Trait bluenrg::hal::Commands[][src]

pub trait Commands {
    type Error;
    fn get_firmware_revision(&mut self) -> Result<(), Self::Error>;
fn write_config_data(
        &mut self,
        config: &ConfigData
    ) -> Result<(), Self::Error>;
fn read_config_data(
        &mut self,
        param: ConfigParameter
    ) -> Result<(), Self::Error>;
fn set_tx_power_level(
        &mut self,
        level: PowerLevel
    ) -> Result<(), Self::Error>;
fn device_standby(&mut self) -> Result<(), Self::Error>;
fn get_tx_test_packet_count(&mut self) -> Result<(), Self::Error>;
fn start_tone(&mut self, channel: u8) -> Result<(), Error<Self::Error>>;
fn stop_tone(&mut self) -> Result<(), Self::Error>;
fn get_link_status(&mut self) -> Result<(), Self::Error>;
fn get_anchor_period(&mut self) -> Result<(), Self::Error>; }

Vendor-specific HCI commands for the ActiveBlueNRG.

Associated Types

Type of communication errors.

Required Methods

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.

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.

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.

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.

Puts the device in standby mode.

Normally the BlueNRG-MS will automatically enter sleep mode to save power. This command further put the device into the Standby mode instead of the sleep mode. The difference is that, in sleep mode, the device can still wake up itself with the internal timer. But in standby mode, this timer is also disabled. So the only possibility to wake up the device is by the external signals, e.g. a HCI command sent via SPI bus.

Based on the measurement, the current consumption under sleep mode is ~2 uA. And this value is ~1.5 uA in standby mode.

Errors

Only underlying communication errors are reported.

Generated events

The controller will generate a command complete event.

The command is only accepted when there is no other Bluetooth activity. Otherwise an error code command disallowed will return.

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 32-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 32-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.

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.

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.

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.

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.

Implementors