5.6.2. network_interface_wifi — WiFi network interface

WiFi network interface driver modules:


Source code: src/inet/network_interface/wifi.h, src/inet/network_interface/wifi.c

Test code: tst/inet/network_interface/wifi_esp/main.c


Functions

int network_interface_wifi_module_init(void)

Initialize the WiFi network interface module.

Return
zero(0) or negative error code.

int network_interface_wifi_init(struct network_interface_wifi_t *self_p, const char *name_p, struct network_interface_wifi_driver_t *driver_p, void *arg_p, const char *ssid_p, const char *password_p)

Initialize given WiFi network interface with given configuration.

Return
zero(0) or negative error code.
Parameters
  • self_p: The WiFi network interface to initialize.
  • name_p: Name to assign the to interface.
  • driver_p: Driver virtualization callbacks to use.
  • arg_p: Argument passed to the driver callbacks.
  • ssid_p: Access Point SSID.
  • password_p: Access Point password.

int network_interface_wifi_start(struct network_interface_wifi_t *self_p)

Start given WiFi network interface.

Return
zero(0) or negative error code.
Parameters
  • self_p: WiFi network interface to start.

int network_interface_wifi_stop(struct network_interface_wifi_t *self_p)

Stop given WiFi network interface.

Return
zero(0) or negative error code.
Parameters
  • self_p: WiFi network interface to stop.

int network_interface_wifi_is_up(struct network_interface_wifi_t *self_p)

Get the connection status of given network interface.

Return
true(1) if the network interface is up, false(0) is it is down, and otherwise negative error code.
Parameters
  • self_p: Network interface to get the connection status of.

int network_interface_wifi_set_ip_info(struct network_interface_wifi_t *self_p, const struct inet_if_ip_info_t *info_p)

Set the ip address, netmask and gateway of given network interface.

Return
zero(0) if the interface has valid IP information, otherwise negative error code.
Parameters
  • self_p: Network interface.
  • info_p: Interface IP information to set.

int network_interface_wifi_get_ip_info(struct network_interface_wifi_t *self_p, struct inet_if_ip_info_t *info_p)

Get the ip address, netmask and gateway of given network interface.

Return
zero(0) if the interface has valid IP information, otherwise negative error code.
Parameters
  • self_p: Network interface.
  • info_p: Interface IP information. Only valid if this function returns zero(0).

struct network_interface_wifi_t
#include <wifi.h>

Public Members

struct network_interface_t network_interface
struct network_interface_wifi_driver_t *driver_p
void *arg_p
const char *ssid_p
const char *password_p
const struct inet_if_ip_info_t *info_p
struct network_interface_wifi_driver_t
#include <wifi.h>

Driver virtualization callbacks. See the driver/ subfolder for available drivers.

Public Members

int (*init)(void *arg_p)
int (*start)(void *arg_p, const char *ssid_p, const char *password_p, const struct inet_if_ip_info_t *info_p)
int (*stop)(void *arg_p)
int (*is_up)(void *arg_p)
int (*set_ip_info)(void *arg_p, const struct inet_if_ip_info_t *info_p)
int (*get_ip_info)(void *arg_p, struct inet_if_ip_info_t *info_p)