Modules#

Wi-SUN API events

Wi-SUN API type definitions

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.

Callbacks#

void
sl_wisun_on_event(sl_wisun_evt_t *evt)

Callback handler for a single event.

Functions#

sl_status_t
sl_wisun_set_network_size(sl_wisun_network_size_t size) SL_DEPRECATED_API_SDK_4_2

Set the size of the Wi-SUN network.

sl_status_t
sl_wisun_connect(const uint8_t *name, sl_wisun_regulatory_domain_t reg_domain, sl_wisun_operating_class_t op_class, sl_wisun_operating_mode_t op_mode) SL_DEPRECATED_API_SDK_4_2

Initiate a connection to a Wi-SUN network.

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_get_ip_address(sl_wisun_ip_address_type_t address_type, sl_wisun_ip_address_t *address)

Read an IP address.

sl_status_t
sl_wisun_open_socket(sl_wisun_socket_protocol_t protocol, sl_wisun_socket_id_t *socket_id)

Open a socket.

sl_status_t
sl_wisun_close_socket(sl_wisun_socket_id_t socket_id)

Close a socket.

sl_status_t
sl_wisun_sendto_on_socket(sl_wisun_socket_id_t socket_id, const sl_wisun_ip_address_t *remote_address, uint16_t remote_port, uint16_t data_length, const uint8_t *data)

Write data to an unconnected socket.

sl_status_t
sl_wisun_listen_on_socket(sl_wisun_socket_id_t socket_id)

Set a TCP socket to listening state.

sl_status_t
sl_wisun_accept_on_socket(sl_wisun_socket_id_t socket_id, sl_wisun_socket_id_t *remote_socket_id, sl_wisun_ip_address_t *remote_address, uint16_t *remote_port)

Accept a pending connection request on a TCP socket.

sl_status_t
sl_wisun_connect_socket(sl_wisun_socket_id_t socket_id, const sl_wisun_ip_address_t *remote_address, uint16_t remote_port)

Initiate a connection from a socket to a remote peer socket.

sl_status_t
sl_wisun_bind_socket(sl_wisun_socket_id_t socket_id, const sl_wisun_ip_address_t *local_address, uint16_t local_port)

Bind a socket to a specific local address and/or a port number.

sl_status_t
sl_wisun_send_on_socket(sl_wisun_socket_id_t socket_id, uint16_t data_length, const uint8_t *data)

Write data to a connected socket.

sl_status_t
sl_wisun_receive_on_socket(sl_wisun_socket_id_t socket_id, sl_wisun_ip_address_t *remote_address, uint16_t *remote_port, uint16_t *data_length, uint8_t *data)

Read data from a socket.

sl_status_t

Disconnect from the Wi-SUN network.

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_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
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_set_socket_option(sl_wisun_socket_id_t socket_id, sl_wisun_socket_option_t option, const sl_wisun_socket_option_data_t *option_data)

Set a socket option.

sl_status_t
sl_wisun_set_tx_power(int8_t tx_power)

Set the maximum TX power.

sl_status_t
sl_wisun_set_channel_plan(uint32_t ch0_frequency, uint16_t number_of_channels, sl_wisun_channel_spacing_t channel_spacing) SL_DEPRECATED_API_SDK_4_2

Set a channel plan.

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_allow_mac_address(const sl_wisun_mac_address_t *address)

Add a MAC address to the list of allowed addresses.

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
sl_wisun_get_socket_option(sl_wisun_socket_id_t socket_id, sl_wisun_socket_option_t option, sl_wisun_socket_option_data_t *option_data)

Get a socket option.

sl_status_t
sl_wisun_get_join_state(sl_wisun_join_state_t *join_state)

Get the current join state.

sl_status_t

Clear the credential cache.

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_set_mac_address(const sl_wisun_mac_address_t *address)

Set the device MAC address to be used.

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_get_neighbor_count(uint8_t *neighbor_count)

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

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_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_set_unicast_settings(uint8_t dwell_interval_ms)

Set unicast settings.

sl_status_t

Set the private key of the device certificate.

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_advert_fragment_duration(uint32_t fragment_duration_ms)

Set the async transmission fragmentation parameters.

sl_status_t

Enable an algorithm that trades off unicast communication reliability for latency.

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_mode_switch(uint8_t mode, uint8_t phy_mode_id, const sl_wisun_mac_address_t *neighbor_address)

Set the mode switch configuration.

sl_status_t
sl_wisun_set_connection_parameters(const sl_wisun_connection_params_t *params)

Configure connection parameter set.

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

Macros#

#define
sl_wisun_set_channel_mask sl_wisun_set_allowed_channel_mask

Set a mask of operating channels.

Callbacks Documentation#

sl_wisun_on_event#

void sl_wisun_on_event (sl_wisun_evt_t * evt)

Callback handler for a single event.

Parameters
N/Aevt

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 96 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

Function Documentation#

sl_wisun_set_network_size#

sl_status_t sl_wisun_set_network_size (sl_wisun_network_size_t size)

Set the size of the Wi-SUN network.

Parameters
[in]size

Size of the network

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the size of the network. The value adjusts internal behavior, such as timing parameters, to optimize device behavior in regard to the network size. The device will function with any setting but may exhibit non-optimal behavior. Setting the size too large may cause slow connection speeds and increased latency. Conversely, a value too small may cause increased network traffic. When configuring the stack for Wi-SUN FAN certification, SL_WISUN_NETWORK_SIZE_CERTIFICATION setting should be used. SL_WISUN_NETWORK_SIZE_TEST is intended for development time use, providing faster initial connectivity over network performance.

DeprecatedThis function will be removed in the future versions of the Wi-SUN stack. See sl_wisun_set_connection_parameters() for a replacement.


Definition at line 126 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_connect#

sl_status_t sl_wisun_connect (const uint8_t * name, sl_wisun_regulatory_domain_t reg_domain, sl_wisun_operating_class_t op_class, sl_wisun_operating_mode_t op_mode)

Initiate a connection to a Wi-SUN network.

Parameters
[in]name

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

[in]reg_domain

Regulatory domain of the Wi-SUN network

[in]op_class

Operating class of the Wi-SUN network

[in]op_mode

Operating mode of the Wi-SUN network

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.

DeprecatedThis function will be removed in the future versions of the Wi-SUN stack. See sl_wisun_join() for a replacement.


Definition at line 143 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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.


Definition at line 158 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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, sl_wisun_ip_address_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.


Definition at line 172 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_open_socket#

sl_status_t sl_wisun_open_socket (sl_wisun_socket_protocol_t protocol, sl_wisun_socket_id_t * socket_id)

Open a socket.

Parameters
[in]protocol

Protocol type of the socket

[out]socket_id

ID of the opened socket

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function opens a socket. Up to 10 sockets may be open at any given time, including those opened implicitly via sl_wisun_accept_on_socket().


Definition at line 186 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_close_socket#

sl_status_t sl_wisun_close_socket (sl_wisun_socket_id_t socket_id)

Close a socket.

Parameters
[in]socket_id

ID of the socket

Returns

  • SL_STATUS_OK if successful, an error code otherwise


Definition at line 195 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_sendto_on_socket#

sl_status_t sl_wisun_sendto_on_socket (sl_wisun_socket_id_t socket_id, const sl_wisun_ip_address_t * remote_address, uint16_t remote_port, uint16_t data_length, const uint8_t * data)

Write data to an unconnected socket.

Parameters
[in]socket_id

ID of the socket

[in]remote_address

IP address of the remote peer

[in]remote_port

Port number of the remote peer

[in]data_length

Amount of data to write

[in]data

Pointer to the data

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function initiates a data transmission to a remote peer and can only be used on an unconnected UDP or ICMP socket. Completion of the transmission is indicated with a SL_WISUN_MSG_SOCKET_DATA_SENT_IND_ID event. The function takes a copy of the data, so the caller may free the resource when the function returns.


Definition at line 213 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_listen_on_socket#

sl_status_t sl_wisun_listen_on_socket (sl_wisun_socket_id_t socket_id)

Set a TCP socket to listening state.

Parameters
[in]socket_id

ID of the socket

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets a TCP socket to listening state, allowing it to act as a server socket, i.e., to receive connection requests from clients. Connection requests are indicated with SL_WISUN_MSG_SOCKET_CONNECTION_AVAILABLE_IND_ID events and accepted using sl_wisun_accept_on_socket(). This function can only be used on an unconnected TCP socket.


Definition at line 232 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_accept_on_socket#

sl_status_t sl_wisun_accept_on_socket (sl_wisun_socket_id_t socket_id, sl_wisun_socket_id_t * remote_socket_id, sl_wisun_ip_address_t * remote_address, uint16_t * remote_port)

Accept a pending connection request on a TCP socket.

Parameters
[in]socket_id

ID of the socket on listening state

[out]remote_socket_id

ID of the new connected socket

[out]remote_address

IP address of the remote peer

[out]remote_port

Port number of the remote peer

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function accepts a pending connection request from a remote peer and creates a new connected TCP socket for the connection. To decline a connection request, the request must be accepted and then closed using sl_wisun_close_socket(). The function can only be used on a TCP socket in listening state.


Definition at line 249 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_connect_socket#

sl_status_t sl_wisun_connect_socket (sl_wisun_socket_id_t socket_id, const sl_wisun_ip_address_t * remote_address, uint16_t remote_port)

Initiate a connection from a socket to a remote peer socket.

Parameters
[in]socket_id

ID of the socket

[in]remote_address

IP address of the remote peer

[in]remote_port

Port number of the remote peer

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function initiates a connection from a local socket to to a remote peer socket. The result of the connection is indicated with a SL_WISUN_MSG_SOCKET_CONNECTED_IND_ID event. Connecting a socket is mandatory for TCP client sockets but may be also used on other types of sockets. A connected socket can only receive and transmit data with the designated peer. This function can only be used on an unconnected TCP or UDP socket.


Definition at line 270 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_bind_socket#

sl_status_t sl_wisun_bind_socket (sl_wisun_socket_id_t socket_id, const sl_wisun_ip_address_t * local_address, uint16_t local_port)

Bind a socket to a specific local address and/or a port number.

Parameters
[in]socket_id

ID of the socket

[in]local_address

Local IP address to use on the socket. NULL if not bound.

[in]local_port

Local port number to use on the socket. Zero if not bound.

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function binds the local address and/or the port of a socket. When the local address is bound, the socket will only accept traffic sent to the specified address and the transmitted packets will use the address as the source address. If not bound, the socket will accept data sent to any valid address of the device. The source address is selected by the stack. Binding the local port number sets the port number for received and transmitted packets. If not bound, the stack will select a port number automatically. This function can only be used on an unconnected TCP or UDP socket. Once bound to a specific address and/or port, the value cannot be changed.


Definition at line 293 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_send_on_socket#

sl_status_t sl_wisun_send_on_socket (sl_wisun_socket_id_t socket_id, uint16_t data_length, const uint8_t * data)

Write data to a connected socket.

Parameters
[in]socket_id

ID of the socket

[in]data_length

Amount of data to write

[in]data

Pointer to the data

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function initiates transmission of data to a connected remote peer and can only be used on a connected socket. Completion of the transmission is indicated with a SL_WISUN_MSG_SOCKET_DATA_SENT_IND_ID event. The function takes a copy of the data, so the caller may free the resource when the function returns.


Definition at line 311 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_receive_on_socket#

sl_status_t sl_wisun_receive_on_socket (sl_wisun_socket_id_t socket_id, sl_wisun_ip_address_t * remote_address, uint16_t * remote_port, uint16_t * data_length, uint8_t * data)

Read data from a socket.

Parameters
[in]socket_id

ID of the socket

[out]remote_address

IP address of the remote peer

[out]remote_port

Port number of the remote peer

[inout]data_length

Amount of data to read on input, amount of data read on output

