btstack_defines: provide con_handle in RFCOMM_EVENT_INCOMING_CONNECTION

This commit is contained in:
Matthias Ringwald 2021-08-25 10:38:14 +02:00
parent 08a3a10564
commit 852600fbce
3 changed files with 14 additions and 2 deletions

View File

@ -928,10 +928,12 @@ typedef uint8_t sm_key_t[16];
#define RFCOMM_EVENT_CHANNEL_CLOSED 0x81
/**
* @format B12
* @format B12H
* @param bd_addr
* @param server_channel
* @param rfcomm_cid
* @param con_handle
*/
#define RFCOMM_EVENT_INCOMING_CONNECTION 0x82

View File

@ -1720,6 +1720,15 @@ static inline uint8_t rfcomm_event_incoming_connection_get_server_channel(const
static inline uint16_t rfcomm_event_incoming_connection_get_rfcomm_cid(const uint8_t * event){
return little_endian_read_16(event, 9);
}
/**
* @brief Get field con_handle from event RFCOMM_EVENT_INCOMING_CONNECTION
* @param event packet
* @return con_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t rfcomm_event_incoming_connection_get_con_handle(const uint8_t * event){
return little_endian_read_16(event, 11);
}
/**
* @brief Get field rfcomm_cid from event RFCOMM_EVENT_REMOTE_LINE_STATUS

View File

@ -244,12 +244,13 @@ static uint16_t rfcomm_next_ertm_id(void){
static void rfcomm_emit_connection_request(rfcomm_channel_t *channel) {
log_info("RFCOMM_EVENT_INCOMING_CONNECTION addr %s channel #%u cid 0x%02x",
bd_addr_to_str(channel->multiplexer->remote_addr), channel->dlci>>1, channel->rfcomm_cid);
uint8_t event[11];
uint8_t event[13];
event[0] = RFCOMM_EVENT_INCOMING_CONNECTION;
event[1] = sizeof(event) - 2;
reverse_bd_addr(channel->multiplexer->remote_addr, &event[2]);
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));
(channel->packet_handler)(HCI_EVENT_PACKET, 0, event, sizeof(event));
}