Sunday 22 December 2019

a WifiScanner written in Gambas Script

I've been looking for a suitable application to write using Gambas Script, as a means of demonstrating its possibilities.


10 years ago I created a Gambas GUI app called WifiScanner which fits the bill.


So I've just stripped it down and created a script version.

My WifiScanner displays details about local wifi access points. This information is useful when deciding which wifi channels to use for your wifi routers. Ideally you want to select a channel that is not already in use by your closest neighbours.

But this needs to be more than a one-off check from wherever you happen to be sitting using your laptop. You really need to check all locations that rely on wifi. And if you happen to have a bird box system 30m away, at the end of your garden, you need to check that location as well.

Gambas script scripter Geany wifi Linux programming

So my new Gambas Script version of the scanner displays AP name, Quality and the Channel used.

the code


Having set Geany up with suitable config files that include keywords and colours, I started coding with the Main routine and a few declarations.

Gambas script scripter Geany wifi Linux programming

As you can see, Sub Main just implements a timer and starts it running.

The timer routine calls GetWifiInterface()...

Gambas script scripter Geany wifi Linux programming

...which in turn uses 'iwconfig' to get details of the interface.

Gambas script scripter Geany wifi Linux programming

The function GetESSIDs uses 'iwlist' to collect and filter all data on the local access points.


Gambas script scripter Geany wifi Linux programming


And that's all there is to it.

If you want to download this file, go to Gambas One: https://forum.gambas.one/viewtopic.php?f=13&t=797



No comments:

Post a Comment