TI BLE5-Stack API Documentation  2.01.03.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 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 
230 typedef enum
231 {
248 
266 
283 
321 
335 
349 
367 
369  SCAN_NUM_RW_PARAM,
371 
383  SCAN_PARAM_NUM_ADV_RPT = SCAN_NUM_RW_PARAM,
384 
386  SCAN_NUM_PARAM
391 /*-------------------------------------------------------------------
392  * Structures
393  */
394 
401 typedef enum
403 {
405  SCANNED_PHY_1M = AE_PHY_1_MBPS,
406  SCANNED_PHY_2M = AE_PHY_2_MBPS,
407  SCANNED_PHY_CODED = AE_PHY_CODED
409 
411 typedef enum {
412  SCAN_TYPE_PASSIVE = LL_SCAN_PASSIVE,
413  SCAN_TYPE_ACTIVE = LL_SCAN_ACTIVE
415 
417 typedef enum {
445 
447 typedef enum {
454 
456 typedef enum {
462 
464 typedef struct {
465  uint8_t reason;
466  uint8_t numReport;
468 
470 typedef struct {
475  uint8_t evtType;
479  uint8_t addr[B_ADDR_LEN];
481  GapScan_ScannedPhy_t primPhy;
483  GapScan_ScannedPhy_t secPhy;
485  uint8_t advSid;
487  int8_t txPower;
489  int8_t rssi;
493  uint8_t directAddr[B_ADDR_LEN];
495  uint16_t periodicAdvInt;
497  uint16_t dataLen;
499  uint8_t *pData;
501 
503 typedef uint32_t GapScan_EventMask_t;
504 
507 /*-------------------------------------------------------------------
508  * API's
509  */
510 
521 status_t GapScan_registerCb(pfnGapCB_t cb, uintptr_t arg);
522 
543 status_t GapScan_setPhyParams(uint8_t primPhys, GapScan_ScanType_t type,
544  uint16_t interval, uint16_t window);
545 
561 status_t GapScan_getPhyParams(uint8_t primPhy, GapScan_ScanType_t* pType,
562  uint16_t* pInterval, uint16_t* pWindow);
563 
575 status_t GapScan_setParam(GapScan_ParamId_t paramId, void* pValue);
576 
590 status_t GapScan_getParam(GapScan_ParamId_t paramId, void* pValue, uint8_t *pLen);
591 
600 void GapScan_setEventMask(GapScan_EventMask_t eventMask);
601 
628 status_t GapScan_enable(uint16_t period, uint16_t duration,
629  uint8_t maxNumReport);
630 
638 status_t GapScan_disable(void);
639 
654 status_t GapScan_getAdvReport(uint8_t rptIdx, GapScan_Evt_AdvRpt_t* pAdvRpt);
655 
666 status_t GapScan_discardAdvReportList(void);
667 
668 /*-------------------------------------------------------------------
669 -------------------------------------------------------------------*/
670 
671 #ifdef __cplusplus
672 }
673 #endif
674 
675 #endif /* GAP_SCANNER_H */
676 
Definition: gap_scanner.h:428
address field
Definition: gap_scanner.h:149
GAP_Addr_Types_t
Address types used for identifying peer address type.
Definition: gap.h:648
status_t GapScan_discardAdvReportList(void)
Definition: gap_scanner.h:320
Limited discoverable mode.
Definition: gap_scanner.h:450
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:404
Definition: gap_scanner.h:282
General discoverable mode.
Definition: gap_scanner.h:449
GapScan_FilterDiscMode_t
Choices for GAP Scanner Discoverable Mode Filter.
Definition: gap_scanner.h:447
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:487
Directed only. Mutually exclusive with SCAN_FLT_PDU_UNDIRECTED_ONLY.
Definition: gap_scanner.h:130
Disable discoverable mode filter.
Definition: gap_scanner.h:452
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:366
GapScan_ScannedPhy_t
Scanned PHY.
Definition: gap_scanner.h:402
GapScan_ScannedPhy_t secPhy
PHY of the secondary advertising channel.
Definition: gap_scanner.h:483
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:499
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:435
Non-discoverable mode.
Definition: gap_scanner.h:448
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:411
void GapScan_setEventMask(GapScan_EventMask_t eventMask)
Scanned on the 2M PHY.
Definition: gap_scanner.h:406
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:465
Definition: gap_scanner.h:458
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:417
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:485
Definition: gap_scanner.h:383
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:405
void(* pfnGapCB_t)(uint32_t event, void *pBuf, uintptr_t arg)
Definition: gap.h:1259
status_t GapScan_setParam(GapScan_ParamId_t paramId, void *pValue)
Complete.
Definition: gap_scanner.h:102
Definition: gap_scanner.h:348
More Data To Come.
Definition: gap_scanner.h:104
Scanned on the Coded PHY.
Definition: gap_scanner.h:407
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:481
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:451
Scannable only. Mutually exclusive with SCAN_FLT_PDU_NONSCANNABLE_ONLY.
Definition: gap_scanner.h:126
Event for advertising report.
Definition: gap_scanner.h:470
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:413
GAP_Addr_Types_t directAddrType
Type of TargetA address in the directed advertising PDU.
Definition: gap_scanner.h:491
GapScan_FilterDuplicate_t
Choices for GAP Scanner Duplicate Filter.
Definition: gap_scanner.h:456
GAP layer interface.
Definition: gap_scanner.h:422
Definition: gap_scanner.h:247
Event for scanning end.
Definition: gap_scanner.h:464
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:495
primPhy field
Definition: gap_scanner.h:150
Definition: gap_scanner.h:265
uint32_t GapScan_EventMask_t
Event Mask.
Definition: gap_scanner.h:503
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:460
#define B_ADDR_LEN
Default Public and Random Address Length.
Definition: bcomdef.h:108
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:475
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:497
int8_t rssi
-127 dBm <= RSSI <= 20 dBm
Definition: gap_scanner.h:489
Definition: gap_scanner.h:443
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:457
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:477
Definition: gap_scanner.h:334
uint8_t numReport
Number of recorded advertising reports.
Definition: gap_scanner.h:466
Scan for non-scannable advertisements.
Definition: gap_scanner.h:412
© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale