libxr 1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
esp_wifi_client.hpp
1#pragma once
2
3#include "esp_event.h"
4#include "esp_netif.h"
5#include "esp_wifi.h"
6#include "wifi_client.hpp"
7
8namespace LibXR
9{
10
12{
13 public:
15 ~ESP32WifiClient() override;
16
17 WifiError Enable() override;
18 WifiError Disable() override;
19 WifiError Connect(const Config& config) override;
20 WifiError Disconnect() override;
21 bool IsConnected() const override;
22 const char* GetIPAddress() const override;
23 WifiError Scan(std::vector<ScanResult>& results) override;
24 int GetRSSI() const override;
25
26 private:
27 static void EventHandler(void* arg, esp_event_base_t event_base, int32_t event_id,
28 void* event_data);
29
30 static inline bool is_initialized_ = false;
31 static inline esp_netif_t* netif_ = nullptr;
32
33 bool enabled_ = false;
34 bool connected_ = false;
35 bool got_ip_ = false;
36 char ip_str_[IP4ADDR_STRLEN_MAX] = {};
37
38 LibXR::Semaphore semaphore_;
39};
40
41} // namespace LibXR
WifiError Connect(const Config &config) override
连接到 WiFi 网络 / Connect to a WiFi network
WifiError Disable() override
禁用 WiFi 模块 / Disable the WiFi module
int GetRSSI() const override
获取当前 WiFi 信号强度 / Get the current WiFi signal strength
WifiError Disconnect() override
断开当前 WiFi 连接 / Disconnect from the current WiFi connection
bool IsConnected() const override
检查是否已连接 / Check if currently connected
WifiError Scan(std::vector< ScanResult > &results) override
扫描可用 WiFi 网络 / Scan for available WiFi networks
const char * GetIPAddress() const override
获取当前 IP 地址 / Get the current IP address
WifiError Enable() override
启用 WiFi 模块 / Enable the WiFi module
信号量类,实现线程同步机制 Semaphore class implementing thread synchronization
Definition semaphore.hpp:23
Wifi 客户端接口类 / Interface class for WiFi client management.
WifiError
WiFi 错误码枚举 / Enumeration of WiFi error codes.
LibXR Color Control Library / LibXR终端颜色控制库
Definition esp_gpio.hpp:8
WiFi 连接配置 / WiFi connection configuration.