WHD Event handling API

group event

Functions that allow user applications to receive event callbacks and set event handlers.

Functions that allow user applications to receive error callbacks and set error handlers.

Typedefs

typedef void *(*whd_event_handler_t)(whd_interface_t ifp, const whd_event_header_t *event_header, const uint8_t *event_data, void *handler_user_data)

Event handler prototype definition.

Parameters
  • ifp: Pointer to handle instance of whd interface

  • event_header: whd event header

  • event_data: event data

  • handler_user_data: semaphore data

typedef void *(*whd_error_handler_t)(whd_driver_t whd_driver, const uint8_t *error_type, const uint8_t *event_data, void *handler_user_data)

Error handler prototype definition.

Parameters
  • whd_driver: Pointer to handle instance of whd driver

  • error_type: whd error type

  • event_data: event data

  • handler_user_data: semaphore data

Functions

uint32_t whd_wifi_set_event_handler(whd_interface_t ifp, const uint32_t *event_type, whd_event_handler_t handler_func, void *handler_user_data, uint16_t *event_index)

Registers a handler to receive event callbacks.

This function registers a callback handler to be notified when a particular event is received.

note

Currently each event may only be registered to one handler and there is a limit to the number of simultaneously registered events. Maximum of 5 event handlers can registered simultaneously, this also includes the internal event handler registration which happens during scan, join and starting an AP.

Return

WHD_SUCCESS or Error code

Parameters
  • ifp: Pointer to handle instance of whd interface

  • event_type: Pointer to the event list array

  • handler_func: A function pointer to the handler callback

  • handler_user_data: A pointer value which will be passed to the event handler function at the time an event is triggered (NULL is allowed)

  • event_index: Entry where the event handler is registered in the list

uint32_t whd_wifi_set_error_handler(whd_interface_t ifp, const uint8_t *error_nums, whd_error_handler_t handler_func, void *handler_user_data, uint16_t *error_index)

Registers a handler to receive error callbacks.

This function registers a callback handler to be notified when a particular event is received.

note

Currently each event may only be registered to one handler and there is a limit to the number of simultaneously registered events. Maximum of 5 event handlers can registered simultaneously, this also includes the internal event handler registration which happens during scan, join and starting an AP.

Return

WHD_SUCCESS or Error code

Parameters
  • ifp: Pointer to handle instance of whd interface

  • error_nums: Pointer to the event list as WLC_ERR_BUS and WLC_ERR_FW

  • handler_func: A function pointer to the handler callback

  • handler_user_data: A pointer value which will be passed to the event handler function at the time an event is triggered (NULL is allowed)

  • error_index: Entry where the error handler is registered in the list

uint32_t whd_wifi_deregister_event_handler(whd_interface_t ifp, uint16_t event_index)

Delete/Deregister the event entry where callback is registered.

Return

WHD_SUCCESS or Error code

Parameters
  • ifp: Pointer to handle instance of whd interface

  • event_index: Event index obtained during registration by whd_wifi_set_event_handler

uint32_t whd_wifi_deregister_error_handler(whd_interface_t ifp, uint16_t error_index)

Delete/Deregister the error entry where callback is registered.

Return

WHD_SUCCESS or Error code

Parameters
  • ifp: Pointer to handle instance of whd interface

  • error_index: Error index obtained during registration by whd_wifi_set_error_handler

Variables

uint16_t subtype

Vendor specific..32769.

uint16_t length

Length of ethernet header.

uint8_t version

Version is 0.

uint8_t oui[3]

Organizationally Unique Identifier.

uint16_t usr_subtype

User specific data.

whd_mac_t destination_address

Ethernet destination address.

whd_mac_t source_address

Ethernet source address.

uint16_t ethertype

Ethertype for identifying event packets.

uint16_t version

Version.

uint16_t flags

see flags below

uint32_t event_type

Event type indicating a response from firmware for IOCTLs/IOVARs sent.

uint32_t status

Status code corresponding to any event type.

uint32_t reason

Reason code associated with the event occurred.

uint32_t auth_type

WLC_E_AUTH: 802.11 AUTH request.

uint32_t datalen

Length of data in event message.

whd_mac_t addr

Station address (if applicable)

char ifname[WHD_MSG_IFNAME_MAX]

name of the incoming packet interface

uint8_t ifidx

destination OS i/f index

uint8_t bsscfgidx

source bsscfg index

whd_event_ether_header_t eth

Variable to store ethernet destination, source and ethertype in event packets.

whd_event_eth_hdr_t eth_evt_hdr

Variable to store ethernet header fields in event message.

whd_event_header_t whd_event

Variable to store rest of the event packet fields after ethernet header.