CAF: Network state module
The network state module of the Common Application Framework (CAF) is responsible for broadcasting the events about current network state. The module provides different backends for available networks (like LTE or OpenThread).
Configuration
To enable the network state module, set the CONFIG_CAF_NET_STATE Kconfig option in the configuration.
The module selects the backend based on the link layer enabled.
Log information about connection waiting
The CONFIG_CAF_LOG_NET_STATE_WAITING Kconfig option enables periodic message logging, while the module is waiting for network connection.
To configure the period between logs, use the CONFIG_CAF_LOG_NET_STATE_WAITING_PERIOD option.
Implementation details
The module generates the net_state_event.
The event reports the current network state using net_state.
The following network states are available:
NET_STATE_DISABLED- Network interface is disabled.NET_STATE_DISCONNECTED- Network interface is ready to connect but waiting for connection.NET_STATE_CONNECTED- Network interface is connected.
NET_STATE_CONNECTED means that IP packets can be transmitted.
For example, in a Thread network, this means not only that the connection to the mesh network is established, but also that the Border Router is working and it is possible to transfer data.