pub trait HalCommands {
Show 19 methods
// Required methods
async fn get_firmware_revision(&mut self);
async fn write_config_data(&mut self, config: &ConfigData);
async fn read_config_data(&mut self, param: ConfigParameter);
async fn set_tx_power_level(&mut self, level: PowerLevel);
async fn get_tx_test_packet_count(&mut self);
async fn start_tone(
&mut self,
channel: u8,
freq_offset: u8,
) -> Result<(), Error>;
async fn stop_tone(&mut self);
async fn get_link_status(&mut self);
async fn set_radio_activity_mask(&mut self, mask: RadioActivityFlags);
async fn get_anchor_period(&mut self);
async fn set_event_mask(&mut self, mask: HalEventFlags);
async fn get_pm_debug_info(&mut self);
async fn set_peripheral_latency(&mut self, enabled: bool);
async fn read_rssi(&mut self);
async fn read_radio_reg(&mut self, address: u8);
async fn read_raw_rssi(&mut self);
async fn rx_start(&mut self, rf_channel: u8);
async fn rx_stop(&mut self);
async fn stack_reset(&mut self);
}
Expand description
Vendor-specific HCI commands.
Required Methods§
Sourceasync fn get_firmware_revision(&mut self)
async fn get_firmware_revision(&mut self)
This command is intended to retrieve the firmware revision number.
§Errors
Only underlying communication errors are reported.
§Generated events
The controller will generate a command complete event.
Sourceasync fn write_config_data(&mut self, config: &ConfigData)
async fn write_config_data(&mut self, config: &ConfigData)
This command writes a value to a low level configure data structure. It is useful to setup directly some low level parameters for the system in the runtime.
§Errors
Only underlying communication errors are reported.
§Generated events
The controller will generate a command complete event.
Sourceasync fn read_config_data(&mut self, param: ConfigParameter)
async fn read_config_data(&mut self, param: ConfigParameter)
This command requests the value in the low level configure data structure.
§Errors
Only underlying communication errors are reported.
§Generated events
The controller will generate a command complete event.
Sourceasync fn set_tx_power_level(&mut self, level: PowerLevel)
async fn set_tx_power_level(&mut self, level: PowerLevel)
This command sets the TX power level of the BlueNRG-MS.
When the system starts up or reboots, the default TX power level will be used, which is the maximum value of 8 dBm. Once this command is given, the output power will be changed instantly, regardless if there is Bluetooth communication going on or not. For example, for debugging purpose, the BlueNRG-MS can be set to advertise all the time. And use this command to observe the signal strength changing.
The system will keep the last received TX power level from the command, i.e. the 2nd command overwrites the previous TX power level. The new TX power level remains until another Set TX Power command, or the system reboots.
§Errors
Only underlying communication errors are reported.
§Generated events
The controller will generate a command complete event.
Sourceasync fn get_tx_test_packet_count(&mut self)
async fn get_tx_test_packet_count(&mut self)
Retrieve the number of packets sent in the last TX direct test.
During the Direct Test mode, in the TX tests, the number of packets sent in the test is not returned when executing the Direct Test End command. This command implements this feature.
If the Direct TX test is started, a 16-bit counter will be used to count how many packets have been transmitted. After the Direct Test End, this command can be used to check how many packets were sent during the Direct TX test.
The counter starts from 0 and counts upwards. As would be the case if 16-bits are all used, the counter wraps back and starts from 0 again. The counter is not cleared until the next Direct TX test starts.
§Errors
Only underlying communication errors are reported.
§Generated events
The controller will generate a command complete event.
Sourceasync fn start_tone(
&mut self,
channel: u8,
freq_offset: u8,
) -> Result<(), Error>
async fn start_tone( &mut self, channel: u8, freq_offset: u8, ) -> Result<(), Error>
This command starts a carrier frequency, i.e. a tone, on a specific channel.
The frequency sine wave at the specific channel may be used for debugging purpose only. The channel ID is a parameter from 0 to 39 for the 40 BLE channels, e.g. 0 for 2.402 GHz, 1 for 2.404 GHz etc.
This command should not be used when normal Bluetooth activities are ongoing.
The tone should be stopped by stop_tone
command.
§Errors
- InvalidChannel if the channel is greater than 39.
- Underlying communication errors
§Generated events
The controller will generate a command complete event.
Sourceasync fn stop_tone(&mut self)
async fn stop_tone(&mut self)
Stops the previously started by the start_tone
command.
§Errors
Only underlying communication errors are reported.
§Generated events
The controller will generate a command complete event.
Sourceasync fn get_link_status(&mut self)
async fn get_link_status(&mut self)
This command is intended to return the Link Layer Status and Connection Handles.
§Errors
Only underlying communication errors are reported.
§Generated events
The controller will generate a command complete event.
Sourceasync fn set_radio_activity_mask(&mut self, mask: RadioActivityFlags)
async fn set_radio_activity_mask(&mut self, mask: RadioActivityFlags)
This command sets the bitmask associated to End of Radio Activity event.
Only the radio activities enabled in the mask will be reported to the application by the End of Radio Activity event.
Sourceasync fn get_anchor_period(&mut self)
async fn get_anchor_period(&mut self)
This command is intended to retrieve information about the current Anchor Interval and allocable timing slots.
§Errors
Only underlying communication errors are reported.
§Generated events
The controller will generate a command complete event.
Sourceasync fn set_event_mask(&mut self, mask: HalEventFlags)
async fn set_event_mask(&mut self, mask: HalEventFlags)
This command is used to enable/disable the generation of HAL events.
If the bit in the HAL Event Mask is set to one, then the event associated with that will be enabled.
Sourceasync fn get_pm_debug_info(&mut self)
async fn get_pm_debug_info(&mut self)
This command is used to retreive Tx, Rx, and total buffer count allocated for ACL packets.
Sourceasync fn set_peripheral_latency(&mut self, enabled: bool)
async fn set_peripheral_latency(&mut self, enabled: bool)
This command is used to disable/enable the Peripheral latencyy feature during a connection.
Note that, by default, the Peripheral latency is enabled at connection time.
Sourceasync fn read_radio_reg(&mut self, address: u8)
async fn read_radio_reg(&mut self, address: u8)
This command reads a register value from the RF module
Sourceasync fn read_raw_rssi(&mut self)
async fn read_raw_rssi(&mut self)
This command returns the raw value of the RSSI
Sourceasync fn rx_start(&mut self, rf_channel: u8)
async fn rx_start(&mut self, rf_channel: u8)
This command does set up the RF to listen to a specific RF Channel.
rf_channel
: BLE Channel Id, from 0x00 to 0x27 meaning (2.402 + 0.002 * 0xXX) GHz
.
The device will continously emit 0s, meaning that the tone will be at the channel center
frequency minus the maximum frequency deviation (250 KHz).
Sourceasync fn rx_stop(&mut self)
async fn rx_stop(&mut self)
This command stops a previous HAL Rx Start command
Sourceasync fn stack_reset(&mut self)
async fn stack_reset(&mut self)
This command is equivalent to HCI Reset but ensures the sleep mode is entered immediately after its completion.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.