pub struct Device {
pub common: Common,
}Fields§
§common: CommonImplementations§
Source§impl Device
impl Device
pub fn new<T>(io: T) -> Self
Sourcepub async fn distance(&self) -> Result<DistanceStruct, PingError>
pub async fn distance(&self) -> Result<DistanceStruct, PingError>
The distance to target with confidence estimate. Relevant device parameters during the measurement are also provided.
Sourcepub async fn general_info(&self) -> Result<GeneralInfoStruct, PingError>
pub async fn general_info(&self) -> Result<GeneralInfoStruct, PingError>
General information.
Sourcepub async fn voltage_5(&self) -> Result<Voltage5Struct, PingError>
pub async fn voltage_5(&self) -> Result<Voltage5Struct, PingError>
The 5V rail voltage.
Sourcepub async fn mode_auto(&self) -> Result<ModeAutoStruct, PingError>
pub async fn mode_auto(&self) -> Result<ModeAutoStruct, PingError>
The current operating mode of the device. Manual mode allows for manual selection of the gain and scan range.
Sourcepub async fn processor_temperature(
&self,
) -> Result<ProcessorTemperatureStruct, PingError>
pub async fn processor_temperature( &self, ) -> Result<ProcessorTemperatureStruct, PingError>
Temperature of the device cpu.
Sourcepub async fn continuous_stop(&self, id: u16) -> Result<(), PingError>
pub async fn continuous_stop(&self, id: u16) -> Result<(), PingError>
Command to stop the continuous data stream of profile messages.
§Arguments
id- The message id to stop streaming. 1300: profile
Sourcepub async fn device_id(&self) -> Result<DeviceIdStruct, PingError>
pub async fn device_id(&self) -> Result<DeviceIdStruct, PingError>
The device ID.
Sourcepub async fn speed_of_sound(&self) -> Result<SpeedOfSoundStruct, PingError>
pub async fn speed_of_sound(&self) -> Result<SpeedOfSoundStruct, PingError>
The speed of sound used for distance calculations.
Sourcepub async fn set_ping_interval(
&self,
ping_interval: u16,
) -> Result<(), PingError>
pub async fn set_ping_interval( &self, ping_interval: u16, ) -> Result<(), PingError>
The interval between acoustic measurements.
§Arguments
ping_interval[ms] - The interval between acoustic measurements.
Sourcepub async fn firmware_version(&self) -> Result<FirmwareVersionStruct, PingError>
pub async fn firmware_version(&self) -> Result<FirmwareVersionStruct, PingError>
Device information
Sourcepub async fn set_speed_of_sound(
&self,
speed_of_sound: u32,
) -> Result<(), PingError>
pub async fn set_speed_of_sound( &self, speed_of_sound: u32, ) -> Result<(), PingError>
Set the speed of sound used for distance calculations.
§Arguments
speed_of_sound[mm/s] - The speed of sound in the measurement medium. ~1,500,000 mm/s for water.
Sourcepub async fn set_gain_setting(&self, gain_setting: u8) -> Result<(), PingError>
pub async fn set_gain_setting(&self, gain_setting: u8) -> Result<(), PingError>
Set the current gain setting.
§Arguments
gain_setting- The current gain setting. 0: 0.6, 1: 1.8, 2: 5.5, 3: 12.9, 4: 30.2, 5: 66.1, 6: 144
Sourcepub async fn profile(&self) -> Result<ProfileStruct, PingError>
pub async fn profile(&self) -> Result<ProfileStruct, PingError>
A profile produced from a single acoustic measurement. The data returned is an array of response strength at even intervals across the scan region. The scan region is defined as the region between <scan_start> and <scan_start + scan_length> millimeters away from the transducer. A distance measurement to the target is also provided.
Sourcepub async fn set_range(
&self,
scan_start: u32,
scan_length: u32,
) -> Result<(), PingError>
pub async fn set_range( &self, scan_start: u32, scan_length: u32, ) -> Result<(), PingError>
Set the scan range for acoustic measurements.
§Arguments
scan_start[mm] - Not documentedscan_length[mm] - The length of the scan range. Minimum 1000.
Sourcepub async fn continuous_start(&self, id: u16) -> Result<(), PingError>
pub async fn continuous_start(&self, id: u16) -> Result<(), PingError>
Command to initiate continuous data stream of profile messages.
§Arguments
id- The message id to stream. 1300: profile
Sourcepub async fn gain_setting(&self) -> Result<GainSettingStruct, PingError>
pub async fn gain_setting(&self) -> Result<GainSettingStruct, PingError>
The current gain setting.
Sourcepub async fn ping_enable(&self) -> Result<PingEnableStruct, PingError>
pub async fn ping_enable(&self) -> Result<PingEnableStruct, PingError>
Acoustic output enabled state.
Sourcepub async fn pcb_temperature(&self) -> Result<PcbTemperatureStruct, PingError>
pub async fn pcb_temperature(&self) -> Result<PcbTemperatureStruct, PingError>
Temperature of the on-board thermistor.
Sourcepub async fn set_oss_profile_configuration(
&self,
number_of_points: u16,
normalization_enabled: u8,
enhance_enabled: u8,
) -> Result<(), PingError>
pub async fn set_oss_profile_configuration( &self, number_of_points: u16, normalization_enabled: u8, enhance_enabled: u8, ) -> Result<(), PingError>
Set the profile output configuration. (Open source firmware only)
§Arguments
number_of_points- Not documentednormalization_enabled- If enabled, the profile data is scaled so that the maximum value aligns with the upper limit of 255. (0: Disabled, 1: Enabled)enhance_enabled- If enabled, the profile data will be unevenly scaled to enhance peak values. (0: Disabled, 1: Enabled)
Sourcepub async fn oss_profile_configuration(
&self,
) -> Result<OssProfileConfigurationStruct, PingError>
pub async fn oss_profile_configuration( &self, ) -> Result<OssProfileConfigurationStruct, PingError>
Get the profile output configuration. (Open source firmware only)
Sourcepub async fn goto_bootloader(&self) -> Result<(), PingError>
pub async fn goto_bootloader(&self) -> Result<(), PingError>
Send the device into the bootloader. This is useful for firmware updates.
§Arguments
Sourcepub async fn range(&self) -> Result<RangeStruct, PingError>
pub async fn range(&self) -> Result<RangeStruct, PingError>
The scan range for acoustic measurements. Measurements returned by the device will lie in the range (scan_start, scan_start + scan_length).
Sourcepub async fn transmit_duration(
&self,
) -> Result<TransmitDurationStruct, PingError>
pub async fn transmit_duration( &self, ) -> Result<TransmitDurationStruct, PingError>
The duration of the acoustic activation/transmission.
Sourcepub async fn ping_interval(&self) -> Result<PingIntervalStruct, PingError>
pub async fn ping_interval(&self) -> Result<PingIntervalStruct, PingError>
The interval between acoustic measurements.
Sourcepub async fn set_device_id(&self, device_id: u8) -> Result<(), PingError>
pub async fn set_device_id(&self, device_id: u8) -> Result<(), PingError>
Set the device ID.
§Arguments
device_id- Device ID (0-254). 255 is reserved for broadcast messages.
Sourcepub async fn set_mode_auto(&self, mode_auto: u8) -> Result<(), PingError>
pub async fn set_mode_auto(&self, mode_auto: u8) -> Result<(), PingError>
Set automatic or manual mode. Manual mode allows for manual selection of the gain and scan range.
§Arguments
mode_auto- 0: manual mode. 1: auto mode.
Sourcepub async fn distance_simple(&self) -> Result<DistanceSimpleStruct, PingError>
pub async fn distance_simple(&self) -> Result<DistanceSimpleStruct, PingError>
The distance to target with confidence estimate.