I am currently writing a program to dump all configuration data from any Particle device using WiFi.getCredentials
. When I run the code on a Photon, I get the correct wireless SSID, security type and cipher type.
When I run the same code on an Argon or Xenon, I get the correct SSID but the security type shows “open” and the cipher shows “not set”.
I did the obligatory doc search but didn’t find anything related. Does anyone know of any differences? Here is the code:
byte bssid[6],
mac[6];
WiFiAccessPoint ap[5];
int found = WiFi.getCredentials(ap, 5);
Serial.printf("WiFi Scan:\n\n");
// WIFI MAC
WiFi.macAddress(mac);
Serial.print("MAC: ");
Serial.printlnf("%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
// Local IP
Serial.print("Local IP: ");
Serial.println(WiFi.localIP());
// BSSID
WiFi.BSSID(bssid);
Serial.print("BSSID: ");
Serial.printlnf("%02X:%02X:%02X:%02X:%02X:%02X", bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]);
// Print all known wireless networks
for (int i = 0; i < found; i++)
{
Serial.printf("Network: %d\n", i);
Serial.print(" SSID: ");
Serial.println(ap[i].ssid);
// Security type
Serial.print(" Security: ");
switch (ap[i].security)
{
case WLAN_SEC_UNSEC:
Serial.println("Open");
break;
case WLAN_SEC_WEP:
Serial.println("WEP");
break;
case WLAN_SEC_WPA:
Serial.println("WPA");
break;
case WLAN_SEC_WPA2:
Serial.println("WPA2");
break;
#if Wiring_WpaEnterprise == 1
case WLAN_SEC_WPA_ENTERPRISE:
Serial.println("WPA Enterprise");
break;
case WLAN_SEC_WPA2_ENTERPRISE:
Serial.println("WPA2 Enterprise");
break;
#endif
default:
Serial.println("Unknown");
break;
}
// Cipher type
Serial.print(" Cipher: ");
switch (ap[i].cipher)
{
case WLAN_CIPHER_NOT_SET:
Serial.println("Not set");
break;
case WLAN_CIPHER_AES:
Serial.println("AES");
break;
case WLAN_CIPHER_TKIP:
Serial.println("TKIP");
break;
case WLAN_CIPHER_AES_TKIP:
Serial.println("AES-TKIP");
break;
default:
Serial.println("Unknown");
break;
}
}