Modules#

regulation_thresholds

Application Core API type definitions

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() configures the network size setting, the TX output power, the certificates, and keys. The last function action is to start the Wi-SUN connection process. The app_wisun_network_is_connected() function provides a simple connection status getter too.

  • Event handlers for basic Wi-SUN network events component includes the basic event handler implementations.

  • Available addresses. Retrieve known IPv6 addresses with the app_wisun_get_current_addresses() function.

  • Error Getter. Use app_wisun_core_get_error() function to get the status of the Stack API calls.

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

#

void
app_wisun_project_info_init(const char *app_name)
void
app_wisun_project_info_print(const bool json_format)

Print Wi-SUN project information.

void

Wait for the connection.

void

Connect and wait for connection.

bool

The network is connected.

Typedefs#

typedef struct regulation_thresholds

Functions#

void

Initialize Wi-SUN application core.

bool
app_wisun_core_get_error(app_core_error_state_flag_t flag)

Get application core error.

void

Connect to the Wi-SUN network.

void
app_wisun_get_current_addresses(current_addr_t *const dest_addresses)

Get the current addresses.

void

Set the regional regulation to active or passive.

bool

Return the state of the regional regulation.

bool
app_wisun_get_remaining_tx_budget(uint32_t *const budget_out)

Get the remaining budget from the transmission quota.

void
app_wisun_set_regulation_thresholds(const int8_t warning_level, const int8_t alert_level)

Set up warning and alert thresholds for the regional regulation.

bool
app_wisun_get_regulation_thresholds(regulation_thresholds_t *thresholds_out)

Get the warning and alert levels for approaching/exceeded the TX budget.

undefined Documentation#

app_wisun_project_info_init#

void app_wisun_project_info_init (const char *app_name)
Parameters
[in]app_name

Application name

Initialize Wi-SUN project information.

Init internal instance


Definition at line 90 of file /mnt/raid/workspaces/ws.fy2OGuDyK/overlay/super/app/wisun/component/app_core/sl_wisun_app_core_util.h

app_wisun_project_info_print#

void app_wisun_project_info_print (const bool json_format)

Print Wi-SUN project information.

Parameters
[in]json_format

Json format required indicator

Print project info in pretty or json format.


Definition at line 97 of file /mnt/raid/workspaces/ws.fy2OGuDyK/overlay/super/app/wisun/component/app_core/sl_wisun_app_core_util.h

app_wisun_wait_for_connection#

void app_wisun_wait_for_connection (void)

Wait for the connection.

Parameters
N/A

This function doesn't call the app_wisun_network_connect() function. The function provides a delay loop with optional heart beat printing till the connection state has not been changed.


Definition at line 105 of file /mnt/raid/workspaces/ws.fy2OGuDyK/overlay/super/app/wisun/component/app_core/sl_wisun_app_core_util.h

app_wisun_connect_and_wait#

void app_wisun_connect_and_wait (void)

Connect and wait for connection.

Parameters
N/A

The function calls app_wisun_network_connect() function and app_wisun_wait_for_connection() function. It can be useful at the beginning of application thread.


Definition at line 113 of file /mnt/raid/workspaces/ws.fy2OGuDyK/overlay/super/app/wisun/component/app_core/sl_wisun_app_core_util.h

app_wisun_network_is_connected#

bool app_wisun_network_is_connected (void)

The network is connected.

Parameters
N/A

Wrapper function of join state getter Returns

  • true Connected

  • false Not connected


Definition at line 121 of file /mnt/raid/workspaces/ws.fy2OGuDyK/overlay/super/app/wisun/component/app_core/sl_wisun_app_core_util.h

Typedef Documentation#

Function Documentation#

app_wisun_core_init#

void app_wisun_core_init (void)

Initialize Wi-SUN application core.

Parameters
N/A

Initializing mutex, socket handler and set Wi-SUN settings.


Definition at line 122 of file /mnt/raid/workspaces/ws.fy2OGuDyK/overlay/super/app/wisun/component/app_core/sl_wisun_app_core.h

