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

Commit ff717cb5 authored by Vishwath Mohan's avatar Vishwath Mohan
Browse files

Fix callback type mismatches in Bluetooth

This CL fixes some mismatches between defined callback signatures and
the signatures of the functions that are actually passed in as that
type.

Bug: 67507323
Test: lunch walleye_cfi && m -j50

Change-Id: Ia5c22ac614c34cc8bd8a370861d988bb9f8034a6
parent 9ab8623b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -195,7 +195,7 @@ void bta_ag_start_open(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data) {
    /* Let the incoming connection goes through.                        */
    /* Issue collision for this scb for now.                            */
    /* We will decide what to do when we find incoming connetion later. */
    bta_ag_collision_cback(0, BTA_ID_AG, 0, &p_scb->peer_addr);
    bta_ag_collision_cback(0, BTA_ID_AG, 0, p_scb->peer_addr);
    return;
  }

+10 −8
Original line number Diff line number Diff line
@@ -129,24 +129,26 @@ void bta_ag_process_at(tBTA_AG_AT_CB* p_cb) {
        if (int_arg < (int16_t)p_cb->p_at_tbl[idx].min ||
            int_arg > (int16_t)p_cb->p_at_tbl[idx].max) {
          /* arg out of range; error */
          (*p_cb->p_err_cback)(p_cb->p_user, false, NULL);
          (*p_cb->p_err_cback)((tBTA_AG_SCB*)p_cb->p_user, false, NULL);
        } else {
          (*p_cb->p_cmd_cback)(p_cb->p_user, p_cb->p_at_tbl[idx].command_id,
                               arg_type, p_arg, int_arg);
          (*p_cb->p_cmd_cback)((tBTA_AG_SCB*)p_cb->p_user,
                               p_cb->p_at_tbl[idx].command_id, arg_type, p_arg,
                               int_arg);
        }
      } else {
        (*p_cb->p_cmd_cback)(p_cb->p_user, p_cb->p_at_tbl[idx].command_id,
                             arg_type, p_arg, int_arg);
        (*p_cb->p_cmd_cback)((tBTA_AG_SCB*)p_cb->p_user,
                             p_cb->p_at_tbl[idx].command_id, arg_type, p_arg,
                             int_arg);
      }
    }
    /* else error */
    else {
      (*p_cb->p_err_cback)(p_cb->p_user, false, NULL);
      (*p_cb->p_err_cback)((tBTA_AG_SCB*)p_cb->p_user, false, NULL);
    }
  }
  /* else no match call error callback */
  else {
    (*p_cb->p_err_cback)(p_cb->p_user, true, p_cb->p_cmd_buf);
    (*p_cb->p_err_cback)((tBTA_AG_SCB*)p_cb->p_user, true, p_cb->p_cmd_buf);
  }
}

@@ -197,7 +199,7 @@ void bta_ag_at_parse(tBTA_AG_AT_CB* p_cb, char* p_buf, uint16_t len) {
      } else if (p_cb->p_cmd_buf[p_cb->cmd_pos] == 0x1A ||
                 p_cb->p_cmd_buf[p_cb->cmd_pos] == 0x1B) {
        p_cb->p_cmd_buf[++p_cb->cmd_pos] = 0;
        (*p_cb->p_err_cback)(p_cb->p_user, true, p_cb->p_cmd_buf);
        (*p_cb->p_err_cback)((tBTA_AG_SCB*)p_cb->p_user, true, p_cb->p_cmd_buf);
        p_cb->cmd_pos = 0;
      } else {
        ++p_cb->cmd_pos;
+4 −2
Original line number Diff line number Diff line
@@ -54,12 +54,14 @@ typedef struct {
} tBTA_AG_AT_CMD;

/* callback function executed when command is parsed */
typedef void(tBTA_AG_AT_CMD_CBACK)(void* p_user, uint16_t command_id,
struct tBTA_AG_SCB;
typedef void(tBTA_AG_AT_CMD_CBACK)(tBTA_AG_SCB* p_user, uint16_t command_id,
                                   uint8_t arg_type, char* p_arg,
                                   int16_t int_arg);

/* callback function executed to send "ERROR" result code */
typedef void(tBTA_AG_AT_ERR_CBACK)(void* p_user, bool unknown, char* p_arg);
typedef void(tBTA_AG_AT_ERR_CBACK)(tBTA_AG_SCB* p_user, bool unknown,
                                   char* p_arg);

/* AT command parsing control block */
typedef struct {
+3 −3
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ typedef enum {
} tBTA_AG_SCO_MSBC_SETTINGS;

/* type for each service control block */
typedef struct {
struct tBTA_AG_SCB {
  char clip[BTA_AG_AT_MAX_LEN + 1];     /* number string used for CLIP */
  uint16_t serv_handle[BTA_AG_NUM_IDX]; /* RFCOMM server handles */
  tBTA_AG_AT_CB at_cb;                  /* AT command interpreter */
@@ -278,7 +278,7 @@ typedef struct {
  tBTA_AG_HF_IND
      local_hf_indicators[BTA_AG_MAX_NUM_LOCAL_HF_IND]; /* Local supported
                                                    HF indicators */
} tBTA_AG_SCB;
};

/* type for sco data */
typedef struct {
@@ -332,7 +332,7 @@ extern void bta_ag_sm_execute(tBTA_AG_SCB* p_scb, uint16_t event,
                              tBTA_AG_DATA* p_data);
extern bool bta_ag_hdl_event(BT_HDR* p_msg);
extern void bta_ag_collision_cback(tBTA_SYS_CONN_STATUS status, uint8_t id,
                                   uint8_t app_id, const RawAddress* peer_addr);
                                   uint8_t app_id, const RawAddress& peer_addr);
extern void bta_ag_resume_open(tBTA_AG_SCB* p_scb);

/* SDP functions */
+2 −2
Original line number Diff line number Diff line
@@ -510,12 +510,12 @@ static void bta_ag_collision_timer_cback(void* data) {
 ******************************************************************************/
void bta_ag_collision_cback(UNUSED_ATTR tBTA_SYS_CONN_STATUS status, uint8_t id,
                            UNUSED_ATTR uint8_t app_id,
                            const RawAddress* peer_addr) {
                            const RawAddress& peer_addr) {
  uint16_t handle;
  tBTA_AG_SCB* p_scb;

  /* Check if we have opening scb for the peer device. */
  handle = bta_ag_idx_by_bdaddr(peer_addr);
  handle = bta_ag_idx_by_bdaddr(&peer_addr);
  p_scb = bta_ag_scb_by_idx(handle);

  if (p_scb && (p_scb->state == BTA_AG_OPENING_ST)) {
Loading