After making my Photon WiFi Strength Meter, I wanted to take my design a step up, by getting a list of surrounding WiFis and displaying the info on a screen.
The Intel Edison was perfect for doing this, as I had the SparkFun OLED block for the Edison and I could easily do any processing I needed on the device. I finished this project on the same weekend I made my strength meter with the Photon.
I started off with figuring out how to get the list of surrounding WiFis, after digging around for a bit I found the command:
Which will list information about the currently connected WiFi, and it will scan for other WiFi connections. Using the command
iwlist wlan0 scan
I was able to get a list of all the available information from the surrounding WiFi connections. Combining that with GREP to filter out the fields we care about, we get
iwlist wlan0 scan | grep -E 'Address|Channel|ESSID|Mode|Quality|Authentication'
But how do we use this command in and app, and more importantly, write the information to the screen and give us some controls? Well we'll use the snippet of code from here to execute shell commands from C++, and read back the input.
After the program reads back the input, we parse it, and display in on the screen and use the A and B tactile buttons to scroll through the data, which is sorted based on the unique UUID address each router has.
I'm not going to break down what each part of the code does, as that would take a long time, and if you want to know more about it you can download the repository which is linked to below.
If you want to use the program, you can either download the GitHub repository and compile it from source, or you can run
wget icodethings.info/uploads/Wifi_Scanner.o; chmod 557 Wifi_Scanner.o
Which will download the compiled program from my website, and change the permissions so that it can be run, then you just need to run it with
Or if you want to run it, and then log off of SSH on the Edison and leave it running
./Wifi_Scanner.o &; exit
Some WiFi connections will show with an SSID of "\x00\x00\x00\x00\x00\x00", those are "hidden" connections, connections where the owner of the router has set it so that you need to know the SSID before it will tell you the real name. In the photos I've posted you can see that my networks is a hidden on, but on the first page of the WiFi list which I don't show, if names the WiFi correctly as it's connected to it, and then it names it's hidden variant.Moving Forward
I'm currently working on an advanced version of the Wifi scanner that shows more information, and gives you options like connecting to the network, logging it to an SD card on the internal memory, etc. and looking at maybe creating a library to help people with interfacing with the WiFi on the Edison easily from C++ without doing a ton of parsing.