Initial commit
mbed-dev-master/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/cb_bt_sec_man.h@0:bb348c97df44, 2020-09-16 (annotated)
- Committer:
- lypinator
- Date:
- Wed Sep 16 01:11:49 2020 +0000
- Revision:
- 0:bb348c97df44
Added PWM
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lypinator | 0:bb348c97df44 | 1 | /*--------------------------------------------------------------------------- |
lypinator | 0:bb348c97df44 | 2 | * Copyright (c) 2016, u-blox Malmö, All Rights Reserved |
lypinator | 0:bb348c97df44 | 3 | * SPDX-License-Identifier: LicenseRef-PBL |
lypinator | 0:bb348c97df44 | 4 | * |
lypinator | 0:bb348c97df44 | 5 | * This file and the related binary are licensed under the |
lypinator | 0:bb348c97df44 | 6 | * Permissive Binary License, Version 1.0 (the "License"); |
lypinator | 0:bb348c97df44 | 7 | * you may not use these files except in compliance with the License. |
lypinator | 0:bb348c97df44 | 8 | * |
lypinator | 0:bb348c97df44 | 9 | * You may obtain a copy of the License here: |
lypinator | 0:bb348c97df44 | 10 | * LICENSE-permissive-binary-license-1.0.txt and at |
lypinator | 0:bb348c97df44 | 11 | * https://www.mbed.com/licenses/PBL-1.0 |
lypinator | 0:bb348c97df44 | 12 | * |
lypinator | 0:bb348c97df44 | 13 | * See the License for the specific language governing permissions and |
lypinator | 0:bb348c97df44 | 14 | * limitations under the License. |
lypinator | 0:bb348c97df44 | 15 | * |
lypinator | 0:bb348c97df44 | 16 | * Component : Bluetooth Security Manager |
lypinator | 0:bb348c97df44 | 17 | * File : cb_bt_sec_man.h |
lypinator | 0:bb348c97df44 | 18 | * |
lypinator | 0:bb348c97df44 | 19 | * Description : Bluetooth security application support |
lypinator | 0:bb348c97df44 | 20 | *-------------------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 21 | |
lypinator | 0:bb348c97df44 | 22 | /** |
lypinator | 0:bb348c97df44 | 23 | * @file cb_bt_sec_man.h |
lypinator | 0:bb348c97df44 | 24 | * @brief Bluetooth security application support. This includes bonding, |
lypinator | 0:bb348c97df44 | 25 | * security modes, passkey and pin code handling. |
lypinator | 0:bb348c97df44 | 26 | */ |
lypinator | 0:bb348c97df44 | 27 | |
lypinator | 0:bb348c97df44 | 28 | #ifndef _CB_BT_SEC_MAN_H_ |
lypinator | 0:bb348c97df44 | 29 | #define _CB_BT_SEC_MAN_H_ |
lypinator | 0:bb348c97df44 | 30 | |
lypinator | 0:bb348c97df44 | 31 | #include "cb_comdefs.h" |
lypinator | 0:bb348c97df44 | 32 | |
lypinator | 0:bb348c97df44 | 33 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 34 | extern "C" { |
lypinator | 0:bb348c97df44 | 35 | #endif |
lypinator | 0:bb348c97df44 | 36 | |
lypinator | 0:bb348c97df44 | 37 | /*=========================================================================== |
lypinator | 0:bb348c97df44 | 38 | * DEFINES |
lypinator | 0:bb348c97df44 | 39 | *=========================================================================*/ |
lypinator | 0:bb348c97df44 | 40 | #define cbBSM_OK (0) |
lypinator | 0:bb348c97df44 | 41 | #define cbBSM_ERROR (-1) |
lypinator | 0:bb348c97df44 | 42 | |
lypinator | 0:bb348c97df44 | 43 | #define cbBSM_PASSKEY_MAX_VALUE (999999) |
lypinator | 0:bb348c97df44 | 44 | |
lypinator | 0:bb348c97df44 | 45 | /*=========================================================================== |
lypinator | 0:bb348c97df44 | 46 | * TYPES |
lypinator | 0:bb348c97df44 | 47 | *=========================================================================*/ |
lypinator | 0:bb348c97df44 | 48 | |
lypinator | 0:bb348c97df44 | 49 | /** |
lypinator | 0:bb348c97df44 | 50 | * cbBSM_SECURITY_MODE_1_DISABLED |
lypinator | 0:bb348c97df44 | 51 | * Security disabled |
lypinator | 0:bb348c97df44 | 52 | * - Remote Device BT 2.1: Auto accept (No man-in-the-middle attack protection, encryption enabled) |
lypinator | 0:bb348c97df44 | 53 | * - Remote Device BT 2.0: Authentication and encryption disabled. |
lypinator | 0:bb348c97df44 | 54 | * - Bluetooth Low Energy: Auto accept (No man-in-the-middle attack protection, encryption enabled) |
lypinator | 0:bb348c97df44 | 55 | * |
lypinator | 0:bb348c97df44 | 56 | * cbBSM_SECURITY_MODE_2_BT_2_0 |
lypinator | 0:bb348c97df44 | 57 | * - Enforce BT 2.0 (Service level authentication and encryption enabled) |
lypinator | 0:bb348c97df44 | 58 | * Please note that the device is not BT 2.1 qualified for this setting. It is included for backward compatibility. Invalid for Bluetooth Low Energy. |
lypinator | 0:bb348c97df44 | 59 | * |
lypinator | 0:bb348c97df44 | 60 | * cbBSM_SECURITY_MODE_3_FIXED_PIN |
lypinator | 0:bb348c97df44 | 61 | * - Remote Device BT 2.1: Service level authentication and encryption enabled. |
lypinator | 0:bb348c97df44 | 62 | * - Remote Device BT 2.0: Service level authentication and encryption enabled. |
lypinator | 0:bb348c97df44 | 63 | * - Bluetooth Low Energy: Service level authentication and encryption enabled. |
lypinator | 0:bb348c97df44 | 64 | * Please note that this security mode will not work with a general BT 2.1 device. However, it will work between two connectBlue BT 2.1 Serial Port Adapters. Use security mode 4 to make the device work with a general BT 2.1 device. |
lypinator | 0:bb348c97df44 | 65 | * |
lypinator | 0:bb348c97df44 | 66 | * cbBSM_SECURITY_MODE_4_JUST_WORKS |
lypinator | 0:bb348c97df44 | 67 | * - Remote Device BT 2.1: Auto accept (no man-in-the-middle attack protection, encryption enabled) |
lypinator | 0:bb348c97df44 | 68 | * - Remote Device BT 2.0: Service level authentication and encryption enabled. |
lypinator | 0:bb348c97df44 | 69 | * - Bluetooth Low Energy: Auto accept (no man-in-the-middle attack protection, encryption enabled) |
lypinator | 0:bb348c97df44 | 70 | * This security mode is intended for pairing in safe environments. When this mode is set, pairability (see AT*AGPM) is automatically disabled. In data mode, pairing can be enabled for 60 seconds by pressing the "External Connect" button for at least 5 seconds. When the module is pairable, the LED will blink. If the mode is changed from Just Works to another, pairability must be enabled again using the AT*AGPM command. |
lypinator | 0:bb348c97df44 | 71 | * |
lypinator | 0:bb348c97df44 | 72 | * cbBSM_SECURITY_MODE_5_DISPLAY_ONLY |
lypinator | 0:bb348c97df44 | 73 | * - Remote Device BT 2.1: Service level authentication and encryption enabled. User should be presented a passkey. |
lypinator | 0:bb348c97df44 | 74 | * - Remote Device BT 2.0: Service level authentication and encryption enabled. No user interaction required. |
lypinator | 0:bb348c97df44 | 75 | * - Bluetooth Low Energy: Service level authentication and encryption enabled. User should be presented a passkey. |
lypinator | 0:bb348c97df44 | 76 | * This security mode is used when the device has a display that can present a 6-digit value that the user shall enter on the remote device. |
lypinator | 0:bb348c97df44 | 77 | * |
lypinator | 0:bb348c97df44 | 78 | * cbBSM_SECURITY_MODE_6_DISPLAY_YES_NO |
lypinator | 0:bb348c97df44 | 79 | * - Remote Device BT 2.1: Service level authentication and encryption enabled. User should compare two values. |
lypinator | 0:bb348c97df44 | 80 | * - Remote Device BT 2.0: Service level authentication and encryption enabled. No user interaction required. |
lypinator | 0:bb348c97df44 | 81 | * This security mode is used when the device has a display that can present a 6-digit value that the user shall verify with yes or no to the remote device's presented value. |
lypinator | 0:bb348c97df44 | 82 | * Invalid for Bluetooth Low Energy. |
lypinator | 0:bb348c97df44 | 83 | * |
lypinator | 0:bb348c97df44 | 84 | * cbBSM_SECURITY_MODE_7_KEYBOARD_ONLY |
lypinator | 0:bb348c97df44 | 85 | * - Remote Device BT 2.1: Service level authentication and encryption enabled. User should enter a passkey. |
lypinator | 0:bb348c97df44 | 86 | * - Remote Device BT 2.0: Service level authentication and encryption enabled. No user interaction required. |
lypinator | 0:bb348c97df44 | 87 | * - Bluetooth Low Energy: Service level authentication and encryption enabled. User should enter a passkey. |
lypinator | 0:bb348c97df44 | 88 | * This security mode is used when the device only has a keyboard where the user can enter a 6-digit value that is presented on the remote device. |
lypinator | 0:bb348c97df44 | 89 | */ |
lypinator | 0:bb348c97df44 | 90 | typedef enum |
lypinator | 0:bb348c97df44 | 91 | { |
lypinator | 0:bb348c97df44 | 92 | cbBSM_SECURITY_MODE_1_DISABLED = 1, |
lypinator | 0:bb348c97df44 | 93 | cbBSM_SECURITY_MODE_2_BT_2_0, |
lypinator | 0:bb348c97df44 | 94 | cbBSM_SECURITY_MODE_3_FIXED_PIN, |
lypinator | 0:bb348c97df44 | 95 | cbBSM_SECURITY_MODE_4_JUST_WORKS, |
lypinator | 0:bb348c97df44 | 96 | cbBSM_SECURITY_MODE_5_DISPLAY_ONLY, |
lypinator | 0:bb348c97df44 | 97 | cbBSM_SECURITY_MODE_6_DISPLAY_YES_NO, |
lypinator | 0:bb348c97df44 | 98 | cbBSM_SECURITY_MODE_7_KEYBOARD_ONLY |
lypinator | 0:bb348c97df44 | 99 | } cbBSM_SecurityMode; |
lypinator | 0:bb348c97df44 | 100 | |
lypinator | 0:bb348c97df44 | 101 | typedef struct |
lypinator | 0:bb348c97df44 | 102 | { |
lypinator | 0:bb348c97df44 | 103 | TPinCode pin; |
lypinator | 0:bb348c97df44 | 104 | cb_uint8 nBytes; |
lypinator | 0:bb348c97df44 | 105 | } cbBSM_PinCode; |
lypinator | 0:bb348c97df44 | 106 | |
lypinator | 0:bb348c97df44 | 107 | typedef enum |
lypinator | 0:bb348c97df44 | 108 | { |
lypinator | 0:bb348c97df44 | 109 | cbBSM_BOND_TYPE_CLASSIC, |
lypinator | 0:bb348c97df44 | 110 | cbBSM_BOND_TYPE_LE, |
lypinator | 0:bb348c97df44 | 111 | cbBSM_BOND_TYPE_ALL, |
lypinator | 0:bb348c97df44 | 112 | } cbBSM_BondTypes; |
lypinator | 0:bb348c97df44 | 113 | |
lypinator | 0:bb348c97df44 | 114 | typedef enum |
lypinator | 0:bb348c97df44 | 115 | { |
lypinator | 0:bb348c97df44 | 116 | cbBSM_BOND_STATUS_OK = 0, |
lypinator | 0:bb348c97df44 | 117 | cbBSM_BOND_STATUS_ERR_PAGE_TMO, |
lypinator | 0:bb348c97df44 | 118 | cbBSM_BOND_STATUS_ERR_AUTH_FAIL, |
lypinator | 0:bb348c97df44 | 119 | cbBSM_BOND_STATUS_ERR_NO_MITM |
lypinator | 0:bb348c97df44 | 120 | } cbBSM_BondStatus; |
lypinator | 0:bb348c97df44 | 121 | |
lypinator | 0:bb348c97df44 | 122 | /** |
lypinator | 0:bb348c97df44 | 123 | * Callback to indicate that bonding is finished. |
lypinator | 0:bb348c97df44 | 124 | * @param bdAddress Remote BD address |
lypinator | 0:bb348c97df44 | 125 | * @param bondStatus Bond status, e.g. cbBSM_BOND_STATUS_OK |
lypinator | 0:bb348c97df44 | 126 | * @return None |
lypinator | 0:bb348c97df44 | 127 | */ |
lypinator | 0:bb348c97df44 | 128 | typedef void (*cbBSM_BondCnf)( |
lypinator | 0:bb348c97df44 | 129 | cbBSM_BondStatus status, |
lypinator | 0:bb348c97df44 | 130 | TBdAddr* pBdAddress); |
lypinator | 0:bb348c97df44 | 131 | |
lypinator | 0:bb348c97df44 | 132 | /** |
lypinator | 0:bb348c97df44 | 133 | * Callback to indicate that a pin code is required from upper layer. |
lypinator | 0:bb348c97df44 | 134 | * Respond the pin code request with cbBSM_rspFixedPin/cbBSM_rspNegFixedPin |
lypinator | 0:bb348c97df44 | 135 | * This is only used when either local or remote side does not support |
lypinator | 0:bb348c97df44 | 136 | * BT 2.1 secure simple pairing. |
lypinator | 0:bb348c97df44 | 137 | * @param bdAddress Remote BD address |
lypinator | 0:bb348c97df44 | 138 | * @return None |
lypinator | 0:bb348c97df44 | 139 | */ |
lypinator | 0:bb348c97df44 | 140 | typedef void (*cbBSM_RequestPinInd)( |
lypinator | 0:bb348c97df44 | 141 | TBdAddr* pBdAddress); |
lypinator | 0:bb348c97df44 | 142 | |
lypinator | 0:bb348c97df44 | 143 | /** |
lypinator | 0:bb348c97df44 | 144 | * Callback to indicate that user confirmation is required. The user should |
lypinator | 0:bb348c97df44 | 145 | * compare numericValues on local and remote side and respond the confirmation |
lypinator | 0:bb348c97df44 | 146 | * request with cbBSM_rspUserConfirmation if values match and |
lypinator | 0:bb348c97df44 | 147 | * cbBSM_rspNegUserConfirmation if they do not match or user wants to interrupt |
lypinator | 0:bb348c97df44 | 148 | * the pairing attempt. |
lypinator | 0:bb348c97df44 | 149 | * This is only used when both sides support BT 2.1 secure simple pairing and |
lypinator | 0:bb348c97df44 | 150 | * security mode cbBSM_SECURITY_MODE_6_DISPLAY_YES_NO is used. |
lypinator | 0:bb348c97df44 | 151 | * @param bdAddress Remote BD address |
lypinator | 0:bb348c97df44 | 152 | * @param numericValue The numeric value to be compared |
lypinator | 0:bb348c97df44 | 153 | * @return None |
lypinator | 0:bb348c97df44 | 154 | */ |
lypinator | 0:bb348c97df44 | 155 | typedef void (*cbBSM_UserConfirmationInd)( |
lypinator | 0:bb348c97df44 | 156 | TBdAddr* pBdAddress, |
lypinator | 0:bb348c97df44 | 157 | cb_uint32 numericValue); |
lypinator | 0:bb348c97df44 | 158 | |
lypinator | 0:bb348c97df44 | 159 | /** |
lypinator | 0:bb348c97df44 | 160 | * Callback to indicate that a passkey is required from upper layer. |
lypinator | 0:bb348c97df44 | 161 | * Respond the passkey request with cbBSM_rspUserPasskey/cbBSM_rspNegUserPasskey. |
lypinator | 0:bb348c97df44 | 162 | * This is only used when both sides support BT 2.1 secure simple pairing and |
lypinator | 0:bb348c97df44 | 163 | * security modes cbBSM_SECURITY_MODE_3_FIXED_PIN or cbBSM_SECURITY_MODE_7_KEYBOARD_ONLY is used |
lypinator | 0:bb348c97df44 | 164 | * @param bdAddress Remote BD address |
lypinator | 0:bb348c97df44 | 165 | * @return None |
lypinator | 0:bb348c97df44 | 166 | */ |
lypinator | 0:bb348c97df44 | 167 | typedef void (*cbBSM_UserPasskeyInd)( |
lypinator | 0:bb348c97df44 | 168 | TBdAddr* pBdAddress); |
lypinator | 0:bb348c97df44 | 169 | |
lypinator | 0:bb348c97df44 | 170 | /** |
lypinator | 0:bb348c97df44 | 171 | * Callback to indicate that a passkey is used in the pairing procedure. |
lypinator | 0:bb348c97df44 | 172 | * The passkey should be displayed to the user. |
lypinator | 0:bb348c97df44 | 173 | * This is only used when both sides support BT 2.1 secure simple pairing and |
lypinator | 0:bb348c97df44 | 174 | * security mode cbBSM_SECURITY_MODE_5_DISPLAY_ONLY is used. |
lypinator | 0:bb348c97df44 | 175 | * @param bdAddress Remote BD address |
lypinator | 0:bb348c97df44 | 176 | * @param passkey Passkey |
lypinator | 0:bb348c97df44 | 177 | * @return None |
lypinator | 0:bb348c97df44 | 178 | */ |
lypinator | 0:bb348c97df44 | 179 | typedef void (*cbBSM_UserPasskeyEvt)( |
lypinator | 0:bb348c97df44 | 180 | TBdAddr* pBdAddress, |
lypinator | 0:bb348c97df44 | 181 | cb_uint32 passkey); |
lypinator | 0:bb348c97df44 | 182 | |
lypinator | 0:bb348c97df44 | 183 | typedef struct |
lypinator | 0:bb348c97df44 | 184 | { |
lypinator | 0:bb348c97df44 | 185 | cbBSM_RequestPinInd requestPinInd; |
lypinator | 0:bb348c97df44 | 186 | cbBSM_UserConfirmationInd userConfirmationInd; |
lypinator | 0:bb348c97df44 | 187 | cbBSM_UserPasskeyInd userPasskeyInd; |
lypinator | 0:bb348c97df44 | 188 | cbBSM_UserPasskeyEvt userPasskeyEvt; |
lypinator | 0:bb348c97df44 | 189 | cbBSM_BondCnf bondConfirmation; |
lypinator | 0:bb348c97df44 | 190 | cbBSM_BondCnf bondEvent; |
lypinator | 0:bb348c97df44 | 191 | } cbBSM_Callbacks; |
lypinator | 0:bb348c97df44 | 192 | |
lypinator | 0:bb348c97df44 | 193 | /*=========================================================================== |
lypinator | 0:bb348c97df44 | 194 | * FUNCTIONS |
lypinator | 0:bb348c97df44 | 195 | *=========================================================================*/ |
lypinator | 0:bb348c97df44 | 196 | |
lypinator | 0:bb348c97df44 | 197 | /** |
lypinator | 0:bb348c97df44 | 198 | * Initialization of BLuetooth security manager. Called during stack |
lypinator | 0:bb348c97df44 | 199 | * initialization. Shall not be called by application. |
lypinator | 0:bb348c97df44 | 200 | * |
lypinator | 0:bb348c97df44 | 201 | * @return None |
lypinator | 0:bb348c97df44 | 202 | */ |
lypinator | 0:bb348c97df44 | 203 | extern void cbBSM_init(void); |
lypinator | 0:bb348c97df44 | 204 | |
lypinator | 0:bb348c97df44 | 205 | /** |
lypinator | 0:bb348c97df44 | 206 | * Register security callbacks. Callbacks in the struct that are not |
lypinator | 0:bb348c97df44 | 207 | * of any interest can be set to NULL. |
lypinator | 0:bb348c97df44 | 208 | * |
lypinator | 0:bb348c97df44 | 209 | * @param pPairingCallbacks Pointer to the security callback struct |
lypinator | 0:bb348c97df44 | 210 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 211 | */ |
lypinator | 0:bb348c97df44 | 212 | extern cb_int32 cbBSM_registerCallbacks(cbBSM_Callbacks* pPairingCallbacks); |
lypinator | 0:bb348c97df44 | 213 | |
lypinator | 0:bb348c97df44 | 214 | /** |
lypinator | 0:bb348c97df44 | 215 | * Set security mode. See comments on cbBSM_SecurityMode for |
lypinator | 0:bb348c97df44 | 216 | * description of the different security modes. |
lypinator | 0:bb348c97df44 | 217 | * |
lypinator | 0:bb348c97df44 | 218 | * @param securityMode Security mode. Default security is cbBSM_SECURITY_MODE_1_DISABLED |
lypinator | 0:bb348c97df44 | 219 | * @param allowPairingInNonBondableMode Normally FALSE. Set to TRUE if pairing should be allowed when not bondable. |
lypinator | 0:bb348c97df44 | 220 | * No link keys will then be stored. |
lypinator | 0:bb348c97df44 | 221 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 222 | */ |
lypinator | 0:bb348c97df44 | 223 | extern cb_int32 cbBSM_setSecurityMode( |
lypinator | 0:bb348c97df44 | 224 | cbBSM_SecurityMode securityMode, |
lypinator | 0:bb348c97df44 | 225 | cb_boolean allowPairingInNonBondableMode); |
lypinator | 0:bb348c97df44 | 226 | |
lypinator | 0:bb348c97df44 | 227 | /** |
lypinator | 0:bb348c97df44 | 228 | * Read current security mode. |
lypinator | 0:bb348c97df44 | 229 | * |
lypinator | 0:bb348c97df44 | 230 | * @param pSecurityMode Security mode |
lypinator | 0:bb348c97df44 | 231 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 232 | */ |
lypinator | 0:bb348c97df44 | 233 | extern cb_int32 cbBSM_getSecurityMode(cbBSM_SecurityMode* pSecurityMode); |
lypinator | 0:bb348c97df44 | 234 | |
lypinator | 0:bb348c97df44 | 235 | /** |
lypinator | 0:bb348c97df44 | 236 | * Sets the local device pairable mode. |
lypinator | 0:bb348c97df44 | 237 | * |
lypinator | 0:bb348c97df44 | 238 | * @param pairable TRUE=pairable, FALSE=not pairable (default) |
lypinator | 0:bb348c97df44 | 239 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 240 | */ |
lypinator | 0:bb348c97df44 | 241 | extern cb_int32 cbBSM_setPairable(boolean pairable); |
lypinator | 0:bb348c97df44 | 242 | |
lypinator | 0:bb348c97df44 | 243 | /** |
lypinator | 0:bb348c97df44 | 244 | * Gets the local device pairable mode. |
lypinator | 0:bb348c97df44 | 245 | * |
lypinator | 0:bb348c97df44 | 246 | * @param pPairable Pointer to return value |
lypinator | 0:bb348c97df44 | 247 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 248 | */ |
lypinator | 0:bb348c97df44 | 249 | extern cb_int32 cbBSM_getPairable(boolean* pPairable); |
lypinator | 0:bb348c97df44 | 250 | |
lypinator | 0:bb348c97df44 | 251 | /** |
lypinator | 0:bb348c97df44 | 252 | * Performs bonding with a remote device. The cbBSM_BondCnf callback will |
lypinator | 0:bb348c97df44 | 253 | * be called upon success/failure. |
lypinator | 0:bb348c97df44 | 254 | * |
lypinator | 0:bb348c97df44 | 255 | * @param remoteDevice Remote BD address |
lypinator | 0:bb348c97df44 | 256 | * @param type Classic or LE |
lypinator | 0:bb348c97df44 | 257 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 258 | */ |
lypinator | 0:bb348c97df44 | 259 | extern cb_int32 cbBSM_reqBond( |
lypinator | 0:bb348c97df44 | 260 | TBdAddr remoteDevice, |
lypinator | 0:bb348c97df44 | 261 | TBluetoothType type); |
lypinator | 0:bb348c97df44 | 262 | |
lypinator | 0:bb348c97df44 | 263 | /** |
lypinator | 0:bb348c97df44 | 264 | * Responds on the cbBSM_RequestPinInd callback with a pin code |
lypinator | 0:bb348c97df44 | 265 | * This is only used when either local or remote side does not support |
lypinator | 0:bb348c97df44 | 266 | * BT 2.1 secure simple pairing. |
lypinator | 0:bb348c97df44 | 267 | * |
lypinator | 0:bb348c97df44 | 268 | * @param pBdAddress Pointer to the remote BD address |
lypinator | 0:bb348c97df44 | 269 | * @param pinCodeLength Length of the provided pin code |
lypinator | 0:bb348c97df44 | 270 | * @param pPinCode Pointer to the provided pin code |
lypinator | 0:bb348c97df44 | 271 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 272 | */ |
lypinator | 0:bb348c97df44 | 273 | extern cb_int32 cbBSM_rspFixedPin( |
lypinator | 0:bb348c97df44 | 274 | TBdAddr* pBdAddress, |
lypinator | 0:bb348c97df44 | 275 | cb_uint8 pinCodeLength, |
lypinator | 0:bb348c97df44 | 276 | cb_uint8 *pPinCode); |
lypinator | 0:bb348c97df44 | 277 | |
lypinator | 0:bb348c97df44 | 278 | /** |
lypinator | 0:bb348c97df44 | 279 | * Responds the cbBSM_RequestPinInd callback. Can be used to interrupt a |
lypinator | 0:bb348c97df44 | 280 | * pairing attempt from the remote device. |
lypinator | 0:bb348c97df44 | 281 | * This is only used when either local or remote side does not support |
lypinator | 0:bb348c97df44 | 282 | * BT 2.1 secure simple pairing. |
lypinator | 0:bb348c97df44 | 283 | * |
lypinator | 0:bb348c97df44 | 284 | * @param pBdAddress Pointer to the remote BD address |
lypinator | 0:bb348c97df44 | 285 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 286 | */ |
lypinator | 0:bb348c97df44 | 287 | extern cb_int32 cbBSM_rspNegFixedPin(TBdAddr* pBdAddress); |
lypinator | 0:bb348c97df44 | 288 | |
lypinator | 0:bb348c97df44 | 289 | /** |
lypinator | 0:bb348c97df44 | 290 | * Responds on the cbBSM_UserPasskeyInd callback. |
lypinator | 0:bb348c97df44 | 291 | * This is only used when both sides support BT 2.1 secure simple pairing. |
lypinator | 0:bb348c97df44 | 292 | * |
lypinator | 0:bb348c97df44 | 293 | * @param pBdAddress Pointer to the remote BD address |
lypinator | 0:bb348c97df44 | 294 | * @param passkey Passkey, range: 0-999999 |
lypinator | 0:bb348c97df44 | 295 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 296 | */ |
lypinator | 0:bb348c97df44 | 297 | extern cb_int32 cbBSM_rspUserPasskey( |
lypinator | 0:bb348c97df44 | 298 | TBdAddr *pBdAddress, |
lypinator | 0:bb348c97df44 | 299 | uint32 passkey); |
lypinator | 0:bb348c97df44 | 300 | |
lypinator | 0:bb348c97df44 | 301 | /** |
lypinator | 0:bb348c97df44 | 302 | * Responds on the cbBSM_UserPasskeyInd callback. Can be used to interrupt a |
lypinator | 0:bb348c97df44 | 303 | * pairing attempt from the remote device. |
lypinator | 0:bb348c97df44 | 304 | * This is only used when both sides support BT 2.1 secure simple pairing. |
lypinator | 0:bb348c97df44 | 305 | * |
lypinator | 0:bb348c97df44 | 306 | * @param pBdAddress Pointer to the remote BD address |
lypinator | 0:bb348c97df44 | 307 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 308 | */ |
lypinator | 0:bb348c97df44 | 309 | extern cb_int32 cbBSM_rspNegUserPasskey(TBdAddr *pBdAddress); |
lypinator | 0:bb348c97df44 | 310 | |
lypinator | 0:bb348c97df44 | 311 | /** |
lypinator | 0:bb348c97df44 | 312 | * Responds on the cbBSM_UserConfirmationInd callback. Accepts the numeric value. |
lypinator | 0:bb348c97df44 | 313 | * This is only used when both sides support BT 2.1 secure simple pairing. |
lypinator | 0:bb348c97df44 | 314 | * |
lypinator | 0:bb348c97df44 | 315 | * @param pBdAddress Pointer to the remote BD address |
lypinator | 0:bb348c97df44 | 316 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 317 | */ |
lypinator | 0:bb348c97df44 | 318 | extern cb_int32 cbBSM_rspUserConfirmation(TBdAddr* pBdAddress); |
lypinator | 0:bb348c97df44 | 319 | |
lypinator | 0:bb348c97df44 | 320 | /** |
lypinator | 0:bb348c97df44 | 321 | * Responds on the cbBSM_UserConfirmationInd callback. Rejects the numeric value. |
lypinator | 0:bb348c97df44 | 322 | * This is only used when both sides support BT 2.1 secure simple pairing. |
lypinator | 0:bb348c97df44 | 323 | * |
lypinator | 0:bb348c97df44 | 324 | * @param pBdAddress Pointer to the remote BD address |
lypinator | 0:bb348c97df44 | 325 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 326 | */ |
lypinator | 0:bb348c97df44 | 327 | extern cb_int32 cbBSM_rspNegUserConfirmation(TBdAddr* pBdAddress); |
lypinator | 0:bb348c97df44 | 328 | |
lypinator | 0:bb348c97df44 | 329 | /** |
lypinator | 0:bb348c97df44 | 330 | * Get number of bonded devices. |
lypinator | 0:bb348c97df44 | 331 | * |
lypinator | 0:bb348c97df44 | 332 | * @param type Bond type |
lypinator | 0:bb348c97df44 | 333 | * @param pNo Pointer to return value. |
lypinator | 0:bb348c97df44 | 334 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 335 | */ |
lypinator | 0:bb348c97df44 | 336 | extern cb_int32 cbBSM_getAllNumberBondedDevices( |
lypinator | 0:bb348c97df44 | 337 | cbBSM_BondTypes type, |
lypinator | 0:bb348c97df44 | 338 | uint32* pNo); |
lypinator | 0:bb348c97df44 | 339 | |
lypinator | 0:bb348c97df44 | 340 | /** |
lypinator | 0:bb348c97df44 | 341 | * Get a bonded devices. |
lypinator | 0:bb348c97df44 | 342 | * |
lypinator | 0:bb348c97df44 | 343 | * @param deviceIndex Index of the bonded device |
lypinator | 0:bb348c97df44 | 344 | * @param pBdAddr Pointer to remote BD address. |
lypinator | 0:bb348c97df44 | 345 | * @param pIsLe Should be TRUE for LE and FALSE for classic |
lypinator | 0:bb348c97df44 | 346 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 347 | */ |
lypinator | 0:bb348c97df44 | 348 | extern cb_int32 cbBSM_getBondedDevice( |
lypinator | 0:bb348c97df44 | 349 | cb_int32 deviceIndex, |
lypinator | 0:bb348c97df44 | 350 | TBdAddr* pBdAddr, |
lypinator | 0:bb348c97df44 | 351 | cb_boolean pIsLe); |
lypinator | 0:bb348c97df44 | 352 | |
lypinator | 0:bb348c97df44 | 353 | /** |
lypinator | 0:bb348c97df44 | 354 | * Delete a bonded device and its link keys. |
lypinator | 0:bb348c97df44 | 355 | * |
lypinator | 0:bb348c97df44 | 356 | * @param pBdAddress to the address of the device which bond shall be deleted. |
lypinator | 0:bb348c97df44 | 357 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 358 | */ |
lypinator | 0:bb348c97df44 | 359 | extern cb_int32 cbBSM_deleteBondedDevice(TBdAddr* pBdAddress); |
lypinator | 0:bb348c97df44 | 360 | |
lypinator | 0:bb348c97df44 | 361 | /** |
lypinator | 0:bb348c97df44 | 362 | * Delete all bonded devices and link keys. |
lypinator | 0:bb348c97df44 | 363 | * |
lypinator | 0:bb348c97df44 | 364 | * @return If the operation is successful cbBSM_OK is returned. |
lypinator | 0:bb348c97df44 | 365 | */ |
lypinator | 0:bb348c97df44 | 366 | extern cb_int32 cbBSM_deleteAllBondedDevices(void); |
lypinator | 0:bb348c97df44 | 367 | |
lypinator | 0:bb348c97df44 | 368 | /** |
lypinator | 0:bb348c97df44 | 369 | * Initializes the static Link Keys for both classic and LE. |
lypinator | 0:bb348c97df44 | 370 | * nvdsId: nvds id for the static link key, |
lypinator | 0:bb348c97df44 | 371 | * (0) disables the use of a static link key. |
lypinator | 0:bb348c97df44 | 372 | * |
lypinator | 0:bb348c97df44 | 373 | * @return cbBSM_OK. |
lypinator | 0:bb348c97df44 | 374 | */ |
lypinator | 0:bb348c97df44 | 375 | cb_int32 cbBSM_setStaticLinkKeyNvdsId(cb_int32 nvdsId); |
lypinator | 0:bb348c97df44 | 376 | |
lypinator | 0:bb348c97df44 | 377 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 378 | } |
lypinator | 0:bb348c97df44 | 379 | #endif |
lypinator | 0:bb348c97df44 | 380 | |
lypinator | 0:bb348c97df44 | 381 | #endif /* _CB_BT_SEC_MAN_H_ */ |
lypinator | 0:bb348c97df44 | 382 | |
lypinator | 0:bb348c97df44 | 383 | |
lypinator | 0:bb348c97df44 | 384 | |
lypinator | 0:bb348c97df44 | 385 | |
lypinator | 0:bb348c97df44 | 386 | |
lypinator | 0:bb348c97df44 | 387 |