
The SCAN command enables a BASIC program to search for WLANs in the neighbourhood. SCAN requires two arguments. The first one is the scan mode, which can be 0 or -1. For a normal scan, the scan mode must be 0. If -1 is given, SCAN throws away it's previous result buffer. The second argument is the time (in milliseconds) that SCAN stays on each channel while listening for beacons. If the first argument is -1 (free previous buffer), the second argument can be any value.
On success SCAN sets the LASTERR status variable to ERR_OK(0). LASTERR becomes ERR_FIL_EXHAUSTED(26) if a result buffer couldn't be allocated. If a previous result buffer is still pending, LASTERR is set to ERR_REJECTED(12).
This example starts a scan, wait until finished and then prints out the result.
outmode -2 ' Start a scan with 300ms per channel scan 0, 300 ' Busy wait until scan finished while scanned < 0 sleep 100 print "."; wend ' Store number of found WLAN nets and print it let a = scanned print "found wlans: "; ' Loop thru all records and print them let s$ = " for s = 1 to a getscan s$ print s$ next
A New SCAN can only be started, if the last result buffer was completely read or thrown away by calling SCAN with the first argument set to -1. See also GETSCAN.
SCAN : Search for WLAN networks
SCANNED : Returns number of found WLAN networks
GETSCAN : Read results from scan command
STATUS(-4]) : Returns status of WLAN connection