Skip to content

Commit

Permalink
Merge pull request #47 from WildernessLabs/feature/ethernet
Browse files Browse the repository at this point in the history
updated Ethernet_Basics sample
  • Loading branch information
jorgedevs authored Jul 3, 2024
2 parents e3467f4 + 420fc99 commit 75ba332
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
23 changes: 18 additions & 5 deletions Source/Meadow F7/Network/Ethernet_Basics/MeadowApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,37 @@ public override async Task Run()
}
else
{
// connected event test.
ethernet.NetworkConnected += EthernetAdapterNetworkConnected;
ethernet.NetworkConnected += EthernetAdapterConnected;
ethernet.NetworkDisconnected += EthernetAdapterDisconnected;

if (ethernet.IsConnected)
{
DisplayNetworkInformation();

while (true)
{
await GetWebPageViaHttpClient("https://postman-echo.com/get?foo1=bar1&foo2=bar2");
try
{
await GetWebPageViaHttpClient("https://postman-echo.com/get?foo1=bar1&foo2=bar2");
}
catch (Exception ex)
{
Resolver.Log.Error($"{ex.Message}");
await Task.Delay(3000);
}
}
}
}
}

void EthernetAdapterNetworkConnected(INetworkAdapter networkAdapter, NetworkConnectionEventArgs e)
private void EthernetAdapterDisconnected(INetworkAdapter sender, NetworkDisconnectionEventArgs args)
{
Resolver.Log.Info("Network cable disconnected");
}

private void EthernetAdapterConnected(INetworkAdapter networkAdapter, NetworkConnectionEventArgs e)
{
Resolver.Log.Info("Connection request completed");
Resolver.Log.Info("Network cable connected");
}

public void DisplayNetworkInformation()
Expand Down
14 changes: 0 additions & 14 deletions Source/Meadow F7/Network/Ethernet_Basics/meadow.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,6 @@ Device:
# (e.g., Core-Compute module with SD add-on)? Optional; default value is `false`.
# SdStorageSupported: true

# Control how the ESP coprocessor will start and operate.
Coprocessor:

# Should the ESP32 automatically attempt to connect to an access point at startup?
# If set to true, wifi.yaml credentials must be stored in the device.
# AutomaticallyStartNetwork: true

# Should the ESP32 automatically reconnect to the configured access point?
# AutomaticallyReconnect: true

# Maximum number of retry attempts for connections etc. before an error code is returned.
# MaximumRetryCount: 7

# Network configuration.
Network:

# Network Interface (Default value is WiFi with DHCP)
Expand Down

0 comments on commit 75ba332

Please sign in to comment.