btstack_event: add SM_EVENT_PAIRING_COMPLETE

This commit is contained in:
Matthias Ringwald 2018-02-01 16:17:54 +01:00
parent 589f5a99a3
commit 36c1abd2e3
2 changed files with 132 additions and 67 deletions

View File

@ -935,6 +935,23 @@ typedef uint8_t sm_key_t[16];
*/
#define SM_EVENT_IDENTITY_CREATED 0xDE
/**
* @brief Emitted to inform app that pairing is complete. Possible status values:
* ERROR_CODE_SUCCESS -> pairing success
* ERROR_CODE_CONNECTION_TIMEOUT -> timeout
* ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION -> disconnect
* ERROR_CODE_AUTHENTICATION_FAILURE -> SM protocol error, see reason field with SM_REASON_* from bluetooth.h
*
* @format H1B11
* @param handle
* @param addr_type
* @param address
* @param status
* @param reason if status == ERROR_CODE_AUTHENTICATION_FAILURE
*/
#define SM_EVENT_PAIRING_COMPLETE 0xDF
// GAP
/**

View File

@ -2880,6 +2880,54 @@ static inline uint8_t sm_event_identity_created_get_index(const uint8_t * event)
}
#endif
#ifdef ENABLE_BLE
/**
* @brief Get field handle from event SM_EVENT_PAIRING_COMPLETE
* @param event packet
* @return handle
* @note: btstack_type H
*/
static inline hci_con_handle_t sm_event_pairing_complete_get_handle(const uint8_t * event){
return little_endian_read_16(event, 2);
}
/**
* @brief Get field addr_type from event SM_EVENT_PAIRING_COMPLETE
* @param event packet
* @return addr_type
* @note: btstack_type 1
*/
static inline uint8_t sm_event_pairing_complete_get_addr_type(const uint8_t * event){
return event[4];
}
/**
* @brief Get field address from event SM_EVENT_PAIRING_COMPLETE
* @param event packet
* @param Pointer to storage for address
* @note: btstack_type B
*/
static inline void sm_event_pairing_complete_get_address(const uint8_t * event, bd_addr_t address){
reverse_bd_addr(&event[5], address);
}
/**
* @brief Get field status from event SM_EVENT_PAIRING_COMPLETE
* @param event packet
* @return status
* @note: btstack_type 1
*/
static inline uint8_t sm_event_pairing_complete_get_status(const uint8_t * event){
return event[11];
}
/**
* @brief Get field reason from event SM_EVENT_PAIRING_COMPLETE
* @param event packet
* @return reason
* @note: btstack_type 1
*/
static inline uint8_t sm_event_pairing_complete_get_reason(const uint8_t * event){
return event[12];
}
#endif
/**
* @brief Get field handle from event GAP_EVENT_SECURITY_LEVEL
* @param event packet