Skip to content

Commit

Permalink
Re-add ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianstevens committed Jan 12, 2025
1 parent 9c07df9 commit 9f5132d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Source/Meadow.Clima/Controllers/NetworkController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,30 @@ public class NetworkController
/// </summary>
public TimeSpan DownEventPeriod { get; private set; }

/// <summary>
/// Initializes a new instance of the <see cref="NetworkController"/> class.
/// </summary>
/// <param name="networkAdapter">The network adapter</param>
public NetworkController(INetworkAdapter networkAdapter)
{
if (networkAdapter is IWiFiNetworkAdapter wifi)
{
if (wifi.IsConnected)
{
_ = ReportWiFiScan(wifi);
}

// TODO: make this configurable
wifi.SetAntenna(AntennaType.External);
}
this.networkAdapter = networkAdapter;

networkAdapter.NetworkConnected += OnNetworkConnected;
networkAdapter.NetworkDisconnected += OnNetworkDisconnected;

downEventTimer = new Timer(DownEventTimerProc, null, -1, -1);
}

/// <summary>
/// Connects to the cloud.
/// </summary>
Expand Down

0 comments on commit 9f5132d

Please sign in to comment.