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();
}

Modules#

Type definitions

Functions#

void
app_wisun_setting_ack_notification(const app_setting_notification_t notif, const uint8_t channel)

Acknowledge notification.

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.

bool
app_wisun_setting_is_notified(const app_setting_notification_t notif, const uint8_t channel)

Is setting notified getter.

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.

sl_status_t
app_wisun_setting_subscribe_notification(const app_setting_notification_t notif, uint8_t *const channel)

Subscribe to setting notification channel.

void
app_wisun_setting_unsubscribe(const app_setting_notification_t notif, const uint8_t channel)

Unsubscribe from setting notification.

Macros#

#define

Wi-SUN settings default subscription channel.

#define
APP_SETTING_NETWORK_NAME_MAX_SIZE (SL_WISUN_NETWORK_NAME_SIZE + 1)

Wi-SUN default network name size.

Function Documentation#

app_wisun_setting_ack_notification#

void app_wisun_setting_ack_notification (const app_setting_notification_t notif, const uint8_t channel)

Acknowledge notification.

Parameters
[in]notif

ype of the notification 'app_setting_notification_t'

[in]channel

channel number, this is the output of the subscription

Delete notification channel flag


Definition at line 226 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

app_wisun_setting_get#

sl_status_t app_wisun_setting_get (app_setting_wisun_t *const wisun_setting)

Get the Wi-SUN settings.

Parameters
[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.


Definition at line 115 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

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
[out]name

pointer where the name is copied onto

[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.


Definition at line 156 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

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
[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.


Definition at line 164 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

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
[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.


Definition at line 180 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

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
[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.


Definition at line 172 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

app_wisun_setting_init#

void app_wisun_setting_init (void )

Initialize Wi-SUN setting.

Parameters
N/A

Definition at line 107 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

app_wisun_setting_init_phy_cfg#

sl_status_t app_wisun_setting_init_phy_cfg (void )

Init internal PHY settings.

Parameters
N/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.


Definition at line 189 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

app_wisun_setting_is_notified#

bool app_wisun_setting_is_notified (const app_setting_notification_t notif, const uint8_t channel)

Is setting notified getter.

Parameters
[in]notif

Type of the notification 'app_setting_notification_t'

[in]channel

channel number, this is the output of the subscription

Polling notification flag Returns

  • bool true if channel is notified by setting, otherwise false


Definition at line 208 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

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
[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.


Definition at line 123 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

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
[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.


Definition at line 131 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

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
[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.


Definition at line 147 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

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
[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.


Definition at line 139 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

app_wisun_setting_subscribe_notification#

sl_status_t app_wisun_setting_subscribe_notification (const app_setting_notification_t notif, uint8_t *const channel)

Subscribe to setting notification channel.

Parameters
[in]notif

Type of the notification 'app_setting_notification_t'

[out]channel

Provided channel number, this is the output of the subscription

Notifications are received on the channel (output) about notification type Returns

  • sl_status_t SL_STATUS_OK on success, otherwise SL_STATUS_FAIL


Definition at line 198 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

app_wisun_setting_unsubscribe#

void app_wisun_setting_unsubscribe (const app_setting_notification_t notif, const uint8_t channel)

Unsubscribe from setting notification.

Parameters
[in]notif

Type of the notification 'app_setting_notification_t'

[in]channel

channel number, this is the output of the subscription

Delete notification channel flag from subscripted channel flags


Definition at line 217 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

Macro Definition Documentation#

APP_SETTING_DEFAULT_SUBSCRIPT_CH#

#define APP_SETTING_DEFAULT_SUBSCRIPT_CH
Value:
0U

Wi-SUN settings default subscription channel.


Definition at line 58 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h

APP_SETTING_NETWORK_NAME_MAX_SIZE#

#define APP_SETTING_NETWORK_NAME_MAX_SIZE
Value:
(SL_WISUN_NETWORK_NAME_SIZE + 1)

Wi-SUN default network name size.


Definition at line 55 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/app/wisun/component/app_setting/sl_wisun_app_setting.h