sm: add SM_EVENT_PAIRING_STARTED

This commit is contained in:
Matthias Ringwald 2020-12-03 20:25:14 +01:00
parent daac65637f
commit 38c89bb1b7
2 changed files with 43 additions and 4 deletions

View File

@ -1282,7 +1282,16 @@ typedef uint8_t sm_key_t[16];
*/
#define SM_EVENT_IDENTITY_CREATED 0xDB
/**
/**
* @brief Emitted to inform app that pairing has started.
* @format H1B
* @param handle
* @param addr_type
* @param address
*/
#define SM_EVENT_PAIRING_STARTED 0xDC
/**
* @brief Emitted to inform app that pairing is complete. Possible status values:
* ERROR_CODE_SUCCESS -> pairing success
* ERROR_CODE_CONNECTION_TIMEOUT -> timeout
@ -1296,7 +1305,7 @@ typedef uint8_t sm_key_t[16];
* @param status
* @param reason if status == ERROR_CODE_AUTHENTICATION_FAILURE
*/
#define SM_EVENT_PAIRING_COMPLETE 0xDC
#define SM_EVENT_PAIRING_COMPLETE 0xDD
/**
@ -1306,7 +1315,7 @@ typedef uint8_t sm_key_t[16];
* @param addr_type
* @param address
*/
#define SM_EVENT_REENCRYPTION_STARTED 0xDD
#define SM_EVENT_REENCRYPTION_STARTED 0xDE
/**
* @brief Proactive Authentication for bonded devices complete. Possible status values:
@ -1319,7 +1328,7 @@ typedef uint8_t sm_key_t[16];
* @param address
* @param status
*/
#define SM_EVENT_REENCRYPTION_COMPLETE 0xDE
#define SM_EVENT_REENCRYPTION_COMPLETE 0xDF
// GAP

View File

@ -2974,6 +2974,36 @@ static inline uint16_t sm_event_identity_created_get_index(const uint8_t * event
}
#endif
#ifdef ENABLE_BLE
/**
* @brief Get field handle from event SM_EVENT_PAIRING_STARTED
* @param event packet
* @return handle
* @note: btstack_type H
*/
static inline hci_con_handle_t sm_event_pairing_started_get_handle(const uint8_t * event){
return little_endian_read_16(event, 2);
}
/**
* @brief Get field addr_type from event SM_EVENT_PAIRING_STARTED
* @param event packet
* @return addr_type
* @note: btstack_type 1
*/
static inline uint8_t sm_event_pairing_started_get_addr_type(const uint8_t * event){
return event[4];
}
/**
* @brief Get field address from event SM_EVENT_PAIRING_STARTED
* @param event packet
* @param Pointer to storage for address
* @note: btstack_type B
*/
static inline void sm_event_pairing_started_get_address(const uint8_t * event, bd_addr_t address){
reverse_bytes(&event[5], address, 6);
}
#endif
#ifdef ENABLE_BLE
/**
* @brief Get field handle from event SM_EVENT_PAIRING_COMPLETE