Skip to content

Commit

Permalink
Merge pull request #70 from WildernessLabs/dominique-FixNotImplemented
Browse files Browse the repository at this point in the history
Fix not implemented
  • Loading branch information
CartBlanche authored Jun 6, 2024
2 parents 6d78319 + 137cd86 commit 48b9ffd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal class NetworkController : INetworkController
{
private bool isConnected;

public event EventHandler NetworkStatusChanged;
public event EventHandler? NetworkStatusChanged;

public NetworkController(Keyboard? keyboard)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,38 @@ namespace ___safeprojectname___.F7;

internal class NetworkController : INetworkController
{
public event EventHandler NetworkStatusChanged;
private const string WIFI_NAME = "[SOME_NAME]";
private const string WIFI_PASSWORD = "[SOME_SECRET]";

private bool isNetworkConnected;
public event EventHandler? NetworkStatusChanged;

public NetworkController(F7MicroBase device)
{
var wifi = device.NetworkAdapters.Primary<IWiFiNetworkAdapter>();
wifi = device.NetworkAdapters.Primary<IWiFiNetworkAdapter>();

IsConnected = wifi.IsConnected;
wifi.NetworkConnected += OnNetworkConnected;
wifi.NetworkDisconnected += OnNetworkDisconnected;
}

private void OnNetworkDisconnected(INetworkAdapter sender, NetworkDisconnectionEventArgs args)
{
IsConnected = false;
// Handle logic when disconnected.
}

private void OnNetworkConnected(INetworkAdapter sender, NetworkConnectionEventArgs args)
{
IsConnected = true;
// Handle logic when connected.
}

private IWiFiNetworkAdapter? wifi;

public bool IsConnected
{
get => isNetworkConnected;
set
{
if (value == IsConnected) return;
isNetworkConnected = value;
NetworkStatusChanged?.Invoke(this, EventArgs.Empty);
}
get => wifi.IsConnected;
}

public Task Connect()
public async Task Connect()
{
throw new NotImplementedException();
await wifi.Connect(WIFI_NAME, WIFI_PASSWORD, TimeSpan.FromSeconds(45));
}
}

0 comments on commit 48b9ffd

Please sign in to comment.