TI BLE5-Stack API Documentation  3.03.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: TI_TEXT 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_AL_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  .zeroDelay = 0 \
67 }
68 
69 #ifdef USE_AE
70 #define GAPADV_PARAMS_AE_LONG_RANGE_CONN { \
72  .eventProps = GAP_ADV_PROP_CONNECTABLE, \
73  .primIntMin = 160, \
74  .primIntMax = 160, \
75  .primChanMap = GAP_ADV_CHAN_ALL, \
76  .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID, \
77  .peerAddr = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }, \
78  .filterPolicy = GAP_ADV_AL_POLICY_ANY_REQ, \
79  .txPower = GAP_ADV_TX_POWER_NO_PREFERENCE, \
80  .primPhy = GAP_ADV_PRIM_PHY_CODED_S2, \
81  .secPhy = GAP_ADV_SEC_PHY_CODED_S2, \
82  .sid = 0 \
83  .zeroDelay = 0 \
84 }
85 
87 #define GAPADV_PARAMS_AE_NC_NS { \
88  .eventProps = 0, \
89  .primIntMin = 160, \
90  .primIntMax = 160, \
91  .primChanMap = GAP_ADV_CHAN_ALL, \
92  .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID, \
93  .peerAddr = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }, \
94  .filterPolicy = GAP_ADV_AL_POLICY_ANY_REQ, \
95  .txPower = GAP_ADV_TX_POWER_NO_PREFERENCE, \
96  .primPhy = GAP_ADV_PRIM_PHY_1_MBPS, \
97  .secPhy = GAP_ADV_SEC_PHY_1_MBPS, \
98  .sid = 1 \
99  .zeroDelay = 0 \
100 }
101 #endif
102 
103 #endif
104 
105 /*-------------------------------------------------------------------
106  * CONSTANTS
107  */
108 
162 typedef enum
163 {
172 
183 
197 
209 
218 
227 
236 
257 
269 
281 
295 
312 
329 
331  GAP_ADV_PARAM_COUNT
341 #define GAP_ADV_INVALID_HANDLE 0xFF
343 
346 {
354 };
356 
358 typedef enum
359 {
363 
365 typedef enum
366 {
371 
373 typedef enum
374 {
389 
391 typedef enum
392 {
393  GAP_ADV_CHAN_37 = BV(0),
394  GAP_ADV_CHAN_38 = BV(1),
395  GAP_ADV_CHAN_39 = BV(2),
397  GAP_ADV_CHAN_38),
399  GAP_ADV_CHAN_39),
401  GAP_ADV_CHAN_39),
406 
408 typedef enum
409 {
430 
432 #define GAP_ADV_TX_POWER_NO_PREFERENCE 127
433 
435 typedef enum
436 {
441 
443 typedef enum
444 {
450 
458 typedef enum
459 {
463  GAP_ADV_EVT_MASK_SCAN_REQ_NOTI = AE_NOTIFY_ENABLE_SCAN_REQUEST,
471  GAP_ADV_EVT_MASK_START_AFTER_ENABLE = AE_NOTIFY_ENABLE_ADV_SET_START,
475  GAP_ADV_EVT_MASK_START = AE_NOTIFY_ENABLE_ADV_START,
479  GAP_ADV_EVT_MASK_END = AE_NOTIFY_ENABLE_ADV_END,
483  GAP_ADV_EVT_MASK_END_AFTER_DISABLE = AE_NOTIFY_ENABLE_ADV_SET_END,
494 
497  GAP_ADV_EVT_MASK_RESERVED = BV(15)
500 
502 
506 #define GAPADV_PERIODIC_ADV_INTERVAL_MIN 0x0006
508 #define GAPADV_PERIODIC_ADV_INTERVAL_MAX 0xFFFF
510 #define GAPADV_PERIODIC_ADV_ENABLE_TX_POWER 0x0040
512 #define GAPADV_PERIODIC_ADV_DISABLE_TX_POWER 0x0000
514 #define GAPADV_PERIODIC_ADV_DATA_INTERMIDIATE_FRAG 0x00
516 #define GAPADV_PERIODIC_ADV_DATA_FIRST_FRAG 0x01
518 #define GAPADV_PERIODIC_ADV_DATA_LAST_FRAG 0x02
520 #define GAPADV_PERIODIC_ADV_DATA_COMPLETE 0x03
522 #define GAPADV_PERIODIC_ADV_MAX_DATA_LEN 252
524 
525 
529 /*-------------------------------------------------------------------
530  * Structures
531  */
532 
545 typedef struct
546 {
547  uint16_t eventProps;
548  uint32_t primIntMin;
549  uint32_t primIntMax;
552  uint8_t peerAddr[B_ADDR_LEN];
553  GapAdv_filterPolicy_t filterPolicy;
554  int8_t txPower;
557  uint8_t sid;
558  uint8_t zeroDelay;
560 
561 
563 typedef struct
564 {
565  uint8 handle;
566  uint8 status;
567  uint16 connHandle;
570 
572 typedef struct
573 {
574  uint8 handle;
575  uint8 scanAddrType;
576  uint8 scanAddr[B_ADDR_LEN];
577  uint8 channel;
578  int8 rssi;
580 
582 typedef struct
583 {
584  uint8 handle;
586 
589  uint16 advDataLen;
591 
593 
595 typedef struct
596 {
597  uint16 periodicAdvIntervalMin;
598  uint16 periodicAdvIntervalMax;
599  uint16 periodicAdvProp;
600 } GapAdv_periodicAdvParams_t;
601 
603 typedef struct
604 {
611  uint8 operation;
612  uint8 dataLength;
613  uint8 *pData;
614 } GapAdv_periodicAdvData_t;
615 
616 typedef struct
617 {
618  osal_event_hdr_t hdr;
619  uint8_t opcode;
620  uint8_t status;
621 } GapAdv_periodicAdvEvt_t;
623 
625 typedef struct
626 {
627  osal_event_hdr_t hdr;
628  uint8_t opcode;
629  uint8_t dataType;
630 } GapAdv_dataUpdateEvent_t;
631 
632 typedef struct
633 {
634  osal_event_hdr_t hdr;
635  uint8_t opcode;
636 } GapAv_setAdvStatusDoneEvent_t;
638 
641 /*-------------------------------------------------------------------
642  * FUNCTIONS - Advertising
643  */
644 
671 extern bStatus_t GapAdv_create(pfnGapCB_t *cb, GapAdv_params_t *advParam,
672  uint8 *advHandle);
673 
694 extern bStatus_t GapAdv_destroy(uint8 handle,
695  GapAdv_freeBufferOptions_t freeOptions);
696 
731 extern bStatus_t GapAdv_enable(uint8 handle,
732  GapAdv_enableOptions_t enableOptions,
733  uint16 durationOrMaxEvents);
734 
752 extern bStatus_t GapAdv_disable(uint8 handle);
753 
770 extern bStatus_t GapAdv_setEventMask(uint8 handle, GapAdv_eventMaskFlags_t mask);
771 
790 extern bStatus_t GapAdv_setParam(uint8 handle, GapAdv_ParamId_t paramID,
791  void *pValue);
792 
812 extern bStatus_t GapAdv_getParam(uint8 handle, GapAdv_ParamId_t paramID,
813  void *pValue, uint8_t *pLen);
814 
832 extern bStatus_t GapAdv_getBuffer(uint8 handle, GapAdv_dataTypes_t dataType,
833  uint16 *pLen, uint8 **ppBuf);
834 
894  GapAdv_freeBufferOptions_t freeOptions);
895 
940 bStatus_t GapAdv_loadByHandle(uint8 handle, GapAdv_dataTypes_t dataType,
941  uint16 len, uint8 *pBuf);
942 
981 extern bStatus_t GapAdv_prepareLoadByBuffer(uint8 *pBuf, bool freeOldData);
982 
1013 extern bStatus_t GapAdv_loadByBuffer(uint16 len, uint8 *pBuf);
1014 
1023 extern bStatus_t GapAdv_abortLoad(void);
1024 
1044 extern bStatus_t GapAdv_setVirtualAdvAddr(uint8 advHandle, uint8 *bdAddr);
1045 
1047 
1064  uint8_t GapAdv_SetPeriodicAdvParams( uint8 advHandle,
1065  GapAdv_periodicAdvParams_t *periodicAdvParams );
1066 
1083  bStatus_t GapAdv_SetPeriodicAdvData( uint8 advHandle,
1084  GapAdv_periodicAdvData_t *periodicAdvData );
1085 
1102  bStatus_t GapAdv_SetPeriodicAdvEnable( uint8 enable,
1103  uint8 advHandle );
1105 
1106 /*-------------------------------------------------------------------
1107 -------------------------------------------------------------------*/
1108 
1109 #ifdef __cplusplus
1110 }
1111 #endif
1112 
1113 #endif /* GAP_ADVERTISER_H */
1114 
Omit advertiser's address from PDU's.
Definition: gap_advertiser.h:352
uint32_t primIntMax
GAP_ADV_PARAM_PRIMARY_INTERVAL_MAX
Definition: gap_advertiser.h:549
This API allows the software components in the Z-Stack to be written independently of the specifics o...
All Channels.
Definition: gap_advertiser.h:402
GAP_Peer_Addr_Types_t
Address types used for specifying peer address type.
Definition: gap.h:727
coded-s2
Definition: gap_advertiser.h:439
Channels 37 & 39.
Definition: gap_advertiser.h:398
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:294
uint32_t primIntMin
GAP_ADV_PARAM_PRIMARY_INTERVAL_MIN
Definition: gap_advertiser.h:548
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:365
Definition: gap_advertiser.h:487
1 mbps
Definition: gap_advertiser.h:437
Definition: gap_advertiser.h:226
Definition: gap_advertiser.h:328
bStatus_t GapAdv_loadByHandle(uint8 handle, GapAdv_dataTypes_t dataType, uint16 len, uint8 *pBuf)
Definition: gap_advertiser.h:353
Directed advertising.
Definition: gap_advertiser.h:349
bStatus_t GapAdv_abortLoad(void)
bStatus_t GapAdv_setVirtualAdvAddr(uint8 advHandle, uint8 *bdAddr)
Definition: gap_advertiser.h:475
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:582
int8 rssi
RSSI of the scan req.
Definition: gap_advertiser.h:578
Scannable advertising.
Definition: gap_advertiser.h:348
uint16_t eventProps
GAP_ADV_PARAM_PROPS
Definition: gap_advertiser.h:547
Free the scan response data.
Definition: gap_advertiser.h:369
uint8 channel
Channel when the scan req was received.
Definition: gap_advertiser.h:577
GapAdv_enableOptions_t
Enable options for GapAdv_enable.
Definition: gap_advertiser.h:373
Definition: gap_advertiser.h:463
GapAdv_ParamId_t
Definition: gap_advertiser.h:162
Definition: gap_advertiser.h:414
1 mbps
Definition: gap_advertiser.h:445
uint8 handle
Advertising handle.
Definition: gap_advertiser.h:565
Definition: gap_advertiser.h:311
Don't free anything.
Definition: gap_advertiser.h:367
Definition: gap_advertiser.h:280
Definition: gap_advertiser.h:419
Channels 38 & 39.
Definition: gap_advertiser.h:400
bStatus_t GapAdv_disable(uint8 handle)
Disable an active advertising set.
Definition: gap_advertiser.h:424
void(* pfnGapCB_t)(uint32_t event, void *pBuf, uintptr_t arg)
Definition: gap.h:1341
uint8 handle
Advertising handle.
Definition: gap_advertiser.h:584
Definition: gap_advertiser.h:235
GapAdv_secondaryPHY_t secPhy
GAP_ADV_PARAM_SECONDARY_PHY
Definition: gap_advertiser.h:556
2 mbps
Definition: gap_advertiser.h:446
Scan response data.
Definition: gap_advertiser.h:361
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:443
bStatus_t GapAdv_create(pfnGapCB_t *cb, GapAdv_params_t *advParam, uint8 *advHandle)
Definition: gap_advertiser.h:483
Definition: gap_advertiser.h:256
GapAdv_advChannels_t
GAP Advertiser Defines for Advertiser Channels.
Definition: gap_advertiser.h:391
Definition: gap_advertiser.h:196
Channels 37 & 38.
Definition: gap_advertiser.h:396
GAP_Peer_Addr_Types_t peerAddrType
GAP_ADV_PARAM_PEER_ADDRESS_TYPE
Definition: gap_advertiser.h:551
GapAdv_eventMaskFlags_t
Definition: gap_advertiser.h:458
Advertising data.
Definition: gap_advertiser.h:360
GapAdv_primaryPHY_t
Gap Advertiser Options for advertising on the primary PHY.
Definition: gap_advertiser.h:435
Definition: gap_advertiser.h:387
Type definitions and macros for BLE stack.
Channel 37.
Definition: gap_advertiser.h:393
Definition: gap_advertiser.h:182
Connectable advertising.
Definition: gap_advertiser.h:347
Free the advertising data.
Definition: gap_advertiser.h:368
Definition: gap_advertiser.h:383
bStatus_t GapAdv_getBuffer(uint8 handle, GapAdv_dataTypes_t dataType, uint16 *pLen, uint8 **ppBuf)
coded-s2
Definition: gap_advertiser.h:448
Definition: gap_advertiser.h:268
Definition: gap_advertiser.h:471
uint16 connHandle
Connection handle that ended advertising.
Definition: gap_advertiser.h:567
GAP layer interface.
OSAL Event Header.
Definition: osal.h:92
Definition: gap_advertiser.h:467
coded-s8
Definition: gap_advertiser.h:447
GapAdv_filterPolicy_t filterPolicy
GAP_ADV_PARAM_FILTER_POLICY
Definition: gap_advertiser.h:553
GapAdv_advChannels_t primChanMap
GAP_ADV_PARAM_PRIMARY_CHANNEL_MAP
Definition: gap_advertiser.h:550
Use legacy advertising PDU's.
Definition: gap_advertiser.h:351
GapAdv_dataTypes_t
Gap Advertising Data Types.
Definition: gap_advertiser.h:358
Definition: gap_advertiser.h:379
uint8 scanAddrType
Address type of scanning device.
Definition: gap_advertiser.h:575
uint16 advDataLen
Definition: gap_advertiser.h:589
int8_t txPower
NOT CURRENTLY IMPLEMENTED.
Definition: gap_advertiser.h:554
Data type returned with GAP_EVT_ADV_SET_TERMINATED event.
Definition: gap_advertiser.h:563
#define B_ADDR_LEN
Default Public and Random Address Length.
Definition: bcomdef.h:102
Definition: gap_advertiser.h:171
Definition: gap_advertiser.h:545
Definition: gap_advertiser.h:479
High Duty Cycle Directed Advertising.
Definition: gap_advertiser.h:350
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:246
Definition: gap_advertiser.h:217
GapAdv_filterPolicy_t
GAP Advertiser Accept List Policy.
Definition: gap_advertiser.h:408
bStatus_t GapAdv_prepareLoadByBuffer(uint8 *pBuf, bool freeOldData)
bStatus_t GapAdv_loadByBuffer(uint16 len, uint8 *pBuf)
Definition: gap_advertiser.h:428
uint8_t zeroDelay
GAP_ADV_PARAM_ZERODELAY
Definition: gap_advertiser.h:558
Channel 39.
Definition: gap_advertiser.h:395
bStatus_t GapAdv_destroy(uint8 handle, GapAdv_freeBufferOptions_t freeOptions)
uint8 handle
Advertising handle.
Definition: gap_advertiser.h:574
GapAdv_eventProps_t
GAP Advertising Event Param Properties.
Definition: gap_advertiser.h:345
coded-s8
Definition: gap_advertiser.h:438
Data type returned with GAP_EVT_SCAN_REQ_RECEIVED event.
Definition: gap_advertiser.h:572
Channel 38.
Definition: gap_advertiser.h:394
GapAdv_primaryPHY_t primPhy
GAP_ADV_PARAM_PRIMARY_PHY
Definition: gap_advertiser.h:555
uint8_t sid
GAP_ADV_PARAM_SID
Definition: gap_advertiser.h:557
uint8 status
TODO.
Definition: gap_advertiser.h:566
uint8 numCompAdvEvts
Number of completed advertising events.
Definition: gap_advertiser.h:568
Definition: gap_advertiser.h:208
uint8 availAdvDataLen
How many bytes of the advertising data were sent.
Definition: gap_advertiser.h:585
© Copyright 1995-2024, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale