TI BLE5-Stack API Documentation  3.03.01.00
gap_scanner.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 
21 #ifndef GAP_SCANNER_H
22 #define GAP_SCANNER_H
23 
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28 
29 /*-------------------------------------------------------------------
30  * INCLUDES
31  */
32 #include "bcomdef.h"
33 #include "osal.h"
34 #include "gap.h"
35 
36 /*-------------------------------------------------------------------
37  * MACROS
38  */
39 
40 /*******************************************************************************
41  * Gap Scanner Internal API
42  */
43 
44 /*-------------------------------------------------------------------
45  * CONSTANTS
46  */
47 
92  ADV_RPT_EVT_TYPE_CONNECTABLE = AE_EVT_TYPE_CONN_ADV,
94  ADV_RPT_EVT_TYPE_SCANNABLE = AE_EVT_TYPE_SCAN_ADV,
96  ADV_RPT_EVT_TYPE_DIRECTED = AE_EVT_TYPE_DIR_ADV,
98  ADV_RPT_EVT_TYPE_SCAN_RSP = AE_EVT_TYPE_SCAN_RSP,
100  ADV_RPT_EVT_TYPE_LEGACY = AE_EVT_TYPE_LEGACY,
102  ADV_RPT_EVT_STATUS_COMPLETE = AE_EVT_TYPE_COMPLETE,
104  ADV_RPT_EVT_STATUS_MORE_DATA = AE_EVT_TYPE_INCOMPLETE_MORE_TO_COME,
106  ADV_RPT_EVT_STATUS_TRUNCATED = AE_EVT_TYPE_INCOMPLETE_NO_MORE_TO_COME,
108  ADV_RPT_EVT_STATUS_RFU = AE_EVT_TYPE_RFU
109 };
110 
113  SCAN_PRIM_PHY_1M = LL_PHY_1_MBPS,
114  SCAN_PRIM_PHY_CODED = LL_PHY_CODED
115 };
116 
143 };
144 
159 };
160 
165 };
166 
171 #define SCAN_RSSI_MAX 127
172 #define SCAN_RSSI_MIN -128
173 
179 #define SCAN_FLT_RSSI_ALL SCAN_RSSI_MIN
180 #define SCAN_FLT_RSSI_NONE SCAN_RSSI_MAX
181 
187 #define SCAN_PARAM_DFLT_INTERVAL 800
189 #define SCAN_PARAM_DFLT_WINDOW 800
191 #define SCAN_PARAM_DFLT_TYPE SCAN_TYPE_PASSIVE
193 #define SCAN_PARAM_DFLT_RPT_FIELDS (SCAN_ADVRPT_FLD_EVENTTYPE|\
195  SCAN_ADVRPT_FLD_ADDRTYPE |\
196  SCAN_ADVRPT_FLD_ADDRESS |\
197  SCAN_ADVRPT_FLD_ADVSID |\
198  SCAN_ADVRPT_FLD_RSSI)
199 #define SCAN_PARAM_DFLT_PHYS SCAN_PRIM_PHY_1M
201 #define SCAN_PARAM_DFLT_FLT_POLICY SCAN_FLT_POLICY_ALL
203 #define SCAN_PARAM_DFLT_FLT_PDU SCAN_FLT_PDU_COMPLETE_ONLY
205 #define SCAN_PARAM_DFLT_FLT_RSSI SCAN_FLT_RSSI_ALL
207 #define SCAN_PARAM_DFLT_FLT_DISC SCAN_FLT_DISC_DISABLE
209 #define SCAN_PARAM_DFLT_FLT_DUP SCAN_FLT_DUP_ENABLE
211 #define SCAN_PARAM_DFLT_NUM_ADV_RPT 0
213 
215 
221 #define SCAN_PERIODIC_SKIP_MAX 0x01F3
223 #define SCAN_PERIODIC_TIMEOUT_MIN 0x000A
225 #define SCAN_PERIODIC_TIMEOUT_MAX 0x4000
227 #define SCAN_PERIODIC_CTE_TYPE_ALL 0
229 #define SCAN_PERIODIC_DO_NOT_SYNC_AOA_CTE 1
231 #define SCAN_PERIODIC_DO_NOT_SYNC_AOD_CTE_1US 2
233 #define SCAN_PERIODIC_DO_NOT_SYNC_AOD_CTE_2US 4
235 #define SCAN_PERIODIC_SYNC_ONLY_WITH_CTE 16
237 #define SCAN_PERIODIC_MAX_ADV_SID 0x0F
239 #define SCAN_PERIODIC_SYNC_OPTIONS_MAX 0x03
241 #define SCAN_PERIODIC_DO_NOT_USE_PERIODIC_ADV_LIST (0 << 0)
243 #define SCAN_PERIODIC_USE_PERIODIC_ADV_LIST (1 << 0)
245 #define SCAN_PERIODIC_REPORTING_INITIALLY_ENABLED (0 << 1)
247 #define SCAN_PERIODIC_REPORTING_INITIALLY_DISABLED (1 << 1)
249 
250 
267 typedef enum
268 {
285 
303 
320 
358 
372 
386 
404 
406  SCAN_NUM_RW_PARAM,
408 
420  SCAN_PARAM_NUM_ADV_RPT = SCAN_NUM_RW_PARAM,
421 
423  SCAN_NUM_PARAM
428 /*-------------------------------------------------------------------
429  * Structures
430  */
431 
438 typedef enum
440 {
442  SCANNED_PHY_1M = AE_PHY_1_MBPS,
443  SCANNED_PHY_2M = AE_PHY_2_MBPS,
444  SCANNED_PHY_CODED = AE_PHY_CODED
446 
448 typedef enum {
449  SCAN_TYPE_PASSIVE = LL_SCAN_PASSIVE,
450  SCAN_TYPE_ACTIVE = LL_SCAN_ACTIVE
452 
454 typedef enum {
482 
484 typedef enum {
491 
493 typedef enum {
499 
501 typedef struct {
502  uint8_t reason;
503  uint8_t numReport;
505 
507 typedef struct {
512  uint8_t evtType;
516  uint8_t addr[B_ADDR_LEN];
518  GapScan_ScannedPhy_t primPhy;
520  GapScan_ScannedPhy_t secPhy;
522  uint8_t advSid;
524  int8_t txPower;
526  int8_t rssi;
530  uint8_t directAddr[B_ADDR_LEN];
532  uint16_t periodicAdvInt;
534  uint16_t dataLen;
536  uint8_t *pData;
538 
540 typedef uint32_t GapScan_EventMask_t;
541 
543 
545 typedef struct
546 {
555  uint8 options;
556  uint8 advAddrType;
557  uint8 advAddress[6];
558  uint16 skip;
559  uint16 syncTimeout;
560 
566  uint8 syncCteType;
567 } GapScan_PeriodicAdvCreateSyncParams_t;
568 
570 typedef struct
571 {
572  osal_event_hdr_t hdr;
573  uint8_t opcode;
574  uint8_t status;
575 } GapScan_PeriodicAdvEvt_t;
576 
578 typedef struct
579 {
580  osal_event_hdr_t hdr;
581  uint8_t opcode;
582  uint8_t status;
583  uint8_t listSize;
584 } GapScan_ReadAdvSizeListEvt_t;
585 
587 typedef struct
588 {
589  osal_event_hdr_t hdr;
590  uint8_t opcode;
591  uint16_t syncHandle;
592 } GapScan_PeriodicAdvSyncLostEvt_t;
593 
595 typedef struct
596 {
597  osal_event_hdr_t hdr;
598  uint8 opcode;
599  uint8 BLEEventCode;
600  uint16 syncHandle;
601  int8 txPower;
602  int8 rssi;
603  uint8 cteType;
604  uint8 dataStatus;
605  uint8 dataLen;
606  uint8 *pData;
607 } GapScan_Evt_PeriodicAdvRpt_t;
608 
610 typedef struct
611 {
612  osal_event_hdr_t hdr;
613  uint8 opcode;
614  uint8 BLEEventCode;
615  uint8 status;
616  uint16 syncHandle;
617  uint8 advSid;
618  uint8 advAddrType;
619  uint8 advAddress[6];
620  uint8 advPhy;
621  uint16 periodicAdvInt;
622  uint8 advClockAccuracy;
623 } GapScan_Evt_PeriodicAdvSyncEst_t;
625 
628 /*-------------------------------------------------------------------
629  * API's
630  */
631 
642 status_t GapScan_registerCb(pfnGapCB_t cb, uintptr_t arg);
643 
664 status_t GapScan_setPhyParams(uint8_t primPhys, GapScan_ScanType_t type,
665  uint16_t interval, uint16_t window);
666 
682 status_t GapScan_getPhyParams(uint8_t primPhy, GapScan_ScanType_t* pType,
683  uint16_t* pInterval, uint16_t* pWindow);
684 
696 status_t GapScan_setParam(GapScan_ParamId_t paramId, void* pValue);
697 
711 status_t GapScan_getParam(GapScan_ParamId_t paramId, void* pValue, uint8_t *pLen);
712 
721 void GapScan_setEventMask(GapScan_EventMask_t eventMask);
722 
749 status_t GapScan_enable(uint16_t period, uint16_t duration,
750  uint8_t maxNumReport);
751 
759 status_t GapScan_disable(void);
760 
775 status_t GapScan_getAdvReport(uint8_t rptIdx, GapScan_Evt_AdvRpt_t* pAdvRpt);
776 
787 status_t GapScan_discardAdvReportList(void);
788 
790 
807 uint8_t GapScan_PeriodicAdvCreateSync( uint8 advSID,
808  GapScan_PeriodicAdvCreateSyncParams_t *createSyncParams );
809 
820 bStatus_t GapScan_PeriodicAdvCreateSyncCancel( void );
821 
839 bStatus_t GapScan_PeriodicAdvTerminateSync( uint16 syncHandle);
840 
860 bStatus_t GapScan_SetPeriodicAdvReceiveEnable( uint16 syncHandle,
861  uint8 enable );
862 
881 bStatus_t GapScan_AddDeviceToPeriodicAdvList( uint8 advAddrType,
882  uint8 advAddress[6],
883  uint8 advSID );
884 
904  bStatus_t GapScan_RemoveDeviceFromPeriodicAdvList( uint8 advAddrType,
905  uint8 advAddress[6],
906  uint8 advSID );
907 
918 hciStatus_t GapScan_ReadPeriodicAdvListSize( void );
919 
930 bStatus_t GapScan_ClearPeriodicAdvList( void );
932 
933 /*-------------------------------------------------------------------
934 -------------------------------------------------------------------*/
935 
936 #ifdef __cplusplus
937 }
938 #endif
939 
940 #endif /* GAP_SCANNER_H */
941 
address field
Definition: gap_scanner.h:149
GAP_Addr_Types_t
Address types used for identifying peer address type.
Definition: gap.h:713
status_t GapScan_discardAdvReportList(void)
Definition: gap_scanner.h:357
Limited discoverable mode.
Definition: gap_scanner.h:487
txPower field
Definition: gap_scanner.h:153
This API allows the software components in the Z-Stack to be written independently of the specifics o...
No PHY is used.
Definition: gap_scanner.h:441
Definition: gap_scanner.h:319
General discoverable mode.
Definition: gap_scanner.h:486
GapScan_FilterDiscMode_t
Choices for GAP Scanner Discoverable Mode Filter.
Definition: gap_scanner.h:484
Truncated.
Definition: gap_scanner.h:106
Scan Response only. Mutually exclusive with SCAN_FLT_PDU_ADV_ONLY.
Definition: gap_scanner.h:134
int8_t txPower
-127 dBm <= TX power <= 126 dBm
Definition: gap_scanner.h:524
Definition: gap_scanner.h:465
Directed only. Mutually exclusive with SCAN_FLT_PDU_UNDIRECTED_ONLY.
Definition: gap_scanner.h:130
Disable discoverable mode filter.
Definition: gap_scanner.h:489
GapScan_EndReason_t
Reason for GapScan_Evt_End_t.
Definition: gap_scanner.h:162
Definition: gap_scanner.h:480
Scannable.
Definition: gap_scanner.h:94
status_t GapScan_enable(uint16_t period, uint16_t duration, uint8_t maxNumReport)
Definition: gap_scanner.h:403
GapScan_ScannedPhy_t
Scanned PHY.
Definition: gap_scanner.h:439
GapScan_ScannedPhy_t secPhy
PHY of the secondary advertising channel.
Definition: gap_scanner.h:520
status_t GapScan_getAdvReport(uint8_t rptIdx, GapScan_Evt_AdvRpt_t *pAdvRpt)
status_t GapScan_registerCb(pfnGapCB_t cb, uintptr_t arg)
uint8_t * pData
Pointer to advertising or scan response data.
Definition: gap_scanner.h:536
GapScan_AdvRptField_t
Fields of Adv Report.
Definition: gap_scanner.h:146
GapScan_ParamId_t
Definition: gap_scanner.h:267
Undirected only. Mutually exclusive with SCAN_FLT_PDU_DIRECTIED_ONLY.
Definition: gap_scanner.h:128
Definition: gap_scanner.h:472
Non-discoverable mode.
Definition: gap_scanner.h:485
dataLen field
Definition: gap_scanner.h:158
Directed.
Definition: gap_scanner.h:96
Truncated only. Mutually exclusive with SCAN_FLT_PDU_COMPLETE_ONLY.
Definition: gap_scanner.h:140
Legacy.
Definition: gap_scanner.h:100
GapScan_ScanType_t
GAP Scanner Scan Type.
Definition: gap_scanner.h:448
void GapScan_setEventMask(GapScan_EventMask_t eventMask)
Scanned on the 2M PHY.
Definition: gap_scanner.h:443
Non-scannable only. Mutually exclusive with SCAN_FLT_PDU_SCANNABLE_ONLY.
Definition: gap_scanner.h:124
uint8_t reason
End reason - GapScan_EndReason_t.
Definition: gap_scanner.h:502
Definition: gap_scanner.h:495
Extended only. Mutually exclusive with SCAN_FLT_PDU_LEGACY_ONLY.
Definition: gap_scanner.h:136
GapScan_FilterPolicy_t
GAP Scanner Filter Policy.
Definition: gap_scanner.h:454
GapScan_AdvRptTypeNStatus_t
Advertising report event types.
Definition: gap_scanner.h:90
uint8_t advSid
SID (0x00-0x0f) of the advertising PDU. 0xFF means no ADI field in the PDU.
Definition: gap_scanner.h:522
Definition: gap_scanner.h:420
status_t GapScan_setPhyParams(uint8_t primPhys, GapScan_ScanType_t type, uint16_t interval, uint16_t window)
status_t GapScan_disable(void)
addrType field
Definition: gap_scanner.h:148
Scanned on the 1M PHY.
Definition: gap_scanner.h:442
void(* pfnGapCB_t)(uint32_t event, void *pBuf, uintptr_t arg)
Definition: gap.h:1341
status_t GapScan_setParam(GapScan_ParamId_t paramId, void *pValue)
Complete.
Definition: gap_scanner.h:102
Definition: gap_scanner.h:385
More Data To Come.
Definition: gap_scanner.h:104
Scanned on the Coded PHY.
Definition: gap_scanner.h:444
advSid field
Definition: gap_scanner.h:152
status_t GapScan_getParam(GapScan_ParamId_t paramId, void *pValue, uint8_t *pLen)
GapScan_ScannedPhy_t primPhy
PHY of the primary advertising channel.
Definition: gap_scanner.h:518
Scan on the 1M PHY.
Definition: gap_scanner.h:113
Scanning ended by user request.
Definition: gap_scanner.h:163
Scan on the Coded PHY.
Definition: gap_scanner.h:114
General or Limited discoverable mode.
Definition: gap_scanner.h:488
Scannable only. Mutually exclusive with SCAN_FLT_PDU_NONSCANNABLE_ONLY.
Definition: gap_scanner.h:126
Event for advertising report.
Definition: gap_scanner.h:507
status_t GapScan_getPhyParams(uint8_t primPhy, GapScan_ScanType_t *pType, uint16_t *pInterval, uint16_t *pWindow)
prdAdvInterval field
Definition: gap_scanner.h:157
Type definitions and macros for BLE stack.
eventType field
Definition: gap_scanner.h:147
Scan for scannable advertisements.
Definition: gap_scanner.h:450
GAP_Addr_Types_t directAddrType
Type of TargetA address in the directed advertising PDU.
Definition: gap_scanner.h:528
GapScan_FilterDuplicate_t
Choices for GAP Scanner Duplicate Filter.
Definition: gap_scanner.h:493
GAP layer interface.
Definition: gap_scanner.h:459
Definition: gap_scanner.h:284
OSAL Event Header.
Definition: osal.h:92
Event for scanning end.
Definition: gap_scanner.h:501
Connectable only. Mutually exclusive with SCAN_FLT_PDU_NONCONNECTABLE_ONLY.
Definition: gap_scanner.h:122
uint16_t periodicAdvInt
Periodic advertising interval. 0 means no periodic advertising.
Definition: gap_scanner.h:532
primPhy field
Definition: gap_scanner.h:150
Definition: gap_scanner.h:302
uint32_t GapScan_EventMask_t
Event Mask.
Definition: gap_scanner.h:540
Legacy only. Mutually exclusive with SCAN_FLT_PDU_EXTENDED_ONLY.
Definition: gap_scanner.h:138
Reserved for Future Use.
Definition: gap_scanner.h:108
Duplicate filtering enabled, reset for each scan period.
Definition: gap_scanner.h:497
#define B_ADDR_LEN
Default Public and Random Address Length.
Definition: bcomdef.h:102
Complete only. Mutually exclusive with SCAN_FLT_PDU_TRUNCATED_ONLY.
Definition: gap_scanner.h:142
GapScan_PrimPhy_t
GAP Scanner Primary PHY.
Definition: gap_scanner.h:112
uint8_t evtType
Definition: gap_scanner.h:512
Advertisement only. Mutually exclusive with SCAN_FLT_PDU_SCANRSP_ONLY.
Definition: gap_scanner.h:132
GapScan_FilterPduType_t
PDU Types for PDU Type Filter.
Definition: gap_scanner.h:118
secPhy field
Definition: gap_scanner.h:151
RSSI field.
Definition: gap_scanner.h:154
dirAddress field
Definition: gap_scanner.h:156
uint16_t dataLen
Length of the data.
Definition: gap_scanner.h:534
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:246
int8_t rssi
-127 dBm <= RSSI <= 20 dBm
Definition: gap_scanner.h:526
Non-connectable only. Mutually exclusive with SCAN_FLT_PDU_CONNECTABLE_ONLY.
Definition: gap_scanner.h:120
Connectable.
Definition: gap_scanner.h:92
dirAddrType field
Definition: gap_scanner.h:155
Duplicate filtering disabled.
Definition: gap_scanner.h:494
Scan Response.
Definition: gap_scanner.h:98
Scanning ended by duration expiration.
Definition: gap_scanner.h:164
GAP_Addr_Types_t addrType
Public, random, public ID, random ID, or anonymous.
Definition: gap_scanner.h:514
Definition: gap_scanner.h:371
uint8_t numReport
Number of recorded advertising reports.
Definition: gap_scanner.h:503
Scan for non-scannable advertisements.
Definition: gap_scanner.h:449
© Copyright 1995-2024, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale