HF Interface Wrapper 0.1.0-dev
Embedded C++ hardware abstraction layer
Loading...
Searching...
No Matches
BaseWifi.h File Reference

Unified WiFi base class for all WiFi implementations. More...

#include "HardwareTypes.h"
#include <cstdint>
#include <functional>
#include <string>
#include <string_view>
Include dependency graph for BaseWifi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  hf_wifi_network_info_t
 WiFi network information structure. More...
 
struct  hf_wifi_station_config_t
 WiFi station configuration structure. More...
 
struct  hf_wifi_ap_config_t
 WiFi Access Point configuration structure. More...
 
struct  hf_wifi_ip_info_t
 WiFi IP configuration structure. More...
 
class  BaseWifi
 Abstract base class for WiFi functionality. More...
 

Macros

#define HF_WIFI_ERR_LIST(X)
 HardFOC WiFi error codes macro list.
 
#define X(name, value, desc)   name = value,
 Generate WiFi error enumeration using X-macro pattern.
 
#define X(NAME, VALUE, DESC)
 Generate WiFi error enumeration using X-macro pattern.
 
#define X(name, value, desc)
 Generate WiFi error enumeration using X-macro pattern.
 

Typedefs

using hf_wifi_event_callback_t = std::function<void(hf_wifi_event_t event, void* event_data)>
 WiFi event callback function type.
 
using hf_wifi_scan_callback_t
 WiFi scan callback function type.
 

Enumerations

enum class  hf_wifi_err_t : hf_u8_t {
  WIFI_SUCCESS = 0 , WIFI_ERR_FAILURE = 1 , WIFI_ERR_INVALID_PARAM = 2 , WIFI_ERR_NOT_INITIALIZED = 3 ,
  WIFI_ERR_ALREADY_INITIALIZED = 4 , WIFI_ERR_NOT_CONNECTED = 5 , WIFI_ERR_ALREADY_CONNECTED = 6 , WIFI_ERR_CONNECTION_FAILED = 7 ,
  WIFI_ERR_DISCONNECTION_FAILED = 8 , WIFI_ERR_SCAN_FAILED = 9 , WIFI_ERR_AP_START_FAILED = 10 , WIFI_ERR_AP_STOP_FAILED = 11 ,
  WIFI_ERR_TIMEOUT = 12 , WIFI_ERR_NO_MEMORY = 13 , WIFI_ERR_INVALID_SSID = 14 , WIFI_ERR_INVALID_PASSWORD = 15 ,
  WIFI_ERR_WEAK_SIGNAL = 16 , WIFI_ERR_AUTHENTICATION_FAILED = 17 , WIFI_ERR_ASSOCIATION_FAILED = 18 , WIFI_ERR_HANDSHAKE_FAILED = 19 ,
  WIFI_ERR_INIT_FAILED = 20 , WIFI_ERR_CONFIG_INVALID = 21 , WIFI_ERR_ENTERPRISE_FAILED = 22 , WIFI_ERR_WPA3_NOT_SUPPORTED = 23 ,
  WIFI_ERR_MESH_FAILED = 24 , WIFI_ERR_UNKNOWN = 25
}
 
enum class  hf_wifi_mode_t : hf_u8_t { hf_wifi_mode_t::HF_WIFI_MODE_STATION = 0 , hf_wifi_mode_t::HF_WIFI_MODE_ACCESS_POINT = 1 , hf_wifi_mode_t::HF_WIFI_MODE_STATION_AP = 2 , hf_wifi_mode_t::HF_WIFI_MODE_DISABLED = 3 }
 WiFi operating modes. More...
 
enum class  hf_wifi_security_t : hf_u8_t {
  hf_wifi_security_t::HF_WIFI_SECURITY_OPEN = 0 , hf_wifi_security_t::HF_WIFI_SECURITY_WEP = 1 , hf_wifi_security_t::HF_WIFI_SECURITY_WPA_PSK = 2 , hf_wifi_security_t::HF_WIFI_SECURITY_WPA2_PSK = 3 ,
  hf_wifi_security_t::HF_WIFI_SECURITY_WPA_WPA2_PSK = 4 , hf_wifi_security_t::HF_WIFI_SECURITY_WPA2_ENTERPRISE = 5 , hf_wifi_security_t::HF_WIFI_SECURITY_WPA3_PSK = 6 , hf_wifi_security_t::HF_WIFI_SECURITY_WPA2_WPA3_PSK = 7 ,
  hf_wifi_security_t::HF_WIFI_SECURITY_WPA3_ENTERPRISE = 8 , hf_wifi_security_t::HF_WIFI_SECURITY_WAPI_PSK = 9
}
 WiFi security types. More...
 
enum class  hf_wifi_state_t : hf_u8_t {
  hf_wifi_state_t::HF_WIFI_STATE_DISCONNECTED = 0 , hf_wifi_state_t::HF_WIFI_STATE_CONNECTING = 1 , hf_wifi_state_t::HF_WIFI_STATE_CONNECTED = 2 , hf_wifi_state_t::HF_WIFI_STATE_DISCONNECTING = 3 ,
  hf_wifi_state_t::HF_WIFI_STATE_RECONNECTING = 4 , hf_wifi_state_t::HF_WIFI_STATE_AP_STARTED = 5 , hf_wifi_state_t::HF_WIFI_STATE_AP_STOPPED = 6 , hf_wifi_state_t::HF_WIFI_STATE_SCANNING = 7
}
 WiFi connection states. More...
 
enum class  hf_wifi_power_save_t : hf_u8_t { hf_wifi_power_save_t::HF_WIFI_POWER_SAVE_NONE = 0 , hf_wifi_power_save_t::HF_WIFI_POWER_SAVE_MIN_MODEM = 1 , hf_wifi_power_save_t::HF_WIFI_POWER_SAVE_MAX_MODEM = 2 }
 WiFi power save modes. More...
 
enum class  hf_wifi_event_t : hf_u8_t {
  hf_wifi_event_t::HF_WIFI_EVENT_STA_START = 0 , hf_wifi_event_t::HF_WIFI_EVENT_STA_STOP = 1 , hf_wifi_event_t::HF_WIFI_EVENT_STA_CONNECTED = 2 , hf_wifi_event_t::HF_WIFI_EVENT_STA_DISCONNECTED = 3 ,
  hf_wifi_event_t::HF_WIFI_EVENT_STA_AUTHMODE_CHANGE = 4 , hf_wifi_event_t::HF_WIFI_EVENT_STA_GOT_IP = 5 , hf_wifi_event_t::HF_WIFI_EVENT_STA_LOST_IP = 6 , hf_wifi_event_t::HF_WIFI_EVENT_AP_START = 7 ,
  hf_wifi_event_t::HF_WIFI_EVENT_AP_STOP = 8 , hf_wifi_event_t::HF_WIFI_EVENT_AP_STACONNECTED = 9 , hf_wifi_event_t::HF_WIFI_EVENT_AP_STADISCONNECTED = 10 , hf_wifi_event_t::HF_WIFI_EVENT_SCAN_DONE = 11
}
 WiFi event types for callback functions. More...
 

Functions

constexpr std::string_view HfWifiErrToString (hf_wifi_err_t err) noexcept
 Convert hf_wifi_err_t to human-readable string.
 

Detailed Description

Unified WiFi base class for all WiFi implementations.

This file contains the declaration of the BaseWifi abstract class, which provides a comprehensive WiFi abstraction that serves as the base for all WiFi implementations in the HardFOC system. It supports station and access point modes, security configurations, connection management, and works across different hardware platforms including ESP32, and other WiFi-capable MCUs.

Author
Nebiyu Tadesse
Date
2025
Note
This class is not thread-safe. Use appropriate synchronization if accessed from multiple contexts.

Enumeration Type Documentation

◆ hf_wifi_err_t

enum class hf_wifi_err_t : hf_u8_t
strong
Enumerator
WIFI_SUCCESS 
WIFI_ERR_FAILURE 
WIFI_ERR_INVALID_PARAM 
WIFI_ERR_NOT_INITIALIZED 
WIFI_ERR_ALREADY_INITIALIZED 
WIFI_ERR_NOT_CONNECTED 
WIFI_ERR_ALREADY_CONNECTED 
WIFI_ERR_CONNECTION_FAILED 
WIFI_ERR_DISCONNECTION_FAILED 
WIFI_ERR_SCAN_FAILED 
WIFI_ERR_AP_START_FAILED 
WIFI_ERR_AP_STOP_FAILED 
WIFI_ERR_TIMEOUT 
WIFI_ERR_NO_MEMORY 
WIFI_ERR_INVALID_SSID 
WIFI_ERR_INVALID_PASSWORD 
WIFI_ERR_WEAK_SIGNAL 
WIFI_ERR_AUTHENTICATION_FAILED 
WIFI_ERR_ASSOCIATION_FAILED 
WIFI_ERR_HANDSHAKE_FAILED 
WIFI_ERR_INIT_FAILED 
WIFI_ERR_CONFIG_INVALID 
WIFI_ERR_ENTERPRISE_FAILED 
WIFI_ERR_WPA3_NOT_SUPPORTED 
WIFI_ERR_MESH_FAILED 
WIFI_ERR_UNKNOWN