Helper module to simplify the usage of NimBLE in scanning mode. More...
Helper module to simplify the usage of NimBLE in scanning mode.
Files | |
| file | nimble_scanner.h | 
| Scanner abstraction for NimBLE.  | |
Data Structures | |
| struct | nimble_scanner_cfg_t | 
| Scanner configuration parameters.  More... | |
| struct | nimble_scanner_info_t | 
| Additional information about received advertising packets.  More... | |
Macros | |
| #define | NIMBLE_SCANNER_EXT_ADV 0x80 | 
| Flag to mark type for extended advertisements.   | |
Typedefs | |
| 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.   | |
Enumerations | |
| enum | { NIMBLE_SCANNER_PASSIVE = 0x01 , NIMBLE_SCANNER_LIMITED = 0x02 , NIMBLE_SCANNER_FILTER_DUPS = 0x04 , NIMBLE_SCANNER_PHY_1M = 0x10 } | 
| Scan procedure configuration flags.  More... | |
| enum | { NIMBLE_SCANNER_COMPLETE = BLE_HCI_ADV_DATA_STATUS_COMPLETE , NIMBLE_SCANNER_INCOMPLETE = BLE_HCI_ADV_DATA_STATUS_INCOMPLETE , NIMBLE_SCANNER_TRUNCATED = BLE_HCI_ADV_DATA_STATUS_TRUNCATED } | 
| Status flags for received advertising packets.  More... | |
Functions | |
| int | nimble_scanner_init (const nimble_scanner_cfg_t *params, nimble_scanner_cb disc_cb) | 
| Initialize the scanner module.   | |
| int | nimble_scanner_start (void) | 
| Start scanning using timing parameters configured on initialization.   | |
| void | nimble_scanner_stop (void) | 
| Stop scanning.  | |
| static bool | nimble_scanner_is_active (void) | 
| Get the current scanning status.   | |
| void | nimble_scanner_set_scan_duration (int32_t duration_ms) | 
| Set the duration for the scanning procedure.   | |
| #define NIMBLE_SCANNER_EXT_ADV 0x80 | 
Flag to mark type for extended advertisements.
Definition at line 36 of file nimble_scanner.h.
| 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.
| [in] | type | type of advertising packet. For legacy advertisements on of the following:
  | 
| [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 116 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 41 of file nimble_scanner.h.
| anonymous enum | 
Status flags for received advertising packets.
Definition at line 54 of file nimble_scanner.h.
| int nimble_scanner_init | ( | const nimble_scanner_cfg_t * | params, | 
| nimble_scanner_cb | disc_cb ) | 
Initialize the scanner module.
| [in] | params | scan parameters to use | 
| [in] | disc_cb | callback triggered of each received advertising packet | 
      
  | 
  inlinestatic | 
Get the current scanning status.
Definition at line 153 of file nimble_scanner.h.
| 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.
| [in] | duration_ms | duration of scanning procedure in ms, set to BLE_HS_FOREVER to scan without time limit | 
| int nimble_scanner_start | ( | void | ) | 
Start scanning using timing parameters configured on initialization.