From 334126b319b4d5dc92342180e272bc8222458e8e Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Mon, 21 Nov 2016 15:01:29 +0100 Subject: [PATCH] sm: provide le_device_db_index in SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED again --- src/ble/sm.c | 3 ++- src/btstack_defines.h | 5 ++--- src/btstack_event.h | 9 +++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/ble/sm.c b/src/ble/sm.c index a0c4e422d..703b08730 100644 --- a/src/ble/sm.c +++ b/src/ble/sm.c @@ -697,10 +697,11 @@ static void sm_notify_client_index(uint8_t type, hci_con_handle_t con_handle, ui int identity_address_type; le_device_db_info(index, &identity_address_type, identity_address, NULL); - uint8_t event[18]; + uint8_t event[19]; sm_setup_event_base(event, sizeof(event), type, con_handle, addr_type, address); event[11] = identity_address_type; reverse_bd_addr(identity_address, &event[12]); + event[18] = index; sm_dispatch_event(HCI_EVENT_PACKET, 0, event, sizeof(event)); } diff --git a/src/btstack_defines.h b/src/btstack_defines.h index b8a01b41c..26e714086 100644 --- a/src/btstack_defines.h +++ b/src/btstack_defines.h @@ -833,14 +833,13 @@ typedef uint8_t sm_key_t[16]; /** * @brief Identify resolving succeeded * - * @format H1B1B + * @format H1B1B2 * @param handle * @param addr_type * @param address * @param identity_addr_type * @param identity_address - * - * @note le_device_db_index was removed, please use provided identity information directly + * @param index_internal * */ #define SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED 0xDA diff --git a/src/btstack_event.h b/src/btstack_event.h index 8d86e204c..304f7b46f 100644 --- a/src/btstack_event.h +++ b/src/btstack_event.h @@ -2616,6 +2616,15 @@ static inline uint8_t sm_event_identity_resolving_succeeded_get_identity_addr_ty static inline void sm_event_identity_resolving_succeeded_get_identity_address(const uint8_t * event, bd_addr_t identity_address){ reverse_bd_addr(&event[12], identity_address); } +/** + * @brief Get field index_internal from event SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED + * @param event packet + * @return index_internal + * @note: btstack_type 2 + */ +static inline uint16_t sm_event_identity_resolving_succeeded_get_index_internal(const uint8_t * event){ + return little_endian_read_16(event, 18); +} #endif #ifdef ENABLE_BLE