Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5734a42c authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Enum-ify bta/dm/bta_dm_int::tBTA_DM_CONN_STATE am: 427c75f2 am: 30f7f552

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1541445

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ieb5e3f9d95c529fe9420d7529df6f01f2149e8f2
parents ead7b8e6 30f7f552
Loading
Loading
Loading
Loading
+23 −4
Original line number Diff line number Diff line
@@ -32,6 +32,12 @@
#include "bta/sys/bta_sys.h"
#include "main/shim/dumpsys.h"

#ifndef CASE_RETURN_TEXT
#define CASE_RETURN_TEXT(code) \
  case code:                   \
    return #code
#endif

/*****************************************************************************
 *  Constants and data types
 ****************************************************************************/
@@ -158,10 +164,21 @@ typedef union {

#define BTA_DM_NUM_PEER_DEVICE 7

#define BTA_DM_NOT_CONNECTED 0
#define BTA_DM_CONNECTED 1
#define BTA_DM_UNPAIRING 2
typedef uint8_t tBTA_DM_CONN_STATE;
typedef enum : uint8_t {
  BTA_DM_NOT_CONNECTED = 0,
  BTA_DM_CONNECTED = 1,
  BTA_DM_UNPAIRING = 2,
} tBTA_DM_CONN_STATE;

inline std::string bta_conn_state_text(tBTA_DM_CONN_STATE state) {
  switch (state) {
    CASE_RETURN_TEXT(BTA_DM_NOT_CONNECTED);
    CASE_RETURN_TEXT(BTA_DM_CONNECTED);
    CASE_RETURN_TEXT(BTA_DM_UNPAIRING);
    default:
      return std::string("UNKNOWN");
  }
}

typedef enum : uint8_t {
  BTA_DM_DI_NONE = 0x00,      /* nothing special */
@@ -528,4 +545,6 @@ void bta_dm_search_set_state(uint8_t state);

void bta_dm_eir_update_uuid(uint16_t uuid16, bool adding);
void bta_dm_eir_update_cust_uuid(const tBTA_CUSTOM_UUID &curr, bool adding);

#undef CASE_RETURN_TEXT
#endif /* BTA_DM_INT_H */