ble_gapc.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file ble_gapc.h
5  *
6  * @brief BLE GAPC 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  /**
51  * @defgroup BLE_GAPC Generic Access Profile (GAP) Connection Control
52  * @{
53  * @brief Definitions and prototypes for the GAP Connection Control interface.
54  */
55 #ifndef __BLE_GAPC_H__
56 #define __BLE_GAPC_H__
57 
58 #include "ble_error.h"
59 #include "gr55xx_sys_cfg.h"
60 #include <stdint.h> // Standard Integer
61 #include <string.h>
62 #include <stdbool.h>
63 
64 /**
65  * @defgroup BLE_GAPC_DEFINES Defines
66  * @{
67  */
68 #define GAP_CHNL_MAP_LEN 0x05 /**< The length of channel map. */
69 #define GAP_FEATS_LEN 0x08 /**< The length of features. */
70 #define GAP_ADDR_LEN 0x06 /**< The length of address. */
71 #define GAP_INVALID_CONN_INDEX 0xFF /**< Invalid connection index. */
72 
73 /**@defgroup BLE_GAP_ADDR_TYPES GAP Address types
74  * @{ */
75 #define BLE_GAP_ADDR_TYPE_PUBLIC 0x00 /**< Public (identity) address.*/
76 #define BLE_GAP_ADDR_TYPE_RANDOM_STATIC 0x01 /**< Random static (identity) address. */
77 /**@} */
78 
79 /**@defgroup BLE_GAP_PHY_OPTIONS GAP PHY OPTIONS (bitmask)
80  * @{ */
81 #define PHY_OPT_NO_CODING 0x00 /**< The Host has no preferred coding when transmitting on the LE Coded PHY. */
82 #define PHY_OPT_S2_CODING 0x01 /**< The Host prefers that S=2 coding be used when transmitting on the LE Coded PHY. */
83 #define PHY_OPT_S8_CODING 0x02 /**< The Host prefers that S=8 coding be used when transmitting on the LE Coded PHY. */
84 /**@} */
85 
86 /** @} */
87 
88 /**
89  * @defgroup BLE_SDK_GAP_ENUM Enumerations
90  * @{
91  */
92 /** @brief The operation code used to get connection info */
93 typedef enum
94 {
95  GAP_GET_CON_RSSI = 0, /**< Get connection RSSI info. */
96  GAP_GET_CON_CHANNEL_MAP, /**< Get connection channel map. */
97  GAP_GET_PHY, /**< Get connection PHY. */
98  GAP_GET_CHAN_SEL_ALGO /**< Get selection algorithm for connection channel. */
100 
101 /**@brief The operation code used to get peer device info. */
102 typedef enum
103 {
104  GAP_GET_PEER_VERSION = 0, /**< Get peer device version info. */
105  GAP_GET_PEER_FEATURES /**< Get peer device features info. */
107 
108 /** @brief Advertising report type. */
109 typedef enum
110 {
111  GAP_REPORT_TYPE_ADV_EXT = 0, /**< Extended advertising report. */
112  GAP_REPORT_TYPE_ADV_LEG, /**< Legacy advertising report. */
113  GAP_REPORT_TYPE_SCAN_RSP_EXT, /**< Extended scan response report. */
114  GAP_REPORT_TYPE_SCAN_RSP_LEG, /**< Legacy scan response report. */
115  GAP_REPORT_TYPE_PER_ADV, /**< Periodic advertising report. */
117 
118 /** @brief Advertising report information. */
119 typedef enum
120 {
121  GAP_REPORT_INFO_COMPLETE_BIT = (1 << 0), /**< Report is complete. */
122  GAP_REPORT_INFO_CONN_ADV_BIT = (1 << 1), /**< Connectable advertising. */
123  GAP_REPORT_INFO_SCAN_ADV_BIT = (1 << 2), /**< Scannable advertising. */
124  GAP_REPORT_INFO_DIR_ADV_BIT = (1 << 3), /**< Directed advertising. */
126 
127 /** @brief Stop reason code. */
128 typedef enum
129 {
130  GAP_STOPPED_REASON_TIMEOUT = 0, /**< Stop with timeout. */
131  GAP_STOPPED_REASON_ON_USER, /**< Stop with user stopping it actively. */
132  GAP_STOPPED_REASON_CONN_EST /**< Stop with connection established. */
134 
135 /** @brief Device role of LL layer type */
136 typedef enum
137 {
138  GAP_LL_ROLE_MASTER = 0, /**< Master role. */
139  GAP_LL_ROLE_SLAVE = 1, /**< Slave role. */
141 
142 /**
143  * @brief Operation code used to set param(s).
144  */
145 typedef enum
146 {
147  GAP_OPCODE_CHNL_MAP_SET, /**< Set Channel Map. */
148  GAP_OPCODE_WHITELIST_SET, /**< Set white list. */
149  GAP_OPCODE_PER_ADV_LIST_SET, /**< Set periodic advertising list. */
150  GAP_OPCODE_PRIVACY_MODE_SET, /**< Set privacy mode for peer device. */
152 
153 /**
154  * @brief Operation code used to read resolvable address.
155  */
156 typedef enum
157 {
158  GAP_OPCODE_LOCAL_RSLV_ADDR_READ, /**< Local resolvable address operation. */
159  GAP_OPCODE_PEER_RSLV_ADDR_READ, /**< Peer resolvable address operation. */
161 
162 /**
163  * @brief Operation code used for LEPSM manager.
164  */
165 typedef enum
166 {
167  GAP_OPCODE_LEPSM_REGISTER, /**< LEPSM register operation. */
168  GAP_OPCODE_LEPSM_UNREGISTER, /**< LEPSM unregister operation. */
170 
171 /**
172  * @brief The specified reason for terminating a connection.
173  */
174 typedef enum
175 {
176  GAP_HCI_AUTHENTICATION_FAILURE = 0x05, /**< Authentication Failure. */
177  GAP_HCI_REMOTE_USER_TERMINATED_CONNECTION = 0x13, /**< Remote User Terminated Connection. */
178  GAP_HCI_REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES = 0x14, /**< Remote Device Terminated Connection due to Low Resources . */
179  GAP_HCI_REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF = 0x15, /**< Remote Device Terminated Connection due to Power Off. */
180  GAP_HCI_UNSUPPORTED_REMOTE_FEATURE = 0x1A, /**< Unsupported Remote Feature. */
181  GAP_HCI_PAIRING_WITH_UNIT_KEY_UNSUPPORTED = 0X29, /**< Pairing With Unit Key Not Supported. */
182  GAP_HCI_CONN_INTERVAL_UNACCEPTABLE = 0x3B, /**< Unacceptable Connection Parameters. */
184 
185 /** @} */
186 
187 /**
188  * @defgroup BLE_GAPC_STRUCT Structures
189  * @{
190  */
191 
192 /** @brief The struct of device version. */
193 typedef struct
194 {
195  uint8_t hci_ver; /**< HCI version. */
196  uint8_t lmp_ver; /**< LMP version. */
197  uint8_t host_ver; /**< Host version. */
198  uint16_t hci_subver; /**< HCI subversion. */
199  uint16_t lmp_subver; /**< LMP subversion. */
200  uint16_t host_subver; /**< Host subversion. */
201  uint16_t manuf_name; /**< Manufacturer name. */
203 
204 /** @brief The struct of address. */
205 typedef struct
206 {
207  uint8_t addr[GAP_ADDR_LEN]; /**< 6-byte array address value. */
208 } gap_addr_t;
209 
210 /** @brief The struct of broadcast address with broadcast type. */
211 typedef struct
212 {
213  gap_addr_t gap_addr; /**< Device BD Address. */
214  uint8_t addr_type; /**< Address type of the device: 0=public/1=random. please @ref BLE_GAP_ADDR_TYPES. */
215 } gap_bdaddr_t;
216 
217 /** @brief Get broadcast address struct. */
218 typedef struct
219 {
220  uint8_t index; /**< Advertsing index. The valid range is: 0 - 4. */
221  gap_bdaddr_t bd_addr; /**< BD address. */
223 
224 /** @brief TX power info struct. */
225 typedef struct
226 {
227  int8_t power_lvl; /**< Advertising channel TX power level. Range: -20 to 10. Unit: dBm. Accuracy: +/-4dB. */
229 
230 /** @brief TX power info struct. */
231 typedef struct
232 {
233  int8_t min_tx_pwr; /**< MIN of TX power. Size: 1 octet (signed integer). Range: -127 to +126. Unit: dBm. */
234  int8_t max_tx_pwr; /**< MAX of TX power. Size: 1 octet (signed integer). Range: -127 to +126. Unit: dBm. */
236 
237 /** @brief Max data length info struct. */
238 typedef struct
239 {
240  uint16_t suppted_max_tx_octets; /**< Maximum number of payload octets that the local Controller supports for transmission of a single Link Layer packet on a data connection.
241  Range: 0x001B-0x00FB (all other values reserved for future use). */
242  uint16_t suppted_max_tx_time; /**< Maximum time, in microseconds, that the local Controller supports for transmission of a single Link Layer packet on a data connection.
243  Range: 0x0148-0x4290 (all other values reserved for future use). */
244  uint16_t suppted_max_rx_octets; /**< Maximum number of payload octets that the local Controller supports for reception of a single Link Layer packet on a data connection.
245  Range: 0x001B-0x00FB (all other values reserved for future use). */
246  uint16_t suppted_max_rx_time; /**< Maximum time, in microseconds, that the local Controller supports for reception of a single Link Layer packet on a data connection.
247  Range: 0x0148-0x4290 (all other values reserved for future use). */
249 
250 /** @brief Suggested default data length info. */
251 typedef struct
252 {
253  uint16_t suggted_max_tx_octets; /**< The Host's suggested value for the Controller's maximum transmitted number of payload octets to be used for new connections.
254  Range: 0x001B-0x00FB (all other values reserved for future use), default: 0x001B */
255  uint16_t suggted_max_tx_time; /**< The Host's suggested value for the Controller's maximum packet transmission time to be used for new connections.
256  Range: 0x0148-0x4290 (all other values reserved for future use), default: 0x0148*/
258 
259 /** @brief Number of available advertising sets info. */
260 typedef struct
261 {
262  uint8_t nb_adv_sets; /**< Number of available advertising sets. */
264 
265 /** @brief Maximum advertising data length info. */
266 typedef struct
267 {
268  uint16_t length; /**< Maximum advertising data length supported by controller. */
270 
271 /** @brief RF path compensation values info. */
272 typedef struct
273 {
274  uint16_t tx_path_comp; /**< RF TX path compensation. */
275  uint16_t rx_path_comp; /**< RF RX path compensation. */
277 
278 /** @brief Device info. */
279 typedef union
280 {
281  gap_dev_version_ind_t dev_version; /**< Version info. */
282  gap_get_bd_addr_t get_bd_addr; /**< Device BD address info. */
283  gap_dev_adv_tx_power_t adv_tx_power; /**< Advertising TX power info. */
284  gap_sugg_dflt_data_len_t sugg_dflt_data_len; /**< Suggested default data length info. */
285  gap_max_data_len_t max_data_len; /**< Suggested MAX data length info. */
286  gap_nb_adv_sets_t nb_adv_sets; /**< Number of available advertising sets. */
287  gap_max_adv_data_len_ind_t max_adv_data_len; /**< Maximum advertising data length info. */
288  gap_dev_tx_power_t dev_tx_power; /**< Device TX power info. */
289  gap_dev_rf_path_comp_ind_t dev_rf_path_comp; /**< RF path compensation values. */
291 
292 /** @brief Get device info operation struct. */
293 typedef struct
294 {
295  uint8_t operation; /**< Operation code. @see enum gap_dev_info_get_type_t. */
296  gap_dev_info_t dev_info; /**< Device info. */
298 
299 /** @brief Read resolvable address info struct. */
300 typedef struct
301 {
302  uint8_t op_code; /**< Operation code. @see enum gap_rslv_addr_read_op_id_t. */
303  gap_addr_t gap_addr; /**< Resolvable address info. */
305 
306 /** @brief Sync established indication. */
307 typedef struct
308 {
309  uint8_t phy; /**< PHY on which synchronization has been established. @see gap_phy_type. */
310  uint16_t intv; /**< Periodic advertising interval (in unit of 1.25ms, min is 7.5ms). */
311  uint8_t adv_sid; /**< Advertising SID. */
312  uint8_t clk_acc; /**< Advertiser clock accuracy. @see enum gapm_clk_acc. */
313  gap_bdaddr_t bd_addr; /**< Advertiser address. */
314  uint16_t sync_hdl; /**< Sync handle. */
316 
317 /** @brief APP receives the extended advertising report indication info struct. */
318 typedef struct
319 {
320  uint8_t adv_type; /**< Advertising type. @see enum gap_adv_report_type_t. */
321  uint8_t adv_info; /**< Bit field providing information about the received report. @see enum gap_adv_report_info_t. */
322  gap_bdaddr_t broadcaster_addr; /**< Broadcaster device address. */
323  gap_bdaddr_t direct_addr; /**< Target address (in case of a directed advertising report). */
324  int8_t tx_pwr; /**< TX power (in dBm). */
325  int8_t rssi; /**< RSSI (between -127 and +20 dBm). */
326  uint8_t phy_prim; /**< Primary PHY on which advertising report has been received. */
327  uint8_t phy_second; /**< Secondary PHY on which advertising report has been received. */
328  uint8_t adv_sid; /**< Advertising SID , valid only for periodic advertising report. */
329  uint16_t period_adv_intv; /**< Periodic advertising interval (in unit of 1.25ms, min is 7.5ms), valid only for periodic advertising report. */
330  uint8_t per_sync_idx; /**< Periodic syncronization index, valid only for periodic advertising report. */
331  uint16_t length; /**< Report length. */
332  uint8_t data[__ARRAY_EMPTY]; /**< Report. */
334 
335 /** @brief Name of peer device indication. */
336 typedef struct
337 {
338  gap_addr_t peer_addr; /**< Peer device bd address. */
339  uint8_t addr_type; /**< Peer device address type. */
340  uint8_t name_len; /**< Peer device name length. */
341  uint8_t name[__ARRAY_EMPTY]; /**< Peer device name. */
343 
344 /** @brief Connection parameter used to update connection parameters. */
345 typedef struct
346 {
347  uint16_t interval; /**< Connection interval. Range: 0x0006 to 0x0C80. Unit: 1.25 ms. Time range: 7.5 ms to 4 s. */
348  uint16_t latency; /**< Latency for the connection in number of connection events. Range: 0x0000 to 0x01F3. */
349  uint16_t sup_timeout; /**< Supervision timeout for the LE link. Range: 0x000A to 0x0C80, unit: 10 ms, time range: 100 ms to 32 s. */
351 
352 /** @brief The parameter of connection. */
353 typedef struct
354 {
355  uint16_t interval_min; /**< Minimum value for the connection interval. This shall be less than or equal to Conn_Interval_Max.
356  Range: 0x0006 to 0x0C80, unit: 1.25 ms, time range: 7.5 ms to 4 s*/
357  uint16_t interval_max; /**< Maximum value for the connection interval. This shall be greater than or equal to Conn_Interval_Min.
358  Range: 0x0006 to 0x0C80, unit: 1.25 ms, time range: 7.5 ms to 4 s.*/
359  uint16_t slave_latency; /**< Slave latency for the connection in number of connection events. Range: 0x0000 to 0x01F3. */
360  uint16_t sup_timeout; /**< Supervision timeout for the LE link. Range: 0x000A to 0x0C80, unit: 10 ms, time range: 100 ms to 32 s. */
362 
363 /** @brief The parameter of update connection. */
364 typedef struct
365 {
366  uint16_t interval_min; /**< Minimum value for the connection interval. This shall be less than or equal to Conn_Interval_Max.
367  Range: 0x0006 to 0x0C80, unit: 1.25 ms, time range: 7.5 ms to 4 s*/
368  uint16_t interval_max; /**< Maximum value for the connection interval. This shall be greater than or equal to Conn_Interval_Min.
369  Range: 0x0006 to 0x0C80, unit: 1.25 ms, time range: 7.5 ms to 4 s.*/
370  uint16_t slave_latency; /**< Slave latency for the connection in number of connection events. Range: 0x0000 to 0x01F3. */
371  uint16_t sup_timeout; /**< Supervision timeout for the LE link. range: 0x000A to 0x0C80, unit: 10 ms, Time range: 100 ms to 32 s. */
372  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.9 s.
373  recommended value: 0x0002 for 1M phy, 0x0006 for coded phy */
375 
376 /** @brief Connection complete info. */
377 typedef struct
378 {
379  uint16_t conhdl; /**< Connection_Handle. Range: 0x0000-0x0EFF (all other values reserved for future use). */
380  uint16_t con_interval; /**< Connection interval. Range: 0x0006 to 0x0C80, unit: 1.25 ms, time range: 7.5 ms to 4 s. */
381  uint16_t con_latency; /**< Latency for the connection in number of connection events. Range: 0x0000 to 0x01F3. */
382  uint16_t sup_to; /**< Connection supervision timeout. Range: 0x000A to 0x0C80, unit: 10 ms, time range: 100 ms to 32 s. */
383  uint8_t clk_accuracy; /**< Clock accuracy (0x00: 500 ppm, 0x01: 250 ppm, 0x02: 150 ppm, 0x03: 100 ppm, 0x04: 75 ppm,
384  0x05:50 ppm, 0x06:30 ppm, 0x07:20 ppm, others: reserved for future use). */
385  uint8_t peer_addr_type; /**< Peer address type(0x00: Public Device Address, 0x01 : Random Device Address, others: reserved for future use). */
386  gap_addr_t peer_addr; /**< Peer BT address. */
387  gap_ll_role_type_t ll_role; /**< Device Role of LL Layer. */
389 
390 /** @brief Channel map structure. */
391 typedef struct
392 {
393  uint8_t map[GAP_CHNL_MAP_LEN]; /**< This parameter contains 37 1-bit fields. The nth bit (n is in the range of 0 to 36) contains the value for the link layer channel index n.
394  Channel n is unused = 0, channel n is used = 1. The most significant bits are reserved for future use.*/
396 
397 /** @brief PHY info. */
398 typedef struct
399 {
400  uint8_t tx_phy; /**< LE PHY for data transmission. @see BLE_GAP_PHYS. */
401  uint8_t rx_phy; /**< LE PHY for data reception. @see BLE_GAP_PHYS. */
403 
404 /** @brief Connection info. */
405 typedef union
406 {
407  int8_t rssi; /**< RSSI. */
408  gap_chnl_map_t chnl_map; /**< channel map. */
409  gap_le_phy_ind_t phy; /**< PHY indicaiton. */
410  uint8_t chan_sel_algo; /**< Chanel Selection algorithm, 0x00: LE Channel Selection Algorithm #1 is used.
411  0x01: LE Channel Selection Algorithm #2 is used.\n 0x02-0xFF: reserved. */
413 
414 /** @brief The info of connecting operation. */
415 typedef struct
416 {
417  uint8_t opcode; /**< Operation code. See @ref gap_get_conn_info_op_t. */
418  gap_conn_info_t info; /**< Connection info. */
420 
421 /** @brief Peer version info. */
422 typedef struct
423 {
424  uint16_t compid; /**<Manufacturer name. */
425  uint16_t lmp_subvers; /**< LMP subversion. */
426  uint8_t lmp_vers; /**< LMP version. */
428 
429 /** @brief LE features info. */
430 typedef struct
431 {
432  uint8_t features[GAP_FEATS_LEN]; /**< 8-byte array for LE features\n
433  Feature Setting field's bit mapping to Controller Features (0: not support, 1: support) \n
434  |Bit position | Link Layer Feature|
435  |-------------|-----------------|
436  |0 | LE Encryption|
437  |1 |Connection Parameters Request Procedure|
438  |2 |Extended Reject Indication|
439  |3 | Slave-initiated Features Exchange |
440  |4 |LE Ping |
441  |5 |LE Data Packet Length Extension |
442  |6 |LL Privacy |
443  |7 |Extended Scanner Filter Policies |
444  |8 |LE 2M PHY|
445  |9 | Stable Modulation Index - Transmitter |
446  |10 | Stable Modulation Index - Receiver |
447  |11 |LE Coded PHY |
448  |12 |LE Extended Advertising|
449  |13 | LE Periodic Advertising|
450  |14 | Channel Selection Algorithm #2|
451  |15 |LE Power Class 1|
452  |16 |Minimum Number of Used Channels Procedure|
453  |All other values |Reserved for Future Use|*/
455 
456 /** @brief LE peer info. */
457 typedef union
458 {
459  gap_peer_version_ind_t peer_version; /**< Version info. */
460  gap_peer_features_ind_t peer_features; /**< Features info. */
462 
463 /** @brief Get peer info operation struct. */
464 typedef struct
465 {
466  uint8_t opcode; /**< Operation code. See @ref gap_get_peer_info_op_t. */
467  gap_peer_info_t peer_info; /**< Peer info. */
469 
470 /** @brief Supported data length size Indication. */
471 typedef struct
472 {
473  uint16_t max_tx_octets; /**< The maximum number of payload octets in TX. */
474  uint16_t max_tx_time; /**< The maximum time that the local Controller will take to TX. */
475  uint16_t max_rx_octets; /**< The maximum number of payload octets in RX. */
476  uint16_t max_rx_time; /**< The maximum time that the local Controller will take to RX. */
478 
479 /**@brief The Structure for BLE Connection Arrangement. */
480 typedef struct
481 {
482  uint16_t conn_idx; /**< Connection Index. */
483  uint32_t interval; /**< Connection Interval (in 625us). */
484  uint32_t offset; /**< Connection Offset (in 625us). */
485  uint32_t duration; /**< Connection Duration (in 625us). */
487 
488 /** @brief Set preference slave event duration */
489 typedef struct
490 {
491  uint16_t duration; /**< Preferred event duration. */
492  uint8_t single_tx; /**< Slave transmits a single packet per connection event (False/True). */
494 
495 /** @brief BLE initialization completed callback function for application. */
496 typedef void (*app_ble_init_cmp_cb_t)(void);
497 
498 /** @brief The gap callback function struct. */
499 typedef struct
500 {
501  // ----------------------------------------------------------------------------------
502  // ------------------------- Common Callbacks ------------------------------------
503  // ----------------------------------------------------------------------------------
504 
505  /**
506  ****************************************************************************************
507  * @brief This callback function will be called when the param(s) setting operation has been completed.
508  * @param[in] status: The status of set param operation.
509  * @param[in] set_param_op: The operation of setting. @see gap_param_set_op_id_t.
510  * @retval void
511  ****************************************************************************************
512  */
513  void (*app_gap_param_set_cb)(uint8_t status, const gap_param_set_op_id_t set_param_op);
514 
515  /**
516  ****************************************************************************************
517  * @brief This callback function will be called when the PSM register/unregister operation has been completed.
518  * @param[in] status: The status of PSM manager operations.
519  * @param[in] psm_op: The operation of register/unregister PSM. @see gap_psm_op_id_t
520  * @retval void
521  ****************************************************************************************
522  */
523  void (*app_gap_psm_manager_cb)(uint8_t status, const gap_psm_manager_op_id_t psm_op);
524 
525  /**
526  ****************************************************************************************
527  * @brief This callback function will be called when update PHY completed.
528  * @param[in] conn_idx: The index of connections.
529  * @param[in] status: The status of udpate PHY operation.
530  * @param[in] phy: Pointer to the PHY info.
531  * @retval void
532  ****************************************************************************************
533  */
534  void (*app_gap_phy_update_cb)(uint8_t conn_idx, uint8_t status, const gap_le_phy_ind_t *p_phy);
535 
536  /**
537  ****************************************************************************************
538  * @brief This callback function will be called once the requested parameters has been available.
539  * @param[in] status: GAP operation status.
540  * @param[in] p_dev_info: Pointer to the device info. See @ref gap_dev_info_get_t.
541  * @retval void
542  ****************************************************************************************
543  */
544  void (*app_gap_dev_info_get_cb)(uint8_t status, const gap_dev_info_get_t* p_dev_info);
545 
546  // ----------------------------------------------------------------------------------
547  // ------------------------- Advertising Callbacks ----------------------------------
548  // ----------------------------------------------------------------------------------
549 
550  /**
551  ****************************************************************************************
552  * @brief This callback function will be called when the adv has started.
553  * @param[in] inst_idx: The advertising index. Valid range is: 0 - 4.
554  * @param[in] status: The status of starting a advertiser.
555  * @retval void
556  ****************************************************************************************
557  */
558  void (*app_gap_adv_start_cb)(uint8_t inst_idx, uint8_t status);
559 
560  /**
561  ****************************************************************************************
562  * @brief This callback function will be called when the adv has stopped.
563  * @param[in] inst_idx: The advertising index. Valid range is: 0 - 4.
564  * @param[in] status: The status of stopping a advertiser. If status is not success, adv_stop_reason is invalid.
565  * @param[in] adv_stop_reason: The stop reason. See @ref gap_stopped_reason_t.
566  * @retval void
567  ****************************************************************************************
568  */
569  void (*app_gap_adv_stop_cb)(uint8_t inst_idx, uint8_t status, gap_stopped_reason_t adv_stop_reason);
570 
571  /**
572  ****************************************************************************************
573  * @brief This callback function will be called when app has received the scan request.
574  * @param[in] inst_idx: The advertising index. Valid range is: 0 - 4.
575  * @param[in] p_scanner_addr: Pointer to the BD address. See @ref gap_bdaddr_t.
576  * @retval void
577  ****************************************************************************************
578  */
579  void (*app_gap_scan_req_ind_cb)(uint8_t inst_idx, const gap_bdaddr_t *p_scanner_addr);
580 
581  /**
582  ****************************************************************************************
583  * @brief This callback function will be called when update adv data completed.
584  * @param[in] inst_idx: The advertising index. Valid range is: 0 - 4.
585  * @param[in] status: The status of udpate PHY operation.
586  * @retval void
587  ****************************************************************************************
588  */
589  void (*app_gap_adv_data_update_cb)(uint8_t inst_idx, uint8_t status);
590 
591  // ----------------------------------------------------------------------------------
592  // -------------------- Scanning/Periodic Synchronization Callbacks ------------------------
593  // ----------------------------------------------------------------------------------
594 
595  /**
596  ****************************************************************************************
597  * @brief This callback function will be called when the scan has started.
598  * @param[in] status: The status of starting a scanner.
599  * @retval void
600  ****************************************************************************************
601  */
602  void (*app_gap_scan_start_cb)(uint8_t status);
603 
604  /**
605  ****************************************************************************************
606  * @brief This callback function will be called once the scanning activity has been stopped.
607  * @param[in] status: The status of stopping a scanner.
608  * @param[in] scan_stop_reason: The stop reason. See @ref gap_stopped_reason_t.
609  * @retval void
610  ****************************************************************************************
611  */
612  void (*app_gap_scan_stop_cb)(uint8_t status, gap_stopped_reason_t scan_stop_reason);
613 
614  /**
615  ****************************************************************************************
616  * @brief This callback function will be called once the advertising report has been received.
617  * @param[in] p_adv_report: Pointer to the extended advertising report. See @ref gap_ext_adv_report_ind_t.
618  * @retval void
619  ****************************************************************************************
620  */
621  void (*app_gap_adv_report_ind_cb)(const gap_ext_adv_report_ind_t *p_adv_report);
622 
623  /**
624  ****************************************************************************************
625  * @brief This callback function will be called once the periodic advertising synchronization has been established.
626  * @param[in] status: The status of sync.
627  * @param[in] inst_idx: The periodic syncronization index. Valid range is: 0 - 4.
628  * @param[in] p_sync_established_info: Pointer to the established ind info. See @ref gap_sync_established_ind_t.
629  * @retval void
630  ****************************************************************************************
631  */
632  void (*app_gap_sync_establish_cb)(uint8_t inst_idx, uint8_t status, const gap_sync_established_ind_t *p_sync_established_info);
633 
634  /**
635  ****************************************************************************************
636  * @brief This callback function will be called when sync has stopped.
637  * @param[in] status: The status of stopping sync.
638  * @param[in] inst_idx: The periodic syncronization index. Valid range is: 0 - 4.
639  * @retval void
640  ****************************************************************************************
641  */
642  void (*app_gap_stop_sync_cb)(uint8_t inst_idx, uint8_t status);
643 
644  /**
645  ****************************************************************************************
646  * @brief This callback function will be called once the periodic advertising synchronization has been lost.
647  * @param[in] inst_idx: The periodic syncronization index. Valid range is: 0 - 4.
648  * @retval void
649  ****************************************************************************************
650  */
651  void (*app_gap_sync_lost_cb)(uint8_t inst_idx);
652 
653  // ----------------------------------------------------------------------------------
654  // ------------------------- Initiating Callbacks --------------------------------------
655  // ----------------------------------------------------------------------------------
656 
657  /**
658  ****************************************************************************************
659  * @brief This callback function will be called when connection completed.
660  * @param[in] conn_idx: The connection index.
661  * @param[in] status: The status of operation. If status is not success, conn_idx and p_conn_param are invalid.
662  * @param[in] p_conn_param: Pointer to the connection param. See @ref gap_conn_cmp_t.
663  * @retval void
664  ****************************************************************************************
665  */
666  void (*app_gap_connect_cb)(uint8_t conn_idx, uint8_t status, const gap_conn_cmp_t *p_conn_param);
667 
668  /**
669  ****************************************************************************************
670  * @brief This callback function will be called when disconnection completed.
671  * @param[in] conn_idx: The connection index.
672  * @param[in] status: The status of operation. If status is not success, disconnection reason is invalid.
673  * @param[in] reason: The reason of disconnection. See @ref BLE_STACK_ERROR_CODES.
674  * @retval void
675  ****************************************************************************************
676  */
677  void (*app_gap_disconnect_cb)(uint8_t conn_idx, uint8_t status, uint8_t reason);
678 
679  /**
680  ****************************************************************************************
681  * @brief This callback function will be called when connection canceled.
682  * @param[in] status: The status of cancel operation.
683  * @retval void
684  ****************************************************************************************
685  */
686  void (*app_gap_connect_cancel_cb)(uint8_t status);
687 
688  /**
689  ****************************************************************************************
690  * @brief This callback function will be called when an automatic connection timeout occurs.
691  * @retval void
692  ****************************************************************************************
693  */
694  void (*app_gap_auto_connection_timeout_cb)(void);
695 
696  /**
697  ****************************************************************************************
698  * @brief This callback function will be called when the peer name info has been available.
699  * @param[in] conn_idx: The connection index.
700  * @param[in] p_peer_name: Pointer to the peer device name indication info. See @ref gap_peer_name_ind_t.
701  * @retval void
702  ****************************************************************************************
703  */
704  void (*app_gap_peer_name_ind_cb)(uint8_t conn_idx, const gap_peer_name_ind_t *p_peer_name);
705 
706  // ----------------------------------------------------------------------------------
707  // ------------------------- Connection Control Callbacks ------------------------------
708  // ----------------------------------------------------------------------------------
709 
710  /**
711  ****************************************************************************************
712  * @brief This callback function will be called when connection update completed.
713  * @param[in] conn_idx: The connection index.
714  * @param[in] status: The status of GAP operation.
715  * @param[in] p_conn_param_update_info: Pointer to the connection update complete param. See @ref gap_conn_update_cmp_t.
716  * @retval void
717  ****************************************************************************************
718  */
719  void (*app_gap_connection_update_cb)(uint8_t conn_idx, uint8_t status, const gap_conn_update_cmp_t *p_conn_param_update_info);
720 
721  /**
722  ****************************************************************************************
723  *@brief This callback function will be called when the peer device requests updating connection.
724  * @param[in] conn_idx: The connection index.
725  * @param[in] p_conn_param_update_req: Pointer to the connection update request param. See @ref gap_conn_param_t.
726  * @retval void
727  ****************************************************************************************
728  */
729  void (*app_gap_connection_update_req_cb)(uint8_t conn_idx, const gap_conn_param_t *p_conn_param_update_req);
730 
731  /**
732  ****************************************************************************************
733  * @brief This callback function will be called when app has got the connection info.
734  * @param[in] conn_idx: The connection index.
735  * @param[in] status: The status of GAP operation.
736  * @param[in] p_conn_info: Pointer to the connection info. See @ref gap_conn_info_param_t.
737  * @retval void
738  ****************************************************************************************
739  */
740  void (*app_gap_connection_info_get_cb)(uint8_t conn_idx, uint8_t status, const gap_conn_info_param_t *p_conn_info);
741 
742  /**
743  ****************************************************************************************
744  * @brief This callback function will be called when app has got the peer info.
745  * @param[in] conn_idx: The connection index.
746  * @param[in] status: The status of GAP operation.
747  * @param[in] p_peer_dev_info: Pointer to the peer device info. See @ref gap_peer_info_param_t.
748  * @retval void
749  ****************************************************************************************
750  */
751  void (*app_gap_peer_info_get_cb)(uint8_t conn_idx, uint8_t status, const gap_peer_info_param_t *p_peer_dev_info);
752 
753  /**
754  ****************************************************************************************
755  * @brief This callback function will be called when an app sets the length size of the supported data.
756  * @param[in] conn_idx: The connection index.
757  * @param[in] status: The status of GAP operation.
758  * @param[in] p_supported_data_length_size: Supported data length size. See @ref gap_le_pkt_size_ind_t.
759  * @retval void
760  ****************************************************************************************
761  */
762  void (*app_gap_le_pkt_size_info_cb)(uint8_t conn_idx, uint8_t status, const gap_le_pkt_size_ind_t *p_supported_data_length_size);
763 
764  /**
765  ****************************************************************************************
766  * @brief This callback function will be called when an app reads the local or peer reslovable address.
767  * @param[in] status: The status of GAP operation.
768  * @param[in] p_read_rslv_addr: Read resolvable address info. See @ref gap_rslv_addr_read_t.
769  * @retval void
770  ****************************************************************************************
771  */
772  void (*app_gap_rslv_addr_read_cb)(uint8_t status, const gap_rslv_addr_read_t *p_read_rslv_addr);
773 
774 }gap_cb_fun_t;
775 
776 /** @} */
777 
778 /**
779  * @defgroup BLE_GAPC_FUNCTION Functions
780  * @{
781  */
782 /**
783  ****************************************************************************************
784  * @brief Terminate an existing connection.
785  * @note When APP wants to disconnect a connection, it should call this function, and when the disconnection is finished,
786  * the callback function @ref gap_cb_fun_t::app_gap_disconnect_cb will be called.
787  *
788  * @param[in] conn_idx: The index of connection.
789  *
790  * @retval ::SDK_SUCCESS: Operation is Success.
791  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
792  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
793  ****************************************************************************************
794  */
795 uint16_t ble_gap_disconnect(uint8_t conn_idx);
796 
797 /**
798  ****************************************************************************************
799  * @brief Terminate an existing connection with a specified reason.
800  * @note When APP wants to disconnect a connection, it should call this function, and when the disconnection is finished,
801  * the callback function @ref gap_cb_fun_t::app_gap_disconnect_cb will be called.
802  *
803  * @param[in] conn_idx: The index of connection.
804  * @param[in] reason: The specified reason.
805  *
806  * @retval ::SDK_SUCCESS: Operation is Success.
807  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
808  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
809  ****************************************************************************************
810  */
811 uint16_t ble_gap_disconnect_with_reason(uint8_t conn_idx, gap_disconn_reason_t reason);
812 
813 /**
814  ****************************************************************************************
815  * @brief Change the Link Layer connection parameters of a connection.
816  * @note When APP wants to update connection param, it should call this function, and if the update connection param is finished,
817  * the callback function @ref gap_cb_fun_t::app_gap_connection_update_cb will be called.
818  *
819  * @param[in] conn_idx: The index of connection.
820  * @param[in] p_conn_param: Pointer to the new connection param.
821  *
822  * @retval ::SDK_SUCCESS: Operation is Success.
823  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
824  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
825  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
826  ****************************************************************************************
827  */
828 uint16_t ble_gap_conn_param_update (uint8_t conn_idx, const gap_conn_update_param_t *p_conn_param);
829 
830 /**
831  *****************************************************************************************
832  * @brief Set connection's Latency.
833  * @note The latency shall be set to X value by LLCP firstly, then uses this API to change the latency in [0, X].
834  *
835  * @param[in] conn_idx: The index of connection.
836  * @param[in] latency: The latency of connection.
837  *
838  * @retval ::SDK_SUCCESS: Operation is Success.
839  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
840  *****************************************************************************************
841  */
842 uint16_t ble_gap_latency_set(uint8_t conn_idx, uint16_t latency);
843 
844 /**
845  *****************************************************************************************
846  * @brief Consult BLE connection activity plan situation function.
847  * @note This function should be called when connection established and no periodic advertising exists.
848  *
849  * @param[out] p_act_num: Pointer to the number of existing connection activities.
850  * @param[out] p_conn_plan_arr: Pointer to the global array that stores planned connection activities.
851  *
852  * @retval ::SDK_SUCCESS: Operation is Success.
853  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
854  *****************************************************************************************
855  */
856 uint16_t ble_gap_con_plan_consult(uint8_t *p_act_num, gap_con_plan_tag_t **p_conn_plan_arr);
857 
858 /**
859  ****************************************************************************************
860  * @brief Connection param update reply to peer device.
861  *
862  * @note If the Host receives the param update request from the peer device, it will call the callback function.
863  * @ref gap_cb_fun_t::app_gap_connection_update_req_cb, and then the APP should call this function to confirm.
864  *
865  * @param[in] conn_idx: The index of connection.
866  * @param[in] accept: True to accept connection parameters, false to reject.
867  *
868  * @retval ::SDK_SUCCESS: Operation is success.
869  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
870  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
871  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
872  ****************************************************************************************
873  */
874 uint16_t ble_gap_conn_param_update_reply(uint8_t conn_idx, bool accept);
875 
876 /**
877  ****************************************************************************************
878  * @brief The suggested maximum transmission packet size and maximum packet transmission time to be used for a given connection.
879  * @note Once this operation has been completed, the callback function @ref gap_cb_fun_t::app_gap_le_pkt_size_info_cb will be called.
880  *
881  * @param[in] conn_idx: The index of connection.
882  * @param[in] tx_octects: Preferred maximum number of payload octets that the local Controller should include in a single Link Layer packet on this connection.
883  * Range 0x001B-0x00FB (all other values reserved for future use).
884  * @param[in] tx_time: Preferred maximum number of microseconds that the local Controller should use to transmit a single Link Layer packet on this connection.
885  * Range 0x0148-0x4290 (all other values reserved for future use).
886  *
887  * @retval ::SDK_SUCCESS: Operation is Success.
888  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
889  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
890  ****************************************************************************************
891  */
892 uint16_t ble_gap_data_length_update(uint8_t conn_idx, uint16_t tx_octects , uint16_t tx_time);
893 
894 /**
895  ****************************************************************************************
896  * @brief Set the PHY preferences for the connection identified by the connection index.
897  * @note Once this operation has been completed, the callback function @ref gap_cb_fun_t::app_gap_phy_update_cb will be called.
898  *
899  * @param[in] conn_idx: The index of connection.
900  * @param[in] tx_phys: The transmitter PHYs that the Host prefers the Controller to use (see @ref BLE_GAP_PHYS).
901  * @param[in] rx_phys: A bit field that indicates the receiver PHYs that the Host prefers the Controller to use (see @ref BLE_GAP_PHYS).
902  * @param[in] phy_opt: A bit field that allows the Host to specify options for PHYs (see @ref BLE_GAP_PHY_OPTIONS).
903  *
904  * @retval ::SDK_SUCCESS: Operation is Success.
905  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
906  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
907  ****************************************************************************************
908  */
909 uint16_t ble_gap_phy_update(uint8_t conn_idx, uint8_t tx_phys , uint8_t rx_phys, uint8_t phy_opt);
910 
911 /**
912  ****************************************************************************************
913  * @brief Get the information of the connection.
914  * @note Once the connection information has been available, the callback function @ref gap_cb_fun_t::app_gap_connection_info_get_cb will be called.
915  *
916  * @param[in] conn_idx: The index of connection.
917  * @param[in] opcode: The operation code. See @ref gap_get_conn_info_op_t.
918  *
919  * @retval ::SDK_SUCCESS: Operation is Success.
920  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
921  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
922  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
923  ****************************************************************************************
924  */
925 uint16_t ble_gap_conn_info_get(uint8_t conn_idx, gap_get_conn_info_op_t opcode);
926 
927 /**
928  ****************************************************************************************
929  * @brief Get the information of the peer device.
930  * @note Once the peer information has been available, the callback function @ref gap_cb_fun_t::app_gap_peer_info_get_cb will be called.
931  *
932  * @param[in] conn_idx: The index of connection.
933  * @param[in] opcode: The operation code. See @ref gap_get_peer_info_op_t.
934  *
935  * @retval ::SDK_SUCCESS: Operation is Success.
936  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
937  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
938  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
939  ****************************************************************************************
940  */
941 uint16_t ble_gap_peer_info_get(uint8_t conn_idx, gap_get_peer_info_op_t opcode);
942 
943 /** @} */
944 
945 #endif
946 /** @} */
947 /** @} */
948 /** @} */
gap_max_data_len_t::suppted_max_rx_octets
uint16_t suppted_max_rx_octets
Maximum number of payload octets that the local Controller supports for reception of a single Link La...
Definition: ble_gapc.h:244
gap_nb_adv_sets_t::nb_adv_sets
uint8_t nb_adv_sets
Number of available advertising sets.
Definition: ble_gapc.h:262
GAP_HCI_AUTHENTICATION_FAILURE
@ GAP_HCI_AUTHENTICATION_FAILURE
Authentication Failure.
Definition: ble_gapc.h:176
gap_dev_version_ind_t
The struct of device version.
Definition: ble_gapc.h:194
GAP_HCI_REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES
@ GAP_HCI_REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES
Remote Device Terminated Connection due to Low Resources .
Definition: ble_gapc.h:178
GAP_LL_ROLE_SLAVE
@ GAP_LL_ROLE_SLAVE
Slave role.
Definition: ble_gapc.h:139
gap_peer_info_param_t::peer_info
gap_peer_info_t peer_info
Peer info.
Definition: ble_gapc.h:467
gap_max_data_len_t::suppted_max_tx_time
uint16_t suppted_max_tx_time
Maximum time, in microseconds, that the local Controller supports for transmission of a single Link L...
Definition: ble_gapc.h:242
gap_peer_version_ind_t
Peer version info.
Definition: ble_gapc.h:423
gap_con_plan_tag_t
The Structure for BLE Connection Arrangement.
Definition: ble_gapc.h:481
gap_peer_info_t
LE peer info.
Definition: ble_gapc.h:458
__ARRAY_EMPTY
#define __ARRAY_EMPTY
Empty Array.
Definition: gr55xx_sys_cfg.h:57
gap_sugg_dflt_data_len_t
Suggested default data length info.
Definition: ble_gapc.h:252
gap_bdaddr_t::gap_addr
gap_addr_t gap_addr
Device BD Address.
Definition: ble_gapc.h:213
gap_sugg_dflt_data_len_t::suggted_max_tx_octets
uint16_t suggted_max_tx_octets
The Host's suggested value for the Controller's maximum transmitted number of payload octets to be us...
Definition: ble_gapc.h:253
GAP_CHNL_MAP_LEN
#define GAP_CHNL_MAP_LEN
The length of channel map.
Definition: ble_gapc.h:68
gap_conn_cmp_t::conhdl
uint16_t conhdl
Connection_Handle.
Definition: ble_gapc.h:379
gap_con_plan_tag_t::conn_idx
uint16_t conn_idx
Connection Index.
Definition: ble_gapc.h:482
gap_ext_adv_report_ind_t::phy_prim
uint8_t phy_prim
Primary PHY on which advertising report has been received.
Definition: ble_gapc.h:326
gap_sync_established_ind_t::phy
uint8_t phy
PHY on which synchronization has been established.
Definition: ble_gapc.h:309
GAP_REPORT_TYPE_ADV_EXT
@ GAP_REPORT_TYPE_ADV_EXT
Extended advertising report.
Definition: ble_gapc.h:111
gap_dev_version_ind_t::hci_ver
uint8_t hci_ver
HCI version.
Definition: ble_gapc.h:195
GAP_LL_ROLE_MASTER
@ GAP_LL_ROLE_MASTER
Master role.
Definition: ble_gapc.h:138
gap_peer_version_ind_t::lmp_subvers
uint16_t lmp_subvers
LMP subversion.
Definition: ble_gapc.h:425
GAP_OPCODE_PER_ADV_LIST_SET
@ GAP_OPCODE_PER_ADV_LIST_SET
Set periodic advertising list.
Definition: ble_gapc.h:149
gap_peer_version_ind_t::lmp_vers
uint8_t lmp_vers
LMP version.
Definition: ble_gapc.h:426
gap_ext_adv_report_ind_t::length
uint16_t length
Report length.
Definition: ble_gapc.h:331
gap_get_peer_info_op_t
gap_get_peer_info_op_t
The operation code used to get peer device info.
Definition: ble_gapc.h:103
gap_dev_version_ind_t::lmp_ver
uint8_t lmp_ver
LMP version.
Definition: ble_gapc.h:196
gap_peer_info_param_t
Get peer info operation struct.
Definition: ble_gapc.h:465
gap_le_pkt_size_ind_t
Supported data length size Indication.
Definition: ble_gapc.h:472
gap_dev_rf_path_comp_ind_t::rx_path_comp
uint16_t rx_path_comp
RF RX path compensation.
Definition: ble_gapc.h:275
gap_sync_established_ind_t::bd_addr
gap_bdaddr_t bd_addr
Advertiser address.
Definition: ble_gapc.h:313
gap_ext_adv_report_ind_t::phy_second
uint8_t phy_second
Secondary PHY on which advertising report has been received.
Definition: ble_gapc.h:327
gap_max_data_len_t
Max data length info struct.
Definition: ble_gapc.h:239
gap_psm_manager_op_id_t
gap_psm_manager_op_id_t
Operation code used for LEPSM manager.
Definition: ble_gapc.h:166
GAP_GET_PEER_FEATURES
@ GAP_GET_PEER_FEATURES
Get peer device features info.
Definition: ble_gapc.h:105
gap_ext_adv_report_ind_t::direct_addr
gap_bdaddr_t direct_addr
Target address (in case of a directed advertising report).
Definition: ble_gapc.h:323
gap_ext_adv_report_ind_t::broadcaster_addr
gap_bdaddr_t broadcaster_addr
Broadcaster device address.
Definition: ble_gapc.h:322
gap_adv_report_type_t
gap_adv_report_type_t
Advertising report type.
Definition: ble_gapc.h:110
GAP_REPORT_TYPE_SCAN_RSP_EXT
@ GAP_REPORT_TYPE_SCAN_RSP_EXT
Extended scan response report.
Definition: ble_gapc.h:113
gap_conn_info_param_t
The info of connecting operation.
Definition: ble_gapc.h:416
gap_ext_adv_report_ind_t::rssi
int8_t rssi
RSSI (between -127 and +20 dBm).
Definition: ble_gapc.h:325
gap_rslv_addr_read_t::op_code
uint8_t op_code
Operation code.
Definition: ble_gapc.h:302
gap_chnl_map_t
Channel map structure.
Definition: ble_gapc.h:392
gap_peer_name_ind_t
Name of peer device indication.
Definition: ble_gapc.h:337
GAP_HCI_REMOTE_USER_TERMINATED_CONNECTION
@ GAP_HCI_REMOTE_USER_TERMINATED_CONNECTION
Remote User Terminated Connection.
Definition: ble_gapc.h:177
gap_max_adv_data_len_ind_t::length
uint16_t length
Maximum advertising data length supported by controller.
Definition: ble_gapc.h:268
gap_conn_update_cmp_t::latency
uint16_t latency
Latency for the connection in number of connection events.
Definition: ble_gapc.h:348
GAP_OPCODE_WHITELIST_SET
@ GAP_OPCODE_WHITELIST_SET
Set white list.
Definition: ble_gapc.h:148
gap_le_phy_ind_t::rx_phy
uint8_t rx_phy
LE PHY for data reception.
Definition: ble_gapc.h:401
GAP_HCI_REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF
@ GAP_HCI_REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF
Remote Device Terminated Connection due to Power Off.
Definition: ble_gapc.h:179
app_ble_init_cmp_cb_t
void(* app_ble_init_cmp_cb_t)(void)
BLE initialization completed callback function for application.
Definition: ble_gapc.h:496
GAP_HCI_UNSUPPORTED_REMOTE_FEATURE
@ GAP_HCI_UNSUPPORTED_REMOTE_FEATURE
Unsupported Remote Feature.
Definition: ble_gapc.h:180
GAP_OPCODE_LEPSM_REGISTER
@ GAP_OPCODE_LEPSM_REGISTER
LEPSM register operation.
Definition: ble_gapc.h:167
gap_le_pkt_size_ind_t::max_tx_octets
uint16_t max_tx_octets
The maximum number of payload octets in TX.
Definition: ble_gapc.h:473
ble_gap_conn_info_get
uint16_t ble_gap_conn_info_get(uint8_t conn_idx, gap_get_conn_info_op_t opcode)
Get the information of the connection.
gap_peer_features_ind_t
LE features info.
Definition: ble_gapc.h:431
gap_ext_adv_report_ind_t::adv_info
uint8_t adv_info
Bit field providing information about the received report.
Definition: ble_gapc.h:321
gap_conn_update_cmp_t::sup_timeout
uint16_t sup_timeout
Supervision timeout for the LE link.
Definition: ble_gapc.h:349
GAP_REPORT_INFO_SCAN_ADV_BIT
@ GAP_REPORT_INFO_SCAN_ADV_BIT
Scannable advertising.
Definition: ble_gapc.h:123
gap_conn_cmp_t::clk_accuracy
uint8_t clk_accuracy
Clock accuracy (0x00: 500 ppm, 0x01: 250 ppm, 0x02: 150 ppm, 0x03: 100 ppm, 0x04: 75 ppm,...
Definition: ble_gapc.h:383
gap_set_pref_slave_evt_dur_param_t::single_tx
uint8_t single_tx
Slave transmits a single packet per connection event (False/True).
Definition: ble_gapc.h:492
ble_gap_latency_set
uint16_t ble_gap_latency_set(uint8_t conn_idx, uint16_t latency)
Set connection's Latency.
gap_ext_adv_report_ind_t::period_adv_intv
uint16_t period_adv_intv
Periodic advertising interval (in unit of 1.25ms, min is 7.5ms), valid only for periodic advertising ...
Definition: ble_gapc.h:329
gap_peer_name_ind_t::peer_addr
gap_addr_t peer_addr
Peer device bd address.
Definition: ble_gapc.h:338
gap_sync_established_ind_t::intv
uint16_t intv
Periodic advertising interval (in unit of 1.25ms, min is 7.5ms).
Definition: ble_gapc.h:310
gr55xx_sys_cfg.h
Define the chip configuration.
gap_conn_cmp_t::peer_addr_type
uint8_t peer_addr_type
Peer address type(0x00: Public Device Address, 0x01 : Random Device Address, others: reserved for fut...
Definition: ble_gapc.h:385
gap_dev_version_ind_t::host_subver
uint16_t host_subver
Host subversion.
Definition: ble_gapc.h:200
gap_bdaddr_t
The struct of broadcast address with broadcast type.
Definition: ble_gapc.h:212
gap_ext_adv_report_ind_t::tx_pwr
int8_t tx_pwr
TX power (in dBm).
Definition: ble_gapc.h:324
gap_conn_update_param_t::interval_min
uint16_t interval_min
Minimum value for the connection interval.
Definition: ble_gapc.h:366
gap_ext_adv_report_ind_t::adv_sid
uint8_t adv_sid
Advertising SID , valid only for periodic advertising report.
Definition: ble_gapc.h:328
gap_sync_established_ind_t
Sync established indication.
Definition: ble_gapc.h:308
GAP_GET_CON_CHANNEL_MAP
@ GAP_GET_CON_CHANNEL_MAP
Get connection channel map.
Definition: ble_gapc.h:96
GAP_GET_PEER_VERSION
@ GAP_GET_PEER_VERSION
Get peer device version info.
Definition: ble_gapc.h:104
GAP_REPORT_TYPE_SCAN_RSP_LEG
@ GAP_REPORT_TYPE_SCAN_RSP_LEG
Legacy scan response report.
Definition: ble_gapc.h:114
gap_conn_cmp_t
Connection complete info.
Definition: ble_gapc.h:378
gap_peer_info_param_t::opcode
uint8_t opcode
Operation code.
Definition: ble_gapc.h:466
ble_gap_phy_update
uint16_t ble_gap_phy_update(uint8_t conn_idx, uint8_t tx_phys, uint8_t rx_phys, uint8_t phy_opt)
Set the PHY preferences for the connection identified by the connection index.
GAP_OPCODE_LEPSM_UNREGISTER
@ GAP_OPCODE_LEPSM_UNREGISTER
LEPSM unregister operation.
Definition: ble_gapc.h:168
gap_dev_tx_power_t::max_tx_pwr
int8_t max_tx_pwr
MAX of TX power.
Definition: ble_gapc.h:234
gap_cb_fun_t
The gap callback function struct.
Definition: ble_gapc.h:500
gap_conn_info_t::rssi
int8_t rssi
RSSI.
Definition: ble_gapc.h:407
GAP_STOPPED_REASON_CONN_EST
@ GAP_STOPPED_REASON_CONN_EST
Stop with connection established.
Definition: ble_gapc.h:132
gap_dev_tx_power_t
TX power info struct.
Definition: ble_gapc.h:232
gap_adv_report_info_t
gap_adv_report_info_t
Advertising report information.
Definition: ble_gapc.h:120
gap_conn_info_t
Connection info.
Definition: ble_gapc.h:406
ble_error.h
File that contains error codes.
gap_peer_version_ind_t::compid
uint16_t compid
Manufacturer name.
Definition: ble_gapc.h:424
gap_con_plan_tag_t::interval
uint32_t interval
Connection Interval (in 625us).
Definition: ble_gapc.h:483
gap_get_bd_addr_t
Get broadcast address struct.
Definition: ble_gapc.h:219
gap_set_pref_slave_evt_dur_param_t
Set preference slave event duration.
Definition: ble_gapc.h:490
gap_set_pref_slave_evt_dur_param_t::duration
uint16_t duration
Preferred event duration.
Definition: ble_gapc.h:491
gap_le_pkt_size_ind_t::max_tx_time
uint16_t max_tx_time
The maximum time that the local Controller will take to TX.
Definition: ble_gapc.h:474
gap_dev_info_get_t::operation
uint8_t operation
Operation code.
Definition: ble_gapc.h:295
GAP_GET_PHY
@ GAP_GET_PHY
Get connection PHY.
Definition: ble_gapc.h:97
gap_dev_rf_path_comp_ind_t::tx_path_comp
uint16_t tx_path_comp
RF TX path compensation.
Definition: ble_gapc.h:274
gap_conn_cmp_t::peer_addr
gap_addr_t peer_addr
Peer BT address.
Definition: ble_gapc.h:386
gap_conn_info_t::chnl_map
gap_chnl_map_t chnl_map
channel map.
Definition: ble_gapc.h:408
GAP_GET_CON_RSSI
@ GAP_GET_CON_RSSI
Get connection RSSI info.
Definition: ble_gapc.h:95
ble_gap_conn_param_update
uint16_t ble_gap_conn_param_update(uint8_t conn_idx, const gap_conn_update_param_t *p_conn_param)
Change the Link Layer connection parameters of a connection.
gap_dev_info_t::sugg_dflt_data_len
gap_sugg_dflt_data_len_t sugg_dflt_data_len
Suggested default data length info.
Definition: ble_gapc.h:284
gap_conn_info_param_t::info
gap_conn_info_t info
Connection info.
Definition: ble_gapc.h:418
gap_ext_adv_report_ind_t::per_sync_idx
uint8_t per_sync_idx
Periodic syncronization index, valid only for periodic advertising report.
Definition: ble_gapc.h:330
gap_dev_info_t::nb_adv_sets
gap_nb_adv_sets_t nb_adv_sets
Number of available advertising sets.
Definition: ble_gapc.h:286
gap_dev_info_t::adv_tx_power
gap_dev_adv_tx_power_t adv_tx_power
Advertising TX power info.
Definition: ble_gapc.h:283
gap_dev_rf_path_comp_ind_t
RF path compensation values info.
Definition: ble_gapc.h:273
gap_dev_info_t::dev_tx_power
gap_dev_tx_power_t dev_tx_power
Device TX power info.
Definition: ble_gapc.h:288
gap_conn_update_param_t::interval_max
uint16_t interval_max
Maximum value for the connection interval.
Definition: ble_gapc.h:368
gap_dev_adv_tx_power_t
TX power info struct.
Definition: ble_gapc.h:226
gap_dev_info_t::dev_version
gap_dev_version_ind_t dev_version
Version info.
Definition: ble_gapc.h:281
gap_le_pkt_size_ind_t::max_rx_time
uint16_t max_rx_time
The maximum time that the local Controller will take to RX.
Definition: ble_gapc.h:476
gap_conn_cmp_t::con_latency
uint16_t con_latency
Latency for the connection in number of connection events.
Definition: ble_gapc.h:381
gap_peer_name_ind_t::addr_type
uint8_t addr_type
Peer device address type.
Definition: ble_gapc.h:339
gap_conn_info_param_t::opcode
uint8_t opcode
Operation code.
Definition: ble_gapc.h:417
GAP_REPORT_INFO_CONN_ADV_BIT
@ GAP_REPORT_INFO_CONN_ADV_BIT
Connectable advertising.
Definition: ble_gapc.h:122
gap_le_pkt_size_ind_t::max_rx_octets
uint16_t max_rx_octets
The maximum number of payload octets in RX.
Definition: ble_gapc.h:475
gap_rslv_addr_read_t
Read resolvable address info struct.
Definition: ble_gapc.h:301
ble_gap_con_plan_consult
uint16_t ble_gap_con_plan_consult(uint8_t *p_act_num, gap_con_plan_tag_t **p_conn_plan_arr)
Consult BLE connection activity plan situation function.
gap_get_conn_info_op_t
gap_get_conn_info_op_t
The operation code used to get connection info.
Definition: ble_gapc.h:94
GAP_REPORT_INFO_DIR_ADV_BIT
@ GAP_REPORT_INFO_DIR_ADV_BIT
Directed advertising.
Definition: ble_gapc.h:124
GAP_FEATS_LEN
#define GAP_FEATS_LEN
The length of features.
Definition: ble_gapc.h:69
gap_dev_info_t::dev_rf_path_comp
gap_dev_rf_path_comp_ind_t dev_rf_path_comp
RF path compensation values.
Definition: ble_gapc.h:289
GAP_OPCODE_PRIVACY_MODE_SET
@ GAP_OPCODE_PRIVACY_MODE_SET
Set privacy mode for peer device.
Definition: ble_gapc.h:150
gap_conn_info_t::phy
gap_le_phy_ind_t phy
PHY indicaiton.
Definition: ble_gapc.h:409
ble_gap_data_length_update
uint16_t ble_gap_data_length_update(uint8_t conn_idx, uint16_t tx_octects, uint16_t tx_time)
The suggested maximum transmission packet size and maximum packet transmission time to be used for a ...
gap_sync_established_ind_t::sync_hdl
uint16_t sync_hdl
Sync handle.
Definition: ble_gapc.h:314
gap_addr_t
The struct of address.
Definition: ble_gapc.h:206
gap_conn_cmp_t::con_interval
uint16_t con_interval
Connection interval.
Definition: ble_gapc.h:380
gap_get_bd_addr_t::bd_addr
gap_bdaddr_t bd_addr
BD address.
Definition: ble_gapc.h:221
GAP_HCI_CONN_INTERVAL_UNACCEPTABLE
@ GAP_HCI_CONN_INTERVAL_UNACCEPTABLE
Unacceptable Connection Parameters.
Definition: ble_gapc.h:182
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_max_data_len_t::suppted_max_tx_octets
uint16_t suppted_max_tx_octets
Maximum number of payload octets that the local Controller supports for transmission of a single Link...
Definition: ble_gapc.h:240
gap_dev_version_ind_t::hci_subver
uint16_t hci_subver
HCI subversion.
Definition: ble_gapc.h:198
gap_le_phy_ind_t
PHY info.
Definition: ble_gapc.h:399
gap_dev_info_get_t::dev_info
gap_dev_info_t dev_info
Device info.
Definition: ble_gapc.h:296
gap_conn_cmp_t::sup_to
uint16_t sup_to
Connection supervision timeout.
Definition: ble_gapc.h:382
gap_dev_version_ind_t::manuf_name
uint16_t manuf_name
Manufacturer name.
Definition: ble_gapc.h:201
gap_conn_info_t::chan_sel_algo
uint8_t chan_sel_algo
Chanel Selection algorithm, 0x00: LE Channel Selection Algorithm #1 is used.
Definition: ble_gapc.h:410
gap_conn_param_t::sup_timeout
uint16_t sup_timeout
Supervision timeout for the LE link.
Definition: ble_gapc.h:360
gap_dev_info_get_t
Get device info operation struct.
Definition: ble_gapc.h:294
ble_gap_disconnect_with_reason
uint16_t ble_gap_disconnect_with_reason(uint8_t conn_idx, gap_disconn_reason_t reason)
Terminate an existing connection with a specified reason.
GAP_STOPPED_REASON_TIMEOUT
@ GAP_STOPPED_REASON_TIMEOUT
Stop with timeout.
Definition: ble_gapc.h:130
GAP_ADDR_LEN
#define GAP_ADDR_LEN
The length of address.
Definition: ble_gapc.h:70
gap_disconn_reason_t
gap_disconn_reason_t
The specified reason for terminating a connection.
Definition: ble_gapc.h:175
gap_dev_version_ind_t::lmp_subver
uint16_t lmp_subver
LMP subversion.
Definition: ble_gapc.h:199
gap_con_plan_tag_t::offset
uint32_t offset
Connection Offset (in 625us).
Definition: ble_gapc.h:484
gap_conn_update_cmp_t
Connection parameter used to update connection parameters.
Definition: ble_gapc.h:346
gap_dev_info_t::max_adv_data_len
gap_max_adv_data_len_ind_t max_adv_data_len
Maximum advertising data length info.
Definition: ble_gapc.h:287
gap_peer_info_t::peer_features
gap_peer_features_ind_t peer_features
Features info.
Definition: ble_gapc.h:460
ble_gap_disconnect
uint16_t ble_gap_disconnect(uint8_t conn_idx)
Terminate an existing connection.
gap_get_bd_addr_t::index
uint8_t index
Advertsing index.
Definition: ble_gapc.h:220
gap_conn_param_t
The parameter of connection.
Definition: ble_gapc.h:354
gap_con_plan_tag_t::duration
uint32_t duration
Connection Duration (in 625us).
Definition: ble_gapc.h:485
gap_ll_role_type_t
gap_ll_role_type_t
Device role of LL layer type.
Definition: ble_gapc.h:137
GAP_OPCODE_LOCAL_RSLV_ADDR_READ
@ GAP_OPCODE_LOCAL_RSLV_ADDR_READ
Local resolvable address operation.
Definition: ble_gapc.h:158
GAP_REPORT_TYPE_PER_ADV
@ GAP_REPORT_TYPE_PER_ADV
Periodic advertising report.
Definition: ble_gapc.h:115
gap_dev_info_t
Device info.
Definition: ble_gapc.h:280
gap_conn_update_cmp_t::interval
uint16_t interval
Connection interval.
Definition: ble_gapc.h:347
gap_le_phy_ind_t::tx_phy
uint8_t tx_phy
LE PHY for data transmission.
Definition: ble_gapc.h:400
gap_stopped_reason_t
gap_stopped_reason_t
Stop reason code.
Definition: ble_gapc.h:129
gap_dev_tx_power_t::min_tx_pwr
int8_t min_tx_pwr
MIN of TX power.
Definition: ble_gapc.h:233
gap_max_data_len_t::suppted_max_rx_time
uint16_t suppted_max_rx_time
Maximum time, in microseconds, that the local Controller supports for reception of a single Link Laye...
Definition: ble_gapc.h:246
gap_rslv_addr_read_t::gap_addr
gap_addr_t gap_addr
Resolvable address info.
Definition: ble_gapc.h:303
gap_conn_cmp_t::ll_role
gap_ll_role_type_t ll_role
Device Role of LL Layer.
Definition: ble_gapc.h:387
ble_gap_conn_param_update_reply
uint16_t ble_gap_conn_param_update_reply(uint8_t conn_idx, bool accept)
Connection param update reply to peer device.
gap_ext_adv_report_ind_t
APP receives the extended advertising report indication info struct.
Definition: ble_gapc.h:319
gap_sugg_dflt_data_len_t::suggted_max_tx_time
uint16_t suggted_max_tx_time
The Host's suggested value for the Controller's maximum packet transmission time to be used for new c...
Definition: ble_gapc.h:255
gap_ext_adv_report_ind_t::adv_type
uint8_t adv_type
Advertising type.
Definition: ble_gapc.h:320
gap_bdaddr_t::addr_type
uint8_t addr_type
Address type of the device: 0=public/1=random.
Definition: ble_gapc.h:214
GAP_GET_CHAN_SEL_ALGO
@ GAP_GET_CHAN_SEL_ALGO
Get selection algorithm for connection channel.
Definition: ble_gapc.h:98
gap_conn_update_param_t
The parameter of update connection.
Definition: ble_gapc.h:365
gap_nb_adv_sets_t
Number of available advertising sets info.
Definition: ble_gapc.h:261
gap_dev_info_t::max_data_len
gap_max_data_len_t max_data_len
Suggested MAX data length info.
Definition: ble_gapc.h:285
gap_dev_info_t::get_bd_addr
gap_get_bd_addr_t get_bd_addr
Device BD address info.
Definition: ble_gapc.h:282
GAP_HCI_PAIRING_WITH_UNIT_KEY_UNSUPPORTED
@ GAP_HCI_PAIRING_WITH_UNIT_KEY_UNSUPPORTED
Pairing With Unit Key Not Supported.
Definition: ble_gapc.h:181
gap_dev_adv_tx_power_t::power_lvl
int8_t power_lvl
Advertising channel TX power level.
Definition: ble_gapc.h:227
GAP_REPORT_INFO_COMPLETE_BIT
@ GAP_REPORT_INFO_COMPLETE_BIT
Report is complete.
Definition: ble_gapc.h:121
gap_max_adv_data_len_ind_t
Maximum advertising data length info.
Definition: ble_gapc.h:267
gap_conn_update_param_t::ce_len
uint16_t ce_len
The length of connection event needed for this LE connection.
Definition: ble_gapc.h:372
GAP_STOPPED_REASON_ON_USER
@ GAP_STOPPED_REASON_ON_USER
Stop with user stopping it actively.
Definition: ble_gapc.h:131
gap_conn_update_param_t::slave_latency
uint16_t slave_latency
Slave latency for the connection in number of connection events.
Definition: ble_gapc.h:370
gap_conn_param_t::interval_min
uint16_t interval_min
Minimum value for the connection interval.
Definition: ble_gapc.h:355
gap_sync_established_ind_t::clk_acc
uint8_t clk_acc
Advertiser clock accuracy.
Definition: ble_gapc.h:312
gap_sync_established_ind_t::adv_sid
uint8_t adv_sid
Advertising SID.
Definition: ble_gapc.h:311
gap_conn_param_t::slave_latency
uint16_t slave_latency
Slave latency for the connection in number of connection events.
Definition: ble_gapc.h:359
GAP_REPORT_TYPE_ADV_LEG
@ GAP_REPORT_TYPE_ADV_LEG
Legacy advertising report.
Definition: ble_gapc.h:112
gap_dev_version_ind_t::host_ver
uint8_t host_ver
Host version.
Definition: ble_gapc.h:197
gap_conn_param_t::interval_max
uint16_t interval_max
Maximum value for the connection interval.
Definition: ble_gapc.h:357
ble_gap_peer_info_get
uint16_t ble_gap_peer_info_get(uint8_t conn_idx, gap_get_peer_info_op_t opcode)
Get the information of the peer device.
gap_peer_info_t::peer_version
gap_peer_version_ind_t peer_version
Version info.
Definition: ble_gapc.h:459
gap_param_set_op_id_t
gap_param_set_op_id_t
Operation code used to set param(s).
Definition: ble_gapc.h:146
gap_peer_name_ind_t::name_len
uint8_t name_len
Peer device name length.
Definition: ble_gapc.h:340
GAP_OPCODE_CHNL_MAP_SET
@ GAP_OPCODE_CHNL_MAP_SET
Set Channel Map.
Definition: ble_gapc.h:147
gap_conn_update_param_t::sup_timeout
uint16_t sup_timeout
Supervision timeout for the LE link.
Definition: ble_gapc.h:371
GAP_OPCODE_PEER_RSLV_ADDR_READ
@ GAP_OPCODE_PEER_RSLV_ADDR_READ
Peer resolvable address operation.
Definition: ble_gapc.h:159