Device

Trait Device 

Source
pub trait Device<'a> {
    // Required methods
    fn set_client(&self, client: &'a dyn Client);
    fn init(&self) -> Result<(), ErrorCode>;
    fn mac(&self) -> Result<[u8; 6], ErrorCode>;
    fn access_point(
        &self,
        ssid: Ssid,
        security: Option<(Security, Passphrase)>,
        channel: u8,
    ) -> Result<(), ErrorCode>;
    fn station(&self) -> Result<(), ErrorCode>;
    fn join(
        &self,
        ssid: Ssid,
        security: Option<(Security, Passphrase)>,
    ) -> Result<(), ErrorCode>;
    fn leave(&self) -> Result<(), ErrorCode>;
    fn scan(&self) -> Result<(), ErrorCode>;
    fn stop_scan(&self) -> Result<(), ErrorCode>;
}

Required Methods§

Source

fn set_client(&self, client: &'a dyn Client)

Set client

Source

fn init(&self) -> Result<(), ErrorCode>

Initialize the device

Source

fn mac(&self) -> Result<[u8; 6], ErrorCode>

Return the device’s MAC address

Source

fn access_point( &self, ssid: Ssid, security: Option<(Security, Passphrase)>, channel: u8, ) -> Result<(), ErrorCode>

Configure the device as access point (AP)

§Arguments
  • ssid: The SSID of the configured network
  • security: Security method used by the network:
    • None if the network is open
    • tuple of the security method and the passphrase buffer
  • channel: 802.11 WLAN channel number
Source

fn station(&self) -> Result<(), ErrorCode>

Configure the device as station (STA)

Source

fn join( &self, ssid: Ssid, security: Option<(Security, Passphrase)>, ) -> Result<(), ErrorCode>

Join a network, either open or protected

§Arguments
  • ssid: WiFi network SSID
  • security: Security method to use in order to join the network:
    • None if the network is open
    • tuple of the security method and the passphrase buffer
Source

fn leave(&self) -> Result<(), ErrorCode>

Disconnect from the current network

Source

fn scan(&self) -> Result<(), ErrorCode>

Start scanning the available WiFi networks

Source

fn stop_scan(&self) -> Result<(), ErrorCode>

Try to force the device to stop scanning

Implementors§

Source§

impl<'a, P: Pin, A: Alarm<'a>, B: CYW4343xBus<'a>> Device<'a> for CYW4343x<'a, P, A, B>