Wi-Fi ready

The Wi-Fi ready library manages Wi-Fi® readiness for applications by handling supplicant ready and not ready events.

Overview

The Wi-Fi ready library informs applications of Wi-Fi readiness by managing supplicant events, indicating when Wi-Fi is available for use.

Configuration

To use this library, enable the CONFIG_WIFI_READY_LIB Kconfig option.

API documentation

Header file: include/net/wifi_ready.h
Source files: subsys/net/lib/wifi_ready
group wifi_ready

Library for handling Wi-Fi ready events.

Functions

int register_wifi_ready_callback(wifi_ready_callback_t cb, struct net_if *iface)

Register a callback to be called when the Wi-Fi is ready.

Parameters:
  • cb – Callback function to be called when the Wi-Fi is ready. The callback is called from NET_MGMT thread, so, care should be taken to avoid blocking the thread and also stack size should be considered.

  • iface – (optional) Interface to which the callback is registered.

Return values:
  • -EINVAL – if the callback is NULL.

  • -ENOMEM – if the callback array is full.

  • -EALREADY – if the callback is already registered.

Returns:

0 if the callback was successfully registered, or a negative error code if the callback could not be registered.

int unregister_wifi_ready_callback(wifi_ready_callback_t cb, struct net_if *iface)

Unregister a callback that was registered to be called when the Wi-Fi is ready.

Parameters:
  • cb – Callback function to be unregistered.

  • iface – (optional) Interface to which the callback is registered.

Return values:
  • -EINVAL – if the callback is NULL.

  • -ENOENT – if the callback is not registered.

Returns:

0 if the callback was successfully unregistered, or a negative error code if the callback could not be unregistered.

struct wifi_ready_callback_t
#include <wifi_ready.h>

Structure for storing a callback function to be called when the Wi-Fi is ready.

Public Members

void (*wifi_ready_cb)(bool wifi_ready)

Callback function to be called when the Wi-Fi is ready.

struct net_if *iface

Interface to which the callback is registered.

struct k_work item

Only for internal use.