TI BLE5-Stack API Documentation  1.01.12.00
Modules | Files | Functions
Gap Scanner

This module implements the Host Scanner. More...

Modules

 GapScan Callbacks
 
 GapScan Constants
 
 GapScan Events
 
 GapScan Params
 
 GapScan Structures
 

Files

file  gap_scanner.h
 GAP Scanner layer interface.
 

Functions

status_t GapScan_disable (void)
 
status_t GapScan_discardAdvReportList (void)
 
status_t GapScan_enable (uint16_t period, uint16_t duration, uint8_t maxNumReport)
 
status_t GapScan_getAdvReport (uint8_t rptIdx, GapScan_Evt_AdvRpt_t *pAdvRpt)
 
status_t GapScan_getParam (GapScan_ParamId_t paramId, void *pValue, uint8_t *pLen)
 
status_t GapScan_getPhyParams (uint8_t primPhy, GapScan_ScanType_t *pType, uint16_t *pInterval, uint16_t *pWindow)
 
status_t GapScan_registerCb (pfnGapCB_t cb, uintptr_t arg)
 
void GapScan_setEventMask (GapScan_EventMask_t eventMask)
 
status_t GapScan_setParam (GapScan_ParamId_t paramId, void *pValue)
 
status_t GapScan_setPhyParams (uint8_t primPhys, GapScan_ScanType_t type, uint16_t interval, uint16_t window)
 

Detailed Description

This module implements the Host Scanner.

Function Documentation

§ GapScan_disable()

status_t GapScan_disable ( void  )

Stop currently running scanning operation.

Returns
SUCCESS
FAILURE
bleIncorrectMode

§ GapScan_discardAdvReportList()

status_t GapScan_discardAdvReportList ( void  )

Deallocate advertising report list and all its reports created during scanning.

If they are not deallocated by the application, they will be deallocated and reallocated when a new scanning starts with GapScan_enable

Returns
SUCCESS
bleIncorrectMode

§ GapScan_enable()

status_t GapScan_enable ( uint16_t  period,
uint16_t  duration,
uint8_t  maxNumReport 
)

Start scanning.

If duration is zero period shall be ignored and the scanner will continue scanning until GapScan_disable is called. If period is zero and duration is non-zero, the scanner will scan once until duration has expired or GapScan_disable is called. If both the duration and period are non-zero, the scanner will continue scanning periodically until GapScan_disable() is called.

Parameters
period- Scan period. Ignored if duration is zero. 1.28 sec unit. Range: 0x00-0xffff, where 0x00 is continuously scanning.
duration- Scan duration. 10 ms unit. The time of duration shall be greater than the time of scan interval set by GapScan_setPhyParams. Range: 0x00-0xffff, where 0x00 is continuously scanning.
maxNumReport- If non-zero, the list of advertising reports (the number of which is up to maxNumReport) will be generated and come with GAP_EVT_SCAN_DISABLED.
Returns
SUCCESS
bleNotReady
bleInvalidRange
bleMemAllocError
bleAlreadyInRequestedMode
bleIncorrectMode

§ GapScan_getAdvReport()

status_t GapScan_getAdvReport ( uint8_t  rptIdx,
GapScan_Evt_AdvRpt_t pAdvRpt 
)

Get a specific advertising report from the advertising report list.

Only the fields specified by GapScan_setParam (SCAN_PARAM_RPT_FIELDS, etc) will be filled out. All other fields will be filled with 0's.

Parameters
rptIdxIndex of the advertising report in the list
pAdvRptpointer to where the retrieved advertising report is to be stored
Returns
SUCCESS
bleInvalidRange
INVALIDPARAMETER

§ GapScan_getParam()

status_t GapScan_getParam ( GapScan_ParamId_t  paramId,
void *  pValue,
uint8_t *  pLen 
)

Set a parameter.

Parameters
paramIdparameter ID
pValuepointer to where the parameter value is to be stored
pLenoutput parameter to return the length of the parameter. This is an optional return parameter. If the caller does not care about this, it can pass in NULL.
Returns
SUCCESS
bleInvalidRange
INVALIDPARAMETER

§ GapScan_getPhyParams()

status_t GapScan_getPhyParams ( uint8_t  primPhy,
GapScan_ScanType_t pType,
uint16_t *  pInterval,
uint16_t *  pWindow 
)

Get parameters of the specified PHY.

Note
that primPhy shall indicate only one PHY.
Parameters
primPhyPrimary advertising channel PHY.Shall be one from GapScan_PrimPhy_t.
pTypepointer to where type value is to be stored
pIntervalpointer to where scanning interval value is to be stored
pWindowpointer to where scanning window value is to be stored
Returns
SUCCESS
bleInvalidRange
INVALIDPARAMETER

§ GapScan_registerCb()

status_t GapScan_registerCb ( pfnGapCB_t  cb,
uintptr_t  arg 
)

Register the callback that will be called when a new GAP_SCAN event occurs.

Parameters
cbcallback fiction that must be provided by the application
arguser-defined argument to be passed back through the callback. This is optional
Returns
SUCCESS
INVALIDPARAMETER

§ GapScan_setEventMask()

void GapScan_setEventMask ( GapScan_EventMask_t  eventMask)

Set which events to receive through the callback.

One bit per event. If a bit is set to 1, the callback provided by GapScan_registerCb will be called upon corresponding event.

Parameters
eventMaskbit mask of the events

§ GapScan_setParam()

status_t GapScan_setParam ( GapScan_ParamId_t  paramId,
void *  pValue 
)

Set a parameter.

Parameters
paramIdparameter ID
pValuepointer to the value to set the parameter with
Returns
SUCCESS
bleInvalidRange
INVALIDPARAMETER
bleIncorrectMode

§ GapScan_setPhyParams()

status_t GapScan_setPhyParams ( uint8_t  primPhys,
GapScan_ScanType_t  type,
uint16_t  interval,
uint16_t  window 
)

Set parameters dependent on PHY.

Note
that if primPhys contains more than one PHY, the same parameters of those PHYs will be set with the same values.
Change of the parameters will not affect an ongoing scanning. If changed during scanning, it will take effect when the scanning is re-enabled after disabled.
Parameters
primPhysPrimary advertising channel PHY(s). Individual values of GapScan_PrimPhy_t can be OR'ed.
typeScanning type
intervalScanning interval. This shall be equal to or greater than window
windowScanning window
Returns
SUCCESS
bleInvalidRange
© Copyright 1995-2021, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale