TI BLE5-Stack API Documentation  1.01.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: TISD 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 1600
189 #define SCAN_PARAM_DFLT_WINDOW 1600
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 
230 typedef enum
231 {
248 
266 
283 
320 
334 
348 
366 
368  SCAN_NUM_RW_PARAM,
370 
382  SCAN_PARAM_NUM_ADV_RPT = SCAN_NUM_RW_PARAM,
383 
385  SCAN_NUM_PARAM
390 /*-------------------------------------------------------------------
391  * Structures
392  */
393 
400 typedef enum
402 {
404  SCANNED_PHY_1M = AE_PHY_1_MBPS,
405  SCANNED_PHY_2M = AE_PHY_2_MBPS,
406  SCANNED_PHY_CODED = AE_PHY_CODED
408 
410 typedef enum {
411  SCAN_TYPE_PASSIVE = LL_SCAN_PASSIVE,
412  SCAN_TYPE_ACTIVE = LL_SCAN_ACTIVE
414 
416 typedef enum {
444 
446 typedef enum {
453 
455 typedef enum {
461 
463 typedef struct {
464  uint8_t reason;
465  uint8_t numReport;
467 
469 typedef struct {
474  uint8_t evtType;
478  uint8_t addr[B_ADDR_LEN];
480  GapScan_ScannedPhy_t primPhy;
482  GapScan_ScannedPhy_t secPhy;
484  uint8_t advSid;
486  int8_t txPower;
488  int8_t rssi;
492  uint8_t directAddr[B_ADDR_LEN];
494  uint16_t periodicAdvInt;
496  uint16_t dataLen;
498  uint8_t *pData;
500 
502 typedef uint32_t GapScan_EventMask_t;
503 
506 /*-------------------------------------------------------------------
507  * API's
508  */
509 
520 status_t GapScan_registerCb(pfnGapCB_t cb, uintptr_t arg);
521 
541 status_t GapScan_setPhyParams(uint8_t primPhys, GapScan_ScanType_t type,
542  uint16_t interval, uint16_t window);
543 
559 status_t GapScan_getPhyParams(uint8_t primPhy, GapScan_ScanType_t* pType,
560  uint16_t* pInterval, uint16_t* pWindow);
561 
573 status_t GapScan_setParam(GapScan_ParamId_t paramId, void* pValue);
574 
588 status_t GapScan_getParam(GapScan_ParamId_t paramId, void* pValue, uint8_t *pLen);
589 
598 void GapScan_setEventMask(GapScan_EventMask_t eventMask);
599 
621 status_t GapScan_enable(uint16_t period, uint16_t duration,
622  uint8_t maxNumReport);
623 
631 status_t GapScan_disable(void);
632 
647 status_t GapScan_getAdvReport(uint8_t rptIdx, GapScan_Evt_AdvRpt_t* pAdvRpt);
648 
659 status_t GapScan_discardAdvReportList(void);
660 
661 /*-------------------------------------------------------------------
662 -------------------------------------------------------------------*/
663 
664 #ifdef __cplusplus
665 }
666 #endif
667 
668 #endif /* GAP_SCANNER_H */
669 
Definition: gap_scanner.h:427
address field
Definition: gap_scanner.h:149
GAP_Addr_Types_t
Address types used for identifying peer address type.
Definition: gap.h:572
status_t GapScan_discardAdvReportList(void)
Definition: gap_scanner.h:319
Limited discoverable mode.
Definition: gap_scanner.h:449
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:403
Definition: gap_scanner.h:282
General discoverable mode.
Definition: gap_scanner.h:448
GapScan_FilterDiscMode_t
Choices for GAP Scanner Discoverable Mode Filter.
Definition: gap_scanner.h:446
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:486
Directed only. Mutually exclusive with SCAN_FLT_PDU_UNDIRECTED_ONLY.
Definition: gap_scanner.h:130
Disable discoverable mode filter.
Definition: gap_scanner.h:451
GapScan_EndReason_t
Reason for GapScan_Evt_End_t.
Definition: gap_scanner.h:162
Scannable.
Definition: gap_scanner.h:94
status_t GapScan_enable(uint16_t period, uint16_t duration, uint8_t maxNumReport)
Definition: gap_scanner.h:365
GapScan_ScannedPhy_t
Scanned PHY.
Definition: gap_scanner.h:401
GapScan_ScannedPhy_t secPhy
PHY of the secondary advertising channel.
Definition: gap_scanner.h:482
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:498
GapScan_AdvRptField_t
Fields of Adv Report.
Definition: gap_scanner.h:146
GapScan_ParamId_t
Definition: gap_scanner.h:230
Undirected only. Mutually exclusive with SCAN_FLT_PDU_DIRECTIED_ONLY.
Definition: gap_scanner.h:128
Definition: gap_scanner.h:434
Non-discoverable mode.
Definition: gap_scanner.h:447
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:410
void GapScan_setEventMask(GapScan_EventMask_t eventMask)
Scanned on the 2M PHY.
Definition: gap_scanner.h:405
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:464
Definition: gap_scanner.h:457
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:416
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:484
Definition: gap_scanner.h:382
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:404
void(* pfnGapCB_t)(uint32_t event, void *pBuf, uintptr_t arg)
Definition: gap.h:1095
status_t GapScan_setParam(GapScan_ParamId_t paramId, void *pValue)
Complete.
Definition: gap_scanner.h:102
Definition: gap_scanner.h:347
More Data To Come.
Definition: gap_scanner.h:104
Scanned on the Coded PHY.
Definition: gap_scanner.h:406
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:480
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:450
Scannable only. Mutually exclusive with SCAN_FLT_PDU_NONSCANNABLE_ONLY.
Definition: gap_scanner.h:126
Event for advertising report.
Definition: gap_scanner.h:469
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:412
GAP_Addr_Types_t directAddrType
Type of TargetA address in the directed advertising PDU.
Definition: gap_scanner.h:490
GapScan_FilterDuplicate_t
Choices for GAP Scanner Duplicate Filter.
Definition: gap_scanner.h:455
GAP layer interface.
Definition: gap_scanner.h:421
Definition: gap_scanner.h:247
Event for scanning end.
Definition: gap_scanner.h:463
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:494
primPhy field
Definition: gap_scanner.h:150
Definition: gap_scanner.h:265
uint32_t GapScan_EventMask_t
Event Mask.
Definition: gap_scanner.h:502
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:459
#define B_ADDR_LEN
Default Public and Random Address Length.
Definition: bcomdef.h:115
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:474
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:496
int8_t rssi
-127 dBm <= RSSI <= 20 dBm
Definition: gap_scanner.h:488
Definition: gap_scanner.h:442
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:456
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:476
Definition: gap_scanner.h:333
uint8_t numReport
Number of recorded advertising reports.
Definition: gap_scanner.h:465
Scan for non-scannable advertisements.
Definition: gap_scanner.h:411
Copyright 2018, Texas Instruments Incorporated