Class WifiAdapter
Provides a means to scan for nearby Wifi access points, enumerate those that are found, and connect to an access point.
public sealed class WifiAdapter : IDisposable
- Inheritance
-
WifiAdapter
- Implements
- Inherited Members
- Extension Methods
Properties
NetworkInterface
Gets the network interface number associatted with this Wifi adapter
public int NetworkInterface { get; }
Property Value
NetworkReport
Gets a list of available networks populated by the last Wifi scan on this WifiNetworkAdapter.
public WifiNetworkReport NetworkReport { get; }
Property Value
Methods
Connect(WifiAvailableNetwork, WifiReconnectionKind, string)
Connect this Wifi device to the specified network, with the specified pass-phrase and reconnection policy.
public WifiConnectionResult Connect(WifiAvailableNetwork availableNetwork, WifiReconnectionKind reconnectionKind, string passwordCredential)
Parameters
availableNetwork
WifiAvailableNetworkDescribes the Wifi network to be connected.
reconnectionKind
WifiReconnectionKindSpecifies how to reconnect if the connection is lost.
passwordCredential
stringThe pass-phrase to be used to connect to the access point.
Returns
- WifiConnectionResult
On successful conclusion of the operation, returns an object that describes the result of the connect operation.
Connect(string, WifiReconnectionKind, string)
Connect this Wifi device to the specified network (using SSID string), with the specified pass-phrase and reconnection policy.
public WifiConnectionResult Connect(string ssid, WifiReconnectionKind reconnectionKind, string passwordCredential)
Parameters
ssid
stringDescribes the Wifi network to be connected.
reconnectionKind
WifiReconnectionKindSpecifies how to reconnect if the connection is lost.
passwordCredential
stringThe pass-phrase to be used to connect to the access point.
Returns
- WifiConnectionResult
On successful conclusion of the operation, returns an object that describes the result of the connect operation.
Disconnect()
Disconnects any active Wifi connection through this adapter.
public void Disconnect()
Dispose()
Dispose WifiAdapter
public void Dispose()
Finalize()
protected override void Finalize()
FindAllAdapters()
A static method that enumerates all the Wifi adapters in the system.
public static WifiAdapter[] FindAllAdapters()
Returns
- WifiAdapter[]
On successful completion, returns an array of WifiAdapter objects
ScanAsync()
Directs this adapter to initiate an asynchronous network scan.
public void ScanAsync()
Remarks
On successful completion, returns a list of Wi-Fi networks scanned by this adapter signaled by the AvailableNetworksChanged event. Use NetworkReport to retrieve the list of available Wi-Fi networks.
Exceptions
- InvalidOperationException
If the Wi-Fi interface hasn't been started.
- TimeoutException
If a timeout occurred when trying to initiate a scan operation.
Events
AvailableNetworksChanged
Event raised when a scan completes on this Wifi adapter.
public event AvailableNetworksChangedEventHandler AvailableNetworksChanged