First I wanted to say great job on the wifi module updates and overall 4.2 upgrade!
I have been able to successfully connect and disconnect wifi without a problem.
However, my up address keeps coming up 0.0.0.0 no matter what. My init setting code is:
// Set the object up
wifi.Interface.Open();
wifi.Interface.NetworkInterface.EnableDhcp();
NetworkInterfaceExtension.AssignNetworkingStackTo(wifi.Interface);
wifi.Interface.WirelessConnectivityChanged += new GHI.Premium.Net.WiFiRS9110.WirelessConnectivityChangedEventHandler(Interface_WirelessConnectivityChanged);
t = new Thread(new ThreadStart(Connect));
t.Start();
Some of the output I get:
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
Network is Up
The thread ‘’ (0x6) has exited with code 0 (0x0).
IsLinkConnected: True
IsOpen: True
IsActivated: True
IsNetworkConnected: True
IsNetworkUp: False IPAddress: 0.0.0.0
I’m I doing something wrong? I thought DHCP was supposed to pull an available IP address? I need this IP address to start a local web server.
Thanks!
@ Weston Bridgewater - for me 30% of the time I get leased an IP address and the and rest of the time nothing… Interface_WirelessConnectivityChanged gets fired but not the Interface_NetworkAddressChanged event.
The same thing is happening to me under 4.2 using FEZspider and a WiFi RS21 module. It seems like all the signals are okay, just DHCP fails to do it’s service (it worked normally under 4.1 using the non-premium library). Static IP works, but fails to create a web server.
What I get back using DHCP:
------------------------------------------------
IP Address: 0.0.0.0
DHCP Enabled: True
Subnet Mask: 0.0.0.0
Gateway: 0.0.0.0
DNS server: 208.67.222.222
------------------------------------------------
Actvated: True
Link connected: True
------------------------------------------------
Web server started at http://0.0.0.0:80/
calling wifiMod.Interface.Open(); seemed to intermittently fail on socket 6 and then constantly started failing; right now I just moved to socket 9 and I haven’t received the exceptions I was getting on socket 6. hope this helps at all.
A first chance exception of type ‘GHI.Premium.Net.NetworkInterfaceExtensionException’ occurred in GHI.Premium.Net.dll
An unhandled exception of type ‘GHI.Premium.Net.NetworkInterfaceExtensionException’ occurred in GHI.Premium.Net.dll
Is there an alternative library that I can use until this is resolved? It was working normally under 4.1, but since the wifi features now moved to the Premium library, is there a way I can still use the old library? Or maybe some other suggestions?
I hate to bitch, but I have a project on hold because of this.
NetworkInterfaceExtension.AssignNetworkingStackTo(wifi);
Error 2 Argument 1: cannot convert from 'Gadgeteer.Modules.GHIElectronics.WiFi_RS21' to 'GHI.Premium.Net.NetworkInterfaceExtension' C:\Users\Weston\Google Drive\Senior Project\Past Projects\Wifi_Test\Wifi_Test\Wifi_Test\Program.cs 35 63 Wifi_Test
Error 1 The best overloaded method match for 'GHI.Premium.Net.NetworkInterfaceExtension.AssignNetworkingStackTo(GHI.Premium.Net.NetworkInterfaceExtension)' has some invalid arguments C:\Users\Weston\Google Drive\Senior Project\Past Projects\Wifi_Test\Wifi_Test\Wifi_Test\Program.cs 35 13 Wifi_Test
private void InitializeModules()
{
// Initialize GTM.Modules and event handlers here.
wifi = new GTM.GHIElectronics.WiFi_RS21(6);
}
I have no idea if this has anything to do with anything, but I’ve just noticed that GHI.Premium.Net library includes misspelled “network” a couple of times (e.g. “AssignedNetwrokInterface”).
Either way, still nothing wrong if you correct it.
Hello, this is the code that works for me (partially - code works for network at my work, at my home does not work, but I think that’s because some kind of problem with my router)
void ConnectMe()
{
if (!wifi_RS21.Interface.IsOpen)
wifi_RS21.Interface.Open();
if (!wifi_RS21.Interface.NetworkInterface.IsDhcpEnabled)
wifi_RS21.Interface.NetworkInterface.EnableDhcp();
NetworkInterfaceExtension.AssignNetworkingStackTo(wifi_RS21.Interface);
wifi_RS21.Interface.WirelessConnectivityChanged += new WiFiRS9110.WirelessConnectivityChangedEventHandler(Interface_WirelessConnectivityChanged);
wifi_RS21.Interface.NetworkAddressChanged += new NetworkInterfaceExtension.NetworkAddressChangedEventHandler(Interface_NetworkAddressChanged);
wifi_RS21.NetworkDown += new GTM.Module.NetworkModule.NetworkEventHandler(wifi_RS21_NetworkDown);
wifi_RS21.NetworkUp += new GTM.Module.NetworkModule.NetworkEventHandler(wifi_RS21_NetworkUp);
WiFiNetworkInfo[] ScanResp = wifi_RS21.Interface.Scan("MyAP");
if (ScanResp != null && ScanResp.Length > 0)
wifi_RS21.Interface.Join(ScanResp[0], "MyPwd");
Debug.Print("Connected to network...");
Gadgeteer.Networking.HttpRequest wc = WebClient.GetFromWeb("http://www.google.com");
wc.ResponseReceived += new HttpRequest.ResponseHandler(wc_ResponseReceived);
Debug.Print("Waiting for response...");
}
void wifi_RS21_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
{
Debug.Print("NetworkUp event!");
}
void wifi_RS21_NetworkDown(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
{
Debug.Print("NetworkDown event!");
}
void Interface_WirelessConnectivityChanged(object sender, WiFiRS9110.WirelessConnectivityEventArgs e)
{
Debug.Print("WirelessConnectivityChanged event!");
Debug.Print("IP Address : " + wifi_RS21.Interface.NetworkInterface.IPAddress);
}
void wc_ResponseReceived(HttpRequest sender, HttpResponse response)
{
Debug.Print("Response is received");
string text = response.Text;
}
void Interface_NetworkAddressChanged(object sender, EventArgs e)
{
Debug.Print("NetworkAddressChanged event!");
Debug.Print("IP Address : " + wifi_RS21.Interface.NetworkInterface.IPAddress);
}
I’m using 4.2 sdk, and AssignNetworkingStackTo method doesn’t support wifi_RS21 object, but it’s interface property. I’m programming in Micro Framework for two days now, so I could say some nonsense things…
To clarify again, if I do not pass it, I get this error:
Error 2 Argument 1: cannot convert from 'Gadgeteer.Modules.GHIElectronics.WiFi_RS21' to 'GHI.Premium.Net.NetworkInterfaceExtension' C:\Users\jure\AppData\Local\Temporary Projects\GadgeteerApp1\Program.cs 40 63 GadgeteerApp1
If I do pass it, I get this exception:
#### Exception GHI.Premium.Net.NetworkInterfaceExtensionException - 0x00000000 (1) ####
#### Message:
#### GHI.Premium.Net.NetworkInterfaceExtension::Activate [IP: 001a] ####
#### GadgeteerApp1.Program::ProgramStarted [IP: 0024] ####
A first chance exception of type 'GHI.Premium.Net.NetworkInterfaceExtensionException' occurred in GHI.Premium.Net.dll
An unhandled exception of type 'GHI.Premium.Net.NetworkInterfaceExtensionException' occurred in GHI.Premium.Net.dll