mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-31 00:32:52 +00:00
btstack_defines: provide con_handle in RFCOMM_EVENT_INCOMING_CONNECTION
This commit is contained in:
parent
08a3a10564
commit
852600fbce
@ -928,10 +928,12 @@ typedef uint8_t sm_key_t[16];
|
|||||||
#define RFCOMM_EVENT_CHANNEL_CLOSED 0x81
|
#define RFCOMM_EVENT_CHANNEL_CLOSED 0x81
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @format B12
|
* @format B12H
|
||||||
* @param bd_addr
|
* @param bd_addr
|
||||||
* @param server_channel
|
* @param server_channel
|
||||||
* @param rfcomm_cid
|
* @param rfcomm_cid
|
||||||
|
* @param con_handle
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#define RFCOMM_EVENT_INCOMING_CONNECTION 0x82
|
#define RFCOMM_EVENT_INCOMING_CONNECTION 0x82
|
||||||
|
|
||||||
|
@ -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){
|
static inline uint16_t rfcomm_event_incoming_connection_get_rfcomm_cid(const uint8_t * event){
|
||||||
return little_endian_read_16(event, 9);
|
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
|
* @brief Get field rfcomm_cid from event RFCOMM_EVENT_REMOTE_LINE_STATUS
|
||||||
|
@ -244,12 +244,13 @@ static uint16_t rfcomm_next_ertm_id(void){
|
|||||||
static void rfcomm_emit_connection_request(rfcomm_channel_t *channel) {
|
static void rfcomm_emit_connection_request(rfcomm_channel_t *channel) {
|
||||||
log_info("RFCOMM_EVENT_INCOMING_CONNECTION addr %s channel #%u cid 0x%02x",
|
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);
|
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[0] = RFCOMM_EVENT_INCOMING_CONNECTION;
|
||||||
event[1] = sizeof(event) - 2;
|
event[1] = sizeof(event) - 2;
|
||||||
reverse_bd_addr(channel->multiplexer->remote_addr, &event[2]);
|
reverse_bd_addr(channel->multiplexer->remote_addr, &event[2]);
|
||||||
event[8] = channel->dlci >> 1;
|
event[8] = channel->dlci >> 1;
|
||||||
little_endian_store_16(event, 9, channel->rfcomm_cid);
|
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, 0, event, sizeof(event));
|
||||||
(channel->packet_handler)(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
(channel->packet_handler)(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user