Callback Framework#
This section provides a reference to Wi-Fi API callback handling functions.
Note
Stack overflows may occur when invoking functions or using your own variables or data structures while handling callbacks. Configure the stack size by modifying the pre-processor macro
SL_SI91X_EVENT_HANDLER_STACK_SIZE
as per your application's requirements. See here for the instructions in modifying a pre-processor macro.Event/Callback handlers must not contain function calls or code which can block or delay the execution of the event/callback handler as it will cause all the other events to queue up and delay the execution of other events since all the events are invoked and handled from a single thread.
Do not call any synchronous SDK APIs from within the Event/Callback handlers.
Typedefs#
Generic callback for Wi-Fi group event of type sl_wifi_event_group_t.
Callback for SL_WIFI_SCAN_RESULT_EVENTS group event.
Callback for SL_WIFI_STATS_RESPONSE_EVENTS group events.
Callback for SL_WIFI_JOIN_EVENTS group events.
Callback for SL_WIFI_TWT_RESPONSE_EVENTS group events.
Callback for SL_WIFI_TRANSCEIVER_EVENTS group events.
Functions#
Register a callback for selected event group.
Default Wi-Fi event handler to passed to sl_wifi_init.
Register callback for SL_WIFI_SCAN_RESULT_EVENTS group event from sl_wifi_event_group_t.
Register callback for SL_WIFI_JOIN_EVENTS group event from sl_wifi_event_group_t.
Register callback for SL_WIFI_TWT_RESPONSE_EVENTS group event from sl_wifi_event_group_t.
Register callback for SL_WIFI_STATS_RESPONSE_EVENTS group event from sl_wifi_event_group_t.
Register callback for SL_WIFI_TRANSCEIVER_EVENTS group event from sl_wifi_event_group_t.
Macros#
Generic macro for callback functions to check if the event has Failed.
Typedef Documentation#
sl_wifi_callback_function_t#
sl_wifi_callback_function_t )(sl_wifi_event_t event, void *data, uint32_t data_length, void *arg)
Generic callback for Wi-Fi group event of type sl_wifi_event_group_t.
N/A | event | Wi-Fi event of type sl_wifi_event_t |
N/A | data | Data received |
N/A | data_length | Data length |
N/A | optional_arg | Optional user provided argument passed in sl_wifi_set_callback |
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
In case of event failure, SL_WIFI_FAIL_EVENT_STATUS_INDICATION bit is set in event, data will be of type sl_status_t and data_length can be ignored
47
of file components/protocol/wifi/inc/sl_wifi_callback_framework.h
sl_wifi_scan_callback_t#
sl_wifi_scan_callback_t )(sl_wifi_event_t event, sl_wifi_scan_result_t *data, uint32_t data_length, void *optional_arg)
Callback for SL_WIFI_SCAN_RESULT_EVENTS group event.
N/A | event | Wi-Fi event of type sl_wifi_event_t |
N/A | data | Scan results of type sl_wifi_scan_result_t |
N/A | data_length | Data length |
N/A | optional_arg | Optional user provided argument passed in sl_wifi_set_scan_callback |
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
In case of event failure, SL_WIFI_FAIL_EVENT_STATUS_INDICATION bit is set in event, data will be of type sl_status_t and data_length can be ignored
65
of file components/protocol/wifi/inc/sl_wifi_callback_framework.h
sl_wifi_stats_callback_t#
sl_wifi_stats_callback_t )(sl_wifi_event_t event, void *data, uint32_t data_length, void *optional_arg)
Callback for SL_WIFI_STATS_RESPONSE_EVENTS group events.
N/A | event | Wi-Fi event of type sl_wifi_event_t Individual Wi-Fi events related to SL_WIFI_STATS_RESPONSE_EVENTS is as follows.
| ||||||||||||
N/A | data | Data received. | ||||||||||||
N/A | data_length | Data length | ||||||||||||
N/A | optional_arg | Optional user provided argument passed in sl_wifi_set_stats_callback |
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
In case of event failure, SL_WIFI_FAIL_EVENT_STATUS_INDICATION bit is set in event, data will be of type sl_status_t and data_length can be ignored.
94
of file components/protocol/wifi/inc/sl_wifi_callback_framework.h
sl_wifi_join_callback_t#
sl_wifi_join_callback_t )(sl_wifi_event_t event, char *data, uint32_t data_length, void *arg)
Callback for SL_WIFI_JOIN_EVENTS group events.
N/A | event | Wi-Fi event of type sl_wifi_event_t | ||||||
N/A | data | Data received in string.
| ||||||
N/A | data_length | Data length | ||||||
N/A | optional_arg | Optional user provided argument passed in sl_wifi_set_join_callback |
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
In case of event failure, SL_WIFI_FAIL_EVENT_STATUS_INDICATION bit is set in event, data will be of type sl_status_t and data_length can be ignored
119
of file components/protocol/wifi/inc/sl_wifi_callback_framework.h
sl_wifi_twt_config_callback_t#
sl_wifi_twt_config_callback_t )(sl_wifi_event_t event, sl_si91x_twt_response_t *data, uint32_t data_length, void *arg)
Callback for SL_WIFI_TWT_RESPONSE_EVENTS group events.
N/A | event | Wi-Fi event of type sl_wifi_event_t Individual Wi-Fi events related to SL_WIFI_TWT_RESPONSE_EVENTS is as follows.
| ||||||||||||||
N/A | data | Data received of type sl_si91x_twt_response_t. | ||||||||||||||
N/A | data_length | Data length | ||||||||||||||
N/A | optional_arg | Optional user provided argument passed in sl_wifi_set_twt_config_callback |
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
In case of event failure, SL_WIFI_FAIL_EVENT_STATUS_INDICATION bit is set in event, data will be of type sl_status_t and data_length can be ignored
153
of file components/protocol/wifi/inc/sl_wifi_callback_framework.h
sl_wifi_transceiver_callback_t#
sl_wifi_transceiver_callback_t )(sl_wifi_event_t event, void *data, uint32_t data_length, void *arg)
Callback for SL_WIFI_TRANSCEIVER_EVENTS group events.
[out] | event | Wi-Fi event of type sl_wifi_event_t. Individual Wi-Fi events related to SL_WIFI_TRANSCEIVER_EVENTS are as follows.
| |||
[out] | data |
| |||
[out] | data_length | Reserved | |||
[out] | optional_arg | Optional user provided argument passed in sl_wifi_set_transceiver_callback |
Returns
sl_status_t. See Status Codes.
Note
This API is only supported in Wi-Fi Transceiver opermode (7).
In case of event failure, SL_WIFI_FAIL_EVENT_STATUS_INDICATION bit is set in event, data will be of type sl_status_t and data_length can be ignored.
180
of file components/protocol/wifi/inc/sl_wifi_callback_framework.h
Function Documentation#
sl_wifi_set_callback#
sl_status_t sl_wifi_set_callback (sl_wifi_event_group_t group, sl_wifi_callback_function_t function, void * optional_arg)
Register a callback for selected event group.
[in] | group | group id of the event. See sl_wifi_event_group_t |
[in] | function | Function pointer to callback of type sl_wifi_callback_function_t |
[in] | optional_arg | Optional user provided argument. This will be passed back to callback handler of type sl_wifi_callback_function_t |
All the individual Wi-Fi events related to specific group will be triggered via this group callback
Pre-conditions:
Pre-conditions:
Pre-conditions:
sl_wifi_init should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
Callbacks can be set only for sl_wifi_event_group_t, not for individual events (sl_wifi_event_t)
204
of file components/protocol/wifi/inc/sl_wifi_callback_framework.h
sl_wifi_default_event_handler#
sl_status_t sl_wifi_default_event_handler (sl_wifi_event_t event, sl_wifi_buffer_t * buffer)
Default Wi-Fi event handler to passed to sl_wifi_init.
[in] | event | Wi-Fi event of type of sl_wifi_event_t |
[in] | buffer | Buffer containing raw data from TA firmware |
This function will dispatch Wi-Fi events and invokes respective Wi-Fi group event callback Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
Passing this event handler is optional. User can implement his own event dispatching framework.
218
of file components/protocol/wifi/inc/sl_wifi_callback_framework.h
sl_wifi_set_scan_callback#
static sl_status_t sl_wifi_set_scan_callback (sl_wifi_scan_callback_t function, void * optional_arg)
Register callback for SL_WIFI_SCAN_RESULT_EVENTS group event from sl_wifi_event_group_t.
[in] | function | Optional user provided argument. This will be passed back to callback handler of type sl_wifi_scan_callback_t |
N/A | optional_arg |
Pre-conditions:
Pre-conditions:
Pre-conditions:
sl_wifi_init should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
All the individual Wi-Fi events related to this group will be triggered via this callback
235
of file components/protocol/wifi/inc/sl_wifi_callback_framework.h
sl_wifi_set_join_callback#
static sl_status_t sl_wifi_set_join_callback (sl_wifi_join_callback_t function, void * optional_arg)
Register callback for SL_WIFI_JOIN_EVENTS group event from sl_wifi_event_group_t.
[in] | function | Function pointer to callback. This will be passed back to callback handler of type sl_wifi_join_callback_t |
[in] | optional_arg | Optional user provided argument. This will be passed back to callback handler. |
Pre-conditions:
Pre-conditions:
Pre-conditions:
sl_wifi_init should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
All the individual Wi-Fi events related to this group will be triggered via this callback
257
of file components/protocol/wifi/inc/sl_wifi_callback_framework.h
sl_wifi_set_twt_config_callback#
static sl_status_t sl_wifi_set_twt_config_callback (sl_wifi_twt_config_callback_t function, void * optional_arg)
Register callback for SL_WIFI_TWT_RESPONSE_EVENTS group event from sl_wifi_event_group_t.
[in] | function | Function pointer to callback. This will be passed back to callback handler of type sl_wifi_twt_config_callback_t |
[in] | optional_arg | Optional user provided argument. This will be passed back to callback handler. |
Pre-conditions:
Pre-conditions:
Pre-conditions:
sl_wifi_init should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
All the individual Wi-Fi events related to this group will be triggered via this callback.
279
of file components/protocol/wifi/inc/sl_wifi_callback_framework.h
sl_wifi_set_stats_callback#
static sl_status_t sl_wifi_set_stats_callback (sl_wifi_stats_callback_t function, void * optional_arg)
Register callback for SL_WIFI_STATS_RESPONSE_EVENTS group event from sl_wifi_event_group_t.
[in] | function | Function pointer to callback. This will be passed back to callback handler of type sl_wifi_stats_callback_t |
[in] | optional_arg | Optional user provided argument. This will be passed back to callback handler. |
Pre-conditions:
Pre-conditions:
Pre-conditions:
sl_wifi_init should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
All the individual Wi-Fi events related to this group will be triggered via this callback.
301
of file components/protocol/wifi/inc/sl_wifi_callback_framework.h
sl_wifi_set_transceiver_callback#
static sl_status_t sl_wifi_set_transceiver_callback (sl_wifi_transceiver_callback_t function, void * optional_arg)
Register callback for SL_WIFI_TRANSCEIVER_EVENTS group event from sl_wifi_event_group_t.
[in] | function | Function pointer to callback. This will be passed back to callback handler of type sl_wifi_transceiver_callback_t |
[in] | optional_arg | Optional user provided argument. This will be passed back to callback handler. |
Pre-conditions:
sl_wifi_init should be called before this API.
Returns
sl_status_t. See Status Codes.
Note
All the individual Wi-Fi events related to this group will be triggered via this callback.
320
of file components/protocol/wifi/inc/sl_wifi_callback_framework.h