mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-06 12:39:51 +00:00
hci_dump: mark all hci events as incoming
This commit is contained in:
parent
997ab207b2
commit
92da54c428
@ -507,7 +507,7 @@ static void gatt_client_handle_transaction_complete(gatt_client_t * gatt_client)
|
||||
|
||||
static void emit_event_new(btstack_packet_handler_t callback, uint8_t * packet, uint16_t size){
|
||||
if (!callback) return;
|
||||
hci_dump_packet(HCI_EVENT_PACKET, 0, packet, size);
|
||||
hci_dump_packet(HCI_EVENT_PACKET, 1, packet, size);
|
||||
(*callback)(HCI_EVENT_PACKET, 0, packet, size);
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ static void bnep_emit_open_channel_complete(bnep_channel_t *channel, uint8_t sta
|
||||
little_endian_store_16(event, 9, channel->max_frame_size);
|
||||
reverse_bd_addr(channel->remote_addr, &event[11]);
|
||||
little_endian_store_16(event, 17, channel->con_handle);
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
(*channel->packet_handler)(HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ static void bnep_emit_channel_timeout(bnep_channel_t *channel)
|
||||
little_endian_store_16(event, 6, channel->uuid_dest);
|
||||
reverse_bd_addr(channel->remote_addr, &event[8]);
|
||||
event[14] = channel->state;
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
(*channel->packet_handler)(HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ static void bnep_emit_channel_closed(bnep_channel_t *channel)
|
||||
little_endian_store_16(event, 4, channel->uuid_source);
|
||||
little_endian_store_16(event, 6, channel->uuid_dest);
|
||||
reverse_bd_addr(channel->remote_addr, &event[8]);
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
(*channel->packet_handler)(HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ static void bnep_emit_ready_to_send(bnep_channel_t *channel)
|
||||
event[0] = BNEP_EVENT_CAN_SEND_NOW;
|
||||
event[1] = sizeof(event) - 2;
|
||||
little_endian_store_16(event, 2, channel->l2cap_cid);
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
(*channel->packet_handler)(HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ static void rfcomm_emit_connection_request(rfcomm_channel_t *channel) {
|
||||
event[8] = channel->dlci >> 1;
|
||||
little_endian_store_16(event, 9, channel->rfcomm_cid);
|
||||
little_endian_store_16(event, 11, channel->multiplexer->con_handle);
|
||||
hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet(HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
(channel->packet_handler)(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ static void rfcomm_emit_channel_opened(rfcomm_channel_t *channel, uint8_t status
|
||||
little_endian_store_16(event, pos, channel->rfcomm_cid); pos += 2; // 12 - channel ID
|
||||
little_endian_store_16(event, pos, channel->max_frame_size); pos += 2; // max frame size
|
||||
event[pos++] = channel->service ? 1 : 0; // linked to service -> incoming
|
||||
hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet(HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
(channel->packet_handler)(HCI_EVENT_PACKET, 0, event, pos);
|
||||
|
||||
// if channel opened successfully, also send can send now if possible
|
||||
@ -292,7 +292,7 @@ static void rfcomm_emit_channel_closed(rfcomm_channel_t * channel) {
|
||||
event[0] = RFCOMM_EVENT_CHANNEL_CLOSED;
|
||||
event[1] = sizeof(event) - 2;
|
||||
little_endian_store_16(event, 2, channel->rfcomm_cid);
|
||||
hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet(HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
(channel->packet_handler)(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ static void rfcomm_emit_remote_line_status(rfcomm_channel_t *channel, uint8_t li
|
||||
event[1] = sizeof(event) - 2;
|
||||
little_endian_store_16(event, 2, channel->rfcomm_cid);
|
||||
event[4] = line_status;
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
(channel->packet_handler)(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ static void rfcomm_emit_port_configuration(rfcomm_channel_t *channel, bool remot
|
||||
event[4] = 0;
|
||||
(void)memcpy(&event[5], (uint8_t *) &channel->local_rpn_data, sizeof(rfcomm_rpn_data_t));
|
||||
}
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
(channel->packet_handler)(HCI_EVENT_PACKET, channel->rfcomm_cid, event, sizeof(event));
|
||||
}
|
||||
|
||||
@ -330,7 +330,7 @@ static void rfcomm_emit_can_send_now(rfcomm_channel_t *channel) {
|
||||
event[0] = RFCOMM_EVENT_CAN_SEND_NOW;
|
||||
event[1] = sizeof(event) - 2;
|
||||
little_endian_store_16(event, 2, channel->rfcomm_cid);
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
(channel->packet_handler)(HCI_EVENT_PACKET, channel->rfcomm_cid, event, sizeof(event));
|
||||
}
|
||||
|
||||
|
@ -6252,7 +6252,7 @@ uint8_t hci_send_cmd(const hci_cmd_t * cmd, ...){
|
||||
static void hci_emit_event(uint8_t * event, uint16_t size, int dump){
|
||||
// dump packet
|
||||
if (dump) {
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, size);
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 1, event, size);
|
||||
}
|
||||
|
||||
// dispatch to all event handlers
|
||||
|
18
src/l2cap.c
18
src/l2cap.c
@ -1006,7 +1006,7 @@ void l2cap_remove_event_handler(btstack_packet_callback_registration_t * callbac
|
||||
}
|
||||
|
||||
static void l2cap_emit_event(uint8_t *event, uint16_t size) {
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, size);
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 1, event, size);
|
||||
// dispatch to all event handlers
|
||||
btstack_linked_list_iterator_t it;
|
||||
btstack_linked_list_iterator_init(&it, &l2cap_event_handlers);
|
||||
@ -1099,7 +1099,7 @@ static void l2cap_emit_can_send_now(btstack_packet_handler_t packet_handler, uin
|
||||
event[0] = L2CAP_EVENT_CAN_SEND_NOW;
|
||||
event[1] = sizeof(event) - 2u;
|
||||
little_endian_store_16(event, 2, channel);
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
packet_handler(HCI_EVENT_PACKET, channel, event, sizeof(event));
|
||||
}
|
||||
|
||||
@ -1113,7 +1113,7 @@ static void l2cap_emit_simple_event_with_cid(l2cap_channel_t * channel, uint8_t
|
||||
event[0] = event_code;
|
||||
event[1] = sizeof(event) - 2u;
|
||||
little_endian_store_16(event, 2, channel->local_cid);
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
l2cap_dispatch_to_channel(channel, HCI_EVENT_PACKET, event, sizeof(event));
|
||||
}
|
||||
#endif
|
||||
@ -1145,7 +1145,7 @@ void l2cap_emit_channel_opened(l2cap_channel_t *channel, uint8_t status) {
|
||||
event[24] = L2CAP_CHANNEL_MODE_BASIC;
|
||||
event[25] = 0;
|
||||
#endif
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
l2cap_dispatch_to_channel(channel, HCI_EVENT_PACKET, event, sizeof(event));
|
||||
}
|
||||
|
||||
@ -1160,7 +1160,7 @@ static void l2cap_emit_incoming_connection(l2cap_channel_t *channel) {
|
||||
little_endian_store_16(event, 10, channel->psm);
|
||||
little_endian_store_16(event, 12, channel->local_cid);
|
||||
little_endian_store_16(event, 14, channel->remote_cid);
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
l2cap_dispatch_to_channel(channel, HCI_EVENT_PACKET, event, sizeof(event));
|
||||
}
|
||||
|
||||
@ -2101,7 +2101,7 @@ static void l2cap_ecbm_emit_channel_opened(l2cap_channel_t *channel, uint8_t sta
|
||||
little_endian_store_16(event, 17, channel->remote_cid);
|
||||
little_endian_store_16(event, 19, channel->local_mtu);
|
||||
little_endian_store_16(event, 21, channel->remote_mtu);
|
||||
hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet(HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
l2cap_dispatch_to_channel(channel, HCI_EVENT_PACKET, event, sizeof(event));
|
||||
}
|
||||
|
||||
@ -3930,7 +3930,7 @@ static int l2cap_ecbm_signaling_handler_dispatch(hci_con_handle_t handle, uint16
|
||||
little_endian_store_16(event, 11, spsm);
|
||||
event[13] = num_channels;
|
||||
little_endian_store_16(event, 14, a_local_cid);
|
||||
hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet(HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
(*service->packet_handler)(HCI_EVENT_PACKET, a_local_cid, event, sizeof(event));
|
||||
|
||||
} else {
|
||||
@ -5039,7 +5039,7 @@ static void l2cap_cbm_emit_incoming_connection(l2cap_channel_t *channel) {
|
||||
little_endian_store_16(event, 13, channel->local_cid);
|
||||
little_endian_store_16(event, 15, channel->remote_cid);
|
||||
little_endian_store_16(event, 17, channel->remote_mtu);
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
l2cap_dispatch_to_channel(channel, HCI_EVENT_PACKET, event, sizeof(event));
|
||||
}
|
||||
// 11BH22222
|
||||
@ -5060,7 +5060,7 @@ static void l2cap_cbm_emit_channel_opened(l2cap_channel_t *channel, uint8_t stat
|
||||
little_endian_store_16(event, 17, channel->remote_cid);
|
||||
little_endian_store_16(event, 19, channel->local_mtu);
|
||||
little_endian_store_16(event, 21, channel->remote_mtu);
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
hci_dump_packet( HCI_EVENT_PACKET, 1, event, sizeof(event));
|
||||
l2cap_dispatch_to_channel(channel, HCI_EVENT_PACKET, event, sizeof(event));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user