Application Settings#

The Application Settings component provides the fundamental API for getting and setting Wi-SUN related settings within the application code. After initializing with the app_wisun_setting_init() function, the setters and getters can be used in the application to interface with runtime settings such as network name, network size, TX power, and PHY configuration.

A notification mechanism is implemented and is triggered by the appropriate settings changes.

The following code snippet demonstrates the API usage:

#include "sl_wisun_api.h"
#include "sl_wisun_app_setting.h"
#include "sl_wisun_app_core_util.h"

static void change_settings(void) {
  app_setting_wisun_t setting = { 0 };
  sl_status_t status = SL_STATUS_FAIL;

  // Disconnect before setting new values
  sl_wisun_disconnect();

  // Get all the settings
  status = app_wisun_setting_get(&setting);
  if (status != SL_STATUS_OK) {
    // Error handling
    return;
  }

  // Increasing TX power
  setting.tx_power += 10;

  status = app_wisun_setting_set_tx_power(&setting.tx_power);
  if (status != SL_STATUS_OK) {
    // Error handling
    return;
  }

  // Connect with the new settings
  sl_wisun_app_core_util_connect_and_wait();
}

Functions#

sl_status_t
app_wisun_setting_get(app_setting_wisun_t *const wisun_setting)

Get the Wi-SUN settings.

sl_status_t
app_wisun_setting_get_network_name(char *const name, uint8_t size)

Get the Wi-SUN network name.

sl_status_t

Get the Wi-SUN network size.

sl_status_t
app_wisun_setting_get_phy(sl_wisun_phy_config_t *const phy)

Get the Wi-SUN PHY.

sl_status_t
app_wisun_setting_get_tx_power(int16_t *const tx_power)

Get the Wi-SUN TX power.

void

Initialize Wi-SUN setting.

sl_status_t

Init internal PHY settings.

sl_status_t
app_wisun_setting_set_network_name(const char *const name)

Set the Wi-SUN network name.

sl_status_t
app_wisun_setting_set_network_size(const uint8_t *const size)

Set the Wi-SUN network size.

sl_status_t
app_wisun_setting_set_phy(const sl_wisun_phy_config_t *const phy)

Set the Wi-SUN PHY.

sl_status_t
app_wisun_setting_set_tx_power(const int16_t *const tx_power)

Set the Wi-SUN TX power.

Function Documentation#

app_wisun_setting_get#

sl_status_t app_wisun_setting_get (app_setting_wisun_t *const wisun_setting)

Get the Wi-SUN settings.

Parameters
TypeDirectionArgument NameDescription
app_setting_wisun_t *const[out]wisun_setting

is the obtained Wi-SUN setting

Returns

  • sl_status_t if the getting is successful it returns SL_STATUS_OK, otherwise error code.


app_wisun_setting_get_network_name#

sl_status_t app_wisun_setting_get_network_name (char *const name, uint8_t size)

Get the Wi-SUN network name.

Parameters
TypeDirectionArgument NameDescription
char *const[out]name

pointer where the name is copied onto

uint8_t[in]size

is the size of the name buffer

Returns

  • sl_status_t it is successful if it returns SL_STATUS_OK otherwise it is not.


app_wisun_setting_get_network_size#

sl_status_t app_wisun_setting_get_network_size (uint8_t *const size)

Get the Wi-SUN network size.

Parameters
TypeDirectionArgument NameDescription
uint8_t *const[out]size

pointer where the network size is copied onto

Returns

  • sl_status_t it is successful if it returns SL_STATUS_OK otherwise it is not.


app_wisun_setting_get_phy#

sl_status_t app_wisun_setting_get_phy (sl_wisun_phy_config_t *const phy)

Get the Wi-SUN PHY.

Parameters
TypeDirectionArgument NameDescription
sl_wisun_phy_config_t *const[out]phy

pointer where the PHY is copied onto

Returns

  • sl_status_t it is successful if it returns SL_STATUS_OK otherwise it is not.


app_wisun_setting_get_tx_power#

sl_status_t app_wisun_setting_get_tx_power (int16_t *const tx_power)

Get the Wi-SUN TX power.

Parameters
TypeDirectionArgument NameDescription
int16_t *const[out]tx_power

pointer where the TX power is copied onto

Returns

  • sl_status_t it is successful if it returns SL_STATUS_OK otherwise it is not.


app_wisun_setting_init#

void app_wisun_setting_init (void )

Initialize Wi-SUN setting.

Parameters
TypeDirectionArgument NameDescription
voidN/A

app_wisun_setting_init_phy_cfg#

sl_status_t app_wisun_setting_init_phy_cfg (void )

Init internal PHY settings.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Full radio config: data initialized with default HPY for appropriate board Simple PHY: get first element of PHY list by 'sl_wisun_util_get_rf_settings' Returns

  • sl_status_t it is successful if it returns SL_STATUS_OK otherwise it is not.


app_wisun_setting_set_network_name#

sl_status_t app_wisun_setting_set_network_name (const char *const name)

Set the Wi-SUN network name.

Parameters
TypeDirectionArgument NameDescription
const char *const[out]name

is the network name that will be set.

Returns

  • sl_status_t if the set is successful it returns SL_STATUS_OK, otherwise error code.


app_wisun_setting_set_network_size#

sl_status_t app_wisun_setting_set_network_size (const uint8_t *const size)

Set the Wi-SUN network size.

Parameters
TypeDirectionArgument NameDescription
const uint8_t *const[in]size

is the pointer to network size that will be set.

Returns

  • sl_status_t if the set is successful it returns SL_STATUS_OK, otherwise error code.


app_wisun_setting_set_phy#

sl_status_t app_wisun_setting_set_phy (const sl_wisun_phy_config_t *const phy)

Set the Wi-SUN PHY.

Parameters
TypeDirectionArgument NameDescription
const sl_wisun_phy_config_t *const[out]phy

is the PHY that will be set.

Returns

  • sl_status_t if the set is successful it returns SL_STATUS_OK, otherwise error code.


app_wisun_setting_set_tx_power#

sl_status_t app_wisun_setting_set_tx_power (const int16_t *const tx_power)

Set the Wi-SUN TX power.

Parameters
TypeDirectionArgument NameDescription
const int16_t *const[out]tx_power

is the pointer to TX power that will be set.

Returns

  • sl_status_t if the set is successful it returns SL_STATUS_OK, otherwise error code.