WiFi.encryptionType()
描述
取得無線網路的加密方法。
語法
WiFi.encryptionType();
WiFi.encryptionType(wifiAccessPoint);
參數
wifiAccessPoint:指定要取得資訊的無線網路
回傳
byte:不同的值代表不同的加密方法,詳見下述
– TKIP (WPA) = 2
– WEP = 5
– CCMP (WPA) = 4
– NONE = 7
– AUTO = 8
範例
#include <WiFi.h>
// 無線網路的 SSID
char ssid[] = "yourNetwork";
// WPA 的密碼
char pass[] = "secretPassword";
void setup()
{
WiFi.begin(ssid, pass);
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
while(true);
}
// 如果成功連上無線網路,印出相關資訊
else {
// 印出加密的方法
byte encryption = WiFi.encryptionType();
Serial.print("Encryption Type:");
Serial.println(encryption,HEX);
}
}
void loop () {}
The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.
