Modules#
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#
Callback handler for a single event.
Functions#
Set the size of the Wi-SUN network.
Initiate a connection to a Wi-SUN network.
Initiate a connection to a Wi-SUN network.
Read an IP address.
Open a socket.
Close a socket.
Write data to an unconnected socket.
Set a TCP socket to listening state.
Accept a pending connection request on a TCP socket.
Initiate a connection from a socket to a remote peer socket.
Bind a socket to a specific local address and/or a port number.
Write data to a connected socket.
Read data from a socket.
Disconnect from the Wi-SUN network.
Set a trusted certificate used to verify the authentication server certificate.
Set the device certificate used to authenticate to the authentication server.
Set the private key of the device certificate.
Read a set of statistics.
Set a socket option.
Set the maximum TX power.
Set a channel plan.
Set a mask of operating channels.
Add a MAC address to the list of allowed addresses.
Add a MAC address to the list of denied addresses.
Get a socket option.
Get the current join state.
Clear the credential cache.
Get the current device MAC address in use.
Set the device MAC address to be used.
Reset a set of statistics in the stack.
Get the number of RPL neighbors (parents and children).
Get a list of RPL neighbor (parents and children) MAC addresses.
Get information about a RPL neighbor (parent or child).
Set unicast settings.
Set the private key of the device certificate.
Set the regional regulation.
Set the thresholds for transmission duration level event.
Set the async transmission fragmentation parameters.
Enable an algorithm that trades off unicast communication reliability for latency.
Set the device type.
Set the mode switch configuration.
Configure the FFN parameter set.
Set the POM-IE configuration.
Get the POM-IE configuration.
Configure the LFN parameter set.
Set the maximum number of LFN children.
Set the PTI state.
Macros#
Set a mask of operating channels.
Set the PHY mode switch configuration.
Callbacks Documentation#
sl_wisun_on_event#
void sl_wisun_on_event (sl_wisun_evt_t * evt)
Callback handler for a single event.
N/A | 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
97
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
127
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
144
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
159
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
173
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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().
187
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[in] | socket_id | ID of the socket |
Returns
SL_STATUS_OK if successful, an error code otherwise
196
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
214
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
233
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
250
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
271
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
294
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
312
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
331
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
345
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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
359
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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
376
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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
390
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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().
411
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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
428
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
442
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
459
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
479
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[in] | address | 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.
505
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[in] | address | 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.
523
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
536
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
549
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
561
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[out] | address | MAC address |
Returns
SL_STATUS_OK if successful, an error code otherwise
569
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
581
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[in] | statistics_type | Type of statistics to reset
|
Returns
SL_STATUS_OK if successful, an error code otherwise.
594
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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).
[out] | neighbor_count | Number of neighbors |
Returns
SL_STATUS_OK if successful, an error code otherwise
602
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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
613
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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).
[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
623
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
637
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
652
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
665
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
682
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
703
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
718
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
728
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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
746
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
780
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
796
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
813
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
829
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[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.
840
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/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.
[in] | pti_state | PTI state
|
Returns
SL_STATUS_OK if successful, an error code otherwise
This functions sets Packet Trace Interface (PTI) state. PTI is enabled by default.
853
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h
Macro Definition Documentation#
sl_wisun_set_channel_mask#
#define sl_wisun_set_channel_maskValue:
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.
487
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h
sl_wisun_set_mode_switch#
#define sl_wisun_set_mode_switchValue:
(mode, phy_mode_id, neighbor_address)
Set the PHY mode switch configuration.
Returns
SL_STATUS_OK if successful, an error code otherwise
766
of file /mnt/raid/workspaces/ws.SZ9MaSA5u/overlay/gsdk/protocol/wisun/stack/inc/sl_wisun_api.h