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

Commit 505bad3b authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Use Bind in BTA_JvFreeChannel

Bug: 68359837
Test: compilation test
Change-Id: I69fdbc9ea8510060736ae522baf865aa2d0c55f2
parent da20887b
Loading
Loading
Loading
Loading
+4 −13
Original line number Diff line number Diff line
@@ -715,19 +715,10 @@ void bta_jv_get_channel_id(
  }
}

/*******************************************************************************
 *
 * Function     bta_jv_free_scn
 *
 * Description  free a SCN
 *
 * Returns      void
 *
 ******************************************************************************/
void bta_jv_free_scn(tBTA_JV_MSG* p_data) {
  uint16_t scn = p_data->free_channel.scn;

  switch (p_data->free_channel.type) {
/** free a SCN */
void bta_jv_free_scn(int32_t type /* One of BTA_JV_CONN_TYPE_ */,
                     uint16_t scn) {
  switch (type) {
    case BTA_JV_CONN_TYPE_RFCOMM: {
      if (scn > 0 && scn <= BTA_JV_MAX_SCN && bta_jv_cb.scn[scn - 1]) {
        /* this scn is used by JV */
+1 −9
Original line number Diff line number Diff line
@@ -167,17 +167,9 @@ tBTA_JV_STATUS BTA_JvGetChannelId(int conn_type, uint32_t id, int32_t channel) {
 *
 ******************************************************************************/
tBTA_JV_STATUS BTA_JvFreeChannel(uint16_t channel, int conn_type) {
  tBTA_JV_API_FREE_CHANNEL* p_msg =
      (tBTA_JV_API_FREE_CHANNEL*)osi_malloc(sizeof(tBTA_JV_API_FREE_CHANNEL));

  APPL_TRACE_API("%s", __func__);

  p_msg->hdr.event = BTA_JV_API_FREE_SCN_EVT;
  p_msg->scn = channel;
  p_msg->type = conn_type;

  bta_sys_sendmsg(p_msg);

  do_in_bta_thread(FROM_HERE, Bind(&bta_jv_free_scn, conn_type, channel));
  return BTA_JV_SUCCESS;
}

+2 −11
Original line number Diff line number Diff line
@@ -36,8 +36,7 @@

enum {
  /* these events are handled by the state machine */
  BTA_JV_API_FREE_SCN_EVT = BTA_SYS_EVT_START(BTA_ID_JV),
  BTA_JV_API_START_DISCOVERY_EVT,
  BTA_JV_API_START_DISCOVERY_EVT = BTA_SYS_EVT_START(BTA_ID_JV),
  BTA_JV_API_CREATE_RECORD_EVT,
  BTA_JV_API_DELETE_RECORD_EVT,
  BTA_JV_API_L2CAP_CONNECT_EVT,
@@ -296,19 +295,11 @@ typedef struct {
  int32_t value_size;
} tBTA_JV_API_ADD_ATTRIBUTE;

/* data type for BTA_JV_API_FREE_SCN_EVT */
typedef struct {
  BT_HDR hdr;
  int32_t type; /* One of BTA_JV_CONN_TYPE_ */
  uint16_t scn;
} tBTA_JV_API_FREE_CHANNEL;

/* union of all data types */
typedef union {
  /* GKI event buffer header */
  BT_HDR hdr;
  tBTA_JV_API_START_DISCOVERY start_discovery;
  tBTA_JV_API_FREE_CHANNEL free_channel;
  tBTA_JV_API_CREATE_RECORD create_record;
  tBTA_JV_API_ADD_ATTRIBUTE add_attr;
  tBTA_JV_API_L2CAP_CONNECT l2cap_connect;
@@ -365,7 +356,7 @@ extern void bta_jv_disable();
extern void bta_jv_get_channel_id(int32_t type, int32_t channel,
                                  uint32_t l2cap_socket_id,
                                  uint32_t rfcomm_slot_id);
extern void bta_jv_free_scn(tBTA_JV_MSG* p_data);
extern void bta_jv_free_scn(int32_t type, uint16_t scn);
extern void bta_jv_start_discovery(tBTA_JV_MSG* p_data);
extern void bta_jv_create_record(tBTA_JV_MSG* p_data);
extern void bta_jv_delete_record(tBTA_JV_MSG* p_data);
+0 −1
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ typedef void (*tBTA_JV_ACTION)(tBTA_JV_MSG* p_data);

/* action function list */
const tBTA_JV_ACTION bta_jv_action[] = {
    bta_jv_free_scn,              /* BTA_JV_API_FREE_SCN_EVT */
    bta_jv_start_discovery,       /* BTA_JV_API_START_DISCOVERY_EVT */
    bta_jv_create_record,         /* BTA_JV_API_CREATE_RECORD_EVT */
    bta_jv_delete_record,         /* BTA_JV_API_DELETE_RECORD_EVT */