libxr 1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::WifiClient Class Referenceabstract

Wifi 客户端接口类 / Interface class for WiFi client management. More...

#include <wifi_client.hpp>

Inheritance diagram for LibXR::WifiClient:

Data Structures

struct  Config
 WiFi 连接配置 / WiFi connection configuration. More...
 
struct  EnterpriseConfig
 企业 WiFi 配置 / Enterprise WiFi configuration More...
 
struct  ScanResult
 WiFi 扫描结果 / WiFi scan result. More...
 
struct  StaticIPConfig
 静态 IP 配置 / Static IP configuration More...
 

Public Types

enum class  WifiError {
  NONE , ALREADY_ENABLED , NOT_ENABLED , CONNECTION_TIMEOUT ,
  AUTHENTICATION_FAILED , DHCP_FAILED , SSID_NOT_FOUND , INVALID_CONFIG ,
  HARDWARE_FAILURE , SCAN_FAILED , UNKNOWN
}
 WiFi 错误码枚举 / Enumeration of WiFi error codes. More...
 
enum class  Security { OPEN , WPA2_PSK , WPA2_ENTERPRISE , UNKNOWN }
 WiFi 安全类型 / WiFi security types. More...
 
using WifiCallback = LibXR::Callback< WifiError >
 WiFi 状态回调 / Callback type for WiFi status.
 

Public Member Functions

virtual WifiError Enable ()=0
 启用 WiFi 模块 / Enable the WiFi module
 
virtual WifiError Disable ()=0
 禁用 WiFi 模块 / Disable the WiFi module
 
virtual WifiError Connect (const Config &config)=0
 连接到 WiFi 网络 / Connect to a WiFi network
 
virtual WifiError Disconnect ()=0
 断开当前 WiFi 连接 / Disconnect from the current WiFi connection
 
virtual bool IsConnected () const =0
 检查是否已连接 / Check if currently connected
 
virtual const charGetIPAddress () const =0
 获取当前 IP 地址 / Get the current IP address
 
virtual WifiError Scan (std::vector< ScanResult > &results)=0
 扫描可用 WiFi 网络 / Scan for available WiFi networks
 
virtual int GetRSSI () const =0
 获取当前 WiFi 信号强度 / Get the current WiFi signal strength
 

Detailed Description

Wifi 客户端接口类 / Interface class for WiFi client management.

Definition at line 15 of file wifi_client.hpp.

Member Typedef Documentation

◆ WifiCallback

WiFi 状态回调 / Callback type for WiFi status.

Definition at line 102 of file wifi_client.hpp.

Member Enumeration Documentation

◆ Security

WiFi 安全类型 / WiFi security types.

Enumerator
OPEN 

开放网络 / Open network

WPA2_PSK 

WPA2-PSK / WPA2-PSK.

WPA2_ENTERPRISE 

WPA2 企业认证 / WPA2 Enterprise.

UNKNOWN 

未知类型 / Unknown type

Definition at line 39 of file wifi_client.hpp.

40 {
41 OPEN,
42 WPA2_PSK,
44 UNKNOWN,
45 };
@ WPA2_PSK
WPA2-PSK / WPA2-PSK.
@ OPEN
开放网络 / Open network
@ WPA2_ENTERPRISE
WPA2 企业认证 / WPA2 Enterprise.
@ UNKNOWN
未知错误 / Unknown error

◆ WifiError

WiFi 错误码枚举 / Enumeration of WiFi error codes.

Enumerator
NONE 

无错误 / No error

ALREADY_ENABLED 

已启用 / Already enabled

NOT_ENABLED 

未启用 / Not enabled

CONNECTION_TIMEOUT 

连接超时 / Connection timeout

AUTHENTICATION_FAILED 

身份验证失败 / Authentication failed

DHCP_FAILED 

DHCP 获取失败 / DHCP acquisition failed.

SSID_NOT_FOUND 

找不到 SSID / SSID not found

INVALID_CONFIG 

配置无效 / Invalid configuration

HARDWARE_FAILURE 

硬件故障 / Hardware failure

SCAN_FAILED 

扫描失败 / Scan failed

UNKNOWN 

未知错误 / Unknown error

Definition at line 21 of file wifi_client.hpp.

22 {
23 NONE,
33 UNKNOWN,
34 };
@ DHCP_FAILED
DHCP 获取失败 / DHCP acquisition failed.
@ INVALID_CONFIG
配置无效 / Invalid configuration
@ AUTHENTICATION_FAILED
身份验证失败 / Authentication failed
@ HARDWARE_FAILURE
硬件故障 / Hardware failure
@ SCAN_FAILED
扫描失败 / Scan failed
@ ALREADY_ENABLED
已启用 / Already enabled
@ NOT_ENABLED
未启用 / Not enabled
@ NONE
无错误 / No error
@ CONNECTION_TIMEOUT
连接超时 / Connection timeout
@ SSID_NOT_FOUND
找不到 SSID / SSID not found

Member Function Documentation

◆ Connect()

virtual WifiError LibXR::WifiClient::Connect ( const Config config)
pure virtual

连接到 WiFi 网络 / Connect to a WiFi network

Parameters
config配置参数 / Configuration parameters

Implemented in LibXR::ESP32WifiClient.

◆ Disable()

virtual WifiError LibXR::WifiClient::Disable ( )
pure virtual

禁用 WiFi 模块 / Disable the WiFi module

Implemented in LibXR::ESP32WifiClient.

◆ Disconnect()

virtual WifiError LibXR::WifiClient::Disconnect ( )
pure virtual

断开当前 WiFi 连接 / Disconnect from the current WiFi connection

Implemented in LibXR::ESP32WifiClient.

◆ Enable()

virtual WifiError LibXR::WifiClient::Enable ( )
pure virtual

启用 WiFi 模块 / Enable the WiFi module

Implemented in LibXR::ESP32WifiClient.

◆ GetIPAddress()

virtual const char * LibXR::WifiClient::GetIPAddress ( ) const
pure virtual

获取当前 IP 地址 / Get the current IP address

Returns
IP 字符串 / IP address string

Implemented in LibXR::ESP32WifiClient.

◆ GetRSSI()

virtual int LibXR::WifiClient::GetRSSI ( ) const
pure virtual

获取当前 WiFi 信号强度 / Get the current WiFi signal strength

Returns
int

Implemented in LibXR::ESP32WifiClient.

◆ IsConnected()

virtual bool LibXR::WifiClient::IsConnected ( ) const
pure virtual

检查是否已连接 / Check if currently connected

Returns
true 表示已连接 / true if connected

Implemented in LibXR::ESP32WifiClient.

◆ Scan()

virtual WifiError LibXR::WifiClient::Scan ( std::vector< ScanResult > &  results)
pure virtual

扫描可用 WiFi 网络 / Scan for available WiFi networks

Parameters
results扫描结果列表 / Output list of scan results

Implemented in LibXR::ESP32WifiClient.


The documentation for this class was generated from the following file: