23. nqWiFi
The nqWiFi object is a built-in object for obtaining WiFi connection information.
Functional overview:
- Provides the function to acquire the WiFi connection information.
- Provides the function to acquire the unique information of the WiFi module.
- Provides the function to indicate the antenna level status using the system LED.
Limitations:
- Available only for the Spresense Wi-Fi configuration.
nqWiFi Global Object
Methods()/Properties | Summary | Version | Note |
---|---|---|---|
nqWiFi.getIDs() | Gets the unique information of the WiFi module. | 01.00.00+ | |
nqWiFi.getSignalQuality() | Gets the connected WiFi-AP information. | 01.00.00+ | |
nqWiFi.getScanList() | Gets nearby WiFi-AP information. | 01.00.00+ | |
nqWiFi.setAntennaLed() | Sets the antenna level indication. | 01.00.00+ | |
nqWiFi.isConnected() | Gets the Wi-Fi communication status. | 02.00.00+ |
Details
nqWiFi.getIDs(callback)
Gets the unique information of the WiFi module.
Name | Type | M/O | Summary | Note |
---|---|---|---|---|
callback(id) | function | optional | Executes callback processing when information acquisition is completed. id : {WifiID} WiFi module unique information | |
return | undefined | - | - |
{WifiID}
Name | Type | M/O | Note |
---|---|---|---|
.macAddr | string | WiFi MAC address | When not yet acquired, it becomes 00:00:00:00:00:00. |
nqWiFi.getSignalQuality(callback)
Gets the connected WiFi-AP information.
Name | Type | M/O | Summary | Note |
---|---|---|---|---|
callback(sq) | function | mandatory | Executes callback processing when information acquisition is completed. sq : {SignalQuality} Connected WiFi-AP information | |
return | undefined | - | - |
{SignalQuality}
Name | Type | Summary | Note |
---|---|---|---|
.macAddr | string | WiFi MAC address When not yet connected, it becomes 00:00:00:00:00:00. | |
.ssid | string | SSID of WiFi-AP Blank when not connected. | |
.rssi | number | Current received signal strength indicator [dBm] It is -255 when not connected. (Version 02.00.00+) It is -32768 when not connected. (Previous version) |
nqWiFi.getScanList(callback[,option])
Gets nearby WiFi-AP information.
Name | Type | M/O | Summary | Note |
---|---|---|---|---|
callback(apList) | function | mandatory | Executes callback processing when information acquisition is completed. apList : {ApList} WiFi-AP information nearby | |
option | string | optional | Option When 'stealth' is specified, stealth AP is also listed. | |
return | undefined | - | - |
{ApList}
Name | Type | Summary | Note |
---|---|---|---|
.result | boolean | Acquisition result If acquisition fails, it will be false. | |
[ ] | {ApInfo} | ({array}) of {ApInfo} Get up to 10 nearby WiFi-AP information. |
{ApInfo}
Name | Type | Summary | Note |
---|---|---|---|
.macAddr | string | WiFi MAC address | |
.ssid | string | SSID of WiFi-AP | |
.rssi | number | Received signal strength indicator [dBm] |
nqWiFi.setAntennaLed(ctl)
Sets the antenna level indication.
Use the system LED to indicate the antenna level status.
Name | Type | M/O | Summary | Note |
---|---|---|---|---|
ctl | boolean | mandatory | LED antenna level indication setting true: The LED indicates the antenna level. false: Normal operation The default value is false. For LED display patterns, please refer to System LED Indications. | |
return | undefined | - | - |
nqWiFi.isConnected()
Gets the Wi-Fi communication status.
Name | Type | M/O | Summary | Note |
---|---|---|---|---|
return | boolean | - | Wi-Fi communication status true: Available for communication false: Not available for communication |
Object Usage Examples
Sample 1
This is a sample to get and display own WiFi MAC address.
nqWiFi.getIDs(function(id){
print(id.macAddr);
});
Sample 2
This is a sample that acquires and displays the connected WiFi-AP information.
nqWiFi.getSignalQuality(function(sq){
print("MAC --> " + sq.macAddr);
print("SSID --> " + sq.ssid);
print("RSSI --> " + sq.rssi);
});
Sample 3
This is a sample that acquires and displays nearby WiFi-AP information.
nqWiFi.getScanList(function(aplist){
if (false != aplist.result) {
for(n = 0; n < aplist.length; n++) {
print("-----");
print("MAC --> " + aplist[n].macAddr);
print("SSID --> " + aplist[n].ssid);
print("RSSI --> " + aplist[n].rssi);
}
}
});
Updated: 2022-06-24