Modules#

Application Core type definitions

Utilities

Application Core#

The Application Core component aims at providing utilities common to most Wi-SUN applications. Following this objective, the component offers the following features:

  • A Wi-SUN connection helper function app_wisun_network_connect(). This function configures the network size setting, the TX output power, the certificates, and keys. The last function action is to start the catual Wi-SUN connection process.

  • An event handler and callback mechanisms. It provides a thread-safe abstraction layer on the Wi-SUN stack events reported in sl_wisun_on_event(). Two APIs (app_wisun_register_custom_callback() and app_wisun_remove_custom_callback()) are exposed to the application to add or remove custom callbacks associated with stack events.

  • A ping capability through the app_wisun_ping() function. It can be used to test communications and latencies in a Wi-SUN network.

  • A Socket FIFO overflow handler. The application can redefine the weakly implemented app_wisun_socket_fifo_overflow_handler() function to handle the socket FIFO overflow events.

  • A graphical interface in Simplicity Studio to configure the network name, TX power, and network size to be used during the connection process.

To use the component in your application, add it to your project and initialize it with app_wisun_core_init().

Functions#

void

Initialize Wi-SUN application core.

void

Connect to the Wi-SUN network.

void

Disconnect from the Wi-SUN network.

void
app_wisun_register_custom_callback(const sl_wisun_msg_ind_id_t id, custom_wisun_event_callback_t custom_callback)

Register custom callback.

void
app_wisun_remove_custom_callback(const sl_wisun_msg_ind_id_t id)

Remove custom callback.

bool
app_wisun_ping(wisun_addr_t *const remote_addr)

Ping remote address.

void
app_wisun_socket_fifo_overflow_handler(const int32_t socketid, const uint8_t *remaining_buffer, const uint32_t remaining_size)

Wi-SUN socket FiFO overflow handler.

const char *
app_wisun_get_ip_address_str(const void *const value)

Get the IP address.

Function Documentation#

app_wisun_core_init#

void app_wisun_core_init (void )

Initialize Wi-SUN application core.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Init mutex, init socket handler and set Wi-SUN setting


app_wisun_network_connect#

void app_wisun_network_connect (void )

Connect to the Wi-SUN network.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Network init and connecting.


app_wisun_network_disconnect#

void app_wisun_network_disconnect (void )

Disconnect from the Wi-SUN network.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Call Wi-SUN disconnect API.


app_wisun_register_custom_callback#

void app_wisun_register_custom_callback (const sl_wisun_msg_ind_id_t id, custom_wisun_event_callback_t custom_callback)

Register custom callback.

Parameters
TypeDirectionArgument NameDescription
const sl_wisun_msg_ind_id_t[in]id

sl_wisun_msg_ind_id_t message ID from the stack

custom_wisun_event_callback_t[in]custom_callback

callback to regist

Set the custom callback ptr.


app_wisun_remove_custom_callback#

void app_wisun_remove_custom_callback (const sl_wisun_msg_ind_id_t id)

Remove custom callback.

Parameters
TypeDirectionArgument NameDescription
const sl_wisun_msg_ind_id_t[in]id

sl_wisun_msg_ind_id_t message id from stack

set the custom callback ptr


app_wisun_get_connection_state#

wisun_network_connection_state_t app_wisun_get_connection_state (void )

Get the connection state.

Parameters
TypeDirectionArgument NameDescription
voidN/A

set the custom callback ptr to NULL Returns

  • wisun_network_connection_state_t Connection state


app_wisun_ping#

bool app_wisun_ping (wisun_addr_t *const remote_addr)

Ping remote address.

Parameters
TypeDirectionArgument NameDescription
wisun_addr_t *const[in]remote_addr

Remote byte address

Send ICMP packets to the remote and receive the response. Returns

  • true if ping was successful

  • false error


app_wisun_socket_fifo_overflow_handler#

void app_wisun_socket_fifo_overflow_handler (const int32_t socketid, const uint8_t * remaining_buffer, const uint32_t remaining_size)

Wi-SUN socket FiFO overflow handler.

Parameters
TypeDirectionArgument NameDescription
const int32_t[in]socketid

socket ID

const uint8_t *[in]remaining_buffer

remaining buffer ptr

const uint32_t[in]remaining_size

remeaing size of buffer

Weak implementation, which can be overridden. Users can create custom backup process to store remaining data.


app_wisun_get_ip_address_str#

const char* app_wisun_get_ip_address_str (const void *const value)

Get the IP address.

Parameters
TypeDirectionArgument NameDescription
const void *const[in]value

IP address raw byte values.

Uses the internal circular buffer. Returns

  • const char* converted string ptr