Maxim Integrated Bluetooth LE Library

Dependents:   BLE_Thermometer MAXWSNENV_demo

Committer:
enginerd
Date:
Thu Oct 06 22:02:31 2016 +0000
Revision:
5:5b87f64ce81e
Parent:
0:b562096246b3
Added new required method.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
enginerd 0:b562096246b3 1 /*************************************************************************************************/
enginerd 0:b562096246b3 2 /*!
enginerd 0:b562096246b3 3 * \file dm_api.h
enginerd 0:b562096246b3 4 *
enginerd 0:b562096246b3 5 * \brief Device Manager subsystem API.
enginerd 0:b562096246b3 6 *
enginerd 0:b562096246b3 7 * $Date: 2012-09-11 16:18:57 -0700 (Tue, 11 Sep 2012) $
enginerd 0:b562096246b3 8 * $Revision: 349 $
enginerd 0:b562096246b3 9 *
enginerd 0:b562096246b3 10 * Copyright (c) 2009-2016 ARM Limited. All rights reserved.
enginerd 0:b562096246b3 11 *
enginerd 0:b562096246b3 12 * SPDX-License-Identifier: LicenseRef-PBL
enginerd 0:b562096246b3 13 *
enginerd 0:b562096246b3 14 * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use
enginerd 0:b562096246b3 15 * this file except in compliance with the License. You may obtain a copy of the License at
enginerd 0:b562096246b3 16 *
enginerd 0:b562096246b3 17 * https://www.mbed.com/licenses/PBL-1.0
enginerd 0:b562096246b3 18 *
enginerd 0:b562096246b3 19 * See the License for the specific language governing permissions and limitations under the License.
enginerd 0:b562096246b3 20 */
enginerd 0:b562096246b3 21 /*************************************************************************************************/
enginerd 0:b562096246b3 22 #ifndef DM_API_H
enginerd 0:b562096246b3 23 #define DM_API_H
enginerd 0:b562096246b3 24
enginerd 0:b562096246b3 25 #include "hci_api.h"
enginerd 0:b562096246b3 26 #include "cfg_stack.h"
enginerd 0:b562096246b3 27 #include "smp_defs.h"
enginerd 0:b562096246b3 28
enginerd 0:b562096246b3 29 #ifdef __cplusplus
enginerd 0:b562096246b3 30 extern "C" {
enginerd 0:b562096246b3 31 #endif
enginerd 0:b562096246b3 32
enginerd 0:b562096246b3 33 /**************************************************************************************************
enginerd 0:b562096246b3 34 Macros
enginerd 0:b562096246b3 35 **************************************************************************************************/
enginerd 0:b562096246b3 36
enginerd 0:b562096246b3 37 /*! Device role */
enginerd 0:b562096246b3 38 #define DM_ROLE_MASTER HCI_ROLE_MASTER /*! Role is master */
enginerd 0:b562096246b3 39 #define DM_ROLE_SLAVE HCI_ROLE_SLAVE /*! Role is slave */
enginerd 0:b562096246b3 40
enginerd 0:b562096246b3 41 /*! The GAP discovery mode */
enginerd 0:b562096246b3 42 #define DM_DISC_MODE_NONE 0 /*! GAP non-discoverable */
enginerd 0:b562096246b3 43 #define DM_DISC_MODE_LIMITED 1 /*! GAP limited discoverable mode */
enginerd 0:b562096246b3 44 #define DM_DISC_MODE_GENERAL 2 /*! GAP general discoverable mode */
enginerd 0:b562096246b3 45
enginerd 0:b562096246b3 46 /*! The type of connectable or discoverable of advertising */
enginerd 0:b562096246b3 47 #define DM_ADV_CONN_UNDIRECT 0 /*! Connectable undirected advertising */
enginerd 0:b562096246b3 48 #define DM_ADV_CONN_DIRECT 1 /*! Connectable directed advertising */
enginerd 0:b562096246b3 49 #define DM_ADV_DISC_UNDIRECT 2 /*! Discoverable undirected advertising */
enginerd 0:b562096246b3 50 #define DM_ADV_NONCONN_UNDIRECT 3 /*! Non-connectable undirected advertising */
enginerd 0:b562096246b3 51 #define DM_ADV_SCAN_RESPONSE 4 /*! Scan response */
enginerd 0:b562096246b3 52 #define DM_ADV_NONE 255 /*! For internal use only */
enginerd 0:b562096246b3 53
enginerd 0:b562096246b3 54 /*! Whether data is located in the advertising data or the scan response data */
enginerd 0:b562096246b3 55 #define DM_DATA_LOC_ADV 0 /*! Locate data in the advertising data */
enginerd 0:b562096246b3 56 #define DM_DATA_LOC_SCAN 1 /*! Locate data in the scan response data */
enginerd 0:b562096246b3 57
enginerd 0:b562096246b3 58 /*! The scan type */
enginerd 0:b562096246b3 59 #define DM_SCAN_TYPE_PASSIVE 0 /*! Passive scan */
enginerd 0:b562096246b3 60 #define DM_SCAN_TYPE_ACTIVE 1 /*! Active scan */
enginerd 0:b562096246b3 61
enginerd 0:b562096246b3 62 /*! Advertising channel map */
enginerd 0:b562096246b3 63 #define DM_ADV_CHAN_37 HCI_ADV_CHAN_37 /*! Advertising channel 37 */
enginerd 0:b562096246b3 64 #define DM_ADV_CHAN_38 HCI_ADV_CHAN_38 /*! Advertising channel 38 */
enginerd 0:b562096246b3 65 #define DM_ADV_CHAN_39 HCI_ADV_CHAN_39 /*! Advertising channel 39 */
enginerd 0:b562096246b3 66 #define DM_ADV_CHAN_ALL (HCI_ADV_CHAN_37 | HCI_ADV_CHAN_38 | HCI_ADV_CHAN_39)
enginerd 0:b562096246b3 67
enginerd 0:b562096246b3 68 /*! The client ID parameter to function DmConnRegister() */
enginerd 0:b562096246b3 69 #define DM_CLIENT_ID_ATT 0 /*! Identifier for attribute protocol, for internal use only */
enginerd 0:b562096246b3 70 #define DM_CLIENT_ID_SMP 1 /*! Identifier for security manager protocol, for internal use only */
enginerd 0:b562096246b3 71 #define DM_CLIENT_ID_DM 2 /*! Identifier for device manager, for internal use only */
enginerd 0:b562096246b3 72 #define DM_CLIENT_ID_APP 3 /*! Identifier for the application */
enginerd 0:b562096246b3 73 #define DM_CLIENT_ID_MAX 4 /*! For internal use only */
enginerd 0:b562096246b3 74
enginerd 0:b562096246b3 75 /*! Unknown connection ID or other error */
enginerd 0:b562096246b3 76 #define DM_CONN_ID_NONE 0
enginerd 0:b562096246b3 77
enginerd 0:b562096246b3 78 /*! The address type */
enginerd 0:b562096246b3 79 #define DM_ADDR_PUBLIC 0 /*! Public address */
enginerd 0:b562096246b3 80 #define DM_ADDR_RANDOM 1 /*! Random address */
enginerd 0:b562096246b3 81
enginerd 0:b562096246b3 82 /*! Advertising data types */
enginerd 0:b562096246b3 83 #define DM_ADV_TYPE_FLAGS 0x01 /*! Flag bits */
enginerd 0:b562096246b3 84 #define DM_ADV_TYPE_16_UUID_PART 0x02 /*! Partial list of 16 bit UUIDs */
enginerd 0:b562096246b3 85 #define DM_ADV_TYPE_16_UUID 0x03 /*! Complete list of 16 bit UUIDs */
enginerd 0:b562096246b3 86 #define DM_ADV_TYPE_128_UUID_PART 0x06 /*! Partial list of 128 bit UUIDs */
enginerd 0:b562096246b3 87 #define DM_ADV_TYPE_128_UUID 0x07 /*! Complete list of 128 bit UUIDs */
enginerd 0:b562096246b3 88 #define DM_ADV_TYPE_SHORT_NAME 0x08 /*! Shortened local name */
enginerd 0:b562096246b3 89 #define DM_ADV_TYPE_LOCAL_NAME 0x09 /*! Complete local name */
enginerd 0:b562096246b3 90 #define DM_ADV_TYPE_TX_POWER 0x0A /*! TX power level */
enginerd 0:b562096246b3 91 #define DM_ADV_TYPE_CONN_INTERVAL 0x12 /*! Slave preferred connection interval */
enginerd 0:b562096246b3 92 #define DM_ADV_TYPE_SIGNED_DATA 0x13 /*! Signed data */
enginerd 0:b562096246b3 93 #define DM_ADV_TYPE_16_SOLICIT 0x14 /*! Service soliticiation list of 16 bit UUIDs */
enginerd 0:b562096246b3 94 #define DM_ADV_TYPE_128_SOLICIT 0x15 /*! Service soliticiation list of 128 bit UUIDs */
enginerd 0:b562096246b3 95 #define DM_ADV_TYPE_SERVICE_DATA 0x16 /*! Service data */
enginerd 0:b562096246b3 96 #define DM_ADV_TYPE_PUBLIC_TARGET 0x17 /*! Public target address */
enginerd 0:b562096246b3 97 #define DM_ADV_TYPE_RANDOM_TARGET 0x18 /*! Random target address */
enginerd 0:b562096246b3 98 #define DM_ADV_TYPE_APPEARANCE 0x19 /*! Device appearance */
enginerd 0:b562096246b3 99 #define DM_ADV_TYPE_MANUFACTURER 0xFF /*! Manufacturer specific data */
enginerd 0:b562096246b3 100
enginerd 0:b562096246b3 101 /*! Bit mask for flags advertising data type */
enginerd 0:b562096246b3 102 #define DM_FLAG_LE_LIMITED_DISC 0x01 /*! Limited discoverable flag */
enginerd 0:b562096246b3 103 #define DM_FLAG_LE_GENERAL_DISC 0x02 /*! General discoverable flag */
enginerd 0:b562096246b3 104 #define DM_FLAG_LE_BREDR_NOT_SUP 0x04 /*! BR/EDR not supported flag */
enginerd 0:b562096246b3 105
enginerd 0:b562096246b3 106 /*! Advertising data element indexes */
enginerd 0:b562096246b3 107 #define DM_AD_LEN_IDX 0 /*! Advertising data element len */
enginerd 0:b562096246b3 108 #define DM_AD_TYPE_IDX 1 /*! Advertising data element type */
enginerd 0:b562096246b3 109 #define DM_AD_DATA_IDX 2 /*! Advertising data element data */
enginerd 0:b562096246b3 110
enginerd 0:b562096246b3 111 /*! Timeouts defined by the GAP specification; in units of milliseconds */
enginerd 0:b562096246b3 112 #define DM_GAP_LIM_ADV_TIMEOUT 180000 /*! Maximum advertising duration in limited discoverable mode */
enginerd 0:b562096246b3 113 #define DM_GAP_GEN_DISC_SCAN_MIN 10240 /*! Minimum scan duration for general discovery */
enginerd 0:b562096246b3 114 #define DM_GAP_LIM_DISC_SCAN_MIN 10240 /*! Minimum scan duration for limited discovery */
enginerd 0:b562096246b3 115 #define DM_GAP_CONN_PARAM_TIMEOUT 30000 /*! Connection parameter update timeout */
enginerd 0:b562096246b3 116 #define DM_GAP_SCAN_FAST_PERIOD 30720 /*! Minimum time to perform scanning when user initiated */
enginerd 0:b562096246b3 117 #define DM_GAP_ADV_FAST_PERIOD 30000 /*! Minimum time to perform advertising when user initiated */
enginerd 0:b562096246b3 118
enginerd 0:b562096246b3 119 /*!
enginerd 0:b562096246b3 120 * Advertising, scanning, and connection parameters defined in the GAP specification.
enginerd 0:b562096246b3 121 * In units of 625 microseconds.
enginerd 0:b562096246b3 122 */
enginerd 0:b562096246b3 123 #define DM_GAP_SCAN_FAST_INT_MIN 48 /*! Minimum scan interval when user initiated */
enginerd 0:b562096246b3 124 #define DM_GAP_SCAN_FAST_INT_MAX 96 /*! Maximum scan interval when user initiated */
enginerd 0:b562096246b3 125 #define DM_GAP_SCAN_FAST_WINDOW 48 /*! Scan window when user initiated */
enginerd 0:b562096246b3 126 #define DM_GAP_SCAN_SLOW_INT_1 2048 /*! Scan interval 1 when background scannning */
enginerd 0:b562096246b3 127 #define DM_GAP_SCAN_SLOW_WINDOW_1 18 /*! Scan window 1 when background scanning */
enginerd 0:b562096246b3 128 #define DM_GAP_SCAN_SLOW_INT_2 4096 /*! Scan interval 2 when background scannning */
enginerd 0:b562096246b3 129 #define DM_GAP_SCAN_SLOW_WINDOW_2 18 /*! Scan window 2 when background scanning */
enginerd 0:b562096246b3 130 #define DM_GAP_ADV_FAST_INT_MIN 48 /*! Minimum advertising interval when user initiated */
enginerd 0:b562096246b3 131 #define DM_GAP_ADV_FAST_INT_MAX 96 /*! Maximum advertising interval when user initiated */
enginerd 0:b562096246b3 132 #define DM_GAP_ADV_SLOW_INT_MIN 1600 /*! Minimum advertising interval when background advertising */
enginerd 0:b562096246b3 133 #define DM_GAP_ADV_SLOW_INT_MAX 1920 /*! Maximum advertising interval when background advertising */
enginerd 0:b562096246b3 134
enginerd 0:b562096246b3 135 /*! GAP connection establishment latency */
enginerd 0:b562096246b3 136 #define DM_GAP_CONN_EST_LATENCY 0
enginerd 0:b562096246b3 137
enginerd 0:b562096246b3 138 /*! GAP connection intervals in 1.25ms units */
enginerd 0:b562096246b3 139 #define DM_GAP_INITIAL_CONN_INT_MIN 24 /*! Minimum initial connection interval */
enginerd 0:b562096246b3 140 #define DM_GAP_INITIAL_CONN_INT_MAX 40 /*! Maximum initial onnection interval */
enginerd 0:b562096246b3 141
enginerd 0:b562096246b3 142 /*! GAP connection establishment minimum and maximum connection event lengths */
enginerd 0:b562096246b3 143 #define DM_GAP_CONN_EST_MIN_CE_LEN 0
enginerd 0:b562096246b3 144 #define DM_GAP_CONN_EST_MAX_CE_LEN 0
enginerd 0:b562096246b3 145
enginerd 0:b562096246b3 146 /*! GAP peripheral privacy flag characteristic values */
enginerd 0:b562096246b3 147 #define DM_GAP_PRIV_DISABLED 0
enginerd 0:b562096246b3 148 #define DM_GAP_PRIV_ENABLED 1
enginerd 0:b562096246b3 149
enginerd 0:b562096246b3 150 /*! Connection establishment supervision timeout default, in 10ms units */
enginerd 0:b562096246b3 151 #define DM_DEFAULT_EST_SUP_TIMEOUT 2000
enginerd 0:b562096246b3 152
enginerd 0:b562096246b3 153 /*! Pairing authentication/security properties bit mask */
enginerd 0:b562096246b3 154 #define DM_AUTH_BOND_FLAG SMP_AUTH_BOND_FLAG /*! Bonding requested */
enginerd 0:b562096246b3 155 #define DM_AUTH_MITM_FLAG SMP_AUTH_MITM_FLAG /*! MITM (authenticated pairing) requested */
enginerd 0:b562096246b3 156
enginerd 0:b562096246b3 157 /*! Key distribution bit mask */
enginerd 0:b562096246b3 158 #define DM_KEY_DIST_LTK SMP_KEY_DIST_ENC /*! Distribute LTK used for encryption */
enginerd 0:b562096246b3 159 #define DM_KEY_DIST_IRK SMP_KEY_DIST_ID /*! Distribute IRK used for privacy */
enginerd 0:b562096246b3 160 #define DM_KEY_DIST_CSRK SMP_KEY_DIST_SIGN /*! Distribute CSRK used for signed data */
enginerd 0:b562096246b3 161
enginerd 0:b562096246b3 162 /*! Key type used in DM_SEC_KEY_IND */
enginerd 0:b562096246b3 163 #define DM_KEY_LOCAL_LTK 0x01 /*! LTK generated locally for this device */
enginerd 0:b562096246b3 164 #define DM_KEY_PEER_LTK 0x02 /*! LTK received from peer device */
enginerd 0:b562096246b3 165 #define DM_KEY_IRK 0x04 /*! IRK and identity info of peer device */
enginerd 0:b562096246b3 166 #define DM_KEY_CSRK 0x08 /*! CSRK of peer device */
enginerd 0:b562096246b3 167
enginerd 0:b562096246b3 168 /*! Base value for HCI error status values for DM_SEC_PAIR_CMPL_IND */
enginerd 0:b562096246b3 169 #define DM_SEC_HCI_ERR_BASE 0x20
enginerd 0:b562096246b3 170
enginerd 0:b562096246b3 171 #define DM_SEC_LEVEL_NONE 0 /*! Connection has no security */
enginerd 0:b562096246b3 172 #define DM_SEC_LEVEL_ENC 1 /*! Connection is encrypted with unauthenticated key */
enginerd 0:b562096246b3 173 #define DM_SEC_LEVEL_ENC_AUTH 2 /*! Connection is encrypted with authenticated key */
enginerd 0:b562096246b3 174
enginerd 0:b562096246b3 175 /*! Random address types */
enginerd 0:b562096246b3 176 #define DM_RAND_ADDR_STATIC 0xC0 /*! Static address */
enginerd 0:b562096246b3 177 #define DM_RAND_ADDR_RESOLV 0x80 /*! Resolvable private address */
enginerd 0:b562096246b3 178 #define DM_RAND_ADDR_NONRESOLV 0x00 /*! Non-resolvable private address */
enginerd 0:b562096246b3 179
enginerd 0:b562096246b3 180 /*! Get the type of random address */
enginerd 0:b562096246b3 181 #define DM_RAND_ADDR_GET(addr) ((addr)[5] & 0xC0)
enginerd 0:b562096246b3 182
enginerd 0:b562096246b3 183 /*! Set the type of random address */
enginerd 0:b562096246b3 184 #define DM_RAND_ADDR_SET(addr, type) {(addr)[5] = ((addr)[5] & 0x3F) | (type);}
enginerd 0:b562096246b3 185
enginerd 0:b562096246b3 186 /*! Connection busy/idle state */
enginerd 0:b562096246b3 187 #define DM_CONN_IDLE 0 /*! Connection is idle */
enginerd 0:b562096246b3 188 #define DM_CONN_BUSY 1 /*! Connection is busy */
enginerd 0:b562096246b3 189
enginerd 0:b562096246b3 190 /*! Connection busy/idle state bitmask */
enginerd 0:b562096246b3 191 #define DM_IDLE_SMP_PAIR 0x0001 /*! SMP pairing in progress */
enginerd 0:b562096246b3 192 #define DM_IDLE_DM_ENC 0x0002 /*! DM Encryption setup in progress */
enginerd 0:b562096246b3 193 #define DM_IDLE_ATTS_DISC 0x0004 /*! ATTS service discovery in progress */
enginerd 0:b562096246b3 194 #define DM_IDLE_APP_DISC 0x0008 /*! App framework service discovery in progress */
enginerd 0:b562096246b3 195 #define DM_IDLE_USER_1 0x0010 /*! For use by user application */
enginerd 0:b562096246b3 196 #define DM_IDLE_USER_2 0x0020 /*! For use by user application */
enginerd 0:b562096246b3 197 #define DM_IDLE_USER_3 0x0040 /*! For use by user application */
enginerd 0:b562096246b3 198 #define DM_IDLE_USER_4 0x0080 /*! For use by user application */
enginerd 0:b562096246b3 199
enginerd 0:b562096246b3 200 /*! DM callback events */
enginerd 0:b562096246b3 201 #define DM_CBACK_START 0x20 /*! DM callback event starting value */
enginerd 0:b562096246b3 202 enum
enginerd 0:b562096246b3 203 {
enginerd 0:b562096246b3 204 DM_RESET_CMPL_IND = DM_CBACK_START, /*! Reset complete */
enginerd 0:b562096246b3 205 DM_ADV_START_IND, /*! Advertising started */
enginerd 0:b562096246b3 206 DM_ADV_STOP_IND, /*! Advertising stopped */
enginerd 0:b562096246b3 207 DM_ADV_NEW_ADDR_IND, /*! New resolvable address has been generated */
enginerd 0:b562096246b3 208 DM_SCAN_START_IND, /*! Scanning started */
enginerd 0:b562096246b3 209 DM_SCAN_STOP_IND, /*! Scanning stopped */
enginerd 0:b562096246b3 210 DM_SCAN_REPORT_IND, /*! Scan data received from peer device */
enginerd 0:b562096246b3 211 DM_CONN_OPEN_IND, /*! Connection opened */
enginerd 0:b562096246b3 212 DM_CONN_CLOSE_IND, /*! Connection closed */
enginerd 0:b562096246b3 213 DM_CONN_UPDATE_IND, /*! Connection update complete */
enginerd 0:b562096246b3 214 DM_SEC_PAIR_CMPL_IND, /*! Pairing completed successfully */
enginerd 0:b562096246b3 215 DM_SEC_PAIR_FAIL_IND, /*! Pairing failed or other security failure */
enginerd 0:b562096246b3 216 DM_SEC_ENCRYPT_IND, /*! Connection encrypted */
enginerd 0:b562096246b3 217 DM_SEC_ENCRYPT_FAIL_IND, /*! Encryption failed */
enginerd 0:b562096246b3 218 DM_SEC_AUTH_REQ_IND, /*! PIN or OOB data requested for pairing */
enginerd 0:b562096246b3 219 DM_SEC_KEY_IND, /*! Security key indication */
enginerd 0:b562096246b3 220 DM_SEC_LTK_REQ_IND, /*! LTK requested for encyption */
enginerd 0:b562096246b3 221 DM_SEC_PAIR_IND, /*! Incoming pairing request from master */
enginerd 0:b562096246b3 222 DM_SEC_SLAVE_REQ_IND, /*! Incoming security request from slave */
enginerd 0:b562096246b3 223 DM_PRIV_RESOLVED_ADDR_IND, /*! Private address resolved */
enginerd 0:b562096246b3 224 DM_HW_ERROR_IND, /*! Hardware Error */
enginerd 0:b562096246b3 225 DM_VENDOR_SPEC_IND, /*! Vendor specific event */
enginerd 0:b562096246b3 226 };
enginerd 0:b562096246b3 227
enginerd 0:b562096246b3 228 #define DM_CBACK_END DM_VENDOR_SPEC_IND /*! DM callback event ending value */
enginerd 0:b562096246b3 229
enginerd 0:b562096246b3 230 /**************************************************************************************************
enginerd 0:b562096246b3 231 Data Types
enginerd 0:b562096246b3 232 **************************************************************************************************/
enginerd 0:b562096246b3 233
enginerd 0:b562096246b3 234 /*! Connection identifier */
enginerd 0:b562096246b3 235 typedef uint8_t dmConnId_t;
enginerd 0:b562096246b3 236
enginerd 0:b562096246b3 237 /*! Configuration structure */
enginerd 0:b562096246b3 238 typedef struct
enginerd 0:b562096246b3 239 {
enginerd 0:b562096246b3 240 uint8_t dummy;
enginerd 0:b562096246b3 241 } dmCfg_t;
enginerd 0:b562096246b3 242
enginerd 0:b562096246b3 243 /*! LTK data type */
enginerd 0:b562096246b3 244 typedef struct
enginerd 0:b562096246b3 245 {
enginerd 0:b562096246b3 246 uint8_t key[SMP_KEY_LEN];
enginerd 0:b562096246b3 247 uint8_t rand[SMP_RAND8_LEN];
enginerd 0:b562096246b3 248 uint16_t ediv;
enginerd 0:b562096246b3 249 } dmSecLtk_t;
enginerd 0:b562096246b3 250
enginerd 0:b562096246b3 251 /*! IRK data type */
enginerd 0:b562096246b3 252 typedef struct
enginerd 0:b562096246b3 253 {
enginerd 0:b562096246b3 254 uint8_t key[SMP_KEY_LEN];
enginerd 0:b562096246b3 255 bdAddr_t bdAddr;
enginerd 0:b562096246b3 256 uint8_t addrType;
enginerd 0:b562096246b3 257 } dmSecIrk_t;
enginerd 0:b562096246b3 258
enginerd 0:b562096246b3 259 /*! CSRK data type */
enginerd 0:b562096246b3 260 typedef struct
enginerd 0:b562096246b3 261 {
enginerd 0:b562096246b3 262 uint8_t key[SMP_KEY_LEN];
enginerd 0:b562096246b3 263 } dmSecCsrk_t;
enginerd 0:b562096246b3 264
enginerd 0:b562096246b3 265 /*! union of key types */
enginerd 0:b562096246b3 266 typedef union
enginerd 0:b562096246b3 267 {
enginerd 0:b562096246b3 268 dmSecLtk_t ltk;
enginerd 0:b562096246b3 269 dmSecIrk_t irk;
enginerd 0:b562096246b3 270 dmSecCsrk_t csrk;
enginerd 0:b562096246b3 271 } dmSecKey_t;
enginerd 0:b562096246b3 272
enginerd 0:b562096246b3 273 /*! Data type for DM_SEC_PAIR_CMPL_IND */
enginerd 0:b562096246b3 274 typedef struct
enginerd 0:b562096246b3 275 {
enginerd 0:b562096246b3 276 wsfMsgHdr_t hdr; /*! Header */
enginerd 0:b562096246b3 277 uint8_t auth; /*! Authentication and bonding flags */
enginerd 0:b562096246b3 278 } dmSecPairCmplIndEvt_t;
enginerd 0:b562096246b3 279
enginerd 0:b562096246b3 280 /*! Data type for DM_SEC_ENCRYPT_IND */
enginerd 0:b562096246b3 281 typedef struct
enginerd 0:b562096246b3 282 {
enginerd 0:b562096246b3 283 wsfMsgHdr_t hdr; /*! Header */
enginerd 0:b562096246b3 284 bool_t usingLtk; /*! TRUE if connection encrypted with LTK */
enginerd 0:b562096246b3 285 } dmSecEncryptIndEvt_t;
enginerd 0:b562096246b3 286
enginerd 0:b562096246b3 287 /*! Data type for DM_SEC_AUTH_REQ_IND */
enginerd 0:b562096246b3 288 typedef struct
enginerd 0:b562096246b3 289 {
enginerd 0:b562096246b3 290 wsfMsgHdr_t hdr; /*! Header */
enginerd 0:b562096246b3 291 bool_t oob; /*! Out-of-band data requested */
enginerd 0:b562096246b3 292 bool_t display; /*! TRUE if pin is to be displayed */
enginerd 0:b562096246b3 293 } dmSecAuthReqIndEvt_t;
enginerd 0:b562096246b3 294
enginerd 0:b562096246b3 295 /*! Data type for DM_SEC_PAIR_IND */
enginerd 0:b562096246b3 296 typedef struct
enginerd 0:b562096246b3 297 {
enginerd 0:b562096246b3 298 wsfMsgHdr_t hdr; /*! Header */
enginerd 0:b562096246b3 299 uint8_t auth; /*! Authentication and bonding flags */
enginerd 0:b562096246b3 300 bool_t oob; /*! Out-of-band pairing data present or not present */
enginerd 0:b562096246b3 301 uint8_t iKeyDist; /*! Initiator key distribution flags */
enginerd 0:b562096246b3 302 uint8_t rKeyDist; /*! Responder key distribution flags */
enginerd 0:b562096246b3 303 } dmSecPairIndEvt_t;
enginerd 0:b562096246b3 304
enginerd 0:b562096246b3 305 /*! Data type for DM_SEC_SLAVE_REQ_IND */
enginerd 0:b562096246b3 306 typedef struct
enginerd 0:b562096246b3 307 {
enginerd 0:b562096246b3 308 wsfMsgHdr_t hdr; /*! Header */
enginerd 0:b562096246b3 309 uint8_t auth; /*! Authentication and bonding flags */
enginerd 0:b562096246b3 310 } dmSecSlaveIndEvt_t;
enginerd 0:b562096246b3 311
enginerd 0:b562096246b3 312 /*! Data type for DM_SEC_KEY_IND */
enginerd 0:b562096246b3 313 typedef struct
enginerd 0:b562096246b3 314 {
enginerd 0:b562096246b3 315 wsfMsgHdr_t hdr; /*! Header */
enginerd 0:b562096246b3 316 dmSecKey_t keyData; /*! Key data */
enginerd 0:b562096246b3 317 uint8_t type; /*! Key type */
enginerd 0:b562096246b3 318 uint8_t secLevel; /*! Security level of pairing when key was exchanged */
enginerd 0:b562096246b3 319 uint8_t encKeyLen; /*! Length of encryption key used when data was transferred */
enginerd 0:b562096246b3 320 } dmSecKeyIndEvt_t;
enginerd 0:b562096246b3 321
enginerd 0:b562096246b3 322 /*! Data type for DM_ADV_NEW_ADDR_IND */
enginerd 0:b562096246b3 323 typedef struct
enginerd 0:b562096246b3 324 {
enginerd 0:b562096246b3 325 wsfMsgHdr_t hdr; /*! Header */
enginerd 0:b562096246b3 326 bdAddr_t addr; /*! New resolvable private address */
enginerd 0:b562096246b3 327 bool_t firstTime; /*! TRUE when address is generated for the first time */
enginerd 0:b562096246b3 328 } dmAdvNewAddrIndEvt_t;
enginerd 0:b562096246b3 329
enginerd 0:b562096246b3 330 /*! Union of DM callback event data types */
enginerd 0:b562096246b3 331 typedef union
enginerd 0:b562096246b3 332 {
enginerd 0:b562096246b3 333 wsfMsgHdr_t hdr;
enginerd 0:b562096246b3 334 hciLeAdvReportEvt_t scanReport;
enginerd 0:b562096246b3 335 hciLeConnCmplEvt_t connOpen;
enginerd 0:b562096246b3 336 hciLeConnUpdateCmplEvt_t connUpdate;
enginerd 0:b562096246b3 337 hciDisconnectCmplEvt_t connClose;
enginerd 0:b562096246b3 338 dmSecPairCmplIndEvt_t pairCmpl;
enginerd 0:b562096246b3 339 dmSecEncryptIndEvt_t encryptInd;
enginerd 0:b562096246b3 340 dmSecAuthReqIndEvt_t authReq;
enginerd 0:b562096246b3 341 dmSecPairIndEvt_t pairInd;
enginerd 0:b562096246b3 342 dmSecSlaveIndEvt_t slaveInd;
enginerd 0:b562096246b3 343 dmSecKeyIndEvt_t keyInd;
enginerd 0:b562096246b3 344 hciLeLtkReqEvt_t ltkReqInd;
enginerd 0:b562096246b3 345 hciVendorSpecEvt_t vendorSpec;
enginerd 0:b562096246b3 346 dmAdvNewAddrIndEvt_t advNewAddr;
enginerd 0:b562096246b3 347 } dmEvt_t;
enginerd 0:b562096246b3 348
enginerd 0:b562096246b3 349 /*! Callback type */
enginerd 0:b562096246b3 350 typedef void (*dmCback_t)(dmEvt_t *pDmEvt);
enginerd 0:b562096246b3 351
enginerd 0:b562096246b3 352 /**************************************************************************************************
enginerd 0:b562096246b3 353 Function Declarations
enginerd 0:b562096246b3 354 **************************************************************************************************/
enginerd 0:b562096246b3 355
enginerd 0:b562096246b3 356 /*************************************************************************************************/
enginerd 0:b562096246b3 357 /*!
enginerd 0:b562096246b3 358 * \fn DmRegister
enginerd 0:b562096246b3 359 *
enginerd 0:b562096246b3 360 * \brief Register a callback with DM for scan and advertising events.
enginerd 0:b562096246b3 361 *
enginerd 0:b562096246b3 362 * \param cback Client callback function.
enginerd 0:b562096246b3 363 *
enginerd 0:b562096246b3 364 * \return None.
enginerd 0:b562096246b3 365 */
enginerd 0:b562096246b3 366 /*************************************************************************************************/
enginerd 0:b562096246b3 367 void DmRegister(dmCback_t cback);
enginerd 0:b562096246b3 368
enginerd 0:b562096246b3 369 /*************************************************************************************************/
enginerd 0:b562096246b3 370 /*!
enginerd 0:b562096246b3 371 * \fn DmFindAdType
enginerd 0:b562096246b3 372 *
enginerd 0:b562096246b3 373 * \brief Find an advertising data element in the given advertising or scan response data.
enginerd 0:b562096246b3 374 *
enginerd 0:b562096246b3 375 * \param adType Advertising data element type to find.
enginerd 0:b562096246b3 376 * \param dataLen Data length.
enginerd 0:b562096246b3 377 * \param pData Pointer to advertising or scan response data.
enginerd 0:b562096246b3 378 *
enginerd 0:b562096246b3 379 * \return Pointer to the advertising data element byte array or NULL if not found.
enginerd 0:b562096246b3 380 */
enginerd 0:b562096246b3 381 /*************************************************************************************************/
enginerd 0:b562096246b3 382 uint8_t *DmFindAdType(uint8_t adType, uint8_t dataLen, uint8_t *pData);
enginerd 0:b562096246b3 383
enginerd 0:b562096246b3 384 /*************************************************************************************************/
enginerd 0:b562096246b3 385 /*!
enginerd 0:b562096246b3 386 * \fn DmAdvInit
enginerd 0:b562096246b3 387 *
enginerd 0:b562096246b3 388 * \brief Initialize DM advertising.
enginerd 0:b562096246b3 389 *
enginerd 0:b562096246b3 390 * \return None.
enginerd 0:b562096246b3 391 */
enginerd 0:b562096246b3 392 /*************************************************************************************************/
enginerd 0:b562096246b3 393 void DmAdvInit(void);
enginerd 0:b562096246b3 394
enginerd 0:b562096246b3 395 /*************************************************************************************************/
enginerd 0:b562096246b3 396 /*!
enginerd 0:b562096246b3 397 * \fn DmAdvStart
enginerd 0:b562096246b3 398 *
enginerd 0:b562096246b3 399 * \brief Start advertising using the given advertising type and duration.
enginerd 0:b562096246b3 400 *
enginerd 0:b562096246b3 401 * \param advType Advertising type.
enginerd 0:b562096246b3 402 * \param duration The advertising duration, in milliseconds.
enginerd 0:b562096246b3 403 *
enginerd 0:b562096246b3 404 * \return None.
enginerd 0:b562096246b3 405 */
enginerd 0:b562096246b3 406 /*************************************************************************************************/
enginerd 0:b562096246b3 407 void DmAdvStart(uint8_t advType, uint16_t duration);
enginerd 0:b562096246b3 408
enginerd 0:b562096246b3 409 /*************************************************************************************************/
enginerd 0:b562096246b3 410 /*!
enginerd 0:b562096246b3 411 * \fn DmAdvStop
enginerd 0:b562096246b3 412 *
enginerd 0:b562096246b3 413 * \brief Stop advertising.
enginerd 0:b562096246b3 414 *
enginerd 0:b562096246b3 415 * \return None.
enginerd 0:b562096246b3 416 */
enginerd 0:b562096246b3 417 /*************************************************************************************************/
enginerd 0:b562096246b3 418 void DmAdvStop(void);
enginerd 0:b562096246b3 419
enginerd 0:b562096246b3 420 /*************************************************************************************************/
enginerd 0:b562096246b3 421 /*!
enginerd 0:b562096246b3 422 * \fn DmAdvSetInterval
enginerd 0:b562096246b3 423 *
enginerd 0:b562096246b3 424 * \brief Set the minimum and maximum advertising intervals.
enginerd 0:b562096246b3 425 *
enginerd 0:b562096246b3 426 * \param intervalMin Minimum advertising interval.
enginerd 0:b562096246b3 427 * \param intervalMax Maximum advertising interval.
enginerd 0:b562096246b3 428 *
enginerd 0:b562096246b3 429 * \return None.
enginerd 0:b562096246b3 430 */
enginerd 0:b562096246b3 431 /*************************************************************************************************/
enginerd 0:b562096246b3 432 void DmAdvSetInterval(uint16_t intervalMin, uint16_t intervalMax);
enginerd 0:b562096246b3 433
enginerd 0:b562096246b3 434 /*************************************************************************************************/
enginerd 0:b562096246b3 435 /*!
enginerd 0:b562096246b3 436 * \fn DmAdvSetChannelMap
enginerd 0:b562096246b3 437 *
enginerd 0:b562096246b3 438 * \brief Include or exclude certain channels from the advertising channel map.
enginerd 0:b562096246b3 439 *
enginerd 0:b562096246b3 440 * \param channelMap Advertising channel map.
enginerd 0:b562096246b3 441 *
enginerd 0:b562096246b3 442 * \return None.
enginerd 0:b562096246b3 443 */
enginerd 0:b562096246b3 444 /*************************************************************************************************/
enginerd 0:b562096246b3 445 void DmAdvSetChannelMap(uint8_t channelMap);
enginerd 0:b562096246b3 446
enginerd 0:b562096246b3 447 /*************************************************************************************************/
enginerd 0:b562096246b3 448 /*!
enginerd 0:b562096246b3 449 * \fn DmAdvSetData
enginerd 0:b562096246b3 450 *
enginerd 0:b562096246b3 451 * \brief Set the advertising or scan response data to the given data.
enginerd 0:b562096246b3 452 *
enginerd 0:b562096246b3 453 * \param location Data location.
enginerd 0:b562096246b3 454 * \param len Length of the data. Maximum length is 31 bytes.
enginerd 0:b562096246b3 455 * \param pData Pointer to the data.
enginerd 0:b562096246b3 456 *
enginerd 0:b562096246b3 457 * \return None.
enginerd 0:b562096246b3 458 */
enginerd 0:b562096246b3 459 /*************************************************************************************************/
enginerd 0:b562096246b3 460 void DmAdvSetData(uint8_t location, uint8_t len, uint8_t *pData);
enginerd 0:b562096246b3 461
enginerd 0:b562096246b3 462 /*************************************************************************************************/
enginerd 0:b562096246b3 463 /*!
enginerd 0:b562096246b3 464 * \fn DmAdvSetAddrType
enginerd 0:b562096246b3 465 *
enginerd 0:b562096246b3 466 * \brief Set the local address type used while advertising. This function can be used to
enginerd 0:b562096246b3 467 * configure advertising to use a random address.
enginerd 0:b562096246b3 468 *
enginerd 0:b562096246b3 469 * \param addrType Address type.
enginerd 0:b562096246b3 470 *
enginerd 0:b562096246b3 471 * \return None.
enginerd 0:b562096246b3 472 */
enginerd 0:b562096246b3 473 /*************************************************************************************************/
enginerd 0:b562096246b3 474 void DmAdvSetAddrType(uint8_t addrType);
enginerd 0:b562096246b3 475
enginerd 0:b562096246b3 476 /*************************************************************************************************/
enginerd 0:b562096246b3 477 /*!
enginerd 0:b562096246b3 478 * \fn DmAdvSetAdValue
enginerd 0:b562096246b3 479 *
enginerd 0:b562096246b3 480 * \brief Set the value of an advertising data element in the given advertising or
enginerd 0:b562096246b3 481 * scan response data. If the element already exists in the data then it is replaced
enginerd 0:b562096246b3 482 * with the new value. If the element does not exist in the data it is appended
enginerd 0:b562096246b3 483 * to it, space permitting.
enginerd 0:b562096246b3 484 *
enginerd 0:b562096246b3 485 * \param adType Advertising data element type.
enginerd 0:b562096246b3 486 * \param len Length of the value. Maximum length is 29 bytes.
enginerd 0:b562096246b3 487 * \param pValue Pointer to the value.
enginerd 0:b562096246b3 488 * \param pAdvDataLen Advertising or scan response data length. The new length is returned
enginerd 0:b562096246b3 489 * in this parameter.
enginerd 0:b562096246b3 490 * \param pAdvData Pointer to advertising or scan response data.
enginerd 0:b562096246b3 491 *
enginerd 0:b562096246b3 492 * \return TRUE if the element was successfully added to the data, FALSE otherwise.
enginerd 0:b562096246b3 493 */
enginerd 0:b562096246b3 494 /*************************************************************************************************/
enginerd 0:b562096246b3 495 bool_t DmAdvSetAdValue(uint8_t adType, uint8_t len, uint8_t *pValue, uint8_t *pAdvDataLen,
enginerd 0:b562096246b3 496 uint8_t *pAdvData);
enginerd 0:b562096246b3 497
enginerd 0:b562096246b3 498 /*************************************************************************************************/
enginerd 0:b562096246b3 499 /*!
enginerd 0:b562096246b3 500 * \fn DmAdvSetName
enginerd 0:b562096246b3 501 *
enginerd 0:b562096246b3 502 * \brief Set the device name in the given advertising or scan response data. If the
enginerd 0:b562096246b3 503 * name can only fit in the data if it is shortened, the name is shortened
enginerd 0:b562096246b3 504 * and the AD type is changed to DM_ADV_TYPE_SHORT_NAME.
enginerd 0:b562096246b3 505 *
enginerd 0:b562096246b3 506 * \param len Length of the name. Maximum length is 29 bytes.
enginerd 0:b562096246b3 507 * \param pValue Pointer to the name in UTF-8 format.
enginerd 0:b562096246b3 508 * \param pAdvDataLen Advertising or scan response data length. The new length is returned
enginerd 0:b562096246b3 509 * in this parameter.
enginerd 0:b562096246b3 510 * \param pAdvData Pointer to advertising or scan response data.
enginerd 0:b562096246b3 511 *
enginerd 0:b562096246b3 512 * \return TRUE if the element was successfully added to the data, FALSE otherwise.
enginerd 0:b562096246b3 513 */
enginerd 0:b562096246b3 514 /*************************************************************************************************/
enginerd 0:b562096246b3 515 bool_t DmAdvSetName(uint8_t len, uint8_t *pValue, uint8_t *pAdvDataLen, uint8_t *pAdvData);
enginerd 0:b562096246b3 516
enginerd 0:b562096246b3 517 /*************************************************************************************************/
enginerd 0:b562096246b3 518 /*!
enginerd 0:b562096246b3 519 * \fn DmAdvPrivInit
enginerd 0:b562096246b3 520 *
enginerd 0:b562096246b3 521 * \brief Initialize private advertising.
enginerd 0:b562096246b3 522 *
enginerd 0:b562096246b3 523 * \return None.
enginerd 0:b562096246b3 524 */
enginerd 0:b562096246b3 525 /*************************************************************************************************/
enginerd 0:b562096246b3 526 void DmAdvPrivInit(void);
enginerd 0:b562096246b3 527
enginerd 0:b562096246b3 528 /*************************************************************************************************/
enginerd 0:b562096246b3 529 /*!
enginerd 0:b562096246b3 530 * \fn DmAdvPrivStart
enginerd 0:b562096246b3 531 *
enginerd 0:b562096246b3 532 * \brief Start using a private resolvable address.
enginerd 0:b562096246b3 533 *
enginerd 0:b562096246b3 534 * \param changeInterval Interval between automatic address changes, in seconds.
enginerd 0:b562096246b3 535 *
enginerd 0:b562096246b3 536 * \return None.
enginerd 0:b562096246b3 537 */
enginerd 0:b562096246b3 538 /*************************************************************************************************/
enginerd 0:b562096246b3 539 void DmAdvPrivStart(uint16_t changeInterval);
enginerd 0:b562096246b3 540
enginerd 0:b562096246b3 541 /*************************************************************************************************/
enginerd 0:b562096246b3 542 /*!
enginerd 0:b562096246b3 543 * \fn DmAdvPrivStop
enginerd 0:b562096246b3 544 *
enginerd 0:b562096246b3 545 * \brief Stop using a private resolvable address.
enginerd 0:b562096246b3 546 *
enginerd 0:b562096246b3 547 * \return None.
enginerd 0:b562096246b3 548 */
enginerd 0:b562096246b3 549 /*************************************************************************************************/
enginerd 0:b562096246b3 550 void DmAdvPrivStop(void);
enginerd 0:b562096246b3 551
enginerd 0:b562096246b3 552 /*************************************************************************************************/
enginerd 0:b562096246b3 553 /*!
enginerd 0:b562096246b3 554 * \fn DmScanInit
enginerd 0:b562096246b3 555 *
enginerd 0:b562096246b3 556 * \brief Initialize DM scanning.
enginerd 0:b562096246b3 557 *
enginerd 0:b562096246b3 558 * \return None.
enginerd 0:b562096246b3 559 */
enginerd 0:b562096246b3 560 /*************************************************************************************************/
enginerd 0:b562096246b3 561 void DmScanInit(void);
enginerd 0:b562096246b3 562
enginerd 0:b562096246b3 563 /*************************************************************************************************/
enginerd 0:b562096246b3 564 /*!
enginerd 0:b562096246b3 565 * \fn DmScanStart
enginerd 0:b562096246b3 566 *
enginerd 0:b562096246b3 567 * \brief Start scanning.
enginerd 0:b562096246b3 568 *
enginerd 0:b562096246b3 569 * \param mode Discoverability mode.
enginerd 0:b562096246b3 570 * \param scanType Scan type.
enginerd 0:b562096246b3 571 * \param filterDup Filter duplicates. Set to TRUE to filter duplicate responses received
enginerd 0:b562096246b3 572 * from the same device. Set to FALSE to receive all responses.
enginerd 0:b562096246b3 573 * \param duration The scan duration, in milliseconds. If set to zero, scanning will
enginerd 0:b562096246b3 574 * continue until DmScanStop() is called.
enginerd 0:b562096246b3 575 *
enginerd 0:b562096246b3 576 * \return None.
enginerd 0:b562096246b3 577 */
enginerd 0:b562096246b3 578 /*************************************************************************************************/
enginerd 0:b562096246b3 579 void DmScanStart(uint8_t mode, uint8_t scanType, bool_t filterDup, uint16_t duration);
enginerd 0:b562096246b3 580
enginerd 0:b562096246b3 581 /*************************************************************************************************/
enginerd 0:b562096246b3 582 /*!
enginerd 0:b562096246b3 583 * \fn DmScanStop
enginerd 0:b562096246b3 584 *
enginerd 0:b562096246b3 585 * \brief Stop scanning.
enginerd 0:b562096246b3 586 *
enginerd 0:b562096246b3 587 * \return None.
enginerd 0:b562096246b3 588 */
enginerd 0:b562096246b3 589 /*************************************************************************************************/
enginerd 0:b562096246b3 590 void DmScanStop(void);
enginerd 0:b562096246b3 591
enginerd 0:b562096246b3 592 /*************************************************************************************************/
enginerd 0:b562096246b3 593 /*!
enginerd 0:b562096246b3 594 * \fn DmScanSetInterval
enginerd 0:b562096246b3 595 *
enginerd 0:b562096246b3 596 * \brief Set the scan interval and window.
enginerd 0:b562096246b3 597 *
enginerd 0:b562096246b3 598 * \param scanInterval The scan interval.
enginerd 0:b562096246b3 599 * \param scanWindow The scan window.
enginerd 0:b562096246b3 600 *
enginerd 0:b562096246b3 601 * \return None.
enginerd 0:b562096246b3 602 */
enginerd 0:b562096246b3 603 /*************************************************************************************************/
enginerd 0:b562096246b3 604 void DmScanSetInterval(uint16_t scanInterval, uint16_t scanWindow);
enginerd 0:b562096246b3 605
enginerd 0:b562096246b3 606 /*************************************************************************************************/
enginerd 0:b562096246b3 607 /*!
enginerd 0:b562096246b3 608 * \fn DmScanSetAddrType
enginerd 0:b562096246b3 609 *
enginerd 0:b562096246b3 610 * \brief Set the local address type used while scanning. This function can be used to
enginerd 0:b562096246b3 611 * configure scanning to use a random address.
enginerd 0:b562096246b3 612 *
enginerd 0:b562096246b3 613 * \param addrType Address type.
enginerd 0:b562096246b3 614 *
enginerd 0:b562096246b3 615 * \return None.
enginerd 0:b562096246b3 616 */
enginerd 0:b562096246b3 617 /*************************************************************************************************/
enginerd 0:b562096246b3 618 void DmScanSetAddrType(uint8_t addrType);
enginerd 0:b562096246b3 619
enginerd 0:b562096246b3 620 /*************************************************************************************************/
enginerd 0:b562096246b3 621 /*!
enginerd 0:b562096246b3 622 * \fn DmConnInit
enginerd 0:b562096246b3 623 *
enginerd 0:b562096246b3 624 * \brief Initialize DM connection manager.
enginerd 0:b562096246b3 625 *
enginerd 0:b562096246b3 626 * \return None.
enginerd 0:b562096246b3 627 */
enginerd 0:b562096246b3 628 /*************************************************************************************************/
enginerd 0:b562096246b3 629 void DmConnInit(void);
enginerd 0:b562096246b3 630
enginerd 0:b562096246b3 631 /*************************************************************************************************/
enginerd 0:b562096246b3 632 /*!
enginerd 0:b562096246b3 633 * \fn DmConnMasterInit
enginerd 0:b562096246b3 634 *
enginerd 0:b562096246b3 635 * \brief Initialize DM connection manager for operation as master.
enginerd 0:b562096246b3 636 *
enginerd 0:b562096246b3 637 * \return None.
enginerd 0:b562096246b3 638 */
enginerd 0:b562096246b3 639 /*************************************************************************************************/
enginerd 0:b562096246b3 640 void DmConnMasterInit(void);
enginerd 0:b562096246b3 641
enginerd 0:b562096246b3 642 /*************************************************************************************************/
enginerd 0:b562096246b3 643 /*!
enginerd 0:b562096246b3 644 * \fn DmConnSlaveInit
enginerd 0:b562096246b3 645 *
enginerd 0:b562096246b3 646 * \brief Initialize DM connection manager for operation as slave.
enginerd 0:b562096246b3 647 *
enginerd 0:b562096246b3 648 * \return None.
enginerd 0:b562096246b3 649 */
enginerd 0:b562096246b3 650 /*************************************************************************************************/
enginerd 0:b562096246b3 651 void DmConnSlaveInit(void);
enginerd 0:b562096246b3 652
enginerd 0:b562096246b3 653 /*************************************************************************************************/
enginerd 0:b562096246b3 654 /*!
enginerd 0:b562096246b3 655 * \fn DmConnRegister
enginerd 0:b562096246b3 656 *
enginerd 0:b562096246b3 657 * \brief Register with the DM connection manager.
enginerd 0:b562096246b3 658 *
enginerd 0:b562096246b3 659 * \param clientId The client identifier.
enginerd 0:b562096246b3 660 * \param cback Client callback function.
enginerd 0:b562096246b3 661 *
enginerd 0:b562096246b3 662 * \return None.
enginerd 0:b562096246b3 663 */
enginerd 0:b562096246b3 664 /*************************************************************************************************/
enginerd 0:b562096246b3 665 void DmConnRegister(uint8_t clientId, dmCback_t cback);
enginerd 0:b562096246b3 666
enginerd 0:b562096246b3 667 /*************************************************************************************************/
enginerd 0:b562096246b3 668 /*!
enginerd 0:b562096246b3 669 * \fn DmConnOpen
enginerd 0:b562096246b3 670 *
enginerd 0:b562096246b3 671 * \brief Open a connection to a peer device with the given address.
enginerd 0:b562096246b3 672 *
enginerd 0:b562096246b3 673 * \param clientId The client identifier.
enginerd 0:b562096246b3 674 * \param addrType Address type.
enginerd 0:b562096246b3 675 * \param pAddr Peer device address.
enginerd 0:b562096246b3 676 *
enginerd 0:b562096246b3 677 * \return Connection identifier.
enginerd 0:b562096246b3 678 */
enginerd 0:b562096246b3 679 /*************************************************************************************************/
enginerd 0:b562096246b3 680 dmConnId_t DmConnOpen(uint8_t clientId, uint8_t addrType, uint8_t *pAddr);
enginerd 0:b562096246b3 681
enginerd 0:b562096246b3 682 /*************************************************************************************************/
enginerd 0:b562096246b3 683 /*!
enginerd 0:b562096246b3 684 * \fn DmConnClose
enginerd 0:b562096246b3 685 *
enginerd 0:b562096246b3 686 * \brief Close the connection with the give connection identifier.
enginerd 0:b562096246b3 687 *
enginerd 0:b562096246b3 688 * \param clientId The client identifier.
enginerd 0:b562096246b3 689 * \param connId Connection identifier.
enginerd 0:b562096246b3 690 * \param reason Reason connection is being closed.
enginerd 0:b562096246b3 691 *
enginerd 0:b562096246b3 692 * \return None.
enginerd 0:b562096246b3 693 */
enginerd 0:b562096246b3 694 /*************************************************************************************************/
enginerd 0:b562096246b3 695 void DmConnClose(uint8_t clientId, dmConnId_t connId, uint8_t reason);
enginerd 0:b562096246b3 696
enginerd 0:b562096246b3 697 /*************************************************************************************************/
enginerd 0:b562096246b3 698 /*!
enginerd 0:b562096246b3 699 * \fn DmConnAccept
enginerd 0:b562096246b3 700 *
enginerd 0:b562096246b3 701 * \brief Accept a connection from the given peer device by initiating directed advertising.
enginerd 0:b562096246b3 702 *
enginerd 0:b562096246b3 703 * \param clientId The client identifier.
enginerd 0:b562096246b3 704 * \param addrType Address type.
enginerd 0:b562096246b3 705 * \param pAddr Peer device address.
enginerd 0:b562096246b3 706 *
enginerd 0:b562096246b3 707 * \return Connection identifier.
enginerd 0:b562096246b3 708 */
enginerd 0:b562096246b3 709 /*************************************************************************************************/
enginerd 0:b562096246b3 710 dmConnId_t DmConnAccept(uint8_t clientId, uint8_t addrType, uint8_t *pAddr);
enginerd 0:b562096246b3 711
enginerd 0:b562096246b3 712 /*************************************************************************************************/
enginerd 0:b562096246b3 713 /*!
enginerd 0:b562096246b3 714 * \fn DmConnUpdate
enginerd 0:b562096246b3 715 *
enginerd 0:b562096246b3 716 * \brief Update the connection parameters of an open connection
enginerd 0:b562096246b3 717 *
enginerd 0:b562096246b3 718 * \param connId Connection identifier.
enginerd 0:b562096246b3 719 * \param pConnSpec Connection specification.
enginerd 0:b562096246b3 720 *
enginerd 0:b562096246b3 721 * \return None.
enginerd 0:b562096246b3 722 */
enginerd 0:b562096246b3 723 /*************************************************************************************************/
enginerd 0:b562096246b3 724 void DmConnUpdate(dmConnId_t connId, hciConnSpec_t *pConnSpec);
enginerd 0:b562096246b3 725
enginerd 0:b562096246b3 726 /*************************************************************************************************/
enginerd 0:b562096246b3 727 /*!
enginerd 0:b562096246b3 728 * \fn DmConnSetScanInterval
enginerd 0:b562096246b3 729 *
enginerd 0:b562096246b3 730 * \brief Set the scan interval and window for created connections created with DmConnOpen().
enginerd 0:b562096246b3 731 *
enginerd 0:b562096246b3 732 * \param scanInterval The scan interval.
enginerd 0:b562096246b3 733 * \param scanWindow The scan window.
enginerd 0:b562096246b3 734 *
enginerd 0:b562096246b3 735 * \return None.
enginerd 0:b562096246b3 736 */
enginerd 0:b562096246b3 737 /*************************************************************************************************/
enginerd 0:b562096246b3 738 void DmConnSetScanInterval(uint16_t scanInterval, uint16_t scanWindow);
enginerd 0:b562096246b3 739
enginerd 0:b562096246b3 740 /*************************************************************************************************/
enginerd 0:b562096246b3 741 /*!
enginerd 0:b562096246b3 742 * \fn DmConnSetConnSpec
enginerd 0:b562096246b3 743 *
enginerd 0:b562096246b3 744 * \brief Set the connection specification parameters for connections created with DmConnOpen().
enginerd 0:b562096246b3 745 *
enginerd 0:b562096246b3 746 * \param pConnSpec Connection spec parameters.
enginerd 0:b562096246b3 747 *
enginerd 0:b562096246b3 748 * \return None.
enginerd 0:b562096246b3 749 */
enginerd 0:b562096246b3 750 /*************************************************************************************************/
enginerd 0:b562096246b3 751 void DmConnSetConnSpec(hciConnSpec_t *pConnSpec);
enginerd 0:b562096246b3 752
enginerd 0:b562096246b3 753 /*************************************************************************************************/
enginerd 0:b562096246b3 754 /*!
enginerd 0:b562096246b3 755 * \fn DmConnSetAddrType
enginerd 0:b562096246b3 756 *
enginerd 0:b562096246b3 757 * \brief Set the local address type used for connections created with DmConnOpen().
enginerd 0:b562096246b3 758 *
enginerd 0:b562096246b3 759 * \param addrType Address type.
enginerd 0:b562096246b3 760 *
enginerd 0:b562096246b3 761 * \return None.
enginerd 0:b562096246b3 762 */
enginerd 0:b562096246b3 763 /*************************************************************************************************/
enginerd 0:b562096246b3 764 void DmConnSetAddrType(uint8_t addrType);
enginerd 0:b562096246b3 765
enginerd 0:b562096246b3 766 /*************************************************************************************************/
enginerd 0:b562096246b3 767 /*!
enginerd 0:b562096246b3 768 * \fn DmConnSetIdle
enginerd 0:b562096246b3 769 *
enginerd 0:b562096246b3 770 * \brief Configure a bit in the connection idle state mask as busy or idle.
enginerd 0:b562096246b3 771 *
enginerd 0:b562096246b3 772 * \param connId Connection identifier.
enginerd 0:b562096246b3 773 * \param idleMask Bit in the idle state mask to configure.
enginerd 0:b562096246b3 774 * \param idle DM_CONN_BUSY or DM_CONN_IDLE.
enginerd 0:b562096246b3 775 *
enginerd 0:b562096246b3 776 * \return None.
enginerd 0:b562096246b3 777 */
enginerd 0:b562096246b3 778 /*************************************************************************************************/
enginerd 0:b562096246b3 779 void DmConnSetIdle(dmConnId_t connId, uint16_t idleMask, uint8_t idle);
enginerd 0:b562096246b3 780
enginerd 0:b562096246b3 781 /*************************************************************************************************/
enginerd 0:b562096246b3 782 /*!
enginerd 0:b562096246b3 783 * \fn DmConnCheckIdle
enginerd 0:b562096246b3 784 *
enginerd 0:b562096246b3 785 * \brief Check if a connection is idle.
enginerd 0:b562096246b3 786 *
enginerd 0:b562096246b3 787 * \param connId Connection identifier.
enginerd 0:b562096246b3 788 *
enginerd 0:b562096246b3 789 * \return Zero if connection is idle, nonzero if busy.
enginerd 0:b562096246b3 790 */
enginerd 0:b562096246b3 791 /*************************************************************************************************/
enginerd 0:b562096246b3 792 uint16_t DmConnCheckIdle(dmConnId_t connId);
enginerd 0:b562096246b3 793
enginerd 0:b562096246b3 794 /*************************************************************************************************/
enginerd 0:b562096246b3 795 /*!
enginerd 0:b562096246b3 796 * \fn DmDevReset
enginerd 0:b562096246b3 797 *
enginerd 0:b562096246b3 798 * \brief Reset the device.
enginerd 0:b562096246b3 799 *
enginerd 0:b562096246b3 800 * \return None.
enginerd 0:b562096246b3 801 */
enginerd 0:b562096246b3 802 /*************************************************************************************************/
enginerd 0:b562096246b3 803 void DmDevReset(void);
enginerd 0:b562096246b3 804
enginerd 0:b562096246b3 805 /*************************************************************************************************/
enginerd 0:b562096246b3 806 /*!
enginerd 0:b562096246b3 807 * \fn DmDevRole
enginerd 0:b562096246b3 808 *
enginerd 0:b562096246b3 809 * \brief Return the device role indicating master or slave.
enginerd 0:b562096246b3 810 *
enginerd 0:b562096246b3 811 * \return Device role.
enginerd 0:b562096246b3 812 */
enginerd 0:b562096246b3 813 /*************************************************************************************************/
enginerd 0:b562096246b3 814 uint8_t DmDevRole(void);
enginerd 0:b562096246b3 815
enginerd 0:b562096246b3 816 /*************************************************************************************************/
enginerd 0:b562096246b3 817 /*!
enginerd 0:b562096246b3 818 * \fn DmDevSetRandAddr
enginerd 0:b562096246b3 819 *
enginerd 0:b562096246b3 820 * \brief Set the random address to be used by the local device.
enginerd 0:b562096246b3 821 *
enginerd 0:b562096246b3 822 * \param pAddr Random address.
enginerd 0:b562096246b3 823 *
enginerd 0:b562096246b3 824 * \return None.
enginerd 0:b562096246b3 825 */
enginerd 0:b562096246b3 826 /*************************************************************************************************/
enginerd 0:b562096246b3 827 void DmDevSetRandAddr(uint8_t *pAddr);
enginerd 0:b562096246b3 828
enginerd 0:b562096246b3 829 /*************************************************************************************************/
enginerd 0:b562096246b3 830 /*!
enginerd 0:b562096246b3 831 * \fn DmDevWhiteListAdd
enginerd 0:b562096246b3 832 *
enginerd 0:b562096246b3 833 * \brief Add a peer device to the white list. Note that this function cannot be called
enginerd 0:b562096246b3 834 * while advertising, scanning, or connecting with white list filtering active.
enginerd 0:b562096246b3 835 *
enginerd 0:b562096246b3 836 * \param addrType Address type.
enginerd 0:b562096246b3 837 * \param pAddr Peer device address.
enginerd 0:b562096246b3 838 *
enginerd 0:b562096246b3 839 * \return None.
enginerd 0:b562096246b3 840 */
enginerd 0:b562096246b3 841 /*************************************************************************************************/
enginerd 0:b562096246b3 842 void DmDevWhiteListAdd(uint8_t addrType, uint8_t *pAddr);
enginerd 0:b562096246b3 843
enginerd 0:b562096246b3 844 /*************************************************************************************************/
enginerd 0:b562096246b3 845 /*!
enginerd 0:b562096246b3 846 * \fn DmDevWhiteListRemove
enginerd 0:b562096246b3 847 *
enginerd 0:b562096246b3 848 * \brief Remove a peer device from the white list. Note that this function cannot be called
enginerd 0:b562096246b3 849 * while advertising, scanning, or connecting with white list filtering active.
enginerd 0:b562096246b3 850 *
enginerd 0:b562096246b3 851 * \param addrType Address type.
enginerd 0:b562096246b3 852 * \param pAddr Peer device address.
enginerd 0:b562096246b3 853 *
enginerd 0:b562096246b3 854 * \return None.
enginerd 0:b562096246b3 855 */
enginerd 0:b562096246b3 856 /*************************************************************************************************/
enginerd 0:b562096246b3 857 void DmDevWhiteListRemove(uint8_t addrType, uint8_t *pAddr);
enginerd 0:b562096246b3 858
enginerd 0:b562096246b3 859 /*************************************************************************************************/
enginerd 0:b562096246b3 860 /*!
enginerd 0:b562096246b3 861 * \fn DmDevWhiteListClear
enginerd 0:b562096246b3 862 *
enginerd 0:b562096246b3 863 * \brief Clear the white list. Note that this function cannot be called while
enginerd 0:b562096246b3 864 * advertising, scanning, or connecting with white list filtering active.
enginerd 0:b562096246b3 865 *
enginerd 0:b562096246b3 866 * \return None.
enginerd 0:b562096246b3 867 */
enginerd 0:b562096246b3 868 /*************************************************************************************************/
enginerd 0:b562096246b3 869 void DmDevWhiteListClear(void);
enginerd 0:b562096246b3 870
enginerd 0:b562096246b3 871 /*************************************************************************************************/
enginerd 0:b562096246b3 872 /*!
enginerd 0:b562096246b3 873 * \fn DmDevVsInit
enginerd 0:b562096246b3 874 *
enginerd 0:b562096246b3 875 * \brief Vendor-specific controller initialization function.
enginerd 0:b562096246b3 876 *
enginerd 0:b562096246b3 877 * \param param Vendor-specific parameter.
enginerd 0:b562096246b3 878 *
enginerd 0:b562096246b3 879 * \return None.
enginerd 0:b562096246b3 880 */
enginerd 0:b562096246b3 881 /*************************************************************************************************/
enginerd 0:b562096246b3 882 void DmDevVsInit(uint8_t param);
enginerd 0:b562096246b3 883
enginerd 0:b562096246b3 884 /*************************************************************************************************/
enginerd 0:b562096246b3 885 /*!
enginerd 0:b562096246b3 886 * \fn DmSecInit
enginerd 0:b562096246b3 887 *
enginerd 0:b562096246b3 888 * \brief Initialize DM security.
enginerd 0:b562096246b3 889 *
enginerd 0:b562096246b3 890 * \return None.
enginerd 0:b562096246b3 891 */
enginerd 0:b562096246b3 892 /*************************************************************************************************/
enginerd 0:b562096246b3 893 void DmSecInit(void);
enginerd 0:b562096246b3 894
enginerd 0:b562096246b3 895 /*************************************************************************************************/
enginerd 0:b562096246b3 896 /*!
enginerd 0:b562096246b3 897 * \fn DmSecPairReq
enginerd 0:b562096246b3 898 *
enginerd 0:b562096246b3 899 * \brief This function is called by a master device to initiate pairing.
enginerd 0:b562096246b3 900 *
enginerd 0:b562096246b3 901 * \param connId DM connection ID.
enginerd 0:b562096246b3 902 * \param oob Out-of-band pairing data present or not present.
enginerd 0:b562096246b3 903 * \param auth Authentication and bonding flags.
enginerd 0:b562096246b3 904 * \param iKeyDist Initiator key distribution flags.
enginerd 0:b562096246b3 905 * \param rKeyDist Responder key distribution flags.
enginerd 0:b562096246b3 906 *
enginerd 0:b562096246b3 907 * \return None.
enginerd 0:b562096246b3 908 */
enginerd 0:b562096246b3 909 /*************************************************************************************************/
enginerd 0:b562096246b3 910 void DmSecPairReq(dmConnId_t connId, bool_t oob, uint8_t auth, uint8_t iKeyDist, uint8_t rKeyDist);
enginerd 0:b562096246b3 911
enginerd 0:b562096246b3 912 /*************************************************************************************************/
enginerd 0:b562096246b3 913 /*!
enginerd 0:b562096246b3 914 * \fn DmSecPairRsp
enginerd 0:b562096246b3 915 *
enginerd 0:b562096246b3 916 * \brief This function is called by a slave device to proceed with pairing after a
enginerd 0:b562096246b3 917 * DM_SEC_PAIR_IND event is received.
enginerd 0:b562096246b3 918 *
enginerd 0:b562096246b3 919 * \param connId DM connection ID.
enginerd 0:b562096246b3 920 * \param oob Out-of-band pairing data present or not present.
enginerd 0:b562096246b3 921 * \param auth Authentication and bonding flags.
enginerd 0:b562096246b3 922 * \param iKeyDist Initiator key distribution flags.
enginerd 0:b562096246b3 923 * \param rKeyDist Responder key distribution flags.
enginerd 0:b562096246b3 924 *
enginerd 0:b562096246b3 925 * \return None.
enginerd 0:b562096246b3 926 */
enginerd 0:b562096246b3 927 /*************************************************************************************************/
enginerd 0:b562096246b3 928 void DmSecPairRsp(dmConnId_t connId, bool_t oob, uint8_t auth, uint8_t iKeyDist, uint8_t rKeyDist);
enginerd 0:b562096246b3 929
enginerd 0:b562096246b3 930 /*************************************************************************************************/
enginerd 0:b562096246b3 931 /*!
enginerd 0:b562096246b3 932 * \fn DmSecCancelReq
enginerd 0:b562096246b3 933 *
enginerd 0:b562096246b3 934 * \brief This function is called to cancel the pairing process.
enginerd 0:b562096246b3 935 *
enginerd 0:b562096246b3 936 * \param connId DM connection ID.
enginerd 0:b562096246b3 937 * \param reason Failure reason.
enginerd 0:b562096246b3 938 *
enginerd 0:b562096246b3 939 * \return None.
enginerd 0:b562096246b3 940 */
enginerd 0:b562096246b3 941 /*************************************************************************************************/
enginerd 0:b562096246b3 942 void DmSecCancelReq(dmConnId_t connId, uint8_t reason);
enginerd 0:b562096246b3 943
enginerd 0:b562096246b3 944 /*************************************************************************************************/
enginerd 0:b562096246b3 945 /*!
enginerd 0:b562096246b3 946 * \fn DmSecAuthRsp
enginerd 0:b562096246b3 947 *
enginerd 0:b562096246b3 948 * \brief This function is called in response to a DM_SEC_AUTH_REQ_IND event to provide
enginerd 0:b562096246b3 949 * PIN or OOB data during pairing.
enginerd 0:b562096246b3 950 *
enginerd 0:b562096246b3 951 * \param connId DM connection ID.
enginerd 0:b562096246b3 952 * \param authDataLen Length of PIN or OOB data.
enginerd 0:b562096246b3 953 * \param pAuthData pointer to PIN or OOB data.
enginerd 0:b562096246b3 954 *
enginerd 0:b562096246b3 955 * \return None.
enginerd 0:b562096246b3 956 */
enginerd 0:b562096246b3 957 /*************************************************************************************************/
enginerd 0:b562096246b3 958 void DmSecAuthRsp(dmConnId_t connId, uint8_t authDataLen, uint8_t *pAuthData);
enginerd 0:b562096246b3 959
enginerd 0:b562096246b3 960 /*************************************************************************************************/
enginerd 0:b562096246b3 961 /*!
enginerd 0:b562096246b3 962 * \fn DmSecSlaveReq
enginerd 0:b562096246b3 963 *
enginerd 0:b562096246b3 964 * \brief This function is called by a slave device to request that the master initiates
enginerd 0:b562096246b3 965 * pairing or link encryption.
enginerd 0:b562096246b3 966 *
enginerd 0:b562096246b3 967 * \param connId DM connection ID.
enginerd 0:b562096246b3 968 * \param auth Authentication flags.
enginerd 0:b562096246b3 969 *
enginerd 0:b562096246b3 970 * \return None.
enginerd 0:b562096246b3 971 */
enginerd 0:b562096246b3 972 /*************************************************************************************************/
enginerd 0:b562096246b3 973 void DmSecSlaveReq(dmConnId_t connId, uint8_t auth);
enginerd 0:b562096246b3 974
enginerd 0:b562096246b3 975 /*************************************************************************************************/
enginerd 0:b562096246b3 976 /*!
enginerd 0:b562096246b3 977 * \fn DmSecEncryptReq
enginerd 0:b562096246b3 978 *
enginerd 0:b562096246b3 979 * \brief This function is called by a master device to initiate link encryption.
enginerd 0:b562096246b3 980 *
enginerd 0:b562096246b3 981 * \param connId DM connection ID.
enginerd 0:b562096246b3 982 * \param secLevel Security level of pairing when LTK was exchanged.
enginerd 0:b562096246b3 983 * \param pLtk Pointer to LTK parameter structure.
enginerd 0:b562096246b3 984 *
enginerd 0:b562096246b3 985 * \return None.
enginerd 0:b562096246b3 986 */
enginerd 0:b562096246b3 987 /*************************************************************************************************/
enginerd 0:b562096246b3 988 void DmSecEncryptReq(dmConnId_t connId, uint8_t secLevel, dmSecLtk_t *pLtk);
enginerd 0:b562096246b3 989
enginerd 0:b562096246b3 990 /*************************************************************************************************/
enginerd 0:b562096246b3 991 /*!
enginerd 0:b562096246b3 992 * \fn DmSecLtkRsp
enginerd 0:b562096246b3 993 *
enginerd 0:b562096246b3 994 * \brief This function is called by a slave in response to a DM_SEC_LTK_REQ_IND event
enginerd 0:b562096246b3 995 * to provide the long term key used for encryption.
enginerd 0:b562096246b3 996 *
enginerd 0:b562096246b3 997 * \param connId DM connection ID.
enginerd 0:b562096246b3 998 * \param keyFound TRUE if key found.
enginerd 0:b562096246b3 999 * \param secLevel Security level of pairing when key was exchanged.
enginerd 0:b562096246b3 1000 * \param pKey Pointer to the key, if found.
enginerd 0:b562096246b3 1001 *
enginerd 0:b562096246b3 1002 * \return None.
enginerd 0:b562096246b3 1003 */
enginerd 0:b562096246b3 1004 /*************************************************************************************************/
enginerd 0:b562096246b3 1005 void DmSecLtkRsp(dmConnId_t connId, bool_t keyFound, uint8_t secLevel, uint8_t *pKey);
enginerd 0:b562096246b3 1006
enginerd 0:b562096246b3 1007 /*************************************************************************************************/
enginerd 0:b562096246b3 1008 /*!
enginerd 0:b562096246b3 1009 * \fn DmSecSetLocalCsrk
enginerd 0:b562096246b3 1010 *
enginerd 0:b562096246b3 1011 * \brief This function sets the local CSRK used by the device.
enginerd 0:b562096246b3 1012 *
enginerd 0:b562096246b3 1013 * \param pCsrk Pointer to CSRK.
enginerd 0:b562096246b3 1014 *
enginerd 0:b562096246b3 1015 * \return None.
enginerd 0:b562096246b3 1016 */
enginerd 0:b562096246b3 1017 /*************************************************************************************************/
enginerd 0:b562096246b3 1018 void DmSecSetLocalCsrk(uint8_t *pCsrk);
enginerd 0:b562096246b3 1019
enginerd 0:b562096246b3 1020 /*************************************************************************************************/
enginerd 0:b562096246b3 1021 /*!
enginerd 0:b562096246b3 1022 * \fn DmSecSetLocalIrk
enginerd 0:b562096246b3 1023 *
enginerd 0:b562096246b3 1024 * \brief This function sets the local IRK used by the device.
enginerd 0:b562096246b3 1025 *
enginerd 0:b562096246b3 1026 * \param pCsrk Pointer to IRK.
enginerd 0:b562096246b3 1027 *
enginerd 0:b562096246b3 1028 * \return None.
enginerd 0:b562096246b3 1029 */
enginerd 0:b562096246b3 1030 /*************************************************************************************************/
enginerd 0:b562096246b3 1031 void DmSecSetLocalIrk(uint8_t *pIrk);
enginerd 0:b562096246b3 1032
enginerd 0:b562096246b3 1033 /*************************************************************************************************/
enginerd 0:b562096246b3 1034 /*!
enginerd 0:b562096246b3 1035 * \fn DmPrivInit
enginerd 0:b562096246b3 1036 *
enginerd 0:b562096246b3 1037 * \brief Initialize DM privacy module.
enginerd 0:b562096246b3 1038 *
enginerd 0:b562096246b3 1039 * \return None.
enginerd 0:b562096246b3 1040 */
enginerd 0:b562096246b3 1041 /*************************************************************************************************/
enginerd 0:b562096246b3 1042 void DmPrivInit(void);
enginerd 0:b562096246b3 1043
enginerd 0:b562096246b3 1044 /*************************************************************************************************/
enginerd 0:b562096246b3 1045 /*!
enginerd 0:b562096246b3 1046 * \fn DmPrivResolveAddr
enginerd 0:b562096246b3 1047 *
enginerd 0:b562096246b3 1048 * \brief Resolve a private resolvable address. When complete the client's callback function
enginerd 0:b562096246b3 1049 * is called with a DM_PRIV_RESOLVED_ADDR_IND event. The client must wait to receive
enginerd 0:b562096246b3 1050 * this event before executing this function again.
enginerd 0:b562096246b3 1051 *
enginerd 0:b562096246b3 1052 * \param pAddr Peer device address.
enginerd 0:b562096246b3 1053 * \param pIrk The peer's identity resolving key.
enginerd 0:b562096246b3 1054 * \param param Client-defined parameter returned with callback event.
enginerd 0:b562096246b3 1055 *
enginerd 0:b562096246b3 1056 * \return None.
enginerd 0:b562096246b3 1057 */
enginerd 0:b562096246b3 1058 /*************************************************************************************************/
enginerd 0:b562096246b3 1059 void DmPrivResolveAddr(uint8_t *pAddr, uint8_t *pIrk, uint16_t param);
enginerd 0:b562096246b3 1060
enginerd 0:b562096246b3 1061 /*************************************************************************************************/
enginerd 0:b562096246b3 1062 /*!
enginerd 0:b562096246b3 1063 * \fn DmL2cConnUpdateCnf
enginerd 0:b562096246b3 1064 *
enginerd 0:b562096246b3 1065 * \brief For internal use only. L2C calls this function to send the result of an L2CAP
enginerd 0:b562096246b3 1066 * connection update response to DM.
enginerd 0:b562096246b3 1067 *
enginerd 0:b562096246b3 1068 * \param handle Connection handle.
enginerd 0:b562096246b3 1069 * \param reason Connection update response reason code.
enginerd 0:b562096246b3 1070 * \return None.
enginerd 0:b562096246b3 1071 */
enginerd 0:b562096246b3 1072 /*************************************************************************************************/
enginerd 0:b562096246b3 1073 void DmL2cConnUpdateCnf(uint16_t handle, uint16_t reason);
enginerd 0:b562096246b3 1074
enginerd 0:b562096246b3 1075 /*************************************************************************************************/
enginerd 0:b562096246b3 1076 /*!
enginerd 0:b562096246b3 1077 * \fn DmL2cConnUpdateInd
enginerd 0:b562096246b3 1078 *
enginerd 0:b562096246b3 1079 * \brief For internal use only. L2C calls this function when it receives a connection update
enginerd 0:b562096246b3 1080 * request from a peer device.
enginerd 0:b562096246b3 1081 *
enginerd 0:b562096246b3 1082 * \param identifier Identifier value.
enginerd 0:b562096246b3 1083 * \param handle Connection handle.
enginerd 0:b562096246b3 1084 * \param pConnSpec Connection spec parameters.
enginerd 0:b562096246b3 1085 * \return None.
enginerd 0:b562096246b3 1086 */
enginerd 0:b562096246b3 1087 /*************************************************************************************************/
enginerd 0:b562096246b3 1088 void DmL2cConnUpdateInd(uint8_t identifier, uint16_t handle, hciConnSpec_t *pConnSpec);
enginerd 0:b562096246b3 1089
enginerd 0:b562096246b3 1090 /*************************************************************************************************/
enginerd 0:b562096246b3 1091 /*!
enginerd 0:b562096246b3 1092 * \fn DmConnIdByHandle
enginerd 0:b562096246b3 1093 *
enginerd 0:b562096246b3 1094 * \brief For internal use only. Find the connection ID with matching handle.
enginerd 0:b562096246b3 1095 *
enginerd 0:b562096246b3 1096 * \param handle Handle to find.
enginerd 0:b562096246b3 1097 *
enginerd 0:b562096246b3 1098 * \return Connection ID or DM_CONN_ID_NONE if error.
enginerd 0:b562096246b3 1099 */
enginerd 0:b562096246b3 1100 /*************************************************************************************************/
enginerd 0:b562096246b3 1101 dmConnId_t DmConnIdByHandle(uint16_t handle);
enginerd 0:b562096246b3 1102
enginerd 0:b562096246b3 1103 /*************************************************************************************************/
enginerd 0:b562096246b3 1104 /*!
enginerd 0:b562096246b3 1105 * \fn DmConnInUse
enginerd 0:b562096246b3 1106 *
enginerd 0:b562096246b3 1107 * \brief For internal use only. Return TRUE if the connection is in use.
enginerd 0:b562096246b3 1108 *
enginerd 0:b562096246b3 1109 * \param connId Connection ID.
enginerd 0:b562096246b3 1110 *
enginerd 0:b562096246b3 1111 * \return TRUE if the connection is in use, FALSE otherwise.
enginerd 0:b562096246b3 1112 */
enginerd 0:b562096246b3 1113 /*************************************************************************************************/
enginerd 0:b562096246b3 1114 bool_t DmConnInUse(dmConnId_t connId);
enginerd 0:b562096246b3 1115
enginerd 0:b562096246b3 1116 /*************************************************************************************************/
enginerd 0:b562096246b3 1117 /*!
enginerd 0:b562096246b3 1118 * \fn DmConnPeerAddrType
enginerd 0:b562096246b3 1119 *
enginerd 0:b562096246b3 1120 * \brief For internal use only. Return the peer address type.
enginerd 0:b562096246b3 1121 *
enginerd 0:b562096246b3 1122 * \param connId Connection ID.
enginerd 0:b562096246b3 1123 *
enginerd 0:b562096246b3 1124 * \return Peer address type.
enginerd 0:b562096246b3 1125 */
enginerd 0:b562096246b3 1126 /*************************************************************************************************/
enginerd 0:b562096246b3 1127 uint8_t DmConnPeerAddrType(dmConnId_t connId);
enginerd 0:b562096246b3 1128
enginerd 0:b562096246b3 1129 /*************************************************************************************************/
enginerd 0:b562096246b3 1130 /*!
enginerd 0:b562096246b3 1131 * \fn DmConnPeerAddr
enginerd 0:b562096246b3 1132 *
enginerd 0:b562096246b3 1133 * \brief For internal use only. Return the peer device address.
enginerd 0:b562096246b3 1134 *
enginerd 0:b562096246b3 1135 * \param connId Connection ID.
enginerd 0:b562096246b3 1136 *
enginerd 0:b562096246b3 1137 * \return Pointer to peer device address.
enginerd 0:b562096246b3 1138 */
enginerd 0:b562096246b3 1139 /*************************************************************************************************/
enginerd 0:b562096246b3 1140 uint8_t *DmConnPeerAddr(dmConnId_t connId);
enginerd 0:b562096246b3 1141
enginerd 0:b562096246b3 1142 /*************************************************************************************************/
enginerd 0:b562096246b3 1143 /*!
enginerd 0:b562096246b3 1144 * \fn DmConnLocalAddrType
enginerd 0:b562096246b3 1145 *
enginerd 0:b562096246b3 1146 * \brief For internal use only. Return the local address type.
enginerd 0:b562096246b3 1147 *
enginerd 0:b562096246b3 1148 * \param connId Connection ID.
enginerd 0:b562096246b3 1149 *
enginerd 0:b562096246b3 1150 * \return Local address type.
enginerd 0:b562096246b3 1151 */
enginerd 0:b562096246b3 1152 /*************************************************************************************************/
enginerd 0:b562096246b3 1153 uint8_t DmConnLocalAddrType(dmConnId_t connId);
enginerd 0:b562096246b3 1154
enginerd 0:b562096246b3 1155 /*************************************************************************************************/
enginerd 0:b562096246b3 1156 /*!
enginerd 0:b562096246b3 1157 * \fn DmConnLocalAddr
enginerd 0:b562096246b3 1158 *
enginerd 0:b562096246b3 1159 * \brief For internal use only. Return the local address.
enginerd 0:b562096246b3 1160 *
enginerd 0:b562096246b3 1161 * \param connId Connection ID.
enginerd 0:b562096246b3 1162 *
enginerd 0:b562096246b3 1163 * \return Pointer to local address.
enginerd 0:b562096246b3 1164 */
enginerd 0:b562096246b3 1165 /*************************************************************************************************/
enginerd 0:b562096246b3 1166 uint8_t *DmConnLocalAddr(dmConnId_t connId);
enginerd 0:b562096246b3 1167
enginerd 0:b562096246b3 1168 /*************************************************************************************************/
enginerd 0:b562096246b3 1169 /*!
enginerd 0:b562096246b3 1170 * \fn DmConnSecLevel
enginerd 0:b562096246b3 1171 *
enginerd 0:b562096246b3 1172 * \brief For internal use only. Return the security level of the connection.
enginerd 0:b562096246b3 1173 *
enginerd 0:b562096246b3 1174 * \param connId Connection ID.
enginerd 0:b562096246b3 1175 *
enginerd 0:b562096246b3 1176 * \return Security level of the connection.
enginerd 0:b562096246b3 1177 */
enginerd 0:b562096246b3 1178 /*************************************************************************************************/
enginerd 0:b562096246b3 1179 uint8_t DmConnSecLevel(dmConnId_t connId);
enginerd 0:b562096246b3 1180
enginerd 0:b562096246b3 1181 /*************************************************************************************************/
enginerd 0:b562096246b3 1182 /*!
enginerd 0:b562096246b3 1183 * \fn DmSmpEncryptReq
enginerd 0:b562096246b3 1184 *
enginerd 0:b562096246b3 1185 * \brief For internal use only. This function is called by SMP to request encryption.
enginerd 0:b562096246b3 1186 *
enginerd 0:b562096246b3 1187 * \param connId DM connection ID.
enginerd 0:b562096246b3 1188 * \param secLevel Security level of pairing when key was exchanged.
enginerd 0:b562096246b3 1189 * \param pKey Pointer to key.
enginerd 0:b562096246b3 1190 *
enginerd 0:b562096246b3 1191 * \return None.
enginerd 0:b562096246b3 1192 */
enginerd 0:b562096246b3 1193 /*************************************************************************************************/
enginerd 0:b562096246b3 1194 void DmSmpEncryptReq(dmConnId_t connId, uint8_t secLevel, uint8_t *pKey);
enginerd 0:b562096246b3 1195
enginerd 0:b562096246b3 1196 /*************************************************************************************************/
enginerd 0:b562096246b3 1197 /*!
enginerd 0:b562096246b3 1198 * \fn DmSmpCbackExec
enginerd 0:b562096246b3 1199 *
enginerd 0:b562096246b3 1200 * \brief For internal use only. Execute DM callback from SMP procedures.
enginerd 0:b562096246b3 1201 *
enginerd 0:b562096246b3 1202 * \param pDmEvt Pointer to callback event data.
enginerd 0:b562096246b3 1203 *
enginerd 0:b562096246b3 1204 * \return None.
enginerd 0:b562096246b3 1205 */
enginerd 0:b562096246b3 1206 /*************************************************************************************************/
enginerd 0:b562096246b3 1207 void DmSmpCbackExec(dmEvt_t *pDmEvt);
enginerd 0:b562096246b3 1208
enginerd 0:b562096246b3 1209 /*************************************************************************************************/
enginerd 0:b562096246b3 1210 /*!
enginerd 0:b562096246b3 1211 * \fn DmSecGetLocalCsrk
enginerd 0:b562096246b3 1212 *
enginerd 0:b562096246b3 1213 * \brief For internal use only. This function gets the local CSRK used by the device.
enginerd 0:b562096246b3 1214 *
enginerd 0:b562096246b3 1215 * \return Pointer to CSRK.
enginerd 0:b562096246b3 1216 */
enginerd 0:b562096246b3 1217 /*************************************************************************************************/
enginerd 0:b562096246b3 1218 uint8_t *DmSecGetLocalCsrk(void);
enginerd 0:b562096246b3 1219
enginerd 0:b562096246b3 1220 /*************************************************************************************************/
enginerd 0:b562096246b3 1221 /*!
enginerd 0:b562096246b3 1222 * \fn DmSecGetLocalIrk
enginerd 0:b562096246b3 1223 *
enginerd 0:b562096246b3 1224 * \brief For internal use only. This function gets the local IRK used by the device.
enginerd 0:b562096246b3 1225 *
enginerd 0:b562096246b3 1226 * \return Pointer to IRK.
enginerd 0:b562096246b3 1227 */
enginerd 0:b562096246b3 1228 /*************************************************************************************************/
enginerd 0:b562096246b3 1229 uint8_t *DmSecGetLocalIrk(void);
enginerd 0:b562096246b3 1230
enginerd 0:b562096246b3 1231 #ifdef __cplusplus
enginerd 0:b562096246b3 1232 };
enginerd 0:b562096246b3 1233 #endif
enginerd 0:b562096246b3 1234
enginerd 0:b562096246b3 1235 #endif /* DM_API_H */