mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-31 19:20:26 +00:00
att_dispatch: extract att_dispatch_classic_get_l2cap_cid
This commit is contained in:
parent
eb65899c12
commit
0cd55b6c9f
@ -128,15 +128,24 @@ void att_dispatch_register_server(btstack_packet_handler_t packet_handler){
|
|||||||
l2cap_register_fixed_channel(att_packet_handler, L2CAP_CID_ATTRIBUTE_PROTOCOL);
|
l2cap_register_fixed_channel(att_packet_handler, L2CAP_CID_ATTRIBUTE_PROTOCOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool att_dispatch_can_send_now(hci_con_handle_t con_handle) {
|
|
||||||
#ifdef ENABLE_GATT_OVER_CLASSIC
|
#ifdef ENABLE_GATT_OVER_CLASSIC
|
||||||
|
static uint16_t att_dispatch_classic_get_l2cap_cid(hci_con_handle_t con_handle){
|
||||||
// get l2cap_cid from att_server in hci_connection
|
// get l2cap_cid from att_server in hci_connection
|
||||||
hci_connection_t * hci_connection = hci_connection_for_handle(con_handle);
|
hci_connection_t * hci_connection = hci_connection_for_handle(con_handle);
|
||||||
if (hci_connection != NULL){
|
if (hci_connection != NULL) {
|
||||||
uint16_t l2cap_cid = hci_connection->att_server.l2cap_cid;
|
return hci_connection->att_server.l2cap_cid;
|
||||||
if (l2cap_cid != 0){
|
} else {
|
||||||
return l2cap_can_send_packet_now(l2cap_cid);
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static bool att_dispatch_can_send_now(hci_con_handle_t con_handle) {
|
||||||
|
#ifdef ENABLE_GATT_OVER_CLASSIC
|
||||||
|
uint16_t l2cap_cid = att_dispatch_classic_get_l2cap_cid(con_handle);
|
||||||
|
if (l2cap_cid != 0){
|
||||||
|
return l2cap_can_send_packet_now(l2cap_cid);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return l2cap_can_send_fixed_channel_packet_now(con_handle, L2CAP_CID_ATTRIBUTE_PROTOCOL);
|
return l2cap_can_send_fixed_channel_packet_now(con_handle, L2CAP_CID_ATTRIBUTE_PROTOCOL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user