arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
WiFiZephyr Class Reference

Login to WiFi using Zephyr's wifi_mgmt / net_mgmt API. Access via the global object ZEPHYR_WIFI. More...

#include <WiFiZephyr.h>

Public Member Functions

bool begin (const char *ssid, const char *password)
 
void end ()
 
const struct in_addrip () const
 
bool isConnected ()
 
const charlocalIP ()
 
void setPowerSave (enum wifi_ps mode)
 
wifi_status_t status ()
 

Protected Member Functions

bool setupWIFI (const char *ssid, const char *password)
 

Static Protected Member Functions

static void ip_event_handler (struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface)
 
static void wifi_event_handler (struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface)
 

Protected Attributes

struct in_addr _ip = {}
 
struct net_mgmt_event_callback _ip_cb
 
volatile bool _is_open = false
 
enum wifi_ps _power_save = WIFI_PS_DISABLED
 
struct net_mgmt_event_callback _wifi_cb
 

Static Protected Attributes

static WiFiZephyr_instance = nullptr
 

Detailed Description

Login to WiFi using Zephyr's wifi_mgmt / net_mgmt API. Access via the global object ZEPHYR_WIFI.

Note
the following settings need to be active: CONFIG_NETWORKING=y CONFIG_NET_L2_WIFI_MGMT=y CONFIG_WIFI=y CONFIG_NET_DHCPV4=y
Author
Phil Schatzmann (ported to Zephyr)

Member Function Documentation

◆ begin()

bool begin ( const char ssid,
const char password 
)
inline

◆ end()

void end ( )
inline

◆ ip()

const struct in_addr & ip ( ) const
inline

Returns the assigned IPv4 address (valid after isConnected() == true).

◆ ip_event_handler()

static void ip_event_handler ( struct net_mgmt_event_callback cb,
uint64_t  mgmt_event,
struct net_if iface 
)
inlinestaticprotected

Handles NET_EVENT_IPV4_ADDR_ADD (equivalent to IP_EVENT_STA_GOT_IP).

◆ isConnected()

bool isConnected ( )
inline

◆ localIP()

const char * localIP ( )
inline

◆ setPowerSave()

void setPowerSave ( enum wifi_ps  mode)
inline

Power-save mode — maps to Zephyr's WIFI_PS_* values: WIFI_PS_DISABLED (= WIFI_PS_NONE equivalent) WIFI_PS_ENABLED

◆ setupWIFI()

bool setupWIFI ( const char ssid,
const char password 
)
inlineprotected

◆ status()

wifi_status_t status ( )
inline

◆ wifi_event_handler()

static void wifi_event_handler ( struct net_mgmt_event_callback cb,
uint64_t  mgmt_event,
struct net_if iface 
)
inlinestaticprotected

Handles WIFI_CONNECT_RESULT and WIFI_DISCONNECT_RESULT.

Member Data Documentation

◆ _instance

WiFiZephyr * _instance = nullptr
inlinestaticprotected

◆ _ip

struct in_addr _ip = {}
protected

◆ _ip_cb

struct net_mgmt_event_callback _ip_cb
protected

◆ _is_open

volatile bool _is_open = false
protected

◆ _power_save

enum wifi_ps _power_save = WIFI_PS_DISABLED
protected

◆ _wifi_cb

struct net_mgmt_event_callback _wifi_cb
protected

The documentation for this class was generated from the following file: