Goodix
GR551x API Reference  V1_6_06_B5676
ble_gapm.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file ble_gapm.h
5  *
6  * @brief BLE GAPM API
7  *
8  ****************************************************************************************
9  * @attention
10  #####Copyright (c) 2019 GOODIX
11  All rights reserved.
12 
13  Redistribution and use in source and binary forms, with or without
14  modification, are permitted provided that the following conditions are met:
15  * Redistributions of source code must retain the above copyright
16  notice, this list of conditions and the following disclaimer.
17  * Redistributions in binary form must reproduce the above copyright
18  notice, this list of conditions and the following disclaimer in the
19  documentation and/or other materials provided with the distribution.
20  * Neither the name of GOODIX nor the names of its contributors may be used
21  to endorse or promote products derived from this software without
22  specific prior written permission.
23 
24  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  POSSIBILITY OF SUCH DAMAGE.
35  *****************************************************************************************
36  */
37 
38  /**
39  * @addtogroup BLE
40  * @{
41  * @brief Definitions and prototypes for the BLE SDK interface.
42  */
43 
44  /**
45  * @addtogroup BLE_GAP Generic Access Profile (GAP)
46  * @{
47  * @brief Definitions and prototypes for the GAP interface.
48  */
49 
50 #ifndef __BLE_GAPM_H__
51 #define __BLE_GAPM_H__
52 
53 /*
54  * INCLUDE FILES
55  ****************************************************************************************
56  */
57 #include "ble_error.h"
58 #include "ble_gapc.h"
59 #include <stdint.h> // standard definitions
60 #include <stddef.h> // standard definitions
61 
62 
63 /**
64  @addtogroup BLE_GAPM Generic Access Profile (GAP) Management
65  @{
66  @brief Definitions and prototypes for the GAP Management interface.
67  */
68 
69 /** @addtogroup BLE_GAPM_DEFINES Defines
70  * @{ */
71 
72 #define CO_BIT(pos)(1UL<<(pos)) /**< Bit operation helper. */
73 #define MAX_ADV_NUM 5 /**< Maximal advertising instance number. */
74 #define MAX_PER_SYNC_NUM 5 /**< Maximal periodic syncronization instance number. */
75 #define MAX_BOND_NUM 10 /**< Maximal bonding number. */
76 #define MAX_WL_NUM 10 /**< Maximal white list number. */
77 
78 #if defined(GR5515_D)
79 #define MAX_PRD_ADV_NUM 10 /**< Maximal periodic advertising list number. */
80 #else
81 #define MAX_PRD_ADV_NUM 4 /**< Maximal periodic advertising list number. */
82 #endif
83 
84 #define MAX_KEY_LEN 16 /**< The key length. */
85 #define INVALID_ADV_IDX 0xFF /**< Invalid adv index. */
86 #define BLE_GAP_DEVNAME_DEFAULT "GOODIX_BLE" /**< Default device name value. */
87 #define BLE_GAP_DEVNAME_MAX_LEN 248 /**< Maximal length of device name. */
88 
89 #define BLE_APPEARANCE_UNKNOWN 0 /**< Unknown. */
90 #define BLE_APPEARANCE_GENERIC_PHONE 64 /**< Generic Phone. */
91 #define BLE_APPEARANCE_GENERIC_COMPUTER 128 /**< Generic Computer. */
92 #define BLE_APPEARANCE_GENERIC_WATCH 192 /**< Generic Watch. */
93 #define BLE_APPEARANCE_WATCH_SPORTS_WATCH 193 /**< Watch: Sports Watch. */
94 #define BLE_APPEARANCE_GENERIC_CLOCK 256 /**< Generic Clock. */
95 #define BLE_APPEARANCE_GENERIC_DISPLAY 320 /**< Generic Display. */
96 #define BLE_APPEARANCE_GENERIC_REMOTE_CONTROL 384 /**< Generic Remote Control. */
97 #define BLE_APPEARANCE_GENERIC_EYE_GLASSES 448 /**< Generic Eye-glasses. */
98 #define BLE_APPEARANCE_GENERIC_TAG 512 /**< Generic Tag. */
99 #define BLE_APPEARANCE_GENERIC_KEYRING 576 /**< Generic Keyring. */
100 #define BLE_APPEARANCE_GENERIC_MEDIA_PLAYER 640 /**< Generic Media Player. */
101 #define BLE_APPEARANCE_GENERIC_BARCODE_SCANNER 704 /**< Generic Barcode Scanner. */
102 #define BLE_APPEARANCE_GENERIC_THERMOMETER 768 /**< Generic Thermometer. */
103 #define BLE_APPEARANCE_THERMOMETER_EAR 769 /**< Thermometer: Ear. */
104 #define BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR 832 /**< Generic Heart Rate Sensor. */
105 #define BLE_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT 833 /**< Heart Rate Sensor: Heart Rate Belt. */
106 #define BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE 896 /**< Generic Blood Pressure. */
107 #define BLE_APPEARANCE_BLOOD_PRESSURE_ARM 897 /**< Blood Pressure: Arm. */
108 #define BLE_APPEARANCE_BLOOD_PRESSURE_WRIST 898 /**< Blood Pressure: Wrist. */
109 #define BLE_APPEARANCE_GENERIC_HID 960 /**< Human Interface Device (HID). */
110 #define BLE_APPEARANCE_HID_KEYBOARD 961 /**< Keyboard (HID Subtype). */
111 #define BLE_APPEARANCE_HID_MOUSE 962 /**< Mouse (HID Subtype). */
112 #define BLE_APPEARANCE_HID_JOYSTICK 963 /**< Joystick (HID Subtype). */
113 #define BLE_APPEARANCE_HID_GAMEPAD 964 /**< Gamepad (HID Subtype). */
114 #define BLE_APPEARANCE_HID_DIGITIZERSUBTYPE 965 /**< Digitizer Tablet (HID Subtype). */
115 #define BLE_APPEARANCE_HID_CARD_READER 966 /**< Card Reader (HID Subtype). */
116 #define BLE_APPEARANCE_HID_DIGITAL_PEN 967 /**< Digital Pen (HID Subtype). */
117 #define BLE_APPEARANCE_HID_BARCODE 968 /**< Barcode Scanner (HID Subtype). */
118 #define BLE_APPEARANCE_GENERIC_GLUCOSE_METER 1024 /**< Generic Glucose Meter. */
119 #define BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR 1088 /**< Generic Running Walking Sensor. */
120 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE 1089 /**< Running Walking Sensor: In-Shoe. */
121 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE 1090 /**< Running Walking Sensor: On-Shoe. */
122 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP 1091 /**< Running Walking Sensor: On-Hip. */
123 #define BLE_APPEARANCE_GENERIC_CYCLING 1152 /**< Generic Cycling. */
124 #define BLE_APPEARANCE_CYCLING_CYCLING_COMPUTER 1153 /**< Cycling: Cycling Computer. */
125 #define BLE_APPEARANCE_CYCLING_SPEED_SENSOR 1154 /**< Cycling: Speed Sensor. */
126 #define BLE_APPEARANCE_CYCLING_CADENCE_SENSOR 1155 /**< Cycling: Cadence Sensor. */
127 #define BLE_APPEARANCE_CYCLING_POWER_SENSOR 1156 /**< Cycling: Power Sensor. */
128 #define BLE_APPEARANCE_CYCLING_SPEED_CADENCE_SENSOR 1157 /**< Cycling: Speed and Cadence Sensor. */
129 #define BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 3136 /**< Generic Pulse Oximeter. */
130 #define BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 3137 /**< Fingertip (Pulse Oximeter subtype). */
131 #define BLE_APPEARANCE_PULSE_OXIMETER_WRIST_WORN 3138 /**< Wrist Worn(Pulse Oximeter subtype). */
132 #define BLE_APPEARANCE_GENERIC_WEIGHT_SCALE 3200 /**< Generic Weight Scale. */
133 #define BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS_ACT 5184 /**< Generic Outdoor Sports Activity. */
134 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_DISP 5185 /**< Location Display Device (Outdoor Sports Activity subtype). */
135 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_DISP 5186 /**< Location and Navigation Display Device (Outdoor Sports Activity subtype). */
136 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_POD 5187 /**< Location Pod (Outdoor Sports Activity subtype). */
137 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_POD 5188 /**< Location and Navigation Pod (Outdoor Sports Activity subtype). */
138 
139 /**@defgroup BLE_GAP_PHYS GAP PHYs (bitmask)
140  * @{ */
141 #define BLE_GAP_PHY_ANY 0x00 /**< No preferred PHY. */
142 #define BLE_GAP_PHY_LE_1MBPS (1 << 0) /**< LE 1M PHY preferred for an active link. */
143 #define BLE_GAP_PHY_LE_2MBPS (1 << 1) /**< LE 2M PHY preferred for an active link. */
144 #define BLE_GAP_PHY_LE_CODED (1 << 2) /**< LE Coded PHY preferred for an active link. */
145 /**@} */
146 
147 
148 /**@defgroup BLE_GAP_ADV_CHANNEL GAP ADV CHANNEL (bitmask)
149  * @{ */
150 #define GAP_ADV_CHANNEL_37 0x01 /**< Advertising Channel 37 (2402MHz). */
151 #define GAP_ADV_CHANNEL_38 0x02 /**< Advertising Channel 38 (2426MHz). */
152 #define GAP_ADV_CHANNEL_39 0x04 /**< Advertising Channel 39 (2480MHz). */
153 #define GAP_ADV_CHANNEL_37_38_39 0x07 /**< Advertising Channel 37, 38, 39. */
154 /**@} */
155 /**@} */
156 
157 /** @addtogroup BLE_GAPM_ENUMERATIONS Enumerations
158  * @{ */
159 /**
160  * @brief GAP role options
161  */
162 typedef enum
163 {
164  BLE_GAP_ROLE_NONE = 0x00, /**< No role set yet. */
165  BLE_GAP_ROLE_OBSERVER = 0x01, /**< Observer role. */
166  BLE_GAP_ROLE_BROADCASTER = 0x02, /**< Broadcaster role. */
167  BLE_GAP_ROLE_CENTRAL = (0x04 | BLE_GAP_ROLE_OBSERVER), /**< Master/Central role. */
168  BLE_GAP_ROLE_PERIPHERAL = (0x08 | BLE_GAP_ROLE_BROADCASTER), /**< Peripheral/Slave role. */
169  BLE_GAP_ROLE_ALL = (BLE_GAP_ROLE_CENTRAL | BLE_GAP_ROLE_PERIPHERAL), /**< Device has all roles, both peripheral and central. */
170 } gap_role_t;
171 
172 /**
173  * @brief Own BD address source of the device
174  */
175 typedef enum
176 {
177  BLE_GAP_OWN_ADDR_STATIC = 0, /**< Public or Private Static Address according to device address configuration. */
178  BLE_GAP_OWN_ADDR_GEN_RSLV, /**< Generated resolvable private random address. */
179  BLE_GAP_OWN_ADDR_GEN_NON_RSLV, /**< Generated non-resolvable private random address. */
181 
182 /**
183  * @brief Write permissions of the device name characteristic
184  */
185 typedef enum
186 {
187  BLE_GAP_WRITE_PERM_DISABLE = 0, /**< Disable write access. */
188  BLE_GAP_WRITE_PERM_NOAUTH, /**< LE Security Mode 1, Level 1. Link does not need to be encrypted or authenticated. */
189  BLE_GAP_WRITE_PERM_UNAUTH, /**< LE Security Mode 1, Level 2. Link needs to be encrypted, but not to be authenticated. */
190  BLE_GAP_WRITE_PERM_AUTH, /**< LE Security Mode 1, Level 3. Link needs to be encrypted and authenticated (MITM). */
191  BLE_GAP_WRITE_PERM_SEC_CON, /**< LE Security Mode 1, Level 4. Link needs to be encrypted and authenticated (secure connections). */
193 
194 /**
195  * @brief Advertising data type
196  */
197 typedef enum
198 {
199  BLE_GAP_ADV_DATA_TYPE_DATA = 0, /**< Advertising data. */
200  BLE_GAP_ADV_DATA_TYPE_SCAN_RSP, /**< Scan response data. */
201  BLE_GAP_ADV_DATA_TYPE_PER_DATA, /**< Periodic advertising data. */
203 
204 
205 /**@brief Get device parameters operation code. */
206 typedef enum
207 {
208  BLE_GAP_GET_DEV_VERSION = 0, /**< Get version information for the local Controller. */
209  BLE_GAP_GET_DEV_BDADDR, /**< Get local device BD Address. */
210  //BLE_GAP_GET_DEV_ADV_TX_POWER, /**< Get the transmit power level used for LE advertising channel packets. */
211  BLE_GAP_GET_SUGGESTED_DFLT_LE_DATA_LEN, /**< Get suggested values (SuggestedMaxTxOctets and SuggestedMaxTxTime)
212  for the Controller's maximum transmitted number of payload octets
213  and maximum packet transmission time to be used for new connections. */
214  BLE_GAP_GET_MAX_LE_DATA_LEN, /**< Get the Controller' maximum supported payload octets and packet duration
215  times for transmission and reception (supportedMaxTxOctets and supportedMaxTxTime,
216  supportedMaxRxOctets, and supportedMaxRxTime). */
217  BLE_GAP_GET_NB_ADV_SETS, /**< Read the maximum number of advertising sets currently supported by the controller. */
218  BLE_GAP_GET_MAX_LE_ADV_DATA_LEN, /**< Get maximum data length for advertising data. */
219  BLE_GAP_GET_DEV_TX_POWER, /**< Read the minimum and maximum transmit powers supported by the Controller. */
220  BLE_GAP_GET_DEV_RF_RF_PATH_COMP, /**< Get RF path compensation values. */
222 
223 /**@brief GAP advertising modes. */
224 typedef enum
225 {
226  GAP_ADV_TYPE_ADV_IND = 0, /**< Undirected connectable and scannable mode. */
227  GAP_ADV_TYPE_ADV_NONCONN_IND, /**< Non-connectable and non-scanable mode. */
228  GAP_ADV_TYPE_ADV_SCAN_IND, /**< Undirected scannable mode. */
229  GAP_ADV_TYPE_ADV_HIGH_DIRECT_IND, /**< Directed high duty cycle mode. */
230  GAP_ADV_TYPE_ADV_LOW_DIRECT_IND, /**< Directed low duty cycle mode. */
232 
233 /**@brief GAP discoverability modes. */
234 typedef enum
235 {
236  GAP_DISC_MODE_NON_DISCOVERABLE = 0, /**< Non-discoverable mode. */
237  GAP_DISC_MODE_GEN_DISCOVERABLE, /**< General-discoverable mode. */
238  GAP_DISC_MODE_LIM_DISCOVERABLE, /**< Limited-discoverable mode. */
239  GAP_DISC_MODE_BROADCASTER, /**< Broadcaster mode. */
241 
242 /**
243  * @brief Advertising filter policy
244  */
245 typedef enum
246 {
247  GAP_ADV_ALLOW_SCAN_ANY_CON_ANY = 0, /**< Allow both scan and connection requests from anyone. */
248  GAP_ADV_ALLOW_SCAN_WLST_CON_ANY, /**< Allow scan req from white-list devices only and connection req from anyone. */
249  GAP_ADV_ALLOW_SCAN_ANY_CON_WLST, /**< Allow scan req from anyone and connection req from white-list devices only. */
250  GAP_ADV_ALLOW_SCAN_WLST_CON_WLST, /**< Allow scan and connection requests from white-list devices only. */
252 
253 /**
254  * @brief Specify what PHY the Controller has changed for TX/RX. HCI:7.7.65.12
255  */
256 typedef enum
257 {
258  GAP_PHY_UNDEF_VALUE = 0, /**< Undefined LE PHY. */
259  GAP_PHY_1MBPS_VALUE = 1, /**< LE 1M PHY. */
260  GAP_PHY_2MBPS_VALUE = 2, /**< LE 2M PHY. */
261  GAP_PHY_CODED_VALUE = 3, /**< LE Coded PHY. */
263 
264 /**
265  * @brief Advertising type
266  */
267 typedef enum
268 {
269  GAP_ADV_TYPE_LEGACY = 0, /**< Legacy advertising. */
270  GAP_ADV_TYPE_EXTENDED, /**< Extended advertising. */
271  GAP_ADV_TYPE_PERIODIC, /**< Periodic advertising. */
273 
274 /**
275  * @brief Advertising properties bit field and bit positions
276  */
277 typedef enum
278 {
279  GAP_ADV_PROP_CONNECTABLE_POS = 0, /**< Indicate that advertising is connectable, reception of CONNECT_REQ or
280  UX_CONNECT_REQ PDUs is accepted. Not applicable for periodic advertising. */
281  GAP_ADV_PROP_SCANNABLE_POS, /**< Indicate that advertising is scannable, reception of SCAN_REQ or AUX_SCAN_REQ PDUs is accepted. */
282  GAP_ADV_PROP_DIRECTED_POS, /**< Indicate that advertising targets at a specific device. Only applicable in following cases:
283  - Legacy advertising: if connectable
284  - Extended advertising: connectable or (non-connectable and non-discoverable). */
285  GAP_ADV_PROP_HDC_POS, /**< Indicate that High Duty Cycle has to be used for advertising on primary channel,
286  applicable only if created advertising is not an extended advertising. */
287  GAP_ADV_PROP_USE_LEGACY_PDUS_POS, /**< Use legacy advertising PDUs. */
288  GAP_ADV_PROP_ANONYMOUS_POS, /**< Enable anonymous mode. Device address will not appear in sending PDUs.
289  Valid only if the created advertising is an extended advertising. */
290  GAP_ADV_PROP_TX_PWR_POS, /**< Include TX power in the extended header of the advertising PDU.
291  Valid only if the created advertising is not a legacy advertising. */
292  GAP_ADV_PROP_PER_TX_PWR_POS, /**< Include TX power in the periodic advertising PDU.
293  Valid only if the created advertising is a periodic advertising. */
294  GAP_ADV_PROP_SCAN_REQ_NTF_EN_POS, /**< Indicate if application must be informed about receiving scan request PDUs. */
296 
297 /**
298  * @brief Advertising properties bit field bit value
299  */
300 typedef enum
301 {
312 
313 /**
314  * @brief Scanning types
315  */
316 typedef enum
317 {
318  GAP_SCAN_ACTIVE = 0, /**< Active scan type. */
319  GAP_SCAN_PASSIVE, /**< Passive scan type. */
321 
322 /**
323  * @brief Scanning modes
324  */
325 typedef enum
326 {
327  GAP_SCAN_GEN_DISC_MODE = 0, /**< General discoverable mode. */
328  GAP_SCAN_LIM_DISC_MODE, /**< Limited discoverable mode. */
329  GAP_SCAN_OBSERVER_MODE, /**< Observer mode. */
331 
332 /**
333  * @brief Duplicate filter policy
334  */
335 typedef enum
336 {
337  GAP_SCAN_FILT_DUPLIC_DIS = 0, /**< Disable filtering of duplicate packets. */
338  GAP_SCAN_FILT_DUPLIC_EN, /**< Enable filtering of duplicate packets. */
340 
341 /**
342  * @brief Extended scanning types
343  */
344 typedef enum
345 {
346  GAP_EXT_SCAN_TYPE_GEN_DISC = 0, /**< General discovery. */
347  GAP_EXT_SCAN_TYPE_LIM_DISC, /**< Limited discovery. */
348  GAP_EXT_SCAN_TYPE_OBSERVER, /**< Observer. */
349  GAP_EXT_SCAN_TYPE_SEL_OBSERVER, /**< Selective observer. */
350  GAP_EXT_SCAN_TYPE_CONN_DISC, /**< Connectable discovery. */
351  GAP_EXT_SCAN_TYPE_SEL_CONN_DISC, /**< Selective connectable discovery. */
353 
354 /**
355  * @brief Scanning properties bit field bit value
356  */
357 typedef enum
358 {
359  GAP_EXT_SCAN_PROP_PHY_1M_BIT = (1 << 0), /**< Scan advertisement on the LE 1M PHY. */
360  GAP_EXT_SCAN_PROP_PHY_CODED_BIT = (1 << 1), /**< Scan advertisement on the LE Coded PHY. */
361  GAP_EXT_SCAN_PROP_ACTIVE_1M_BIT = (1 << 2), /**< Active scan on LE 1M PHY (scan request PDUs may be sent). */
362  GAP_EXT_SCAN_PROP_ACTIVE_CODED_BIT = (1 << 3), /**< Active scan on LE Coded PHY (scan request PDUs may be sent). */
363  GAP_EXT_SCAN_PROP_ACCEPT_RPA_BIT = (1 << 4), /**< Accept directed advertising packets if the uesd RPA and target address cannot be solved by the controller. */
364  GAP_EXT_SCAN_PROP_FILT_TRUNC_BIT = (1 << 5), /**< Filter truncated advertising or scan response reports. */
366 
367 /**
368  * @brief Filtering policy for duplicated packets
369  */
370 typedef enum
371 {
372  GAP_EXT_DUP_FILT_DIS = 0, /**< Disable filtering of duplicated packets. */
373  GAP_EXT_DUP_FILT_EN, /**< Enable filtering of duplicated packets. */
374  GAP_EXT_DUP_FILT_EN_PERIOD, /**< Enable filtering of duplicated packets, reset for each scan period. */
376 
377 /**
378  * @brief Initiating types
379  */
380 typedef enum
381 {
382  GAP_INIT_TYPE_DIRECT_CONN_EST = 0, /**< Direct connection establishment: establish a connection with an indicated device. */
383  GAP_INIT_TYPE_AUTO_CONN_EST, /**< Automatic connection establishment: establish a connection with all devices whose address is present in the white list. */
384  GAP_INIT_TYPE_NAME_DISC, /**< Name discovery: establish a connection with an indicated device in order to read content of its device name characteristic. Connection is closed once this operation is stopped. */
386 
387 /**
388  * @brief Initiating properties
389  */
390 typedef enum
391 {
392  GAP_INIT_PROP_1M_BIT = (1 << 0), /**< Scan connectable advertisements on the LE 1M PHY. Connection parameters for the LE 1M PHY are provided. */
393  GAP_INIT_PROP_2M_BIT = (1 << 1), /**< Connection parameters for the LE 2M PHY are provided. */
394  GAP_INIT_PROP_CODED_BIT = (1 << 2), /**< Scan connectable advertisements on the LE Coded PHY. Connection parameters for the LE Coded PHY are provided. */
396 
397 /**
398  * @brief Scanning properties bit field bit value
399  */
401 {
402  GAP_SCAN_PROP_PHY_1M_BIT = (1 << 0), /**< Scan advertisement on the LE 1M PHY. */
403  GAP_SCAN_PROP_PHY_CODED_BIT = (1 << 1), /**< Scan advertisement on the LE Coded PHY. */
404  GAP_SCAN_PROP_ACTIVE_1M_BIT = (1 << 2), /**< Active scan on LE 1M PHY (scan request PDUs may be sent). */
405  GAP_SCAN_PROP_ACTIVE_CODED_BIT = (1 << 3), /**< Active scan on LE Coded PHY (scan request PDUs may be sent). */
406  GAP_SCAN_PROP_ACCEPT_RPA_BIT = (1 << 4), /**< Accept directed advertising packets if the used RPA and target address cannot be solved by the controller. */
407  GAP_SCAN_PROP_FILT_TRUNC_BIT = (1 << 5), /**< Filter truncated advertising or scan response reports. */
408 };
409 
410 /**
411  * @brief Periodic synchronization types
412  */
414 {
415  GAP_PER_SYNC_TYPE_GENERAL = 0, /**< Do not use periodic advertiser list for synchronization. */
416  GAP_PER_SYNC_TYPE_SELECTIVE, /**< Use periodic advertiser list for synchronization. */
417 };
418 
419 /**
420  * @brief Security level types
421  */
423 {
424  GAP_SEC_LVL_NO_SECURITY = 0, /**< No encryption or auth. */
425  GAP_SEC_LVL_ENC_NO_AUTH, /**< Encryption with no auth. */
426  GAP_SEC_LVL_LE_ENC_AUTH, /**< Legacy encryption with auth. */
427  GAP_SEC_LVL_SC_ENC_AUTH, /**< Security connection encryption with auth. */
428 };
429 
430 /**
431  * @brief GAP advertising types
432  */
433 typedef enum
434 {
435  BLE_GAP_AD_TYPE_FLAGS = 0x01, /**< Flag. */
436  BLE_GAP_AD_TYPE_MORE_16_BIT_UUID = 0x02, /**< Use of more than 16-bit UUID. */
437  BLE_GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID = 0x03, /**< Complete List of 16-bit UUID. */
438  BLE_GAP_AD_TYPE_MORE_32_BIT_UUID = 0x04, /**< Use of more than 32-bit UUD. */
439  BLE_GAP_AD_TYPE_COMPLETE_LIST_32_BIT_UUID = 0x05, /**< Complete List of 32-bit UUID. */
440  BLE_GAP_AD_TYPE_MORE_128_BIT_UUID = 0x06, /**< Use of more than 128-bit UUID. */
441  BLE_GAP_AD_TYPE_COMPLETE_LIST_128_BIT_UUID = 0x07, /**< Complete List of 128-bit UUID. */
442  BLE_GAP_AD_TYPE_SHORTENED_NAME = 0x08, /**< Shortened Device name. */
443  BLE_GAP_AD_TYPE_COMPLETE_NAME = 0x09, /**< Complete Device name. */
444  BLE_GAP_AD_TYPE_TRANSMIT_POWER = 0x0A, /**< Transmit power. */
445  BLE_GAP_AD_TYPE_CLASS_OF_DEVICE = 0x0D, /**< Class of device. */
446  BLE_GAP_AD_TYPE_SP_HASH_C = 0x0E, /**< Simple Pairing Hash C. */
447  BLE_GAP_AD_TYPE_SP_RANDOMIZER_R = 0x0F, /**< Simple Pairing Randomizer. */
448  BLE_GAP_AD_TYPE_TK_VALUE = 0x10, /**< Temporary key value. */
449  BLE_GAP_AD_TYPE_OOB_FLAGS = 0x11, /**< Out of Band Flag. */
450  BLE_GAP_AD_TYPE_SLAVE_CONN_INT_RANGE = 0x12, /**< Slave connection interval range. */
451  BLE_GAP_AD_TYPE_RQRD_16_BIT_SVC_UUID = 0x14, /**< Require 16-bit service UUID. */
452  BLE_GAP_AD_TYPE_RQRD_32_BIT_SVC_UUID = 0x1F, /**< Require 32-bit service UUID. */
453  BLE_GAP_AD_TYPE_RQRD_128_BIT_SVC_UUID = 0x15, /**< Require 128-bit service UUID. */
454  BLE_GAP_AD_TYPE_SERVICE_16_BIT_DATA = 0x16, /**< Service data 16-bit UUID. */
455  BLE_GAP_AD_TYPE_SERVICE_32_BIT_DATA = 0x20, /**< Service data 32-bit UUID. */
456  BLE_GAP_AD_TYPE_SERVICE_128_BIT_DATA = 0x21, /**< Service data 128-bit UUID. */
457  BLE_GAP_AD_TYPE_PUB_TGT_ADDR = 0x17, /**< Public Target Address. */
458  BLE_GAP_AD_TYPE_RAND_TGT_ADDR = 0x18, /**< Random Target Address. */
459  BLE_GAP_AD_TYPE_APPEARANCE = 0x19, /**< Appearance. */
460  BLE_GAP_AD_TYPE_ADV_INTV = 0x1A, /**< Advertising Interval. */
461  BLE_GAP_AD_TYPE_LE_BT_ADDR = 0x1B, /**< LE Bluetooth Device Address. */
462  BLE_GAP_AD_TYPE_LE_ROLE = 0x1C, /**< LE Role. */
463  BLE_GAP_AD_TYPE_SPAIR_HASH = 0x1D, /**< Simple Pairing Hash C-256. */
464  BLE_GAP_AD_TYPE_SPAIR_RAND = 0x1E, /**< Simple Pairing Randomizer R-256. */
465  BLE_GAP_AD_TYPE_3D_INFO = 0x3D, /**< 3D Information Data. */
466 
467  BLE_GAP_AD_TYPE_MANU_SPECIFIC_DATA = 0xFF, /**< Manufacturer specific data. */
469 
470 /**
471  * @brief AD Type Flag - Bit mask.
472  */
473 typedef enum
474 {
475  GAP_ADV_FLAG_LE_LIMITED_DISC_MODE = 0x01, /**< Limited discovery flag: AD Flag. */
476  GAP_ADV_FLAG_LE_GENERAL_DISC_MODE = 0x02, /**< General discovery flag: AD Flag. */
477  GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED = 0x04, /**< Legacy BT not supported: AD Flag. */
478  GAP_ADV_FLAG_SIMUL_BR_EDR_LE_CONTROLLER = 0x08, /**< Dual mode for controller supported (BR/EDR/LE): AD Flag. */
479  GAP_ADV_FLAG_SIMUL_BR_EDR_LE_HOST = 0x10, /**< Dual mode for host supported (BR/EDR/LE): AD Flag. */
481 
482 /**
483  * @brief Privacy mode.
484  */
485 
486 typedef enum
487 {
488  PRIVACY_MODE_NETWORK= 0x00, /**< Set to the network privacy mode for the peer device. */
489  PRIVACY_MODE_DEVICE = 0x01, /**< Set to the device privacy mode for the peer device. */
491 
492 /**
493  * @brief Possible roles of the activity.
494  */
495 typedef enum
496 {
497  GAP_ACTIVITY_ROLE_ADV = 0, /**< Adertise role. */
498  GAP_ACTIVITY_ROLE_CON = 1, /**< Connect role. */
499  GAP_ACTIVITY_ROLE_SCAN_INIT = 2, /**< Scann role. */
500  GAP_ACTIVITY_ROLE_UNKNOWN = 0xf, /**< Unknown role. */
502 
503 /** @} */
504 
505 /**@addtogroup BLE_GAPM_STRUCTURES Structures
506  * @{ */
507 
508 /**
509  * @brief Advertising parameters for legacy advertising
510  */
511 typedef struct
512 {
513  uint8_t adv_mode; /**< Advertising mode (see enum @ref gap_adv_mode_t). */
514  uint8_t disc_mode; /**< Discovery mode (see enum @ref gap_disc_mode_t). */
515  uint8_t filter_pol; /**< Advertising filtering policy (see enum @ref gap_adv_filter_policy_t). */
516  gap_bdaddr_t peer_addr; /**< Peer address configuration (only used in case of directed advertising, or used to locate the IRK list). */
517  uint16_t adv_intv_min; /**< Minimum advertising interval (in unit of 625 us). Must be greater than 20 ms. */
518  uint16_t adv_intv_max; /**< Maximum advertising interval (in unit of 625 us). Must be greater than 20 ms. */
519  uint8_t chnl_map; /**< Advertising channel map. See @ref BLE_GAP_ADV_CHANNEL. */
520  bool scan_req_ind_en; /**< Indicate if the application should be informed when receiving a scan request from the scanner. */
521  int8_t max_tx_pwr; /**< Maximum power level at which the advertising packets have to be transmitted (between -20dbm and 7dbm).
522  For the real value, please refer to GR551x Datasheet. */
524 
525 /**
526  * @brief Configuration for advertising on primary channel
527  */
528 typedef struct
529 {
530  uint32_t adv_intv_min; /**< Minimum advertising interval (in unit of 625 us). Must be greater than 20 ms. */
531  uint32_t adv_intv_max; /**< Maximum advertising interval (in unit of 625 us). Must be greater than 20 ms. */
532  uint8_t chnl_map; /**< Bit field indicating the channel map. See @ref BLE_GAP_ADV_CHANNEL. */
533  gap_le_phy_value_t phy; /**< Indicate on which PHY primary advertising has to be performed. See enum @ref gap_le_phy_value_t.
534  Note that LE 2M PHY is not allowed and that legacy advertising only supports LE 1M PHY. */
536 
537 /**
538  * @brief Configuration for advertising on secondary channel
539  */
540 typedef struct
541 {
542  uint8_t max_skip; /**< Maximum number of advertising events the controller can skip before sending the AUX_ADV_IND packets.
543  The range is 0x00 to 0xFF. 0x00 means that AUX_ADV_IND PDUs shall be sent prior to each advertising events. */
544  gap_le_phy_value_t phy; /**< Indicate on which PHY secondary advertising has to be performed. See enum @ref gap_le_phy_value_t. */
545  uint8_t adv_sid; /**< Advertising SID. Allowed range is 0x00 to 0x0F. */
547 
548 /**
549  * @brief Configuration for periodic advertising
550  */
551 typedef struct
552 {
553  uint16_t adv_intv_min; /**< Minimum advertising interval (in unit of 1.25 ms). Must be greater than 20 ms. */
554  uint16_t adv_intv_max; /**< Maximum advertising interval (in unit of 1.25 ms). Must be greater than 20 ms. */
556 
557 /**
558  * @brief Advertising parameters for extended advertising and periodic advertising
559  */
560 typedef struct
561 {
562  uint8_t type; /**< Advertising type (see enum @ref gap_adv_type_t). */
563  uint8_t disc_mode; /**< Discovery mode (see enum @ref gap_disc_mode_t). */
564  uint16_t prop; /**< Bit field value provided by advertising properties. See enum @ref gap_adv_prop_t for bit signification. */
565  int8_t max_tx_pwr; /**< Maximum power level at which the advertising packets have to be transmitted (between -20 and 7 dBm). */
566  uint8_t filter_pol; /**< Advertising filtering policy (see enum @ref gap_adv_filter_policy_t). */
567  gap_bdaddr_t peer_addr; /**< Peer address configuration (only used in case of directed advertising or used to locate the IRK list). */
568  gap_adv_prim_cfg_t prim_cfg; /**< Configuration for primary advertising. */
569  gap_adv_second_cfg_t second_cfg; /**< Configuration for secondary advertising (valid only if advertising type is GAP_ADV_TYPE_EXTENDED or GAP_ADV_TYPE_PERIODIC). */
570  gap_adv_period_cfg_t period_cfg; /**< Configuration for periodic advertising (valid only if advertising type is GAP_ADV_TYPE_PERIODIC). */
572 
573 /**
574  * @brief Advertising timing parameter
575  */
576 typedef struct
577 {
578  uint16_t duration; /**< Advertising duration (in unit of 10ms). 0 means that advertising continues until the host disables it.
579  If Advertising discovery mode is GAP_DISC_MODE_LIM_DISCOVERABLE (see enum @ref gap_disc_mode_t),
580  the setting duration range is [1, 18000].
581  If adv mode is high duty, duration time range is [1, 128]. */
582  uint8_t max_adv_evt; /**< Maximum number of extended advertising events. The controller shall attempt to send prior to terminating the extending advertising.
583  The range is [0, 255]. 0 means no maximum number of advertising events. Valid only if the created advertising is an extended advertising. */
585 
586 /**
587  * @brief Security key
588  */
589 typedef struct
590 {
591  uint8_t key[MAX_KEY_LEN]; /**< Key value MSB -> LSB (MSB followed by LSB). */
592 } gap_sec_key_t;
593 
594 /**
595  * @brief Parameters for legacy scanning
596  */
597 typedef struct
598 {
599  gap_scan_type_t scan_type; /**< Active scanning or passive scanning. */
600  gap_scan_mode_t scan_mode; /**< Scan mode. */
601  gap_scan_dup_filt_policy_t scan_dup_filt; /**< Duplicate filter policy. */
602  bool use_whitelist; /**< Filter policy. */
603  uint16_t interval; /**< Scan interval between 0x0004 and 0x4000 in 0.625 ms (range: 2.5 ms to 10.24s). */
604  uint16_t window; /**< Scan window between 0x0004 and 0x4000 in 0.625 ms (range: 2.5 ms to 10.24s). */
605  uint16_t timeout; /**< Scan timeout should be a value between 0x0001 and 0xFFFF(unit: 10 ms). 0x0000 indicates that the timeout has no effect. */
607 
608 /**
609  * @brief Scan Window operation parameters
610  */
611 typedef struct
612 {
613  uint16_t scan_intv; /**< Scan interval between 0x0004 and 0xFFFF in 0.625 ms (range: 2.5 ms to 40.959375s). */
614  uint16_t scan_wd; /**< Scan window between 0x0004 and 0xFFFF in 0.625 ms (range: 2.5 ms to 40.959375s). */
616 
617 /**
618  * @brief Parameters for extended scanning
619  */
620 typedef struct
621 {
622  uint8_t type; /**< Type of scanning to be started (see enum @ref gap_ext_scan_type_t). */
623  uint8_t prop; /**< Properties for the scan procedure (see enum @ref gap_scan_prop for bit signification). */
624  uint8_t dup_filt_pol; /**< Duplicate packet filtering policy (see enum @ref gap_ext_scan_dup_filt_policy_t). */
625  uint8_t rsvd; /**< Reserved for future use. */
626  gap_scan_wd_op_param_t scan_param_1m; /**< Scan window opening parameters for LE 1M PHY. */
627  gap_scan_wd_op_param_t scan_param_coded; /**< Scan window opening parameters for LE Coded PHY. */
628  uint16_t duration; /**< Scan duration (in unit of 10ms). 0 means that the controller will scan continuously
629  until receiving a stop command from the application (10 ms to 655.35s). */
630  uint16_t period; /**< Scan period, which is the time interval between two consequent starts of a scan duration by the controller.
631  0 means that the scan procedure is not periodic, in unit of 1.28s (1.28s to 83,884.8s). */
633 
634 /**
635  * @brief Periodic advertising information
636  */
637 typedef struct
638 {
639  gap_bdaddr_t bd_addr; /**< Advertiser address information. */
640  uint8_t adv_sid; /**< Advertising SID. */
642 
643 /**
644  * @brief Periodic advertising synchronization parameters
645  */
646 typedef struct
647 {
648  uint16_t skip; /**< Number of periodic advertising that can be skipped after a successful reception.
649  Maximum authorized value is 499. */
650  uint16_t sync_to; /**< Synchronization timeout for the periodic advertising (in unit of 10ms between 100ms and 163.84s). */
651  uint8_t type; /**< Periodic synchronization type (see enum @ref gap_per_sync_type). */
652  uint8_t rsvd; /**< Reserved for future use.*/
653  gap_period_adv_addr_cfg_t adv_addr; /**< Address of advertiser with which synchronization has to be established(used only if use_pal is false). */
655 
656 /**
657  * @brief Legacy initiating parameters
658  */
659 typedef struct
660 {
661  uint8_t type; /**< Initiating type (see enum @ref gap_init_type_t). */
662  gap_bdaddr_t peer_addr; /**< Peer device address. */
663  uint16_t interval_min; /**< Minimum value for the connection interval (in unit of 1.25ms). Shall be less than or equal to interval_max value.
664  Allowed range is 7.5 ms to 4s. */
665  uint16_t interval_max; /**< Maximum value for the connection interval (in unit of 1.25ms). Shall be greater than or equal to interval_min value.
666  Allowed range is 7.5 ms to 4s. */
667  uint16_t slave_latency; /**< Slave latency. Number of events that can be missed by a connected slave device. */
668  uint16_t sup_timeout; /**< Link supervision timeout (in unit of 10ms). Allowed range is 100 ms to 32s. */
669  uint16_t conn_timeout; /**< Timeout for connection establishment (in unit of 10ms).
670  Cancel the procedure if connection has not been connected when the timeout occurs.
671  0 means there is no timeout. */
673 
674 
675 /**
676  * @brief Connection parameters
677  */
678 typedef struct
679 {
680  uint16_t conn_intv_min; /**< Minimum value for the connection interval (in unit of 1.25ms). Shall be less than or equal to conn_intv_max value.
681  Allowed range is 7.5 ms to 4s. */
682  uint16_t conn_intv_max; /**< Maximum value for the connection interval (in unit of 1.25ms). Shall be greater than or equal to conn_intv_min value.
683  Allowed range is 7.5 ms to 4s. */
684  uint16_t conn_latency; /**< Slave latency. Number of events that can be missed by a connected slave device. */
685  uint16_t supervision_to; /**< Link supervision timeout (in unit of 10ms). Allowed range is 100 ms to 32s. */
686  uint16_t ce_len; /**< The length of connection event needed for this LE connection. Range: 0x0002 to 0xFFFF, Unit:0.625 ms, Time Range: 1.25 ms to 40.9s. */
688 
689 /**
690  * @brief Extended initiating parameters
691  */
692 typedef struct
693 {
694  uint8_t type; /**< Initiating type (see enum @ref gap_init_type_t). */
695  uint8_t prop; /**< Properties for the initiating procedure (see enum @ref gap_init_prop_t for bit signification). */
696  uint16_t conn_to; /**< Timeout for automatic connection establishment (in unit of 10ms).
697  Cancel the procedure if connection has not been connected when the timeout occurs.
698  0 means there is no timeout. */
699  gap_scan_wd_op_param_t scan_param_1m; /**< Scan window opening parameters for LE 1M PHY. */
700  gap_scan_wd_op_param_t scan_param_coded; /**< Scan window opening parameters for LE Coded PHY. */
701  gap_ext_conn_param_t conn_param_1m; /**< Connection parameters for LE 1M PHY. */
702  gap_ext_conn_param_t conn_param_2m; /**< Connection parameters for LE 2M PHY. */
703  gap_ext_conn_param_t conn_param_coded; /**< Connection parameters for LE Coded PHY. */
704  gap_bdaddr_t peer_addr; /**< Address of peer device in case white list is not used for connection. */
706 
707 /**
708  * @brief LE Protocol/Service Multiplexer information
709  */
710 typedef struct
711 {
712  uint16_t le_psm; /**< LE Protocol/Service Multiplexer (range: 1 to 255), PSMs should be odd. */
713  uint8_t sec_lvl; /**< Security level requirement, see @ref gap_sec_lvl_type. */
714  bool mks_flag; /**< Whether to use maximum-size key (16 bytes) or not. */
716 
717 /**
718  * @brief Bonded device list
719  */
720 typedef struct
721 {
722  uint8_t num; /**< Number of bonded device. */
723  gap_bdaddr_t items[MAX_BOND_NUM]; /**< Bonded device addr info. */
725 
726 /**
727  * @brief White list
728  */
729 typedef struct
730 {
731  uint8_t num; /**< Number of available items. */
732  gap_bdaddr_t items[MAX_WL_NUM]; /**< Content of each item. */
733 } white_list_t;
734 
735 /**
736  * @brief Periodic advertising list
737  */
738 typedef struct
739 {
740  uint8_t num; /**< Number of available items. */
741  gap_period_adv_addr_cfg_t items[MAX_PRD_ADV_NUM]; /**< Content of each item. */
743 
744 /**
745  * @brief RPA list item info
746  */
747 typedef struct
748 {
749  gap_bdaddr_t bd_addr; /**< Peer device identity. */
750  uint8_t priv_mode; /**< Privacy mode, see enum @ref privacy_mode_t. */
751  uint8_t peer_irk[MAX_KEY_LEN]; /**< Peer IRK. */
752  uint8_t local_irk[MAX_KEY_LEN]; /**< Local IRK. */
754 
755 /**
756  * @brief RPA list info
757  */
758 typedef struct
759 {
760  uint8_t num; /**< Number of RPA list. */
761  gap_ral_dev_info_t items[MAX_BOND_NUM]; /**< RPA list item info. */
763 
764 /** @} */
765 
766 
767 
768 /** @addtogroup BLE_GAPM_FUNCTION Functions
769  * @{ */
770 
771 /**
772  ****************************************************************************************
773  * @brief Decide whether to support the pair feature.
774  *
775  * @param[in] enable: Support flag.
776  ****************************************************************************************
777  */
778 void ble_gap_pair_enable(bool enable);
779 
780 /**
781  ****************************************************************************************
782  * @brief Set the device identity address (public or random static).
783  *
784  * @param[in] p_addr: Provided public or static random address. If addr_type = 0, it means public address,
785  * If addr_type = 1, it means static random address.
786  *
787  * @retval ::SDK_SUCCESS: Operation is successful.
788  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
789  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
790  ****************************************************************************************
791  */
792 uint16_t ble_gap_addr_set(gap_bdaddr_t const *p_addr);
793 
794 /**
795  ****************************************************************************************
796  * @brief Get the device identity address (public or random static).
797  *
798  * @param[in] p_addr: The pointer for the returned identity address.
799  *
800  * @retval ::SDK_SUCCESS: Operation is successful.
801  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
802  ****************************************************************************************
803  */
804 uint16_t ble_gap_addr_get(gap_bdaddr_t *p_addr);
805 
806 /**
807  ****************************************************************************************
808  * @brief Set the tx power
809  *
810  * @param[in] role: Select the role to set tx power. @ref gap_activity_role_t for possible roles.
811  * @param[in] index: The idx parameter is interpreted on role.
812  * -If role is @ref GAP_ACTIVITY_ROLE_ADV, it's the index of Advertising.
813  * -If role is @ref GAP_ACTIVITY_ROLE_CON, it's the index of connection.
814  * -For all other roles, it should be ignored.
815  * @param[in] txpwr_dbm: The value of the tx power, Range: -20dbm to 7dbm.
816  *
817  * @retval ::SDK_SUCCESS: Operation is Success.
818  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
819  * @retval ::SDK_ERR_INVALID_ADV_IDX: Invalid advertising index supplied.
820  * @retval ::SDK_ERR_INVALID_HANDLE: Invalid handle supplied.
821  ****************************************************************************************
822  */
823 uint16_t ble_gap_tx_power_set(gap_activity_role_t role, uint8_t index, int8_t txpwr_dbm);
824 
825 /**
826  ****************************************************************************************
827  * @brief Get the tx power
828  *
829  * @param[in] role: Select the role to Get tx power. @ref gap_activity_role_t for possible roles.
830  * @param[in] index: The idx parameter is interpreted on role.
831  * -If role is @ref GAP_ACTIVITY_ROLE_ADV, it's the index of Advertising.
832  * -If role is @ref GAP_ACTIVITY_ROLE_CON, it's the index of connection.
833  * -For all other roles, it should be ignored.
834  * @param[in] txpwr_dbm: The value of the tx power, Range: -20dbm to 7dbm.
835  *
836  * @retval ::SDK_SUCCESS: Operation is Success.
837  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
838  * @retval ::SDK_ERR_INVALID_ADV_IDX: Invalid advertising index supplied.
839  * @retval ::SDK_ERR_INVALID_HANDLE: Invalid handle supplied.
840  ****************************************************************************************
841  */
842 uint16_t ble_gap_tx_power_get(gap_activity_role_t role, uint8_t index, int8_t *txpwr_dbm);
843 
844 /**
845  ****************************************************************************************
846  * @brief Set the default tx power for all roles.
847  *
848  * @note This function should be called before BLE stack init.
849  *
850  * @param[in] txpwr_dbm: The value of the tx power, Range: -20dbm to 7dbm.
851  *
852  * @retval ::SDK_SUCCESS: Operation is Success.
853  ****************************************************************************************
854  */
855 uint16_t ble_gap_default_tx_power_set(int8_t txpwr_dbm);
856 
857 /**
858  ****************************************************************************************
859  * @brief Get the default tx power for all roles.
860  *
861  * @param[in] txpwr_dbm: The value of the tx power, Range: -20dbm to 7dbm.
862  *
863  * @retval ::SDK_SUCCESS: Operation is Success.
864  ****************************************************************************************
865  */
866 uint16_t ble_gap_default_tx_power_get(int8_t *txpwr_dbm);
867 
868 
869 /**
870  ****************************************************************************************
871  * @brief Set IRK used for resolvable random BD address generation (LSB first).
872  *
873  * @param[in] p_irk: Device IRK (Identity Resolving Key).
874  *
875  * @retval ::SDK_SUCCESS: Operation is successful.
876  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
877  ****************************************************************************************
878  */
880 
881 /**
882  ****************************************************************************************
883  * @brief Set privacy related parameters.
884  * @param[in] renew_dur: Duration before regenerating a device address when privacy is enabled in seconds. Range: 0x0001 (1s) ~ 0xA1B8 (11.5 hr).
885  * The suggested time is 900s(15 minutes).
886  * @param[in] enable_flag: Indicate the controller privacy is enabled or disabled.
887  *
888  * @retval ::SDK_SUCCESS: Operation is successful.
889  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
890  ****************************************************************************************
891  */
892 uint16_t ble_gap_privacy_params_set(uint16_t renew_dur, bool enable_flag);
893 
894 /**
895  ****************************************************************************************
896  * @brief Set suggested default LE data length.
897  *
898  * @param[in] sugg_max_tx_octet: Suggested value for the Controller's maximum transmitted number of payload octets to be used, the range is 27~251.
899  * @param[in] sugg_max_tx_time: Suggested value for the Controller's maximum packet transmission time to be used, the range is 328~2120.
900  *
901  * @retval ::SDK_SUCCESS: Operation is successful.
902  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
903  ****************************************************************************************
904  */
905 uint16_t ble_gap_data_length_set(uint16_t sugg_max_tx_octet,uint16_t sugg_max_tx_time);
906 
907 /**
908  ****************************************************************************************
909  * @brief Set L2CAP related parameters.
910  *
911  * @param[in] max_mtu: Maximal MTU acceptable for device, the range is 65~512.
912  * @param[in] max_mps: Maximal MPS Packet size acceptable for device (for COC SDU), the range is 65~max_mtu.
913  * @param[in] max_nb_lecb: Maximum number of LE Credit based connection that can be established, this range is 0x00~0x20.
914  * The actual number is decided by resource available.
915  *
916  * @retval ::SDK_SUCCESS: Operation is successful.
917  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
918  *
919  * @note If these parameters are not set, the stack will config the default value as (max_mtu = 512, max_mps = 512 and max_nb_lecb = 10).
920  ****************************************************************************************
921  */
922 uint16_t ble_gap_l2cap_params_set(uint16_t max_mtu,uint16_t max_mps,uint8_t max_nb_lecb);
923 
924 /**
925  ****************************************************************************************
926  * @brief Set the preferred values for the transmitter PHY and receiver PHY.
927  *
928  * @param[in] tx_pref_phy: A bit field that indicates the transmitter PHYs that the Host prefers the Controller to use(see @ref BLE_GAP_PHYS).
929  * @param[in] rx_pref_phy: A bit field that indicates the receiver PHYs that the Host prefers the Controller to use(see @ref BLE_GAP_PHYS).
930  ****************************************************************************************
931  */
932 void ble_gap_pref_phy_set(uint8_t tx_pref_phy, uint8_t rx_pref_phy);
933 
934 /**
935  ****************************************************************************************
936  * @brief Set the RF path gain or loss between the RF transceiver and the antenna contributed by intermediate components.
937  *
938  * @param[in] tx_path_comp: RF TX Path Compensation value (from -128dB to 128dB, unit is 0.1dB).
939  * @param[in] rx_path_comp: RF RX Path Compensation value (from -128dB to 128dB, unit is 0.1dB).
940  *
941  * @retval ::SDK_SUCCESS: Operation is successful.
942  * @retval ::SDK_ERR_INVALID_PARAM: The parameter is invalid.
943  ****************************************************************************************
944  */
945 uint16_t ble_gap_path_compensation_set(int16_t tx_path_comp, int16_t rx_path_comp);
946 
947 /**
948  ****************************************************************************************
949  * @brief Set advertising channel map before advertising starts.
950  *
951  * @param[in] p_chnl_map: Bitmask of LE channel map. See enum @ref gap_chnl_map_t for BT Core Spec version <= 4.2.
952  *
953  * @retval ::SDK_SUCCESS: Operation is successful.
954  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
955  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
956  *
957  * @note This API is asynchronous.
958  * @note @ref gap_cb_fun_t::app_gap_param_set_cb with op_id: @ref GAP_OPCODE_CHNL_MAP_SET
959  will be called once the operation has completed.
960  ****************************************************************************************
961  */
962 uint16_t ble_gap_chnl_map_set(gap_chnl_map_t* p_chnl_map);
963 
964 /**
965  ****************************************************************************************
966  * @brief Get all bonded devices.
967  *
968  * @retval ::SDK_SUCCESS: Operation is successful.
969  * @retval ::SDK_ERR_SDK_INTERNAL: SDK internal error.
970  * @retval ::SDK_ERR_NVDS_NOT_INIT: NVDS is not initiated.
971  * @retval ::SDK_ERR_LIST_ITEM_NOT_FOUND: Item not found in list.
972  * @retval ::SDK_ERR_LIST_FULL: List is full.
973  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
974  ****************************************************************************************
975  */
976 uint16_t ble_gap_bond_devs_get(bond_dev_list_t *p_bond_list);
977 
978 /**
979  ****************************************************************************************
980  * @brief Get BD address of the bonded device.
981  *
982  * @param[in] conn_idx: The index of connection.
983  * @param[in] p_peer_addr: Pointer to the peer BD addrss
984  *
985  * @retval ::SDK_SUCCESS: Operation is successful.
986  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
987  * @retval ::SDK_ERR_INVALID_PARAM: The parameter is invalid.
988  ****************************************************************************************
989  */
990 uint16_t ble_gap_bond_dev_addr_get(uint8_t conn_idx, gap_bdaddr_t *p_peer_addr);
991 
992 /**
993  ****************************************************************************************
994  * @brief Clear all bonded devices.
995  *
996  * @retval ::SDK_SUCCESS: Operation is successful.
997  * @retval ::SDK_ERR_SDK_INTERNAL: SDK internal error.
998  * @retval ::SDK_ERR_NVDS_NOT_INIT: NVDS is not initiated.
999  * @retval ::SDK_ERR_LIST_ITEM_NOT_FOUND: Item not found in list.
1000  * @retval ::SDK_ERR_LIST_FULL: List is full.
1001  ****************************************************************************************
1002  */
1004 
1005 /**
1006  ****************************************************************************************
1007  * @brief Delete a bond device with the specified BD address.
1008  *
1009  * @param[in] p_peer_addr: Pointer to the BD addrss.
1010  *
1011  * @retval ::SDK_SUCCESS: Operation is successful.
1012  * @retval ::SDK_ERR_SDK_INTERNAL: SDK internal error.
1013  * @retval ::SDK_ERR_NVDS_NOT_INIT: NVDS is not initiated.
1014  * @retval ::SDK_ERR_LIST_ITEM_NOT_FOUND: Item not found in list.
1015  * @retval ::SDK_ERR_LIST_FULL: List is full.
1016  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1017  ****************************************************************************************
1018  */
1019 uint16_t ble_gap_bond_dev_del(const gap_bdaddr_t *p_peer_addr);
1020 
1021 /**
1022  ****************************************************************************************
1023  * @brief Get the content of the whole white list.
1024  *
1025  * @param[in] p_whitelist: Pointer to the output white list.
1026  *
1027  * @retval ::SDK_SUCCESS: Operation is successful.
1028  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1029  ****************************************************************************************
1030  */
1031 uint16_t ble_gap_whitelist_get(white_list_t *p_whitelist);
1032 
1033 /**
1034  ****************************************************************************************
1035  * @brief Add the devices into current white list. If white list is full or there are duplicated entries, it will return error.
1036  *
1037  * @param[in] p_whitelist: Pointer to input white list.
1038  *
1039  * @retval ::SDK_SUCCESS: Operation is successful.
1040  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1041  * @retval ::SDK_ERR_LIST_ITEM_ALREADY_EXISTED: Item already existed in list.
1042  * @retval ::SDK_ERR_LIST_FULL: List is full.
1043  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1044  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1045  *
1046  * @note This API is asynchronous.
1047  * @note @ref gap_cb_fun_t::app_gap_param_set_cb with op_id: @ref GAP_OPCODE_WHITELIST_SET
1048  * will be called once the operation has completed.
1049  ****************************************************************************************
1050  */
1051 uint16_t ble_gap_whitelist_add(const white_list_t *p_whitelist);
1052 
1053 /**
1054  ****************************************************************************************
1055  * @brief Delete the devices out of current white list. If the entries do not exist in the current white list, it will return error.
1056  *
1057  * @param[in] p_whitelist: Pointer to input white list.
1058  *
1059  * @retval ::SDK_SUCCESS: Operation is successful.
1060  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1061  * @retval ::SDK_ERR_LIST_ITEM_NOT_FOUND: Item not found in list.
1062  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1063  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
1064  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1065  *
1066  * @note This API is asynchronous.
1067  * @note @ref gap_cb_fun_t::app_gap_param_set_cb with op_id: @ref GAP_OPCODE_WHITELIST_SET
1068  * will be called once the operation has completed.
1069  ****************************************************************************************
1070  */
1071 uint16_t ble_gap_whitelist_del(const white_list_t *p_whitelist);
1072 
1073 /**
1074  ****************************************************************************************
1075  * @brief Clear all the entries in the current white list.
1076  *
1077  * @retval ::SDK_SUCCESS: Operation is successful.
1078  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1079  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1080  *
1081  * @note This API is asynchronous.
1082  * @note @ref gap_cb_fun_t::app_gap_param_set_cb with op_id: @ref GAP_OPCODE_WHITELIST_SET
1083  * will be called once the operation has completed.
1084  ****************************************************************************************
1085  */
1087 
1088 /**
1089  ****************************************************************************************
1090  * @brief Get the content of the whole periodic advertising list.
1091  *
1092  * @param[in] p_pal_list: Pointer to the output periodic advertising list.
1093  *
1094  * @retval ::SDK_SUCCESS: Operation is successful.
1095  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1096  ****************************************************************************************
1097  */
1099 
1100 /**
1101  ****************************************************************************************
1102  * @brief Add the devices into current periodic advertising list. If periodic advertising list is full or there are
1103  * duplicated entries, it will return error.
1104  *
1105  * @param[in] p_pal_list: Pointer to input periodic advertising list.
1106  *
1107  * @retval ::SDK_SUCCESS: Operation is successful.
1108  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1109  * @retval ::SDK_ERR_LIST_ITEM_ALREADY_EXISTED: Item already existed in list.
1110  * @retval ::SDK_ERR_LIST_FULL: List is full.
1111  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1112  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1113  *
1114  * @note This API is asynchronous.
1115  * @note @ref gap_cb_fun_t::app_gap_param_set_cb with op_id: @ref GAP_OPCODE_PER_ADV_LIST_SET
1116  * will be called once the operation has completed.
1117  ****************************************************************************************
1118  */
1119 uint16_t ble_gap_per_adv_list_add(const period_adv_list_t *p_pal_list);
1120 
1121 /**
1122  ****************************************************************************************
1123  * @brief Delete the devices out of periodic advertising list. If the entries do not exist in the current list, an error will be returned.
1124  *
1125  * @param[in] p_pal_list: Pointer to input periodic advertising list.
1126  *
1127  * @retval ::SDK_SUCCESS: Operation is successful.
1128  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1129  * @retval ::SDK_ERR_LIST_ITEM_NOT_FOUND: Item not found in list.
1130  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
1131  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1132  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1133  *
1134  * @note This API is asynchronous.
1135  * @note @ref gap_cb_fun_t::app_gap_param_set_cb with op_id: @ref GAP_OPCODE_PER_ADV_LIST_SET
1136  * will be called once the operation has completed.
1137  ****************************************************************************************
1138  */
1139 uint16_t ble_gap_per_adv_list_del(const period_adv_list_t *p_pal_list);
1140 
1141 /**
1142  ****************************************************************************************
1143  * @brief Clear all the entries in the current periodic advertising list.
1144  *
1145  * @note This API is asynchronous.
1146  * @note @ref gap_cb_fun_t::app_gap_param_set_cb with op_id: @ref GAP_OPCODE_PER_ADV_LIST_SET
1147  * will be called once the operation has completed.
1148  *
1149  * @retval ::SDK_SUCCESS: Operation is successful.
1150  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1151  ****************************************************************************************
1152  */
1154 
1155 /**
1156  ****************************************************************************************
1157  * @brief Get the RPA list info.
1158  * @param[in] p_rpa_list: Pointer to the output RPA list.
1159  *
1160  * @retval ::SDK_SUCCESS: Operation is successful.
1161  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1162  ****************************************************************************************
1163  */
1164 uint16_t ble_gap_rpa_list_get(ral_dev_list_t *p_rpa_list);
1165 
1166 /**
1167  ****************************************************************************************
1168  * @brief Get the device information according to param type.
1169  *
1170  * @param[in] type: Param type.
1171  *
1172  * @retval ::SDK_SUCCESS: Operation is successful.
1173  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
1174  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1175  *
1176  * @note This API is asynchronous.
1177  * @note @ref gap_cb_fun_t::app_gap_dev_info_get_cb with the specified op_id (see @ref gap_dev_info_get_type_t)
1178  * will be called once the requested parameters has been got.
1179  ****************************************************************************************
1180  */
1182 
1183 /**
1184  ****************************************************************************************
1185  * @brief Set parameters for advertising. Note that this function must be called prior to advertising started.
1186  * @param[in] adv_idx: Advertising index, range is 0 to 4.
1187  * @param[in] own_addr_type: Own BD address source of the local device.
1188  * @param[in] p_adv_param: The advertising parameters.
1189  *
1190  * @retval ::SDK_SUCCESS: Operation is successful.
1191  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1192  * @retval ::SDK_ERR_INVALID_ADV_IDX: Invalid advertising index supplied.
1193  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
1194  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1195  *
1196 
1197  * @note Discovery mode param contains Flags AD type, setting adv data should not set the Flags AD type.
1198  * @note This API is for legacy advertsing (BT Core Spec version <= 4.2).
1199  ****************************************************************************************
1200  */
1201 uint16_t ble_gap_adv_param_set(uint8_t adv_idx, gap_own_addr_t own_addr_type, gap_adv_param_t* p_adv_param);
1202 
1203 /**
1204  ****************************************************************************************
1205  * @brief Set extended parameters for advertising. Note that this function must be called prior to advertising.
1206  * @param[in] adv_idx: Advertising index, range is 0 to 4.
1207  * @param[in] own_addr_type: Own BD address source of the local device.
1208  * @param[in] p_adv_param: The advertising parameters.
1209  *
1210  * @retval ::SDK_SUCCESS: Operation is successful.
1211  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1212  * @retval ::SDK_ERR_INVALID_ADV_IDX: Invalid advertising index supplied.
1213  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
1214  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1215  *
1216  * @note This API is for extended and periodic advertising (BT Core Spec version >= 5.0).
1217  ****************************************************************************************
1218  */
1219 uint16_t ble_gap_ext_adv_param_set(uint8_t adv_idx, gap_own_addr_t own_addr_type, gap_ext_adv_param_t* p_adv_param);
1220 
1221 /**
1222  ****************************************************************************************
1223  * @brief Set Advertising Data, Scan Response Data and Periodic Advertising Data. See ENUM @ref gap_ad_type_t
1224  for ADV Type definitions. See ENUM @ref gap_adv_flags_t for ADV flag definitions.
1225  *
1226  * @param[in] adv_idx: Advertising index, range is 0 to 4.
1227  * @param[in] type: Data type.
1228  * @param[in] p_data: The data pointer.
1229  * @param[in] length: Data length.
1230  *
1231  * @retval ::SDK_SUCCESS: Operation is successful.
1232  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1233  * @retval ::SDK_ERR_INVALID_ADV_IDX: Invalid advertising index supplied.
1234  * @retval ::SDK_ERR_INVALID_ADV_DATA_TYPE: Invalid advertising data type supplied.
1235  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1236  *
1237  * @note User should not add extra Flags AD type as the BLE Stack has added the Flags AD type already.
1238  ****************************************************************************************
1239  */
1240 uint16_t ble_gap_adv_data_set(uint8_t adv_idx, gap_adv_data_type_t type, const uint8_t* p_data, uint16_t length);
1241 
1242 /**
1243  ****************************************************************************************
1244  * @brief Update Advertising Data, Scan Response Data and Periodic Advertising Data. See ENUM @ref gap_ad_type_t
1245  * for ADV Type definitions. See ENUM @ref gap_adv_flags_t for ADV flag definitions.
1246  *
1247  * @param[in] adv_idx: Advertising index, range is 0 to 4.
1248  * @param[in] type: Data type.
1249  * @param[in] p_data: The data pointer.
1250  * @param[in] length: Data length.
1251  *
1252  * @retval ::SDK_SUCCESS: Operation is successful.
1253  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1254  * @retval ::SDK_ERR_INVALID_ADV_IDX: Invalid advertising index supplied.
1255  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
1256  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1257  *
1258  * @note User should not add extra Flags AD type as the BLE Stack has added the Flags AD type already.
1259  ****************************************************************************************
1260  */
1261 uint16_t ble_gap_update_adv_data(uint8_t adv_idx, gap_adv_data_type_t type, const uint8_t* p_data, uint16_t length);
1262 
1263 /**
1264  ****************************************************************************************
1265  * @brief Start advertising.
1266  * @param[in] adv_idx: Advertising index, range is 0 to 4.
1267  * @param[in] p_timeout: Advertising timing parameter.
1268  *
1269  * @retval ::SDK_SUCCESS: Operation is successful.
1270  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1271  * @retval ::SDK_ERR_INVALID_ADV_IDX: Invalid advertising index supplied.
1272  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
1273  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1274  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1275  *
1276  * @note If advertising mode is directed high duty cycle mode, duration should be set nonzero and not be greater than 1.28s.
1277  * @note This API is asynchronous.
1278  * @note If the field scan_req_ind_en in @ref gap_adv_param_t is TRUE passed in @ref ble_gap_adv_param_set function, or if the
1279  GAP_ADV_PROP_SCAN_REQ_NTF_EN_BIT is set in @ref gap_adv_prop_t and passed in @ref ble_gap_ext_adv_param_set function,
1280  @ref gap_cb_fun_t::app_gap_scan_req_ind_cb will be called once a scan request has been received.
1281  * @note @ref gap_cb_fun_t::app_gap_adv_start_cb will be called once the operation has completed.
1282  ****************************************************************************************
1283  */
1284 uint16_t ble_gap_adv_start(uint8_t adv_idx, gap_adv_time_param_t* p_timeout);
1285 
1286 /**
1287  ****************************************************************************************
1288  * @brief Stop advertising.
1289  * @param[in] adv_idx: Advertising index, range is 0 to 4.
1290  *
1291  * @retval ::SDK_SUCCESS: Operation is successful.
1292  * @retval ::SDK_ERR_INVALID_ADV_IDX: Invalid advertising index supplied.
1293  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1294  *
1295  * @note This API is asynchronous.
1296  * @note @ref gap_cb_fun_t::app_gap_adv_stop_cb will be called once the operation has completed or advertising has been stopped.
1297  ****************************************************************************************
1298  */
1299 uint16_t ble_gap_adv_stop(uint8_t adv_idx);
1300 
1301 /**
1302  ****************************************************************************************
1303  * @brief Set parameters for scanning. Note that this function must be called prior to scanning started.
1304  * @param[in] own_addr_type: Own BD address source of the local device.
1305  * @param[in] p_scan_param: The scanning parameters.
1306  *
1307  * @retval ::SDK_SUCCESS: Operation is successful.
1308  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1309  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
1310  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1311  *
1312  * @note This API is for legacy scanning (BT Core Spec version <= 4.2).
1313  ****************************************************************************************
1314  */
1315 uint16_t ble_gap_scan_param_set(gap_own_addr_t own_addr_type, gap_scan_param_t* p_scan_param);
1316 
1317 /**
1318  ****************************************************************************************
1319  * @brief Set extended parameters for scanning. Note that this function must be called prior to scanning started.
1320  * @param[in] own_addr_type: Own BD address source of the local device.
1321  * @param[in] p_scan_param: The scanning parameters.
1322  *
1323  * @retval ::SDK_SUCCESS: Operation is successful.
1324  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1325  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1326  *
1327  * @note This API is for extended scanning (BT Core Spec version >= 5.0).
1328  * The Scan window in p_scan_param should be enough to recieve one packet. For example.
1329  * If you want to recieve packects with 1270 bytes on coded phy(S8), the scan_wd should be greater than 82ms.
1330  * If you want to recieve packects with 1270 bytes on coded phy(S2), the scan_wd should be greater than 21ms.
1331  ****************************************************************************************
1332  */
1333 uint16_t ble_gap_ext_scan_param_set(gap_own_addr_t own_addr_type, gap_ext_scan_param_t* p_scan_param);
1334 
1335 /**
1336  ****************************************************************************************
1337  * @brief Start scanning
1338  *
1339  * @retval ::SDK_SUCCESS: Operation is successful.
1340  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1341  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1342  *
1343  * @note This API is asynchronous.
1344  * @note @ref gap_cb_fun_t::app_gap_adv_report_ind_cb will be called once the advertising report has been received.
1345  * @note @ref gap_cb_fun_t::app_gap_scan_stop_cb will be called once the scanning has been stopped.
1346  * @note @ref gap_cb_fun_t::app_gap_scan_start_cb will be called once the operation has completed.
1347  ****************************************************************************************
1348  */
1349 uint16_t ble_gap_scan_start(void);
1350 
1351 /**
1352  ****************************************************************************************
1353  * @brief Stop scanning
1354  *
1355  * @retval ::SDK_SUCCESS: Operation is successful.
1356  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1357  *
1358  * @note This API is asynchronous.
1359  * @note @ref gap_cb_fun_t::app_gap_scan_stop_cb will be called once the operation has completed or the scanning has been stopped.
1360  ****************************************************************************************
1361  */
1362 uint16_t ble_gap_scan_stop(void);
1363 
1364 /**
1365  ****************************************************************************************
1366  * @brief Set the parameters used for periodic sync.
1367  * @param[in] per_sync_idx: Periodic synchronization index (range is 0 to 4).
1368  * @param[in] p_per_sync_param: Periodic synchronization parameters.
1369  *
1370  * @retval ::SDK_SUCCESS: Operation is successful.
1371  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1372  * @retval ::SDK_ERR_INVALID_PER_SYNC_IDX: Invalid periodic syncronization index supplied.
1373  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1374  ****************************************************************************************
1375  */
1376 uint16_t ble_gap_per_sync_param_set(uint8_t per_sync_idx, gap_per_sync_param_t* p_per_sync_param);
1377 
1378 /**
1379  ****************************************************************************************
1380  * @brief Start to synchronize with periodic advertising from an advertiser and begin receiving periodic advertising packets.
1381  * @param[in] per_sync_idx: Periodic synchronization index (range is 0 to 4).
1382  *
1383  * @retval ::SDK_SUCCESS: Operation is successful.
1384  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1385  * @retval ::SDK_ERR_INVALID_PER_SYNC_IDX: Invalid periodic syncronization index supplied.
1386  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1387  *
1388  * @note This API is asynchronous.
1389  * @note @ref gap_cb_fun_t::app_gap_sync_establish_cb will be called once the periodic advertising synchronization has been established.
1390  ****************************************************************************************
1391  */
1392 uint16_t ble_gap_per_sync_start(uint8_t per_sync_idx);
1393 
1394 /**
1395  ****************************************************************************************
1396  * @brief Stop periodic synchronization.
1397  * @param[in] per_sync_idx: Periodic synchronization index (range is 0 to 4).
1398  *
1399  * @retval ::SDK_SUCCESS: Operation is successful.
1400  * @retval ::SDK_ERR_INVALID_PER_SYNC_IDX: Invalid periodic syncronization index supplied.
1401  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1402  *
1403  * @note This API is asynchronous.
1404  * @note @ref gap_cb_fun_t::app_gap_stop_sync_cb will be called once the operation has completed.
1405  ****************************************************************************************
1406  */
1407 uint16_t ble_gap_per_sync_stop(uint8_t per_sync_idx);
1408 
1409 /**
1410  ****************************************************************************************
1411  * @brief Start a legacy connection to a device.
1412  * @param[in] own_addr_type: Own BD address source of the local device.
1413  * @param[in] p_init_param: Initiate parameters.
1414  *
1415  * @retval ::SDK_SUCCESS: Operation is successful.
1416  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1417  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1418  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1419  *
1420  * @note This API is for legacy connection (BT Core Spec version <= 4.2).
1421  *
1422  * @note This API is asynchronous.
1423  * @note @ref gap_cb_fun_t::app_gap_connect_cb will be called once the operation has completed or the connection has been completed.
1424  * @note @ref gap_cb_fun_t::app_gap_peer_name_ind_cb will be called once the peer name has been got for the
1425  Name Discovery Procedure. See enum @ref GAP_INIT_TYPE_NAME_DISC of type @ref gap_init_type_t.
1426  ****************************************************************************************
1427  */
1428 uint16_t ble_gap_connect(gap_own_addr_t own_addr_type, gap_init_param_t* p_init_param);
1429 
1430 /**
1431  ****************************************************************************************
1432  * @brief Start an extended connection to a device.
1433  * @param[in] own_addr_type: Own BD address source of the local device.
1434  * @param[in] p_init_param: Initiate parameters.
1435  *
1436  * @retval ::SDK_SUCCESS: Operation is successful.
1437  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1438  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1439  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1440  *
1441  * @note This API is for extended connection (BT Core Spec version >= 5.0).
1442  *
1443  * @note This API is asynchronous.
1444  * @note @ref gap_cb_fun_t::app_gap_connect_cb will be called once the operation has completed or the connection has been completed.
1445  ****************************************************************************************
1446  */
1447 uint16_t ble_gap_ext_connect(gap_own_addr_t own_addr_type, gap_ext_init_param_t* p_init_param);
1448 
1449 /**
1450  ****************************************************************************************
1451  * @brief Cancel an initiated connection.
1452  *
1453  * @retval ::SDK_SUCCESS: Operation is successful.
1454  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1455  *
1456  * @note This API is asynchronous.
1457  * @note @ref gap_cb_fun_t::app_gap_connect_cancel_cb will be called once the operation has completed.
1458  ****************************************************************************************
1459  */
1460 uint16_t ble_gap_connect_cancel(void);
1461 
1462 /**
1463  ****************************************************************************************
1464  * @brief Set GAP appearance value.
1465  * @param[in] appearance: Appearance value.
1466  ****************************************************************************************
1467  */
1468 void ble_gap_appearance_set(uint16_t appearance);
1469 
1470 /**
1471  ****************************************************************************************
1472  * @brief Get GAP appearance value.
1473  * @param[out] p_appearance: The pointer to appearance value.
1474  *
1475  * @retval ::SDK_SUCCESS: Operation is successful.
1476  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1477  ****************************************************************************************
1478  */
1479 uint16_t ble_gap_appearance_get(uint16_t *p_appearance);
1480 
1481 /**
1482  ****************************************************************************************
1483  * @brief Set GAP Peripheral Preferred Connection Parameters present flag.
1484  *
1485  * @param[in] present_flag: Present or not.
1486  ****************************************************************************************
1487  */
1488 void ble_gap_ppcp_present_set(bool present_flag);
1489 
1490 /**
1491  ****************************************************************************************
1492  * @brief Set GAP Peripheral Preferred Connection Parameters.
1493  * @param[in] p_conn_params: The pointer to PPCP values.
1494  *
1495  * @retval ::SDK_SUCCESS: Operation is successful.
1496  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1497  ****************************************************************************************
1498  */
1499 uint16_t ble_gap_ppcp_set(gap_conn_param_t const *p_conn_params);
1500 
1501 /**
1502  ****************************************************************************************
1503  * @brief Get GAP Peripheral Preferred Connection Parameters.
1504  * @param[out] p_conn_params: The pointer to PPCP values.
1505  *
1506  * @retval ::SDK_SUCCESS: Operation is successful.
1507  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1508  ****************************************************************************************
1509  */
1510 uint16_t ble_gap_ppcp_get(gap_conn_param_t *p_conn_params);
1511 
1512 /**
1513  ****************************************************************************************
1514  * @brief Set GAP device name.
1515  * @param[in] write_perm: Write permissions of the device name characteristic.
1516  * @param[in] p_dev_name: The pointer to device name value. If p_dev_name is NULL, this function will only set write permissions of the device name.
1517  * @param[in] length: Device name length.
1518  *
1519  * @retval ::SDK_SUCCESS: Operation is successful.
1520  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
1521  ****************************************************************************************
1522  */
1523 uint16_t ble_gap_device_name_set(gap_dev_name_write_perm_t write_perm, uint8_t const *p_dev_name, uint16_t length);
1524 
1525 /**
1526  ****************************************************************************************
1527  * @brief Get GAP device name.
1528  * @param[out] p_dev_name: The pointer to device name value, set to NULL to obtain the complete device name length.
1529  * @param[in, out] p_length: Length of the buffer pointed by p_dev_name, complete device name length on output.
1530  *
1531  * @retval ::SDK_SUCCESS: Operation is successful.
1532  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1533  * @retval ::SDK_ERR_INVALID_DATA_LENGTH: Invalid data size(s) supplied.
1534  *
1535  * @note If device name was not set, the default device name "GOODIX_BLE" will be available.
1536  * @note If the device name is longer than the size of the supplied buffer,p_len will return the complete device name length,
1537  * and not the number of bytes actually returned in p_dev_name.
1538  * The application may use this information to allocate a suitable buffer size.
1539  ****************************************************************************************
1540  */
1541 uint16_t ble_gap_device_name_get(uint8_t *p_dev_name, uint16_t *p_length);
1542 
1543 /**
1544  ****************************************************************************************
1545  * @brief Register a LE Protocol/Service Multiplexer.
1546  * @param[in] p_lepsm: The lepsm information to be registerred.
1547  *
1548  * @retval ::SDK_SUCCESS: Operation is successful.
1549  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
1550  * @retval ::SDK_ERR_INVALID_PSM_NUM: Invalid psm number.
1551  * @retval ::SDK_ERR_INVALID_PSM_EXCEEDED_MAX_PSM_NUM: The maximum psm number limit is exceeded.
1552  * @retval ::SDK_ERR_INVALID_PSM_ALREADY_REGISTERED: The psm number has been registered.
1553  *
1554  * @note This API is asynchronous.
1555  * @ref gap_cb_fun_t::app_gap_psm_manager_cb callback with op_id: @ref GAP_OPCODE_LEPSM_REGISTER will be called.
1556  ****************************************************************************************
1557  */
1559 
1560 /**
1561  ****************************************************************************************
1562  * @brief Unregister a LE Protocol/Service Multiplexer.
1563  * @param[in] le_psm: LE Protocol/Service Multiplexer (1 to 255).
1564  *
1565  * @retval ::SDK_SUCCESS: Operation is successful.
1566  * @retval ::SDK_ERR_INVALID_PSM_NUM: Invalid psm number.
1567  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1568  *
1569  * @note This API is asynchronous.
1570  * @note app_gap_psm_manager_cb will be called once the operation has completed,
1571  * @ref gap_cb_fun_t::app_gap_psm_manager_cb callback with op_id: @ref GAP_OPCODE_LEPSM_UNREGISTER will be called.
1572  ****************************************************************************************
1573  */
1574 uint16_t ble_gap_lepsm_unregister(uint16_t le_psm);
1575 
1576 /**
1577  ****************************************************************************************
1578  * @brief Set privacy mode for peer device.
1579  * @param[in] peer_addr: The peer address.
1580  * @param[in] mode: Privacy mode (see @ref privacy_mode_t).
1581  *
1582  * @retval ::SDK_SUCCESS: Operation is successful.
1583  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
1584  * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed.
1585  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
1586  *
1587  ****************************************************************************************
1588  */
1590 
1591 /**
1592  ****************************************************************************************
1593  * @brief Read peer or local resolvable address.
1594  * @param[in] op_code: The operation code (see @ref gap_rslv_addr_read_op_id_t).
1595  * @param[in] peer_iden_addr: The peer identity address.
1596  *
1597  * @retval ::SDK_SUCCESS: Operation is successful.
1598  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
1599  *
1600  ****************************************************************************************
1601  */
1603 
1604 /** @} */
1605 
1606 #endif
1607 /** @} */
1608 
1609 /** @} */
1610 /** @} */
BLE_GAP_AD_TYPE_SP_RANDOMIZER_R
@ BLE_GAP_AD_TYPE_SP_RANDOMIZER_R
Simple Pairing Randomizer.
Definition: ble_gapm.h:447
BLE_GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID
@ BLE_GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID
Complete List of 16-bit UUID.
Definition: ble_gapm.h:437
gap_ext_scan_param_t::duration
uint16_t duration
Scan duration (in unit of 10ms).
Definition: ble_gapm.h:628
BLE_GAP_AD_TYPE_SERVICE_32_BIT_DATA
@ BLE_GAP_AD_TYPE_SERVICE_32_BIT_DATA
Service data 32-bit UUID.
Definition: ble_gapm.h:455
BLE_GAP_GET_MAX_LE_DATA_LEN
@ BLE_GAP_GET_MAX_LE_DATA_LEN
Get the Controller' maximum supported payload octets and packet duration times for transmission and r...
Definition: ble_gapm.h:214
ble_gap_pref_phy_set
void ble_gap_pref_phy_set(uint8_t tx_pref_phy, uint8_t rx_pref_phy)
Set the preferred values for the transmitter PHY and receiver PHY.
gap_adv_second_cfg_t
Configuration for advertising on secondary channel.
Definition: ble_gapm.h:541
gap_adv_time_param_t::duration
uint16_t duration
Advertising duration (in unit of 10ms).
Definition: ble_gapm.h:578
ble_gap_addr_get
uint16_t ble_gap_addr_get(gap_bdaddr_t *p_addr)
Get the device identity address (public or random static).
gap_period_adv_addr_cfg_t
Periodic advertising information.
Definition: ble_gapm.h:638
gap_init_param_t::sup_timeout
uint16_t sup_timeout
Link supervision timeout (in unit of 10ms).
Definition: ble_gapm.h:668
BLE_GAP_WRITE_PERM_DISABLE
@ BLE_GAP_WRITE_PERM_DISABLE
Disable write access.
Definition: ble_gapm.h:187
GAP_DISC_MODE_LIM_DISCOVERABLE
@ GAP_DISC_MODE_LIM_DISCOVERABLE
Limited-discoverable mode.
Definition: ble_gapm.h:238
BLE_GAP_AD_TYPE_FLAGS
@ BLE_GAP_AD_TYPE_FLAGS
Flag.
Definition: ble_gapm.h:435
BLE_GAP_AD_TYPE_SERVICE_16_BIT_DATA
@ BLE_GAP_AD_TYPE_SERVICE_16_BIT_DATA
Service data 16-bit UUID.
Definition: ble_gapm.h:454
gap_ext_conn_param_t::supervision_to
uint16_t supervision_to
Link supervision timeout (in unit of 10ms).
Definition: ble_gapm.h:685
GAP_EXT_SCAN_PROP_ACTIVE_1M_BIT
@ GAP_EXT_SCAN_PROP_ACTIVE_1M_BIT
Active scan on LE 1M PHY (scan request PDUs may be sent).
Definition: ble_gapm.h:361
gap_ext_adv_param_t::peer_addr
gap_bdaddr_t peer_addr
Peer address configuration (only used in case of directed advertising or used to locate the IRK list)...
Definition: ble_gapm.h:567
PRIVACY_MODE_DEVICE
@ PRIVACY_MODE_DEVICE
Set to the device privacy mode for the peer device.
Definition: ble_gapm.h:489
gap_ext_adv_param_t::disc_mode
uint8_t disc_mode
Discovery mode (see enum gap_disc_mode_t).
Definition: ble_gapm.h:563
BLE_GAP_AD_TYPE_LE_ROLE
@ BLE_GAP_AD_TYPE_LE_ROLE
LE Role.
Definition: ble_gapm.h:462
GAP_PHY_CODED_VALUE
@ GAP_PHY_CODED_VALUE
LE Coded PHY.
Definition: ble_gapm.h:261
gap_ext_init_param_t::conn_param_1m
gap_ext_conn_param_t conn_param_1m
Connection parameters for LE 1M PHY.
Definition: ble_gapm.h:701
BLE_GAP_AD_TYPE_ADV_INTV
@ BLE_GAP_AD_TYPE_ADV_INTV
Advertising Interval.
Definition: ble_gapm.h:460
GAP_SCAN_LIM_DISC_MODE
@ GAP_SCAN_LIM_DISC_MODE
Limited discoverable mode.
Definition: ble_gapm.h:328
ble_gap_scan_start
uint16_t ble_gap_scan_start(void)
Start scanning.
PRIVACY_MODE_NETWORK
@ PRIVACY_MODE_NETWORK
Set to the network privacy mode for the peer device.
Definition: ble_gapm.h:488
gap_ext_conn_param_t::conn_intv_max
uint16_t conn_intv_max
Maximum value for the connection interval (in unit of 1.25ms).
Definition: ble_gapm.h:682
GAP_INIT_PROP_1M_BIT
@ GAP_INIT_PROP_1M_BIT
Scan connectable advertisements on the LE 1M PHY.
Definition: ble_gapm.h:392
GAP_INIT_PROP_CODED_BIT
@ GAP_INIT_PROP_CODED_BIT
Scan connectable advertisements on the LE Coded PHY.
Definition: ble_gapm.h:394
ble_gap_irk_set
uint16_t ble_gap_irk_set(gap_sec_key_t *p_irk)
Set IRK used for resolvable random BD address generation (LSB first).
ble_gap_dev_info_get
uint16_t ble_gap_dev_info_get(gap_dev_info_get_type_t type)
Get the device information according to param type.
GAP_ADV_PROP_SCAN_REQ_NTF_EN_POS
@ GAP_ADV_PROP_SCAN_REQ_NTF_EN_POS
Indicate if application must be informed about receiving scan request PDUs.
Definition: ble_gapm.h:294
GAP_SCAN_ACTIVE
@ GAP_SCAN_ACTIVE
Active scan type.
Definition: ble_gapm.h:318
gap_adv_param_t::disc_mode
uint8_t disc_mode
Discovery mode (see enum gap_disc_mode_t).
Definition: ble_gapm.h:514
period_adv_list_t::num
uint8_t num
Number of available items.
Definition: ble_gapm.h:740
BLE_GAP_AD_TYPE_COMPLETE_NAME
@ BLE_GAP_AD_TYPE_COMPLETE_NAME
Complete Device name.
Definition: ble_gapm.h:443
GAP_SCAN_OBSERVER_MODE
@ GAP_SCAN_OBSERVER_MODE
Observer mode.
Definition: ble_gapm.h:329
gap_scan_param_t::scan_mode
gap_scan_mode_t scan_mode
Scan mode.
Definition: ble_gapm.h:600
gap_init_param_t::type
uint8_t type
Initiating type (see enum gap_init_type_t).
Definition: ble_gapm.h:661
ble_gap_privacy_mode_set
uint16_t ble_gap_privacy_mode_set(gap_bdaddr_t peer_addr, privacy_mode_t mode)
Set privacy mode for peer device.
GAP_INIT_PROP_2M_BIT
@ GAP_INIT_PROP_2M_BIT
Connection parameters for the LE 2M PHY are provided.
Definition: ble_gapm.h:393
gap_scan_param_t
Parameters for legacy scanning.
Definition: ble_gapm.h:598
gap_own_addr_t
gap_own_addr_t
Own BD address source of the device.
Definition: ble_gapm.h:176
gap_adv_mode_t
gap_adv_mode_t
GAP advertising modes.
Definition: ble_gapm.h:225
BLE_GAP_AD_TYPE_SHORTENED_NAME
@ BLE_GAP_AD_TYPE_SHORTENED_NAME
Shortened Device name.
Definition: ble_gapm.h:442
GAP_ADV_PROP_USE_LEGACY_PDUS_BIT
@ GAP_ADV_PROP_USE_LEGACY_PDUS_BIT
Definition: ble_gapm.h:306
GAP_EXT_SCAN_TYPE_SEL_OBSERVER
@ GAP_EXT_SCAN_TYPE_SEL_OBSERVER
Selective observer.
Definition: ble_gapm.h:349
BLE_GAP_GET_SUGGESTED_DFLT_LE_DATA_LEN
@ BLE_GAP_GET_SUGGESTED_DFLT_LE_DATA_LEN
Get suggested values (SuggestedMaxTxOctets and SuggestedMaxTxTime) for the Controller's maximum trans...
Definition: ble_gapm.h:211
gap_adv_param_t::scan_req_ind_en
bool scan_req_ind_en
Indicate if the application should be informed when receiving a scan request from the scanner.
Definition: ble_gapm.h:520
gap_adv_second_cfg_t::adv_sid
uint8_t adv_sid
Advertising SID.
Definition: ble_gapm.h:545
GAP_SEC_LVL_SC_ENC_AUTH
@ GAP_SEC_LVL_SC_ENC_AUTH
Security connection encryption with auth.
Definition: ble_gapm.h:427
GAP_ADV_PROP_SCAN_REQ_NTF_EN_BIT
@ GAP_ADV_PROP_SCAN_REQ_NTF_EN_BIT
Definition: ble_gapm.h:310
ble_gap_connect_cancel
uint16_t ble_gap_connect_cancel(void)
Cancel an initiated connection.
ble_gap_connect
uint16_t ble_gap_connect(gap_own_addr_t own_addr_type, gap_init_param_t *p_init_param)
Start a legacy connection to a device.
BLE_GAP_AD_TYPE_MORE_128_BIT_UUID
@ BLE_GAP_AD_TYPE_MORE_128_BIT_UUID
Use of more than 128-bit UUID.
Definition: ble_gapm.h:440
ble_gap_chnl_map_set
uint16_t ble_gap_chnl_map_set(gap_chnl_map_t *p_chnl_map)
Set advertising channel map before advertising starts.
BLE_GAP_AD_TYPE_SPAIR_RAND
@ BLE_GAP_AD_TYPE_SPAIR_RAND
Simple Pairing Randomizer R-256.
Definition: ble_gapm.h:464
GAP_INIT_TYPE_DIRECT_CONN_EST
@ GAP_INIT_TYPE_DIRECT_CONN_EST
Direct connection establishment: establish a connection with an indicated device.
Definition: ble_gapm.h:382
gap_period_adv_addr_cfg_t::adv_sid
uint8_t adv_sid
Advertising SID.
Definition: ble_gapm.h:640
ble_gap_pair_enable
void ble_gap_pair_enable(bool enable)
Decide whether to support the pair feature.
GAP_SCAN_FILT_DUPLIC_EN
@ GAP_SCAN_FILT_DUPLIC_EN
Enable filtering of duplicate packets.
Definition: ble_gapm.h:338
gap_ext_scan_param_t::rsvd
uint8_t rsvd
Reserved for future use.
Definition: ble_gapm.h:625
BLE_GAP_ROLE_CENTRAL
@ BLE_GAP_ROLE_CENTRAL
Master/Central role.
Definition: ble_gapm.h:167
gap_ext_init_param_t::peer_addr
gap_bdaddr_t peer_addr
Address of peer device in case white list is not used for connection.
Definition: ble_gapm.h:704
gap_ext_init_param_t::scan_param_coded
gap_scan_wd_op_param_t scan_param_coded
Scan window opening parameters for LE Coded PHY.
Definition: ble_gapm.h:700
ble_gap_rslv_addr_read
uint16_t ble_gap_rslv_addr_read(gap_rslv_addr_read_op_id_t op_code, gap_bdaddr_t peer_iden_addr)
Read peer or local resolvable address.
BLE_GAP_OWN_ADDR_GEN_RSLV
@ BLE_GAP_OWN_ADDR_GEN_RSLV
Generated resolvable private random address.
Definition: ble_gapm.h:178
gap_ext_scan_param_t::dup_filt_pol
uint8_t dup_filt_pol
Duplicate packet filtering policy (see enum gap_ext_scan_dup_filt_policy_t).
Definition: ble_gapm.h:624
gap_adv_prop_t
gap_adv_prop_t
Advertising properties bit field bit value.
Definition: ble_gapm.h:301
GAP_ADV_PROP_CONNECTABLE_BIT
@ GAP_ADV_PROP_CONNECTABLE_BIT
Definition: ble_gapm.h:302
ble_gap_whitelist_add
uint16_t ble_gap_whitelist_add(const white_list_t *p_whitelist)
Add the devices into current white list.
GAP_EXT_SCAN_TYPE_SEL_CONN_DISC
@ GAP_EXT_SCAN_TYPE_SEL_CONN_DISC
Selective connectable discovery.
Definition: ble_gapm.h:351
BLE_GAP_ROLE_PERIPHERAL
@ BLE_GAP_ROLE_PERIPHERAL
Peripheral/Slave role.
Definition: ble_gapm.h:168
GAP_SCAN_GEN_DISC_MODE
@ GAP_SCAN_GEN_DISC_MODE
General discoverable mode.
Definition: ble_gapm.h:327
GAP_DISC_MODE_GEN_DISCOVERABLE
@ GAP_DISC_MODE_GEN_DISCOVERABLE
General-discoverable mode.
Definition: ble_gapm.h:237
ble_gap_scan_param_set
uint16_t ble_gap_scan_param_set(gap_own_addr_t own_addr_type, gap_scan_param_t *p_scan_param)
Set parameters for scanning.
ble_gap_bond_devs_clear
uint16_t ble_gap_bond_devs_clear(void)
Clear all bonded devices.
GAP_EXT_DUP_FILT_DIS
@ GAP_EXT_DUP_FILT_DIS
Disable filtering of duplicated packets.
Definition: ble_gapm.h:372
bond_dev_list_t::num
uint8_t num
Number of bonded device.
Definition: ble_gapm.h:722
gap_ext_conn_param_t
Connection parameters.
Definition: ble_gapm.h:679
BLE_GAP_ADV_DATA_TYPE_SCAN_RSP
@ BLE_GAP_ADV_DATA_TYPE_SCAN_RSP
Scan response data.
Definition: ble_gapm.h:200
ble_gap_data_length_set
uint16_t ble_gap_data_length_set(uint16_t sugg_max_tx_octet, uint16_t sugg_max_tx_time)
Set suggested default LE data length.
BLE_GAP_AD_TYPE_COMPLETE_LIST_128_BIT_UUID
@ BLE_GAP_AD_TYPE_COMPLETE_LIST_128_BIT_UUID
Complete List of 128-bit UUID.
Definition: ble_gapm.h:441
gap_scan_type_t
gap_scan_type_t
Scanning types.
Definition: ble_gapm.h:317
BLE_GAP_AD_TYPE_COMPLETE_LIST_32_BIT_UUID
@ BLE_GAP_AD_TYPE_COMPLETE_LIST_32_BIT_UUID
Complete List of 32-bit UUID.
Definition: ble_gapm.h:439
gap_chnl_map_t
Channel map structure.
Definition: ble_gapc.h:392
gap_init_type_t
gap_init_type_t
Initiating types.
Definition: ble_gapm.h:381
GAP_ADV_FLAG_LE_GENERAL_DISC_MODE
@ GAP_ADV_FLAG_LE_GENERAL_DISC_MODE
General discovery flag: AD Flag.
Definition: ble_gapm.h:476
gap_scan_dup_filt_policy_t
gap_scan_dup_filt_policy_t
Duplicate filter policy.
Definition: ble_gapm.h:336
gap_adv_param_t::adv_intv_max
uint16_t adv_intv_max
Maximum advertising interval (in unit of 625 us).
Definition: ble_gapm.h:518
ble_gap_default_tx_power_get
uint16_t ble_gap_default_tx_power_get(int8_t *txpwr_dbm)
Get the default tx power for all roles.
GAP_ADV_FLAG_LE_LIMITED_DISC_MODE
@ GAP_ADV_FLAG_LE_LIMITED_DISC_MODE
Limited discovery flag: AD Flag.
Definition: ble_gapm.h:475
GAP_INIT_TYPE_NAME_DISC
@ GAP_INIT_TYPE_NAME_DISC
Name discovery: establish a connection with an indicated device in order to read content of its devic...
Definition: ble_gapm.h:384
gap_init_param_t::conn_timeout
uint16_t conn_timeout
Timeout for connection establishment (in unit of 10ms).
Definition: ble_gapm.h:669
BLE_GAP_GET_DEV_VERSION
@ BLE_GAP_GET_DEV_VERSION
Get version information for the local Controller.
Definition: ble_gapm.h:208
gap_ext_init_param_t::prop
uint8_t prop
Properties for the initiating procedure (see enum gap_init_prop_t for bit signification).
Definition: ble_gapm.h:695
gap_ext_scan_param_t::scan_param_coded
gap_scan_wd_op_param_t scan_param_coded
Scan window opening parameters for LE Coded PHY.
Definition: ble_gapm.h:627
gap_disc_mode_t
gap_disc_mode_t
GAP discoverability modes.
Definition: ble_gapm.h:235
GAP_INIT_TYPE_AUTO_CONN_EST
@ GAP_INIT_TYPE_AUTO_CONN_EST
Automatic connection establishment: establish a connection with all devices whose address is present ...
Definition: ble_gapm.h:383
GAP_SCAN_PASSIVE
@ GAP_SCAN_PASSIVE
Passive scan type.
Definition: ble_gapm.h:319
GAP_SEC_LVL_LE_ENC_AUTH
@ GAP_SEC_LVL_LE_ENC_AUTH
Legacy encryption with auth.
Definition: ble_gapm.h:426
ble_gap_bond_devs_get
uint16_t ble_gap_bond_devs_get(bond_dev_list_t *p_bond_list)
Get all bonded devices.
GAP_ADV_PROP_TX_PWR_POS
@ GAP_ADV_PROP_TX_PWR_POS
Include TX power in the extended header of the advertising PDU.
Definition: ble_gapm.h:290
gap_adv_period_cfg_t::adv_intv_max
uint16_t adv_intv_max
Maximum advertising interval (in unit of 1.25 ms).
Definition: ble_gapm.h:554
gap_ext_conn_param_t::conn_latency
uint16_t conn_latency
Slave latency.
Definition: ble_gapm.h:684
GAP_PER_SYNC_TYPE_GENERAL
@ GAP_PER_SYNC_TYPE_GENERAL
Do not use periodic advertiser list for synchronization.
Definition: ble_gapm.h:415
gap_adv_param_t::max_tx_pwr
int8_t max_tx_pwr
Maximum power level at which the advertising packets have to be transmitted (between -20dbm and 7dbm)...
Definition: ble_gapm.h:521
GAP_SEC_LVL_NO_SECURITY
@ GAP_SEC_LVL_NO_SECURITY
No encryption or auth.
Definition: ble_gapm.h:424
gap_sec_lvl_type
gap_sec_lvl_type
Security level types.
Definition: ble_gapm.h:423
white_list_t
White list.
Definition: ble_gapm.h:730
ble_gap_ext_scan_param_set
uint16_t ble_gap_ext_scan_param_set(gap_own_addr_t own_addr_type, gap_ext_scan_param_t *p_scan_param)
Set extended parameters for scanning.
BLE_GAP_WRITE_PERM_NOAUTH
@ BLE_GAP_WRITE_PERM_NOAUTH
LE Security Mode 1, Level 1.
Definition: ble_gapm.h:188
GAP_DISC_MODE_NON_DISCOVERABLE
@ GAP_DISC_MODE_NON_DISCOVERABLE
Non-discoverable mode.
Definition: ble_gapm.h:236
gap_ext_conn_param_t::conn_intv_min
uint16_t conn_intv_min
Minimum value for the connection interval (in unit of 1.25ms).
Definition: ble_gapm.h:680
ble_gap_per_sync_start
uint16_t ble_gap_per_sync_start(uint8_t per_sync_idx)
Start to synchronize with periodic advertising from an advertiser and begin receiving periodic advert...
BLE_GAP_GET_DEV_RF_RF_PATH_COMP
@ BLE_GAP_GET_DEV_RF_RF_PATH_COMP
Get RF path compensation values.
Definition: ble_gapm.h:220
gap_ext_adv_param_t::prop
uint16_t prop
Bit field value provided by advertising properties.
Definition: ble_gapm.h:564
gap_adv_prim_cfg_t::adv_intv_min
uint32_t adv_intv_min
Minimum advertising interval (in unit of 625 us).
Definition: ble_gapm.h:530
gap_adv_type_t
gap_adv_type_t
Advertising type.
Definition: ble_gapm.h:268
gap_ext_scan_param_t::prop
uint8_t prop
Properties for the scan procedure (see enum gap_scan_prop for bit signification).
Definition: ble_gapm.h:623
gap_bdaddr_t
The struct of broadcast address with broadcast type.
Definition: ble_gapc.h:212
BLE_GAP_AD_TYPE_MORE_32_BIT_UUID
@ BLE_GAP_AD_TYPE_MORE_32_BIT_UUID
Use of more than 32-bit UUD.
Definition: ble_gapm.h:438
GAP_ADV_PROP_SCANNABLE_BIT
@ GAP_ADV_PROP_SCANNABLE_BIT
Definition: ble_gapm.h:303
gap_activity_role_t
gap_activity_role_t
Possible roles of the activity.
Definition: ble_gapm.h:496
gap_scan_prop
gap_scan_prop
Scanning properties bit field bit value.
Definition: ble_gapm.h:401
period_adv_list_t
Periodic advertising list.
Definition: ble_gapm.h:739
gap_init_param_t::interval_min
uint16_t interval_min
Minimum value for the connection interval (in unit of 1.25ms).
Definition: ble_gapm.h:663
gap_per_sync_param_t::type
uint8_t type
Periodic synchronization type (see enum gap_per_sync_type).
Definition: ble_gapm.h:651
BLE_GAP_ADV_DATA_TYPE_DATA
@ BLE_GAP_ADV_DATA_TYPE_DATA
Advertising data.
Definition: ble_gapm.h:199
ble_gap_tx_power_get
uint16_t ble_gap_tx_power_get(gap_activity_role_t role, uint8_t index, int8_t *txpwr_dbm)
Get the tx power.
BLE_GAP_AD_TYPE_TRANSMIT_POWER
@ BLE_GAP_AD_TYPE_TRANSMIT_POWER
Transmit power.
Definition: ble_gapm.h:444
gap_ext_adv_param_t::type
uint8_t type
Advertising type (see enum gap_adv_type_t).
Definition: ble_gapm.h:562
GAP_ADV_PROP_PER_TX_PWR_POS
@ GAP_ADV_PROP_PER_TX_PWR_POS
Include TX power in the periodic advertising PDU.
Definition: ble_gapm.h:292
GAP_SEC_LVL_ENC_NO_AUTH
@ GAP_SEC_LVL_ENC_NO_AUTH
Encryption with no auth.
Definition: ble_gapm.h:425
gap_scan_wd_op_param_t
Scan Window operation parameters.
Definition: ble_gapm.h:612
GAP_ACTIVITY_ROLE_ADV
@ GAP_ACTIVITY_ROLE_ADV
Adertise role.
Definition: ble_gapm.h:497
gap_adv_prop_pos_t
gap_adv_prop_pos_t
Advertising properties bit field and bit positions.
Definition: ble_gapm.h:278
gap_lepsm_register_t::sec_lvl
uint8_t sec_lvl
Security level requirement, see gap_sec_lvl_type.
Definition: ble_gapm.h:713
CO_BIT
#define CO_BIT(pos)
Bit operation helper.
Definition: ble_gapm.h:72
BLE_GAP_AD_TYPE_APPEARANCE
@ BLE_GAP_AD_TYPE_APPEARANCE
Appearance.
Definition: ble_gapm.h:459
gap_dev_name_write_perm_t
gap_dev_name_write_perm_t
Write permissions of the device name characteristic.
Definition: ble_gapm.h:186
gap_adv_param_t
Advertising parameters for legacy advertising.
Definition: ble_gapm.h:512
ble_gap_per_sync_param_set
uint16_t ble_gap_per_sync_param_set(uint8_t per_sync_idx, gap_per_sync_param_t *p_per_sync_param)
Set the parameters used for periodic sync.
ble_gap_addr_set
uint16_t ble_gap_addr_set(gap_bdaddr_t const *p_addr)
Set the device identity address (public or random static).
GAP_SCAN_PROP_ACTIVE_1M_BIT
@ GAP_SCAN_PROP_ACTIVE_1M_BIT
Active scan on LE 1M PHY (scan request PDUs may be sent).
Definition: ble_gapm.h:404
gap_adv_second_cfg_t::max_skip
uint8_t max_skip
Maximum number of advertising events the controller can skip before sending the AUX_ADV_IND packets.
Definition: ble_gapm.h:542
BLE_GAP_GET_DEV_BDADDR
@ BLE_GAP_GET_DEV_BDADDR
Get local device BD Address.
Definition: ble_gapm.h:209
ble_gap_per_sync_stop
uint16_t ble_gap_per_sync_stop(uint8_t per_sync_idx)
Stop periodic synchronization.
MAX_PRD_ADV_NUM
#define MAX_PRD_ADV_NUM
Maximal periodic advertising list number.
Definition: ble_gapm.h:81
ble_gap_path_compensation_set
uint16_t ble_gap_path_compensation_set(int16_t tx_path_comp, int16_t rx_path_comp)
Set the RF path gain or loss between the RF transceiver and the antenna contributed by intermediate c...
gap_adv_time_param_t::max_adv_evt
uint8_t max_adv_evt
Maximum number of extended advertising events.
Definition: ble_gapm.h:582
GAP_ADV_PROP_TX_PWR_BIT
@ GAP_ADV_PROP_TX_PWR_BIT
Definition: ble_gapm.h:308
GAP_EXT_DUP_FILT_EN
@ GAP_EXT_DUP_FILT_EN
Enable filtering of duplicated packets.
Definition: ble_gapm.h:373
BLE_GAP_OWN_ADDR_GEN_NON_RSLV
@ BLE_GAP_OWN_ADDR_GEN_NON_RSLV
Generated non-resolvable private random address.
Definition: ble_gapm.h:179
ble_gap_whitelist_get
uint16_t ble_gap_whitelist_get(white_list_t *p_whitelist)
Get the content of the whole white list.
gap_role_t
gap_role_t
GAP role options.
Definition: ble_gapm.h:163
ble_error.h
File that contains error codes.
ble_gapc.h
BLE GAPC API.
gap_scan_param_t::interval
uint16_t interval
Scan interval between 0x0004 and 0x4000 in 0.625 ms (range: 2.5 ms to 10.24s).
Definition: ble_gapm.h:603
gap_ext_scan_param_t::period
uint16_t period
Scan period, which is the time interval between two consequent starts of a scan duration by the contr...
Definition: ble_gapm.h:630
gap_adv_second_cfg_t::phy
gap_le_phy_value_t phy
Indicate on which PHY secondary advertising has to be performed.
Definition: ble_gapm.h:544
BLE_GAP_WRITE_PERM_AUTH
@ BLE_GAP_WRITE_PERM_AUTH
LE Security Mode 1, Level 3.
Definition: ble_gapm.h:190
GAP_SCAN_FILT_DUPLIC_DIS
@ GAP_SCAN_FILT_DUPLIC_DIS
Disable filtering of duplicate packets.
Definition: ble_gapm.h:337
BLE_GAP_WRITE_PERM_SEC_CON
@ BLE_GAP_WRITE_PERM_SEC_CON
LE Security Mode 1, Level 4.
Definition: ble_gapm.h:191
BLE_GAP_GET_NB_ADV_SETS
@ BLE_GAP_GET_NB_ADV_SETS
Read the maximum number of advertising sets currently supported by the controller.
Definition: ble_gapm.h:217
gap_le_phy_value_t
gap_le_phy_value_t
Specify what PHY the Controller has changed for TX/RX.
Definition: ble_gapm.h:257
GAP_PHY_UNDEF_VALUE
@ GAP_PHY_UNDEF_VALUE
Undefined LE PHY.
Definition: ble_gapm.h:258
BLE_GAP_AD_TYPE_SLAVE_CONN_INT_RANGE
@ BLE_GAP_AD_TYPE_SLAVE_CONN_INT_RANGE
Slave connection interval range.
Definition: ble_gapm.h:450
GAP_EXT_SCAN_PROP_PHY_CODED_BIT
@ GAP_EXT_SCAN_PROP_PHY_CODED_BIT
Scan advertisement on the LE Coded PHY.
Definition: ble_gapm.h:360
gap_adv_data_type_t
gap_adv_data_type_t
Advertising data type.
Definition: ble_gapm.h:198
BLE_GAP_AD_TYPE_LE_BT_ADDR
@ BLE_GAP_AD_TYPE_LE_BT_ADDR
LE Bluetooth Device Address.
Definition: ble_gapm.h:461
gap_ext_adv_param_t::second_cfg
gap_adv_second_cfg_t second_cfg
Configuration for secondary advertising (valid only if advertising type is GAP_ADV_TYPE_EXTENDED or G...
Definition: ble_gapm.h:569
GAP_ADV_TYPE_EXTENDED
@ GAP_ADV_TYPE_EXTENDED
Extended advertising.
Definition: ble_gapm.h:270
GAP_ADV_FLAG_SIMUL_BR_EDR_LE_CONTROLLER
@ GAP_ADV_FLAG_SIMUL_BR_EDR_LE_CONTROLLER
Dual mode for controller supported (BR/EDR/LE): AD Flag.
Definition: ble_gapm.h:478
gap_adv_prim_cfg_t::adv_intv_max
uint32_t adv_intv_max
Maximum advertising interval (in unit of 625 us).
Definition: ble_gapm.h:531
gap_adv_filter_policy_t
gap_adv_filter_policy_t
Advertising filter policy.
Definition: ble_gapm.h:246
gap_adv_param_t::adv_intv_min
uint16_t adv_intv_min
Minimum advertising interval (in unit of 625 us).
Definition: ble_gapm.h:517
gap_adv_time_param_t
Advertising timing parameter.
Definition: ble_gapm.h:577
gap_scan_param_t::window
uint16_t window
Scan window between 0x0004 and 0x4000 in 0.625 ms (range: 2.5 ms to 10.24s).
Definition: ble_gapm.h:604
ble_gap_scan_stop
uint16_t ble_gap_scan_stop(void)
Stop scanning.
BLE_GAP_AD_TYPE_SERVICE_128_BIT_DATA
@ BLE_GAP_AD_TYPE_SERVICE_128_BIT_DATA
Service data 128-bit UUID.
Definition: ble_gapm.h:456
gap_init_param_t
Legacy initiating parameters.
Definition: ble_gapm.h:660
gap_per_sync_param_t::skip
uint16_t skip
Number of periodic advertising that can be skipped after a successful reception.
Definition: ble_gapm.h:648
ble_gap_ppcp_present_set
void ble_gap_ppcp_present_set(bool present_flag)
Set GAP Peripheral Preferred Connection Parameters present flag.
GAP_EXT_SCAN_TYPE_CONN_DISC
@ GAP_EXT_SCAN_TYPE_CONN_DISC
Connectable discovery.
Definition: ble_gapm.h:350
BLE_GAP_ROLE_OBSERVER
@ BLE_GAP_ROLE_OBSERVER
Observer role.
Definition: ble_gapm.h:165
GAP_EXT_SCAN_PROP_PHY_1M_BIT
@ GAP_EXT_SCAN_PROP_PHY_1M_BIT
Scan advertisement on the LE 1M PHY.
Definition: ble_gapm.h:359
gap_init_prop_t
gap_init_prop_t
Initiating properties.
Definition: ble_gapm.h:391
BLE_GAP_ROLE_ALL
@ BLE_GAP_ROLE_ALL
Device has all roles, both peripheral and central.
Definition: ble_gapm.h:169
ral_dev_list_t::num
uint8_t num
Number of RPA list.
Definition: ble_gapm.h:760
GAP_ADV_PROP_HDC_BIT
@ GAP_ADV_PROP_HDC_BIT
Definition: ble_gapm.h:305
GAP_EXT_SCAN_PROP_ACTIVE_CODED_BIT
@ GAP_EXT_SCAN_PROP_ACTIVE_CODED_BIT
Active scan on LE Coded PHY (scan request PDUs may be sent).
Definition: ble_gapm.h:362
GAP_SCAN_PROP_ACTIVE_CODED_BIT
@ GAP_SCAN_PROP_ACTIVE_CODED_BIT
Active scan on LE Coded PHY (scan request PDUs may be sent).
Definition: ble_gapm.h:405
GAP_SCAN_PROP_ACCEPT_RPA_BIT
@ GAP_SCAN_PROP_ACCEPT_RPA_BIT
Accept directed advertising packets if the used RPA and target address cannot be solved by the contro...
Definition: ble_gapm.h:406
gap_adv_prim_cfg_t::chnl_map
uint8_t chnl_map
Bit field indicating the channel map.
Definition: ble_gapm.h:532
gap_per_sync_param_t::adv_addr
gap_period_adv_addr_cfg_t adv_addr
Address of advertiser with which synchronization has to be established(used only if use_pal is false)...
Definition: ble_gapm.h:653
ble_gap_l2cap_params_set
uint16_t ble_gap_l2cap_params_set(uint16_t max_mtu, uint16_t max_mps, uint8_t max_nb_lecb)
Set L2CAP related parameters.
gap_per_sync_param_t::sync_to
uint16_t sync_to
Synchronization timeout for the periodic advertising (in unit of 10ms between 100ms and 163....
Definition: ble_gapm.h:650
ble_gap_per_adv_list_get
uint16_t ble_gap_per_adv_list_get(period_adv_list_t *p_pal_list)
Get the content of the whole periodic advertising list.
BLE_GAP_AD_TYPE_TK_VALUE
@ BLE_GAP_AD_TYPE_TK_VALUE
Temporary key value.
Definition: ble_gapm.h:448
BLE_GAP_AD_TYPE_RAND_TGT_ADDR
@ BLE_GAP_AD_TYPE_RAND_TGT_ADDR
Random Target Address.
Definition: ble_gapm.h:458
GAP_ADV_PROP_DIRECTED_POS
@ GAP_ADV_PROP_DIRECTED_POS
Indicate that advertising targets at a specific device.
Definition: ble_gapm.h:282
gap_adv_period_cfg_t
Configuration for periodic advertising.
Definition: ble_gapm.h:552
gap_ext_adv_param_t::filter_pol
uint8_t filter_pol
Advertising filtering policy (see enum gap_adv_filter_policy_t).
Definition: ble_gapm.h:566
GAP_SCAN_PROP_PHY_1M_BIT
@ GAP_SCAN_PROP_PHY_1M_BIT
Scan advertisement on the LE 1M PHY.
Definition: ble_gapm.h:402
GAP_ADV_PROP_ANONYMOUS_POS
@ GAP_ADV_PROP_ANONYMOUS_POS
Enable anonymous mode.
Definition: ble_gapm.h:288
GAP_ADV_TYPE_ADV_NONCONN_IND
@ GAP_ADV_TYPE_ADV_NONCONN_IND
Non-connectable and non-scanable mode.
Definition: ble_gapm.h:227
gap_ext_init_param_t::conn_to
uint16_t conn_to
Timeout for automatic connection establishment (in unit of 10ms).
Definition: ble_gapm.h:696
GAP_ADV_FLAG_SIMUL_BR_EDR_LE_HOST
@ GAP_ADV_FLAG_SIMUL_BR_EDR_LE_HOST
Dual mode for host supported (BR/EDR/LE): AD Flag.
Definition: ble_gapm.h:479
white_list_t::num
uint8_t num
Number of available items.
Definition: ble_gapm.h:731
ble_gap_ppcp_get
uint16_t ble_gap_ppcp_get(gap_conn_param_t *p_conn_params)
Get GAP Peripheral Preferred Connection Parameters.
GAP_ADV_TYPE_ADV_SCAN_IND
@ GAP_ADV_TYPE_ADV_SCAN_IND
Undirected scannable mode.
Definition: ble_gapm.h:228
ble_gap_per_adv_list_del
uint16_t ble_gap_per_adv_list_del(const period_adv_list_t *p_pal_list)
Delete the devices out of periodic advertising list.
GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED
@ GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED
Legacy BT not supported: AD Flag.
Definition: ble_gapm.h:477
GAP_ADV_TYPE_ADV_IND
@ GAP_ADV_TYPE_ADV_IND
Undirected connectable and scannable mode.
Definition: ble_gapm.h:226
gap_ad_type_t
gap_ad_type_t
GAP advertising types.
Definition: ble_gapm.h:434
gap_ext_scan_param_t
Parameters for extended scanning.
Definition: ble_gapm.h:621
GAP_ADV_ALLOW_SCAN_WLST_CON_WLST
@ GAP_ADV_ALLOW_SCAN_WLST_CON_WLST
Allow scan and connection requests from white-list devices only.
Definition: ble_gapm.h:250
ble_gap_adv_data_set
uint16_t ble_gap_adv_data_set(uint8_t adv_idx, gap_adv_data_type_t type, const uint8_t *p_data, uint16_t length)
Set Advertising Data, Scan Response Data and Periodic Advertising Data.
gap_adv_prim_cfg_t::phy
gap_le_phy_value_t phy
Indicate on which PHY primary advertising has to be performed.
Definition: ble_gapm.h:533
BLE_GAP_ROLE_NONE
@ BLE_GAP_ROLE_NONE
No role set yet.
Definition: ble_gapm.h:164
MAX_BOND_NUM
#define MAX_BOND_NUM
Maximal bonding number.
Definition: ble_gapm.h:75
gap_init_param_t::peer_addr
gap_bdaddr_t peer_addr
Peer device address.
Definition: ble_gapm.h:662
MAX_WL_NUM
#define MAX_WL_NUM
Maximal white list number.
Definition: ble_gapm.h:76
BLE_GAP_AD_TYPE_MANU_SPECIFIC_DATA
@ BLE_GAP_AD_TYPE_MANU_SPECIFIC_DATA
Manufacturer specific data.
Definition: ble_gapm.h:467
gap_per_sync_param_t::rsvd
uint8_t rsvd
Reserved for future use.
Definition: ble_gapm.h:652
GAP_PHY_2MBPS_VALUE
@ GAP_PHY_2MBPS_VALUE
LE 2M PHY.
Definition: ble_gapm.h:260
GAP_ADV_ALLOW_SCAN_ANY_CON_ANY
@ GAP_ADV_ALLOW_SCAN_ANY_CON_ANY
Allow both scan and connection requests from anyone.
Definition: ble_gapm.h:247
ble_gap_per_adv_list_clear
uint16_t ble_gap_per_adv_list_clear(void)
Clear all the entries in the current periodic advertising list.
GAP_SCAN_PROP_FILT_TRUNC_BIT
@ GAP_SCAN_PROP_FILT_TRUNC_BIT
Filter truncated advertising or scan response reports.
Definition: ble_gapm.h:407
gap_ext_conn_param_t::ce_len
uint16_t ce_len
The length of connection event needed for this LE connection.
Definition: ble_gapm.h:686
GAP_ADV_PROP_HDC_POS
@ GAP_ADV_PROP_HDC_POS
Indicate that High Duty Cycle has to be used for advertising on primary channel, applicable only if c...
Definition: ble_gapm.h:285
ble_gap_adv_param_set
uint16_t ble_gap_adv_param_set(uint8_t adv_idx, gap_own_addr_t own_addr_type, gap_adv_param_t *p_adv_param)
Set parameters for advertising.
BLE_GAP_GET_MAX_LE_ADV_DATA_LEN
@ BLE_GAP_GET_MAX_LE_ADV_DATA_LEN
Get maximum data length for advertising data.
Definition: ble_gapm.h:218
GAP_SCAN_PROP_PHY_CODED_BIT
@ GAP_SCAN_PROP_PHY_CODED_BIT
Scan advertisement on the LE Coded PHY.
Definition: ble_gapm.h:403
GAP_ACTIVITY_ROLE_UNKNOWN
@ GAP_ACTIVITY_ROLE_UNKNOWN
Unknown role.
Definition: ble_gapm.h:500
ble_gap_adv_stop
uint16_t ble_gap_adv_stop(uint8_t adv_idx)
Stop advertising.
GAP_ADV_TYPE_ADV_LOW_DIRECT_IND
@ GAP_ADV_TYPE_ADV_LOW_DIRECT_IND
Directed low duty cycle mode.
Definition: ble_gapm.h:230
BLE_GAP_OWN_ADDR_STATIC
@ BLE_GAP_OWN_ADDR_STATIC
Public or Private Static Address according to device address configuration.
Definition: ble_gapm.h:177
ble_gap_lepsm_unregister
uint16_t ble_gap_lepsm_unregister(uint16_t le_psm)
Unregister a LE Protocol/Service Multiplexer.
ble_gap_appearance_set
void ble_gap_appearance_set(uint16_t appearance)
Set GAP appearance value.
gap_ext_scan_dup_filt_policy_t
gap_ext_scan_dup_filt_policy_t
Filtering policy for duplicated packets.
Definition: ble_gapm.h:371
ble_gap_ext_adv_param_set
uint16_t ble_gap_ext_adv_param_set(uint8_t adv_idx, gap_own_addr_t own_addr_type, gap_ext_adv_param_t *p_adv_param)
Set extended parameters for advertising.
GAP_ADV_PROP_CONNECTABLE_POS
@ GAP_ADV_PROP_CONNECTABLE_POS
Indicate that advertising is connectable, reception of CONNECT_REQ or UX_CONNECT_REQ PDUs is accepted...
Definition: ble_gapm.h:279
gap_adv_flags_t
gap_adv_flags_t
AD Type Flag - Bit mask.
Definition: ble_gapm.h:474
gap_scan_wd_op_param_t::scan_wd
uint16_t scan_wd
Scan window between 0x0004 and 0xFFFF in 0.625 ms (range: 2.5 ms to 40.959375s).
Definition: ble_gapm.h:614
BLE_GAP_ADV_DATA_TYPE_PER_DATA
@ BLE_GAP_ADV_DATA_TYPE_PER_DATA
Periodic advertising data.
Definition: ble_gapm.h:201
gap_rslv_addr_read_op_id_t
gap_rslv_addr_read_op_id_t
Operation code used to read resolvable address.
Definition: ble_gapc.h:157
gap_scan_param_t::use_whitelist
bool use_whitelist
Filter policy.
Definition: ble_gapm.h:602
GAP_ADV_PROP_SCANNABLE_POS
@ GAP_ADV_PROP_SCANNABLE_POS
Indicate that advertising is scannable, reception of SCAN_REQ or AUX_SCAN_REQ PDUs is accepted.
Definition: ble_gapm.h:281
gap_init_param_t::interval_max
uint16_t interval_max
Maximum value for the connection interval (in unit of 1.25ms).
Definition: ble_gapm.h:665
GAP_ADV_TYPE_LEGACY
@ GAP_ADV_TYPE_LEGACY
Legacy advertising.
Definition: ble_gapm.h:269
gap_ext_init_param_t::conn_param_coded
gap_ext_conn_param_t conn_param_coded
Connection parameters for LE Coded PHY.
Definition: ble_gapm.h:703
ble_gap_rpa_list_get
uint16_t ble_gap_rpa_list_get(ral_dev_list_t *p_rpa_list)
Get the RPA list info.
GAP_ADV_TYPE_PERIODIC
@ GAP_ADV_TYPE_PERIODIC
Periodic advertising.
Definition: ble_gapm.h:271
gap_lepsm_register_t::le_psm
uint16_t le_psm
LE Protocol/Service Multiplexer (range: 1 to 255), PSMs should be odd.
Definition: ble_gapm.h:712
ble_gap_adv_start
uint16_t ble_gap_adv_start(uint8_t adv_idx, gap_adv_time_param_t *p_timeout)
Start advertising.
BLE_GAP_WRITE_PERM_UNAUTH
@ BLE_GAP_WRITE_PERM_UNAUTH
LE Security Mode 1, Level 2.
Definition: ble_gapm.h:189
ble_gap_update_adv_data
uint16_t ble_gap_update_adv_data(uint8_t adv_idx, gap_adv_data_type_t type, const uint8_t *p_data, uint16_t length)
Update Advertising Data, Scan Response Data and Periodic Advertising Data.
gap_scan_param_t::timeout
uint16_t timeout
Scan timeout should be a value between 0x0001 and 0xFFFF(unit: 10 ms).
Definition: ble_gapm.h:605
BLE_GAP_AD_TYPE_RQRD_128_BIT_SVC_UUID
@ BLE_GAP_AD_TYPE_RQRD_128_BIT_SVC_UUID
Require 128-bit service UUID.
Definition: ble_gapm.h:453
gap_ext_scan_type_t
gap_ext_scan_type_t
Extended scanning types.
Definition: ble_gapm.h:345
gap_adv_param_t::chnl_map
uint8_t chnl_map
Advertising channel map.
Definition: ble_gapm.h:519
gap_lepsm_register_t::mks_flag
bool mks_flag
Whether to use maximum-size key (16 bytes) or not.
Definition: ble_gapm.h:714
gap_ral_dev_info_t::priv_mode
uint8_t priv_mode
Privacy mode, see enum privacy_mode_t.
Definition: ble_gapm.h:750
gap_period_adv_addr_cfg_t::bd_addr
gap_bdaddr_t bd_addr
Advertiser address information.
Definition: ble_gapm.h:639
GAP_ADV_PROP_ANONYMOUS_BIT
@ GAP_ADV_PROP_ANONYMOUS_BIT
Definition: ble_gapm.h:307
GAP_EXT_SCAN_PROP_ACCEPT_RPA_BIT
@ GAP_EXT_SCAN_PROP_ACCEPT_RPA_BIT
Accept directed advertising packets if the uesd RPA and target address cannot be solved by the contro...
Definition: ble_gapm.h:363
bond_dev_list_t
Bonded device list.
Definition: ble_gapm.h:721
GAP_ADV_TYPE_ADV_HIGH_DIRECT_IND
@ GAP_ADV_TYPE_ADV_HIGH_DIRECT_IND
Directed high duty cycle mode.
Definition: ble_gapm.h:229
gap_per_sync_param_t
Periodic advertising synchronization parameters.
Definition: ble_gapm.h:647
ble_gap_ext_connect
uint16_t ble_gap_ext_connect(gap_own_addr_t own_addr_type, gap_ext_init_param_t *p_init_param)
Start an extended connection to a device.
ble_gap_bond_dev_addr_get
uint16_t ble_gap_bond_dev_addr_get(uint8_t conn_idx, gap_bdaddr_t *p_peer_addr)
Get BD address of the bonded device.
ble_gap_appearance_get
uint16_t ble_gap_appearance_get(uint16_t *p_appearance)
Get GAP appearance value.
gap_ext_adv_param_t::prim_cfg
gap_adv_prim_cfg_t prim_cfg
Configuration for primary advertising.
Definition: ble_gapm.h:568
gap_ext_adv_param_t::period_cfg
gap_adv_period_cfg_t period_cfg
Configuration for periodic advertising (valid only if advertising type is GAP_ADV_TYPE_PERIODIC).
Definition: ble_gapm.h:570
gap_ral_dev_info_t
RPA list item info.
Definition: ble_gapm.h:748
gap_conn_param_t
The parameter of connection.
Definition: ble_gapc.h:354
ble_gap_ppcp_set
uint16_t ble_gap_ppcp_set(gap_conn_param_t const *p_conn_params)
Set GAP Peripheral Preferred Connection Parameters.
gap_ext_scan_param_t::scan_param_1m
gap_scan_wd_op_param_t scan_param_1m
Scan window opening parameters for LE 1M PHY.
Definition: ble_gapm.h:626
gap_scan_mode_t
gap_scan_mode_t
Scanning modes.
Definition: ble_gapm.h:326
BLE_GAP_AD_TYPE_MORE_16_BIT_UUID
@ BLE_GAP_AD_TYPE_MORE_16_BIT_UUID
Use of more than 16-bit UUID.
Definition: ble_gapm.h:436
gap_ext_init_param_t::scan_param_1m
gap_scan_wd_op_param_t scan_param_1m
Scan window opening parameters for LE 1M PHY.
Definition: ble_gapm.h:699
ble_gap_device_name_get
uint16_t ble_gap_device_name_get(uint8_t *p_dev_name, uint16_t *p_length)
Get GAP device name.
BLE_GAP_AD_TYPE_3D_INFO
@ BLE_GAP_AD_TYPE_3D_INFO
3D Information Data.
Definition: ble_gapm.h:465
GAP_ADV_PROP_PER_TX_PWR_BIT
@ GAP_ADV_PROP_PER_TX_PWR_BIT
Definition: ble_gapm.h:309
gap_adv_param_t::adv_mode
uint8_t adv_mode
Advertising mode (see enum gap_adv_mode_t).
Definition: ble_gapm.h:513
gap_scan_param_t::scan_type
gap_scan_type_t scan_type
Active scanning or passive scanning.
Definition: ble_gapm.h:599
GAP_ADV_ALLOW_SCAN_WLST_CON_ANY
@ GAP_ADV_ALLOW_SCAN_WLST_CON_ANY
Allow scan req from white-list devices only and connection req from anyone.
Definition: ble_gapm.h:248
ble_gap_tx_power_set
uint16_t ble_gap_tx_power_set(gap_activity_role_t role, uint8_t index, int8_t txpwr_dbm)
Set the tx power.
gap_ext_adv_param_t::max_tx_pwr
int8_t max_tx_pwr
Maximum power level at which the advertising packets have to be transmitted (between -20 and 7 dBm).
Definition: ble_gapm.h:565
ble_gap_lepsm_register
uint16_t ble_gap_lepsm_register(gap_lepsm_register_t *p_lepsm)
Register a LE Protocol/Service Multiplexer.
gap_adv_prim_cfg_t
Configuration for advertising on primary channel.
Definition: ble_gapm.h:529
gap_ext_init_param_t::type
uint8_t type
Initiating type (see enum gap_init_type_t).
Definition: ble_gapm.h:694
GAP_EXT_SCAN_TYPE_LIM_DISC
@ GAP_EXT_SCAN_TYPE_LIM_DISC
Limited discovery.
Definition: ble_gapm.h:347
gap_scan_param_t::scan_dup_filt
gap_scan_dup_filt_policy_t scan_dup_filt
Duplicate filter policy.
Definition: ble_gapm.h:601
gap_ext_adv_param_t
Advertising parameters for extended advertising and periodic advertising.
Definition: ble_gapm.h:561
GAP_DISC_MODE_BROADCASTER
@ GAP_DISC_MODE_BROADCASTER
Broadcaster mode.
Definition: ble_gapm.h:239
BLE_GAP_AD_TYPE_SP_HASH_C
@ BLE_GAP_AD_TYPE_SP_HASH_C
Simple Pairing Hash C.
Definition: ble_gapm.h:446
gap_ral_dev_info_t::bd_addr
gap_bdaddr_t bd_addr
Peer device identity.
Definition: ble_gapm.h:749
GAP_ACTIVITY_ROLE_SCAN_INIT
@ GAP_ACTIVITY_ROLE_SCAN_INIT
Scann role.
Definition: ble_gapm.h:499
BLE_GAP_AD_TYPE_PUB_TGT_ADDR
@ BLE_GAP_AD_TYPE_PUB_TGT_ADDR
Public Target Address.
Definition: ble_gapm.h:457
GAP_ADV_ALLOW_SCAN_ANY_CON_WLST
@ GAP_ADV_ALLOW_SCAN_ANY_CON_WLST
Allow scan req from anyone and connection req from white-list devices only.
Definition: ble_gapm.h:249
GAP_ADV_PROP_USE_LEGACY_PDUS_POS
@ GAP_ADV_PROP_USE_LEGACY_PDUS_POS
Use legacy advertising PDUs.
Definition: ble_gapm.h:287
ble_gap_privacy_params_set
uint16_t ble_gap_privacy_params_set(uint16_t renew_dur, bool enable_flag)
Set privacy related parameters.
ble_gap_bond_dev_del
uint16_t ble_gap_bond_dev_del(const gap_bdaddr_t *p_peer_addr)
Delete a bond device with the specified BD address.
gap_per_sync_type
gap_per_sync_type
Periodic synchronization types.
Definition: ble_gapm.h:414
gap_adv_period_cfg_t::adv_intv_min
uint16_t adv_intv_min
Minimum advertising interval (in unit of 1.25 ms).
Definition: ble_gapm.h:553
BLE_GAP_AD_TYPE_RQRD_32_BIT_SVC_UUID
@ BLE_GAP_AD_TYPE_RQRD_32_BIT_SVC_UUID
Require 32-bit service UUID.
Definition: ble_gapm.h:452
gap_dev_info_get_type_t
gap_dev_info_get_type_t
Get device parameters operation code.
Definition: ble_gapm.h:207
BLE_GAP_AD_TYPE_OOB_FLAGS
@ BLE_GAP_AD_TYPE_OOB_FLAGS
Out of Band Flag.
Definition: ble_gapm.h:449
gap_sec_key_t
Security key.
Definition: ble_gapm.h:590
GAP_PHY_1MBPS_VALUE
@ GAP_PHY_1MBPS_VALUE
LE 1M PHY.
Definition: ble_gapm.h:259
GAP_ACTIVITY_ROLE_CON
@ GAP_ACTIVITY_ROLE_CON
Connect role.
Definition: ble_gapm.h:498
MAX_KEY_LEN
#define MAX_KEY_LEN
The key length.
Definition: ble_gapm.h:84
gap_adv_param_t::peer_addr
gap_bdaddr_t peer_addr
Peer address configuration (only used in case of directed advertising, or used to locate the IRK list...
Definition: ble_gapm.h:516
ble_gap_whitelist_clear
uint16_t ble_gap_whitelist_clear(void)
Clear all the entries in the current white list.
BLE_GAP_AD_TYPE_CLASS_OF_DEVICE
@ BLE_GAP_AD_TYPE_CLASS_OF_DEVICE
Class of device.
Definition: ble_gapm.h:445
GAP_EXT_DUP_FILT_EN_PERIOD
@ GAP_EXT_DUP_FILT_EN_PERIOD
Enable filtering of duplicated packets, reset for each scan period.
Definition: ble_gapm.h:374
gap_init_param_t::slave_latency
uint16_t slave_latency
Slave latency.
Definition: ble_gapm.h:667
gap_scan_wd_op_param_t::scan_intv
uint16_t scan_intv
Scan interval between 0x0004 and 0xFFFF in 0.625 ms (range: 2.5 ms to 40.959375s).
Definition: ble_gapm.h:613
gap_ext_init_param_t::conn_param_2m
gap_ext_conn_param_t conn_param_2m
Connection parameters for LE 2M PHY.
Definition: ble_gapm.h:702
GAP_EXT_SCAN_TYPE_GEN_DISC
@ GAP_EXT_SCAN_TYPE_GEN_DISC
General discovery.
Definition: ble_gapm.h:346
ble_gap_device_name_set
uint16_t ble_gap_device_name_set(gap_dev_name_write_perm_t write_perm, uint8_t const *p_dev_name, uint16_t length)
Set GAP device name.
GAP_EXT_SCAN_PROP_FILT_TRUNC_BIT
@ GAP_EXT_SCAN_PROP_FILT_TRUNC_BIT
Filter truncated advertising or scan response reports.
Definition: ble_gapm.h:364
ble_gap_per_adv_list_add
uint16_t ble_gap_per_adv_list_add(const period_adv_list_t *p_pal_list)
Add the devices into current periodic advertising list.
ble_gap_whitelist_del
uint16_t ble_gap_whitelist_del(const white_list_t *p_whitelist)
Delete the devices out of current white list.
BLE_GAP_ROLE_BROADCASTER
@ BLE_GAP_ROLE_BROADCASTER
Broadcaster role.
Definition: ble_gapm.h:166
gap_ext_scan_param_t::type
uint8_t type
Type of scanning to be started (see enum gap_ext_scan_type_t).
Definition: ble_gapm.h:622
BLE_GAP_AD_TYPE_RQRD_16_BIT_SVC_UUID
@ BLE_GAP_AD_TYPE_RQRD_16_BIT_SVC_UUID
Require 16-bit service UUID.
Definition: ble_gapm.h:451
GAP_EXT_SCAN_TYPE_OBSERVER
@ GAP_EXT_SCAN_TYPE_OBSERVER
Observer.
Definition: ble_gapm.h:348
BLE_GAP_GET_DEV_TX_POWER
@ BLE_GAP_GET_DEV_TX_POWER
Read the minimum and maximum transmit powers supported by the Controller.
Definition: ble_gapm.h:219
ral_dev_list_t
RPA list info.
Definition: ble_gapm.h:759
gap_adv_param_t::filter_pol
uint8_t filter_pol
Advertising filtering policy (see enum gap_adv_filter_policy_t).
Definition: ble_gapm.h:515
gap_lepsm_register_t
LE Protocol/Service Multiplexer information.
Definition: ble_gapm.h:711
BLE_GAP_AD_TYPE_SPAIR_HASH
@ BLE_GAP_AD_TYPE_SPAIR_HASH
Simple Pairing Hash C-256.
Definition: ble_gapm.h:463
gap_ext_init_param_t
Extended initiating parameters.
Definition: ble_gapm.h:693
ble_gap_default_tx_power_set
uint16_t ble_gap_default_tx_power_set(int8_t txpwr_dbm)
Set the default tx power for all roles.
GAP_PER_SYNC_TYPE_SELECTIVE
@ GAP_PER_SYNC_TYPE_SELECTIVE
Use periodic advertiser list for synchronization.
Definition: ble_gapm.h:416
GAP_ADV_PROP_DIRECTED_BIT
@ GAP_ADV_PROP_DIRECTED_BIT
Definition: ble_gapm.h:304
privacy_mode_t
privacy_mode_t
Privacy mode.
Definition: ble_gapm.h:487
gap_scan_prop_t
gap_scan_prop_t
Scanning properties bit field bit value.
Definition: ble_gapm.h:358