app_wisun_core_get_error#

bool app_wisun_core_get_error (app_core_error_state_flag_t flag)

Get application core error.

Parameters
[in]flag

is the indicator of the error

The function retrieves the application core error status based on the flag.


Definition at line 130 of file /mnt/raid/workspaces/ws.fy2OGuDyK/overlay/super/app/wisun/component/app_core/sl_wisun_app_core.h

app_wisun_network_connect#

void app_wisun_network_connect (void)

Connect to the Wi-SUN network.

Parameters
N/A

Network initialization and connection. The function initializes the network with parameters (Network name, TX Power, Network size, etc.) by the stored settings in NVM if the settings component is added to the project, otherwise with the default settings.


Definition at line 141 of file /mnt/raid/workspaces/ws.fy2OGuDyK/overlay/super/app/wisun/component/app_core/sl_wisun_app_core.h

app_wisun_get_current_addresses#

void app_wisun_get_current_addresses (current_addr_t *const dest_addresses)

Get the current addresses.

Parameters
[out]dest_addresses

Destination

Copy cached addresses into destination.


Definition at line 148 of file /mnt/raid/workspaces/ws.fy2OGuDyK/overlay/super/app/wisun/component/app_core/sl_wisun_app_core.h

app_wisun_set_regulation_active#

void app_wisun_set_regulation_active (bool enabled)

Set the regional regulation to active or passive.

Parameters
[in]enabled

(true = active, false = not active)

After a stack API call for regional regulation, this function can be used to store the status of the regulation (active or not). Returns

  • None


Definition at line 157 of file /mnt/raid/workspaces/ws.fy2OGuDyK/overlay/super/app/wisun/component/app_core/sl_wisun_app_core.h

app_wisun_get_regulation_active#

bool app_wisun_get_regulation_active (void)

Return the state of the regional regulation.

Parameters
[in]

This function tells the caller if a regulation is currently active. Returns

  • Boolean indicating if a regional regulation is currently active.


Definition at line 165 of file /mnt/raid/workspaces/ws.fy2OGuDyK/overlay/super/app/wisun/component/app_core/sl_wisun_app_core.h

app_wisun_get_remaining_tx_budget#

bool app_wisun_get_remaining_tx_budget (uint32_t *const budget_out)

Get the remaining budget from the transmission quota.

Parameters
[out]budget_out

pointer to return the remaining budget to.

Returns the state of the regional regulation and the remaining budget in ms if applicable, or zero budget if exceeded or not regulated. Returns

  • Boolean to indicate if the returned value reflects a usable value.


Definition at line 174 of file /mnt/raid/workspaces/ws.fy2OGuDyK/overlay/super/app/wisun/component/app_core/sl_wisun_app_core.h

app_wisun_set_regulation_thresholds#

void app_wisun_set_regulation_thresholds (const int8_t warning_level, const int8_t alert_level)

Set up warning and alert thresholds for the regional regulation.

Parameters
[in]warning_level

new percentage for the warning threshold

[in]alert_level

new percentage for the alert threshold

Sets up the percentages of warnings and alerts where the regulation indicate that the transmission quota is approached/exceeded. Returns

  • None


Definition at line 184 of file /mnt/raid/workspaces/ws.fy2OGuDyK/overlay/super/app/wisun/component/app_core/sl_wisun_app_core.h

app_wisun_get_regulation_thresholds#

bool app_wisun_get_regulation_thresholds (regulation_thresholds_t *thresholds_out)

Get the warning and alert levels for approaching/exceeded the TX budget.

Parameters
[out]thresholds_out

pointer to the struct to hold the thresholds

Values representing percentages of the allowed transmission quota in ms are returned for the warning and alert levels, respectively. Returns

  • Boolean to indicate if the operation was successful


Definition at line 193 of file /mnt/raid/workspaces/ws.fy2OGuDyK/overlay/super/app/wisun/component/app_core/sl_wisun_app_core.h