當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Arduino WiFi - WiFi.encryptionType()用法及代碼示例

說明

獲取當前網絡的加密類型

用法

WiFi.encryptionType();
WiFi.encryptionType(wifiAccessPoint);

參數

wifiAccessPoint:指定從哪個網絡獲取信息

返回

byte: value 代表加密的類型

TKIP (WPA) = 2 WEP = 5 CCMP (WPA) = 4 無 = 7 自動 = 8

示例

#include <SPI.h>
#include <WiFi.h>

//SSID of your network
char ssid[] = "yourNetwork";
//password of your WPA Network
char pass[] = "secretPassword";

void setup()
{
 WiFi.begin(ssid, pass);

  if ( status != WL_CONNECTED) {
    Serial.println("Couldn't get a wifi connection");
    while(true);
  }
  // if you are connected, print out info about the connection:
  else {
   // print the encryption type:
  byte encryption = WiFi.encryptionType();
  Serial.print("Encryption Type:");
  Serial.println(encryption,HEX);
  }
}

void loop () {}

相關用法


注:本文由純淨天空篩選整理自arduino.cc大神的英文原創作品 WiFi - WiFi.encryptionType()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。