pub struct NetworkInfo {
pub ssid: String,
pub signal_strength: u8,
pub security: SecurityType,
pub bssid: Option<String>,
pub frequency: Option<u32>,
pub is_connected: bool,
}Expand description
Information about a discovered WiFi network.
Returned by WifiManager::scan() when scanning
for available networks.
§Example
use rpi_host::WifiManager;
let wifi = WifiManager::new()?;
for network in wifi.scan()? {
println!(
"{}: {}% signal, {} security{}",
network.ssid,
network.signal_strength,
network.security,
if network.is_connected { " (connected)" } else { "" }
);
}Fields§
§ssid: StringThe SSID (network name).
signal_strength: u8Signal strength as a percentage (0-100).
Higher values indicate a stronger signal.
security: SecurityTypeSecurity type of the network.
bssid: Option<String>BSSID (MAC address of the access point).
Useful for distinguishing between access points with the same SSID.
frequency: Option<u32>Frequency in MHz (e.g., 2412 for channel 1, 5180 for channel 36).
is_connected: boolWhether the device is currently connected to this network.
Implementations§
Source§impl NetworkInfo
impl NetworkInfo
Sourcepub fn new(
ssid: impl Into<String>,
signal_strength: u8,
security: SecurityType,
) -> Self
pub fn new( ssid: impl Into<String>, signal_strength: u8, security: SecurityType, ) -> Self
Create a new NetworkInfo with required fields.
§Arguments
ssid- The network namesignal_strength- Signal strength (0-100)security- Security type of the network
Sourcepub fn with_bssid(self, bssid: impl Into<String>) -> Self
pub fn with_bssid(self, bssid: impl Into<String>) -> Self
Set the BSSID (builder pattern).
Sourcepub fn with_frequency(self, frequency: u32) -> Self
pub fn with_frequency(self, frequency: u32) -> Self
Set the frequency (builder pattern).
Sourcepub fn with_connected(self, connected: bool) -> Self
pub fn with_connected(self, connected: bool) -> Self
Set the connected status (builder pattern).
Trait Implementations§
Source§impl Clone for NetworkInfo
impl Clone for NetworkInfo
Source§fn clone(&self) -> NetworkInfo
fn clone(&self) -> NetworkInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NetworkInfo
impl RefUnwindSafe for NetworkInfo
impl Send for NetworkInfo
impl Sync for NetworkInfo
impl Unpin for NetworkInfo
impl UnwindSafe for NetworkInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more