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

Commit 70e20af6 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Enum-ify bta/include/bta_api::tBTA_PREF_ROLES am: a252d61f am: cc3e2632

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6a9524c4543ef64a2d929bfea0f3e8bde80c7777
parents 3d37ff62 cc3e2632
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -2487,8 +2487,7 @@ void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, uint8_t id, uint8_t app_id,
        if (((p_bta_dm_rm_cfg[j].app_id == app_id) ||
        if (((p_bta_dm_rm_cfg[j].app_id == app_id) ||
             (p_bta_dm_rm_cfg[j].app_id == BTA_ALL_APP_ID)) &&
             (p_bta_dm_rm_cfg[j].app_id == BTA_ALL_APP_ID)) &&
            (p_bta_dm_rm_cfg[j].id == id)) {
            (p_bta_dm_rm_cfg[j].id == id)) {
          role = p_bta_dm_rm_cfg[j].cfg;
          role = toBTA_PREF_ROLES(p_bta_dm_rm_cfg[j].cfg);

          if (role > p_dev->pref_role) p_dev->pref_role = role;
          if (role > p_dev->pref_role) p_dev->pref_role = role;
          break;
          break;
        }
        }
+15 −8
Original line number Original line Diff line number Diff line
@@ -119,14 +119,21 @@ typedef uint16_t


typedef uint16_t tBTA_DM_CONN;
typedef uint16_t tBTA_DM_CONN;


/* M/S preferred roles */
/* Central/peripheral preferred roles */
#define BTA_ANY_ROLE 0x00
typedef enum : uint8_t {
#define BTA_CENTRAL_ROLE_PREF 0x01
  BTA_ANY_ROLE = 0x00,
#define BTA_CENTRAL_ROLE_ONLY 0x02
  BTA_CENTRAL_ROLE_PREF = 0x01,
#define BTA_PERIPHERAL_ROLE_ONLY \
  BTA_CENTRAL_ROLE_ONLY = 0x02,
  0x03 /* Used for PANU only, skip role switch to central */
  /* Used for PANU only, skip role switch to central */

  BTA_PERIPHERAL_ROLE_ONLY = 0x03,
typedef uint8_t tBTA_PREF_ROLES;
} tBTA_PREF_ROLES;

inline tBTA_PREF_ROLES toBTA_PREF_ROLES(uint8_t role) {
  ASSERT_LOG(role <= BTA_PERIPHERAL_ROLE_ONLY,
             "Passing illegal preferred role:0x%02x [0x%02x<=>0x%02x]", role,
             BTA_ANY_ROLE, BTA_PERIPHERAL_ROLE_ONLY);
  return static_cast<tBTA_PREF_ROLES>(role);
}


inline std::string preferred_role_text(const tBTA_PREF_ROLES& role) {
inline std::string preferred_role_text(const tBTA_PREF_ROLES& role) {
  switch (role) {
  switch (role) {