Bluetooth scanner role implementation.
More...
|
#define | SCANNER_CHANNELS_MAX (3) |
|
#define | SCANNER_ACCESS_ADDR_INVALID (0x00000000) |
|
#define | SCANNER_CHANNELS_DEFAULT {37, 38, 39} |
|
|
typedef void(* | scanner_rx_callback_t) (const scanner_packet_t *p_packet, ts_timestamp_t rx_timestamp_ts) |
| Scanner packet callback hook, called on every successfully received packet before committing it to the buffer. More...
|
|
Bluetooth scanner role implementation.
The scanner handles all packet reception on the mesh. By default, the scanner runs in continuous mode on all three advertisement channels. Note that the scanner API expects a single consumer, and if multiple packet handlers are required, this must be managed by a higher level module.
◆ scanner_rx_callback_t
typedef void(* scanner_rx_callback_t) (const scanner_packet_t *p_packet, ts_timestamp_t rx_timestamp_ts) |
Scanner packet callback hook, called on every successfully received packet before committing it to the buffer.
- Parameters
-
[in] | p_packet | Packet received. |
[in] | rx_timestamp_ts | Timeslot timestamp of the packet RX, sampled at the first bit of the header with the HF timer. |
Definition at line 88 of file scanner.h.
◆ scanner_init()
void scanner_init |
( |
bearer_event_flag_callback_t |
packet_process_cb | ) |
|
Initializes the scanner module.
- Parameters
-
[in] | packet_process_cb | Callback function for processing received packets. |
◆ scanner_rx_callback_set()
Set the scanner rx callback function.
The Scanner RX callback function gets called on every received packet before it's commited to the packet queue. This callback should only be used for fast, timing critical tasks, and should never be used for general packet processing. There's only one active rx callback at a time, and setting it twice without clearing it will trigger an assert.
- Parameters
-
[in] | callback | Callback function to call on every received packet, or NULL to clear the callback. |
◆ scanner_is_enabled()
bool scanner_is_enabled |
( |
void |
| ) |
|
Checks if the scanner module is enabled.
- Returns
- true if enabled, false if disabled.
◆ scanner_rx()
Returns the next packet that has been received by the scanner.
- Note
- The returned packet must be released using scanner_packet_release().
- Returns
- Pointer to received packet, or NULL if no packet has been received.
◆ scanner_rx_pending()
bool scanner_rx_pending |
( |
void |
| ) |
|
Checks if any received packets are pending.
- Returns
- true if packets are pending, false if not.
◆ scanner_packet_release()
Releases a packet that has previously been returned by scanner_rx().
- Parameters
-
[in] | p_packet | Packet to be released. |
◆ scanner_stats_get()
Returns statistics related to the scanner module.
- Returns
- Pointer to statistics structure.
◆ scanner_config_radio_mode_set()
void scanner_config_radio_mode_set |
( |
radio_mode_t |
radio_mode | ) |
|
Sets scanner radio mode (data rate and modulation).
- Parameters
-
[in] | radio_mode | New radio mode. |
◆ scanner_config_scan_time_set()
void scanner_config_scan_time_set |
( |
uint32_t |
scan_interval_us, |
|
|
uint32_t |
scan_window_us |
|
) |
| |
Sets scanner timing parameters.
- Parameters
-
[in] | scan_interval_us | Scan interval duration. |
[in] | scan_window_us | Scan window duration. |
◆ scanner_config_channels_set()
void scanner_config_channels_set |
( |
const uint8_t * |
p_channels, |
|
|
uint8_t |
channel_count |
|
) |
| |
Sets which radio channels are to be used by the scanner.
- Parameters
-
[in] | p_channels | Array of radio channels. |
[in] | channel_count | Number of radio channels. |
◆ scanner_config_access_addresses_set()
void scanner_config_access_addresses_set |
( |
const uint32_t * |
p_access_addresses, |
|
|
uint8_t |
address_count |
|
) |
| |
Sets access addresses to be used by the scanner, and corresponding logical address.
- Note
- Set address to SCANNER_ACCESS_ADDR_INVALID if corresponding logical address is not to be used.
- Parameters
-
[in] | p_access_addresses | Array of access addresses. Address index defines corresponding logical address. |
[in] | address_count | Number of access addresses. |
◆ scanner_radio_start()
void scanner_radio_start |
( |
ts_timestamp_t |
start_time | ) |
|
Start scanner radio.
- Warning
- Only to be used by the bearer module.
- Parameters
-
[in] | start_time | Timestamp when the action timer was started. |
◆ scanner_radio_stop()
void scanner_radio_stop |
( |
void |
| ) |
|
Stop scanner radio.
- Warning
- Only to be used by the bearer module.
◆ scanner_radio_irq_handler()
void scanner_radio_irq_handler |
( |
void |
| ) |
|
Scanner radio IRQ handler.
- Warning
- Only to be used by the bearer module.
◆ scanner_timer_irq_handler()
void scanner_timer_irq_handler |
( |
void |
| ) |
|
Scanner timer IRQ handler.
- Warning
- Only to be used by the bearer module.