Hardware Reference
In-Depth Information
This function takes no parameters and returns an int —the number of wire-
less networks detected. A scan can take a few seconds to complete, but when
done, the results are stored on the wireless chip, ready for interrogation. The
chip stores several pieces of information: the SSID name, the signal strength,
and the encryption type.
To retrieve the SSID of a network, use SSID() :
result = WiFi.SSID(num);
It takes one parameter: the number of a network scanned with the scanNet-
works() function. It returns a String : the name of the SSID.
To know the RSSI of a station broadcasting, use RSSI() specifying the net-
work number:
result = WiFi.RSSI(num);
Exactly like RSSI() used to learn the RSSI of the current network, this function
returns a long , the value in dBm, short for Decibel-milliwatts. Typical values
range from −80 to 0; the higher the number, the better the reception.
Wireless networks also broadcast their security, specii cally the encryption
method required to connect (if any). To know the encryption of a network, use
encryptionType() , specifying the network number:
result = WiFi.encryptionType(num);
This function returns a constant: the type of encryption detected. Table 10-2
lists the values.
Table 10-2: Possible Encryption Types
VALUE
MEANING
ENC_TYPE_WEP
WEP encryption
ENC_TYPE_TKIP
WPA encryption
ENC_TYPE_CCMP
WPA2 encryption
ENC_TYPE_NONE
No encryption, open network
ENC_TYPE_AUTO
Multiple encryption methods possible
Connecting and Confi guring
To connect to a wireless network, use begin() , explained previously in the
“Initialization” section. To disconnect from a network, use disconnect() :
WiFi.disconnect();
 
Search WWH ::




Custom Search