TI BLE5-Stack API Documentation  2.01.02.00
gap_advertiser.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  Group: WCS, BTS
4  $Target Device: DEVICES $
5 
6  ******************************************************************************
7  $License: TISD 2009 $
8  ******************************************************************************
9  $Release Name: PACKAGE NAME $
10  $Release Date: PACKAGE RELEASE DATE $
11  *****************************************************************************/
12 
22 #ifndef GAP_ADVERTISER_H
23 #define GAP_ADVERTISER_H
24 
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #endif
29 
30 /*-------------------------------------------------------------------
31  * INCLUDES
32  */
33 #include "bcomdef.h"
34 #include "osal.h"
35 #include "gap.h"
36 
37 /*-------------------------------------------------------------------
38  * MACROS
39  */
40 
41 // This is a common file for the legacy and sysconfig examples,
42 // the parameters under ifndef SYSCFG are defined in this file for
43 // the legacy examples and generated using the sysconfig tool for
44 // the sysconfig examples
45 #ifndef SYSCFG
46 
52 #define GAPADV_PARAMS_LEGACY_SCANN_CONN { \
54  .eventProps = GAP_ADV_PROP_CONNECTABLE | GAP_ADV_PROP_SCANNABLE | \
55  GAP_ADV_PROP_LEGACY, \
56  .primIntMin = 160, \
57  .primIntMax = 160, \
58  .primChanMap = GAP_ADV_CHAN_ALL, \
59  .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID, \
60  .peerAddr = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }, \
61  .filterPolicy = GAP_ADV_WL_POLICY_ANY_REQ, \
62  .txPower = GAP_ADV_TX_POWER_NO_PREFERENCE, \
63  .primPhy = GAP_ADV_PRIM_PHY_1_MBPS, \
64  .secPhy = GAP_ADV_SEC_PHY_1_MBPS, \
65  .sid = 0 \
66 }
67 
69 #define GAPADV_PARAMS_AE_LONG_RANGE_CONN { \
70  .eventProps = GAP_ADV_PROP_CONNECTABLE, \
71  .primIntMin = 160, \
72  .primIntMax = 160, \
73  .primChanMap = GAP_ADV_CHAN_ALL, \
74  .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID, \
75  .peerAddr = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }, \
76  .filterPolicy = GAP_ADV_WL_POLICY_ANY_REQ, \
77  .txPower = GAP_ADV_TX_POWER_NO_PREFERENCE, \
78  .primPhy = GAP_ADV_PRIM_PHY_CODED_S2, \
79  .secPhy = GAP_ADV_SEC_PHY_CODED_S2, \
80  .sid = 0 \
81 }
82 
84 #endif
85 
86 /*-------------------------------------------------------------------
87  * CONSTANTS
88  */
89 
143 typedef enum
144 {
153 
164 
178 
190 
199 
208 
217 
238 
250 
262 
276 
278  GAP_ADV_PARAM_COUNT
288 #define GAP_ADV_INVALID_HANDLE 0xFF
290 
293 {
301 };
303 
305 typedef enum
306 {
310 
312 typedef enum
313 {
318 
320 typedef enum
321 {
336 
338 typedef enum
339 {
340  GAP_ADV_CHAN_37 = BV(0),
341  GAP_ADV_CHAN_38 = BV(1),
342  GAP_ADV_CHAN_39 = BV(2),
344  GAP_ADV_CHAN_38),
346  GAP_ADV_CHAN_39),
348  GAP_ADV_CHAN_39),
353 
355 typedef enum
356 {
377 
379 #define GAP_ADV_TX_POWER_NO_PREFERENCE 127
380 
382 typedef enum
383 {
388 
390 typedef enum
391 {
397 
405 typedef enum
406 {
410  GAP_ADV_EVT_MASK_SCAN_REQ_NOTI = AE_NOTIFY_ENABLE_SCAN_REQUEST,
418  GAP_ADV_EVT_MASK_START_AFTER_ENABLE = AE_NOTIFY_ENABLE_ADV_SET_START,
422  GAP_ADV_EVT_MASK_START = AE_NOTIFY_ENABLE_ADV_START,
426  GAP_ADV_EVT_MASK_END = AE_NOTIFY_ENABLE_ADV_END,
430  GAP_ADV_EVT_MASK_END_AFTER_DISABLE = AE_NOTIFY_ENABLE_ADV_SET_END,
441 
444  GAP_ADV_EVT_MASK_RESERVED = BV(15)
447 
450 /*-------------------------------------------------------------------
451  * Structures
452  */
453 
466 typedef struct
467 {
468  uint16_t eventProps;
469  uint32_t primIntMin;
470  uint32_t primIntMax;
473  uint8_t peerAddr[B_ADDR_LEN];
474  GapAdv_filterPolicy_t filterPolicy;
475  int8_t txPower;
478  uint8_t sid;
480 
481 
483 typedef struct
484 {
485  uint8 handle;
486  uint8 status;
487  uint16 connHandle;
490 
492 typedef struct
493 {
494  uint8 handle;
495  uint8 scanAddrType;
496  uint8 scanAddr[B_ADDR_LEN];
497  uint8 channel;
498  int8 rssi;
500 
502 typedef struct
503 {
504  uint8 handle;
506 
509  uint16 advDataLen;
511 
514 /*-------------------------------------------------------------------
515  * FUNCTIONS - Advertising
516  */
517 
544 extern bStatus_t GapAdv_create(pfnGapCB_t *cb, GapAdv_params_t *advParam,
545  uint8 *advHandle);
546 
567 extern bStatus_t GapAdv_destroy(uint8 handle,
568  GapAdv_freeBufferOptions_t freeOptions);
569 
604 extern bStatus_t GapAdv_enable(uint8 handle,
605  GapAdv_enableOptions_t enableOptions,
606  uint16 durationOrMaxEvents);
607 
625 extern bStatus_t GapAdv_disable(uint8 handle);
626 
643 extern bStatus_t GapAdv_setEventMask(uint8 handle, GapAdv_eventMaskFlags_t mask);
644 
663 extern bStatus_t GapAdv_setParam(uint8 handle, GapAdv_ParamId_t paramID,
664  void *pValue);
665 
685 extern bStatus_t GapAdv_getParam(uint8 handle, GapAdv_ParamId_t paramID,
686  void *pValue, uint8_t *pLen);
687 
705 extern bStatus_t GapAdv_getBuffer(uint8 handle, GapAdv_dataTypes_t dataType,
706  uint16 *pLen, uint8 **ppBuf);
707 
767  GapAdv_freeBufferOptions_t freeOptions);
768 
813 bStatus_t GapAdv_loadByHandle(uint8 handle, GapAdv_dataTypes_t dataType,
814  uint16 len, uint8 *pBuf);
815 
854 extern bStatus_t GapAdv_prepareLoadByBuffer(uint8 *pBuf, bool freeOldData);
855 
886 extern bStatus_t GapAdv_loadByBuffer(uint16 len, uint8 *pBuf);
887 
896 extern bStatus_t GapAdv_abortLoad(void);
897 
917 extern bStatus_t GapAdv_setVirtualAdvAddr(uint8 advHandle, uint8 *bdAddr);
918 
919 /*-------------------------------------------------------------------
920 -------------------------------------------------------------------*/
921 
922 #ifdef __cplusplus
923 }
924 #endif
925 
926 #endif /* GAP_ADVERTISER_H */
927 
Omit advertiser's address from PDU's.
Definition: gap_advertiser.h:299
uint32_t primIntMax
GAP_ADV_PARAM_PRIMARY_INTERVAL_MAX
Definition: gap_advertiser.h:470
This API allows the software components in the Z-Stack to be written independently of the specifics o...
All Channels.
Definition: gap_advertiser.h:349
GAP_Peer_Addr_Types_t
Address types used for specifying peer address type.
Definition: gap.h:598
coded-s2
Definition: gap_advertiser.h:386
Channels 37 & 39.
Definition: gap_advertiser.h:345
bStatus_t GapAdv_setParam(uint8 handle, GapAdv_ParamId_t paramID, void *pValue)
bStatus_t GapAdv_getParam(uint8 handle, GapAdv_ParamId_t paramID, void *pValue, uint8_t *pLen)
Definition: gap_advertiser.h:275
uint32_t primIntMin
GAP_ADV_PARAM_PRIMARY_INTERVAL_MIN
Definition: gap_advertiser.h:469
bStatus_t GapAdv_prepareLoadByHandle(uint8 handle, GapAdv_freeBufferOptions_t freeOptions)
GapAdv_freeBufferOptions_t
Possible free options for Gap Advertiser API's.
Definition: gap_advertiser.h:312
Definition: gap_advertiser.h:434
1 mbps
Definition: gap_advertiser.h:384
Definition: gap_advertiser.h:207
bStatus_t GapAdv_loadByHandle(uint8 handle, GapAdv_dataTypes_t dataType, uint16 len, uint8 *pBuf)
Definition: gap_advertiser.h:300
Directed advertising.
Definition: gap_advertiser.h:296
bStatus_t GapAdv_abortLoad(void)
bStatus_t GapAdv_setVirtualAdvAddr(uint8 advHandle, uint8 *bdAddr)
Definition: gap_advertiser.h:422
bStatus_t GapAdv_enable(uint8 handle, GapAdv_enableOptions_t enableOptions, uint16 durationOrMaxEvents)
Data type returned with GAP_EVT_ADV_DATA_TRUNCATED event.
Definition: gap_advertiser.h:502
int8 rssi
RSSI of the scan req.
Definition: gap_advertiser.h:498
Scannable advertising.
Definition: gap_advertiser.h:295
uint16_t eventProps
GAP_ADV_PARAM_PROPS
Definition: gap_advertiser.h:468
Free the scan response data.
Definition: gap_advertiser.h:316
uint8 channel
Channel when the scan req was received.
Definition: gap_advertiser.h:497
GapAdv_enableOptions_t
Enable options for GapAdv_enable.
Definition: gap_advertiser.h:320
Definition: gap_advertiser.h:410
GapAdv_ParamId_t
Definition: gap_advertiser.h:143
Definition: gap_advertiser.h:361
1 mbps
Definition: gap_advertiser.h:392
uint8 handle
Advertising handle.
Definition: gap_advertiser.h:485
Don't free anything.
Definition: gap_advertiser.h:314
Definition: gap_advertiser.h:261
Channels 38 & 39.
Definition: gap_advertiser.h:347
bStatus_t GapAdv_disable(uint8 handle)
Disable an active advertising set.
void(* pfnGapCB_t)(uint32_t event, void *pBuf, uintptr_t arg)
Definition: gap.h:1195
uint8 handle
Advertising handle.
Definition: gap_advertiser.h:504
Definition: gap_advertiser.h:216
GapAdv_secondaryPHY_t secPhy
GAP_ADV_PARAM_SECONDARY_PHY
Definition: gap_advertiser.h:477
2 mbps
Definition: gap_advertiser.h:393
Scan response data.
Definition: gap_advertiser.h:308
bStatus_t GapAdv_setEventMask(uint8 handle, GapAdv_eventMaskFlags_t mask)
GapAdv_secondaryPHY_t
Gap Advertiser Options for advertising on the secondary PHY.
Definition: gap_advertiser.h:390
bStatus_t GapAdv_create(pfnGapCB_t *cb, GapAdv_params_t *advParam, uint8 *advHandle)
Definition: gap_advertiser.h:430
Definition: gap_advertiser.h:237
GapAdv_advChannels_t
GAP Advertiser Defines for Advertiser Channels.
Definition: gap_advertiser.h:338
Definition: gap_advertiser.h:177
Channels 37 & 38.
Definition: gap_advertiser.h:343
GAP_Peer_Addr_Types_t peerAddrType
GAP_ADV_PARAM_PEER_ADDRESS_TYPE
Definition: gap_advertiser.h:472
GapAdv_eventMaskFlags_t
Definition: gap_advertiser.h:405
Advertising data.
Definition: gap_advertiser.h:307
GapAdv_primaryPHY_t
Gap Advertiser Options for advertising on the primary PHY.
Definition: gap_advertiser.h:382
Definition: gap_advertiser.h:334
Type definitions and macros for BLE stack.
Channel 37.
Definition: gap_advertiser.h:340
Definition: gap_advertiser.h:163
Connectable advertising.
Definition: gap_advertiser.h:294
Free the advertising data.
Definition: gap_advertiser.h:315
Definition: gap_advertiser.h:330
bStatus_t GapAdv_getBuffer(uint8 handle, GapAdv_dataTypes_t dataType, uint16 *pLen, uint8 **ppBuf)
coded-s2
Definition: gap_advertiser.h:395
Definition: gap_advertiser.h:249
Definition: gap_advertiser.h:371
uint32_t len
Image length in bytes.
Definition: oad_image_header.h:602
Definition: gap_advertiser.h:418
uint16 connHandle
Connection handle that ended advertising.
Definition: gap_advertiser.h:487
GAP layer interface.
Definition: gap_advertiser.h:414
coded-s8
Definition: gap_advertiser.h:394
GapAdv_filterPolicy_t filterPolicy
GAP_ADV_PARAM_FILTER_POLICY
Definition: gap_advertiser.h:474
GapAdv_advChannels_t primChanMap
GAP_ADV_PARAM_PRIMARY_CHANNEL_MAP
Definition: gap_advertiser.h:471
Use legacy advertising PDU's.
Definition: gap_advertiser.h:298
GapAdv_dataTypes_t
Gap Advertising Data Types.
Definition: gap_advertiser.h:305
Definition: gap_advertiser.h:326
uint8 scanAddrType
Address type of scanning device.
Definition: gap_advertiser.h:495
uint16 advDataLen
Definition: gap_advertiser.h:509
int8_t txPower
NOT CURRENTLY IMPLEMENTED.
Definition: gap_advertiser.h:475
Data type returned with GAP_EVT_ADV_SET_TERMINATED event.
Definition: gap_advertiser.h:483
#define B_ADDR_LEN
Default Public and Random Address Length.
Definition: bcomdef.h:108
Definition: gap_advertiser.h:152
Definition: gap_advertiser.h:466
Definition: gap_advertiser.h:426
High Duty Cycle Directed Advertising.
Definition: gap_advertiser.h:297
Definition: gap_advertiser.h:366
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:246
Definition: gap_advertiser.h:375
Definition: gap_advertiser.h:198
GapAdv_filterPolicy_t
GAP Advertiser White List Policy.
Definition: gap_advertiser.h:355
bStatus_t GapAdv_prepareLoadByBuffer(uint8 *pBuf, bool freeOldData)
bStatus_t GapAdv_loadByBuffer(uint16 len, uint8 *pBuf)
Channel 39.
Definition: gap_advertiser.h:342
bStatus_t GapAdv_destroy(uint8 handle, GapAdv_freeBufferOptions_t freeOptions)
uint8 handle
Advertising handle.
Definition: gap_advertiser.h:494
GapAdv_eventProps_t
GAP Advertising Event Param Properties.
Definition: gap_advertiser.h:292
coded-s8
Definition: gap_advertiser.h:385
Data type returned with GAP_EVT_SCAN_REQ_RECEIVED event.
Definition: gap_advertiser.h:492
Channel 38.
Definition: gap_advertiser.h:341
GapAdv_primaryPHY_t primPhy
GAP_ADV_PARAM_PRIMARY_PHY
Definition: gap_advertiser.h:476
uint8_t sid
GAP_ADV_PARAM_SID
Definition: gap_advertiser.h:478
uint8 status
TODO.
Definition: gap_advertiser.h:486
uint8 numCompAdvEvts
Number of completed advertising events.
Definition: gap_advertiser.h:488
Definition: gap_advertiser.h:189
uint8 availAdvDataLen
How many bytes of the advertising data were sent.
Definition: gap_advertiser.h:505
© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale