Callback Framework#

This section provides a reference to Wi-Fi API callback handling functions.

Typedefs#

typedef sl_status_t(*
sl_wifi_callback_function_t)(sl_wifi_event_t event, void *data, uint32_t data_length, void *arg)

Generic Wi-Fi callback function type.

typedef sl_status_t(*
sl_wifi_scan_callback_t)(sl_wifi_event_t event, sl_wifi_scan_result_t *data, uint32_t data_length, void *arg)

Wi-Fi scan result callback type.

typedef sl_status_t(*
sl_wifi_stats_callback_t)(sl_wifi_event_t event, void *data, uint32_t data_length, void *arg)

Wi-Fi stats callback type.

typedef sl_status_t(*
sl_wifi_join_callback_t)(sl_wifi_event_t event, char *data, uint32_t data_length, void *arg)

Wi-Fi join callback type.

typedef sl_status_t(*
sl_wifi_twt_config_callback_t)(sl_wifi_event_t event, sl_si91x_twt_response_t *data, uint32_t data_length, void *arg)

TWT Response callback type.

Functions#

sl_status_t
sl_wifi_set_callback(sl_wifi_event_group_t group, sl_wifi_callback_function_t function, void *optional_arg)

Register a function and optional argument for a selected callback.

sl_status_t
default_wifi_event_handler(sl_wifi_event_t event, sl_wifi_buffer_t *buffer)

Default Wi-Fi event handler.

sl_status_t
sl_wifi_set_scan_callback(sl_wifi_scan_callback_t function, void *optional_arg)

Register a function and optional argument for scan results callback.

sl_status_t
sl_wifi_set_join_callback(sl_wifi_join_callback_t function, void *optional_arg)

Register a function and optional argument for join status callback.

sl_status_t
sl_wifi_set_twt_config_callback(sl_wifi_twt_config_callback_t function, void *optional_arg)

Register a function and optional argument for TWT response callback.

sl_status_t
sl_wifi_set_stats_callback(sl_wifi_stats_callback_t function, void *optional_arg)

Register a function and optional argument for statistic report callback.

Macros#

#define

Generic macro for callback functions to check if the event has Failed.

Typedef Documentation#

sl_wifi_callback_function_t#

typedef sl_status_t(* sl_wifi_callback_function_t) (sl_wifi_event_t event, void *data, uint32_t data_length, void *arg) )(sl_wifi_event_t event, void *data, uint32_t data_length, void *arg)

Generic Wi-Fi callback function type.


Definition at line 15 of file components/protocol/wifi/inc/sl_wifi_callback_framework.h

sl_wifi_scan_callback_t#

typedef sl_status_t(* sl_wifi_scan_callback_t) (sl_wifi_event_t event, sl_wifi_scan_result_t *data, uint32_t data_length, void *arg) )(sl_wifi_event_t event, sl_wifi_scan_result_t *data, uint32_t data_length, void *arg)

Wi-Fi scan result callback type.

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


Definition at line 19 of file components/protocol/wifi/inc/sl_wifi_callback_framework.h

sl_wifi_stats_callback_t#

typedef sl_status_t(* sl_wifi_stats_callback_t) (sl_wifi_event_t event, void *data, uint32_t data_length, void *arg) )(sl_wifi_event_t event, void *data, uint32_t data_length, void *arg)

Wi-Fi stats callback type.

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 Note

  • structure of data to be expected

  • SL_WIFI_STATS_EVENT -> Coming soon

  • : SL_WIFI_STATS_AYSNC_EVENT -> sl_si91x_async_stats_response_t

  • : SL_WIFI_STATS_ADVANCE_EVENT -> sl_si91x_advance_stats_response_t

  • : SL_WIFI_STATS_TEST_MODE_EVENT -> Coming soon

  • : SL_WIFI_STATS_MODULE_STATE_EVENT -> sl_si91x_module_state_stats_response_t


Definition at line 32 of file components/protocol/wifi/inc/sl_wifi_callback_framework.h

sl_wifi_join_callback_t#

typedef sl_status_t(* sl_wifi_join_callback_t) (sl_wifi_event_t event, char *data, uint32_t data_length, void *arg) )(sl_wifi_event_t event, char *data, uint32_t data_length, void *arg)

Wi-Fi join callback type.

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


Definition at line 36 of file components/protocol/wifi/inc/sl_wifi_callback_framework.h

sl_wifi_twt_config_callback_t#

typedef sl_status_t(* sl_wifi_twt_config_callback_t) (sl_wifi_event_t event, sl_si91x_twt_response_t *data, uint32_t data_length, void *arg) )(sl_wifi_event_t event, sl_si91x_twt_response_t *data, uint32_t data_length, void *arg)

TWT Response callback type.

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


Definition at line 40 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 function and optional argument for a selected callback.

Parameters
[in]group

ID of the event. See sl_wifi_event_t

[in]function

Function pointer to callback

[in]optional_arg

Optional user provided argument. This will be passed back to callback handler.

Returns

Note

  • Callbacks can be set only for sl_wifi_event_group_t, not for individual events (sl_wifi_event_t)


Definition at line 61 of file components/protocol/wifi/inc/sl_wifi_callback_framework.h

default_wifi_event_handler#

sl_status_t default_wifi_event_handler (sl_wifi_event_t event, sl_wifi_buffer_t * buffer)

Default Wi-Fi event handler.

Parameters
N/Aevent
N/Abuffer

Definition at line 64 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 a function and optional argument for scan results callback.

Parameters
[in]function

Function pointer to callback

[in]optional_arg

Optional user provided argument. This will be passed back to callback handler.

Returns


Definition at line 78 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 a function and optional argument for join status callback.

Parameters
[in]function

Function pointer to callback

[in]optional_arg

Optional user provided argument. This will be passed back to callback handler.

Returns


Definition at line 95 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 a function and optional argument for TWT response callback.

Parameters
[in]function

Function pointer to callback

[in]optional_arg

Optional user provided argument. This will be passed back to callback handler.

Returns


Definition at line 112 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 a function and optional argument for statistic report callback.

Parameters
[in]function

Function pointer to callback

[in]optional_arg

Optional user provided argument. This will be passed back to callback handler.

Returns


Definition at line 129 of file components/protocol/wifi/inc/sl_wifi_callback_framework.h

Macro Definition Documentation#

CHECK_IF_EVENT_FAILED#

#define CHECK_IF_EVENT_FAILED
Value:
(event)

Generic macro for callback functions to check if the event has Failed.


Definition at line 12 of file components/protocol/wifi/inc/sl_wifi_callback_framework.h