Wi-Fi Basic Interface

[中文]

Public header: #include "brookesia/hal_interface/interfaces/wifi/basic.hpp"

Class: WifiBasicIface

WifiBasicIface exposes the shared Wi-Fi control plane: initialization, deinitialization, start/stop actions, reset, and general action/event callbacks. Connection policy remains above HAL in the Wi-Fi service.

API Reference

Header File

Classes

class BasicIface : public esp_brookesia::hal::Interface

Basic Wi-Fi controller interface for shared lifecycle and runtime context.

Public Functions

inline BasicIface()

Construct a basic Wi-Fi interface.

virtual ~BasicIface() = default

Virtual destructor for polymorphic interfaces.

virtual bool configure(RuntimeContext runtime, Callbacks callbacks) = 0

Configure runtime resources and callbacks.

Parameters
  • runtime -- [in] Runtime context shared with the Wi-Fi backend.

  • callbacks -- [in] Callback hooks used to report basic Wi-Fi state.

Returns

true on success; otherwise false.

virtual void clear_callbacks() = 0

Clear all configured callbacks.

virtual bool init() = 0

Initialize Wi-Fi resources.

Returns

true on success; otherwise false.

virtual void deinit() = 0

Deinitialize Wi-Fi resources.

virtual bool start() = 0

Start the Wi-Fi subsystem.

Returns

true on success; otherwise false.

virtual void stop() = 0

Stop the Wi-Fi subsystem.

virtual void reset_data() = 0

Reset backend runtime data.

virtual bool do_action(BasicAction action, bool is_force = false) = 0

Request a basic Wi-Fi action.

Parameters
  • action -- [in] Action to execute.

  • is_force -- [in] Whether to force the action even if state checks would normally skip it.

Returns

true on success; otherwise false.

virtual bool is_action_running(BasicAction action) = 0

Check whether a basic Wi-Fi action is running.

Parameters

action -- [in] Action to query.

Returns

true if the action is running; otherwise false.

virtual bool is_event_ready(BasicEvent event) = 0

Check whether a basic Wi-Fi event is ready.

Parameters

event -- [in] Event to query.

Returns

true if the event is ready; otherwise false.

Public Static Attributes

static constexpr const char *NAME = "WifiBasic"

Interface registry name.

struct Callbacks

Public Members

std::function<void(BasicAction)> on_action

Called when a basic action is triggered.

std::function<void(BasicEvent, bool)> on_event

Called when a basic event happens.

std::function<void()> on_error

Called when a basic action fails.

struct RuntimeContext

Public Members

std::shared_ptr<lib_utils::TaskScheduler> task_scheduler

Scheduler used for async Wi-Fi work.

lib_utils::TaskScheduler::Group task_group

Scheduler group used by the Wi-Fi service.