mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-27 06:35:20 +00:00
fixed tracking of l2cap, rfcomm services and channels
This commit is contained in:
parent
53d7624b52
commit
e6f51008ec
@ -1294,25 +1294,25 @@ static void daemon_packet_handler(void * connection, uint8_t packet_type, uint16
|
|||||||
daemon_retry_parked();
|
daemon_retry_parked();
|
||||||
break;
|
break;
|
||||||
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
case RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE:
|
||||||
if (!packet[2]) break;
|
if (packet[2]) break;
|
||||||
daemon_add_client_rfcomm_channel(connection, READ_BT_16(packet, 9));
|
daemon_add_client_rfcomm_channel(connection, READ_BT_16(packet, 9));
|
||||||
break;
|
break;
|
||||||
case RFCOMM_EVENT_CHANNEL_CLOSED:
|
case RFCOMM_EVENT_CHANNEL_CLOSED:
|
||||||
daemon_remove_client_rfcomm_channel(connection, READ_BT_16(packet, 2));
|
daemon_remove_client_rfcomm_channel(connection, READ_BT_16(packet, 2));
|
||||||
break;
|
break;
|
||||||
case RFCOMM_EVENT_SERVICE_REGISTERED:
|
case RFCOMM_EVENT_SERVICE_REGISTERED:
|
||||||
if (!packet[2]) break;
|
if (packet[2]) break;
|
||||||
daemon_add_client_rfcomm_service(connection, packet[3]);
|
daemon_add_client_rfcomm_service(connection, packet[3]);
|
||||||
break;
|
break;
|
||||||
case L2CAP_EVENT_CHANNEL_OPENED:
|
case L2CAP_EVENT_CHANNEL_OPENED:
|
||||||
if (!packet[2]) break;
|
if (packet[2]) break;
|
||||||
daemon_add_client_l2cap_channel(connection, READ_BT_16(packet, 13));
|
daemon_add_client_l2cap_channel(connection, READ_BT_16(packet, 13));
|
||||||
break;
|
break;
|
||||||
case L2CAP_EVENT_CHANNEL_CLOSED:
|
case L2CAP_EVENT_CHANNEL_CLOSED:
|
||||||
daemon_remove_client_l2cap_channel(connection, READ_BT_16(packet, 2));
|
daemon_remove_client_l2cap_channel(connection, READ_BT_16(packet, 2));
|
||||||
break;
|
break;
|
||||||
case L2CAP_EVENT_SERVICE_REGISTERED:
|
case L2CAP_EVENT_SERVICE_REGISTERED:
|
||||||
if (!packet[2]) break;
|
if (packet[2]) break;
|
||||||
daemon_add_client_l2cap_service(connection, READ_BT_16(packet, 3));
|
daemon_add_client_l2cap_service(connection, READ_BT_16(packet, 3));
|
||||||
break;
|
break;
|
||||||
#if defined(HAVE_BLE) && defined(HAVE_MALLOC)
|
#if defined(HAVE_BLE) && defined(HAVE_MALLOC)
|
||||||
|
@ -190,7 +190,7 @@ static void l2cap_emit_service_registered(void *connection, uint8_t status, uint
|
|||||||
event[2] = status;
|
event[2] = status;
|
||||||
bt_store_16(event, 3, psm);
|
bt_store_16(event, 3, psm);
|
||||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||||
(*packet_handler)(NULL, HCI_EVENT_PACKET, 0, event, sizeof(event));
|
(*packet_handler)(connection, HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
void l2cap_emit_credits(l2cap_channel_t *channel, uint8_t credits) {
|
void l2cap_emit_credits(l2cap_channel_t *channel, uint8_t credits) {
|
||||||
@ -1493,7 +1493,7 @@ l2cap_service_t * l2cap_get_service(uint16_t psm){
|
|||||||
|
|
||||||
void l2cap_register_service_internal(void *connection, btstack_packet_handler_t packet_handler, uint16_t psm, uint16_t mtu, gap_security_level_t security_level){
|
void l2cap_register_service_internal(void *connection, btstack_packet_handler_t packet_handler, uint16_t psm, uint16_t mtu, gap_security_level_t security_level){
|
||||||
|
|
||||||
log_info("L2CAP_REGISTER_SERVICE psm 0x%x mtu %u", psm, mtu);
|
log_info("L2CAP_REGISTER_SERVICE psm 0x%x mtu %u connection %p", psm, mtu, connection);
|
||||||
|
|
||||||
// check for alread registered psm
|
// check for alread registered psm
|
||||||
// TODO: emit error event
|
// TODO: emit error event
|
||||||
|
Loading…
x
Reference in New Issue
Block a user