Wi-Fi SoftAP 接口

[English]

公共头文件: #include "brookesia/hal_interface/interfaces/wifi/softap.hpp"

类名: WifiSoftApIface

WifiSoftApIface 定义 SoftAP 参数访问、SoftAP 启停、 配网启停,以及 SoftAP 事件和配网页面请求 显式 Station 动作的回调。

API 参考

Header File

Classes

class SoftApIface : public esp_brookesia::hal::Interface

Wi-Fi SoftAP interface for AP mode and provisioning.

Public Functions

inline SoftApIface()

Construct a SoftAP Wi-Fi interface.

virtual ~SoftApIface() = default

Virtual destructor for polymorphic interfaces.

virtual bool configure(Callbacks callbacks) = 0

Configure SoftAP callbacks.

参数

callbacks -- [in] Callback hooks used to report SoftAP state and requests.

返回

true on success; otherwise false.

virtual void clear_callbacks() = 0

Clear all configured callbacks.

virtual bool set_params(const SoftApParams &params) = 0

Set SoftAP runtime parameters.

参数

params -- [in] SoftAP parameters.

返回

true on success; otherwise false.

virtual const SoftApParams &get_params() const = 0

Get SoftAP runtime parameters.

返回

SoftAP parameters.

virtual bool start() = 0

Start SoftAP mode.

返回

true on success; otherwise false.

virtual void stop() = 0

Stop SoftAP mode.

virtual bool start_provision() = 0

Start SoftAP provisioning.

返回

true on success; otherwise false.

virtual bool stop_provision() = 0

Stop SoftAP provisioning.

返回

true on success; otherwise false.

Public Static Attributes

static constexpr const char *NAME = "WifiSoftAp"

Interface registry name.

struct Callbacks

Public Members

std::function<void(SoftApEvent)> on_event

Called when a SoftAP event happens.

std::function<void(const SoftApParams&)> on_params_updated

Persist backend-updated params.

std::function<bool(StationAction)> on_station_action_requested

Called when SoftAP needs station action.