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, int8_t rssi, const uint8_t *ad, size_t ad_len) |
| Callback signature triggered by this module for each discovered advertising packet. More...
|
|
|
enum | { NIMBLE_SCANNER_OK = 0,
NIMBLE_SCANNER_SCANNING = 1,
NIMBLE_SCANNER_STOPPED = 2,
NIMBLE_SCANNER_ERR = -1
} |
| Return values used by this submodule.
|
|
◆ nimble_scanner_cb
typedef void(* nimble_scanner_cb) (uint8_t type, const ble_addr_t *addr, int8_t rssi, 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, e.g BLE_HCI_ADV_TYPE_ADV_IND |
[in] | addr | advertising address of the source node |
[in] | rssi | RSSI value for the received packet |
[in] | ad | advertising data |
[in] | ad_len | length of ad in bytes |
Definition at line 52 of file nimble_scanner.h.
◆ nimble_scanner_init()
int nimble_scanner_init |
( |
const struct ble_gap_disc_params * |
params, |
|
|
nimble_scanner_cb |
disc_cb |
|
) |
| |
Initialize the scanner module.
- Parameters
-
[in] | params | scan parameters to use, pass NULL to use NimBLE's default parameters |
[in] | disc_cb | callback triggered of each received advertising packet |
- Returns
- NIMBLE_SCANNER_OK on success
-
NIMBLE_SCANNER_ERR if putting NimBLE into discovery mode failed
◆ nimble_scanner_status()
int nimble_scanner_status |
( |
void |
| ) |
|
Get the current scanning status.
- Returns
- NIMBLE_SCANNER_SCANNING if currently scanning
-
NIMBLE_SCANNER_STOPPED if the scanner is stopped