mn::device::basic_wifi_net_if Class Reference

Wrapper basic WiFi class around esp-idf implementation of a esp-netif device. More...

#include <mn_basic_wifi_net_if.hpp>

+ Inheritance diagram for mn::device::basic_wifi_net_if:
+ Collaboration diagram for mn::device::basic_wifi_net_if:

Public Types

enum class  wifi_protocol : uint8_t {
  none = 0 , b = WIFI_PROTOCOL_11B , g = WIFI_PROTOCOL_11G , n = WIFI_PROTOCOL_11N ,
  bg = WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G , bgn = WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N , lr = WIFI_PROTOCOL_LR
}
 list of the wifi protocols More...
 
- Public Types inherited from mn::device::basic_net_if
using ip4_address_t = net::basic_ip4_address
 
using ip_info_t = ip_info
 

Public Member Functions

 basic_wifi_net_if (const esp_interface_t &type) noexcept
 Construt. More...
 
virtual bool create_default (void)
 Set the hostname. More...
 
esp_interface_t & get (void)
 get the type of the interface More...
 
const char * get_hostname (void)
 Get interface hostname. More...
 
wifi_mode_t get_mode (void)
 Get current operating mode of WiFi. More...
 
const char * get_ssid (char ssid[32])
 Get the ssid for the wifi. More...
 
wifi_protocol get_protocol ()
 Get the current protocol bitmap. More...
 
wifi_ps_type_t get_power_save_mode ()
 Get current WiFi power save type. More...
 
int set_power_save_mode (const wifi_ps_type_t mode)
 Set current WiFi power save type. More...
 
int set_protocol (const wifi_protocol &prot=wifi_protocol::bgn)
 Set protocol type of specified interface The default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N) More...
 
- Public Member Functions inherited from mn::device::basic_net_if
 basic_net_if ()
 
 basic_net_if (const basic_net_if &other)
 
basic_net_ifoperator= (const basic_net_if &other)
 
int set_mac (uint8_t mac[6])
 Set the mac address for the interface instance. More...
 
esp_err_t get_mac (uint8_t mac[6])
 Get the mac address for the interface instance. More...
 
const char * get_hostname ()
 Get the hostname of an interface. More...
 
bool set_hostname (const char *hostname)
 Set the hostname of an interface. More...
 
bool is_up ()
 Test if supplied interface is up. More...
 
int get_impl_name (char name[6])
 Get net interface name from network stack implementation. More...
 
int get_impl_index ()
 Get net interface index from network stack implementation. More...
 
virtual esp_netif_t * get_netif ()
 Get the Handle to esp-netif instance. More...
 
virtual esp_netif_config_t * get_config ()
 Get the config of the esp-netif instance. More...
 
int get_ip_infos (ip_info_t &ip_info)
 Get interface's IP address information. More...
 
int set_ip_infos (const ip_info_t &ip_info)
 Set interface's IP address information. More...
 
 operator bool ()
 
 operator esp_netif_t * ()
 
bool operator== (const basic_net_if &other)
 
bool operator!= (const basic_net_if &other)
 
bool operator== (const esp_netif_t *other)
 
bool operator!= (const esp_netif_t *other)
 

Protected Attributes

esp_interface_t m_ifInterface
 NET_IF intarface of the device. More...
 
- Protected Attributes inherited from mn::device::basic_net_if
esp_netif_config_t * m_ifConfig
 
esp_netif_t * m_pNetIf
 

Additional Inherited Members

- Static Public Member Functions inherited from mn::device::basic_net_if
static bool start ()
 Initialize the underlying TCP/IP stack. More...
 
static bool stop ()
 Deinitialize the esp-netif component (and the underlying TCP/IP stack) More...
 

Detailed Description

Wrapper basic WiFi class around esp-idf implementation of a esp-netif device.

Note
Class for STA and soft AP class

Member Enumeration Documentation

◆ wifi_protocol

list of the wifi protocols

Enumerator
none 

wifi protocoll .11B, use only B

wifi protocoll .11G, use only G

wifi protocoll .11N, use only N

bg 

protocoll .11BG

bgn 

protocoll .11BGN

lr 

protocol for lang range

Constructor & Destructor Documentation

◆ basic_wifi_net_if()

mn::device::basic_wifi_net_if::basic_wifi_net_if ( const esp_interface_t &  type)
noexcept

Construt.

Parameters
typeThe type of the using interface

Member Function Documentation

◆ create_default()

bool mn::device::basic_wifi_net_if::create_default ( void  )
virtual

Set the hostname.

Parameters
hostnameThe new hostname
Returns
true If set the new hostname and false if not

Implements mn::device::basic_net_if.

◆ get()

esp_interface_t & mn::device::basic_wifi_net_if::get ( void  )

get the type of the interface

Returns
reference of the type

◆ get_hostname()

const char* mn::device::basic_wifi_net_if::get_hostname ( void  )

Get interface hostname.

Returns
Returns a pointer to the hostname

◆ get_mode()

wifi_mode_t mn::device::basic_wifi_net_if::get_mode ( void  )

Get current operating mode of WiFi.

Returns
The current WiFi mode

◆ get_power_save_mode()

wifi_ps_type_t mn::device::basic_wifi_net_if::get_power_save_mode ( )

Get current WiFi power save type.

Attention
Default power save type is WIFI_PS_MIN_MODEM.
Returns
The current power save type

◆ get_protocol()

basic_wifi_net_if::wifi_protocol mn::device::basic_wifi_net_if::get_protocol ( )

Get the current protocol bitmap.

Returns
The current protocol bitmapfx or wifi_protocol::none on error

◆ get_ssid()

const char * mn::device::basic_wifi_net_if::get_ssid ( char  ssid[32])

Get the ssid for the wifi.

Parameters
[out]ssidstore the ssid this wifi
Returns
the ssid for the wifi

◆ set_power_save_mode()

int mn::device::basic_wifi_net_if::set_power_save_mode ( const wifi_ps_type_t  mode)

Set current WiFi power save type.

Attention
Default power save type is WIFI_PS_MIN_MODEM.
Parameters
modepower save type
Returns
NO_ERROR: succeed

◆ set_protocol()

int mn::device::basic_wifi_net_if::set_protocol ( const wifi_protocol prot = wifi_protocol::bgn)

Set protocol type of specified interface The default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N)

Attention
Currently we only support 802.11b or 802.11bg or 802.11bgn mode
Parameters
wifi_protocolWiFi protocol
Returns
  • NO_ERROR: succeed
  • ERR_MNTHREAD_NULL: WiFi is not initialized by esp_wifi_init
  • ERR_MNTHREAD_INVALID_ARG: invalid interface

Member Data Documentation

◆ m_ifInterface

esp_interface_t mn::device::basic_wifi_net_if::m_ifInterface
protected

NET_IF intarface of the device.


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