Helper module to simplify the usage of NimBLE in scanning mode.
More...
Helper module to simplify the usage of NimBLE in scanning mode.
|
typedef void(* | nimble_scanner_cb) (uint8_t type, const ble_addr_t *addr, const nimble_scanner_info_t *info, const uint8_t *ad, size_t ad_len) |
| Callback signature triggered by this module for each discovered advertising packet. More...
|
|
◆ nimble_scanner_cb
typedef void(* nimble_scanner_cb) (uint8_t type, const ble_addr_t *addr, const nimble_scanner_info_t *info, const uint8_t *ad, size_t ad_len) |
Callback signature triggered by this module for each discovered advertising packet.
- Parameters
-
[in] | type | type of advertising packet. For legacy advertisements on of the following:
- BLE_HCI_ADV_RPT_EVTYPE_ADV_IND
- BLE_HCI_ADV_RPT_EVTYPE_DIR_IND
- BLE_HCI_ADV_RPT_EVTYPE_SCAN_IND
- BLE_HCI_ADV_RPT_EVTYPE_NONCONN_IND
- BLE_HCI_ADV_RPT_EVTYPE_SCAN_RSP For extended advertisements NIMBLE_SCANNER_EXT_ADV ORed with any set out of the following:
- BLE_HCI_ADV_CONN_MASK
- BLE_HCI_ADV_SCAN_MASK
- BLE_HCI_ADV_DIRECT_MASK
- BLE_HCI_ADV_SCAN_RSP_MASK
|
[in] | addr | advertising address of the source node |
[in] | info | additional information about the advertiser |
[in] | ad | advertising data |
[in] | ad_len | length of ad in bytes |
Definition at line 117 of file nimble_scanner.h.
◆ anonymous enum
Scan procedure configuration flags.
Enumerator |
---|
NIMBLE_SCANNER_PASSIVE | do a passive scan
|
NIMBLE_SCANNER_LIMITED | do limited discovery
|
NIMBLE_SCANNER_FILTER_DUPS | filter duplicates
|
NIMBLE_SCANNER_PHY_1M | scan on 1Mbit PHY
|
Definition at line 42 of file nimble_scanner.h.
◆ anonymous enum
Status flags for received advertising packets.
Enumerator |
---|
NIMBLE_SCANNER_COMPLETE | All fragments of a advertising message were received.
|
NIMBLE_SCANNER_INCOMPLETE | The advertising message is incomplete.
|
NIMBLE_SCANNER_TRUNCATED | Advertising message is truncated.
|
Definition at line 55 of file nimble_scanner.h.
◆ nimble_scanner_init()
Initialize the scanner module.
- Parameters
-
[in] | params | scan parameters to use |
[in] | disc_cb | callback triggered of each received advertising packet |
- Returns
- 0 on success
◆ nimble_scanner_is_active()
static bool nimble_scanner_is_active |
( |
void |
| ) |
|
|
inlinestatic |
Get the current scanning status.
- Returns
- true if currently scanning
-
false if the scanner is stopped
Definition at line 154 of file nimble_scanner.h.
◆ nimble_scanner_set_scan_duration()
void nimble_scanner_set_scan_duration |
( |
int32_t |
duration_ms | ) |
|
Set the duration for the scanning procedure.
If there is an active scanning process, it will be restarted.
- Parameters
-
[in] | duration_ms | duration of scanning procedure in ms, set to BLE_HS_FOREVER to scan without time limit |
◆ nimble_scanner_start()
int nimble_scanner_start |
( |
void |
| ) |
|
Start scanning using timing parameters configured on initialization.
- Note
- Scanning will run for ever unless stopped or unless a different scan duration is set with nimble_scanner_set_scan_duration
- Returns
- 0 on success
-
-ECANCELED on error