Loading system/bta/gatt/bta_gattc_act.cc +14 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,16 @@ void bta_gattc_disable() { } } /** start an application interface */ void bta_gattc_start_if(uint8_t client_if) { if (!bta_gattc_cl_get_regcb(client_if)) { LOG(ERROR) << "Unable to start app.: Unknown client_if=" << +client_if; return; } GATT_StartIf(client_if); } /** Register a GATT client application with BTA */ void bta_gattc_register(const Uuid& app_uuid, tBTA_GATTC_CBACK* p_cback, BtaAppRegisterCallback cb) { Loading @@ -181,6 +191,10 @@ void bta_gattc_register(const Uuid& app_uuid, tBTA_GATTC_CBACK* p_cback, /* BTA use the same client interface as BTE GATT statck */ client_if = bta_gattc_cb.cl_rcb[i].client_if; do_in_main_thread(FROM_HERE, base::Bind(&bta_gattc_start_if, client_if)); status = GATT_SUCCESS; break; } Loading system/bta/gatt/bta_gatts_act.cc +25 −0 Original line number Diff line number Diff line Loading @@ -214,6 +214,13 @@ void bta_gatts_register(tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg) { GATT_Register(p_msg->api_reg.app_uuid, &bta_gatts_cback); if (!p_cb->rcb[first_unuse].gatt_if) { status = GATT_NO_RESOURCES; } else { tBTA_GATTS_INT_START_IF* p_buf = (tBTA_GATTS_INT_START_IF*)osi_malloc( sizeof(tBTA_GATTS_INT_START_IF)); p_buf->hdr.event = BTA_GATTS_INT_START_IF_EVT; p_buf->server_if = p_cb->rcb[first_unuse].gatt_if; bta_sys_sendmsg(p_buf); } } else { status = GATT_NO_RESOURCES; Loading @@ -224,6 +231,24 @@ void bta_gatts_register(tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg) { (*p_msg->api_reg.p_cback)(BTA_GATTS_REG_EVT, &cb_data); } /******************************************************************************* * * Function bta_gatts_start_if * * Description start an application interface. * * Returns none. * ******************************************************************************/ void bta_gatts_start_if(UNUSED_ATTR tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg) { if (bta_gatts_find_app_rcb_by_app_if(p_msg->int_start_if.server_if)) { GATT_StartIf(p_msg->int_start_if.server_if); } else { LOG(ERROR) << "Unable to start app.: Unknown interface=" << +p_msg->int_start_if.server_if; } } /******************************************************************************* * * Function bta_gatts_deregister Loading system/bta/gatt/bta_gatts_int.h +7 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ ****************************************************************************/ enum { BTA_GATTS_API_REG_EVT = BTA_SYS_EVT_START(BTA_ID_GATTS), BTA_GATTS_INT_START_IF_EVT, BTA_GATTS_API_DEREG_EVT, BTA_GATTS_API_INDICATION_EVT, Loading Loading @@ -66,7 +67,9 @@ typedef struct { typedef struct { BT_HDR hdr; tGATT_IF server_if; } tBTA_GATTS_API_DEREG; } tBTA_GATTS_INT_START_IF; typedef tBTA_GATTS_INT_START_IF tBTA_GATTS_API_DEREG; typedef struct { BT_HDR hdr; Loading Loading @@ -115,6 +118,8 @@ typedef union { tBTA_GATTS_API_RSP api_rsp; tBTA_GATTS_API_OPEN api_open; tBTA_GATTS_API_CANCEL_OPEN api_cancel_open; tBTA_GATTS_INT_START_IF int_start_if; } tBTA_GATTS_DATA; /* application registration control block */ Loading Loading @@ -156,6 +161,7 @@ extern bool bta_gatts_hdl_event(BT_HDR* p_msg); extern void bta_gatts_api_disable(tBTA_GATTS_CB* p_cb); extern void bta_gatts_api_enable(tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_data); extern void bta_gatts_register(tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg); extern void bta_gatts_start_if(tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg); extern void bta_gatts_deregister(tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg); extern void bta_gatts_delete_service(tBTA_GATTS_SRVC_CB* p_srvc_cb, tBTA_GATTS_DATA* p_msg); Loading system/bta/gatt/bta_gatts_main.cc +4 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,10 @@ bool bta_gatts_hdl_event(BT_HDR* p_msg) { bta_gatts_register(p_cb, (tBTA_GATTS_DATA*)p_msg); break; case BTA_GATTS_INT_START_IF_EVT: bta_gatts_start_if(p_cb, (tBTA_GATTS_DATA*)p_msg); break; case BTA_GATTS_API_DEREG_EVT: bta_gatts_deregister(p_cb, (tBTA_GATTS_DATA*)p_msg); break; Loading system/btif/src/btif_gatt_test.cc +1 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,7 @@ bt_status_t btif_gattc_test_command_impl(int command, tmp.fill(0xAE); test_cb.gatt_if = GATT_Register(bluetooth::Uuid::From128BitBE(tmp), &btif_test_callbacks); GATT_StartIf(test_cb.gatt_if); } else { GATT_Deregister(test_cb.gatt_if); test_cb.gatt_if = 0; Loading Loading
system/bta/gatt/bta_gattc_act.cc +14 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,16 @@ void bta_gattc_disable() { } } /** start an application interface */ void bta_gattc_start_if(uint8_t client_if) { if (!bta_gattc_cl_get_regcb(client_if)) { LOG(ERROR) << "Unable to start app.: Unknown client_if=" << +client_if; return; } GATT_StartIf(client_if); } /** Register a GATT client application with BTA */ void bta_gattc_register(const Uuid& app_uuid, tBTA_GATTC_CBACK* p_cback, BtaAppRegisterCallback cb) { Loading @@ -181,6 +191,10 @@ void bta_gattc_register(const Uuid& app_uuid, tBTA_GATTC_CBACK* p_cback, /* BTA use the same client interface as BTE GATT statck */ client_if = bta_gattc_cb.cl_rcb[i].client_if; do_in_main_thread(FROM_HERE, base::Bind(&bta_gattc_start_if, client_if)); status = GATT_SUCCESS; break; } Loading
system/bta/gatt/bta_gatts_act.cc +25 −0 Original line number Diff line number Diff line Loading @@ -214,6 +214,13 @@ void bta_gatts_register(tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg) { GATT_Register(p_msg->api_reg.app_uuid, &bta_gatts_cback); if (!p_cb->rcb[first_unuse].gatt_if) { status = GATT_NO_RESOURCES; } else { tBTA_GATTS_INT_START_IF* p_buf = (tBTA_GATTS_INT_START_IF*)osi_malloc( sizeof(tBTA_GATTS_INT_START_IF)); p_buf->hdr.event = BTA_GATTS_INT_START_IF_EVT; p_buf->server_if = p_cb->rcb[first_unuse].gatt_if; bta_sys_sendmsg(p_buf); } } else { status = GATT_NO_RESOURCES; Loading @@ -224,6 +231,24 @@ void bta_gatts_register(tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg) { (*p_msg->api_reg.p_cback)(BTA_GATTS_REG_EVT, &cb_data); } /******************************************************************************* * * Function bta_gatts_start_if * * Description start an application interface. * * Returns none. * ******************************************************************************/ void bta_gatts_start_if(UNUSED_ATTR tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg) { if (bta_gatts_find_app_rcb_by_app_if(p_msg->int_start_if.server_if)) { GATT_StartIf(p_msg->int_start_if.server_if); } else { LOG(ERROR) << "Unable to start app.: Unknown interface=" << +p_msg->int_start_if.server_if; } } /******************************************************************************* * * Function bta_gatts_deregister Loading
system/bta/gatt/bta_gatts_int.h +7 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ ****************************************************************************/ enum { BTA_GATTS_API_REG_EVT = BTA_SYS_EVT_START(BTA_ID_GATTS), BTA_GATTS_INT_START_IF_EVT, BTA_GATTS_API_DEREG_EVT, BTA_GATTS_API_INDICATION_EVT, Loading Loading @@ -66,7 +67,9 @@ typedef struct { typedef struct { BT_HDR hdr; tGATT_IF server_if; } tBTA_GATTS_API_DEREG; } tBTA_GATTS_INT_START_IF; typedef tBTA_GATTS_INT_START_IF tBTA_GATTS_API_DEREG; typedef struct { BT_HDR hdr; Loading Loading @@ -115,6 +118,8 @@ typedef union { tBTA_GATTS_API_RSP api_rsp; tBTA_GATTS_API_OPEN api_open; tBTA_GATTS_API_CANCEL_OPEN api_cancel_open; tBTA_GATTS_INT_START_IF int_start_if; } tBTA_GATTS_DATA; /* application registration control block */ Loading Loading @@ -156,6 +161,7 @@ extern bool bta_gatts_hdl_event(BT_HDR* p_msg); extern void bta_gatts_api_disable(tBTA_GATTS_CB* p_cb); extern void bta_gatts_api_enable(tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_data); extern void bta_gatts_register(tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg); extern void bta_gatts_start_if(tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg); extern void bta_gatts_deregister(tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg); extern void bta_gatts_delete_service(tBTA_GATTS_SRVC_CB* p_srvc_cb, tBTA_GATTS_DATA* p_msg); Loading
system/bta/gatt/bta_gatts_main.cc +4 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,10 @@ bool bta_gatts_hdl_event(BT_HDR* p_msg) { bta_gatts_register(p_cb, (tBTA_GATTS_DATA*)p_msg); break; case BTA_GATTS_INT_START_IF_EVT: bta_gatts_start_if(p_cb, (tBTA_GATTS_DATA*)p_msg); break; case BTA_GATTS_API_DEREG_EVT: bta_gatts_deregister(p_cb, (tBTA_GATTS_DATA*)p_msg); break; Loading
system/btif/src/btif_gatt_test.cc +1 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,7 @@ bt_status_t btif_gattc_test_command_impl(int command, tmp.fill(0xAE); test_cb.gatt_if = GATT_Register(bluetooth::Uuid::From128BitBE(tmp), &btif_test_callbacks); GATT_StartIf(test_cb.gatt_if); } else { GATT_Deregister(test_cb.gatt_if); test_cb.gatt_if = 0; Loading