Skip to main content

Class WiFiNetworkAdapter

Represents WiFi network adapter

Assembly: Meadow.dll
View Source
Declaration
public class WiFiNetworkAdapter : NetworkAdapterBase, IWiFiNetworkAdapter, IWirelessNetworkAdapter, INetworkAdapter

Inheritance: System.Object -> Meadow.NetworkAdapterBase

Implements:
Meadow.Hardware.IWiFiNetworkAdapter

Properties

IsConnected

Returns true if the adapter is connected, otherwise false

View Source
Declaration
public override bool IsConnected { get; }

CurrentAntenna

Returns the current Antenna type

View Source
Declaration
public AntennaType CurrentAntenna { get; }

Ssid

Access point the adapter is currently connected to

View Source
Declaration
public string? Ssid { get; }

Bssid

BSSID (MAC) of the access point the ESP32 is currently connected to.

View Source
Declaration
public PhysicalAddress Bssid { get; }

AutoConnect

Automatically attempt to connect to the <b>DefaultSsid</b> network after a power cycle or reset.

View Source
Declaration
public bool AutoConnect { get; }

AutoReconnect

Automatically try to reconnect to an access point if there is a problem / disconnection

View Source
Declaration
public bool AutoReconnect { get; }

DefaultSsid

Default access point to try to connect to if the network interface is started and the board is configured to automatically reconnect.

View Source
Declaration
public string DefaultSsid { get; }

Channel

WiFi channel used for communication.

View Source
Declaration
public int Channel { get; }

Methods

ClearStoredAccessPointInformation()

Removed any stored access point information from the coprocessor memory.

View Source
Declaration
public Task ClearStoredAccessPointInformation()
Returns

System.Threading.Tasks.Task

Connect(string, string, TimeSpan, CancellationToken, ReconnectionType)

Start a WiFi network.

View Source
Declaration
public Task Connect(string ssid, string password, TimeSpan timeout, CancellationToken cancellationToken, ReconnectionType reconnection = ReconnectionType.Automatic)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.StringssidName of the network to connect to.
System.StringpasswordPassword for the network.
System.TimeSpantimeoutTimeout period for the connection attempt
System.Threading.CancellationTokencancellationToken
Meadow.Gateway.WiFi.ReconnectionTypereconnectionShould the adapter reconnect automatically?
Exceptions

System.ArgumentNullException
Thrown if the ssid is null or empty or the password is null.

ConnectToDefaultAccessPoint(TimeSpan, CancellationToken)

Connect to the default access point.

View Source
Declaration
public Task ConnectToDefaultAccessPoint(TimeSpan timeout, CancellationToken cancellationToken)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.TimeSpantimeout
System.Threading.CancellationTokencancellationToken

Disconnect(bool)

Disconnect from the currently active access point.

View Source
Declaration
public Task Disconnect(bool turnOffWiFiInterface)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.BooleanturnOffWiFiInterfaceShould the WiFi interface be turned off?

Scan(CancellationToken)

Get the list of access points.

View Source
Declaration
public Task<IList<WifiNetwork>> Scan(CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Collections.Generic.IList<Meadow.Gateway.WiFi.WifiNetwork>>: An IList (possibly empty) of access points.

Parameters
TypeNameDescription
System.Threading.CancellationTokentokenA System.Threading.CancellationToken to be used if the Scan should be canceled.

Scan(TimeSpan)

Get the list of access points.

View Source
Declaration
public Task<IList<WifiNetwork>> Scan(TimeSpan timeout)
Returns

System.Threading.Tasks.Task<System.Collections.Generic.IList<Meadow.Gateway.WiFi.WifiNetwork>>: An IList (possibly empty) of access points.

Parameters
TypeNameDescription
System.TimeSpantimeoutA System.TimeSpan representing the time to search before giving up.

SetAntenna(AntennaType, bool)

Sets the current antenna type used by the adapter

View Source
Declaration
public void SetAntenna(AntennaType antenna, bool persist = true)
Parameters
TypeNameDescription
Meadow.Hardware.AntennaTypeantennaThe antenna type to use
System.BooleanpersistWhether or not the type should persist across OS restarts
Exceptions

System.NotImplementedException

Implements