This module implements the Host Scanner.
More...
|
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) |
|
This module implements the Host Scanner.
§ GapScan_disable()
status_t GapScan_disable |
( |
void |
| ) |
|
§ 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()
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
-
rptIdx | Index of the advertising report in the list |
pAdvRpt | pointer 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
-
paramId | parameter ID |
pValue | pointer to where the parameter value is to be stored |
pLen | output 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
-
primPhy | Primary advertising channel PHY.Shall be one from GapScan_PrimPhy_t. |
pType | pointer to where type value is to be stored |
pInterval | pointer to where scanning interval value is to be stored |
pWindow | pointer 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
-
cb | callback fiction that must be provided by the application |
arg | user-defined argument to be passed back through the callback. This is optional |
- Returns
- SUCCESS
-
INVALIDPARAMETER
§ GapScan_setEventMask()
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
-
eventMask | bit mask of the events |
§ GapScan_setParam()
§ 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
-
primPhys | Primary advertising channel PHY(s). Individual values of GapScan_PrimPhy_t can be OR'ed. |
type | Scanning type |
interval | Scanning interval. This shall be equal to or greater than window |
window | Scanning window |
- Returns
- SUCCESS
-
bleInvalidRange