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

Commit fcf822d5 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Replace BD_ADDR with bt_addr_t in MCE related code

Test: compilation test
Change-Id: Icfb69cafa55bcd0f4e0146577deb05bb881672cd
parent 9383fc7c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ typedef struct {
/* data associated with BTA_MCE_MAS_DISCOVERY_COMP_EVT */
typedef struct {
  tBTA_MCE_STATUS status;
  BD_ADDR remote_addr;
  bt_bdaddr_t remote_addr;
  int num_mas;
  tBTA_MCE_MAS_INFO mas[BTA_MCE_MAX_MAS_INSTANCES];
} tBTA_MCE_MAS_DISCOVERY_COMP;
@@ -116,6 +116,6 @@ extern tBTA_MCE_STATUS BTA_MceEnable(tBTA_MCE_DM_CBACK* p_cback);
 *                  BTA_MCE_FAILURE, otherwise.
 *
 ******************************************************************************/
extern tBTA_MCE_STATUS BTA_MceGetRemoteMasInstances(BD_ADDR bd_addr);
extern tBTA_MCE_STATUS BTA_MceGetRemoteMasInstances(const bt_bdaddr_t& bd_addr);

#endif /* BTA_MCE_API_H */
+5 −5
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ static void bta_mce_search_cback(uint16_t result, void* user_data) {
  if (bta_mce_cb.p_dm_cback == NULL) return;

  evt_data.status = BTA_MCE_FAILURE;
  bdcpy(evt_data.remote_addr, bta_mce_cb.remote_addr);
  evt_data.remote_addr = bta_mce_cb.remote_addr;
  evt_data.num_mas = 0;

  if (result == SDP_SUCCESS || result == SDP_DB_FULL) {
@@ -159,13 +159,13 @@ void bta_mce_get_remote_mas_instances(tBTA_MCE_MSG* p_data) {
  }

  bta_mce_cb.sdp_active = BTA_MCE_SDP_ACT_YES;
  bdcpy(bta_mce_cb.remote_addr, p_data->get_rmt_mas.bd_addr);
  bta_mce_cb.remote_addr = p_data->get_rmt_mas.bd_addr;

  SDP_InitDiscoveryDb(p_bta_mce_cfg->p_sdp_db, p_bta_mce_cfg->sdp_db_size, 1,
                      (tBT_UUID*)&bta_mce_mas_uuid, 0, NULL);

  if (!SDP_ServiceSearchAttributeRequest2(
          from_BD_ADDR(p_data->get_rmt_mas.bd_addr), p_bta_mce_cfg->p_sdp_db,
  if (!SDP_ServiceSearchAttributeRequest2(p_data->get_rmt_mas.bd_addr,
                                          p_bta_mce_cfg->p_sdp_db,
                                          bta_mce_search_cback, NULL)) {
    bta_mce_cb.sdp_active = BTA_MCE_SDP_ACT_NONE;

+2 −2
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ tBTA_MCE_STATUS BTA_MceEnable(tBTA_MCE_DM_CBACK* p_cback) {
 *                  BTA_MCE_FAILURE, otherwise.
 *
 ******************************************************************************/
tBTA_MCE_STATUS BTA_MceGetRemoteMasInstances(BD_ADDR bd_addr) {
tBTA_MCE_STATUS BTA_MceGetRemoteMasInstances(const bt_bdaddr_t& bd_addr) {
  tBTA_MCE_API_GET_REMOTE_MAS_INSTANCES* p_msg =
      (tBTA_MCE_API_GET_REMOTE_MAS_INSTANCES*)osi_malloc(
          sizeof(tBTA_MCE_API_GET_REMOTE_MAS_INSTANCES));
@@ -99,7 +99,7 @@ tBTA_MCE_STATUS BTA_MceGetRemoteMasInstances(BD_ADDR bd_addr) {
  APPL_TRACE_API("%s", __func__);

  p_msg->hdr.event = BTA_MCE_API_GET_REMOTE_MAS_INSTANCES_EVT;
  bdcpy(p_msg->bd_addr, bd_addr);
  p_msg->bd_addr = bd_addr;

  bta_sys_sendmsg(p_msg);

+2 −2
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ typedef struct {
/* data type for BTA_MCE_API_GET_REMOTE_MAS_INSTANCES_EVT */
typedef struct {
  BT_HDR hdr;
  BD_ADDR bd_addr;
  bt_bdaddr_t bd_addr;
} tBTA_MCE_API_GET_REMOTE_MAS_INSTANCES;

/* union of all data types */
@@ -63,7 +63,7 @@ typedef union {
/* MCE control block */
typedef struct {
  uint8_t sdp_active; /* see BTA_MCE_SDP_ACT_* */
  BD_ADDR remote_addr;
  bt_bdaddr_t remote_addr;
  tBTA_MCE_DM_CBACK* p_dm_cback;
} tBTA_MCE_CB;

+3 −8
Original line number Diff line number Diff line
@@ -51,7 +51,6 @@ static btmce_callbacks_t* bt_mce_callbacks = NULL;
static void btif_mce_mas_discovery_comp_evt(uint16_t event, char* p_param) {
  tBTA_MCE_MAS_DISCOVERY_COMP* evt_data = (tBTA_MCE_MAS_DISCOVERY_COMP*)p_param;
  btmce_mas_instance_t insts[BTA_MCE_MAX_MAS_INSTANCES];
  bt_bdaddr_t addr;
  int i;

  BTIF_TRACE_EVENT("%s:  event = %d", __func__, event);
@@ -65,8 +64,7 @@ static void btif_mce_mas_discovery_comp_evt(uint16_t event, char* p_param) {
    insts[i].p_name = evt_data->mas[i].p_srv_name;
  }

  bdcpy(addr.address, evt_data->remote_addr);

  bt_bdaddr_t addr = evt_data->remote_addr;
  HAL_CBACK(bt_mce_callbacks, remote_mas_instances_cb,
            (bt_status_t)evt_data->status, &addr, evt_data->num_mas, insts);
}
@@ -128,12 +126,9 @@ static bt_status_t init(btmce_callbacks_t* callbacks) {
}

static bt_status_t get_remote_mas_instances(bt_bdaddr_t* bd_addr) {
  bdstr_t bdstr;

  BTIF_TRACE_EVENT("%s: remote_addr=%s", __func__,
                   bdaddr_to_string(bd_addr, bdstr, sizeof(bdstr)));
  VLOG(2) << __func__ << ": remote_addr=" << bd_addr;

  BTA_MceGetRemoteMasInstances(bd_addr->address);
  BTA_MceGetRemoteMasInstances(*bd_addr);

  return BT_STATUS_SUCCESS;
}