-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #220 from WildernessLabs/feature/net-events
added network connection related events
- Loading branch information
Showing
6 changed files
with
114 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
Source/Meadow.Contracts/Hardware/Networking/NetworkDisconnectReason.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
namespace Meadow.Hardware; | ||
|
||
/// <summary> | ||
/// Extension methods for NetworkDisconnectReason | ||
/// </summary> | ||
public static class NetworkDisconnectReasonExtensions | ||
{ | ||
/// <summary> | ||
/// Gets a string representation of a NetworkDisconnectReason | ||
/// </summary> | ||
/// <param name="reason"></param> | ||
/// <returns></returns> | ||
public static string ToString(this NetworkDisconnectReason reason) | ||
{ | ||
return reason switch | ||
{ | ||
NetworkDisconnectReason.Unspecified => "Unspecified", | ||
NetworkDisconnectReason.Inactivity => "Disconnected due to inactivity", | ||
NetworkDisconnectReason.TooManyDevicesConnected => "Too many devices already connected to the Access Point", | ||
NetworkDisconnectReason.ManualDisconnect => "Adapter was commanded to disconnect", | ||
NetworkDisconnectReason.IncorrectPasscode => "Incorrect passcode provided", | ||
NetworkDisconnectReason.InsufficientSignal => "Insufficient signal to connect", | ||
NetworkDisconnectReason.AccessPointDisconnected => "Access point dropped the connection", | ||
NetworkDisconnectReason.AccessPointNotFound => "Access point not found", | ||
NetworkDisconnectReason.CableDisconnected => "Cable disconnected", | ||
_ => $"Undefined Reason ({reason})", | ||
}; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Reasons for network interface disconnection | ||
/// </summary> | ||
public enum NetworkDisconnectReason | ||
{ | ||
/// <summary> | ||
/// Unspecified reason for disconnection | ||
/// </summary> | ||
Unspecified = 1, | ||
|
||
/// <summary> | ||
/// Disconnection due to authenticated leave | ||
/// </summary> | ||
AuthenticatedLeave = 3, | ||
|
||
/// <summary> | ||
/// Disconnection due to inactivity | ||
/// </summary> | ||
Inactivity = 4, | ||
|
||
/// <summary> | ||
/// Disconnection because too many devices are connected | ||
/// </summary> | ||
TooManyDevicesConnected = 5, | ||
|
||
/// <summary> | ||
/// Disconnection initiated manually | ||
/// </summary> | ||
ManualDisconnect = 8, | ||
|
||
/// <summary> | ||
/// Disconnection due to incorrect passcode | ||
/// </summary> | ||
IncorrectPasscode = 15, | ||
|
||
/// <summary> | ||
/// Disconnection due to insufficient signal | ||
/// </summary> | ||
InsufficientSignal = 33, | ||
|
||
/// <summary> | ||
/// The network cable was disconnected | ||
/// </summary> | ||
CableDisconnected = 100, | ||
|
||
/// <summary> | ||
/// Disconnection because the access point was disconnected | ||
/// </summary> | ||
AccessPointDisconnected = 200, | ||
|
||
/// <summary> | ||
/// Disconnection because the access point was not found | ||
/// </summary> | ||
AccessPointNotFound = 201, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
Source/Meadow.Contracts/Hardware/Networking/WiFiNetworkDisconnectionEventArgs.cs
This file was deleted.
Oops, something went wrong.