| 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 {
106 bt_sm_passkey_started = 0,
107 bt_sm_passkey_digit_entered,
108 bt_sm_passkey_digit_erased,
109 bt_sm_passkey_cleared,
110 bt_sm_passkey_complete
111 }ble_sm_keypress_type;
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;
124 }ble_sm_security_param_t;
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
150 bool BLE_gap_sm_delete_paired_record(ble_addr_t *addr);
151
159 bool BLE_gap_sm_is_device_bonded(ble_addr_t *addr, uint8_t *flashIdx);
160
167 bool BLE_gap_sm_get_last_paired_device(ble_addr_t *addr);
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
187 bool BLE_gap_sm_send_keypress_notification_request(uint16_t conn_handle, ble_sm_keypress_type type);
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
ble_sm_security_param_t
Parameters for BLE_gap_sm_set_security_param function.
Definition: ble_gap_sm.h:116
BLE_gap_sm_delete_paired_record
bool BLE_gap_sm_delete_paired_record(ble_addr_t *addr)
To delete bonded device information in flash.
ble_sm_keypress_type
ble_sm_keypress_type
Definition: ble_gap_sm.h:104
BLE_gap_sm_get_ltk
bool BLE_gap_sm_get_ltk(uint8_t *peerAddr, uint8_t *ltk)
Get LTK in flash by peer address.
bt_sm_passkey_started
Definition: ble_gap_sm.h:106
ble_addr_t
BLE address structure.
Definition: ble_gap.h:460
BLE_gap_sm_is_device_bonded
bool BLE_gap_sm_is_device_bonded(ble_addr_t *addr, uint8_t *flashIdx)
To check if device information exists in flash.
BLE_gap_sm_send_keypress_notification_request
bool BLE_gap_sm_send_keypress_notification_request(uint16_t conn_handle, ble_sm_keypress_type type)
To send a key notification command.
bt_sm_passkey_cleared
Definition: ble_gap_sm.h:109
bt_sm_passkey_digit_entered
Definition: ble_gap_sm.h:107
BLE_gap_sm_set_passkey_for_display
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...
bt_sm_passkey_complete
Definition: ble_gap_sm.h:110
BLE_gap_sm_authenticate
bool BLE_gap_sm_authenticate(uint16_t conn_handle, ble_sm_security_param_t *param)
To start authentication procedure.
ble_sm_security_param_t::maxKeySize
uint8_t maxKeySize
Definition: ble_gap_sm.h:121
bt_sm_passkey_digit_erased
Definition: ble_gap_sm.h:108
ble_sm_security_param_t::respKeyDistr
uint8_t respKeyDistr
Definition: ble_gap_sm.h:123
BLE_gap_sm_get_last_paired_device
bool BLE_gap_sm_get_last_paired_device(ble_addr_t *addr)
To obtain last paired device information in flash.
BLE_gap_sm_passkey_response
bool BLE_gap_sm_passkey_response(uint16_t conn_handle, uint32_t passkey)
To send passkey input to security manager.
ble_sm_security_param_t::oobData
uint8_t oobData
Definition: ble_gap_sm.h:119
BLE_gap_sm_set_security_param
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.
ble_sm_security_param_t::initKeyDistr
uint8_t initKeyDistr
Definition: ble_gap_sm.h:122
BLE_gap_sm_get_peer_ltk
bool BLE_gap_sm_get_peer_ltk(uint8_t *peerAddr, uint8_t *peerLtk)
Get peer LTK in flash by peer address.
ble_sm_security_param_t::authReq
uint8_t authReq
Definition: ble_gap_sm.h:120