Trait PingDevice

Source
pub trait PingDevice {
    // Required methods
    fn get_common(&self) -> &Common;
    fn get_mut_common(&mut self) -> &mut Common;

    // Provided methods
    fn subscribe(&self) -> Receiver<ProtocolMessage> { ... }
    async fn send_general_request(
        &self,
        requested_id: u16,
    ) -> Result<(), PingError> { ... }
    async fn wait_for_message<T>(
        &self,
        receiver: Receiver<ProtocolMessage>,
    ) -> Result<T, PingError>
       where T: MessageInfo + Sync + Clone + Send + 'static { ... }
    async fn wait_for_ack(
        &self,
        receiver: Receiver<ProtocolMessage>,
        message_id: u16,
    ) -> Result<(), PingError> { ... }
    async fn request<T>(&self) -> Result<T, PingError>
       where T: MessageInfo + Sync + Clone + Send + 'static { ... }
    async fn device_information(
        &self,
    ) -> Result<DeviceInformationStruct, PingError> { ... }
    async fn protocol_version(&self) -> Result<ProtocolVersionStruct, PingError> { ... }
    async fn set_device_id(&self, device_id: u8) -> Result<(), PingError> { ... }
}

Required Methods§

Source

fn get_common(&self) -> &Common

Source

fn get_mut_common(&mut self) -> &mut Common

Provided Methods§

Source

fn subscribe(&self) -> Receiver<ProtocolMessage>

Source

async fn send_general_request(&self, requested_id: u16) -> Result<(), PingError>

Source

async fn wait_for_message<T>( &self, receiver: Receiver<ProtocolMessage>, ) -> Result<T, PingError>
where T: MessageInfo + Sync + Clone + Send + 'static,

Source

async fn wait_for_ack( &self, receiver: Receiver<ProtocolMessage>, message_id: u16, ) -> Result<(), PingError>

Source

async fn request<T>(&self) -> Result<T, PingError>
where T: MessageInfo + Sync + Clone + Send + 'static,

Source

async fn device_information(&self) -> Result<DeviceInformationStruct, PingError>

Device information

Source

async fn protocol_version(&self) -> Result<ProtocolVersionStruct, PingError>

The protocol version

Source

async fn set_device_id(&self, device_id: u8) -> Result<(), PingError>

Set the device ID.

§Arguments
  • device_id - Device ID (1-254). 0 is unknown and 255 is reserved for broadcast messages.

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.

Implementors§

Source§

impl PingDevice for bluerobotics_ping::bluebps::Device

Source§

impl PingDevice for bluerobotics_ping::common::Device

Source§

impl PingDevice for bluerobotics_ping::omniscan450::Device

Source§

impl PingDevice for bluerobotics_ping::ping1d::Device

Source§

impl PingDevice for bluerobotics_ping::ping360::Device