libxr
1.0
Want to be the best embedded framework
|
WiFi 客户端接口 / WiFi Client Interface. More...
#include <wifi_client.hpp>
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 | ~WifiClient ()=default |
析构函数 / Destructor | |
virtual bool | Enable () override=0 |
启用网络接口(WiFi) / Enable the network interface | |
virtual void | Disable () override=0 |
禁用网络接口(WiFi) / Disable the network interface | |
virtual bool | IsConnected () const override=0 |
检查是否已连接 / Check if currently connected | |
virtual IPAddressRaw | GetIPAddress () const override=0 |
获取当前 IP 地址 / Get current IP address | |
virtual MACAddressRaw | GetMACAddress () const override=0 |
获取当前 MAC 地址 / Get MAC address | |
virtual WifiError | Connect (const Config &config)=0 |
连接到指定 WiFi 网络 / Connect to a WiFi network | |
virtual WifiError | Disconnect ()=0 |
断开当前 WiFi 连接 / Disconnect from the WiFi network | |
virtual WifiError | Scan (ScanResult *out_list, size_t max_count, size_t &out_found)=0 |
扫描可用网络 / Scan for available WiFi networks | |
virtual int | GetRSSI () const =0 |
获取当前 WiFi 信号强度(RSSI) / Get current signal strength | |
![]() |
WiFi 客户端接口 / WiFi Client Interface.
提供对 WiFi 模块的基本控制、连接管理、网络状态查询和扫描等接口, 同时继承 NetworkInterface,可统一作为网络接口使用。
Definition at line 17 of file wifi_client.hpp.
WiFi 状态回调类型 / Callback type for WiFi status.
Definition at line 122 of file wifi_client.hpp.
|
strong |
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 47 of file wifi_client.hpp.
|
strong |
WiFi 错误码 / Enumeration of WiFi error codes.
Definition at line 28 of file wifi_client.hpp.
连接到指定 WiFi 网络 / Connect to a WiFi network
[in] | config | WiFi 连接配置 / Configuration parameters |
Implemented in LibXR::ESP32WifiClient.
|
overridepure virtual |
禁用网络接口(WiFi) / Disable the network interface
Implements LibXR::NetworkInterface.
Implemented in LibXR::ESP32WifiClient.
|
pure virtual |
断开当前 WiFi 连接 / Disconnect from the WiFi network
Implemented in LibXR::ESP32WifiClient.
|
overridepure virtual |
启用网络接口(WiFi) / Enable the network interface
Implements LibXR::NetworkInterface.
Implemented in LibXR::ESP32WifiClient.
|
overridepure virtual |
获取当前 IP 地址 / Get current IP address
Implements LibXR::NetworkInterface.
Implemented in LibXR::ESP32WifiClient.
|
overridepure virtual |
获取当前 MAC 地址 / Get MAC address
Implements LibXR::NetworkInterface.
Implemented in LibXR::ESP32WifiClient.
|
pure virtual |
获取当前 WiFi 信号强度(RSSI) / Get current signal strength
Implemented in LibXR::ESP32WifiClient.
|
overridepure virtual |
检查是否已连接 / Check if currently connected
Implements LibXR::NetworkInterface.
Implemented in LibXR::ESP32WifiClient.
|
pure virtual |
扫描可用网络 / Scan for available WiFi networks
[out] | out_list | 扫描结果数组 / Output list buffer |
[in] | max_count | 最大可填入数量 / Max result count |
[out] | out_found | 实际找到数量 / Number found |
Implemented in LibXR::ESP32WifiClient.