Loading system/bta/hh/bta_hh_act.cc +2 −1 Original line number Original line Diff line number Diff line Loading @@ -932,6 +932,7 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) { #if (BTA_HH_LE_INCLUDED == TRUE) #if (BTA_HH_LE_INCLUDED == TRUE) if (bta_hh_is_le_device(p_cb, p_data->api_conn.bd_addr)) { if (bta_hh_is_le_device(p_cb, p_data->api_conn.bd_addr)) { dev_info.handle = bta_hh_le_add_device(p_cb, p_dev_info); dev_info.handle = bta_hh_le_add_device(p_cb, p_dev_info); if (dev_info.handle != BTA_HH_INVALID_HANDLE) dev_info.status = BTA_HH_OK; dev_info.status = BTA_HH_OK; } else } else #endif #endif Loading system/bta/hh/bta_hh_int.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -284,7 +284,7 @@ typedef struct { uint8_t cb_index[BTA_HH_MAX_KNOWN]; /* maintain a CB index uint8_t cb_index[BTA_HH_MAX_KNOWN]; /* maintain a CB index map to dev handle */ map to dev handle */ #if (BTA_HH_LE_INCLUDED == TRUE) #if (BTA_HH_LE_INCLUDED == TRUE) uint8_t le_cb_index[BTA_HH_MAX_DEVICE]; /* maintain a CB index map to LE dev uint8_t le_cb_index[BTA_HH_LE_MAX_KNOWN]; /* maintain a CB index map to LE dev handle */ handle */ tGATT_IF gatt_if; tGATT_IF gatt_if; #endif #endif Loading system/bta/hh/bta_hh_le.cc +39 −4 Original line number Original line Diff line number Diff line Loading @@ -324,7 +324,7 @@ void bta_hh_le_enable(void) { bta_hh_cb.gatt_if = BTA_GATTS_INVALID_IF; bta_hh_cb.gatt_if = BTA_GATTS_INVALID_IF; for (xx = 0; xx < BTA_HH_MAX_DEVICE; xx++) for (xx = 0; xx < ARRAY_SIZE(bta_hh_cb.le_cb_index); xx++) bta_hh_cb.le_cb_index[xx] = BTA_HH_IDX_INVALID; bta_hh_cb.le_cb_index[xx] = BTA_HH_IDX_INVALID; BTA_GATTC_AppRegister(bta_hh_gattc_callback, BTA_GATTC_AppRegister(bta_hh_gattc_callback, Loading Loading @@ -385,6 +385,28 @@ bool bta_hh_is_le_device(tBTA_HH_DEV_CB* p_cb, const RawAddress& remote_bda) { return p_cb->is_le_device; return p_cb->is_le_device; } } /****************************************************************************** * * Function bta_hh_le_get_le_cb * * Description Allocate bta_hh_cb.le_cb_index * * Parameters: * ******************************************************************************/ uint8_t bta_hh_le_get_le_dev_hdl(uint8_t cb_index) { uint8_t i; for (i = 0; i < ARRAY_SIZE(bta_hh_cb.le_cb_index); i++) { if (bta_hh_cb.le_cb_index[i] == cb_index) return BTA_HH_GET_LE_DEV_HDL(i); } for (i = 0; i < ARRAY_SIZE(bta_hh_cb.le_cb_index); i++) { if (bta_hh_cb.le_cb_index[i] == BTA_HH_IDX_INVALID) return BTA_HH_GET_LE_DEV_HDL(i); } return BTA_HH_IDX_INVALID; } /******************************************************************************* /******************************************************************************* * * * Function bta_hh_le_open_conn * Function bta_hh_le_open_conn Loading @@ -395,8 +417,15 @@ bool bta_hh_is_le_device(tBTA_HH_DEV_CB* p_cb, const RawAddress& remote_bda) { * * ******************************************************************************/ ******************************************************************************/ void bta_hh_le_open_conn(tBTA_HH_DEV_CB* p_cb, const RawAddress& remote_bda) { void bta_hh_le_open_conn(tBTA_HH_DEV_CB* p_cb, const RawAddress& remote_bda) { tBTA_HH_STATUS status = BTA_HH_ERR_NO_RES; /* update cb_index[] map */ /* update cb_index[] map */ p_cb->hid_handle = BTA_HH_GET_LE_DEV_HDL(p_cb->index); p_cb->hid_handle = bta_hh_le_get_le_dev_hdl(p_cb->index); if (p_cb->hid_handle == BTA_HH_IDX_INVALID) { bta_hh_sm_execute(p_cb, BTA_HH_SDP_CMPL_EVT, (tBTA_HH_DATA*)&status); return; } p_cb->addr = remote_bda; p_cb->addr = remote_bda; bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = p_cb->index; bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = p_cb->index; p_cb->in_use = true; p_cb->in_use = true; Loading Loading @@ -1271,10 +1300,15 @@ void bta_hh_gatt_open(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_buf) { ((p2[4]) << 8) + p2[5], p_data->status); ((p2[4]) << 8) + p2[5], p_data->status); if (p_data->status == GATT_SUCCESS) { if (p_data->status == GATT_SUCCESS) { p_cb->hid_handle = bta_hh_le_get_le_dev_hdl(p_cb->index); if (p_cb->hid_handle == BTA_HH_IDX_INVALID) { p_cb->conn_id = p_data->conn_id; bta_hh_le_api_disc_act(p_cb); return; } p_cb->is_le_device = true; p_cb->is_le_device = true; p_cb->in_use = true; p_cb->in_use = true; p_cb->conn_id = p_data->conn_id; p_cb->conn_id = p_data->conn_id; p_cb->hid_handle = BTA_HH_GET_LE_DEV_HDL(p_cb->index); bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = p_cb->index; bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = p_cb->index; Loading Loading @@ -2113,7 +2147,8 @@ static void bta_hh_le_add_dev_bg_conn(tBTA_HH_DEV_CB* p_cb, bool check_bond) { ******************************************************************************/ ******************************************************************************/ uint8_t bta_hh_le_add_device(tBTA_HH_DEV_CB* p_cb, uint8_t bta_hh_le_add_device(tBTA_HH_DEV_CB* p_cb, tBTA_HH_MAINT_DEV* p_dev_info) { tBTA_HH_MAINT_DEV* p_dev_info) { p_cb->hid_handle = BTA_HH_GET_LE_DEV_HDL(p_cb->index); p_cb->hid_handle = bta_hh_le_get_le_dev_hdl(p_cb->index); if (p_cb->hid_handle == BTA_HH_INVALID_HANDLE) return BTA_HH_INVALID_HANDLE; bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = p_cb->index; bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = p_cb->index; /* update DI information */ /* update DI information */ Loading system/bta/include/bta_hh_api.h +6 −1 Original line number Original line Diff line number Diff line Loading @@ -79,8 +79,13 @@ typedef uint16_t tBTA_HH_EVT; #if (BTA_HH_LE_INCLUDED == TRUE) #if (BTA_HH_LE_INCLUDED == TRUE) /* GATT_MAX_PHY_CHANNEL can not exceed 14 for the design of BTA HH */ /* GATT_MAX_PHY_CHANNEL can not exceed 14 for the design of BTA HH */ #if GATT_MAX_PHY_CHANNEL > 14 #define BTA_HH_LE_MAX_KNOWN 14 #else #define BTA_HH_LE_MAX_KNOWN GATT_MAX_PHY_CHANNEL #define BTA_HH_LE_MAX_KNOWN GATT_MAX_PHY_CHANNEL #define BTA_HH_MAX_DEVICE (HID_HOST_MAX_DEVICES + GATT_MAX_PHY_CHANNEL) #endif #define BTA_HH_MAX_DEVICE (HID_HOST_MAX_DEVICES + BTA_HH_LE_MAX_KNOWN) #else #else #define BTA_HH_MAX_DEVICE HID_HOST_MAX_DEVICES #define BTA_HH_MAX_DEVICE HID_HOST_MAX_DEVICES #endif #endif Loading Loading
system/bta/hh/bta_hh_act.cc +2 −1 Original line number Original line Diff line number Diff line Loading @@ -932,6 +932,7 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) { #if (BTA_HH_LE_INCLUDED == TRUE) #if (BTA_HH_LE_INCLUDED == TRUE) if (bta_hh_is_le_device(p_cb, p_data->api_conn.bd_addr)) { if (bta_hh_is_le_device(p_cb, p_data->api_conn.bd_addr)) { dev_info.handle = bta_hh_le_add_device(p_cb, p_dev_info); dev_info.handle = bta_hh_le_add_device(p_cb, p_dev_info); if (dev_info.handle != BTA_HH_INVALID_HANDLE) dev_info.status = BTA_HH_OK; dev_info.status = BTA_HH_OK; } else } else #endif #endif Loading
system/bta/hh/bta_hh_int.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -284,7 +284,7 @@ typedef struct { uint8_t cb_index[BTA_HH_MAX_KNOWN]; /* maintain a CB index uint8_t cb_index[BTA_HH_MAX_KNOWN]; /* maintain a CB index map to dev handle */ map to dev handle */ #if (BTA_HH_LE_INCLUDED == TRUE) #if (BTA_HH_LE_INCLUDED == TRUE) uint8_t le_cb_index[BTA_HH_MAX_DEVICE]; /* maintain a CB index map to LE dev uint8_t le_cb_index[BTA_HH_LE_MAX_KNOWN]; /* maintain a CB index map to LE dev handle */ handle */ tGATT_IF gatt_if; tGATT_IF gatt_if; #endif #endif Loading
system/bta/hh/bta_hh_le.cc +39 −4 Original line number Original line Diff line number Diff line Loading @@ -324,7 +324,7 @@ void bta_hh_le_enable(void) { bta_hh_cb.gatt_if = BTA_GATTS_INVALID_IF; bta_hh_cb.gatt_if = BTA_GATTS_INVALID_IF; for (xx = 0; xx < BTA_HH_MAX_DEVICE; xx++) for (xx = 0; xx < ARRAY_SIZE(bta_hh_cb.le_cb_index); xx++) bta_hh_cb.le_cb_index[xx] = BTA_HH_IDX_INVALID; bta_hh_cb.le_cb_index[xx] = BTA_HH_IDX_INVALID; BTA_GATTC_AppRegister(bta_hh_gattc_callback, BTA_GATTC_AppRegister(bta_hh_gattc_callback, Loading Loading @@ -385,6 +385,28 @@ bool bta_hh_is_le_device(tBTA_HH_DEV_CB* p_cb, const RawAddress& remote_bda) { return p_cb->is_le_device; return p_cb->is_le_device; } } /****************************************************************************** * * Function bta_hh_le_get_le_cb * * Description Allocate bta_hh_cb.le_cb_index * * Parameters: * ******************************************************************************/ uint8_t bta_hh_le_get_le_dev_hdl(uint8_t cb_index) { uint8_t i; for (i = 0; i < ARRAY_SIZE(bta_hh_cb.le_cb_index); i++) { if (bta_hh_cb.le_cb_index[i] == cb_index) return BTA_HH_GET_LE_DEV_HDL(i); } for (i = 0; i < ARRAY_SIZE(bta_hh_cb.le_cb_index); i++) { if (bta_hh_cb.le_cb_index[i] == BTA_HH_IDX_INVALID) return BTA_HH_GET_LE_DEV_HDL(i); } return BTA_HH_IDX_INVALID; } /******************************************************************************* /******************************************************************************* * * * Function bta_hh_le_open_conn * Function bta_hh_le_open_conn Loading @@ -395,8 +417,15 @@ bool bta_hh_is_le_device(tBTA_HH_DEV_CB* p_cb, const RawAddress& remote_bda) { * * ******************************************************************************/ ******************************************************************************/ void bta_hh_le_open_conn(tBTA_HH_DEV_CB* p_cb, const RawAddress& remote_bda) { void bta_hh_le_open_conn(tBTA_HH_DEV_CB* p_cb, const RawAddress& remote_bda) { tBTA_HH_STATUS status = BTA_HH_ERR_NO_RES; /* update cb_index[] map */ /* update cb_index[] map */ p_cb->hid_handle = BTA_HH_GET_LE_DEV_HDL(p_cb->index); p_cb->hid_handle = bta_hh_le_get_le_dev_hdl(p_cb->index); if (p_cb->hid_handle == BTA_HH_IDX_INVALID) { bta_hh_sm_execute(p_cb, BTA_HH_SDP_CMPL_EVT, (tBTA_HH_DATA*)&status); return; } p_cb->addr = remote_bda; p_cb->addr = remote_bda; bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = p_cb->index; bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = p_cb->index; p_cb->in_use = true; p_cb->in_use = true; Loading Loading @@ -1271,10 +1300,15 @@ void bta_hh_gatt_open(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_buf) { ((p2[4]) << 8) + p2[5], p_data->status); ((p2[4]) << 8) + p2[5], p_data->status); if (p_data->status == GATT_SUCCESS) { if (p_data->status == GATT_SUCCESS) { p_cb->hid_handle = bta_hh_le_get_le_dev_hdl(p_cb->index); if (p_cb->hid_handle == BTA_HH_IDX_INVALID) { p_cb->conn_id = p_data->conn_id; bta_hh_le_api_disc_act(p_cb); return; } p_cb->is_le_device = true; p_cb->is_le_device = true; p_cb->in_use = true; p_cb->in_use = true; p_cb->conn_id = p_data->conn_id; p_cb->conn_id = p_data->conn_id; p_cb->hid_handle = BTA_HH_GET_LE_DEV_HDL(p_cb->index); bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = p_cb->index; bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = p_cb->index; Loading Loading @@ -2113,7 +2147,8 @@ static void bta_hh_le_add_dev_bg_conn(tBTA_HH_DEV_CB* p_cb, bool check_bond) { ******************************************************************************/ ******************************************************************************/ uint8_t bta_hh_le_add_device(tBTA_HH_DEV_CB* p_cb, uint8_t bta_hh_le_add_device(tBTA_HH_DEV_CB* p_cb, tBTA_HH_MAINT_DEV* p_dev_info) { tBTA_HH_MAINT_DEV* p_dev_info) { p_cb->hid_handle = BTA_HH_GET_LE_DEV_HDL(p_cb->index); p_cb->hid_handle = bta_hh_le_get_le_dev_hdl(p_cb->index); if (p_cb->hid_handle == BTA_HH_INVALID_HANDLE) return BTA_HH_INVALID_HANDLE; bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = p_cb->index; bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = p_cb->index; /* update DI information */ /* update DI information */ Loading
system/bta/include/bta_hh_api.h +6 −1 Original line number Original line Diff line number Diff line Loading @@ -79,8 +79,13 @@ typedef uint16_t tBTA_HH_EVT; #if (BTA_HH_LE_INCLUDED == TRUE) #if (BTA_HH_LE_INCLUDED == TRUE) /* GATT_MAX_PHY_CHANNEL can not exceed 14 for the design of BTA HH */ /* GATT_MAX_PHY_CHANNEL can not exceed 14 for the design of BTA HH */ #if GATT_MAX_PHY_CHANNEL > 14 #define BTA_HH_LE_MAX_KNOWN 14 #else #define BTA_HH_LE_MAX_KNOWN GATT_MAX_PHY_CHANNEL #define BTA_HH_LE_MAX_KNOWN GATT_MAX_PHY_CHANNEL #define BTA_HH_MAX_DEVICE (HID_HOST_MAX_DEVICES + GATT_MAX_PHY_CHANNEL) #endif #define BTA_HH_MAX_DEVICE (HID_HOST_MAX_DEVICES + BTA_HH_LE_MAX_KNOWN) #else #else #define BTA_HH_MAX_DEVICE HID_HOST_MAX_DEVICES #define BTA_HH_MAX_DEVICE HID_HOST_MAX_DEVICES #endif #endif Loading