core_pb::driving::network

Trait RobotNetworkBehavior

Source
pub trait RobotNetworkBehavior {
    type Error: Debug;
    type Socket<'a>: Read + Write
       where Self: 'a;

Show 14 methods // Required methods async fn mac_address(&mut self) -> [u8; 6]; async fn wifi_is_connected(&self) -> Option<[u8; 4]>; async fn list_networks<const C: usize>(&mut self) -> Vec<NetworkScanInfo, C>; async fn connect_wifi( &mut self, network: &str, password: Option<&str>, ) -> Result<(), Self::Error>; async fn disconnect_wifi(&mut self); async fn tcp_accept<'a>( &mut self, port: u16, tx_buffer: &'a mut [u8; 5192], rx_buffer: &'a mut [u8; 5192], ) -> Result<Self::Socket<'a>, Self::Error> where Self: 'a; async fn tcp_close<'a>(&mut self, socket: &mut Self::Socket<'a>); async fn prepare_firmware_update(&mut self); async fn write_firmware( &mut self, offset: usize, data: &[u8], ) -> Result<(), Self::Error>; async fn hash_firmware(&mut self, update_len: u32, output: &mut [u8; 32]); async fn mark_firmware_updated(&mut self); async fn firmware_swapped(&mut self) -> bool; async fn reboot(&mut self); async fn mark_firmware_booted(&mut self);
}
Expand description

Functionality that robots with networking must support

Required Associated Types§

Source

type Error: Debug

Source

type Socket<'a>: Read + Write where Self: 'a

Required Methods§

Source

async fn mac_address(&mut self) -> [u8; 6]

Get the device’s mac address

Source

async fn wifi_is_connected(&self) -> Option<[u8; 4]>

If the device is currently connected to a wifi network, its IP, else None

Source

async fn list_networks<const C: usize>(&mut self) -> Vec<NetworkScanInfo, C>

List information for up to C networks

Source

async fn connect_wifi( &mut self, network: &str, password: Option<&str>, ) -> Result<(), Self::Error>

Connect to a network with the given username/password. This method shouldn’t return until the connection either completes or fails, but it shouldn’t do any retries.

This will only be called if RobotNetworkBehavior::wifi_is_connected is false

Source

async fn disconnect_wifi(&mut self)

Disconnect from any active wifi network

Source

async fn tcp_accept<'a>( &mut self, port: u16, tx_buffer: &'a mut [u8; 5192], rx_buffer: &'a mut [u8; 5192], ) -> Result<Self::Socket<'a>, Self::Error>
where Self: 'a,

Accept a socket that meets the requirements. Close the previous one if one exists

Source

async fn tcp_close<'a>(&mut self, socket: &mut Self::Socket<'a>)

Dispose of the current socket

Source

async fn prepare_firmware_update(&mut self)

Source

async fn write_firmware( &mut self, offset: usize, data: &[u8], ) -> Result<(), Self::Error>

See https://docs.embassy.dev/embassy-boot/git/default/struct.FirmwareUpdater.html#method.write_firmware

Source

async fn hash_firmware(&mut self, update_len: u32, output: &mut [u8; 32])

See https://docs.embassy.dev/embassy-boot/git/default/struct.FirmwareUpdater.html#method.hash

Source

async fn mark_firmware_updated(&mut self)

See https://docs.embassy.dev/embassy-boot/git/default/struct.FirmwareUpdater.html#method.mark_updated

Source

async fn firmware_swapped(&mut self) -> bool

See https://docs.embassy.dev/embassy-boot/git/default/struct.FirmwareUpdater.html#method.get_state

Source

async fn reboot(&mut self)

Reboot the microcontroller, as fully as possible

Source

async fn mark_firmware_booted(&mut self)

See https://docs.embassy.dev/embassy-boot/git/default/struct.FirmwareUpdater.html#method.mark_booted

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§