Is there example code for connecting successively to wifi using .NET Micro 4.2? I have tried but am not able to generate a NetworkUpEvent. A WirelessConnectivityChanged is generated which states that IsConnected = true. Is there also example code of how to properly use UpdateFirmware() method?
void Connect()
{
GHI.Premium.Net.WiFiNetworkInfo[] myBSS = wifi.Interface.Scan(myAP);
if (myBSS != null)
{
Debug.Print("Connecting to " + myAP);
wifi.Interface.Join(myBSS[0], password);
Debug.Print("IsLinkConnected: " + wifi.Interface.IsLinkConnected);
Debug.Print("IsOpen: " + wifi.Interface.IsOpen);
Debug.Print("IsActivated: " + wifi.Interface.IsActivated);
Debug.Print("IsNetworkConnected: " + wifi.IsNetworkConnected);
Debug.Print("IsNetworkUp: " + wifi.IsNetworkUp);
Debug.Print("Connected");
}
else
{
Debug.Print(myAP + " Wireless network was not found");
}
}
void ProgramStarted()
{
wifi.UseDHCP();
wifi.DebugPrintEnabled = true;
wifi.NetworkDown += new GTM.Module.NetworkModule.NetworkEventHandler(wifi_NetworkDown);
wifi.NetworkUp += new GTM.Module.NetworkModule.NetworkEventHandler(wifi_NetworkUp);
wifi.Interface.Open();
wifi.Interface.WirelessConnectivityChanged += new GHI.Premium.Net.WiFiRS9110.WirelessConnectivityChangedEventHandler(Interface_WirelessConnectivityChanged);
Connect();
}
Output:
Using mainboard GHI Electronics FEZSpider version 1.0
RS9110 firmware version Number is 4.4.5
RS9110 driver version Number is 4.4.5
Connecting to Home_Slow
IsConnected: True
IsLinkConnected: True
IsOpen: True
IsActivated: False
IsNetworkConnected: True
IsNetworkUp: False
Connected
Network down event generated but may not be down
The thread ‘’ (0x3) has exited with code 0 (0x0).