TI BLE5-Stack API Documentation  3.02.01.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 
68 #ifdef USE_AE
69 #define GAPADV_PARAMS_AE_LONG_RANGE_CONN { \
71  .eventProps = GAP_ADV_PROP_CONNECTABLE, \
72  .primIntMin = 160, \
73  .primIntMax = 160, \
74  .primChanMap = GAP_ADV_CHAN_ALL, \
75  .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID, \
76  .peerAddr = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }, \
77  .filterPolicy = GAP_ADV_WL_POLICY_ANY_REQ, \
78  .txPower = GAP_ADV_TX_POWER_NO_PREFERENCE, \
79  .primPhy = GAP_ADV_PRIM_PHY_CODED_S2, \
80  .secPhy = GAP_ADV_SEC_PHY_CODED_S2, \
81  .sid = 0 \
82 }
83 
85 #define GAPADV_PARAMS_AE_NC_NS { \
86  .eventProps = 0, \
87  .primIntMin = 160, \
88  .primIntMax = 160, \
89  .primChanMap = GAP_ADV_CHAN_ALL, \
90  .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID, \
91  .peerAddr = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }, \
92  .filterPolicy = GAP_ADV_WL_POLICY_ANY_REQ, \
93  .txPower = GAP_ADV_TX_POWER_NO_PREFERENCE, \
94  .primPhy = GAP_ADV_PRIM_PHY_1_MBPS, \
95  .secPhy = GAP_ADV_SEC_PHY_1_MBPS, \
96  .sid = 1 \
97 }
98 #endif
99 
100 #endif
101 
102 /*-------------------------------------------------------------------
103  * CONSTANTS
104  */
105 
159 typedef enum
160 {
169 
180 
194 
206 
215 
224 
233 
254 
266 
278 
292 
294  GAP_ADV_PARAM_COUNT
304 #define GAP_ADV_INVALID_HANDLE 0xFF
306 
309 {
317 };
319 
321 typedef enum
322 {
326 
328 typedef enum
329 {
334 
336 typedef enum
337 {
352 
354 typedef enum
355 {
356  GAP_ADV_CHAN_37 = BV(0),
357  GAP_ADV_CHAN_38 = BV(1),
358  GAP_ADV_CHAN_39 = BV(2),
360  GAP_ADV_CHAN_38),
362  GAP_ADV_CHAN_39),
364  GAP_ADV_CHAN_39),
369 
371 typedef enum
372 {
393 
395 #define GAP_ADV_TX_POWER_NO_PREFERENCE 127
396 
398 typedef enum
399 {
404 
406 typedef enum
407 {
413 
421 typedef enum
422 {
426  GAP_ADV_EVT_MASK_SCAN_REQ_NOTI = AE_NOTIFY_ENABLE_SCAN_REQUEST,
434  GAP_ADV_EVT_MASK_START_AFTER_ENABLE = AE_NOTIFY_ENABLE_ADV_SET_START,
438  GAP_ADV_EVT_MASK_START = AE_NOTIFY_ENABLE_ADV_START,
442  GAP_ADV_EVT_MASK_END = AE_NOTIFY_ENABLE_ADV_END,
446  GAP_ADV_EVT_MASK_END_AFTER_DISABLE = AE_NOTIFY_ENABLE_ADV_SET_END,
457 
460  GAP_ADV_EVT_MASK_RESERVED = BV(15)
463 
465 
469 #define GAPADV_PERIODIC_ADV_INTERVAL_MIN 0x0006
471 #define GAPADV_PERIODIC_ADV_INTERVAL_MAX 0xFFFF
473 #define GAPADV_PERIODIC_ADV_ENABLE_TX_POWER 0x0040
475 #define GAPADV_PERIODIC_ADV_DISABLE_TX_POWER 0x0000
477 #define GAPADV_PERIODIC_ADV_DATA_INTERMIDIATE_FRAG 0x00
479 #define GAPADV_PERIODIC_ADV_DATA_FIRST_FRAG 0x01
481 #define GAPADV_PERIODIC_ADV_DATA_LAST_FRAG 0x02
483 #define GAPADV_PERIODIC_ADV_DATA_COMPLETE 0x03
485 #define GAPADV_PERIODIC_ADV_MAX_DATA_LEN 252
487 
488 
492 /*-------------------------------------------------------------------
493  * Structures
494  */
495 
508 typedef struct
509 {
510  uint16_t eventProps;
511  uint32_t primIntMin;
512  uint32_t primIntMax;
515  uint8_t peerAddr[B_ADDR_LEN];
516  GapAdv_filterPolicy_t filterPolicy;
517  int8_t txPower;
520  uint8_t sid;
522 
523 
525 typedef struct
526 {
527  uint8 handle;
528  uint8 status;
529  uint16 connHandle;
532 
534 typedef struct
535 {
536  uint8 handle;
537  uint8 scanAddrType;
538  uint8 scanAddr[B_ADDR_LEN];
539  uint8 channel;
540  int8 rssi;
542 
544 typedef struct
545 {
546  uint8 handle;
548 
551  uint16 advDataLen;
553 
555 
557 typedef struct
558 {
559  uint16 periodicAdvIntervalMin;
560  uint16 periodicAdvIntervalMax;
561  uint16 periodicAdvProp;
562 } GapAdv_periodicAdvParams_t;
563 
565 typedef struct
566 {
573  uint8 operation;
574  uint8 dataLength;
575  uint8 *pData;
576 } GapAdv_periodicAdvData_t;
577 
578 typedef struct
579 {
580  osal_event_hdr_t hdr;
581  uint8_t opcode;
582  uint8_t status;
583 } GapAdv_periodicAdvEvt_t;
585 
587 typedef struct
588 {
589  osal_event_hdr_t hdr;
590  uint8_t opcode;
591  uint8_t dataType;
592 } GapAdv_dataUpdateEvent_t;
593 
594 typedef struct
595 {
596  osal_event_hdr_t hdr;
597  uint8_t opcode;
598 } GapAv_setAdvStatusDoneEvent_t;
600 
603 /*-------------------------------------------------------------------
604  * FUNCTIONS - Advertising
605  */
606 
633 extern bStatus_t GapAdv_create(pfnGapCB_t *cb, GapAdv_params_t *advParam,
634  uint8 *advHandle);
635 
656 extern bStatus_t GapAdv_destroy(uint8 handle,
657  GapAdv_freeBufferOptions_t freeOptions);
658 
693 extern bStatus_t GapAdv_enable(uint8 handle,
694  GapAdv_enableOptions_t enableOptions,
695  uint16 durationOrMaxEvents);
696 
714 extern bStatus_t GapAdv_disable(uint8 handle);
715 
732 extern bStatus_t GapAdv_setEventMask(uint8 handle, GapAdv_eventMaskFlags_t mask);
733 
752 extern bStatus_t GapAdv_setParam(uint8 handle, GapAdv_ParamId_t paramID,
753  void *pValue);
754 
774 extern bStatus_t GapAdv_getParam(uint8 handle, GapAdv_ParamId_t paramID,
775  void *pValue, uint8_t *pLen);
776 
794 extern bStatus_t GapAdv_getBuffer(uint8 handle, GapAdv_dataTypes_t dataType,
795  uint16 *pLen, uint8 **ppBuf);
796 
856  GapAdv_freeBufferOptions_t freeOptions);
857 
902 bStatus_t GapAdv_loadByHandle(uint8 handle, GapAdv_dataTypes_t dataType,
903  uint16 len, uint8 *pBuf);
904 
943 extern bStatus_t GapAdv_prepareLoadByBuffer(uint8 *pBuf, bool freeOldData);
944 
975 extern bStatus_t GapAdv_loadByBuffer(uint16 len, uint8 *pBuf);
976 
985 extern bStatus_t GapAdv_abortLoad(void);
986 
1006 extern bStatus_t GapAdv_setVirtualAdvAddr(uint8 advHandle, uint8 *bdAddr);
1007 
1009 
1026  uint8_t GapAdv_SetPeriodicAdvParams( uint8 advHandle,
1027  GapAdv_periodicAdvParams_t *periodicAdvParams );
1028 
1045  bStatus_t GapAdv_SetPeriodicAdvData( uint8 advHandle,
1046  GapAdv_periodicAdvData_t *periodicAdvData );
1047 
1064  bStatus_t GapAdv_SetPeriodicAdvEnable( uint8 enable,
1065  uint8 advHandle );
1067 
1068 /*-------------------------------------------------------------------
1069 -------------------------------------------------------------------*/
1070 
1071 #ifdef __cplusplus
1072 }
1073 #endif
1074 
1075 #endif /* GAP_ADVERTISER_H */
1076 
Omit advertiser's address from PDU's.
Definition: gap_advertiser.h:315
uint32_t primIntMax
GAP_ADV_PARAM_PRIMARY_INTERVAL_MAX
Definition: gap_advertiser.h:512
This API allows the software components in the Z-Stack to be written independently of the specifics o...
All Channels.
Definition: gap_advertiser.h:365
GAP_Peer_Addr_Types_t
Address types used for specifying peer address type.
Definition: gap.h:727
coded-s2
Definition: gap_advertiser.h:402
Channels 37 & 39.
Definition: gap_advertiser.h:361
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:291
uint32_t primIntMin
GAP_ADV_PARAM_PRIMARY_INTERVAL_MIN
Definition: gap_advertiser.h:511
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:328
Definition: gap_advertiser.h:450
1 mbps
Definition: gap_advertiser.h:400
Definition: gap_advertiser.h:223
bStatus_t GapAdv_loadByHandle(uint8 handle, GapAdv_dataTypes_t dataType, uint16 len, uint8 *pBuf)
Definition: gap_advertiser.h:316
Directed advertising.
Definition: gap_advertiser.h:312
bStatus_t GapAdv_abortLoad(void)
bStatus_t GapAdv_setVirtualAdvAddr(uint8 advHandle, uint8 *bdAddr)
Definition: gap_advertiser.h:438
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:544
int8 rssi
RSSI of the scan req.
Definition: gap_advertiser.h:540
Scannable advertising.
Definition: gap_advertiser.h:311
uint16_t eventProps
GAP_ADV_PARAM_PROPS
Definition: gap_advertiser.h:510
Free the scan response data.
Definition: gap_advertiser.h:332
uint8 channel
Channel when the scan req was received.
Definition: gap_advertiser.h:539
GapAdv_enableOptions_t
Enable options for GapAdv_enable.
Definition: gap_advertiser.h:336
Definition: gap_advertiser.h:426
GapAdv_ParamId_t
Definition: gap_advertiser.h:159
Definition: gap_advertiser.h:377
1 mbps
Definition: gap_advertiser.h:408
uint8 handle
Advertising handle.
Definition: gap_advertiser.h:527
Don't free anything.
Definition: gap_advertiser.h:330
Definition: gap_advertiser.h:277
Channels 38 & 39.
Definition: gap_advertiser.h:363
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:1324
uint8 handle
Advertising handle.
Definition: gap_advertiser.h:546
Definition: gap_advertiser.h:232
GapAdv_secondaryPHY_t secPhy
GAP_ADV_PARAM_SECONDARY_PHY
Definition: gap_advertiser.h:519
2 mbps
Definition: gap_advertiser.h:409
Scan response data.
Definition: gap_advertiser.h:324
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:406
bStatus_t GapAdv_create(pfnGapCB_t *cb, GapAdv_params_t *advParam, uint8 *advHandle)
Definition: gap_advertiser.h:446
Definition: gap_advertiser.h:253
GapAdv_advChannels_t
GAP Advertiser Defines for Advertiser Channels.
Definition: gap_advertiser.h:354
Definition: gap_advertiser.h:193
Channels 37 & 38.
Definition: gap_advertiser.h:359
GAP_Peer_Addr_Types_t peerAddrType
GAP_ADV_PARAM_PEER_ADDRESS_TYPE
Definition: gap_advertiser.h:514
GapAdv_eventMaskFlags_t
Definition: gap_advertiser.h:421
Advertising data.
Definition: gap_advertiser.h:323
GapAdv_primaryPHY_t
Gap Advertiser Options for advertising on the primary PHY.
Definition: gap_advertiser.h:398
Definition: gap_advertiser.h:350
Type definitions and macros for BLE stack.
Channel 37.
Definition: gap_advertiser.h:356
Definition: gap_advertiser.h:179
Connectable advertising.
Definition: gap_advertiser.h:310
Free the advertising data.
Definition: gap_advertiser.h:331
Definition: gap_advertiser.h:346
bStatus_t GapAdv_getBuffer(uint8 handle, GapAdv_dataTypes_t dataType, uint16 *pLen, uint8 **ppBuf)
coded-s2
Definition: gap_advertiser.h:411
Definition: gap_advertiser.h:265
Definition: gap_advertiser.h:387
Definition: gap_advertiser.h:434
uint16 connHandle
Connection handle that ended advertising.
Definition: gap_advertiser.h:529
GAP layer interface.
OSAL Event Header.
Definition: osal.h:92
Definition: gap_advertiser.h:430
coded-s8
Definition: gap_advertiser.h:410
GapAdv_filterPolicy_t filterPolicy
GAP_ADV_PARAM_FILTER_POLICY
Definition: gap_advertiser.h:516
GapAdv_advChannels_t primChanMap
GAP_ADV_PARAM_PRIMARY_CHANNEL_MAP
Definition: gap_advertiser.h:513
Use legacy advertising PDU's.
Definition: gap_advertiser.h:314
GapAdv_dataTypes_t
Gap Advertising Data Types.
Definition: gap_advertiser.h:321
Definition: gap_advertiser.h:342
uint8 scanAddrType
Address type of scanning device.
Definition: gap_advertiser.h:537
uint16 advDataLen
Definition: gap_advertiser.h:551
int8_t txPower
NOT CURRENTLY IMPLEMENTED.
Definition: gap_advertiser.h:517
Data type returned with GAP_EVT_ADV_SET_TERMINATED event.
Definition: gap_advertiser.h:525
#define B_ADDR_LEN
Default Public and Random Address Length.
Definition: bcomdef.h:108
Definition: gap_advertiser.h:168
Definition: gap_advertiser.h:508
Definition: gap_advertiser.h:442
High Duty Cycle Directed Advertising.
Definition: gap_advertiser.h:313
Definition: gap_advertiser.h:382
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:251
Definition: gap_advertiser.h:391
Definition: gap_advertiser.h:214
GapAdv_filterPolicy_t
GAP Advertiser White List Policy.
Definition: gap_advertiser.h:371
bStatus_t GapAdv_prepareLoadByBuffer(uint8 *pBuf, bool freeOldData)
bStatus_t GapAdv_loadByBuffer(uint16 len, uint8 *pBuf)
Channel 39.
Definition: gap_advertiser.h:358
bStatus_t GapAdv_destroy(uint8 handle, GapAdv_freeBufferOptions_t freeOptions)
uint8 handle
Advertising handle.
Definition: gap_advertiser.h:536
GapAdv_eventProps_t
GAP Advertising Event Param Properties.
Definition: gap_advertiser.h:308
coded-s8
Definition: gap_advertiser.h:401
Data type returned with GAP_EVT_SCAN_REQ_RECEIVED event.
Definition: gap_advertiser.h:534
Channel 38.
Definition: gap_advertiser.h:357
GapAdv_primaryPHY_t primPhy
GAP_ADV_PARAM_PRIMARY_PHY
Definition: gap_advertiser.h:518
uint8_t sid
GAP_ADV_PARAM_SID
Definition: gap_advertiser.h:520
uint8 status
TODO.
Definition: gap_advertiser.h:528
uint8 numCompAdvEvts
Number of completed advertising events.
Definition: gap_advertiser.h:530
Definition: gap_advertiser.h:205
uint8 availAdvDataLen
How many bytes of the advertising data were sent.
Definition: gap_advertiser.h:547
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale