Wi-SUN Stack API#

Wi-SUN Stack API is based on requests from the application to the stack and events from the stack to the application.

Requests are made using function calls, where a function call either performs the required action immediately or initiates an internal operation within the stack, which terminates with an event. All events contain a status code, indicating the result of the requested operation. Events are also used by the stack to notify the application of any important information, such as the state of the connection.

The application is expected to override sl_wisun_on_event() to handle events from the stack. Because all events share a common header, the function may be implemented as a switch statement. The event-specific data can be accessed through the sl_wisun_evt_t::evt union.

void sl_wisun_on_event(sl_wisun_evt_t *evt)
{
  switch (evt->header.id) {
    case SL_WISUN_MSG_CONNECTED_IND_ID:
      handle_connected_event(evt->evt.connected);
      break;
    default:
      break;
  }
}

The API is thread-safe, which means can be called from multiple RTOS tasks. The stack guarantees that only a single request is executed at a time and that requests are handled in the order they were made. Event callback is executed in a different context than the request, so the API functions may be called from the event callback.

Modules#

Wi-SUN API events

Wi-SUN API type definitions

Wi-SUN API availability

Socket API

Select API

Callbacks#

void
sl_wisun_on_event(sl_wisun_evt_t *evt)

Callback handler for a single event.

Functions#

sl_status_t
sl_wisun_allow_mac_address(const sl_wisun_mac_address_t *address)

Add a MAC address to the list of allowed addresses.

sl_status_t

Clear the credential cache.

sl_status_t
sl_wisun_config_mode_switch(uint8_t mode, uint8_t phy_mode_id, const sl_wisun_mac_address_t *neighbor_address, bool reserved)

Set the mode switch configuration.

sl_status_t
sl_wisun_deny_mac_address(const sl_wisun_mac_address_t *address)

Add a MAC address to the list of denied addresses.

sl_status_t

Disconnect from the Wi-SUN network.

sl_status_t
sl_wisun_get_excluded_channel_mask(sl_wisun_channel_mask_type_t type, sl_wisun_channel_mask_t *channel_mask, uint8_t *channel_count)

Get the mask of channels excluded from channel plan.

sl_status_t
sl_wisun_get_ip_address(sl_wisun_ip_address_type_t address_type, in6_addr_t *address)

Read an IP address.

sl_status_t
sl_wisun_get_join_state(sl_wisun_join_state_t *join_state)

Get the current join state.

sl_status_t
sl_wisun_get_mac_address(sl_wisun_mac_address_t *address)

Get the current device MAC address in use.

sl_status_t
sl_wisun_get_neighbor_count(uint8_t *neighbor_count)

Get the number of RPL neighbors (parents and children).

sl_status_t
sl_wisun_get_neighbor_info(const sl_wisun_mac_address_t *neighbor_mac_address, sl_wisun_neighbor_info_t *neighbor_info)

Get information about a RPL neighbor (parent or child).

sl_status_t
sl_wisun_get_neighbors(uint8_t *neighbor_count, sl_wisun_mac_address_t *neighbor_mac_addresses)

Get a list of RPL neighbor (parents and children) MAC addresses.

sl_status_t
sl_wisun_get_network_info(sl_wisun_network_info_t *network_info)

Get Wi-SUN network information.

sl_status_t
sl_wisun_get_pom_ie(uint8_t *phy_mode_id_count, uint8_t *phy_mode_ids, uint8_t *is_mdr_command_capable)

Get the POM-IE configuration.

sl_status_t
sl_wisun_get_rpl_info(sl_wisun_rpl_info_t *rpl_info)

Get RPL information.

sl_status_t
sl_wisun_get_stack_version(uint8_t *major, uint8_t *minor, uint8_t *patch, uint16_t *build)

Get the Wi-SUN stack version.

sl_status_t
sl_wisun_get_statistics(sl_wisun_statistics_type_t statistics_type, sl_wisun_statistics_t *statistics)

Read a set of statistics.

sl_status_t
sl_wisun_join(const uint8_t *name, sl_wisun_phy_config_t *phy_config)

Initiate a connection to a Wi-SUN network.

sl_status_t
sl_wisun_reset_statistics(sl_wisun_statistics_type_t statistics_type)

Reset a set of statistics in the stack.

sl_status_t
sl_wisun_set_advert_fragment_duration(uint32_t fragment_duration_ms)

Set the async transmission fragmentation parameters.

sl_status_t
sl_wisun_set_allowed_channel_mask(const sl_wisun_channel_mask_t *channel_mask)

Set a mask of operating channels.

sl_status_t
sl_wisun_set_channel_mask(const sl_wisun_channel_mask_t *channel_mask)

Set a mask of operating channels.

sl_status_t
sl_wisun_set_connection_parameters(const sl_wisun_connection_params_t *params)

Configure the FFN parameter set.

sl_status_t
sl_wisun_set_device_certificate(uint16_t certificate_options, uint16_t certificate_length, const uint8_t *certificate)

Set the device certificate used to authenticate to the authentication server.

sl_status_t
sl_wisun_set_device_private_key(uint16_t key_options, uint16_t key_length, const uint8_t *key)

Set the private key of the device certificate.

sl_status_t

Set the private key of the device certificate.

sl_status_t
sl_wisun_set_device_type(sl_wisun_device_type_t device_type)

Set the device type.

sl_status_t
sl_wisun_set_lfn_parameters(const sl_wisun_lfn_params_t *params)

Configure the LFN parameter set.

sl_status_t
sl_wisun_set_lfn_support(uint8_t lfn_limit)

Set the maximum number of LFN children.

sl_status_t
sl_wisun_set_mac_address(const sl_wisun_mac_address_t *address)

Set the device MAC address to be used.

sl_status_t
sl_wisun_set_mode_switch(uint8_t mode, uint8_t phy_mode_id, const sl_wisun_mac_address_t *neighbor_address)

Set the PHY mode switch configuration.

sl_status_t

Set neighbor table size.

sl_status_t
sl_wisun_set_pom_ie(uint8_t phy_mode_id_count, uint8_t phy_mode_ids[SL_WISUN_MAX_PHY_MODE_ID_COUNT], uint8_t is_mdr_command_capable)

Set the POM-IE configuration.

sl_status_t
sl_wisun_set_pti_state(bool pti_state)

Set the PTI state.

sl_status_t
sl_wisun_set_regulation(sl_wisun_regulation_t regulation)

Set the regional regulation.

sl_status_t
sl_wisun_set_regulation_tx_thresholds(int8_t warning_threshold, int8_t alert_threshold)

Set the thresholds for transmission duration level event.

sl_status_t
sl_wisun_set_security_state(uint32_t security_state)

Set the connection security state.

sl_status_t
sl_wisun_set_trusted_certificate(uint16_t certificate_options, uint16_t certificate_length, const uint8_t *certificate)

Set a trusted certificate used to verify the authentication server certificate.

sl_status_t
sl_wisun_set_tx_power(int8_t tx_power) SL_DEPRECATED_API_SDK_2024_6

Set the maximum TX power.

sl_status_t
sl_wisun_set_unicast_settings(uint8_t dwell_interval_ms)

Set unicast settings.

sl_status_t
sl_wisun_trigger_frame(sl_wisun_frame_type_t frame_type)

Trigger a transmission of a periodic frame (FAN Discovery, RPL).

Callbacks Documentation#

sl_wisun_on_event#

void sl_wisun_on_event (sl_wisun_evt_t * evt)

Callback handler for a single event.

Parameters
[out]evt

The event to be handled

This function is called when the stack sends an event to the application. The application can declare its own version this function to customize event handling. The default implementation discards all events.

See Also


Definition at line 100 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

Function Documentation#

sl_wisun_allow_mac_address#

sl_status_t sl_wisun_allow_mac_address (const sl_wisun_mac_address_t * address)

Add a MAC address to the list of allowed addresses.

Parameters
[in]address

MAC address

  • sl_wisun_broadcast_mac: allow all MAC addresses

  • unicast address: allow the given MAC address

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function adds a MAC address to the list of allowed addresses. When the first address is added to the list, the list of denied addresses is cleared and the device will start preventing communication with any device whose MAC address does not match any of addresses on the list. By default, all MAC addresses are allowed. Up to 10 MAC addresses may be added to the list. The access list affects only directly connected nodes such as parents, children, and neighbors.

Note


Definition at line 295 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_clear_credential_cache#

sl_status_t sl_wisun_clear_credential_cache ()

Clear the credential cache.

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function clears the cached authentication credentials stored in non-volatile storage. The function is intended for test purposes. Note that clearing the credential cache may prevent the node from reconnecting to the same parent until the corresponding cache entry has expired on the parent.

Note


Definition at line 342 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_config_mode_switch#

sl_status_t sl_wisun_config_mode_switch (uint8_t mode, uint8_t phy_mode_id, const sl_wisun_mac_address_t * neighbor_address, bool reserved)

Set the mode switch configuration.

Parameters
[in]mode

Mode switch configuration of the neighbor. If set to SL_WISUN_MODE_SWITCH_DEFAULT, the configuration of the neighbor is reset back to the default mode switch behavior.

[in]phy_mode_id

PhyModeId to use when mode is set to SL_WISUN_MODE_SWITCH_ENABLED, ignored otherwise.

[in]neighbor_address

MAC address of the neighbor to configure. If set to sl_wisun_broadcast_mac, configures the default mode switch behavior for all non-configured neighbors.

[in]reserved

Reserved for future use, set to false.

Returns

  • SL_STATUS_OK if successful, an error code otherwise

Note


Definition at line 555 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_deny_mac_address#

sl_status_t sl_wisun_deny_mac_address (const sl_wisun_mac_address_t * address)

Add a MAC address to the list of denied addresses.

Parameters
[in]address

MAC address

  • sl_wisun_broadcast_mac: deny all MAC addresses

  • unicast address: deny the given MAC address

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function adds a MAC address to the list of denied addresses. When the first address is added to the list, the list of allowed addresses is cleared and the device will start preventing communication with any device whose MAC address matches any of the addresses on the list. By default, all MAC addresses are allowed. Up to 10 MAC addresses may be added to the list. The access list affects only directly connected nodes such as parents, children, and neighbors.

Note


Definition at line 315 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_disconnect#

sl_status_t sl_wisun_disconnect ()

Disconnect from the Wi-SUN network.

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function disconnects an active connection or cancels an ongoing connection attempt.

Note


Definition at line 147 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_get_excluded_channel_mask#

sl_status_t sl_wisun_get_excluded_channel_mask (sl_wisun_channel_mask_type_t type, sl_wisun_channel_mask_t * channel_mask, uint8_t * channel_count)

Get the mask of channels excluded from channel plan.

Parameters
[in]type

Type of channel mask to retrieve

[out]channel_mask

Pointer where channel mask is written

[out]channel_count

Number of channels in the mask

Returns

  • SL_STATUS_OK if successful, an error code otherwise

Note


Definition at line 763 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_get_ip_address#

sl_status_t sl_wisun_get_ip_address (sl_wisun_ip_address_type_t address_type, in6_addr_t * address)

Read an IP address.

Parameters
[in]address_type

Type of the IP address to read

[out]address

IP address to read

Returns

  • SL_STATUS_OK if successful, an error code otherwise.

Note


Definition at line 134 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_get_join_state#

sl_status_t sl_wisun_get_join_state (sl_wisun_join_state_t * join_state)

Get the current join state.

Parameters
[out]join_state

Join state

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function retrieves the current state of the connection process. The function can only be used once a connection has been initiated.

Note


Definition at line 328 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_get_mac_address#

sl_status_t sl_wisun_get_mac_address (sl_wisun_mac_address_t * address)

Get the current device MAC address in use.

Parameters
[out]address

MAC address

Returns

  • SL_STATUS_OK if successful, an error code otherwise

Note


Definition at line 352 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_get_neighbor_count#

sl_status_t sl_wisun_get_neighbor_count (uint8_t * neighbor_count)

Get the number of RPL neighbors (parents and children).

Parameters
[out]neighbor_count

Number of neighbors

Returns

  • SL_STATUS_OK if successful, an error code otherwise

Note


Definition at line 391 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_get_neighbor_info#

sl_status_t sl_wisun_get_neighbor_info (const sl_wisun_mac_address_t * neighbor_mac_address, sl_wisun_neighbor_info_t * neighbor_info)

Get information about a RPL neighbor (parent or child).

Parameters
[in]neighbor_mac_address

Pointer to neighbor MAC address

[out]neighbor_info

Pointer to where the read information is stored

Returns

  • SL_STATUS_OK if successful, an error code otherwise

Note


Definition at line 416 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_get_neighbors#

sl_status_t sl_wisun_get_neighbors (uint8_t * neighbor_count, sl_wisun_mac_address_t * neighbor_mac_addresses)

Get a list of RPL neighbor (parents and children) MAC addresses.

Parameters
[inout]neighbor_count

Maximum number of neighbors to read on input, number of neighbors read on output

[out]neighbor_mac_addresses

Pointer to memory where to store neighbor MAC addresses

Returns

  • SL_STATUS_OK if successful, an error code otherwise

Note


Definition at line 404 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_get_network_info#

sl_status_t sl_wisun_get_network_info (sl_wisun_network_info_t * network_info)

Get Wi-SUN network information.

Parameters
[out]network_info

Pointer where network information is written

Returns

  • SL_STATUS_OK if successful, an error code otherwise

Note


Definition at line 741 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_get_pom_ie#

sl_status_t sl_wisun_get_pom_ie (uint8_t * phy_mode_id_count, uint8_t * phy_mode_ids, uint8_t * is_mdr_command_capable)

Get the POM-IE configuration.

Parameters
[out]phy_mode_id_count

Number of PhyModeId retrieved

[out]phy_mode_ids

List of phy_mode_id_count PhyModeId. Caller must allocate space for at least SL_WISUN_MAX_PHY_MODE_ID_COUNT entries.

[out]is_mdr_command_capable

Set to 1 if the device supports MAC mode switch, 0 otherwise

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function retrieves the PHY operating mode information advertised to neighboring nodes.

Note


Definition at line 631 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_get_rpl_info#

sl_status_t sl_wisun_get_rpl_info (sl_wisun_rpl_info_t * rpl_info)

Get RPL information.

Parameters
[out]rpl_info

Pointer where RPL information is written

Returns

  • SL_STATUS_OK if successful, an error code otherwise

Note


Definition at line 751 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_get_stack_version#

sl_status_t sl_wisun_get_stack_version (uint8_t * major, uint8_t * minor, uint8_t * patch, uint16_t * build)

Get the Wi-SUN stack version.

Parameters
[out]major

Wi-SUN stack version major

[out]minor

Wi-SUN stack version minor

[out]patch

Wi-SUN stack version patch

[out]build

Build number, set to 0 in public versions

Returns

  • SL_STATUS_OK if successful, an error code otherwise

Note


Definition at line 646 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_get_statistics#

sl_status_t sl_wisun_get_statistics (sl_wisun_statistics_type_t statistics_type, sl_wisun_statistics_t * statistics)

Read a set of statistics.

Parameters
[in]statistics_type

Type of statistics to read

[out]statistics

Set of statistics read

Returns

  • SL_STATUS_OK if successful, an error code otherwise.

This function reads a set of statistics from the stack. Statistics are cumulative and reset when a connection is initiated or by calling sl_wisun_reset_statistics().

Note


Definition at line 222 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_join#

sl_status_t sl_wisun_join (const uint8_t * name, sl_wisun_phy_config_t * phy_config)

Initiate a connection to a Wi-SUN network.

Parameters
[in]name

Name of the Wi-SUN network as a zero-terminated string

[in]phy_config

Pointer to PHY configuration

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function initiates connection to a Wi-SUN network. Completion of the request is indicated with a SL_WISUN_MSG_CONNECTED_IND_ID event.

Note


Definition at line 118 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_reset_statistics#

sl_status_t sl_wisun_reset_statistics (sl_wisun_statistics_type_t statistics_type)

Reset a set of statistics in the stack.

Parameters
[in]statistics_type

Type of statistics to reset

Returns

  • SL_STATUS_OK if successful, an error code otherwise.

Note


Definition at line 381 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_advert_fragment_duration#

sl_status_t sl_wisun_set_advert_fragment_duration (uint32_t fragment_duration_ms)

Set the async transmission fragmentation parameters.

Parameters
[in]fragment_duration_ms

Max duration of a fragment in ms (min 500 ms)

Returns

  • SL_STATUS_OK if successful, an error code otherwise

Async transmissions, such as Wi-SUN PAN advertisement packets, are sent to every allowed operating channel and may therefore block broadcast and unicast traffic. This impact can be reduced by splitting the channel list into fragments based on the maximum transmission duration and by forcing a delay between the fragments, allowing other traffic to occur. This function sets the maximum duration of a PA, PAS, PC, and PCS advertisement period fragments. A small value trades off longer connection times for shorter latencies. Setting the duration to SL_WISUN_ADVERT_FRAGMENT_DISABLE disables async transmission fragmentation.

By default, the maximum fragment duration is set to 500 ms.

Note


Definition at line 522 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_allowed_channel_mask#

sl_status_t sl_wisun_set_allowed_channel_mask (const sl_wisun_channel_mask_t * channel_mask)

Set a mask of operating channels.

Parameters
[in]channel_mask

Mask of operating channels

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets a mask of channels the device is allowed to operate in for unicast frequency hopping. By default, all channels in the channel plan are allowed. The mask can only be used to further restrict the channels. Channels outside the channel plan or channels internally excluded are ignored. This mask will be used in the following connections.

Warnings

  • By comparison to the Wi-SUN FAN specification, the channel mask logic is inverted. The specification references a mask of excluded channels.

Note


Definition at line 259 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_channel_mask#

sl_status_t sl_wisun_set_channel_mask (const sl_wisun_channel_mask_t * channel_mask)

Set a mask of operating channels.

Parameters
[in]channel_mask

Mask of operating channels

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets a mask of channels the device is allowed to operate in for unicast frequency hopping. By default, all channels in the channel plan are allowed. The mask can only be used to further restrict the channels. Channels outside the channel plan or channels internally excluded are ignored. This mask will be used in the following connections.

Note


Definition at line 275 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_connection_parameters#

sl_status_t sl_wisun_set_connection_parameters (const sl_wisun_connection_params_t * params)

Configure the FFN parameter set.

Parameters
[in]params

Parameter set to use

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the FFN parameter set. These parameters impact connection time, bandwidth usage, and latency. Use of a predefined parameter set is recommended (Predefined FFN parameter sets). The function must be called before initiating a connection.

Note


Definition at line 594 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_device_certificate#

sl_status_t sl_wisun_set_device_certificate (uint16_t certificate_options, uint16_t certificate_length, const uint8_t * certificate)

Set the device certificate used to authenticate to the authentication server.

Parameters
[in]certificate_options

Options for the certificate.

[in]certificate_length

Size of the certificate data

[in]certificate

Pointer to the certificate data

Returns

  • SL_STATUS_OK if successful, an error code otherwise

Note


Definition at line 182 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_device_private_key#

sl_status_t sl_wisun_set_device_private_key (uint16_t key_options, uint16_t key_length, const uint8_t * key)

Set the private key of the device certificate.

Parameters
[in]key_options

Options for the private key

[in]key_length

Size of the private key data

[in]key

Pointer to the private key data

Returns

  • SL_STATUS_OK if successful, an error code otherwise

Note


Definition at line 198 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_device_private_key_id#

sl_status_t sl_wisun_set_device_private_key_id (uint32_t key_id)

Set the private key of the device certificate.

Parameters
[in]key_id

Key ID of the private key

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the device private key using a key identifier, referencing a key stored in PSA cryptography module. The corresponding device certificate must still be set using sl_wisun_set_device_certificate(). The stored key must have correct PSA key attributes, see the Wi-SUN FAN Security Concepts and Design Considerations document for details.

Note


Definition at line 449 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_device_type#

sl_status_t sl_wisun_set_device_type (sl_wisun_device_type_t device_type)

Set the device type.

Parameters
[in]device_type

Type of the device

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the operational mode of the node.

Note


Definition at line 535 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_lfn_parameters#

sl_status_t sl_wisun_set_lfn_parameters (const sl_wisun_lfn_params_t * params)

Configure the LFN parameter set.

Parameters
[in]params

Parameter set to use

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the LFN parameter set. These parameters impact connection time, bandwidth usage, power consumption, and latency. Use of a predefined parameter set is recommended (Predefined LFN parameter sets). The function must be called before initiating a connection.

Note


Definition at line 665 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_lfn_support#

sl_status_t sl_wisun_set_lfn_support (uint8_t lfn_limit)

Set the maximum number of LFN children.

Parameters
[in]lfn_limit

Maximum number of LFN children [0, 10]

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the maximum number of LFN children this node can parent.

Note


Definition at line 678 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_mac_address#

sl_status_t sl_wisun_set_mac_address (const sl_wisun_mac_address_t * address)

Set the device MAC address to be used.

Parameters
[in]address

MAC address

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the MAC address for use in the following connections. By default, the device will use the built-in unique device MAC address. The address is reset to the built-in value upon power up.

Note


Definition at line 366 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_mode_switch#

sl_status_t sl_wisun_set_mode_switch (uint8_t mode, uint8_t phy_mode_id, const sl_wisun_mac_address_t * neighbor_address)

Set the PHY mode switch configuration.

Parameters
[in]mode

Mode switch configuration of the neighbor. If set to SL_WISUN_MODE_SWITCH_DEFAULT, the configuration of the neighbor is reset back to the default mode switch behavior.

[in]phy_mode_id

PhyModeId to use when mode is set to SL_WISUN_MODE_SWITCH_ENABLED, ignored otherwise.

[in]neighbor_address

MAC address of the neighbor to configure. If set to sl_wisun_broadcast_mac, configures the default mode switch behavior for all non-configured neighbors.

Returns

  • SL_STATUS_OK if successful, an error code otherwise

Note


Definition at line 577 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_neighbor_table_size#

sl_status_t sl_wisun_set_neighbor_table_size (uint8_t size)

Set neighbor table size.

Parameters
[in]size

Size of the neighbor table

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the limit of regular neighbors supported by the node [1, 245], without considering temporary or RPL parents. Increasing this parameter means a higher number of potential neighbors while lowering it means reduced RAM consumption. The default value is 22.

Note


Definition at line 480 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_pom_ie#

sl_status_t sl_wisun_set_pom_ie (uint8_t phy_mode_id_count, uint8_t phy_mode_ids, uint8_t is_mdr_command_capable)

Set the POM-IE configuration.

Parameters
[in]phy_mode_id_count

Number of PhyModeId to configure

[in]phy_mode_ids

List of phy_mode_id_count PhyModeId. It must contain the base operating mode.

[in]is_mdr_command_capable

Indicate if the device supports MAC mode switch. Feature currently unsupported, must be set to 0.

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the PHY operating mode information advertised to neighboring nodes. By default the PhyModeId list contains the first fifteen PhyModeId listed in radio multi-PHY configuration, MAC mode switch is disabled.

Note


Definition at line 612 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_pti_state#

