diff --git a/include/btstack/hci_cmds.h b/include/btstack/hci_cmds.h index 726b74a74..dbca1bd5a 100644 --- a/include/btstack/hci_cmds.h +++ b/include/btstack/hci_cmds.h @@ -155,7 +155,7 @@ extern "C" { // L2CAP EVENTS -// data: event (8), len(8), status (8), address(48), handle (16), psm (16), local_cid(16), remote_cid (16), local_mtu(16), remote_mtu(16) +// data: event (8), len(8), status (8), address(48), handle (16), psm (16), local_cid(16), remote_cid (16), local_mtu(16), remote_mtu(16), flush_timeout(16) #define L2CAP_EVENT_CHANNEL_OPENED 0x70 // data: event (8), len(8), channel (16) @@ -256,12 +256,13 @@ extern "C" { #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM 0x65 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY 0x66 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_RESOURCES 0x65 +#define L2CAP_CONNECTION_RESPONSE_RESULT_RTX_TIMEOUT 0x66 -#define L2CAP_CONFIG_RESPONSE_RESULT_SUCCESSFUL 0x66 -#define L2CAP_CONFIG_RESPONSE_RESULT_UNACCEPTABLE_PARAMS 0x67 -#define L2CAP_CONFIG_RESPONSE_RESULT_REJECTED 0x68 -#define L2CAP_CONFIG_RESPONSE_RESULT_UNKNOWN_OPTIONS 0x69 -#define L2CAP_SERVICE_ALREADY_REGISTERED 0x6a +#define L2CAP_CONFIG_RESPONSE_RESULT_SUCCESSFUL 0x67 +#define L2CAP_CONFIG_RESPONSE_RESULT_UNACCEPTABLE_PARAMS 0x68 +#define L2CAP_CONFIG_RESPONSE_RESULT_REJECTED 0x69 +#define L2CAP_CONFIG_RESPONSE_RESULT_UNKNOWN_OPTIONS 0x6a +#define L2CAP_SERVICE_ALREADY_REGISTERED 0x6b #define RFCOMM_MULTIPLEXER_STOPPED 0x70 #define RFCOMM_CHANNEL_ALREADY_REGISTERED 0x71 diff --git a/src/l2cap.c b/src/l2cap.c index 628befc65..8d92cc2df 100644 --- a/src/l2cap.c +++ b/src/l2cap.c @@ -123,10 +123,10 @@ void l2cap_dispatch(l2cap_channel_t *channel, uint8_t type, uint8_t * data, uint } void l2cap_emit_channel_opened(l2cap_channel_t *channel, uint8_t status) { - log_info("L2CAP_EVENT_CHANNEL_OPENED status 0x%x addr %s handle 0x%x psm 0x%x local_cid 0x%x remote_cid 0x%x local_mtu %u, remote_mtu %u", + log_info("L2CAP_EVENT_CHANNEL_OPENED status 0x%x addr %s handle 0x%x psm 0x%x local_cid 0x%x remote_cid 0x%x local_mtu %u, remote_mtu %u, flush_timeout %u", status, bd_addr_to_str(channel->address), channel->handle, channel->psm, - channel->local_cid, channel->remote_cid, channel->local_mtu, channel->remote_mtu); - uint8_t event[21]; + channel->local_cid, channel->remote_cid, channel->local_mtu, channel->remote_mtu, channel->flush_timeout); + uint8_t event[23]; event[0] = L2CAP_EVENT_CHANNEL_OPENED; event[1] = sizeof(event) - 2; event[2] = status; @@ -137,6 +137,7 @@ void l2cap_emit_channel_opened(l2cap_channel_t *channel, uint8_t status) { bt_store_16(event, 15, channel->remote_cid); bt_store_16(event, 17, channel->local_mtu); bt_store_16(event, 19, channel->remote_mtu); + bt_store_16(event, 19, channel->flush_timeout); hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); l2cap_dispatch(channel, HCI_EVENT_PACKET, event, sizeof(event)); } diff --git a/src/l2cap.h b/src/l2cap.h index 8b1784fea..559d8d85c 100644 --- a/src/l2cap.h +++ b/src/l2cap.h @@ -139,6 +139,8 @@ typedef struct { uint16_t local_mtu; uint16_t remote_mtu; + uint16_t flush_timeout; // default 0xffff + uint16_t psm; uint8_t packets_granted; // number of L2CAP/ACL packets client is allowed to send