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.
