forward HCI Events to att and sm packet handlers, too

This commit is contained in:
matthias.ringwald@gmail.com 2014-04-28 20:51:11 +00:00
parent 7d468b9be6
commit e070741715
2 changed files with 14 additions and 17 deletions

View File

@ -141,25 +141,16 @@ int l2cap_send_connectionless(uint16_t handle, uint16_t cid, uint8_t *data, uint
void l2cap_event_handler( uint8_t *packet, uint16_t size ){
switch(packet[0]){
case DAEMON_EVENT_HCI_PACKET_SENT:
if (attribute_protocol_packet_handler) {
(*attribute_protocol_packet_handler)(HCI_EVENT_PACKET, 0, packet, size);
}
if (security_protocol_packet_handler) {
(*security_protocol_packet_handler)(HCI_EVENT_PACKET, 0, packet, size);
}
break;
default:
break;
}
// pass on
if (packet_handler) {
(*packet_handler)(NULL, HCI_EVENT_PACKET, 0, packet, size);
}
if (attribute_protocol_packet_handler){
(*attribute_protocol_packet_handler)(HCI_EVENT_PACKET, 0, packet, size)
}
if (security_protocol_packet_handler) {
(*security_protocol_packet_handler)(HCI_EVENT_PACKET, 0, packet, size)
}
}
void l2cap_acl_handler( uint8_t *packet, uint16_t size ){

View File

@ -779,7 +779,7 @@ static void l2cap_handle_connection_success_for_addr(bd_addr_t address, hci_con_
l2cap_run();
}
void l2cap_event_handler( uint8_t *packet, uint16_t size ){
void l2cap_event_handler(uint8_t *packet, uint16_t size){
bd_addr_t address;
hci_con_handle_t handle;
@ -921,8 +921,14 @@ void l2cap_event_handler( uint8_t *packet, uint16_t size ){
break;
}
// pass on
// pass on: main packet handler, att and sm packet handlers
(*packet_handler)(NULL, HCI_EVENT_PACKET, 0, packet, size);
if (attribute_protocol_packet_handler){
(*attribute_protocol_packet_handler)(HCI_EVENT_PACKET, 0, packet, size);
}
if (security_protocol_packet_handler) {
(*security_protocol_packet_handler)(HCI_EVENT_PACKET, 0, packet, size);
}
l2cap_run();
}