(I am new to this so I hope this is the right place to report a “bug”?)
I took the WifiWeather sample because I wanted to try out both the display and out the WiFi functionality, but if i am not misktaken I found a bug in Connect method.
When I run the following code:
Device.InitWiFiAdapter().Wait();
onboardLed.StartPulse(Color.Blue);
var result = await Device.WiFiAdapter.Connect(Secrets.WIFI_NAME, Secrets.WIFI_PASSWORD);
if (result.ConnectionStatus != ConnectionStatus.Success)
{
throw new Exception($"Cannot connect to network: {result.ConnectionStatus}");
}
else
{
Console.WriteLine("INFO: Connected to WiFi " + Secrets.WIFI_NAME);
}
I get a “INFO: Connected to WiFi xxxx” (Success) even if SSID name and/or password is wrong.
I discovered this because I couldn’t get any data back from the weather service and then I found out that I had written the SSID with a starting lowercase letter, which was not correct. When I changed the SSID in Secrets.cs to start with a uppercase letter I got data back from the weather service.
I have now tried again to rebuild and deploy with same results. I get Success from Connect even when password for SSID is wrong.
Are there some logs that I can provide or things that i can check to see if there is something wrong with the downloaded modules/packages?
As a side note, I find it strange the way WifiWeather calls the Initialize () and Start () methods. If I am not mistaken, then you can easily risk that the call to the weather service is carried out before connecting to Wifi.
I’ve fixed this in my own version, but I’m wondering why it’s coded this way in the sample and Visual Studio also complains about the way the Initialize () and Start () methods are called because they are async methods.