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
You can enable network state module by selecting the CONFIG_CAF_NET_STATE
option in the configuration.
The module selects the backend based on the link layer enabled.
Log information about connection waiting
The option CONFIG_CAF_LOG_NET_STATE_WAITING
enables periodically logging message, while the module is waiting for network connection.
The period between logs may be configured by CONFIG_CAF_LOG_NET_STATE_WAITING_PERIOD
.
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 case of 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.