Loading system/bta/hh/bta_hh_act.cc +4 −4 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ static const char* bta_hh_hid_event_name(uint16_t event); * Returns void * ******************************************************************************/ void bta_hh_api_enable(const tBTA_HH_DATA* p_data) { void bta_hh_api_enable(tBTA_HH_CBACK* p_cback, bool enable_hid, bool enable_hogp) { tBTA_HH_STATUS status = BTA_HH_OK; uint8_t xx; Loading @@ -85,7 +85,7 @@ void bta_hh_api_enable(const tBTA_HH_DATA* p_data) { memset(&bta_hh_cb, 0, sizeof(tBTA_HH_CB)); /* store parameters */ bta_hh_cb.p_cback = p_data->api_enable.p_cback; bta_hh_cb.p_cback = p_cback; /* initialize device CB */ for (xx = 0; xx < BTA_HH_MAX_DEVICE; xx++) { bta_hh_cb.kdev[xx].state = BTA_HH_IDLE_ST; Loading @@ -98,14 +98,14 @@ void bta_hh_api_enable(const tBTA_HH_DATA* p_data) { bta_hh_cb.cb_index[xx] = BTA_HH_IDX_INVALID; } if (p_data->api_enable.enable_hid) { if (enable_hid) { /* Register with L2CAP */ if (HID_HostRegister(bta_hh_cback) != HID_SUCCESS) { status = BTA_HH_ERR; } } if (status == BTA_HH_OK && p_data->api_enable.enable_hogp) { if (status == BTA_HH_OK && enable_hogp) { bta_hh_le_enable(); } else { /* signal BTA call back event */ Loading system/bta/hh/bta_hh_api.cc +1 −13 Original line number Diff line number Diff line Loading @@ -59,19 +59,7 @@ void BTA_HhEnable(tBTA_HH_CBACK* p_cback, bool enable_hid, bool enable_hogp) { bta_sys_register(BTA_ID_HH, &bta_hh_reg); post_on_bt_main([p_cback, enable_hid, enable_hogp]() { tBTA_HH_DATA data = { .api_enable = { .hdr = { .event = BTA_HH_API_ENABLE_EVT, }, .p_cback = p_cback, .enable_hid = enable_hid, .enable_hogp = enable_hogp, }, }; bta_hh_api_enable(&data); bta_hh_api_enable(p_cback, enable_hid, enable_hogp); }); } Loading system/bta/hh/bta_hh_int.h +3 −18 Original line number Diff line number Diff line Loading @@ -53,15 +53,10 @@ enum tBTA_HH_INT_EVT : uint16_t { BTA_HH_GATT_OPEN_EVT, BTA_HH_START_ENC_EVT, BTA_HH_ENC_CMPL_EVT, BTA_HH_GATT_ENC_CMPL_EVT, /* not handled by execute state machine */ BTA_HH_API_ENABLE_EVT, BTA_HH_API_DISABLE_EVT, BTA_HH_DISC_CMPL_EVT BTA_HH_GATT_ENC_CMPL_EVT }; /* HID host internal events */ #define BTA_HH_INVALID_EVT (BTA_HH_DISC_CMPL_EVT + 1) #define BTA_HH_INVALID_EVT (BTA_HH_GATT_ENC_CMPL_EVT + 1) /* state machine states */ enum { Loading @@ -86,15 +81,6 @@ typedef struct { BT_HDR* p_data; } tBTA_HH_CMD_DATA; /* data type for BTA_HH_API_ENABLE_EVT */ typedef struct { BT_HDR_RIGID hdr; uint8_t service_name[BTA_SERVICE_NAME_LEN + 1]; tBTA_HH_CBACK* p_cback; bool enable_hid; bool enable_hogp; } tBTA_HH_API_ENABLE; typedef struct { BT_HDR_RIGID hdr; RawAddress bd_addr; Loading Loading @@ -134,7 +120,6 @@ typedef struct { /* union of all event data types */ typedef union { BT_HDR_RIGID hdr; tBTA_HH_API_ENABLE api_enable; tBTA_HH_API_CONN api_conn; tBTA_HH_CMD_DATA api_sndcmd; tBTA_HH_CBACK_DATA hid_cback; Loading Loading @@ -301,7 +286,7 @@ extern void bta_hh_cleanup_disable(tBTA_HH_STATUS status); extern uint8_t bta_hh_dev_handle_to_cb_idx(uint8_t dev_handle); /* action functions used outside state machine */ extern void bta_hh_api_enable(const tBTA_HH_DATA* p_data); extern void bta_hh_api_enable(tBTA_HH_CBACK* p_cback, bool enable_hid, bool enable_hogp); extern void bta_hh_api_disable(void); extern void bta_hh_disc_cmpl(void); Loading system/bta/hh/bta_hh_main.cc +32 −54 Original line number Diff line number Diff line Loading @@ -303,20 +303,6 @@ bool bta_hh_hdl_event(BT_HDR_RIGID* p_msg) { uint8_t index = BTA_HH_IDX_INVALID; tBTA_HH_DEV_CB* p_cb = NULL; switch (p_msg->event) { case BTA_HH_API_ENABLE_EVT: bta_hh_api_enable((tBTA_HH_DATA*)p_msg); break; case BTA_HH_API_DISABLE_EVT: bta_hh_api_disable(); break; case BTA_HH_DISC_CMPL_EVT: /* disable complete */ bta_hh_disc_cmpl(); break; default: /* all events processed in state machine need to find corresponding CB before proceed */ if (p_msg->event == BTA_HH_API_OPEN_EVT) { Loading @@ -325,8 +311,7 @@ bool bta_hh_hdl_event(BT_HDR_RIGID* p_msg) { /* if add device */ if (((tBTA_HH_MAINT_DEV*)p_msg)->sub_event == BTA_HH_ADD_DEV_EVT) { index = bta_hh_find_cb(((tBTA_HH_MAINT_DEV*)p_msg)->bda); } else /* else remove device by handle */ { } else /* else remove device by handle */ { index = bta_hh_dev_handle_to_cb_idx((uint8_t)p_msg->layer_specific); /* If BT disable is done while the HID device is connected and * Link_Key uses unauthenticated combination Loading @@ -338,22 +323,21 @@ bool bta_hh_hdl_event(BT_HDR_RIGID* p_msg) { * treat this as a NULL p_cb. Hence we * force the index to be IDX_INVALID */ if ((index != BTA_HH_IDX_INVALID) && (!bta_hh_cb.kdev[index].in_use)) { if ((index != BTA_HH_IDX_INVALID) && (!bta_hh_cb.kdev[index].in_use)) { index = BTA_HH_IDX_INVALID; } } } else if (p_msg->event == BTA_HH_INT_OPEN_EVT) { index = bta_hh_find_cb(((tBTA_HH_CBACK_DATA*)p_msg)->addr); } else } else { index = bta_hh_dev_handle_to_cb_idx((uint8_t)p_msg->layer_specific); } if (index != BTA_HH_IDX_INVALID) p_cb = &bta_hh_cb.kdev[index]; APPL_TRACE_DEBUG("bta_hh_hdl_event:: handle = %d dev_cb[%d] ", p_msg->layer_specific, index); APPL_TRACE_DEBUG("bta_hh_hdl_event:: handle = %d dev_cb[%d] ", p_msg->layer_specific, index); bta_hh_sm_execute(p_cb, p_msg->event, (tBTA_HH_DATA*)p_msg); } return (true); } Loading @@ -371,10 +355,6 @@ bool bta_hh_hdl_event(BT_HDR_RIGID* p_msg) { ******************************************************************************/ static const char* bta_hh_evt_code(tBTA_HH_INT_EVT evt_code) { switch (evt_code) { case BTA_HH_API_DISABLE_EVT: return "BTA_HH_API_DISABLE_EVT"; case BTA_HH_API_ENABLE_EVT: return "BTA_HH_API_ENABLE_EVT"; case BTA_HH_API_OPEN_EVT: return "BTA_HH_API_OPEN_EVT"; case BTA_HH_API_CLOSE_EVT: Loading @@ -393,8 +373,6 @@ static const char* bta_hh_evt_code(tBTA_HH_INT_EVT evt_code) { return "BTA_HH_API_WRITE_DEV_EVT"; case BTA_HH_SDP_CMPL_EVT: return "BTA_HH_SDP_CMPL_EVT"; case BTA_HH_DISC_CMPL_EVT: return "BTA_HH_DISC_CMPL_EVT"; case BTA_HH_API_MAINT_DEV_EVT: return "BTA_HH_API_MAINT_DEV_EVT"; case BTA_HH_API_GET_DSCP_EVT: Loading Loading
system/bta/hh/bta_hh_act.cc +4 −4 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ static const char* bta_hh_hid_event_name(uint16_t event); * Returns void * ******************************************************************************/ void bta_hh_api_enable(const tBTA_HH_DATA* p_data) { void bta_hh_api_enable(tBTA_HH_CBACK* p_cback, bool enable_hid, bool enable_hogp) { tBTA_HH_STATUS status = BTA_HH_OK; uint8_t xx; Loading @@ -85,7 +85,7 @@ void bta_hh_api_enable(const tBTA_HH_DATA* p_data) { memset(&bta_hh_cb, 0, sizeof(tBTA_HH_CB)); /* store parameters */ bta_hh_cb.p_cback = p_data->api_enable.p_cback; bta_hh_cb.p_cback = p_cback; /* initialize device CB */ for (xx = 0; xx < BTA_HH_MAX_DEVICE; xx++) { bta_hh_cb.kdev[xx].state = BTA_HH_IDLE_ST; Loading @@ -98,14 +98,14 @@ void bta_hh_api_enable(const tBTA_HH_DATA* p_data) { bta_hh_cb.cb_index[xx] = BTA_HH_IDX_INVALID; } if (p_data->api_enable.enable_hid) { if (enable_hid) { /* Register with L2CAP */ if (HID_HostRegister(bta_hh_cback) != HID_SUCCESS) { status = BTA_HH_ERR; } } if (status == BTA_HH_OK && p_data->api_enable.enable_hogp) { if (status == BTA_HH_OK && enable_hogp) { bta_hh_le_enable(); } else { /* signal BTA call back event */ Loading
system/bta/hh/bta_hh_api.cc +1 −13 Original line number Diff line number Diff line Loading @@ -59,19 +59,7 @@ void BTA_HhEnable(tBTA_HH_CBACK* p_cback, bool enable_hid, bool enable_hogp) { bta_sys_register(BTA_ID_HH, &bta_hh_reg); post_on_bt_main([p_cback, enable_hid, enable_hogp]() { tBTA_HH_DATA data = { .api_enable = { .hdr = { .event = BTA_HH_API_ENABLE_EVT, }, .p_cback = p_cback, .enable_hid = enable_hid, .enable_hogp = enable_hogp, }, }; bta_hh_api_enable(&data); bta_hh_api_enable(p_cback, enable_hid, enable_hogp); }); } Loading
system/bta/hh/bta_hh_int.h +3 −18 Original line number Diff line number Diff line Loading @@ -53,15 +53,10 @@ enum tBTA_HH_INT_EVT : uint16_t { BTA_HH_GATT_OPEN_EVT, BTA_HH_START_ENC_EVT, BTA_HH_ENC_CMPL_EVT, BTA_HH_GATT_ENC_CMPL_EVT, /* not handled by execute state machine */ BTA_HH_API_ENABLE_EVT, BTA_HH_API_DISABLE_EVT, BTA_HH_DISC_CMPL_EVT BTA_HH_GATT_ENC_CMPL_EVT }; /* HID host internal events */ #define BTA_HH_INVALID_EVT (BTA_HH_DISC_CMPL_EVT + 1) #define BTA_HH_INVALID_EVT (BTA_HH_GATT_ENC_CMPL_EVT + 1) /* state machine states */ enum { Loading @@ -86,15 +81,6 @@ typedef struct { BT_HDR* p_data; } tBTA_HH_CMD_DATA; /* data type for BTA_HH_API_ENABLE_EVT */ typedef struct { BT_HDR_RIGID hdr; uint8_t service_name[BTA_SERVICE_NAME_LEN + 1]; tBTA_HH_CBACK* p_cback; bool enable_hid; bool enable_hogp; } tBTA_HH_API_ENABLE; typedef struct { BT_HDR_RIGID hdr; RawAddress bd_addr; Loading Loading @@ -134,7 +120,6 @@ typedef struct { /* union of all event data types */ typedef union { BT_HDR_RIGID hdr; tBTA_HH_API_ENABLE api_enable; tBTA_HH_API_CONN api_conn; tBTA_HH_CMD_DATA api_sndcmd; tBTA_HH_CBACK_DATA hid_cback; Loading Loading @@ -301,7 +286,7 @@ extern void bta_hh_cleanup_disable(tBTA_HH_STATUS status); extern uint8_t bta_hh_dev_handle_to_cb_idx(uint8_t dev_handle); /* action functions used outside state machine */ extern void bta_hh_api_enable(const tBTA_HH_DATA* p_data); extern void bta_hh_api_enable(tBTA_HH_CBACK* p_cback, bool enable_hid, bool enable_hogp); extern void bta_hh_api_disable(void); extern void bta_hh_disc_cmpl(void); Loading
system/bta/hh/bta_hh_main.cc +32 −54 Original line number Diff line number Diff line Loading @@ -303,20 +303,6 @@ bool bta_hh_hdl_event(BT_HDR_RIGID* p_msg) { uint8_t index = BTA_HH_IDX_INVALID; tBTA_HH_DEV_CB* p_cb = NULL; switch (p_msg->event) { case BTA_HH_API_ENABLE_EVT: bta_hh_api_enable((tBTA_HH_DATA*)p_msg); break; case BTA_HH_API_DISABLE_EVT: bta_hh_api_disable(); break; case BTA_HH_DISC_CMPL_EVT: /* disable complete */ bta_hh_disc_cmpl(); break; default: /* all events processed in state machine need to find corresponding CB before proceed */ if (p_msg->event == BTA_HH_API_OPEN_EVT) { Loading @@ -325,8 +311,7 @@ bool bta_hh_hdl_event(BT_HDR_RIGID* p_msg) { /* if add device */ if (((tBTA_HH_MAINT_DEV*)p_msg)->sub_event == BTA_HH_ADD_DEV_EVT) { index = bta_hh_find_cb(((tBTA_HH_MAINT_DEV*)p_msg)->bda); } else /* else remove device by handle */ { } else /* else remove device by handle */ { index = bta_hh_dev_handle_to_cb_idx((uint8_t)p_msg->layer_specific); /* If BT disable is done while the HID device is connected and * Link_Key uses unauthenticated combination Loading @@ -338,22 +323,21 @@ bool bta_hh_hdl_event(BT_HDR_RIGID* p_msg) { * treat this as a NULL p_cb. Hence we * force the index to be IDX_INVALID */ if ((index != BTA_HH_IDX_INVALID) && (!bta_hh_cb.kdev[index].in_use)) { if ((index != BTA_HH_IDX_INVALID) && (!bta_hh_cb.kdev[index].in_use)) { index = BTA_HH_IDX_INVALID; } } } else if (p_msg->event == BTA_HH_INT_OPEN_EVT) { index = bta_hh_find_cb(((tBTA_HH_CBACK_DATA*)p_msg)->addr); } else } else { index = bta_hh_dev_handle_to_cb_idx((uint8_t)p_msg->layer_specific); } if (index != BTA_HH_IDX_INVALID) p_cb = &bta_hh_cb.kdev[index]; APPL_TRACE_DEBUG("bta_hh_hdl_event:: handle = %d dev_cb[%d] ", p_msg->layer_specific, index); APPL_TRACE_DEBUG("bta_hh_hdl_event:: handle = %d dev_cb[%d] ", p_msg->layer_specific, index); bta_hh_sm_execute(p_cb, p_msg->event, (tBTA_HH_DATA*)p_msg); } return (true); } Loading @@ -371,10 +355,6 @@ bool bta_hh_hdl_event(BT_HDR_RIGID* p_msg) { ******************************************************************************/ static const char* bta_hh_evt_code(tBTA_HH_INT_EVT evt_code) { switch (evt_code) { case BTA_HH_API_DISABLE_EVT: return "BTA_HH_API_DISABLE_EVT"; case BTA_HH_API_ENABLE_EVT: return "BTA_HH_API_ENABLE_EVT"; case BTA_HH_API_OPEN_EVT: return "BTA_HH_API_OPEN_EVT"; case BTA_HH_API_CLOSE_EVT: Loading @@ -393,8 +373,6 @@ static const char* bta_hh_evt_code(tBTA_HH_INT_EVT evt_code) { return "BTA_HH_API_WRITE_DEV_EVT"; case BTA_HH_SDP_CMPL_EVT: return "BTA_HH_SDP_CMPL_EVT"; case BTA_HH_DISC_CMPL_EVT: return "BTA_HH_DISC_CMPL_EVT"; case BTA_HH_API_MAINT_DEV_EVT: return "BTA_HH_API_MAINT_DEV_EVT"; case BTA_HH_API_GET_DSCP_EVT: Loading