sm: add SM_EVENT_NUMERIC_COMPARISON_REQUEST and SM_EVENT_NUMERIC_COMPARISON_CANCEL events for Numeric Comparison

This commit is contained in:
Matthias Ringwald 2016-05-13 12:17:43 +02:00
parent b434342875
commit 8362d86ace
2 changed files with 92 additions and 6 deletions

View File

@ -735,12 +735,21 @@ typedef uint8_t sm_key_t[16];
#define SM_EVENT_PASSKEY_INPUT_CANCEL 0xD5
/**
* @format H1B
* @format H1B4
* @param handle
* @param addr_type
* @param address
* @param passkey
*/
#define SM_EVENT_NUMERIC_COMPARISON_REQUEST 0xD6
/**
* @format H1B4
* @param handle
* @param addr_type
* @param address
*/
#define SM_EVENT_IDENTITY_RESOLVING_STARTED 0xD6
#define SM_EVENT_NUMERIC_COMPARISON_CANCEL 0xD7
/**
* @format H1B
@ -748,7 +757,15 @@ typedef uint8_t sm_key_t[16];
* @param addr_type
* @param address
*/
#define SM_EVENT_IDENTITY_RESOLVING_FAILED 0xD7
#define SM_EVENT_IDENTITY_RESOLVING_STARTED 0xD8
/**
* @format H1B
* @param handle
* @param addr_type
* @param address
*/
#define SM_EVENT_IDENTITY_RESOLVING_FAILED 0xD9
/**
* @format H1B2
@ -757,7 +774,7 @@ typedef uint8_t sm_key_t[16];
* @param address
* @param le_device_db_index
*/
#define SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED 0xD8
#define SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED 0xDA
/**
* @format H1B
@ -765,7 +782,7 @@ typedef uint8_t sm_key_t[16];
* @param addr_type
* @param address
*/
#define SM_EVENT_AUTHORIZATION_REQUEST 0xD9
#define SM_EVENT_AUTHORIZATION_REQUEST 0xDB
/**
* @format H1B1
@ -774,7 +791,7 @@ typedef uint8_t sm_key_t[16];
* @param address
* @param authorization_result
*/
#define SM_EVENT_AUTHORIZATION_RESULT 0xDA
#define SM_EVENT_AUTHORIZATION_RESULT 0xDC
// GAP

View File

@ -2180,6 +2180,75 @@ static inline void sm_event_passkey_input_cancel_get_address(const uint8_t * eve
}
#endif
#ifdef ENABLE_BLE
/**
* @brief Get field handle from event SM_EVENT_NUMERIC_COMPARISON_REQUEST
* @param event packet
* @return handle
* @note: btstack_type H
*/
static inline hci_con_handle_t sm_event_numeric_comparison_request_get_handle(const uint8_t * event){
return little_endian_read_16(event, 2);
}
/**
* @brief Get field addr_type from event SM_EVENT_NUMERIC_COMPARISON_REQUEST
* @param event packet
* @return addr_type
* @note: btstack_type 1
*/
static inline uint8_t sm_event_numeric_comparison_request_get_addr_type(const uint8_t * event){
return event[4];
}
/**
* @brief Get field address from event SM_EVENT_NUMERIC_COMPARISON_REQUEST
* @param event packet
* @param Pointer to storage for address
* @note: btstack_type B
*/
static inline void sm_event_numeric_comparison_request_get_address(const uint8_t * event, bd_addr_t address){
reverse_bd_addr(&event[5], address);
}
/**
* @brief Get field passkey from event SM_EVENT_NUMERIC_COMPARISON_REQUEST
* @param event packet
* @return passkey
* @note: btstack_type 4
*/
static inline uint32_t sm_event_numeric_comparison_request_get_passkey(const uint8_t * event){
return little_endian_read_32(event, 11);
}
#endif
#ifdef ENABLE_BLE
/**
* @brief Get field handle from event SM_EVENT_NUMERIC_COMPARISON_CANCEL
* @param event packet
* @return handle
* @note: btstack_type H
*/
static inline hci_con_handle_t sm_event_numeric_comparison_cancel_get_handle(const uint8_t * event){
return little_endian_read_16(event, 2);
}
/**
* @brief Get field addr_type from event SM_EVENT_NUMERIC_COMPARISON_CANCEL
* @param event packet
* @return addr_type
* @note: btstack_type 1
*/
static inline uint8_t sm_event_numeric_comparison_cancel_get_addr_type(const uint8_t * event){
return event[4];
}
/**
* @brief Get field address from event SM_EVENT_NUMERIC_COMPARISON_CANCEL
* @param event packet
* @param Pointer to storage for address
* @note: btstack_type B
*/
static inline void sm_event_numeric_comparison_cancel_get_address(const uint8_t * event, bd_addr_t address){
reverse_bd_addr(&event[5], address);
}
#endif
#ifdef ENABLE_BLE
/**
* @brief Get field handle from event SM_EVENT_IDENTITY_RESOLVING_STARTED