Message API#
Wi-SUN Message API provides a message-based API for managing and configuring the Wi-SUN protocol stack for Network Co-Processor (NCP) use-cases.
The API is functionally equivalent of Wi-SUN Stack API. It is based on requests from the host application to the NCP application running on the device, which sends the requests to the stack using sl_wisun_send_request(). Depending on the request, the required action is either performed immediately or an internal stack operation is started, terminating with an event once the operation finishes. 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 NCP application is expected to override sl_wisun_on_event() to handle events from the stack.
Modules#
sl_wisun_msg_receive_on_socket
sl_wisun_msg_socket_getsockname
sl_wisun_msg_socket_getpeername
sl_wisun_msg_set_trusted_certificate
sl_wisun_msg_set_device_certificate
sl_wisun_msg_set_device_private_key
sl_wisun_msg_set_socket_option
sl_wisun_msg_allow_mac_address
sl_wisun_msg_get_socket_option
sl_wisun_msg_clear_credential_cache
sl_wisun_msg_get_neighbor_count
sl_wisun_msg_get_neighbor_info
sl_wisun_msg_set_unicast_settings
sl_wisun_msg_set_device_private_key_id
sl_wisun_set_advert_fragment_duration
sl_wisun_msg_set_rate_algorithm
sl_wisun_msg_get_rate_algorithm_stats
sl_wisun_set_regulation_tx_thresholds
sl_wisun_msg_set_connection_params
sl_wisun_msg_get_stack_version
sl_wisun_msg_set_security_state
sl_wisun_msg_get_excluded_channel_mask
sl_wisun_msg_set_neighbor_table_size
sl_wisun_msg_config_neighbor_table_size
sl_wisun_msg_enable_neighbour_solicitations
sl_wisun_msg_trigger_neighbor_cache_refresh
sl_wisun_msg_set_tx_power_ddbm
sl_wisun_msg_clear_event_filters
sl_wisun_msg_set_direct_connect_state
sl_wisun_msg_accept_direct_connect_link
sl_wisun_msg_set_direct_connect_pmk_id
sl_wisun_msg_set_preferred_pan
sl_wisun_msg_config_concurrent_detection
sl_wisun_msg_set_regulation_params
sl_wisun_msg_reset_regulation_duty_cycle
sl_wisun_msg_set_fan_tps_version
Enumerations#
Wi-SUN Message API confirmation IDs.
Wi-SUN Message API request IDs.
Functions#
Send a request to the Wi-SUN stack.
Enumeration Documentation#
sl_wisun_msg_cnf_id_t#
sl_wisun_msg_cnf_id_t
Wi-SUN Message API confirmation IDs.
| Enumerator | |
|---|---|
| SL_WISUN_MSG_SET_NETWORK_SIZE_CNF_ID | |
| SL_WISUN_MSG_GET_IP_ADDRESS_CNF_ID | |
| SL_WISUN_MSG_OPEN_SOCKET_CNF_ID | |
| SL_WISUN_MSG_CLOSE_SOCKET_CNF_ID | |
| SL_WISUN_MSG_SENDTO_ON_SOCKET_CNF_ID | |
| SL_WISUN_MSG_LISTEN_ON_SOCKET_CNF_ID | |
| SL_WISUN_MSG_ACCEPT_ON_SOCKET_CNF_ID | |
| SL_WISUN_MSG_CONNECT_SOCKET_CNF_ID | |
| SL_WISUN_MSG_BIND_SOCKET_CNF_ID | |
| SL_WISUN_MSG_SEND_ON_SOCKET_CNF_ID | |
| SL_WISUN_MSG_RECEIVE_ON_SOCKET_CNF_ID | |
| SL_WISUN_MSG_DISCONNECT_CNF_ID | |
| SL_WISUN_MSG_SET_TRUSTED_CERTIFICATE_CNF_ID | |
| SL_WISUN_MSG_SET_DEVICE_CERTIFICATE_CNF_ID | |
| SL_WISUN_MSG_SET_DEVICE_PRIVATE_KEY_CNF_ID | |
| SL_WISUN_MSG_GET_STATISTICS_CNF_ID | |
| SL_WISUN_MSG_SET_SOCKET_OPTION_CNF_ID | |
| SL_WISUN_MSG_SET_TX_POWER_CNF_ID | |
| SL_WISUN_MSG_SET_CHANNEL_MASK_CNF_ID | |
| SL_WISUN_MSG_ALLOW_MAC_ADDRESS_CNF_ID | |
| SL_WISUN_MSG_DENY_MAC_ADDRESS_CNF_ID | |
| SL_WISUN_MSG_GET_SOCKET_OPTION_CNF_ID | |
| SL_WISUN_MSG_GET_JOIN_STATE_CNF_ID | |
| SL_WISUN_MSG_CLEAR_CREDENTIAL_CACHE_CNF_ID | |
| SL_WISUN_MSG_GET_MAC_ADDRESS_CNF_ID | |
| SL_WISUN_MSG_SET_MAC_ADDRESS_CNF_ID | |
| SL_WISUN_MSG_RESET_STATISTICS_CNF_ID | |
| SL_WISUN_MSG_GET_NEIGHBOR_COUNT_CNF_ID | |
| SL_WISUN_MSG_GET_NEIGHBORS_CNF_ID | |
| SL_WISUN_MSG_GET_NEIGHBOR_INFO_CNF_ID | |
| SL_WISUN_MSG_SET_UNICAST_SETTINGS_CNF_ID | |
| SL_WISUN_MSG_SET_TRACE_LEVEL_CNF_ID | |
| SL_WISUN_MSG_SET_TRACE_FILTER_CNF_ID | |
| SL_WISUN_MSG_SET_REGULATION_CNF_ID | |
| SL_WISUN_MSG_SET_DEVICE_PRIVATE_KEY_ID_CNF_ID | |
| SL_WISUN_MSG_SET_ASYNC_FRAGMENTATION_CNF_ID | |
| SL_WISUN_MSG_SET_MODE_SWITCH_CNF_ID | |
| SL_WISUN_MSG_SET_REGULATION_TX_THRESHOLDS_CNF_ID | |
| SL_WISUN_MSG_SET_DEVICE_TYPE_CNF_ID | |
| SL_WISUN_MSG_SET_CONNECTION_PARAMS_CNF_ID | |
| SL_WISUN_MSG_JOIN_CNF_ID | |
| SL_WISUN_MSG_SET_POM_IE_CNF_ID | |
| SL_WISUN_MSG_GET_POM_IE_CNF_ID | |
| SL_WISUN_MSG_SET_LFN_PARAMS_CNF_ID | |
| SL_WISUN_MSG_SET_LFN_SUPPORT_CNF_ID | |
| SL_WISUN_MSG_SET_PTI_STATE_CNF_ID | |
| SL_WISUN_MSG_SET_TBU_SETTINGS_CNF_ID | |
| SL_WISUN_MSG_GET_GTKS_CNF_ID | |
| SL_WISUN_MSG_TRIGGER_FRAME_CNF_ID | |
| SL_WISUN_MSG_GET_STACK_VERSION_CNF_ID | |
| SL_WISUN_MSG_SET_SECURITY_STATE_CNF_ID | |
| SL_WISUN_MSG_GET_NETWORK_INFO_CNF_ID | |
| SL_WISUN_MSG_GET_RPL_INFO_CNF_ID | |
| SL_WISUN_MSG_GET_EXCLUDED_CHANNEL_MASK_CNF_ID | |
| SL_WISUN_MSG_SET_NEIGHBOR_TABLE_SIZE_CNF_ID | |
| SL_WISUN_MSG_SOCKET_RECVMSG_CNF_ID | |
| SL_WISUN_MSG_SOCKET_SENDMSG_CNF_ID | |
| SL_WISUN_MSG_SOCKET_GETSOCKNAME_CNF_ID | |
| SL_WISUN_MSG_SOCKET_GETPEERNAME_CNF_ID | |
| SL_WISUN_MSG_ENABLE_NEIGHBOUR_SOLICITATIONS_CNF_ID | |
| SL_WISUN_MSG_TRIGGER_NEIGHBOR_CACHE_REFRESH_CNF_ID | |
| SL_WISUN_MSG_SET_RATE_ALGORITHM_CNF_ID | |
| SL_WISUN_MSG_GET_RATE_ALGORITHM_STATS_CNF_ID | |
| SL_WISUN_MSG_SET_TX_POWER_DDBM_CNF_ID | |
| SL_WISUN_MSG_SET_LEAF_CNF_ID | |
| SL_WISUN_MSG_SET_DIRECT_CONNECT_STATE_CNF_ID | |
| SL_WISUN_MSG_ACCEPT_DIRECT_CONNECT_LINK_CNF_ID | |
| SL_WISUN_MSG_SET_PHY_SENSITIVITY_CNF_ID | |
| SL_WISUN_MSG_SET_DIRECT_CONNECT_PMK_ID_CNF_ID | |
| SL_WISUN_MSG_SET_PREFERRED_PAN_CNF_ID | |
| SL_WISUN_MSG_CONFIG_NEIGHBOR_TABLE_SIZE_CNF_ID | |
| SL_WISUN_MSG_SET_LFN_TIMINGS_CNF_ID | |
| SL_WISUN_MSG_CONFIG_CONCURRENT_DETECTION_CNF_ID | |
| SL_WISUN_MSG_SET_REGULATION_PARAMS_CNF_ID | |
| SL_WISUN_MSG_RESET_REGULATION_DUTY_CYCLE_CNF_ID | |
| SL_WISUN_MSG_SET_EAP_IDENTITY_CNF_ID | |
| SL_WISUN_MSG_SET_EVENT_FILTER_CNF_ID | |
| SL_WISUN_MSG_SET_FAN_TPS_VERSION_CNF_ID | |
| SL_WISUN_MSG_SET_RX_FIFO_SIZE_CNF_ID | |
| SL_WISUN_MSG_REGISTER_ADDRESS_CNF_ID | |
| SL_WISUN_MSG_CLEAR_EVENT_FILTERS_CNF_ID | |
sl_wisun_msg_req_id_t#
sl_wisun_msg_req_id_t
Wi-SUN Message API request IDs.
| Enumerator | |
|---|---|
| SL_WISUN_MSG_SET_NETWORK_SIZE_REQ_ID | |
| SL_WISUN_MSG_GET_IP_ADDRESS_REQ_ID | |
| SL_WISUN_MSG_OPEN_SOCKET_REQ_ID | |
| SL_WISUN_MSG_CLOSE_SOCKET_REQ_ID | |
| SL_WISUN_MSG_SENDTO_ON_SOCKET_REQ_ID | |
| SL_WISUN_MSG_LISTEN_ON_SOCKET_REQ_ID | |
| SL_WISUN_MSG_ACCEPT_ON_SOCKET_REQ_ID | |
| SL_WISUN_MSG_CONNECT_SOCKET_REQ_ID | |
| SL_WISUN_MSG_BIND_SOCKET_REQ_ID | |
| SL_WISUN_MSG_SEND_ON_SOCKET_REQ_ID | |
| SL_WISUN_MSG_RECEIVE_ON_SOCKET_REQ_ID | |
| SL_WISUN_MSG_DISCONNECT_REQ_ID | |
| SL_WISUN_MSG_SET_TRUSTED_CERTIFICATE_REQ_ID | |
| SL_WISUN_MSG_SET_DEVICE_CERTIFICATE_REQ_ID | |
| SL_WISUN_MSG_SET_DEVICE_PRIVATE_KEY_REQ_ID | |
| SL_WISUN_MSG_GET_STATISTICS_REQ_ID | |
| SL_WISUN_MSG_SET_SOCKET_OPTION_REQ_ID | |
| SL_WISUN_MSG_SET_TX_POWER_REQ_ID | |
| SL_WISUN_MSG_SET_CHANNEL_MASK_REQ_ID | |
| SL_WISUN_MSG_ALLOW_MAC_ADDRESS_REQ_ID | |
| SL_WISUN_MSG_DENY_MAC_ADDRESS_REQ_ID | |
| SL_WISUN_MSG_GET_SOCKET_OPTION_REQ_ID | |
| SL_WISUN_MSG_GET_JOIN_STATE_REQ_ID | |
| SL_WISUN_MSG_CLEAR_CREDENTIAL_CACHE_REQ_ID | |
| SL_WISUN_MSG_GET_MAC_ADDRESS_REQ_ID | |
| SL_WISUN_MSG_SET_MAC_ADDRESS_REQ_ID | |
| SL_WISUN_MSG_RESET_STATISTICS_REQ_ID | |
| SL_WISUN_MSG_GET_NEIGHBOR_COUNT_REQ_ID | |
| SL_WISUN_MSG_GET_NEIGHBORS_REQ_ID | |
| SL_WISUN_MSG_GET_NEIGHBOR_INFO_REQ_ID | |
| SL_WISUN_MSG_SET_UNICAST_SETTINGS_REQ_ID | |
| SL_WISUN_MSG_SET_TRACE_LEVEL_REQ_ID | |
| SL_WISUN_MSG_SET_TRACE_FILTER_REQ_ID | |
| SL_WISUN_MSG_SET_REGULATION_REQ_ID | |
| SL_WISUN_MSG_SET_DEVICE_PRIVATE_KEY_ID_REQ_ID | |
| SL_WISUN_MSG_SET_ASYNC_FRAGMENTATION_REQ_ID | |
| SL_WISUN_MSG_SET_MODE_SWITCH_REQ_ID | |
| SL_WISUN_MSG_SET_REGULATION_TX_THRESHOLDS_REQ_ID | |
| SL_WISUN_MSG_SET_DEVICE_TYPE_REQ_ID | |
| SL_WISUN_MSG_SET_CONNECTION_PARAMS_REQ_ID | |
| SL_WISUN_MSG_JOIN_REQ_ID | |
| SL_WISUN_MSG_SET_POM_IE_REQ_ID | |
| SL_WISUN_MSG_GET_POM_IE_REQ_ID | |
| SL_WISUN_MSG_SET_LFN_PARAMS_REQ_ID | |
| SL_WISUN_MSG_SET_LFN_SUPPORT_REQ_ID | |
| SL_WISUN_MSG_SET_PTI_STATE_REQ_ID | |
| SL_WISUN_MSG_SET_TBU_SETTINGS_REQ_ID | |
| SL_WISUN_MSG_GET_GTKS_REQ_ID | |
| SL_WISUN_MSG_TRIGGER_FRAME_REQ_ID | |
| SL_WISUN_MSG_GET_STACK_VERSION_REQ_ID | |
| SL_WISUN_MSG_SET_SECURITY_STATE_REQ_ID | |
| SL_WISUN_MSG_GET_NETWORK_INFO_REQ_ID | |
| SL_WISUN_MSG_GET_RPL_INFO_REQ_ID | |
| SL_WISUN_MSG_GET_EXCLUDED_CHANNEL_MASK_REQ_ID | |
| SL_WISUN_MSG_SET_NEIGHBOR_TABLE_SIZE_REQ_ID | |
| SL_WISUN_MSG_SOCKET_RECVMSG_REQ_ID | |
| SL_WISUN_MSG_SOCKET_SENDMSG_REQ_ID | |
| SL_WISUN_MSG_SOCKET_GETSOCKNAME_REQ_ID | |
| SL_WISUN_MSG_SOCKET_GETPEERNAME_REQ_ID | |
| SL_WISUN_MSG_ENABLE_NEIGHBOUR_SOLICITATIONS_REQ_ID | |
| SL_WISUN_MSG_TRIGGER_NEIGHBOR_CACHE_REFRESH_REQ_ID | |
| SL_WISUN_MSG_SET_RATE_ALGORITHM_REQ_ID | |
| SL_WISUN_MSG_GET_RATE_ALGORITHM_STATS_REQ_ID | |
| SL_WISUN_MSG_SET_TX_POWER_DDBM_REQ_ID | |
| SL_WISUN_MSG_SET_LEAF_REQ_ID | |
| SL_WISUN_MSG_SET_DIRECT_CONNECT_STATE_REQ_ID | |
| SL_WISUN_MSG_ACCEPT_DIRECT_CONNECT_LINK_REQ_ID | |
| SL_WISUN_MSG_SET_PHY_SENSITIVITY_REQ_ID | |
| SL_WISUN_MSG_SET_DIRECT_CONNECT_PMK_ID_REQ_ID | |
| SL_WISUN_MSG_SET_PREFERRED_PAN_REQ_ID | |
| SL_WISUN_MSG_CONFIG_NEIGHBOR_TABLE_SIZE_REQ_ID | |
| SL_WISUN_MSG_SET_LFN_TIMINGS_REQ_ID | |
| SL_WISUN_MSG_CONFIG_CONCURRENT_DETECTION_REQ_ID | |
| SL_WISUN_MSG_SET_REGULATION_PARAMS_REQ_ID | |
| SL_WISUN_MSG_RESET_REGULATION_DUTY_CYCLE_REQ_ID | |
| SL_WISUN_MSG_SET_EAP_IDENTITY_REQ_ID | |
| SL_WISUN_MSG_SET_EVENT_FILTER_REQ_ID | |
| SL_WISUN_MSG_SET_FAN_TPS_VERSION_REQ_ID | |
| SL_WISUN_MSG_SET_RX_FIFO_SIZE_REQ_ID | |
| SL_WISUN_MSG_REGISTER_ADDRESS_REQ_ID | |
| SL_WISUN_MSG_CLEAR_EVENT_FILTERS_REQ_ID | |
Function Documentation#
sl_wisun_send_request#
sl_status_t sl_wisun_send_request (const void * req, uint16_t req_len, void * cnf, uint16_t cnf_len)
Send a request to the Wi-SUN stack.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| const void * | [in] | req | Pointer to the request message buffer |
| uint16_t | [in] | req_len | Length of the request message in bytes (must match req->header.length) |
| void * | [out] | cnf | Pointer to confirmation message buffer |
| uint16_t | [in] | cnf_len | Length of the confirmation message buffer in bytes |
This function provides an interface for sending requests to the Wi-SUN stack and receiving confirmations. When using blocking requests, the function blocks until the request is processed and a confirmation is available.
REQ/CNF buffer layout: request: | Header (4B) | Request body (varies) | Trailing data (if any) | confirmation: | Header (4B) | Confirmation body (varies) | Trailing data (if any) |
Header structure:
length: uint16_t - Total message length including header and trailing data
id: uint8_t - Message identifier
info: uint8_t - Message flags and metadata
req != NULL && cnf != NULL
req_len >= sizeof(sl_wisun_msg_header_t)
cnf_len >= sizeof(sl_wisun_msg_header_t) + sizeof(uint32_t) (header + status)
req->header.length == req_len (length consistency check)
Returns
SL_STATUS_OK Request processed successfully
SL_STATUS_INVALID_PARAMETER Invalid parameters or buffer size mismatch
SL_STATUS_NULL_POINTER NULL pointer parameter
SL_STATUS_FAIL Internal processing error or handler failure
Note
Blocking behavior: When using blocking requests, this function blocks the calling thread until the request is processed.
See Also
sl_wisun_msg_header_t for header structure details