sl_status_t sl_wisun_set_pti_state (bool pti_state)

Set the PTI state.

Parameters
[in]pti_state

PTI state

  • true: PTI is enabled

  • false: PTI is disabled

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets Packet Trace Interface (PTI) state. PTI is enabled by default.

Note


Definition at line 693 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_regulation#

sl_status_t sl_wisun_set_regulation (sl_wisun_regulation_t regulation)

Set the regional regulation.

Parameters
[in]regulation

Regional regulation

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the regional regulation for use in the following connections. The selected regional regulation will impact both the Wi-SUN stack performance and its behavior. See regulation standards for details. No regulation is set by default.

Note


Definition at line 464 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_regulation_tx_thresholds#

sl_status_t sl_wisun_set_regulation_tx_thresholds (int8_t warning_threshold, int8_t alert_threshold)

Set the thresholds for transmission duration level event.

Parameters
[in]warning_threshold

Warning threshold in percent or -1 to disable

[in]alert_threshold

Alert threshold in percent or -1 to disable

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the thresholds for transmission duration level event. When set and when a regional regulation is enabled using sl_wisun_set_regulation(), a SL_WISUN_MSG_REGULATION_TX_LEVEL_IND_ID event is sent when one of the configured thresholds is exceeded. This can be used by the application to prevent exceeding the total transmission duration allowed in the regional regulation. Thresholds are defined as a percentage of the maximum transmission duration permitted by the regional regulation.

Note


Definition at line 499 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_security_state#

sl_status_t sl_wisun_set_security_state (uint32_t security_state)

Set the connection security state.

Parameters
[in]security_state

Connection security state

  • 0: Authentication and link encryption are disabled

  • 1: Authentication and link encryption are enabled

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the connection security state. By default, authentication and link encryption are enabled. The function is intended for test purposes.

Note

  • Authentication and link encryption can only be disabled when the application is linked against a library supporting this option.

  • Available in libraries: Full, FFN, LFN (see Wi-SUN API availability)


Definition at line 731 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_trusted_certificate#

sl_status_t sl_wisun_set_trusted_certificate (uint16_t certificate_options, uint16_t certificate_length, const uint8_t * certificate)

Set a trusted certificate used to verify the authentication server certificate.

Parameters
[in]certificate_options

Options for the certificate

[in]certificate_length

Size of the certificate data

[in]certificate

Pointer to the certificate data

Returns

  • SL_STATUS_OK if successful, an error code otherwise

Note


Definition at line 163 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_tx_power#

sl_status_t sl_wisun_set_tx_power (int8_t tx_power)

Set the maximum TX power.

Parameters
[in]tx_power

TX power in dBm

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the maximum TX power. The device may use a lower value based on internal decision making or hardware limitations but will never exceed the given value. The function must be called before initiating a connection.

Note

DeprecatedThis function will be removed in the future versions of the Wi-SUN stack, use sl_wisun_set_tx_power_ddbm() instead.


Definition at line 240 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_unicast_settings#

sl_status_t sl_wisun_set_unicast_settings (uint8_t dwell_interval_ms)

Set unicast settings.

Parameters
[in]dwell_interval_ms

Unicast Dwell Interval (15-255 ms)

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the parameters for unicast channel hopping to be used in the following connections. The Unicast Dwell Interval specifies the duration which the node will listen to a channel within its listening schedule. The default value is 255 ms.

Note


Definition at line 432 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_trigger_frame#

sl_status_t sl_wisun_trigger_frame (sl_wisun_frame_type_t frame_type)

Trigger a transmission of a periodic frame (FAN Discovery, RPL).

Parameters
[in]frame_type

Type of frame to transmit

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function causes a periodic frame (FAN Discovery, RPL) to be transmitted immediately. The frame can only be transmitted in the appropriate connection state, i.e. the associated trickle timer must be running. The function is intended for test purposes.

Note


Definition at line 714 of file /mnt/raid/workspaces/ws.z1SfSYxIV/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h