btstack_event: add Connection Handle to BNEP_EVENT_CHANNEL_OPENED

This commit is contained in:
Matthias Ringwald 2019-06-15 19:36:09 +02:00
parent 45e58dda4d
commit 32b46fec1d
4 changed files with 14 additions and 2 deletions

View File

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
- FreeRTOS: use freertos/.. prefix to include FreeRTOS headers if HAVE_FREERTOS_INCLUDE_PREFIX is defined
- BNEP_EVENT_CHANNEL_OPENED: add Connection Handle
### Fixed
- BNEP: Bluetooth address is stored in little-endian format for all BNEP_EVENT_*

View File

@ -783,13 +783,14 @@ typedef uint8_t sm_key_t[16];
#define BNEP_EVENT_SERVICE_REGISTERED 0xC0
/**
* @format 12222B
* @format 12222BH
* @param status
* @param bnep_cid
* @param source_uuid
* @param destination_uuid
* @param mtu
* @param remote_address
* @param con_handle
*/
#define BNEP_EVENT_CHANNEL_OPENED 0xC1

View File

@ -2327,6 +2327,15 @@ static inline uint16_t bnep_event_channel_opened_get_mtu(const uint8_t * event){
static inline void bnep_event_channel_opened_get_remote_address(const uint8_t * event, bd_addr_t remote_address){
reverse_bd_addr(&event[11], remote_address);
}
/**
* @brief Get field con_handle from event BNEP_EVENT_CHANNEL_OPENED
* @param event packet
* @return con_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t bnep_event_channel_opened_get_con_handle(const uint8_t * event){
return little_endian_read_16(event, 17);
}
/**
* @brief Get field bnep_cid from event BNEP_EVENT_CHANNEL_CLOSED

View File

@ -79,7 +79,7 @@ static void bnep_emit_open_channel_complete(bnep_channel_t *channel, uint8_t sta
log_info("BNEP_EVENT_CHANNEL_OPENED status 0x%02x bd_addr: %s, handler %p", status, bd_addr_to_str(channel->remote_addr), channel->packet_handler);
if (!channel->packet_handler) return;
uint8_t event[3 + sizeof(bd_addr_t) + 4 * sizeof(uint16_t)];
uint8_t event[3 + sizeof(bd_addr_t) + 4 * sizeof(uint16_t) + 2];
event[0] = BNEP_EVENT_CHANNEL_OPENED;
event[1] = sizeof(event) - 2;
event[2] = status;
@ -88,6 +88,7 @@ static void bnep_emit_open_channel_complete(bnep_channel_t *channel, uint8_t sta
little_endian_store_16(event, 7, channel->uuid_dest);
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));
(*channel->packet_handler)(HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event));
}