pub struct Device {
pub common: Common,
}Fields§
§common: CommonImplementations§
Source§impl Device
impl Device
pub fn new<T>(io: T) -> Self
Sourcepub async fn device_data(&self) -> Result<DeviceDataStruct, PingError>
pub async fn device_data(&self) -> Result<DeviceDataStruct, PingError>
This message is used to communicate the current sonar state. If the data field is populated, the other fields indicate the sonar state when the data was captured. The time taken before the response to the command is sent depends on the difference between the last angle scanned and the new angle in the parameters as well as the number of samples and sample interval (range). To allow for the worst case reponse time the command timeout should be set to 4000 msec.
Sourcepub async fn auto_device_data(&self) -> Result<AutoDeviceDataStruct, PingError>
pub async fn auto_device_data(&self) -> Result<AutoDeviceDataStruct, PingError>
NEW (v1.1.0) Extended version of device_data with auto_transmit information. The sensor emits this message when in auto_transmit mode.
Sourcepub async fn transducer(
&self,
mode: u8,
gain_setting: u8,
angle: u16,
transmit_duration: u16,
sample_period: u16,
transmit_frequency: u16,
number_of_samples: u16,
transmit: u8,
reserved: u8,
) -> Result<DeviceDataStruct, PingError>
pub async fn transducer( &self, mode: u8, gain_setting: u8, angle: u16, transmit_duration: u16, sample_period: u16, transmit_frequency: u16, number_of_samples: u16, transmit: u8, reserved: u8, ) -> Result<DeviceDataStruct, PingError>
The transducer will apply the commanded settings. The sonar will reply with a device_data message. If the transmit field is 0, the sonar will not transmit after locating the transducer, and the data field in the device_data message reply will be empty. If the transmit field is 1, the sonar will make an acoustic transmission after locating the transducer, and the resulting data will be uploaded in the data field of the device_data message reply. To allow for the worst case response time the command timeout should be set to 4000 msec.
§Arguments
mode- Operating mode (1 for Ping360)gain_setting- Analog gain setting (0 = low, 1 = normal, 2 = high)angle[gradians] - Head angletransmit_duration[microseconds] - Acoustic transmission duration (1~1000 us)sample_period[eicosapenta-nanoseconds] - Time interval between individual signal intensity samples in 25 ns increments (80 to 40000 == 2 to 1000 us)transmit_frequency[kilohertz] - Acoustic operating frequency (500~1000 kHz). It is only practical to use say 650 to 850 kHz due to the narrow bandwidth of the acoustic receiver.number_of_samples[samples] - Number of samples per reflected signal (supported values: 200~1200)transmit- 0 = do not transmit; 1 = transmit after the transducer has reached the specified anglereserved- reserved
Sourcepub async fn motor_off(&self) -> Result<(), PingError>
pub async fn motor_off(&self) -> Result<(), PingError>
The sonar switches the current through the stepper motor windings off to save power. The sonar will send an ack message in response. The command timeout should be set to 50 msec. If the sonar is idle (not scanning) for more than 30 seconds then the motor current will automatically turn off. When the user sends any command that involves moving the transducer then the motor current is automatically re-enabled.
§Arguments
Sourcepub async fn reset(&self, bootloader: u8, reserved: u8) -> Result<(), PingError>
pub async fn reset(&self, bootloader: u8, reserved: u8) -> Result<(), PingError>
Reset the sonar. The bootloader may run depending on the selection according to the bootloader payload field. When the bootloader runs, the external LED flashes at 5Hz. If the bootloader is not contacted within 5 seconds, it will run the current program. If there is no program, then the bootloader will wait forever for a connection. Note that if you issue a reset then you will have to close all your open comm ports and go back to issuing either a discovery message for UDP or go through the break sequence for serial comms before you can talk to the sonar again.
§Arguments
bootloader- 0 = skip bootloader; 1 = run bootloaderreserved- reserved
Sourcepub async fn auto_transmit(
&self,
mode: u8,
gain_setting: u8,
transmit_duration: u16,
sample_period: u16,
transmit_frequency: u16,
number_of_samples: u16,
start_angle: u16,
stop_angle: u16,
num_steps: u8,
delay: u8,
) -> Result<(), PingError>
pub async fn auto_transmit( &self, mode: u8, gain_setting: u8, transmit_duration: u16, sample_period: u16, transmit_frequency: u16, number_of_samples: u16, start_angle: u16, stop_angle: u16, num_steps: u8, delay: u8, ) -> Result<(), PingError>
NEW (v1.1.0) Extended transducer message with auto-scan function. The sonar will automatically scan the region between start_angle and end_angle and send auto_device_data messages as soon as new data is available. Send a line break to stop scanning (and also begin the autobaudrate procedure). Alternatively, a motor_off message may be sent (but retries might be necessary on the half-duplex RS485 interface).
§Arguments
mode- Operating mode (1 for Ping360)gain_setting- Analog gain setting (0 = low, 1 = normal, 2 = high)transmit_duration[microseconds] - Acoustic transmission duration (1~1000 us)sample_period[eicosapenta-nanoseconds] - Time interval between individual signal intensity samples in 25 ns increments (80 to 40000 == 2 to 1000 us)transmit_frequency[kilohertz] - Acoustic operating frequency (500~1000 kHz). It is only practical to use say 650 to 850 kHz due to the narrow bandwidth of the acoustic receiver.number_of_samples[samples] - Number of samples per reflected signal (supported values: 200~1200)start_angle[gradians] - Head angle to begin scan sector for autoscan (0~399 = 0~360 degrees).stop_angle[gradians] - Head angle to end scan sector for autoscan (0~399 = 0~360 degrees).num_steps[gradians] - Number of 0.9 degree motor steps between pings for auto scan (1~10 = 0.9~9.0 degrees)delay[milliseconds] - An additional delay between successive transmit pulses (0~100 ms). This may be necessary for some programs to avoid collisions on the RS485 USRT.