[in]data

Pointer to where the read data is stored

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function reads buffered data from a socket. When reading data from a UDP or ICMP socket, the entire packet must be read. Any data left unread is discarded after this call. TCP sockets allow reading only a part of the buffered data.


Definition at line 330 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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.


Definition at line 344 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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


Definition at line 358 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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


Definition at line 375 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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


Definition at line 389 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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().


Definition at line 410 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_socket_option#

sl_status_t sl_wisun_set_socket_option (sl_wisun_socket_id_t socket_id, sl_wisun_socket_option_t option, const sl_wisun_socket_option_data_t * option_data)

Set a socket option.

Parameters
[in]socket_id

ID of the socket

[in]option

Socket option to set

[in]option_data

Socket option specific data

Returns

  • SL_STATUS_OK if successful, an error code otherwise


Definition at line 424 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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.


Definition at line 438 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_channel_plan#

sl_status_t sl_wisun_set_channel_plan (uint32_t ch0_frequency, uint16_t number_of_channels, sl_wisun_channel_spacing_t channel_spacing)

Set a channel plan.

Parameters
[in]ch0_frequency

Frequency of the first channel in kHz

[in]number_of_channels

Number of channels

[in]channel_spacing

Spacing between the channels

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets an application-specific channel plan for use in the following connections. By default, the channel plan is set indirectly based on the regulatory domain and the operating class given in sl_wisun_connect().

DeprecatedThis function will be removed in the future versions of the Wi-SUN stack. See sl_wisun_join() for a replacement.


Definition at line 455 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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.


Definition at line 475 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

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.


Definition at line 501 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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.


Definition at line 519 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_get_socket_option#

sl_status_t sl_wisun_get_socket_option (sl_wisun_socket_id_t socket_id, sl_wisun_socket_option_t option, sl_wisun_socket_option_data_t * option_data)

Get a socket option.

Parameters
[in]socket_id

ID of the socket

[in]option

Socket option to get

[out]option_data

Socket option specific data

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function retrieves the value of a socket option.


Definition at line 532 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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.


Definition at line 545 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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.


Definition at line 557 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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


Definition at line 565 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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.


Definition at line 577 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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.


Definition at line 590 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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


Definition at line 598 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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


Definition at line 609 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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


Definition at line 619 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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.


Definition at line 633 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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.


Definition at line 648 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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.


Definition at line 661 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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.


Definition at line 678 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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 500ms.


Definition at line 699 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

sl_wisun_set_unicast_tx_mode#

sl_status_t sl_wisun_set_unicast_tx_mode (uint8_t mode)

Enable an algorithm that trades off unicast communication reliability for latency.

Parameters
[in]mode

Transmission mode to use

Returns

  • SL_STATUS_OK if successful, an error code otherwise

Enable an algorithm that trades off unicast communication reliability for latency. The mechanism is only effective when all the neighbors are enabled. Enabling this option is detrimental when used with unaware Wi-SUN devices.


Definition at line 714 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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.


Definition at line 724 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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 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 behaviour.

[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 behaviour for all non-configured neighbors.

Returns

  • SL_STATUS_OK if successful, an error code otherwise


Definition at line 741 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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 connection parameter set.

Parameters
[in]params

Parameters set to use

Returns

  • SL_STATUS_OK if successful, an error code otherwise

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


Definition at line 756 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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.


Definition at line 772 of file /mnt/raid/workspaces/ws.0wy4DfJrj/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 provide at least SL_WISUN_MAX_PHY_MODE_ID_COUNT bytes.

[out]is_mdr_command_capable

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

Returns

  • SL_STATUS_OK if successful, an error code otherwise

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


Definition at line 788 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h

Macro Definition Documentation#

sl_wisun_set_channel_mask#

#define sl_wisun_set_channel_mask
Value:
sl_wisun_set_allowed_channel_mask

Set a mask of operating channels.

This macro provides backwards compatibility to an older version of a renamed function.


Definition at line 483 of file /mnt/raid/workspaces/ws.0wy4DfJrj/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h