fixed tracking of l2cap, rfcomm services and channels

This commit is contained in:
mila@ringwald.ch 2014-10-16 11:33:28 +00:00
parent 53d7624b52
commit e6f51008ec
2 changed files with 6 additions and 6 deletions

View File

@ -1294,25 +1294,25 @@ static void daemon_packet_handler(void * connection, uint8_t packet_type, uint16
daemon_retry_parked();
break;
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));
break;
case RFCOMM_EVENT_CHANNEL_CLOSED:
daemon_remove_client_rfcomm_channel(connection, READ_BT_16(packet, 2));
break;
case RFCOMM_EVENT_SERVICE_REGISTERED:
if (!packet[2]) break;
if (packet[2]) break;
daemon_add_client_rfcomm_service(connection, packet[3]);
break;
case L2CAP_EVENT_CHANNEL_OPENED:
if (!packet[2]) break;
if (packet[2]) break;
daemon_add_client_l2cap_channel(connection, READ_BT_16(packet, 13));
break;
case L2CAP_EVENT_CHANNEL_CLOSED:
daemon_remove_client_l2cap_channel(connection, READ_BT_16(packet, 2));
break;
case L2CAP_EVENT_SERVICE_REGISTERED:
if (!packet[2]) break;
if (packet[2]) break;
daemon_add_client_l2cap_service(connection, READ_BT_16(packet, 3));
break;
#if defined(HAVE_BLE) && defined(HAVE_MALLOC)

View File

@ -190,7 +190,7 @@ static void l2cap_emit_service_registered(void *connection, uint8_t status, uint
event[2] = status;
bt_store_16(event, 3, psm);
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) {
@ -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){
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
// TODO: emit error event