Application Core#
The Application Core component is designed to offer utilities commonly used in Wi-SUN applications with the following features:
The sl_wisun_app_core_util_connect_and_wait() function configures the network size setting, the TX output power, the certificates and keys. The function is waiting for the connected state. Its final action is to initiate the Wi-SUN connection process. The sl_wisun_app_core_network_connect() and sl_wisun_app_core_util_network_is_connected() functions also provide an easy way to establish a connection and wait for it to be ready.
Event handlers for basic Wi-SUN network events include the basic event handler implementations.
Available addresses. The sl_wisun_app_core_get_current_addresses() function retrieves known IPv6 addresses.
Status Getter. Use sl_wisun_app_core_get_state() function to get the status of the Stack API calls. The sl_wisun_app_core_get_time_stat() function retrives the connection time, disconnection time stamps and total elapsed time in those states.
Limited Function Node (LFN) device support. Use sl_wisun_app_core_get_device_type() to get the selected device type for the project. The device type can be changed in the Wi-SUN configurator interface. sl_wisun_app_core_get_lfn_profile() and sl_wisun_app_core_get_lfn_params() provide an interface to access the selected LFN profile and its parameters.
The following code snippet shows how the connection can be performed in an application thread:
#include "sl_wisun_app_core.h"
#include "sl_wisun_app_core_util.h"
/*App task function*/
void app_task(void *args)
{
(void) args;
// Connect to the wisun network.
sl_wisun_app_core_util_connect_and_wait();
while (1) {
// Put your application code here.
osDelay(1);
}
}