Airoha M0 BLE API  1.0.5.4
ble_gap_sm.h
1 /******************************************************************************
2 Copyright (c) Airoha 2016 - All rights reserved
3 
4 FILE NAME
5  ble_gap_sm.h
6 DESCRIPTION
7 NOTES
8 ********************************************************************************/
9 
10 #ifndef __BLE_GAP_SM_H__
11 #define __BLE_GAP_SM_H__
12 
13 #include "ble_gap.h"
14 
28 /******************************************************************************
29  * Macro Definition
30  ******************************************************************************/
31 
37 #define SM_IO_DISPLAY_ONLY 0x00
38 #define SM_IO_DISPLAY_YES_NO 0x01
39 #define SM_IO_KEYBOARD_ONLY 0x02
40 #define SM_IO_NO_INPUT_NO_OUTPUT 0x03
41 #define SM_IO_KEYBOARD_DISPLAY 0x04
42 
51 #define SM_OOB_DATA_NOT_PRESENT 0x00
52 #define SM_OOB_DATA_FROM_REMOTE 0x01
53 
62 #define SM_NO_BONDING 0x00
63 #define SM_BONDING 0x01
64 
73 #define SM_NO_MITM_PROTECTION 0x00
74 #define SM_MITM_PROTECTION 0x04
75 
84 #define SM_SC_DISABLE 0x00
85 #define SM_SC_ENABLE 0x08
86 
95 #define SM_KEY_PRESS_NOTI_DISABLE 0x00
96 #define SM_KEY_PRESS_NOTI_ENABLE 0x10
97 
104 typedef enum
105 {
112 
116 typedef struct
117 {
118  uint8_t ioCapability;
119  uint8_t oobData;
120  uint8_t authReq;
121  uint8_t maxKeySize;
122  uint8_t initKeyDistr;
123  uint8_t respKeyDistr;
125 
126 
127 /*************************************************************************
128 * API
129 *************************************************************************/
136 bool BLE_gap_sm_authenticate(uint16_t conn_handle, ble_sm_security_param_t *param);
137 
144 bool BLE_gap_sm_set_security_param(uint16_t conn_handle, uint8_t status, ble_sm_security_param_t *param);
145 
151 
159 bool BLE_gap_sm_is_device_bonded(ble_addr_t *addr, uint8_t *flashIdx);
160 
168 
173 bool BLE_gap_sm_set_passkey_for_display(uint32_t passkey);
174 
180 bool BLE_gap_sm_passkey_response(uint16_t conn_handle, uint32_t passkey);
181 
188 
194 bool BLE_gap_sm_get_ltk(uint8_t *peerAddr, uint8_t *ltk);
195 
201 bool BLE_gap_sm_get_peer_ltk(uint8_t *peerAddr, uint8_t *peerLtk);
202 
207 #endif
Parameters for BLE_gap_sm_set_security_param function.
Definition: ble_gap_sm.h:116
bool BLE_gap_sm_delete_paired_record(ble_addr_t *addr)
To delete bonded device information in flash.
ble_sm_keypress_type
Definition: ble_gap_sm.h:104
bool BLE_gap_sm_get_ltk(uint8_t *peerAddr, uint8_t *ltk)
Get LTK in flash by peer address.
Definition: ble_gap_sm.h:106
BLE address structure.
Definition: ble_gap.h:460
bool BLE_gap_sm_is_device_bonded(ble_addr_t *addr, uint8_t *flashIdx)
To check if device information exists in flash.
bool BLE_gap_sm_send_keypress_notification_request(uint16_t conn_handle, ble_sm_keypress_type type)
To send a key notification command.
Definition: ble_gap_sm.h:109
Definition: ble_gap_sm.h:107
bool BLE_gap_sm_set_passkey_for_display(uint32_t passkey)
To set passkey for display, security manager will use 000000 as default if passkey is not set...
Definition: ble_gap_sm.h:110
bool BLE_gap_sm_authenticate(uint16_t conn_handle, ble_sm_security_param_t *param)
To start authentication procedure.
uint8_t maxKeySize
Definition: ble_gap_sm.h:121
Definition: ble_gap_sm.h:108
uint8_t respKeyDistr
Definition: ble_gap_sm.h:123
bool BLE_gap_sm_get_last_paired_device(ble_addr_t *addr)
To obtain last paired device information in flash.
bool BLE_gap_sm_passkey_response(uint16_t conn_handle, uint32_t passkey)
To send passkey input to security manager.
uint8_t oobData
Definition: ble_gap_sm.h:119
bool BLE_gap_sm_set_security_param(uint16_t conn_handle, uint8_t status, ble_sm_security_param_t *param)
To set security parameter for pairing information exchange.
uint8_t initKeyDistr
Definition: ble_gap_sm.h:122
bool BLE_gap_sm_get_peer_ltk(uint8_t *peerAddr, uint8_t *peerLtk)
Get peer LTK in flash by peer address.
uint8_t authReq
Definition: ble_gap_sm.h:120