Gadgeteer WiFi Scanner

Just published my first Gadgeteer app.
You can find the current results
Feel free to comment, criticize, berate, etc. as you see fit.

Nice! The image there is too small. Can you post it here as well?


…and to follow the trend, here’s what it looks like on the inside…

Looks great!


BTW, I discovered a couple of minor (but irritating) bugs:

  1. the channel sort routine was sorting based on the string representation of the number; not the number itself
  2. the RSSI sort routine was sorting incorrectly (-90 is actually smaller than -80)

The corrected “CompareItems” function follows:

        private static int CompareItems(string Field, AccessPointInfo Ref, AccessPointInfo Cmp)
            int Result = 0;
            switch (Field)
                case "SSID": Result = Ref.SSID.CompareTo(Cmp.SSID); break;
                case "Chan":
                    if(Ref.ChannelNumber > Cmp.ChannelNumber)
                        Result = 1;
                    if(Ref.ChannelNumber < Cmp.ChannelNumber)
                        Result = -1;
                case "Mode": Result = CompareSecModes(Ref.SecMode, Cmp.SecMode); break;
                    // RSSI is signal strength expressed in dBm.
                    // because this value is inversely proprtional
                    // to signal strength, we provide opposite results 
                    // for "larger vs. smaller" comparisons
                case "RSSI":
                    if (Ref.RSSI > Cmp.RSSI)
                        Result = -1;
                    if (Ref.RSSI < Cmp.RSSI)
                        Result = 1;
            return Result;

…oh; did I forget to mention that you can sort the WAP list by each field simply by tapping on the column name and that you can tell the scanner to try to connect to a WAP by tapping on the SSID?
As soon as Gus & crew sort out the new drivers, I’ll work up (or gladly accept) a passkey popup dialog so you can connect to more than Open WAPs.

This is is cool. Thank you for sharing. :wink:

I saw your glide based wifi scanner but the screen xml for glide is missing. Can you attach to your code submission? :wink:

Hi Patrick,

Sorry - I forgot that I wasn’t able to attach the project.
I’ve added it to the source code.

Thx Jimmy, Now I can start testing it 8)


I downloaded your Wifi scanner project (, but I can’t get it working.

This is my first playing day with FEZ Spider.
I upgraded the firmware a few hours ago.

I get the following error when instanciating the Wifi Module :

The thread ‘’ (0x2) has exited with code 0 (0x0).
Using mainboard GHIElectronics-FEZSpider version 1.0
Version Number is 4.3.0
#### Exception GHIElectronics.NETMF.Net.WiFi+HardwareException - 0x00000000 (1) ####
#### Message:
#### GHIElectronics.NETMF.Net.WiFi::Enable [IP: 008d] ####
#### Gadgeteer.Modules.GHIElectronics.WiFi_RS21::.ctor [IP: 0064] ####
#### WiFiTest_Wpf.Program::InitializeModules [IP: 0024] ####
#### WiFiTest_Wpf.Program::Main [IP: 000e] ####
A first chance exception of type ‘GHIElectronics.NETMF.Net.WiFi.HardwareException’ occurred in GHIElectronics.NETMF.Net.dll
#### Exception System.ApplicationException - 0x00000000 (1) ####
#### Message: Unable to enable WiFi module.
#### Gadgeteer.Modules.GHIElectronics.WiFi_RS21::.ctor [IP: 006e] ####
#### WiFiTest_Wpf.Program::InitializeModules [IP: 0024] ####
#### WiFiTest_Wpf.Program::Main [IP: 000e] ####
A first chance exception of type ‘System.ApplicationException’ occurred in GTM.GHIElectronics.WiFi_RS21.dll
An unhandled exception of type ‘System.ApplicationException’ occurred in GTM.GHIElectronics.WiFi_RS21.dll

Additional information: Unable to enable WiFi module.

Could you please give me information on how to solve that issue.

Thanks by advance !

@ JeJe
What WiFi module are you using (this only works with the WIFI_RS21 module)?
What socket is your WiFi module plugged into (only 6 or 9 are valid)?

You have to change the following #define in WiFiClass.cs as noted in the comments:

// comment this out if your WiFi module is plugged into socket 6
 #define SOCKET_9

In other words, if you connect your WiFi module to socket 6, you would comment out that #define statement. If you connect your WiFi module to socket 9, you would leave it alone.

I’m working on making the display more responsive (and learning a bit about NetMF async operations in the process), so I’ll see what I can do about making the initialization routine a bit more “socket flexible”.

@ Jimmy
I’m using WiFi_RS21 module (1.1 is writen on the module).
I had a look to you code and explanations, and took care of
plugging the module on the socket 9.

The crash occurs here :

wifi = new GTM.GHIElectronics.WiFi_RS21(9);

The project is referencing GTM.GHIElectronics.WiFi_RS21.dll
Runtime version v4.0.30319

Thanks for your help !

You’re not using the project [italic]as provided[/italic].
That line of code is created by the Gadgeteer module weirdzard and it will fail until the GHI/Redpine collaboration completes their current efforts.

If you use the project [italic]as provided[/italic], and edit the #define to accommodate the socket where your WiFi module is connected, the scanner should work.

I’ll have an updated version available soonish that’s a bit more socket-aware.

I edited the diagram to see which modules where used.
Doing this re-generated the .cs file, and the wifi initialization line has been enabled.

Everything is fine now.

Thank you very much for you help !

And congratulations for your project !

Until GHI & Redpine finish their current efforts, you must not include the WiFi module in your project. THe new one I’m about to republish will not include the WiFi module and so you will not run into this confusion.

Delete the WiFi module from the wizard and recompile - there will be no initialization errors as long as you set your #define properly.

OK - I’ve finished the updates.
It now:

  • auto-detects the socket where you’ve attached your WiFi_RS21 module
  • adds a “cycle” button that starts a cyclic scan operation so you can hone in on those rogue WiFi deployments while you walk around
  • provides faster screen updates through copius use of Dispatcher calls

@ Jeje - see if you like this one better (you still can’t add the WiFi module to the designer yet)


Have you guys tried the new WiFi driver for .NETMF and .NET Gadgeteer?

Yes. It now works fine on my Spider in a Gadgeteer project. I tested getting a DHCP address, and pinging the Spider from another PC.


I have - and it works much mo betterer!
The online docs haven’t caught up with the API changes (and there are MANY). Got an ETA for that?
Also, I’m seing some odd behavior with the error caes for the Join() operation.
I’m collating some data and I’ll send it ASAP.