Struct esp_wifi::esp_now::EspNowManager
source · pub struct EspNowManager<'d> { /* private fields */ }
Expand description
Manages the EspNow
instance lifecycle while ensuring it remains active.
Implementations§
source§impl EspNowManager<'_>
impl EspNowManager<'_>
sourcepub fn set_protocol(
&self,
protocols: EnumSet<Protocol>,
) -> Result<(), EspNowError>
pub fn set_protocol( &self, protocols: EnumSet<Protocol>, ) -> Result<(), EspNowError>
Set the wifi protocol.
This will set the wifi protocol to the desired protocol
§Arguments:
protocols
- The desired protocols
sourcepub fn set_power_saving(&self, ps: PowerSaveMode) -> Result<(), WifiError>
pub fn set_power_saving(&self, ps: PowerSaveMode) -> Result<(), WifiError>
Configures modem power saving
sourcepub fn set_channel(&self, channel: u8) -> Result<(), EspNowError>
pub fn set_channel(&self, channel: u8) -> Result<(), EspNowError>
Set primary WiFi channel. Should only be used when using ESP-NOW without AP or STA.
sourcepub fn version(&self) -> Result<u32, EspNowError>
pub fn version(&self) -> Result<u32, EspNowError>
Get the version of ESP-NOW.
sourcepub fn add_peer(&self, peer: PeerInfo) -> Result<(), EspNowError>
pub fn add_peer(&self, peer: PeerInfo) -> Result<(), EspNowError>
Add a peer to the list of known peers.
sourcepub fn remove_peer(&self, peer_address: &[u8; 6]) -> Result<(), EspNowError>
pub fn remove_peer(&self, peer_address: &[u8; 6]) -> Result<(), EspNowError>
Remove the given peer.
sourcepub fn modify_peer(&self, peer: PeerInfo) -> Result<(), EspNowError>
pub fn modify_peer(&self, peer: PeerInfo) -> Result<(), EspNowError>
Modify a peer information.
sourcepub fn peer(&self, peer_address: &[u8; 6]) -> Result<PeerInfo, EspNowError>
pub fn peer(&self, peer_address: &[u8; 6]) -> Result<PeerInfo, EspNowError>
Get peer by MAC address.
sourcepub fn fetch_peer(&self, from_head: bool) -> Result<PeerInfo, EspNowError>
pub fn fetch_peer(&self, from_head: bool) -> Result<PeerInfo, EspNowError>
Fetch a peer from peer list.
Only returns peers which address is unicast, for multicast/broadcast addresses, the function will skip the entry and find the next in the peer list.
sourcepub fn peer_exists(&self, peer_address: &[u8; 6]) -> bool
pub fn peer_exists(&self, peer_address: &[u8; 6]) -> bool
Check is peer is known.
sourcepub fn peer_count(&self) -> Result<PeerCount, EspNowError>
pub fn peer_count(&self) -> Result<PeerCount, EspNowError>
Get the number of peers.
sourcepub fn set_pmk(&self, pmk: &[u8; 16]) -> Result<(), EspNowError>
pub fn set_pmk(&self, pmk: &[u8; 16]) -> Result<(), EspNowError>
Set the primary master key.
sourcepub fn set_wake_window(&self, wake_window: u16) -> Result<(), EspNowError>
pub fn set_wake_window(&self, wake_window: u16) -> Result<(), EspNowError>
Set wake window for esp_now to wake up in interval unit.
Window is milliseconds the chip keep waked each interval, from 0 to 65535.
sourcepub fn set_rate(&self, rate: WifiPhyRate) -> Result<(), EspNowError>
pub fn set_rate(&self, rate: WifiPhyRate) -> Result<(), EspNowError>
Configure ESP-NOW rate.