Cordio Stack and Cordio Profiles  r2p3-02rel0
dm_api.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Device Manager subsystem API.
6  *
7  * Copyright (c) 2016-2018 Arm Ltd. All Rights Reserved.
8  * Arm Ltd. confidential and proprietary.
9  *
10  * IMPORTANT. Your use of this file is governed by a Software License Agreement
11  * ("Agreement") that must be accepted in order to download or otherwise receive a
12  * copy of this file. You may not use or copy this file for any purpose other than
13  * as described in the Agreement. If you do not agree to all of the terms of the
14  * Agreement do not use this file and delete all copies in your possession or control;
15  * if you do not have a copy of the Agreement, you must contact Arm Ltd. prior
16  * to any use, copying or further distribution of this software.
17  */
18 /*************************************************************************************************/
19 #ifndef DM_API_H
20 #define DM_API_H
21 
22 #include "hci_api.h"
23 #include "cfg_stack.h"
24 #include "smp_defs.h"
25 #include "sec_api.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /*! \addtogroup STACK_DM_API
32  * \{ */
33 
34 /**************************************************************************************************
35  Macros
36 **************************************************************************************************/
37 
38 /** \name GAP Device Role
39  * Connectable GAP Roles.
40  */
41 /**@{*/
42 #define DM_ROLE_MASTER HCI_ROLE_MASTER /*!< \brief Role is master */
43 #define DM_ROLE_SLAVE HCI_ROLE_SLAVE /*!< \brief Role is slave */
44 /**@}*/
45 
46 /** \name GAP Discovery Mode
47  * When setup as a discoverable device, these are the possible modes of discovery.
48  */
49 /**@{*/
50 #define DM_DISC_MODE_NONE 0 /*!< \brief GAP non-discoverable */
51 #define DM_DISC_MODE_LIMITED 1 /*!< \brief GAP limited discoverable mode */
52 #define DM_DISC_MODE_GENERAL 2 /*!< \brief GAP general discoverable mode */
53 /**@}*/
54 
55 /** \name GAP Advertising Type
56  * Type of connectable or disconverable advertising to perform.
57  */
58 /**@{*/
59 #define DM_ADV_CONN_UNDIRECT 0 /*!< \brief Connectable and scannable undirected advertising */
60 #define DM_ADV_CONN_DIRECT 1 /*!< \brief Connectable directed advertising */
61 #define DM_ADV_SCAN_UNDIRECT 2 /*!< \brief Scannable undirected advertising */
62 #define DM_ADV_NONCONN_UNDIRECT 3 /*!< \brief Non-connectable and non-scannable undirected advertising */
63 #define DM_ADV_CONN_DIRECT_LO_DUTY 4 /*!< \brief Connectable directed low duty cycle advertising */
64 /**@}*/
65 
66 /** \name GAP AE Advertising Types
67  * Advertising extension types - AE only.
68  */
69 /**@{*/
70 #define DM_EXT_ADV_CONN_UNDIRECT 5 /*!< \brief Connectable undirected advertising */
71 #define DM_EXT_ADV_NONCONN_DIRECT 6 /*!< \brief Non-connectable and non-scannable directed advertising */
72 #define DM_EXT_ADV_SCAN_DIRECT 7 /*!< \brief Scannable directed advertising */
73 #define DM_ADV_NONE 255 /*!< \brief For internal use only */
74 /**@}*/
75 
76 /** \name GAP Advertising Report Type
77  * Type of an advertising report observed while scanning.
78  */
79 /**@{*/
80 #define DM_RPT_CONN_UNDIRECT 0 /*!< \brief Connectable and scannable undirected advertising */
81 #define DM_RPT_CONN_DIRECT 1 /*!< \brief Connectable directed advertising */
82 #define DM_RPT_SCAN_UNDIRECT 2 /*!< \brief Scannable undirected advertising */
83 #define DM_RPT_NONCONN_UNDIRECT 3 /*!< \brief Non-connectable undirected advertising */
84 #define DM_RPT_SCAN_RESPONSE 4 /*!< \brief Scan response */
85 /**@}*/
86 
87 /** \name GAP Advertising Data Location
88  * Whether data is located in the advertising data or in the scan response data
89  */
90 /**@{*/
91 #define DM_DATA_LOC_ADV 0 /*!< \brief Locate data in the advertising data */
92 #define DM_DATA_LOC_SCAN 1 /*!< \brief Locate data in the scan response data */
93 /**@}*/
94 
95 /** \name GAP Scan Type
96  * When setup as a connectable or observer device, this is the type of scanning to perform.
97  */
98 /**@{*/
99 #define DM_SCAN_TYPE_PASSIVE 0 /*!< \brief Passive scan */
100 #define DM_SCAN_TYPE_ACTIVE 1 /*!< \brief Active scan */
101 /**@}*/
102 
103 /** \name GAP Advertising Channel Map
104  * Advertising channel map codes
105  */
106 /**@{*/
107 #define DM_ADV_CHAN_37 HCI_ADV_CHAN_37 /*!< \brief Advertising channel 37 */
108 #define DM_ADV_CHAN_38 HCI_ADV_CHAN_38 /*!< \brief Advertising channel 38 */
109 #define DM_ADV_CHAN_39 HCI_ADV_CHAN_39 /*!< \brief Advertising channel 39 */
110 /*! \brief All advertising channels */
111 #define DM_ADV_CHAN_ALL (HCI_ADV_CHAN_37 | HCI_ADV_CHAN_38 | HCI_ADV_CHAN_39)
112 /**@}*/
113 
114 /** \name DM Client IDs
115  * The client ID parameter to function DmConnRegister()
116  */
117 /**@{*/
118 #define DM_CLIENT_ID_ATT 0 /*!< \brief Identifier for attribute protocol, for internal use only */
119 #define DM_CLIENT_ID_SMP 1 /*!< \brief Identifier for security manager protocol, for internal use only */
120 #define DM_CLIENT_ID_DM 2 /*!< \brief Identifier for device manager, for internal use only */
121 #define DM_CLIENT_ID_APP 3 /*!< \brief Identifier for the application */
122 #define DM_CLIENT_ID_L2C 4 /*!< \brief Identifier for L2CAP */
123 #define DM_CLIENT_ID_MAX 5 /*!< \brief For internal use only */
124 /**@}*/
125 
126 /** \name DM Unknown IDs
127  * Values for unknown or unspecificed device identifiers.
128  */
129 /**@{*/
130 /*! \brief Unknown connection ID or other error */
131 #define DM_CONN_ID_NONE 0
132 
133 /*! \brief Unknown sync ID or other error */
134 #define DM_SYNC_ID_NONE 0
135 /**@}*/
136 
137 /** \name GAP Address Type
138  * The address type to use over the air or that is associated with a received address.
139  */
140 /**@{*/
141 #define DM_ADDR_PUBLIC 0x00 /*!< \brief Public device address */
142 #define DM_ADDR_RANDOM 0x01 /*!< \brief Random device address */
143 #define DM_ADDR_PUBLIC_IDENTITY 0x02 /*!< \brief Public identity address (corresponds to resolved private address) */
144 #define DM_ADDR_RANDOM_IDENTITY 0x03 /*!< \brief Random (static) identity address (corresponds to resolved private address) */
145 #define DM_ADDR_RANDOM_UNRESOLVED 0xFE /*!< \brief Random device address (Controller unable to resolve) */
146 #define DM_ADDR_NONE 0xFF /*!< \brief No address provided (anonymous) */
147 /**@}*/
148 
149 /** \name GAP Advertising Data Types
150  * Advertising data types flags.
151  */
152 /**@{*/
153 #define DM_ADV_TYPE_FLAGS 0x01 /*!< \brief Flag bits */
154 #define DM_ADV_TYPE_16_UUID_PART 0x02 /*!< \brief Partial list of 16 bit UUIDs */
155 #define DM_ADV_TYPE_16_UUID 0x03 /*!< \brief Complete list of 16 bit UUIDs */
156 #define DM_ADV_TYPE_32_UUID_PART 0x04 /*!< \brief Partial list of 32 bit UUIDs */
157 #define DM_ADV_TYPE_32_UUID 0x05 /*!< \brief Complete list of 32 bit UUIDs */
158 #define DM_ADV_TYPE_128_UUID_PART 0x06 /*!< \brief Partial list of 128 bit UUIDs */
159 #define DM_ADV_TYPE_128_UUID 0x07 /*!< \brief Complete list of 128 bit UUIDs */
160 #define DM_ADV_TYPE_SHORT_NAME 0x08 /*!< \brief Shortened local name */
161 #define DM_ADV_TYPE_LOCAL_NAME 0x09 /*!< \brief Complete local name */
162 #define DM_ADV_TYPE_TX_POWER 0x0A /*!< \brief TX power level */
163 #define DM_ADV_TYPE_SM_TK_VALUE 0x10 /*!< \brief Security manager TK value */
164 #define DM_ADV_TYPE_SM_OOB_FLAGS 0x11 /*!< \brief Security manager OOB flags */
165 #define DM_ADV_TYPE_CONN_INTERVAL 0x12 /*!< \brief Slave preferred connection interval */
166 #define DM_ADV_TYPE_SIGNED_DATA 0x13 /*!< \brief Signed data */
167 #define DM_ADV_TYPE_16_SOLICIT 0x14 /*!< \brief Service soliticiation list of 16 bit UUIDs */
168 #define DM_ADV_TYPE_128_SOLICIT 0x15 /*!< \brief Service soliticiation list of 128 bit UUIDs */
169 #define DM_ADV_TYPE_SERVICE_DATA 0x16 /*!< \brief Service data - 16-bit UUID */
170 #define DM_ADV_TYPE_PUBLIC_TARGET 0x17 /*!< \brief Public target address */
171 #define DM_ADV_TYPE_RANDOM_TARGET 0x18 /*!< \brief Random target address */
172 #define DM_ADV_TYPE_APPEARANCE 0x19 /*!< \brief Device appearance */
173 #define DM_ADV_TYPE_ADV_INTERVAL 0x1A /*!< \brief Advertising interval */
174 #define DM_ADV_TYPE_BD_ADDR 0x1B /*!< \brief LE Bluetooth device address */
175 #define DM_ADV_TYPE_ROLE 0x1C /*!< \brief LE role */
176 #define DM_ADV_TYPE_32_SOLICIT 0x1F /*!< \brief Service soliticiation list of 32 bit UUIDs */
177 #define DM_ADV_TYPE_SVC_DATA_32 0x20 /*!< \brief Service data - 32-bit UUID */
178 #define DM_ADV_TYPE_SVC_DATA_128 0x21 /*!< \brief Service data - 128-bit UUID */
179 #define DM_ADV_TYPE_LESC_CONFIRM 0x22 /*!< \brief LE Secure Connections confirm value */
180 #define DM_ADV_TYPE_LESC_RANDOM 0x23 /*!< \brief LE Secure Connections random value */
181 #define DM_ADV_TYPE_URI 0x24 /*!< \brief URI */
182 #define DM_ADV_TYPE_MANUFACTURER 0xFF /*!< \brief Manufacturer specific data */
183 /**@}*/
184 
185 /** \name GAP Advertising Data Flag Advertising Type
186  * Bit mask for Advertising Type flag in advertising data.
187  */
188 /**@{*/
189 #define DM_FLAG_LE_LIMITED_DISC 0x01 /*!< \brief Limited discoverable flag */
190 #define DM_FLAG_LE_GENERAL_DISC 0x02 /*!< \brief General discoverable flag */
191 #define DM_FLAG_LE_BREDR_NOT_SUP 0x04 /*!< \brief BR/EDR not supported flag */
192 /**@}*/
193 
194 /** \name GAP Advertising Data Element Indexes
195  * Advertising data element indexes.
196  */
197 /**@{*/
198 #define DM_AD_LEN_IDX 0 /*!< \brief Advertising data element len */
199 #define DM_AD_TYPE_IDX 1 /*!< \brief Advertising data element type */
200 #define DM_AD_DATA_IDX 2 /*!< \brief Advertising data element data */
201 /**@}*/
202 
203 /** \name GAP Advertising URI
204  * Advertising URI Scheme
205  */
206 /**@{*/
207 #define DM_URI_SCHEME_HTTP 0x16 /*!< \brief URI HTTP Scheme */
208 #define DM_URI_SCHEME_HTTPS 0x17 /*!< \brief URI HTTPS Scheme */
209 /**@}*/
210 
211 /** \name GAP Timeouts
212  * Timeouts defined by the GAP specification; in units of milliseconds.
213  */
214 /**@{*/
215 #define DM_GAP_LIM_ADV_TIMEOUT 180000 /*!< \brief Maximum advertising duration in limited discoverable mode */
216 #define DM_GAP_GEN_DISC_SCAN_MIN 10240 /*!< \brief Minimum scan duration for general discovery */
217 #define DM_GAP_LIM_DISC_SCAN_MIN 10240 /*!< \brief Minimum scan duration for limited discovery */
218 #define DM_GAP_CONN_PARAM_TIMEOUT 30000 /*!< \brief Connection parameter update timeout */
219 #define DM_GAP_SCAN_FAST_PERIOD 30720 /*!< \brief Minimum time to perform scanning when user initiated */
220 #define DM_GAP_ADV_FAST_PERIOD 30000 /*!< \brief Minimum time to perform advertising when user initiated */
221 /**@}*/
222 
223 /** \name GAP 1M PHY Timing
224  * Advertising, scanning, and connection parameters defined in the GAP specification for the LE 1M PHY.
225  * In units of 625 microseconds.
226  */
227 /**@{*/
228 #define DM_GAP_SCAN_FAST_INT_MIN 48 /*!< \brief Minimum scan interval when user initiated */
229 #define DM_GAP_SCAN_FAST_INT_MAX 96 /*!< \brief Maximum scan interval when user initiated */
230 #define DM_GAP_SCAN_FAST_WINDOW 48 /*!< \brief Scan window when user initiated */
231 #define DM_GAP_SCAN_SLOW_INT_1 2048 /*!< \brief Scan interval 1 when background scannning */
232 #define DM_GAP_SCAN_SLOW_WINDOW_1 18 /*!< \brief Scan window 1 when background scanning */
233 #define DM_GAP_SCAN_SLOW_INT_2 4096 /*!< \brief Scan interval 2 when background scannning */
234 #define DM_GAP_SCAN_SLOW_WINDOW_2 36 /*!< \brief Scan window 2 when background scanning */
235 #define DM_GAP_ADV_FAST_INT_MIN_1 48 /*!< \brief Minimum advertising interval 1 when user initiated */
236 #define DM_GAP_ADV_FAST_INT_MAX_1 96 /*!< \brief Maximum advertising interval 1 when user initiated */
237 #define DM_GAP_ADV_FAST_INT_MIN_2 160 /*!< \brief Minimum advertising interval 2 when user initiated */
238 #define DM_GAP_ADV_FAST_INT_MAX_2 240 /*!< \brief Maximum advertising interval 2 when user initiated */
239 #define DM_GAP_ADV_SLOW_INT_MIN 1600 /*!< \brief Minimum advertising interval when background advertising */
240 #define DM_GAP_ADV_SLOW_INT_MAX 1920 /*!< \brief Maximum advertising interval when background advertising */
241 /**@}*/
242 
243 /** \name GAP Coded PHY Timing
244  * Advertising, scanning, and connection parameters defined in the GAP specification for the LE Coded PHY.
245  * In units of 625 microseconds.
246  */
247 /**@{*/
248 #define DM_GAP_SCAN_CODED_FAST_INT_MIN 144 /*!< \brief Minimum scan interval when user initiated on LE Coded PHY */
249 #define DM_GAP_SCAN_CODED_FAST_INT_MAX 288 /*!< \brief Maximum scan interval when user initiated on LE Coded PHY */
250 #define DM_GAP_SCAN_CODED_FAST_WINDOW 144 /*!< \brief Scan window when user initiated on LE Coded PHY */
251 #define DM_GAP_SCAN_CODED_SLOW_INT_1 6144 /*!< \brief Scan interval 1 when background scannning on LE Coded PHY */
252 #define DM_GAP_SCAN_CODED_SLOW_WINDOW_1 54 /*!< \brief Scan window 1 when background scanning on LE Coded PHY */
253 #define DM_GAP_SCAN_CODED_SLOW_INT_2 12288 /*!< \brief Scan interval 2 when background scannning on LE Coded PHY */
254 #define DM_GAP_SCAN_CODED_SLOW_WINDOW_2 108 /*!< \brief Scan window 2 when background scanning on LE Coded PHY */
255 #define DM_GAP_ADV_CODED_FAST_INT_MIN_1 144 /*!< \brief Minimum advertising interval 1 when user initiated on LE Coded PHY */
256 #define DM_GAP_ADV_CODED_FAST_INT_MAX_1 288 /*!< \brief Maximum advertising interval 1 when user initiated on LE Coded PHY */
257 #define DM_GAP_ADV_CODED_FAST_INT_MIN_2 480 /*!< \brief Minimum advertising interval 2 when user initiated on LE Coded PHY */
258 #define DM_GAP_ADV_CODED_FAST_INT_MAX_2 720 /*!< \brief Maximum advertising interval 2 when user initiated on LE Coded PHY */
259 #define DM_GAP_ADV_CODED_SLOW_INT_MIN 4800 /*!< \brief Minimum advertising interval when background advertising on LE Coded PHY */
260 #define DM_GAP_ADV_CODED_SLOW_INT_MAX 5760 /*!< \brief Maximum advertising interval when background advertising on LE Coded PHY */
261 /**@}*/
262 
263 /** \name GAP Connection Slave Latency
264  *
265  */
266 /**@{*/
267 /*! \brief GAP connection establishment slaves latency */
268 #define DM_GAP_CONN_EST_LATENCY 0
269 /**@}*/
270 
271 /** \name GAP Connection Interval
272  * GAP connection interval in 1.25ms units.
273  */
274 /**@{*/
275 #define DM_GAP_INITIAL_CONN_INT_MIN 24 /*!< \brief Minimum initial connection interval */
276 #define DM_GAP_INITIAL_CONN_INT_MAX 40 /*!< \brief Maximum initial connection interval */
277 /**@}*/
278 
279 /** \name GAP Connection Event Lengths
280  * GAP connection establishment minimum and maximum connection event lengths.
281  */
282 /**@{*/
283 #define DM_GAP_CONN_EST_MIN_CE_LEN 0 /*!< \brief Connection establishment minimum event length */
284 #define DM_GAP_CONN_EST_MAX_CE_LEN 0 /*!< \brief Connection establishment maximum event length */
285 /**@}*/
286 
287 /** \name GAP Peripheral Privacy Characteristic Values
288  *
289  */
290 /**@{*/
291 #define DM_GAP_PRIV_DISABLED 0 /*!< \brief Privacy Disabled */
292 #define DM_GAP_PRIV_ENABLED 1 /*!< \brief Privacy Enabled */
293 /**@}*/
294 
295 /** \name GAP Connection Supervision Timeout
296  * Connection supervision timeout, in 10ms units
297  */
298 /**@{*/
299 /*! \brief Connection establishment supervision timeout default, in 10ms units */
300 #define DM_DEFAULT_EST_SUP_TIMEOUT 2000
301 /**@}*/
302 
303 /** \name GAP Security Pairing Authentication Requirements
304  * Pairing authentication/security properties bit mask.
305  */
306 /**@{*/
307 #define DM_AUTH_BOND_FLAG SMP_AUTH_BOND_FLAG /*!< \brief Bonding requested */
308 #define DM_AUTH_MITM_FLAG SMP_AUTH_MITM_FLAG /*!< \brief MITM (authenticated pairing) requested */
309 #define DM_AUTH_SC_FLAG SMP_AUTH_SC_FLAG /*!< \brief LE Secure Connections requested */
310 #define DM_AUTH_KP_FLAG SMP_AUTH_KP_FLAG /*!< \brief Keypress notifications requested */
311 /**@}*/
312 
313 /** \name GAP Key Distribution Flags
314  * Key distribution bit mask
315  */
316 /**@{*/
317 #define DM_KEY_DIST_LTK SMP_KEY_DIST_ENC /*!< \brief Distribute LTK used for encryption */
318 #define DM_KEY_DIST_IRK SMP_KEY_DIST_ID /*!< \brief Distribute IRK used for privacy */
319 #define DM_KEY_DIST_CSRK SMP_KEY_DIST_SIGN /*!< \brief Distribute CSRK used for signed data */
320 /**@}*/
321 
322 /** \name DM Security Key Indication Types
323  * Type of key used in \ref DM_SEC_KEY_IND.
324  */
325 /**@{*/
326 #define DM_KEY_LOCAL_LTK 0x01 /*!< \brief LTK generated locally for this device */
327 #define DM_KEY_PEER_LTK 0x02 /*!< \brief LTK received from peer device */
328 #define DM_KEY_IRK 0x04 /*!< \brief IRK and identity info of peer device */
329 #define DM_KEY_CSRK 0x08 /*!< \brief CSRK of peer device */
330 /**@}*/
331 
332 /*! \brief Base value for HCI error status values for \ref DM_SEC_PAIR_CMPL_IND */
333 #define DM_SEC_HCI_ERR_BASE 0x20
334 
335 /** \name GAP Security Level
336  * GAP Mode 1 Security Levels
337  */
338 /**@{*/
339 #define DM_SEC_LEVEL_NONE 0 /*!< \brief Connection has no security */
340 #define DM_SEC_LEVEL_ENC 1 /*!< \brief Connection is encrypted with unauthenticated key */
341 #define DM_SEC_LEVEL_ENC_AUTH 2 /*!< \brief Connection is encrypted with authenticated key */
342 #define DM_SEC_LEVEL_ENC_LESC 3 /*!< \brief Connection is encrypted with LE Secure Connections */
343 /**@}*/
344 
345 /** \name GAP Random Address Types
346  * Random address type masks.
347  */
348 /**@{*/
349 #define DM_RAND_ADDR_STATIC 0xC0 /*!< \brief Static address */
350 #define DM_RAND_ADDR_RESOLV 0x40 /*!< \brief Resolvable private address */
351 #define DM_RAND_ADDR_NONRESOLV 0x00 /*!< \brief Non-resolvable private address */
352 /**@}*/
353 
354 /** \name GAP Random Address Macros
355  * Macros for identifying address type.
356  */
357 /**@{*/
358 /*! \brief Get the type of random address */
359 #define DM_RAND_ADDR_GET(addr) ((addr)[5] & 0xC0)
360 
361 /*! \brief Set the type of random address */
362 #define DM_RAND_ADDR_SET(addr, type) {(addr)[5] = ((addr)[5] & 0x3F) | (type);}
363 
364 /*! \brief Check for Resolvable Random Address */
365 #define DM_RAND_ADDR_RPA(addr, type) (((type) == DM_ADDR_RANDOM) && \
366  (DM_RAND_ADDR_GET((addr)) == DM_RAND_ADDR_RESOLV))
367 /**@}*/
368 
369 /** \name GAP Privacy Mode
370  * Privacy Mode of this device in regards to a peer device.
371  */
372 /**@{*/
373 #define DM_PRIV_MODE_NETWORK 0x00 /*!< \brief Network privacy mode (default). */
374 #define DM_PRIV_MODE_DEVICE 0x01 /*!< \brief Device privacy mode. */
375 /**@}*/
376 
377 /** \name DM Internal State
378  * Connection busy or idle state
379  */
380 /**@{*/
381 #define DM_CONN_IDLE 0 /*!< \brief Connection is idle. */
382 #define DM_CONN_BUSY 1 /*!< \brief Connection is busy. */
383 /**@}*/
384 
385 /** \name DM Internal State Flags
386  * Connection busy/idle state bitmask.
387  */
388 /**@{*/
389 #define DM_IDLE_SMP_PAIR 0x0001 /*!< \brief SMP pairing in progress */
390 #define DM_IDLE_DM_ENC 0x0002 /*!< \brief DM Encryption setup in progress */
391 #define DM_IDLE_ATTS_DISC 0x0004 /*!< \brief ATTS service discovery in progress */
392 #define DM_IDLE_APP_DISC 0x0008 /*!< \brief App framework service discovery in progress */
393 #define DM_IDLE_USER_1 0x0010 /*!< \brief For use by user application */
394 #define DM_IDLE_USER_2 0x0020 /*!< \brief For use by user application */
395 #define DM_IDLE_USER_3 0x0040 /*!< \brief For use by user application */
396 #define DM_IDLE_USER_4 0x0080 /*!< \brief For use by user application */
397 /**@}*/
398 
399 /** \name GAP Filter Policy Modes
400  * Filter policy modes.
401  */
402 /**@{*/
403 #define DM_FILT_POLICY_MODE_ADV 0 /*!< \brief Advertising filter policy mode */
404 #define DM_FILT_POLICY_MODE_SCAN 1 /*!< \brief Scanning filter policy mode */
405 #define DM_FILT_POLICY_MODE_INIT 2 /*!< \brief Initiator filter policy mode */
406 #define DM_FILT_POLICY_MODE_SYNC 3 /*!< \brief Synchronization filter policy mode */
407 /**@}*/
408 
409 /** \name DM Proprietary Error Codes
410  * Internal error codes not sent in any PDU.
411  */
412 /**@{*/
413 #define DM_ERR_SMP_RX_PDU_LEN_EXCEEDED 0x01 /*!< \brief LESC key length exceeded maximum RX PDU length */
414 #define DM_ERR_ATT_RX_PDU_LEN_EXCEEDED 0x02 /*!< \brief Configured ATT MTU exceeded maximum RX PDU length */
415 #define DM_ERR_L2C_RX_PDU_LEN_EXCEEDED 0x03 /*!< \brief Registered COC MPS exceeded maximum RX PDU length */
416 /**@}*/
417 
418 /** \name DM Legacy Advertising Handle
419  * Default handle for legacy advertising when using legacy HCI interface. In this case only one advertising
420  * set is allowed so all activity uses the same handle.
421  */
422 /**@{*/
423 /*! \brief Default Advertising handle for legacy advertising */
424 #define DM_ADV_HANDLE_DEFAULT 0
425 /**@}*/
426 
427 /** \name DM Callback Events
428  * Events handled by the DM state machine.
429  */
430 /**@{*/
431 #define DM_CBACK_START 0x20 /*!< \brief DM callback event starting value */
432 
433 /*! \brief DM callback events */
434 enum
435 {
436  DM_RESET_CMPL_IND = DM_CBACK_START, /*!< \brief Reset complete */
437  DM_ADV_START_IND, /*!< \brief Advertising started */
438  DM_ADV_STOP_IND, /*!< \brief Advertising stopped */
439  DM_ADV_NEW_ADDR_IND, /*!< \brief New resolvable address has been generated */
440  DM_SCAN_START_IND, /*!< \brief Scanning started */
441  DM_SCAN_STOP_IND, /*!< \brief Scanning stopped */
442  DM_SCAN_REPORT_IND, /*!< \brief Scan data received from peer device */
443  DM_CONN_OPEN_IND, /*!< \brief Connection opened */
444  DM_CONN_CLOSE_IND, /*!< \brief Connection closed */
445  DM_CONN_UPDATE_IND, /*!< \brief Connection update complete */
446  DM_SEC_PAIR_CMPL_IND, /*!< \brief Pairing completed successfully */
447  DM_SEC_PAIR_FAIL_IND, /*!< \brief Pairing failed or other security failure */
448  DM_SEC_ENCRYPT_IND, /*!< \brief Connection encrypted */
449  DM_SEC_ENCRYPT_FAIL_IND, /*!< \brief Encryption failed */
450  DM_SEC_AUTH_REQ_IND, /*!< \brief PIN or OOB data requested for pairing */
451  DM_SEC_KEY_IND, /*!< \brief Security key indication */
452  DM_SEC_LTK_REQ_IND, /*!< \brief LTK requested for encyption */
453  DM_SEC_PAIR_IND, /*!< \brief Incoming pairing request from master */
454  DM_SEC_SLAVE_REQ_IND, /*!< \brief Incoming security request from slave */
455  DM_SEC_CALC_OOB_IND, /*!< \brief Result of OOB Confirm Calculation Generation */
456  DM_SEC_ECC_KEY_IND, /*!< \brief Result of ECC Key Generation */
457  DM_SEC_COMPARE_IND, /*!< \brief Result of Just Works/Numeric Comparison Compare Value Calculation */
458  DM_SEC_KEYPRESS_IND, /*!< \brief Keypress indication from peer in passkey security */
459  DM_PRIV_RESOLVED_ADDR_IND, /*!< \brief Private address resolved */
460  DM_CONN_READ_RSSI_IND, /*!< \brief Connection RSSI read */
461  DM_PRIV_ADD_DEV_TO_RES_LIST_IND, /*!< \brief Device added to resolving list */
462  DM_PRIV_REM_DEV_FROM_RES_LIST_IND, /*!< \brief Device removed from resolving list */
463  DM_PRIV_CLEAR_RES_LIST_IND, /*!< \brief Resolving list cleared */
464  DM_PRIV_READ_PEER_RES_ADDR_IND, /*!< \brief Peer resolving address read */
465  DM_PRIV_READ_LOCAL_RES_ADDR_IND, /*!< \brief Local resolving address read */
466  DM_PRIV_SET_ADDR_RES_ENABLE_IND, /*!< \brief Address resolving enable set */
467  DM_REM_CONN_PARAM_REQ_IND, /*!< \brief Remote connection parameter requested */
468  DM_CONN_DATA_LEN_CHANGE_IND, /*!< \brief Data length changed */
469  DM_CONN_WRITE_AUTH_TO_IND, /*!< \brief Write authenticated payload complete */
470  DM_CONN_AUTH_TO_EXPIRED_IND, /*!< \brief Authenticated payload timeout expired */
471  DM_PHY_READ_IND, /*!< \brief Read PHY */
472  DM_PHY_SET_DEF_IND, /*!< \brief Set default PHY */
473  DM_PHY_UPDATE_IND, /*!< \brief PHY update */
474  DM_ADV_SET_START_IND, /*!< \brief Advertising set(s) started */
475  DM_ADV_SET_STOP_IND, /*!< \brief Advertising set(s) stopped */
476  DM_SCAN_REQ_RCVD_IND, /*!< \brief Scan request received */
477  DM_EXT_SCAN_START_IND, /*!< \brief Extended scanning started */
478  DM_EXT_SCAN_STOP_IND, /*!< \brief Extended scanning stopped */
479  DM_EXT_SCAN_REPORT_IND, /*!< \brief Extended scan data received from peer device */
480  DM_PER_ADV_SET_START_IND, /*!< \brief Periodic advertising set started */
481  DM_PER_ADV_SET_STOP_IND, /*!< \brief Periodic advertising set stopped */
482  DM_PER_ADV_SYNC_EST_IND, /*!< \brief Periodic advertising sync established */
483  DM_PER_ADV_SYNC_LOST_IND, /*!< \brief Periodic advertising sync lost */
484  DM_PER_ADV_REPORT_IND, /*!< \brief Periodic advertising data received from peer device */
485  DM_REMOTE_FEATURES_IND, /*!< \brief Remote features from peer device */
486  DM_READ_LOCAL_VER_INFO_IND, /*!< \brief Local LL version information read */
487  DM_READ_REMOTE_VER_INFO_IND, /*!< \brief Remote LL version information read */
488  DM_ERROR_IND, /*!< \brief General error */
489  DM_HW_ERROR_IND, /*!< \brief Hardware error */
490  DM_VENDOR_SPEC_IND /*!< \brief Vendor specific event */
491 };
492 
493 #define DM_CBACK_END DM_VENDOR_SPEC_IND /*!< \brief DM callback event ending value */
494 /**@}*/
495 
496 /**************************************************************************************************
497  Data Types
498 **************************************************************************************************/
499 
500 /*! \brief Connection identifier. */
502 
503 /*! \brief Synchronization identifier. */
505 
506 /*! \brief Configuration structure. */
507 typedef struct
508 {
509  uint8_t dummy; /*!< \brief Placeholder variable. */
510 } dmCfg_t;
511 
512 /*! \brief LTK data type. */
513 typedef struct
514 {
515  uint8_t key[SMP_KEY_LEN]; /*!< \brief LTK */
516  uint8_t rand[SMP_RAND8_LEN]; /*!< \brief Rand */
517  uint16_t ediv; /*!< \brief EDIV */
518 } dmSecLtk_t;
519 
520 /*! \brief IRK data type. */
521 typedef struct
522 {
523  uint8_t key[SMP_KEY_LEN]; /*!< \brief IRK */
524  bdAddr_t bdAddr; /*!< \brief BD Address */
525  uint8_t addrType; /*!< \brief Address Type */
526 } dmSecIrk_t;
527 
528 /*! \brief CSRK data type. */
529 typedef struct
530 {
531  uint8_t key[SMP_KEY_LEN]; /*!< \brief CSRK */
532 } dmSecCsrk_t;
533 
534 /*! \brief Union of key types. */
535 typedef union
536 {
537  dmSecLtk_t ltk; /*!< \brief LTK */
538  dmSecIrk_t irk; /*!< \brief IRK */
539  dmSecCsrk_t csrk; /*!< \brief CSRK */
540 } dmSecKey_t;
541 
542 /*! \brief Data type for \ref DM_SEC_PAIR_CMPL_IND. */
543 typedef struct
544 {
545  wsfMsgHdr_t hdr; /*!< \brief Header */
546  uint8_t auth; /*!< \brief Authentication and bonding flags */
548 
549 /*! \brief Data type for \ref DM_SEC_ENCRYPT_IND. */
550 typedef struct
551 {
552  wsfMsgHdr_t hdr; /*!< \brief Header */
553  bool_t usingLtk; /*!< \brief TRUE if connection encrypted with LTK */
555 
556 /*! \brief Data type for \ref DM_SEC_AUTH_REQ_IND. */
557 typedef struct
558 {
559  wsfMsgHdr_t hdr; /*!< \brief Header */
560  bool_t oob; /*!< \brief Out-of-band data requested */
561  bool_t display; /*!< \brief TRUE if pin is to be displayed */
563 
564 /*! \brief Data type for \ref DM_SEC_PAIR_IND. */
565 typedef struct
566 {
567  wsfMsgHdr_t hdr; /*!< \brief Header */
568  uint8_t auth; /*!< \brief Authentication and bonding flags */
569  bool_t oob; /*!< \brief Out-of-band pairing data present or not present */
570  uint8_t iKeyDist; /*!< \brief Initiator key distribution flags */
571  uint8_t rKeyDist; /*!< \brief Responder key distribution flags */
573 
574 /*! \brief Data type for \ref DM_SEC_SLAVE_REQ_IND. */
575 typedef struct
576 {
577  wsfMsgHdr_t hdr; /*!< \brief Header */
578  uint8_t auth; /*!< \brief Authentication and bonding flags */
580 
581 /*! \brief Data type for \ref DM_SEC_KEY_IND. */
582 typedef struct
583 {
584  wsfMsgHdr_t hdr; /*!< \brief Header */
585  dmSecKey_t keyData; /*!< \brief Key data */
586  uint8_t type; /*!< \brief Key type */
587  uint8_t secLevel; /*!< \brief Security level of pairing when key was exchanged */
588  uint8_t encKeyLen; /*!< \brief Length of encryption key used when data was transferred */
590 
591 /*! \brief Data type for \ref DM_SEC_COMPARE_IND. */
592 typedef struct
593 {
594  wsfMsgHdr_t hdr; /*!< \brief Header */
595  uint8_t confirm[SMP_CONFIRM_LEN]; /*!< \brief Confirm value */
597 
598 /*! \brief Data type for \ref DM_SEC_KEYPRESS_IND. */
599 typedef struct
600 {
601  wsfMsgHdr_t hdr; /*!< \brief Header */
602  uint8_t notificationType; /*!< \brief Type of keypress notification */
604 
605 /*! \brief Data type for \ref DM_SEC_CALC_OOB_IND. */
606 typedef struct
607 {
608  wsfMsgHdr_t hdr; /*!< \brief Header */
609  uint8_t confirm[SMP_CONFIRM_LEN]; /*!< \brief Local confirm value */
610  uint8_t random[SMP_RAND_LEN]; /*!< \brief Local random value */
612 
613 /*! \brief Data type for \ref DM_ADV_NEW_ADDR_IND. */
614 typedef struct
615 {
616  wsfMsgHdr_t hdr; /*!< \brief Header */
617  bdAddr_t addr; /*!< \brief New resolvable private address */
618  bool_t firstTime; /*!< \brief TRUE when address is generated for the first time */
620 
621 /*! \brief Data structure for \ref DM_ADV_SET_START_IND. */
622 typedef struct
623 {
624  wsfMsgHdr_t hdr; /*!< \brief Header */
625  uint8_t numSets; /*!< \brief Number of advertising sets */
626  uint8_t advHandle[DM_NUM_ADV_SETS];/*!< \brief Advertising handle array */
628 
629 /*! \brief Data structure for \ref DM_PER_ADV_SET_START_IND. */
630 typedef struct
631 {
632  wsfMsgHdr_t hdr; /*!< \brief Header */
633  uint8_t advHandle; /*!< \brief Advertising handle */
635 
636 /*! \brief Data structure for \ref DM_PER_ADV_SET_STOP_IND. */
637 typedef struct
638 {
639  wsfMsgHdr_t hdr; /*!< \brief Header */
640  uint8_t advHandle; /*!< \brief Advertising handle */
642 
643 /*! \brief Union of DM callback event data types.
644  *
645  * \note the following events use only the common \ref wsfMsgHdr_t header:
646  * \ref DM_RESET_CMPL_IND,
647  * \ref DM_ADV_START_IND,
648  * \ref DM_ADV_STOP_IND,
649  * \ref DM_SCAN_START_IND,
650  * \ref DM_SCAN_STOP_IND,
651  * \ref DM_SEC_PAIR_FAIL_IND,
652  * \ref DM_SEC_ENCRYPT_FAIL_IND,
653  * \ref DM_PRIV_RESOLVED_ADDR_IND,
654  * \ref DM_EXT_SCAN_START_IND,
655  * \ref DM_EXT_SCAN_STOP_IND,
656  * \ref DM_ERROR_IND
657  */
658 typedef union
659 {
660  wsfMsgHdr_t hdr; /*!< \brief Common header */
661  /* common header used by DM_RESET_CMPL_IND */
662  /* common header used by DM_ADV_START_IND */
663  /* common header used by DM_ADV_STOP_IND */
664  dmAdvNewAddrIndEvt_t advNewAddr; /*!< \brief handles \ref DM_ADV_NEW_ADDR_IND */
665  /* common header used by DM_SCAN_START_IND */
666  /* common header used by DM_SCAN_STOP_IND */
667  hciLeAdvReportEvt_t scanReport; /*!< \brief handles \ref DM_SCAN_REPORT_IND */
668  hciLeConnCmplEvt_t connOpen; /*!< \brief handles \ref DM_CONN_OPEN_IND */
669  hciDisconnectCmplEvt_t connClose; /*!< \brief handles \ref DM_CONN_CLOSE_IND */
670  hciLeConnUpdateCmplEvt_t connUpdate; /*!< \brief handles \ref DM_CONN_UPDATE_IND */
671  dmSecPairCmplIndEvt_t pairCmpl; /*!< \brief handles \ref DM_SEC_PAIR_CMPL_IND */
672  /* common header used by DM_SEC_PAIR_FAIL_IND */
673  dmSecEncryptIndEvt_t encryptInd; /*!< \brief handles \ref DM_SEC_ENCRYPT_IND */
674  /* common header used by DM_SEC_ENCRYPT_FAIL_IND */
675  dmSecAuthReqIndEvt_t authReq; /*!< \brief handles \ref DM_SEC_AUTH_REQ_IND */
676  dmSecKeyIndEvt_t keyInd; /*!< \brief handles \ref DM_SEC_KEY_IND */
677  hciLeLtkReqEvt_t ltkReqInd; /*!< \brief handles \ref DM_SEC_LTK_REQ_IND */
678  dmSecPairIndEvt_t pairInd; /*!< \brief handles \ref DM_SEC_PAIR_IND */
679  dmSecSlaveIndEvt_t slaveInd; /*!< \brief handles \ref DM_SEC_SLAVE_REQ_IND */
680  dmSecOobCalcIndEvt_t oobCalcInd; /*!< \brief handles \ref DM_SEC_CALC_OOB_IND */
681  secEccMsg_t eccMsg; /*!< \brief handles \ref DM_SEC_ECC_KEY_IND */
682  dmSecCnfIndEvt_t cnfInd; /*!< \brief handles \ref DM_SEC_COMPARE_IND */
683  dmSecKeypressIndEvt_t keypressInd; /*!< \brief handles \ref DM_SEC_KEYPRESS_IND */
684  /* common header used by DM_PRIV_RESOLVED_ADDR_IND */
685  hciReadRssiCmdCmplEvt_t readRssi; /*!< \brief handles \ref DM_CONN_READ_RSSI_IND */
686  hciLeAddDevToResListCmdCmplEvt_t addDevToResList; /*!< \brief handles \ref DM_PRIV_ADD_DEV_TO_RES_LIST_IND */
687  hciLeRemDevFromResListCmdCmplEvt_t remDevFromResList;/*!< \brief handles \ref DM_PRIV_REM_DEV_FROM_RES_LIST_IND */
688  hciLeClearResListCmdCmplEvt_t clearResList; /*!< \brief handles \ref DM_PRIV_CLEAR_RES_LIST_IND */
689  hciLeReadPeerResAddrCmdCmplEvt_t readPeerResAddr; /*!< \brief handles \ref DM_PRIV_READ_PEER_RES_ADDR_IND */
690  hciLeReadLocalResAddrCmdCmplEvt_t readLocalResAddr; /*!< \brief handles \ref DM_PRIV_READ_LOCAL_RES_ADDR_IND */
691  hciLeSetAddrResEnableCmdCmplEvt_t setAddrResEnable; /*!< \brief handles \ref DM_PRIV_SET_ADDR_RES_ENABLE_IND */
692  hciLeRemConnParamReqEvt_t remConnParamReq; /*!< \brief handles \ref DM_REM_CONN_PARAM_REQ_IND */
693  hciLeDataLenChangeEvt_t dataLenChange; /*!< \brief handles \ref DM_CONN_DATA_LEN_CHANGE_IND */
694  hciWriteAuthPayloadToCmdCmplEvt_t writeAuthTo; /*!< \brief handles \ref DM_CONN_WRITE_AUTH_TO_IND */
695  hciAuthPayloadToExpiredEvt_t authToExpired; /*!< \brief handles \ref DM_CONN_AUTH_TO_EXPIRED_IND */
696  hciLeReadPhyCmdCmplEvt_t readPhy; /*!< \brief handles \ref DM_PHY_READ_IND */
697  hciLeSetDefPhyCmdCmplEvt_t setDefPhy; /*!< \brief handles \ref DM_PHY_SET_DEF_IND */
698  hciLePhyUpdateEvt_t phyUpdate; /*!< \brief handles \ref DM_PHY_UPDATE_IND */
699  dmAdvSetStartEvt_t advSetStart; /*!< \brief handles \ref DM_ADV_SET_START_IND */
700  hciLeAdvSetTermEvt_t advSetStop; /*!< \brief handles \ref DM_ADV_SET_STOP_IND */
701  hciLeScanReqRcvdEvt_t scanReqRcvd; /*!< \brief handles \ref DM_SCAN_REQ_RCVD_IND */
702  /* common header used by DM_EXT_SCAN_START_IND */
703  /* common header used by DM_EXT_SCAN_STOP_IND */
704  hciLeExtAdvReportEvt_t extScanReport; /*!< \brief handles \ref DM_EXT_SCAN_REPORT_IND */
705  dmPerAdvSetStartEvt_t perAdvSetStart; /*!< \brief handles \ref DM_PER_ADV_SET_START_IND */
706  dmPerAdvSetStopEvt_t perAdvSetStop; /*!< \brief handles \ref DM_PER_ADV_SET_STOP_IND */
707  hciLePerAdvSyncEstEvt_t perAdvSyncEst; /*!< \brief handles \ref DM_PER_ADV_SYNC_EST_IND */
708  hciLePerAdvSyncLostEvt_t perAdvSyncLost; /*!< \brief handles \ref DM_PER_ADV_SYNC_LOST_IND */
709  hciLePerAdvReportEvt_t perAdvReport; /*!< \brief handles \ref DM_PER_ADV_REPORT_IND */
710  hciLeReadRemoteFeatCmplEvt_t readRemoteFeat; /*!< \brief handles \ref DM_REMOTE_FEATURES_IND */
711  hciReadLocalVerInfo_t readLocVerInfo; /*!< \brief handles \ref DM_READ_LOCAL_VER_INFO_IND */
712  hciReadRemoteVerInfoCmplEvt_t readRemVerInfo; /*!< \brief handles \ref DM_READ_REMOTE_VER_INFO_IND */
713  /* common header used by DM_ERROR_IND */
714  hciHwErrorEvt_t hwError; /*!< \brief handles \ref DM_HW_ERROR_IND */
715  hciVendorSpecEvt_t vendorSpec; /*!< \brief handles \ref DM_VENDOR_SPEC_IND */
716 } dmEvt_t;
717 
718 /*! \brief Data type for DmSecSetOob(). */
719 typedef struct
720 {
721  uint8_t localRandom[SMP_RAND_LEN]; /*!< \brief Random value of the local device */
722  uint8_t localConfirm[SMP_CONFIRM_LEN]; /*!< \brief Confirm value of the local device */
723  uint8_t peerRandom[SMP_RAND_LEN]; /*!< \brief Random value of the peer device */
724  uint8_t peerConfirm[SMP_CONFIRM_LEN]; /*!< \brief Confirm value of the peer device */
726 
727 /*! \brief Callback type. */
728 typedef void (*dmCback_t)(dmEvt_t *pDmEvt);
729 
730 /**************************************************************************************************
731  Function Declarations
732 **************************************************************************************************/
733 
734 /** \name DM App Callback Registration
735  *
736  */
737 /**@{*/
738 /*************************************************************************************************/
739 /*!
740  * \brief Register a callback with DM for scan and advertising events.
741  *
742  * \param cback Client callback function.
743  *
744  * \return None.
745  */
746 /*************************************************************************************************/
747 void DmRegister(dmCback_t cback);
748 
749 /**@}*/
750 
751 /** \name DM Advertising Functions
752  * Functions used to control Legacy and Extended Advertising.
753  */
754 /**@{*/
755 
756 /*************************************************************************************************/
757 /*!
758  * \brief Find an advertising data element in the given advertising or scan response data.
759  *
760  * \param adType Advertising data element type to find.
761  * \param dataLen Data length.
762  * \param pData Pointer to advertising or scan response data.
763  *
764  * \return Pointer to the advertising data element byte array or NULL if not found.
765  */
766 /*************************************************************************************************/
767 uint8_t *DmFindAdType(uint8_t adType, uint16_t dataLen, uint8_t *pData);
768 
769 /*************************************************************************************************/
770 /*!
771  * \brief Initialize DM legacy advertising.
772  *
773  * \return None.
774  */
775 /*************************************************************************************************/
776 void DmAdvInit(void);
777 
778 /*************************************************************************************************/
779 /*!
780  * \brief Initialize DM extended advertising.
781  *
782  * \return None.
783  */
784 /*************************************************************************************************/
785 void DmExtAdvInit(void);
786 
787 /*************************************************************************************************/
788 /*!
789  * \brief Whether DM advertising is in legacy mode.
790  *
791  * \return TRUE if DM advertising is in legacy mode. FALSE, otherwise.
792  */
793 /*************************************************************************************************/
794 bool_t DmAdvModeLeg(void);
795 
796 /*************************************************************************************************/
797 /*!
798  * \brief Whether DM advertising is in extended mode.
799  *
800  * \return TRUE if DM advertising is in extended mode. FALSE, otherwise.
801  */
802 /*************************************************************************************************/
803 bool_t DmAdvModeExt(void);
804 
805 /*************************************************************************************************/
806 /*!
807  * \brief Set the advertising parameters using the given advertising type, and peer address.
808  *
809  * \param advHandle Advertising handle.
810  * \param advType Advertising type.
811  * \param peerAddrType Peer address type.
812  * \param pPeerAddr Peer address.
813  *
814  * \return None.
815  */
816 /*************************************************************************************************/
817 void DmAdvConfig(uint8_t advHandle, uint8_t advType, uint8_t peerAddrType, uint8_t *pPeerAddr);
818 
819 /*************************************************************************************************/
820 /*!
821  * \brief Set the advertising or scan response data to the given data.
822  *
823  * \param advHandle Advertising handle.
824  * \param op Data operation.
825  * \param location Data location.
826  * \param len Length of the data. Maximum length is 236 bytes.
827  * \param pData Pointer to the data.
828  *
829  * \return None.
830  */
831 /*************************************************************************************************/
832 void DmAdvSetData(uint8_t advHandle, uint8_t op, uint8_t location, uint8_t len, uint8_t *pData);
833 
834 /*************************************************************************************************/
835 /*!
836  * \brief Start advertising using the given advertising set and duration.
837  *
838  * \param numSets Number of advertising sets to enable.
839  * \param pAdvHandles Advertising handles array.
840  * \param pDuration Advertising duration (in milliseconds) array.
841  * \param pMaxEaEvents Maximum number of extended advertising events array.
842  *
843  * \return None.
844  */
845 /*************************************************************************************************/
846 void DmAdvStart(uint8_t numSets, uint8_t *pAdvHandles, uint16_t *pDuration, uint8_t *pMaxEaEvents);
847 
848 /*************************************************************************************************/
849 /*!
850  * \brief Stop advertising for the given advertising set. If the number of sets is set to 0
851  * then all advertising sets are disabled.
852  *
853  * \param numSets Number of advertising sets to disable.
854  * \param pAdvHandles Advertising handles array.
855  *
856  * \return None.
857  */
858 /*************************************************************************************************/
859 void DmAdvStop(uint8_t numSets, uint8_t *pAdvHandles);
860 
861 /*************************************************************************************************/
862 /*!
863  * \brief Remove an advertising set.
864  *
865  * \param advHandle Advertising handle.
866  *
867  * \return None.
868  */
869 /*************************************************************************************************/
870 void DmAdvRemoveAdvSet(uint8_t advHandle);
871 
872 /*************************************************************************************************/
873 /*!
874  * \brief Clear advertising sets.
875  *
876  * \return None.
877  */
878 /*************************************************************************************************/
879 void DmAdvClearAdvSets(void);
880 
881 /*************************************************************************************************/
882 /*!
883  * \brief Set the minimum and maximum advertising intervals.
884  *
885  * \param advHandle Advertising handle.
886  * \param intervalMin Minimum advertising interval.
887  * \param intervalMax Maximum advertising interval.
888  *
889  * \return None.
890  */
891 /*************************************************************************************************/
892 void DmAdvSetInterval(uint8_t advHandle, uint16_t intervalMin, uint16_t intervalMax);
893 
894 /*************************************************************************************************/
895 /*!
896  * \brief Include or exclude certain channels from the advertising channel map.
897  *
898  * \param advHandle Advertising handle.
899  * \param channelMap Advertising channel map.
900  *
901  * \return None.
902  */
903 /*************************************************************************************************/
904 void DmAdvSetChannelMap(uint8_t advHandle, uint8_t channelMap);
905 
906 /*************************************************************************************************/
907 /*!
908  * \brief Set the local address type used while advertising. This function can be used to
909  * configure advertising to use a random address.
910  *
911  * \param addrType Address type.
912  *
913  * \return None.
914  */
915 /*************************************************************************************************/
916 void DmAdvSetAddrType(uint8_t addrType);
917 
918 /*************************************************************************************************/
919 /*!
920  * \brief Set the value of an advertising data element in the given advertising or
921  * scan response data. If the element already exists in the data then it is replaced
922  * with the new value. If the element does not exist in the data it is appended
923  * to it, space permitting.
924  *
925  * \param adType Advertising data element type.
926  * \param len Length of the value. Maximum length is 29 bytes.
927  * \param pValue Pointer to the value.
928  * \param pAdvDataLen Advertising or scan response data length. The new length is returned
929  * in this parameter.
930  * \param pAdvData Pointer to advertising or scan response data.
931  * \param advDataBufLen Length of the advertising or scan response data buffer maintained by
932  * Application.
933  *
934  * \return TRUE if the element was successfully added to the data, FALSE otherwise.
935  */
936 /*************************************************************************************************/
937 bool_t DmAdvSetAdValue(uint8_t adType, uint8_t len, uint8_t *pValue, uint16_t *pAdvDataLen,
938  uint8_t *pAdvData, uint16_t advDataBufLen);
939 
940 /*************************************************************************************************/
941 /*!
942  * \brief Set the device name in the given advertising or scan response data. If the
943  * name can only fit in the data if it is shortened, the name is shortened
944  * and the AD type is changed to DM_ADV_TYPE_SHORT_NAME.
945  *
946  * \param len Length of the name. Maximum length is 29 bytes.
947  * \param pValue Pointer to the name in UTF-8 format.
948  * \param pAdvDataLen Advertising or scan response data length. The new length is returned
949  * in this parameter.
950  * \param pAdvData Pointer to advertising or scan response data.
951  * \param advDataBufLen Length of the advertising or scan response data buffer maintained by
952  * Application.
953  *
954  * \return TRUE if the element was successfully added to the data, FALSE otherwise.
955  */
956 /*************************************************************************************************/
957 bool_t DmAdvSetName(uint8_t len, uint8_t *pValue, uint16_t *pAdvDataLen, uint8_t *pAdvData,
958  uint16_t advDataBufLen);
959 
960 /*************************************************************************************************/
961 /*!
962  * \brief Set the random device address for a given advertising set.
963  *
964  * \param advHandle Advertising handle.
965  * \param pAddr Random device address.
966  *
967  * \return None.
968  */
969 /*************************************************************************************************/
970 void DmAdvSetRandAddr(uint8_t advHandle, const uint8_t *pAddr);
971 
972 /*************************************************************************************************/
973 /*!
974  * \brief Initialize device privacy module.
975  *
976  * \return None.
977  */
978 /*************************************************************************************************/
979 void DmDevPrivInit(void);
980 
981 /*************************************************************************************************/
982 /*!
983  * \brief Start using a private resolvable address.
984  *
985  * \param changeInterval Interval between automatic address changes, in seconds.
986  *
987  * \return None.
988  */
989 /*************************************************************************************************/
990 void DmDevPrivStart(uint16_t changeInterval);
991 
992 /*************************************************************************************************/
993 /*!
994  * \brief Stop using a private resolvable address.
995  *
996  * \return None.
997  */
998 /*************************************************************************************************/
999 void DmDevPrivStop(void);
1000 
1001 /*************************************************************************************************/
1002 /*!
1003  * \brief Set whether or not to use legacy advertising PDUs with extended advertising.
1004  *
1005  * \param advHandle Advertising handle.
1006  * \param useLegacyPdu Whether to use legacy advertising PDUs (default value is TRUE).
1007  *
1008  * \return None.
1009  */
1010 /*************************************************************************************************/
1011 void DmAdvUseLegacyPdu(uint8_t advHandle, bool_t useLegacyPdu);
1012 
1013 /*************************************************************************************************/
1014 /*!
1015  * \brief Set whether or not to omit advertiser's address from all PDUs (anonymous advertising).
1016  *
1017  * \param advHandle Advertising handle.
1018  * \param omitAdvAddr Whether to omit advertiser's address from all PDUs (default value is FALSE).
1019  *
1020  * \return None.
1021  */
1022 /*************************************************************************************************/
1023 void DmAdvOmitAdvAddr(uint8_t advHandle, bool_t omitAdvAddr);
1024 
1025 /*************************************************************************************************/
1026 /*!
1027  * \brief Set whether or not to include TxPower in extended header of advertising PDU.
1028  *
1029  * \param advHandle Advertising handle.
1030  * \param incTxPwr Whether to include TxPower in extended header of advertising PDU (default
1031  * value is FALSE).
1032  * \param advTxPwr Advertising tx power (127 = no preference).
1033  *
1034  * \return None.
1035  */
1036 /*************************************************************************************************/
1037 void DmAdvIncTxPwr(uint8_t advHandle, bool_t incTxPwr, int8_t advTxPwr);
1038 
1039 /*************************************************************************************************/
1040 /*!
1041  * \brief Set extended advertising PHY parameters.
1042  *
1043  * \param advHandle Advertising handle.
1044  * \param priAdvPhy Primary advertising Phy.
1045  * \param secAdvMaxSkip Maximum advertising events Controller can skip before sending AUX_ADV_IND
1046  * on secondary advertising channel (0 = AUX_ADV_IND will be sent prior to
1047  * next advertising event).
1048  * \param secAdvPhy Secondary advertising Phy.
1049  *
1050  * \return None.
1051  */
1052 /*************************************************************************************************/
1053 void DmAdvSetPhyParam(uint8_t advHandle, uint8_t priAdvPhy, uint8_t secAdvMaxSkip, uint8_t secAdvPhy);
1054 
1055 /*************************************************************************************************/
1056 /*!
1057  * \brief Set scan request notification enable.
1058  *
1059  * \param advHandle Advertising handle.
1060  * \param scanReqNotifEna Scan request notification enable.
1061  *
1062  * \return None.
1063  */
1064 /*************************************************************************************************/
1065 void DmAdvScanReqNotifEnable(uint8_t advHandle, bool_t scanReqNotifEna);
1066 
1067 /*************************************************************************************************/
1068 /*!
1069  * \brief Set fragment preference for advertising data.
1070  *
1071  * \param advHandle Advertising handle.
1072  * \param fragPref Fragment preference.
1073  *
1074  * \return None.
1075  */
1076 /*************************************************************************************************/
1077 void DmAdvSetFragPref(uint8_t advHandle, uint8_t fragPref);
1078 
1079 /*************************************************************************************************/
1080 /*!
1081  * \brief Set the advertising parameters for periodic advertising.
1082  *
1083  * \param advHandle Advertising handle.
1084  *
1085  * \return None.
1086  */
1087 /*************************************************************************************************/
1088 void DmPerAdvConfig(uint8_t advHandle);
1089 
1090 /*************************************************************************************************/
1091 /*!
1092  * \brief Set the advertising data to the given data for periodic advertising.
1093  *
1094  * \param advHandle Advertising handle.
1095  * \param op Data operation.
1096  * \param len Length of the data. Maximum length is 236 bytes.
1097  * \param pData Pointer to the data.
1098  *
1099  * \return None.
1100  */
1101 /*************************************************************************************************/
1102 void DmPerAdvSetData(uint8_t advHandle, uint8_t op, uint8_t len, uint8_t *pData);
1103 
1104 /*************************************************************************************************/
1105 /*!
1106  * \brief Start periodic advertising for the advertising set specified by the advertising handle.
1107  *
1108  * \param advHandle Advertising handle.
1109  *
1110  * \return None.
1111  */
1112 /*************************************************************************************************/
1113 void DmPerAdvStart(uint8_t advHandle);
1114 
1115 /*************************************************************************************************/
1116 /*!
1117  * \brief Stop periodic advertising for the advertising set specified by the advertising handle.
1118  *
1119  * \param advHandle Advertising handle.
1120  *
1121  * \return None.
1122  */
1123 /*************************************************************************************************/
1124 void DmPerAdvStop(uint8_t advHandle);
1125 
1126 
1127 /*************************************************************************************************/
1128 /*!
1129  * \brief Set the minimum and maximum advertising intervals for periodic advertising.
1130  *
1131  * \param advHandle Advertising handle.
1132  * \param intervalMin Minimum advertising interval.
1133  * \param intervalMax Maximum advertising interval.
1134  *
1135  * \return None.
1136  */
1137 /*************************************************************************************************/
1138 void DmPerAdvSetInterval(uint8_t advHandle, uint16_t intervalMin, uint16_t intervalMax);
1139 
1140 /*************************************************************************************************/
1141 /*!
1142  * \brief Set whether or not to include TxPower in extended header of advertising PDU for
1143  * periodic advertising.
1144  *
1145  * \param advHandle Advertising handle.
1146  * \param incTxPwr Whether to include TxPower in extended header of advertising PDU (default
1147  * value is FALSE).
1148  *
1149  * \return None.
1150  */
1151 /*************************************************************************************************/
1152 void DmPerAdvIncTxPwr(uint8_t advHandle, bool_t incTxPwr);
1153 
1154 /**@}*/
1155 
1156 /** \name DM Privacy Functions
1157  * Functions for controlling Privacy.
1158  */
1159 /**@{*/
1160 
1161 /*************************************************************************************************/
1162 /*!
1163  * \brief Initialize DM privacy module.
1164  *
1165  * \return None.
1166  */
1167 /*************************************************************************************************/
1168 void DmPrivInit(void);
1169 
1170 /*************************************************************************************************/
1171 /*!
1172  * \brief Resolve a private resolvable address. When complete the client's callback function
1173  * is called with a DM_PRIV_RESOLVED_ADDR_IND event. The client must wait to receive
1174  * this event before executing this function again.
1175  *
1176  * \param pAddr Peer device address.
1177  * \param pIrk The peer's identity resolving key.
1178  * \param param Client-defined parameter returned with callback event.
1179  *
1180  * \return None.
1181  */
1182 /*************************************************************************************************/
1183 void DmPrivResolveAddr(uint8_t *pAddr, uint8_t *pIrk, uint16_t param);
1184 
1185 /*************************************************************************************************/
1186 /*!
1187  * \brief Add device to resolving list. When complete the client's callback function
1188  * is called with a DM_PRIV_ADD_DEV_TO_RES_LIST_IND event. The client must wait
1189  * to receive this event before executing this function again.
1190  *
1191  * Note: This command cannot be used when address translation is enabled in the LL and:
1192  * - Advertising is enabled
1193  * - Scanning is enabled
1194  * - Create connection command is outstanding
1195  *
1196  * Note: If the local or peer IRK associated with the peer Identity Address is all
1197  * zeros then the LL will use or accept the local or peer Identity Address.
1198  *
1199  * Note: 'enableLlPriv' should be set to TRUE when the last device is being added
1200  * to resolving list to enable address resolution in LL.
1201  *
1202  * \param addrType Peer identity address type.
1203  * \param pIdentityAddr Peer identity address.
1204  * \param pPeerIrk The peer's identity resolving key.
1205  * \param pLocalIrk The local identity resolving key.
1206  * \param enableLlPriv Set to TRUE to enable address resolution in LL.
1207  * \param param client-defined parameter returned with callback event.
1208  *
1209  * \return None.
1210  */
1211 /*************************************************************************************************/
1212 void DmPrivAddDevToResList(uint8_t addrType, const uint8_t *pIdentityAddr, uint8_t *pPeerIrk,
1213  uint8_t *pLocalIrk, bool_t enableLlPriv, uint16_t param);
1214 
1215 /*************************************************************************************************/
1216 /*!
1217  * \brief Remove device from resolving list. When complete the client's callback function
1218  * is called with a DM_PRIV_REM_DEV_FROM_RES_LIST_IND event. The client must wait to
1219  * receive this event before executing this function again.
1220  *
1221  * Note: This command cannot be used when address translation is enabled in the LL and:
1222  * - Advertising is enabled
1223  * - Scanning is enabled
1224  * - Create connection command is outstanding
1225  *
1226  * \param addrType Peer identity address type.
1227  * \param pIdentityAddr Peer identity address.
1228  * \param param client-defined parameter returned with callback event.
1229  *
1230  * \return None.
1231  */
1232 /*************************************************************************************************/
1233 void DmPrivRemDevFromResList(uint8_t addrType, const uint8_t *pIdentityAddr, uint16_t param);
1234 
1235 /*************************************************************************************************/
1236 /*!
1237  * \brief Clear resolving list. When complete the client's callback function is called with a
1238  * DM_PRIV_CLEAR_RES_LIST_IND event. The client must wait to receive this event before
1239  * executing this function again.
1240  *
1241  * Note: This command cannot be used when address translation is enabled in the LL and:
1242  * - Advertising is enabled
1243  * - Scanning is enabled
1244  * - Create connection command is outstanding
1245  *
1246  * Note: Address resolution in LL will be disabled when resolving list's cleared
1247  * successfully.
1248  *
1249  * \return None.
1250  */
1251 /*************************************************************************************************/
1252 void DmPrivClearResList(void);
1253 
1254 /*************************************************************************************************/
1255 /*!
1256  * \brief HCI read peer resolvable address command. When complete the client's callback
1257  * function is called with a DM_PRIV_READ_PEER_RES_ADDR_IND event. The client must
1258  * wait to receive this event before executing this function again.
1259  *
1260  * \param addrType Peer identity address type.
1261  * \param pIdentityAddr Peer identity address.
1262  *
1263  * \return None.
1264  */
1265 /*************************************************************************************************/
1266 void DmPrivReadPeerResolvableAddr(uint8_t addrType, const uint8_t *pIdentityAddr);
1267 
1268 /*************************************************************************************************/
1269 /*!
1270  * \brief Read local resolvable address command. When complete the client's callback
1271  * function is called with a DM_PRIV_READ_LOCAL_RES_ADDR_IND event. The client must
1272  * wait to receive this event before executing this function again.
1273  *
1274  * \param addrType Peer identity address type.
1275  * \param pIdentityAddr Peer identity address.
1276  *
1277  * \return None.
1278  */
1279 /*************************************************************************************************/
1280 void DmPrivReadLocalResolvableAddr(uint8_t addrType, const uint8_t *pIdentityAddr);
1281 
1282 /*************************************************************************************************/
1283 /*!
1284  * \brief Enable or disable address resolution in LL. When complete the client's callback
1285  * function is called with a DM_PRIV_SET_ADDR_RES_ENABLE_IND event. The client must
1286  * wait to receive this event before executing this function again.
1287  *
1288  * Note: This command can be used at any time except when:
1289  * - Advertising is enabled
1290  * - Scanning is enabled
1291  * - Create connection command is outstanding
1292  *
1293  * \param enable Set to TRUE to enable address resolution or FALSE to disable it.
1294  *
1295  * \return None.
1296  */
1297 /*************************************************************************************************/
1298 void DmPrivSetAddrResEnable(bool_t enable);
1299 
1300 /*************************************************************************************************/
1301 /*!
1302  * \brief Set resolvable private address timeout command.
1303  *
1304  * \param rpaTimeout Timeout measured in seconds.
1305  *
1306  * \return None.
1307  */
1308 /*************************************************************************************************/
1310 
1311 /*************************************************************************************************/
1312 /*!
1313  * \brief Set privacy mode for a given entry in the resolving list.
1314  *
1315  * \param addrType Peer identity address type.
1316  * \param pIdentityAddr Peer identity address.
1317  * \param mode Privacy mode (by default, network privacy mode is used).
1318  *
1319  * \return None.
1320  */
1321 /*************************************************************************************************/
1322 void DmPrivSetPrivacyMode(uint8_t addrType, const uint8_t *pIdentityAddr, uint8_t mode);
1323 
1324 /*************************************************************************************************/
1325 /*!
1326  * \brief Whether LL Privacy is enabled.
1327  *
1328  * \return TRUE if LL Privacy is enabled. FALSE, otherwise.
1329  */
1330 /*************************************************************************************************/
1331 bool_t DmLlPrivEnabled(void);
1332 
1333 /**@}*/
1334 
1335 /** \name DM Scanner Functions
1336  * Functions for controlling Legacy and Extended Scanner behavior.
1337  */
1338 /**@{*/
1339 
1340 /*************************************************************************************************/
1341 /*!
1342  * \brief Initialize DM legacy scanning.
1343  *
1344  * \return None.
1345  */
1346 /*************************************************************************************************/
1347 void DmScanInit(void);
1348 
1349 /*************************************************************************************************/
1350 /*!
1351  * \brief Initialize DM extended scanning.
1352  *
1353  * \return None.
1354  */
1355 /*************************************************************************************************/
1356 void DmExtScanInit(void);
1357 
1358 /*************************************************************************************************/
1359 /*!
1360  * \brief Whether DM scanning is in legacy mode.
1361  *
1362  * \return TRUE if DM scanning is in legacy mode. FALSE, otherwise.
1363  */
1364 /*************************************************************************************************/
1365 bool_t DmScanModeLeg(void);
1366 
1367 /*************************************************************************************************/
1368 /*!
1369  * \brief Whether DM scanning is in extended mode.
1370  *
1371  * \return TRUE if DM scanning is in extended mode. FALSE, otherwise.
1372  */
1373 /*************************************************************************************************/
1374 bool_t DmScanModeExt(void);
1375 
1376 /*************************************************************************************************/
1377 /*!
1378  * \brief Start scanning on the given PHYs.
1379  *
1380  * \param scanPhys Scanner PHYs.
1381  * \param mode Discoverability mode.
1382  * \param pScanType Scan type array.
1383  * \param filterDup Filter duplicates. Set to TRUE to filter duplicate responses received
1384  * from the same device. Set to FALSE to receive all responses.
1385  * \param duration The scan duration, in milliseconds. If set to zero or both duration and
1386  * period set to non-zero, scanning will continue until DmScanStop() is called.
1387  * \param period The scan period, in 1.28 sec units (only applicable to AE). If set to zero,
1388  * periodic scanning is disabled.
1389  *
1390  * \return None.
1391  */
1392  /*************************************************************************************************/
1393 void DmScanStart(uint8_t scanPhys, uint8_t mode, const uint8_t *pScanType, bool_t filterDup,
1394  uint16_t duration, uint16_t period);
1395 
1396 /*************************************************************************************************/
1397 /*!
1398  * \brief Stop scanning.
1399  *
1400  * \return None.
1401  */
1402 /*************************************************************************************************/
1403 void DmScanStop(void);
1404 
1405 /*************************************************************************************************/
1406 /*!
1407  * \brief Set the scan interval and window for the specified PHYs.
1408  *
1409  * \param scanPhys Scanning PHYs.
1410  * \param pScanInterval Scan interval array.
1411  * \param pScanWindow Scan window array.
1412  *
1413  * \return None.
1414  */
1415 /*************************************************************************************************/
1416 void DmScanSetInterval(uint8_t scanPhys, uint16_t *pScanInterval, uint16_t *pScanWindow);
1417 
1418 /*************************************************************************************************/
1419 /*!
1420  * \brief Set the local address type used while scanning. This function can be used to
1421  * configure scanning to use a random address.
1422  *
1423  * \param addrType Address type.
1424  *
1425  * \return None.
1426  */
1427 /*************************************************************************************************/
1428 void DmScanSetAddrType(uint8_t addrType);
1429 
1430 /*************************************************************************************************/
1431 /*!
1432  * \brief Synchronize with periodic advertising from the given advertiser, and start receiving
1433  * periodic advertising packets.
1434  *
1435  * Note: The synchronization filter policy is used to determine whether the periodic
1436  * advertiser list is used. If the periodic advertiser list is not used, the
1437  * advertising SID, advertiser address type, and advertiser address parameters
1438  * specify the periodic advertising device to listen to; otherwise these parameters
1439  * are ignored.
1440  *
1441  * \param advSid Advertising SID.
1442  * \param advAddrType Advertiser address type.
1443  * \param pAdvAddr Advertiser address.
1444  * \param skip Number of periodic advertising packets that can be skipped after
1445  * successful receive.
1446  * \param syncTimeout Synchronization timeout.
1447  *
1448  * \return Sync indentifier.
1449  */
1450 /*************************************************************************************************/
1451 dmSyncId_t DmSyncStart(uint8_t advSid, uint8_t advAddrType, const uint8_t *pAdvAddr, uint16_t skip,
1452  uint16_t syncTimeout);
1453 
1454 /*************************************************************************************************/
1455 /*!
1456  * \brief Stop reception of the periodic advertising identified by the given sync identifier.
1457  *
1458  * \param syncId Sync identifier.
1459  *
1460  * \return None.
1461  */
1462 /*************************************************************************************************/
1463 void DmSyncStop(dmSyncId_t syncId);
1464 
1465 /*************************************************************************************************/
1466 /*!
1467  * \brief Add device to periodic advertiser list.
1468  *
1469  * \param advAddrType Advertiser address type.
1470  * \param pAdvAddr Advertiser address.
1471  * \param advSid Advertising SID.
1472  *
1473  * \return None.
1474  */
1475 /*************************************************************************************************/
1476 void DmAddDeviceToPerAdvList(uint8_t advAddrType, uint8_t *pAdvAddr, uint8_t advSid);
1477 
1478 /*************************************************************************************************/
1479 /*!
1480  * \brief DM remove device from periodic advertiser list.
1481  *
1482  * \param advAddrType Advertiser address type.
1483  * \param pAdvAddr Advertiser address.
1484  * \param advSid Advertising SID.
1485  *
1486  * \return None.
1487  */
1488 /*************************************************************************************************/
1489 void DmRemoveDeviceFromPerAdvList(uint8_t advAddrType, uint8_t *pAdvAddr, uint8_t advSid);
1490 
1491 /*************************************************************************************************/
1492 /*!
1493  * \brief DM clear periodic advertiser list.
1494  *
1495  * \return None.
1496  */
1497 /*************************************************************************************************/
1498 void DmClearPerAdvList(void);
1499 
1500 /**@}*/
1501 
1502 /** \name DM Connection Functions
1503  * Functions for forming connections and managing connection behavior and parameter updates.
1504  */
1505 /**@{*/
1506 
1507 /*************************************************************************************************/
1508 /*!
1509  * \brief Initialize DM connection manager.
1510  *
1511  * \return None.
1512  */
1513 /*************************************************************************************************/
1514 void DmConnInit(void);
1515 
1516 /*************************************************************************************************/
1517 /*!
1518  * \brief Initialize DM connection manager for operation as legacy master.
1519  *
1520  * \return None.
1521  */
1522 /*************************************************************************************************/
1523 void DmConnMasterInit(void);
1524 
1525 /*************************************************************************************************/
1526 /*!
1527  * \brief Initialize DM connection manager for operation as extended master.
1528  *
1529  * \return None.
1530  */
1531 /*************************************************************************************************/
1532 void DmExtConnMasterInit(void);
1533 
1534 /*************************************************************************************************/
1535 /*!
1536  * \brief Initialize DM connection manager for operation as legacy slave.
1537  *
1538  * \return None.
1539  */
1540 /*************************************************************************************************/
1541 void DmConnSlaveInit(void);
1542 
1543 /*************************************************************************************************/
1544 /*!
1545  * \brief Initialize DM connection manager for operation as extended slave.
1546  *
1547  * \return None.
1548  */
1549 /*************************************************************************************************/
1550 void DmExtConnSlaveInit(void);
1551 
1552 /*************************************************************************************************/
1553 /*!
1554  * \brief Register with the DM connection manager.
1555  *
1556  * \param clientId The client identifier.
1557  * \param cback Client callback function.
1558  *
1559  * \return None.
1560  */
1561 /*************************************************************************************************/
1562 void DmConnRegister(uint8_t clientId, dmCback_t cback);
1563 
1564 /*************************************************************************************************/
1565 /*!
1566  * \brief Open a connection to a peer device with the given address.
1567  *
1568  * \param clientId The client identifier.
1569  * \param initPhys Initiator PHYs.
1570  * \param addrType Address type.
1571  * \param pAddr Peer device address.
1572  *
1573  * \return Connection identifier.
1574  */
1575 /*************************************************************************************************/
1576 dmConnId_t DmConnOpen(uint8_t clientId, uint8_t initPhys, uint8_t addrType, uint8_t *pAddr);
1577 
1578 /*************************************************************************************************/
1579 /*!
1580  * \brief Close the connection with the give connection identifier.
1581  *
1582  * \param clientId The client identifier.
1583  * \param connId Connection identifier.
1584  * \param reason Reason connection is being closed.
1585  *
1586  * \return None.
1587  */
1588 /*************************************************************************************************/
1589 void DmConnClose(uint8_t clientId, dmConnId_t connId, uint8_t reason);
1590 
1591 /*************************************************************************************************/
1592 /*!
1593  * \brief Accept a connection from the given peer device by initiating directed advertising.
1594  *
1595  * \param clientId The client identifier.
1596  * \param advHandle Advertising handle.
1597  * \param advType Advertising type.
1598  * \param duration Advertising duration (in ms).
1599  * \param maxEaEvents Maximum number of extended advertising events.
1600  * \param addrType Address type.
1601  * \param pAddr Peer device address.
1602  *
1603  * \return Connection identifier.
1604  */
1605 /*************************************************************************************************/
1606 dmConnId_t DmConnAccept(uint8_t clientId, uint8_t advHandle, uint8_t advType, uint16_t duration,
1607  uint8_t maxEaEvents, uint8_t addrType, uint8_t *pAddr);
1608 
1609 /*************************************************************************************************/
1610 /*!
1611  * \brief Update the connection parameters of an open connection
1612  *
1613  * \param connId Connection identifier.
1614  * \param pConnSpec Connection specification.
1615  *
1616  * \return None.
1617  */
1618 /*************************************************************************************************/
1619 void DmConnUpdate(dmConnId_t connId, hciConnSpec_t *pConnSpec);
1620 
1621 /*************************************************************************************************/
1622 /*!
1623  * \brief Set the scan interval and window for connections to be created with DmConnOpen().
1624  *
1625  * \param scanInterval The scan interval.
1626  * \param scanWindow The scan window.
1627  *
1628  * \return None.
1629  */
1630 /*************************************************************************************************/
1631 void DmConnSetScanInterval(uint16_t scanInterval, uint16_t scanWindow);
1632 
1633 /*************************************************************************************************/
1634 /*!
1635  * \brief Set the scan interval and window for extended connections to be created with
1636  * DmConnOpen().
1637  *
1638  * \param initPhys Initiator PHYs.
1639  * \param pScanInterval Scan interval array.
1640  * \param pScanWindow Scan window array.
1641  *
1642  * \return None.
1643  */
1644 /*************************************************************************************************/
1645 void DmExtConnSetScanInterval(uint8_t initPhys, uint16_t *pScanInterval, uint16_t *pScanWindow);
1646 
1647 /*************************************************************************************************/
1648 /*!
1649  * \brief Set the connection spec parameters for connections to be created with DmConnOpen().
1650  *
1651  * \param pConnSpec Connection spec parameters.
1652  *
1653  * \return None.
1654  */
1655 /*************************************************************************************************/
1656 void DmConnSetConnSpec(hciConnSpec_t *pConnSpec);
1657 
1658 /*************************************************************************************************/
1659 /*!
1660  * \brief Set the extended connection spec parameters for extended connections to be created
1661  * with DmConnOpen().
1662  *
1663  * \param initPhys The initiator PHYs.
1664  * \param pConnSpec Connection spec parameters array.
1665  *
1666  * \return None.
1667  */
1668 /*************************************************************************************************/
1669 void DmExtConnSetConnSpec(uint8_t initPhys, hciConnSpec_t *pConnSpec);
1670 
1671 /*************************************************************************************************/
1672 /*!
1673  * \brief Set the local address type used for connections created with DmConnOpen().
1674  *
1675  * \param addrType Address type.
1676  *
1677  * \return None.
1678  */
1679 /*************************************************************************************************/
1680 void DmConnSetAddrType(uint8_t addrType);
1681 
1682 /*************************************************************************************************/
1683 /*!
1684  * \brief Configure a bit in the connection idle state mask as busy or idle.
1685  *
1686  * \param connId Connection identifier.
1687  * \param idleMask Bit in the idle state mask to configure.
1688  * \param idle DM_CONN_BUSY or DM_CONN_IDLE.
1689  *
1690  * \return None.
1691  */
1692 /*************************************************************************************************/
1693 void DmConnSetIdle(dmConnId_t connId, uint16_t idleMask, uint8_t idle);
1694 
1695 /*************************************************************************************************/
1696 /*!
1697  * \brief Check if a connection is idle.
1698  *
1699  * \param connId Connection identifier.
1700  *
1701  * \return Zero if connection is idle, nonzero if busy.
1702  */
1703 /*************************************************************************************************/
1704 uint16_t DmConnCheckIdle(dmConnId_t connId);
1705 
1706 /*************************************************************************************************/
1707 /*!
1708  * \brief Read RSSI of a given connection.
1709  *
1710  * \param connId Connection identifier.
1711  *
1712  * \return None.
1713  */
1714 /*************************************************************************************************/
1715 void DmConnReadRssi(dmConnId_t connId);
1716 
1717 /*************************************************************************************************/
1718 /*!
1719  * \brief Reply to the HCI remote connection parameter request event. This command is used to
1720  * indicate that the Host has accepted the remote device's request to change connection
1721  * parameters.
1722  *
1723  * \param connId Connection identifier.
1724  * \param pConnSpec Connection specification.
1725  *
1726  * \return None.
1727  */
1728 /*************************************************************************************************/
1729 void DmRemoteConnParamReqReply(dmConnId_t connId, hciConnSpec_t *pConnSpec);
1730 
1731 /*************************************************************************************************/
1732 /*!
1733  * \brief Negative reply to the HCI remote connection parameter request event. This command
1734  * is used to indicate that the Host has rejected the remote device's request to change
1735  * connection parameters.
1736  *
1737  * \param connId Connection identifier.
1738  * \param reason Reason for rejection.
1739  *
1740  * \return None.
1741  */
1742 /*************************************************************************************************/
1743 void DmRemoteConnParamReqNegReply(dmConnId_t connId, uint8_t reason);
1744 
1745 /*************************************************************************************************/
1746 /*!
1747  * \brief Set data length for a given connection.
1748  *
1749  * \param connId Connection identifier.
1750  * \param txOctets Maximum number of payload octets for a Data PDU.
1751  * \param txTime Maximum number of microseconds for a Data PDU.
1752  *
1753  * \return None.
1754  */
1755 /*************************************************************************************************/
1756 void DmConnSetDataLen(dmConnId_t connId, uint16_t txOctets, uint16_t txTime);
1757 
1758 /*************************************************************************************************/
1759 /*!
1760  * \brief Return the connection role indicating master or slave.
1761  *
1762  * \param connId Connection identifier.
1763  *
1764  * \return Device role.
1765  */
1766 /*************************************************************************************************/
1767 uint8_t DmConnRole(dmConnId_t connId);
1768 
1769 /*************************************************************************************************/
1770 /*!
1771  * \brief Set authenticated payload timeout for a given connection.
1772  *
1773  * \param connId Connection identifier.
1774  * \param timeout Timeout period in units of 10ms.
1775  *
1776  * \return None.
1777  */
1778 /*************************************************************************************************/
1779 void DmWriteAuthPayloadTimeout(dmConnId_t connId, uint16_t timeout);
1780 
1781 /**@}*/
1782 
1783 /** \name DM PHY Control Functions
1784  * Functions for setting PHY preferences.
1785  */
1786 /**@{*/
1787 
1788 /*************************************************************************************************/
1789 /*!
1790  * \brief Set the preferred values for the transmitter PHY and receiver PHY for all subsequent
1791  * connections.
1792  *
1793  * \param allPhys All PHYs preferences.
1794  * \param txPhys Preferred transmitter PHYs.
1795  * \param rxPhys Preferred receiver PHYs.
1796  *
1797  * \return None.
1798  */
1799 /*************************************************************************************************/
1800 void DmSetDefaultPhy(uint8_t allPhys, uint8_t txPhys, uint8_t rxPhys);
1801 
1802 /*************************************************************************************************/
1803 /*!
1804  * \brief Read the current transmitter PHY and receiver PHY for a given connection.
1805  *
1806  * \param connId Connection identifier.
1807  *
1808  * \return None.
1809  */
1810 /*************************************************************************************************/
1811 void DmReadPhy(dmConnId_t connId);
1812 
1813 /*************************************************************************************************/
1814 /*!
1815  * \brief Set the PHY preferences for a given connection.
1816  *
1817  * \param connId Connection identifier.
1818  * \param allPhys All PHYs preferences.
1819  * \param txPhys Preferred transmitter PHYs.
1820  * \param rxPhys Preferred receiver PHYs.
1821  * \param phyOptions PHY options.
1822  *
1823  * \return None.
1824  */
1825 /*************************************************************************************************/
1826 void DmSetPhy(dmConnId_t connId, uint8_t allPhys, uint8_t txPhys, uint8_t rxPhys, uint16_t phyOptions);
1827 
1828 /*************************************************************************************************/
1829 /*!
1830 * \brief Initialize DM PHY.
1831 *
1832 * \return None.
1833 */
1834 /*************************************************************************************************/
1835 void DmPhyInit(void);
1836 
1837 /**@}*/
1838 
1839 
1840 /** \name DM Device Functions
1841  * Device control functions
1842  */
1843 /**@{*/
1844 
1845 /*************************************************************************************************/
1846 /*!
1847  * \brief Reset the device.
1848  *
1849  * \return None.
1850  */
1851 /*************************************************************************************************/
1852 void DmDevReset(void);
1853 
1854 /*************************************************************************************************/
1855 /*!
1856  * \brief Set the random address to be used by the local device.
1857  *
1858  * \param pAddr Random address.
1859  *
1860  * \return None.
1861  */
1862 /*************************************************************************************************/
1863 void DmDevSetRandAddr(uint8_t *pAddr);
1864 
1865 /*************************************************************************************************/
1866 /*!
1867  * \brief Add a peer device to the white list. Note that this function cannot be called
1868  * while advertising, scanning, or connecting with white list filtering active.
1869  *
1870  * \param addrType Address type.
1871  * \param pAddr Peer device address.
1872  *
1873  * \return None.
1874  */
1875 /*************************************************************************************************/
1876 void DmDevWhiteListAdd(uint8_t addrType, uint8_t *pAddr);
1877 
1878 /*************************************************************************************************/
1879 /*!
1880  * \brief Remove a peer device from the white list. Note that this function cannot be called
1881  * while advertising, scanning, or connecting with white list filtering active.
1882  *
1883  * \param addrType Address type.
1884  * \param pAddr Peer device address.
1885  *
1886  * \return None.
1887  */
1888 /*************************************************************************************************/
1889 void DmDevWhiteListRemove(uint8_t addrType, uint8_t *pAddr);
1890 
1891 /*************************************************************************************************/
1892 /*!
1893  * \brief Clear the white list. Note that this function cannot be called while
1894  * advertising, scanning, or connecting with white list filtering active.
1895  *
1896  * \return None.
1897  */
1898 /*************************************************************************************************/
1899 void DmDevWhiteListClear(void);
1900 
1901 /*************************************************************************************************/
1902 /*!
1903  * \brief Set the Advertising, Scanning or Initiator filter policy.
1904  *
1905  * \param mode Policy mode.
1906  * \param policy Filter policy.
1907  *
1908  * \return TRUE if the filter policy was successfully set, FALSE otherwise.
1909  */
1910 /*************************************************************************************************/
1912 
1913 /*************************************************************************************************/
1914 /*!
1915  * \brief Set the Advertising filter policy for the given advertising, Scanning or Initiator
1916  * filter policy.
1917  *
1918  * \param advHandle Advertising handle (only applicable to advertising).
1919  * \param mode Policy mode.
1920  * \param policy Filter policy.
1921  *
1922  * \return TRUE if the filter policy was successfully set, FALSE otherwise.
1923  */
1924 /*************************************************************************************************/
1925 bool_t DmDevSetExtFilterPolicy(uint8_t advHandle, uint8_t mode, uint8_t policy);
1926 
1927 /*************************************************************************************************/
1928 /*!
1929  * \brief Vendor-specific controller initialization function.
1930  *
1931  * \param param Vendor-specific parameter.
1932  *
1933  * \return None.
1934  */
1935 /*************************************************************************************************/
1936 void DmDevVsInit(uint8_t param);
1937 
1938 /**@}*/
1939 
1940 /** \name DM Security Functions
1941  * Functions for accessing and controlling security configuration of device.
1942  */
1943 /**@{*/
1944 
1945 /*************************************************************************************************/
1946 /*!
1947  * \brief Initialize DM security.
1948  *
1949  * \return None.
1950  */
1951 /*************************************************************************************************/
1952 void DmSecInit(void);
1953 
1954 /*************************************************************************************************/
1955 /*!
1956  * \brief Initialize DM LE Secure Connections security.
1957  *
1958  * \return None.
1959  */
1960 /*************************************************************************************************/
1961 void DmSecLescInit(void);
1962 
1963 /*************************************************************************************************/
1964 /*!
1965  * \brief This function is called by a master device to initiate pairing.
1966  *
1967  * \param connId DM connection ID.
1968  * \param oob Out-of-band pairing data present or not present.
1969  * \param auth Authentication and bonding flags.
1970  * \param iKeyDist Initiator key distribution flags.
1971  * \param rKeyDist Responder key distribution flags.
1972  *
1973  * \return None.
1974  */
1975 /*************************************************************************************************/
1976 void DmSecPairReq(dmConnId_t connId, bool_t oob, uint8_t auth, uint8_t iKeyDist, uint8_t rKeyDist);
1977 
1978 /*************************************************************************************************/
1979 /*!
1980  * \brief This function is called by a slave device to proceed with pairing after a
1981  * DM_SEC_PAIR_IND event is received.
1982  *
1983  * \param connId DM connection ID.
1984  * \param oob Out-of-band pairing data present or not present.
1985  * \param auth Authentication and bonding flags.
1986  * \param iKeyDist Initiator key distribution flags.
1987  * \param rKeyDist Responder key distribution flags.
1988  *
1989  * \return None.
1990  */
1991 /*************************************************************************************************/
1992 void DmSecPairRsp(dmConnId_t connId, bool_t oob, uint8_t auth, uint8_t iKeyDist, uint8_t rKeyDist);
1993 
1994 /*************************************************************************************************/
1995 /*!
1996  * \brief This function is called to cancel the pairing process.
1997  *
1998  * \param connId DM connection ID.
1999  * \param reason Failure reason.
2000  *
2001  * \return None.
2002  */
2003 /*************************************************************************************************/
2004 void DmSecCancelReq(dmConnId_t connId, uint8_t reason);
2005 
2006 /*************************************************************************************************/
2007 /*!
2008  * \brief This function is called in response to a DM_SEC_AUTH_REQ_IND event to provide
2009  * PIN or OOB data during pairing.
2010  *
2011  * \param connId DM connection ID.
2012  * \param authDataLen Length of PIN or OOB data.
2013  * \param pAuthData pointer to PIN or OOB data.
2014  *
2015  * \return None.
2016  */
2017 /*************************************************************************************************/
2018 void DmSecAuthRsp(dmConnId_t connId, uint8_t authDataLen, uint8_t *pAuthData);
2019 
2020 /*************************************************************************************************/
2021 /*!
2022  * \brief This function is called by a slave device to request that the master initiates
2023  * pairing or link encryption.
2024  *
2025  * \param connId DM connection ID.
2026  * \param auth Authentication flags.
2027  *
2028  * \return None.
2029  */
2030 /*************************************************************************************************/
2031 void DmSecSlaveReq(dmConnId_t connId, uint8_t auth);
2032 
2033 /*************************************************************************************************/
2034 /*!
2035  * \brief This function is called by a master device to initiate link encryption.
2036  *
2037  * \param connId DM connection ID.
2038  * \param secLevel Security level of pairing when LTK was exchanged.
2039  * \param pLtk Pointer to LTK parameter structure.
2040  *
2041  * \return None.
2042  */
2043 /*************************************************************************************************/
2044 void DmSecEncryptReq(dmConnId_t connId, uint8_t secLevel, dmSecLtk_t *pLtk);
2045 
2046 /*************************************************************************************************/
2047 /*!
2048  * \brief This function is called by a slave in response to a DM_SEC_LTK_REQ_IND event
2049  * to provide the long term key used for encryption.
2050  *
2051  * \param connId DM connection ID.
2052  * \param keyFound TRUE if key found.
2053  * \param secLevel Security level of pairing when key was exchanged.
2054  * \param pKey Pointer to the key, if found.
2055  *
2056  * \return None.
2057  */
2058 /*************************************************************************************************/
2059 void DmSecLtkRsp(dmConnId_t connId, bool_t keyFound, uint8_t secLevel, uint8_t *pKey);
2060 
2061 /*************************************************************************************************/
2062 /*!
2063  * \brief This function sets the local CSRK used by the device.
2064  *
2065  * \param pCsrk Pointer to CSRK.
2066  *
2067  * \return None.
2068  */
2069 /*************************************************************************************************/
2070 void DmSecSetLocalCsrk(uint8_t *pCsrk);
2071 
2072 /*************************************************************************************************/
2073 /*!
2074  * \brief This function sets the local IRK used by the device.
2075  *
2076  * \param pIrk Pointer to IRK.
2077  *
2078  * \return None.
2079  */
2080 /*************************************************************************************************/
2081 void DmSecSetLocalIrk(uint8_t *pIrk);
2082 
2083 /*************************************************************************************************/
2084 /*!
2085  * \brief This function generates an ECC key for use with LESC security.
2086  *
2087  * \return None.
2088  */
2089 /*************************************************************************************************/
2090 void DmSecGenerateEccKeyReq(void);
2091 
2092 /*************************************************************************************************/
2093 /*!
2094  * \brief This function sets the ECC key for use with LESC security.
2095  *
2096  * \param pKey Pointer to key.
2097  *
2098  * \return None.
2099  */
2100 /*************************************************************************************************/
2101 void DmSecSetEccKey(secEccKey_t *pKey);
2102 
2103 /*************************************************************************************************/
2104 /*!
2105  * \brief This function gets the local ECC key for use with LESC security.
2106  *
2107  * \return Pointer to local ECC key.
2108  */
2109 /*************************************************************************************************/
2111 
2112 /*************************************************************************************************/
2113 /*!
2114  * \brief This function sets the ECC key for use with LESC security to standard debug keys values.
2115  *
2116  * \return None.
2117  */
2118 /*************************************************************************************************/
2119 void DmSecSetDebugEccKey(void);
2120 
2121 /*************************************************************************************************/
2122 /*!
2123  * \brief This function configures the DM to use OOB pairing for the given connection.
2124  * The pRand and pConfirm contain the Random and Confirm values exchanged via
2125  * out of band methods.
2126  *
2127  * \param connId ID of the connection.
2128  * \param pConfig Pointer to OOB configuration.
2129  *
2130  * \return Pointer to IRK.
2131  */
2132 /*************************************************************************************************/
2133 void DmSecSetOob(dmConnId_t connId, dmSecLescOobCfg_t *pConfig);
2134 
2135 /*************************************************************************************************/
2136 /*!
2137  * \brief This function calculates the local random and confirm values used in LESC OOB pairing.
2138  * The operation's result is posted as a DM_SEC_CALC_OOB_IND event to the application's DM
2139  * callback handler. The local rand and confirm values are exchanged with the peer via
2140  * out-of-band (OOB) methods and passed into the DmSecSetOob after DM_CONN_OPEN_IND.
2141  *
2142  * \param pRand Random value used in calculation.
2143  * \param pPubKeyX X component of the local public key.
2144  *
2145  * \return None.
2146  */
2147 /*************************************************************************************************/
2148 void DmSecCalcOobReq(uint8_t *pRand, uint8_t *pPubKeyX);
2149 
2150 /*************************************************************************************************/
2151 /*!
2152  * \brief This function is called by the application in response to a DM_SEC_COMPARE_IND event.
2153  * The valid parameter indicates if the compare value of the DM_SEC_COMPARE_IND was valid.
2154  *
2155  * \param connId ID of the connection.
2156  * \param valid TRUE if compare value was valid
2157  *
2158  * \return None.
2159  */
2160 /*************************************************************************************************/
2161 void DmSecCompareRsp(dmConnId_t connId, bool_t valid);
2162 
2163 /*************************************************************************************************/
2164 /*!
2165  * \brief This function returns the 6-digit compare value for the specified 128-bit confirm value.
2166  *
2167  * \param pConfirm Pointer to 128-bit comfirm value.
2168  *
2169  * \return Six-digit compare value.
2170  */
2171 /*************************************************************************************************/
2173 
2174 /**@}*/
2175 
2176 /** \name DM Internal Functions
2177  * Functions called internally by the stack.
2178  */
2179 /**@{*/
2180 
2181 /*************************************************************************************************/
2182 /*!
2183  * \brief Map an address type to a type used by LL.
2184  *
2185  * \param addrType Address type used by Host.
2186  *
2187  * \return Address type used by LL.
2188  */
2189 /*************************************************************************************************/
2190 uint8_t DmLlAddrType(uint8_t addrType);
2191 
2192 /*************************************************************************************************/
2193 /*!
2194  * \brief Map an address type to a type used by Host.
2195  *
2196  * \param addrType Address type used by LL.
2197  *
2198  * \return Address type used by Host.
2199  */
2200 /*************************************************************************************************/
2201 uint8_t DmHostAddrType(uint8_t addrType);
2202 
2203 /*************************************************************************************************/
2204 /*!
2205  * \brief Return size of a DM callback event.
2206  *
2207  * \param pDmEvt DM callback event.
2208  *
2209  * \return Size of DM callback event.
2210  */
2211 /*************************************************************************************************/
2212 uint16_t DmSizeOfEvt(dmEvt_t *pDmEvt);
2213 
2214 /*************************************************************************************************/
2215 /*!
2216  * \brief For internal use only. L2C calls this function to send the result of an L2CAP
2217  * connection update response to DM.
2218  *
2219  * \param handle Connection handle.
2220  * \param reason Connection update response reason code.
2221  * \return None.
2222  */
2223 /*************************************************************************************************/
2224 void DmL2cConnUpdateCnf(uint16_t handle, uint16_t reason);
2225 
2226 /*************************************************************************************************/
2227 /*!
2228  * \brief For internal use only. L2C calls this function when it receives a connection update
2229  * request from a peer device.
2230  *
2231  * \param identifier Identifier value.
2232  * \param handle Connection handle.
2233  * \param pConnSpec Connection spec parameters.
2234  * \return None.
2235  */
2236 /*************************************************************************************************/
2237 void DmL2cConnUpdateInd(uint8_t identifier, uint16_t handle, hciConnSpec_t *pConnSpec);
2238 
2239 /*************************************************************************************************/
2240 /*!
2241  * \brief For internal use only. Find the connection ID with matching handle.
2242  *
2243  * \param handle Handle to find.
2244  *
2245  * \return Connection ID or DM_CONN_ID_NONE if error.
2246  */
2247 /*************************************************************************************************/
2248 dmConnId_t DmConnIdByHandle(uint16_t handle);
2249 
2250 /*************************************************************************************************/
2251 /*!
2252  * \brief For internal use only. Return TRUE if the connection is in use.
2253  *
2254  * \param connId Connection ID.
2255  *
2256  * \return TRUE if the connection is in use, FALSE otherwise.
2257  */
2258 /*************************************************************************************************/
2259 bool_t DmConnInUse(dmConnId_t connId);
2260 
2261 /*************************************************************************************************/
2262 /*!
2263  * \brief For internal use only. Return the peer address type.
2264  *
2265  * \param connId Connection ID.
2266  *
2267  * \return Peer address type.
2268  */
2269 /*************************************************************************************************/
2270 uint8_t DmConnPeerAddrType(dmConnId_t connId);
2271 
2272 /*************************************************************************************************/
2273 /*!
2274  * \brief For internal use only. Return the peer device address.
2275  *
2276  * \param connId Connection ID.
2277  *
2278  * \return Pointer to peer device address.
2279  */
2280 /*************************************************************************************************/
2281 uint8_t *DmConnPeerAddr(dmConnId_t connId);
2282 
2283 /*************************************************************************************************/
2284 /*!
2285  * \brief For internal use only. Return the local address type.
2286  *
2287  * \param connId Connection ID.
2288  *
2289  * \return Local address type.
2290  */
2291 /*************************************************************************************************/
2292 uint8_t DmConnLocalAddrType(dmConnId_t connId);
2293 
2294 /*************************************************************************************************/
2295 /*!
2296  * \brief For internal use only. Return the local address.
2297  *
2298  * \param connId Connection ID.
2299  *
2300  * \return Pointer to local address.
2301  */
2302 /*************************************************************************************************/
2303 uint8_t *DmConnLocalAddr(dmConnId_t connId);
2304 
2305 /*************************************************************************************************/
2306 /*!
2307 * \brief For internal use only. Return the peer resolvable private address (RPA).
2308 *
2309 * \param connId Connection ID.
2310 *
2311 * \return Pointer to peer RPA.
2312 */
2313 /*************************************************************************************************/
2314 uint8_t *DmConnPeerRpa(dmConnId_t connId);
2315 
2316 /*************************************************************************************************/
2317 /*!
2318 * \brief For internal use only. Return the local resolvable private address (RPA).
2319 *
2320 * \param connId Connection ID.
2321 *
2322 * \return Pointer to local RPA.
2323 */
2324 /*************************************************************************************************/
2325 uint8_t *DmConnLocalRpa(dmConnId_t connId);
2326 
2327 /*************************************************************************************************/
2328 /*!
2329  * \brief For internal use only. Return the security level of the connection.
2330  *
2331  * \param connId Connection ID.
2332  *
2333  * \return Security level of the connection.
2334  */
2335 /*************************************************************************************************/
2336 uint8_t DmConnSecLevel(dmConnId_t connId);
2337 
2338 /*************************************************************************************************/
2339 /*!
2340  * \brief For internal use only. This function is called by SMP to request encryption.
2341  *
2342  * \param connId DM connection ID.
2343  * \param secLevel Security level of pairing when key was exchanged.
2344  * \param pKey Pointer to key.
2345  *
2346  * \return None.
2347  */
2348 /*************************************************************************************************/
2349 void DmSmpEncryptReq(dmConnId_t connId, uint8_t secLevel, uint8_t *pKey);
2350 
2351 /*************************************************************************************************/
2352 /*!
2353  * \brief For internal use only. Execute DM callback from SMP procedures.
2354  *
2355  * \param pDmEvt Pointer to callback event data.
2356  *
2357  * \return None.
2358  */
2359 /*************************************************************************************************/
2360 void DmSmpCbackExec(dmEvt_t *pDmEvt);
2361 
2362 /*************************************************************************************************/
2363 /*!
2364  * \brief For internal use only. This function gets the local CSRK used by the device.
2365  *
2366  * \return Pointer to CSRK.
2367  */
2368 /*************************************************************************************************/
2369 uint8_t *DmSecGetLocalCsrk(void);
2370 
2371 /*************************************************************************************************/
2372 /*!
2373  * \brief For internal use only. This function gets the local IRK used by the device.
2374  *
2375  * \return Pointer to IRK.
2376  */
2377 /*************************************************************************************************/
2378 uint8_t *DmSecGetLocalIrk(void);
2379 
2380 /*************************************************************************************************/
2381 /*!
2382  * \brief For internal use only. Read the features of the remote device.
2383  *
2384  * \param connId Connection identifier.
2385  *
2386  * \return None.
2387  */
2388 /*************************************************************************************************/
2389 void DmReadRemoteFeatures(dmConnId_t connId);
2390 
2391 /**@}*/
2392 
2393 /*! \} */ /* STACK_DM_API */
2394 
2395 #ifdef __cplusplus
2396 };
2397 #endif
2398 
2399 #endif /* DM_API_H */
uint8_t * DmSecGetLocalCsrk(void)
For internal use only. This function gets the local CSRK used by the device.
void DmScanStop(void)
Stop scanning.
void DmRemoveDeviceFromPerAdvList(uint8_t advAddrType, uint8_t *pAdvAddr, uint8_t advSid)
DM remove device from periodic advertiser list.
void DmPerAdvConfig(uint8_t advHandle)
Set the advertising parameters for periodic advertising.
Remote features from peer device.
Definition: dm_api.h:485
bool_t DmDevSetFilterPolicy(uint8_t mode, uint8_t policy)
Set the Advertising, Scanning or Initiator filter policy.
LE read local resolving address command complete event.
Definition: hci_api.h:488
Extended scan data received from peer device.
Definition: dm_api.h:479
Data type for DM_SEC_PAIR_IND.
Definition: dm_api.h:565
uint8_t * DmConnPeerRpa(dmConnId_t connId)
For internal use only. Return the peer resolvable private address (RPA).
bool_t DmAdvModeExt(void)
Whether DM advertising is in extended mode.
bool_t DmAdvSetName(uint8_t len, uint8_t *pValue, uint16_t *pAdvDataLen, uint8_t *pAdvData, uint16_t advDataBufLen)
Set the device name in the given advertising or scan response data. If the name can only fit in the d...
Set default PHY.
Definition: dm_api.h:472
void DmConnUpdate(dmConnId_t connId, hciConnSpec_t *pConnSpec)
Update the connection parameters of an open connection.
Configuration structure.
Definition: dm_api.h:507
uint8_t dmConnId_t
Connection identifier.
Definition: dm_api.h:501
uint8_t secLevel
Security level of pairing when key was exchanged.
Definition: dm_api.h:587
dmConnId_t DmConnOpen(uint8_t clientId, uint8_t initPhys, uint8_t addrType, uint8_t *pAddr)
Open a connection to a peer device with the given address.
void DmExtConnMasterInit(void)
Initialize DM connection manager for operation as extended master.
void DmAdvIncTxPwr(uint8_t advHandle, bool_t incTxPwr, int8_t advTxPwr)
Set whether or not to include TxPower in extended header of advertising PDU.
hciReadRssiCmdCmplEvt_t readRssi
handles DM_CONN_READ_RSSI_IND
Definition: dm_api.h:685
wsfMsgHdr_t hdr
Common header.
Definition: dm_api.h:660
Advertising started.
Definition: dm_api.h:437
wsfMsgHdr_t hdr
Header.
Definition: dm_api.h:594
uint8_t * DmConnLocalAddr(dmConnId_t connId)
For internal use only. Return the local address.
void DmDevReset(void)
Reset the device.
ECC Security callback parameters structure.
Definition: sec_api.h:79
void DmSecCalcOobReq(uint8_t *pRand, uint8_t *pPubKeyX)
This function calculates the local random and confirm values used in LESC OOB pairing. The operation&#39;s result is posted as a DM_SEC_CALC_OOB_IND event to the application&#39;s DM callback handler. The local rand and confirm values are exchanged with the peer via out-of-band (OOB) methods and passed into the DmSecSetOob after DM_CONN_OPEN_IND.
Connection RSSI read.
Definition: dm_api.h:460
bool_t DmConnInUse(dmConnId_t connId)
For internal use only. Return TRUE if the connection is in use.
HCI subsystem API.
Advertising set(s) started.
Definition: dm_api.h:474
void DmPrivClearResList(void)
Clear resolving list. When complete the client&#39;s callback function is called with a DM_PRIV_CLEAR_RES...
void DmConnSetDataLen(dmConnId_t connId, uint16_t txOctets, uint16_t txTime)
Set data length for a given connection.
wsfMsgHdr_t hdr
Header.
Definition: dm_api.h:559
void DmAdvSetFragPref(uint8_t advHandle, uint8_t fragPref)
Set fragment preference for advertising data.
LE connection complete event.
Definition: hci_api.h:109
void DmSecSetEccKey(secEccKey_t *pKey)
This function sets the ECC key for use with LESC security.
Write authenticated payload to command complete event.
Definition: hci_api.h:524
void DmDevVsInit(uint8_t param)
Vendor-specific controller initialization function.
void DmScanStart(uint8_t scanPhys, uint8_t mode, const uint8_t *pScanType, bool_t filterDup, uint16_t duration, uint16_t period)
Start scanning on the given PHYs.
LE PHY update complete event.
Definition: hci_api.h:556
dmSyncId_t DmSyncStart(uint8_t advSid, uint8_t advAddrType, const uint8_t *pAdvAddr, uint16_t skip, uint16_t syncTimeout)
Synchronize with periodic advertising from the given advertiser, and start receiving periodic adverti...
void DmDevPrivInit(void)
Initialize device privacy module.
Data type for DM_SEC_COMPARE_IND.
Definition: dm_api.h:592
Pairing failed or other security failure.
Definition: dm_api.h:447
#define SMP_RAND8_LEN
Random 8-byte number length.
Definition: smp_defs.h:179
hciAuthPayloadToExpiredEvt_t authToExpired
handles DM_CONN_AUTH_TO_EXPIRED_IND
Definition: dm_api.h:695
Scan data received from peer device.
Definition: dm_api.h:442
Peer resolving address read.
Definition: dm_api.h:464
hciLeAddDevToResListCmdCmplEvt_t addDevToResList
handles DM_PRIV_ADD_DEV_TO_RES_LIST_IND
Definition: dm_api.h:686
void DmSecSlaveReq(dmConnId_t connId, uint8_t auth)
This function is called by a slave device to request that the master initiates pairing or link encryp...
wsfMsgHdr_t hdr
Header.
Definition: dm_api.h:639
bool_t DmScanModeExt(void)
Whether DM scanning is in extended mode.
Local resolving address read.
Definition: dm_api.h:465
uint8_t * DmFindAdType(uint8_t adType, uint16_t dataLen, uint8_t *pData)
Find an advertising data element in the given advertising or scan response data.
Write authenticated payload complete.
Definition: dm_api.h:469
void DmAdvRemoveAdvSet(uint8_t advHandle)
Remove an advertising set.
wsfMsgHdr_t hdr
Header.
Definition: dm_api.h:632
void DmSecCompareRsp(dmConnId_t connId, bool_t valid)
This function is called by the application in response to a DM_SEC_COMPARE_IND event. The valid parameter indicates if the compare value of the DM_SEC_COMPARE_IND was valid.
dmAdvSetStartEvt_t advSetStart
handles DM_ADV_SET_START_IND
Definition: dm_api.h:699
void DmSyncStop(dmSyncId_t syncId)
Stop reception of the periodic advertising identified by the given sync identifier.
uint8_t auth
Authentication and bonding flags.
Definition: dm_api.h:578
hciReadRemoteVerInfoCmplEvt_t readRemVerInfo
handles DM_READ_REMOTE_VER_INFO_IND
Definition: dm_api.h:712
uint8_t bool_t
Boolean data type.
Definition: wsf_types.h:78
void DmRegister(dmCback_t cback)
Register a callback with DM for scan and advertising events.
void DmSecAuthRsp(dmConnId_t connId, uint8_t authDataLen, uint8_t *pAuthData)
This function is called in response to a DM_SEC_AUTH_REQ_IND event to provide PIN or OOB data during ...
void DmPrivAddDevToResList(uint8_t addrType, const uint8_t *pIdentityAddr, uint8_t *pPeerIrk, uint8_t *pLocalIrk, bool_t enableLlPriv, uint16_t param)
Add device to resolving list. When complete the client&#39;s callback function is called with a DM_PRIV_A...
void DmAdvUseLegacyPdu(uint8_t advHandle, bool_t useLegacyPdu)
Set whether or not to use legacy advertising PDUs with extended advertising.
hciLeConnCmplEvt_t connOpen
handles DM_CONN_OPEN_IND
Definition: dm_api.h:668
Data type for DM_SEC_SLAVE_REQ_IND.
Definition: dm_api.h:575
void DmSecPairRsp(dmConnId_t connId, bool_t oob, uint8_t auth, uint8_t iKeyDist, uint8_t rKeyDist)
This function is called by a slave device to proceed with pairing after a DM_SEC_PAIR_IND event is re...
Data type for DmSecSetOob().
Definition: dm_api.h:719
Hardware error event.
Definition: hci_api.h:368
LE add device to resolving list command complete event.
Definition: hci_api.h:503
dmSecKeypressIndEvt_t keypressInd
handles DM_SEC_KEYPRESS_IND
Definition: dm_api.h:683
uint8_t addrType
Address Type.
Definition: dm_api.h:525
uint16_t DmSizeOfEvt(dmEvt_t *pDmEvt)
Return size of a DM callback event.
wsfMsgHdr_t hdr
Header.
Definition: dm_api.h:545
void DmAdvSetInterval(uint8_t advHandle, uint16_t intervalMin, uint16_t intervalMax)
Set the minimum and maximum advertising intervals.
void DmConnMasterInit(void)
Initialize DM connection manager for operation as legacy master.
Result of ECC Key Generation.
Definition: dm_api.h:456
uint8_t * DmSecGetLocalIrk(void)
For internal use only. This function gets the local IRK used by the device.
hciLeAdvReportEvt_t scanReport
handles DM_SCAN_REPORT_IND
Definition: dm_api.h:667
hciLeRemDevFromResListCmdCmplEvt_t remDevFromResList
handles DM_PRIV_REM_DEV_FROM_RES_LIST_IND
Definition: dm_api.h:687
dmSecPairIndEvt_t pairInd
handles DM_SEC_PAIR_IND
Definition: dm_api.h:678
void DmSecPairReq(dmConnId_t connId, bool_t oob, uint8_t auth, uint8_t iKeyDist, uint8_t rKeyDist)
This function is called by a master device to initiate pairing.
dmConnId_t DmConnIdByHandle(uint16_t handle)
For internal use only. Find the connection ID with matching handle.
dmAdvNewAddrIndEvt_t advNewAddr
handles DM_ADV_NEW_ADDR_IND
Definition: dm_api.h:664
uint8_t * DmConnLocalRpa(dmConnId_t connId)
For internal use only. Return the local resolvable private address (RPA).
dmSecEncryptIndEvt_t encryptInd
handles DM_SEC_ENCRYPT_IND
Definition: dm_api.h:673
void DmPrivSetAddrResEnable(bool_t enable)
Enable or disable address resolution in LL. When complete the client&#39;s callback function is called wi...
Scanning stopped.
Definition: dm_api.h:441
secEccMsg_t eccMsg
handles DM_SEC_ECC_KEY_IND
Definition: dm_api.h:681
Extended scanning started.
Definition: dm_api.h:477
void DmPrivSetResolvablePrivateAddrTimeout(uint16_t rpaTimeout)
Set resolvable private address timeout command.
Data structure for DM_ADV_SET_START_IND.
Definition: dm_api.h:622
void DmConnSetConnSpec(hciConnSpec_t *pConnSpec)
Set the connection spec parameters for connections to be created with DmConnOpen().
void DmL2cConnUpdateInd(uint8_t identifier, uint16_t handle, hciConnSpec_t *pConnSpec)
For internal use only. L2C calls this function when it receives a connection update request from a pe...
void DmAdvConfig(uint8_t advHandle, uint8_t advType, uint8_t peerAddrType, uint8_t *pPeerAddr)
Set the advertising parameters using the given advertising type, and peer address.
LE remote connetion parameter request event.
Definition: hci_api.h:442
#define SMP_KEY_LEN
Key length.
Definition: smp_defs.h:178
void DmSecLtkRsp(dmConnId_t connId, bool_t keyFound, uint8_t secLevel, uint8_t *pKey)
This function is called by a slave in response to a DM_SEC_LTK_REQ_IND event to provide the long term...
uint16_t ediv
EDIV.
Definition: dm_api.h:517
void DmPrivResolveAddr(uint8_t *pAddr, uint8_t *pIrk, uint16_t param)
Resolve a private resolvable address. When complete the client&#39;s callback function is called with a D...
uint32_t DmSecGetCompareValue(uint8_t *pConfirm)
This function returns the 6-digit compare value for the specified 128-bit confirm value...
void DmRemoteConnParamReqReply(dmConnId_t connId, hciConnSpec_t *pConnSpec)
Reply to the HCI remote connection parameter request event. This command is used to indicate that the...
wsfMsgHdr_t hdr
Header.
Definition: dm_api.h:601
hciVendorSpecEvt_t vendorSpec
handles DM_VENDOR_SPEC_IND
Definition: dm_api.h:715
Data type for DM_SEC_KEY_IND.
Definition: dm_api.h:582
void DmScanInit(void)
Initialize DM legacy scanning.
void DmL2cConnUpdateCnf(uint16_t handle, uint16_t reason)
For internal use only. L2C calls this function to send the result of an L2CAP connection update respo...
hciLeExtAdvReportEvt_t extScanReport
handles DM_EXT_SCAN_REPORT_IND
Definition: dm_api.h:704
void DmSecGenerateEccKeyReq(void)
This function generates an ECC key for use with LESC security.
Pairing completed successfully.
Definition: dm_api.h:446
PIN or OOB data requested for pairing.
Definition: dm_api.h:450
hciLeReadRemoteFeatCmplEvt_t readRemoteFeat
handles DM_REMOTE_FEATURES_IND
Definition: dm_api.h:710
hciLeConnUpdateCmplEvt_t connUpdate
handles DM_CONN_UPDATE_IND
Definition: dm_api.h:670
dmSecCnfIndEvt_t cnfInd
handles DM_SEC_COMPARE_IND
Definition: dm_api.h:682
Device removed from resolving list.
Definition: dm_api.h:462
wsfMsgHdr_t hdr
Header.
Definition: dm_api.h:577
hciLeScanReqRcvdEvt_t scanReqRcvd
handles DM_SCAN_REQ_RCVD_IND
Definition: dm_api.h:701
void DmSecEncryptReq(dmConnId_t connId, uint8_t secLevel, dmSecLtk_t *pLtk)
This function is called by a master device to initiate link encryption.
void DmSmpEncryptReq(dmConnId_t connId, uint8_t secLevel, uint8_t *pKey)
For internal use only. This function is called by SMP to request encryption.
Security key indication.
Definition: dm_api.h:451
bool_t DmAdvModeLeg(void)
Whether DM advertising is in legacy mode.
LE extended advertising report.
Definition: hci_api.h:171
dmConnId_t DmConnAccept(uint8_t clientId, uint8_t advHandle, uint8_t advType, uint16_t duration, uint8_t maxEaEvents, uint8_t addrType, uint8_t *pAddr)
Accept a connection from the given peer device by initiating directed advertising.
void DmExtConnSetScanInterval(uint8_t initPhys, uint16_t *pScanInterval, uint16_t *pScanWindow)
Set the scan interval and window for extended connections to be created with DmConnOpen().
bool_t DmLlPrivEnabled(void)
Whether LL Privacy is enabled.
#define SMP_CONFIRM_LEN
Confirm number length.
Definition: smp_defs.h:177
void DmAdvSetAddrType(uint8_t addrType)
Set the local address type used while advertising. This function can be used to configure advertising...
void DmAdvStart(uint8_t numSets, uint8_t *pAdvHandles, uint16_t *pDuration, uint8_t *pMaxEaEvents)
Start advertising using the given advertising set and duration.
LE set default PHY command complete event.
Definition: hci_api.h:549
void DmPerAdvSetInterval(uint8_t advHandle, uint16_t intervalMin, uint16_t intervalMax)
Set the minimum and maximum advertising intervals for periodic advertising.
void DmWriteAuthPayloadTimeout(dmConnId_t connId, uint16_t timeout)
Set authenticated payload timeout for a given connection.
void DmPerAdvSetData(uint8_t advHandle, uint8_t op, uint8_t len, uint8_t *pData)
Set the advertising data to the given data for periodic advertising.
void DmSecSetOob(dmConnId_t connId, dmSecLescOobCfg_t *pConfig)
This function configures the DM to use OOB pairing for the given connection. The pRand and pConfirm c...
Result of Just Works/Numeric Comparison Compare Value Calculation.
Definition: dm_api.h:457
void DmDevPrivStop(void)
Stop using a private resolvable address.
bool_t firstTime
TRUE when address is generated for the first time.
Definition: dm_api.h:618
void DmSecSetLocalCsrk(uint8_t *pCsrk)
This function sets the local CSRK used by the device.
uint8_t auth
Authentication and bonding flags.
Definition: dm_api.h:546
void DmConnSlaveInit(void)
Initialize DM connection manager for operation as legacy slave.
Connection closed.
Definition: dm_api.h:444
void DmAdvInit(void)
Initialize DM legacy advertising.
void DmConnRegister(uint8_t clientId, dmCback_t cback)
Register with the DM connection manager.
hciLeRemConnParamReqEvt_t remConnParamReq
handles DM_REM_CONN_PARAM_REQ_IND
Definition: dm_api.h:692
Periodic advertising sync lost.
Definition: dm_api.h:483
Data type for DM_SEC_KEYPRESS_IND.
Definition: dm_api.h:599
void DmScanSetInterval(uint8_t scanPhys, uint16_t *pScanInterval, uint16_t *pScanWindow)
Set the scan interval and window for the specified PHYs.
uint8_t dmSyncId_t
Synchronization identifier.
Definition: dm_api.h:504
Read PHY.
Definition: dm_api.h:471
dmSecCsrk_t csrk
CSRK.
Definition: dm_api.h:539
uint8_t notificationType
Type of keypress notification.
Definition: dm_api.h:602
LE periodic advertising report.
Definition: hci_api.h:229
dmSecPairCmplIndEvt_t pairCmpl
handles DM_SEC_PAIR_CMPL_IND
Definition: dm_api.h:671
hciReadLocalVerInfo_t readLocVerInfo
handles DM_READ_LOCAL_VER_INFO_IND
Definition: dm_api.h:711
void DmSetDefaultPhy(uint8_t allPhys, uint8_t txPhys, uint8_t rxPhys)
Set the preferred values for the transmitter PHY and receiver PHY for all subsequent connections...
Read RSSI command complete event.
Definition: hci_api.h:257
void DmExtAdvInit(void)
Initialize DM extended advertising.
uint8_t encKeyLen
Length of encryption key used when data was transferred.
Definition: dm_api.h:588
Union of DM callback event data types.
Definition: dm_api.h:658
hciDisconnectCmplEvt_t connClose
handles DM_CONN_CLOSE_IND
Definition: dm_api.h:669
Data type for DM_SEC_PAIR_CMPL_IND.
Definition: dm_api.h:543
Data type for DM_SEC_CALC_OOB_IND.
Definition: dm_api.h:606
void DmAdvSetChannelMap(uint8_t advHandle, uint8_t channelMap)
Include or exclude certain channels from the advertising channel map.
void DmAdvSetData(uint8_t advHandle, uint8_t op, uint8_t location, uint8_t len, uint8_t *pData)
Set the advertising or scan response data to the given data.
Authenticated payload to expire event.
Definition: hci_api.h:532
ECC Security public/private key pair.
Definition: sec_api.h:64
uint8_t DmConnSecLevel(dmConnId_t connId)
For internal use only. Return the security level of the connection.
hciLePerAdvSyncEstEvt_t perAdvSyncEst
handles DM_PER_ADV_SYNC_EST_IND
Definition: dm_api.h:707
dmSecOobCalcIndEvt_t oobCalcInd
handles DM_SEC_CALC_OOB_IND
Definition: dm_api.h:680
void DmReadRemoteFeatures(dmConnId_t connId)
For internal use only. Read the features of the remote device.
dmSecKey_t keyData
Key data.
Definition: dm_api.h:585
void DmDevWhiteListRemove(uint8_t addrType, uint8_t *pAddr)
Remove a peer device from the white list. Note that this function cannot be called while advertising...
uint8_t advHandle
Advertising handle.
Definition: dm_api.h:633
hciWriteAuthPayloadToCmdCmplEvt_t writeAuthTo
handles DM_CONN_WRITE_AUTH_TO_IND
Definition: dm_api.h:694
void DmSecSetDebugEccKey(void)
This function sets the ECC key for use with LESC security to standard debug keys values.
New resolvable address has been generated.
Definition: dm_api.h:439
Read remote version information complete event.
Definition: hci_api.h:284
bdAddr_t addr
New resolvable private address.
Definition: dm_api.h:617
void DmPrivSetPrivacyMode(uint8_t addrType, const uint8_t *pIdentityAddr, uint8_t mode)
Set privacy mode for a given entry in the resolving list.
void DmPerAdvStop(uint8_t advHandle)
Stop periodic advertising for the advertising set specified by the advertising handle.
IRK data type.
Definition: dm_api.h:521
Connection specification type.
Definition: hci_api.h:641
void DmSecInit(void)
Initialize DM security.
LE connection update complete event.
Definition: hci_api.h:137
void DmConnClose(uint8_t clientId, dmConnId_t connId, uint8_t reason)
Close the connection with the give connection identifier.
unsigned long uint32_t
Unsigned 32-bit value.
Definition: wsf_types.h:71
uint16_t DmConnCheckIdle(dmConnId_t connId)
Check if a connection is idle.
bool_t DmDevSetExtFilterPolicy(uint8_t advHandle, uint8_t mode, uint8_t policy)
Set the Advertising filter policy for the given advertising, Scanning or Initiator filter policy...
hciLeReadLocalResAddrCmdCmplEvt_t readLocalResAddr
handles DM_PRIV_READ_LOCAL_RES_ADDR_IND
Definition: dm_api.h:690
#define DM_NUM_ADV_SETS
Number of supported advertising sets: must be set to 1 for legacy advertising.
Definition: cfg_stack.h:84
uint8_t * DmConnPeerAddr(dmConnId_t connId)
For internal use only. Return the peer device address.
Keypress indication from peer in passkey security.
Definition: dm_api.h:458
#define SMP_RAND_LEN
Random number length.
Definition: smp_defs.h:176
Periodic advertising set stopped.
Definition: dm_api.h:481
void DmConnSetScanInterval(uint16_t scanInterval, uint16_t scanWindow)
Set the scan interval and window for connections to be created with DmConnOpen(). ...
void DmReadPhy(dmConnId_t connId)
Read the current transmitter PHY and receiver PHY for a given connection.
void DmPrivReadLocalResolvableAddr(uint8_t addrType, const uint8_t *pIdentityAddr)
Read local resolvable address command. When complete the client&#39;s callback function is called with a ...
void DmDevPrivStart(uint16_t changeInterval)
Start using a private resolvable address.
wsfMsgHdr_t hdr
Header.
Definition: dm_api.h:567
Periodic advertising sync established.
Definition: dm_api.h:482
LE clear resolving list command complete event.
Definition: hci_api.h:517
LE data length change event.
Definition: hci_api.h:453
LTK requested for encyption.
Definition: dm_api.h:452
wsfMsgHdr_t hdr
Header.
Definition: dm_api.h:624
hciLeAdvSetTermEvt_t advSetStop
handles DM_ADV_SET_STOP_IND
Definition: dm_api.h:700
hciLeLtkReqEvt_t ltkReqInd
handles DM_SEC_LTK_REQ_IND
Definition: dm_api.h:677
uint8_t auth
Authentication and bonding flags.
Definition: dm_api.h:568
uint8_t DmLlAddrType(uint8_t addrType)
Map an address type to a type used by LL.
void(* dmCback_t)(dmEvt_t *pDmEvt)
Callback type.
Definition: dm_api.h:728
LE LTK request event.
Definition: hci_api.h:337
hciLeSetDefPhyCmdCmplEvt_t setDefPhy
handles DM_PHY_SET_DEF_IND
Definition: dm_api.h:697
Security manager constants and definitions from the Bluetooth specification.
void DmAdvOmitAdvAddr(uint8_t advHandle, bool_t omitAdvAddr)
Set whether or not to omit advertiser&#39;s address from all PDUs (anonymous advertising).
Data length changed.
Definition: dm_api.h:468
dmPerAdvSetStopEvt_t perAdvSetStop
handles DM_PER_ADV_SET_STOP_IND
Definition: dm_api.h:706
uint8_t iKeyDist
Initiator key distribution flags.
Definition: dm_api.h:570
dmSecSlaveIndEvt_t slaveInd
handles DM_SEC_SLAVE_REQ_IND
Definition: dm_api.h:679
bool_t DmScanModeLeg(void)
Whether DM scanning is in legacy mode.
bool_t DmAdvSetAdValue(uint8_t adType, uint8_t len, uint8_t *pValue, uint16_t *pAdvDataLen, uint8_t *pAdvData, uint16_t advDataBufLen)
Set the value of an advertising data element in the given advertising or scan response data...
bool_t oob
Out-of-band data requested.
Definition: dm_api.h:560
uint8_t bdAddr_t[BDA_ADDR_LEN]
BD address data type.
Definition: bda.h:62
hciLePerAdvReportEvt_t perAdvReport
handles DM_PER_ADV_REPORT_IND
Definition: dm_api.h:709
Vendor specific event.
Definition: dm_api.h:490
void DmDevSetRandAddr(uint8_t *pAddr)
Set the random address to be used by the local device.
LE read PHY command complete event.
Definition: hci_api.h:539
wsfMsgHdr_t hdr
Header.
Definition: dm_api.h:552
void DmAdvSetRandAddr(uint8_t advHandle, const uint8_t *pAddr)
Set the random device address for a given advertising set.
Data structure for DM_PER_ADV_SET_START_IND.
Definition: dm_api.h:630
General error.
Definition: dm_api.h:488
void DmConnSetAddrType(uint8_t addrType)
Set the local address type used for connections created with DmConnOpen().
dmSecKeyIndEvt_t keyInd
handles DM_SEC_KEY_IND
Definition: dm_api.h:676
void DmPerAdvIncTxPwr(uint8_t advHandle, bool_t incTxPwr)
Set whether or not to include TxPower in extended header of advertising PDU for periodic advertising...
Data structure for DM_PER_ADV_SET_STOP_IND.
Definition: dm_api.h:637
Reset complete.
Definition: dm_api.h:436
dmSecAuthReqIndEvt_t authReq
handles DM_SEC_AUTH_REQ_IND
Definition: dm_api.h:675
uint8_t type
Key type.
Definition: dm_api.h:586
LE set address resolving enable command complete event.
Definition: hci_api.h:496
Device added to resolving list.
Definition: dm_api.h:461
uint8_t numSets
Number of advertising sets.
Definition: dm_api.h:625
Extended scanning stopped.
Definition: dm_api.h:478
bool_t oob
Out-of-band pairing data present or not present.
Definition: dm_api.h:569
LE read peer resolving address command complete event.
Definition: hci_api.h:480
Scanning started.
Definition: dm_api.h:440
void DmAdvClearAdvSets(void)
Clear advertising sets.
void DmScanSetAddrType(uint8_t addrType)
Set the local address type used while scanning. This function can be used to configure scanning to us...
dmSecLtk_t ltk
LTK.
Definition: dm_api.h:537
Scan request received.
Definition: dm_api.h:476
Result of OOB Confirm Calculation Generation.
Definition: dm_api.h:455
void DmSetPhy(dmConnId_t connId, uint8_t allPhys, uint8_t txPhys, uint8_t rxPhys, uint16_t phyOptions)
Set the PHY preferences for a given connection.
Read local version information complete event.
Definition: hci_api.h:566
void DmClearPerAdvList(void)
DM clear periodic advertiser list.
void DmPrivInit(void)
Initialize DM privacy module.
uint8_t DmConnRole(dmConnId_t connId)
Return the connection role indicating master or slave.
void DmAdvScanReqNotifEnable(uint8_t advHandle, bool_t scanReqNotifEna)
Set scan request notification enable.
Connection opened.
Definition: dm_api.h:443
Hardware error.
Definition: dm_api.h:489
LTK data type.
Definition: dm_api.h:513
Data type for DM_ADV_NEW_ADDR_IND.
Definition: dm_api.h:614
LE scan request received.
Definition: hci_api.h:206
LE remove device from resolving list command complete event.
Definition: hci_api.h:510
Data type for DM_SEC_ENCRYPT_IND.
Definition: dm_api.h:550
bool_t usingLtk
TRUE if connection encrypted with LTK.
Definition: dm_api.h:553
uint8_t DmConnPeerAddrType(dmConnId_t connId)
For internal use only. Return the peer address type.
LE advertising report event.
Definition: hci_api.h:155
void DmDevWhiteListAdd(uint8_t addrType, uint8_t *pAddr)
Add a peer device to the white list. Note that this function cannot be called while advertising...
void DmConnInit(void)
Initialize DM connection manager.
void DmExtConnSetConnSpec(uint8_t initPhys, hciConnSpec_t *pConnSpec)
Set the extended connection spec parameters for extended connections to be created with DmConnOpen()...
Incoming pairing request from master.
Definition: dm_api.h:453
unsigned short uint16_t
Unsigned 16-bit value.
Definition: wsf_types.h:67
#define DM_CBACK_START
DM callback event starting value.
Definition: dm_api.h:431
void DmConnSetIdle(dmConnId_t connId, uint16_t idleMask, uint8_t idle)
Configure a bit in the connection idle state mask as busy or idle.
Private address resolved.
Definition: dm_api.h:459
void DmSecSetLocalIrk(uint8_t *pIrk)
This function sets the local IRK used by the device.
void DmPrivReadPeerResolvableAddr(uint8_t addrType, const uint8_t *pIdentityAddr)
HCI read peer resolvable address command. When complete the client&#39;s callback function is called with...
Vendor specific event.
Definition: hci_api.h:361
Data type for DM_SEC_AUTH_REQ_IND.
Definition: dm_api.h:557
Address resolving enable set.
Definition: dm_api.h:466
hciLeReadPeerResAddrCmdCmplEvt_t readPeerResAddr
handles DM_PRIV_READ_PEER_RES_ADDR_IND
Definition: dm_api.h:689
Disconnect complete event.
Definition: hci_api.h:128
bool_t display
TRUE if pin is to be displayed.
Definition: dm_api.h:561
dmSecIrk_t irk
IRK.
Definition: dm_api.h:538
Periodic advertising data received from peer device.
Definition: dm_api.h:484
uint8_t advHandle
Advertising handle.
Definition: dm_api.h:640
CSRK data type.
Definition: dm_api.h:529
Local LL version information read.
Definition: dm_api.h:486
void DmDevWhiteListClear(void)
Clear the white list. Note that this function cannot be called while advertising, scanning...
wsfMsgHdr_t hdr
Header.
Definition: dm_api.h:608
void DmPerAdvStart(uint8_t advHandle)
Start periodic advertising for the advertising set specified by the advertising handle.
secEccKey_t * DmSecGetEccKey(void)
This function gets the local ECC key for use with LESC security.
void DmAdvSetPhyParam(uint8_t advHandle, uint8_t priAdvPhy, uint8_t secAdvMaxSkip, uint8_t secAdvPhy)
Set extended advertising PHY parameters.
LE read remote features complete event.
Definition: hci_api.h:295
wsfMsgHdr_t hdr
Header.
Definition: dm_api.h:584
hciLePerAdvSyncLostEvt_t perAdvSyncLost
handles DM_PER_ADV_SYNC_LOST_IND
Definition: dm_api.h:708
Remote LL version information read.
Definition: dm_api.h:487
hciLeClearResListCmdCmplEvt_t clearResList
handles DM_PRIV_CLEAR_RES_LIST_IND
Definition: dm_api.h:688
uint8_t DmHostAddrType(uint8_t addrType)
Map an address type to a type used by Host.
void DmAdvStop(uint8_t numSets, uint8_t *pAdvHandles)
Stop advertising for the given advertising set. If the number of sets is set to 0 then all advertisin...
void DmExtConnSlaveInit(void)
Initialize DM connection manager for operation as extended slave.
LE periodic advertising sync established.
Definition: hci_api.h:215
void DmAddDeviceToPerAdvList(uint8_t advAddrType, uint8_t *pAdvAddr, uint8_t advSid)
Add device to periodic advertiser list.
Authenticated payload timeout expired.
Definition: dm_api.h:470
hciLePhyUpdateEvt_t phyUpdate
handles DM_PHY_UPDATE_IND
Definition: dm_api.h:698
Union of key types.
Definition: dm_api.h:535
Connection update complete.
Definition: dm_api.h:445
void DmSecCancelReq(dmConnId_t connId, uint8_t reason)
This function is called to cancel the pairing process.
void DmSecLescInit(void)
Initialize DM LE Secure Connections security.
dmPerAdvSetStartEvt_t perAdvSetStart
handles DM_PER_ADV_SET_START_IND
Definition: dm_api.h:705
void DmSmpCbackExec(dmEvt_t *pDmEvt)
For internal use only. Execute DM callback from SMP procedures.
bdAddr_t bdAddr
BD Address.
Definition: dm_api.h:524
hciLeDataLenChangeEvt_t dataLenChange
handles DM_CONN_DATA_LEN_CHANGE_IND
Definition: dm_api.h:693
uint8_t rKeyDist
Responder key distribution flags.
Definition: dm_api.h:571
hciHwErrorEvt_t hwError
handles DM_HW_ERROR_IND
Definition: dm_api.h:714
Common message structure passed to event handler.
Definition: wsf_os.h:97
wsfMsgHdr_t hdr
Header.
Definition: dm_api.h:616
Resolving list cleared.
Definition: dm_api.h:463
Periodic advertising set started.
Definition: dm_api.h:480
Remote connection parameter requested.
Definition: dm_api.h:467
PHY update.
Definition: dm_api.h:473
void DmPrivRemDevFromResList(uint8_t addrType, const uint8_t *pIdentityAddr, uint16_t param)
Remove device from resolving list. When complete the client&#39;s callback function is called with a DM_P...
hciLeSetAddrResEnableCmdCmplEvt_t setAddrResEnable
handles DM_PRIV_SET_ADDR_RES_ENABLE_IND
Definition: dm_api.h:691
AES and random number security service API.
void DmRemoteConnParamReqNegReply(dmConnId_t connId, uint8_t reason)
Negative reply to the HCI remote connection parameter request event. This command is used to indicate...
Advertising stopped.
Definition: dm_api.h:438
void DmExtScanInit(void)
Initialize DM extended scanning.
Connection encrypted.
Definition: dm_api.h:448
void DmPhyInit(void)
Initialize DM PHY.
unsigned char uint8_t
Unsigned 8-bit value.
Definition: wsf_types.h:63
hciLeReadPhyCmdCmplEvt_t readPhy
handles DM_PHY_READ_IND
Definition: dm_api.h:696
uint8_t dummy
Placeholder variable.
Definition: dm_api.h:509
Incoming security request from slave.
Definition: dm_api.h:454
LE advertising set terminated.
Definition: hci_api.h:196
LE periodic advertising synch lost.
Definition: hci_api.h:242
Stack configuration.
Advertising set(s) stopped.
Definition: dm_api.h:475
void DmConnReadRssi(dmConnId_t connId)
Read RSSI of a given connection.
uint8_t DmConnLocalAddrType(dmConnId_t connId)
For internal use only. Return the local address type.
signed char int8_t
Signed 8-bit value.
Definition: wsf_types.h:61
Encryption failed.
Definition: dm_api.h:449