CC3000 Host Programming Guide
3
Events
An event is a device-triggered behavior that results in an interruption of the host processor. Two types of events are
generated by the CC3000 device:
€ Command response events
€ Unsolicited events
Command Response Events
Command response events are generated as a result of a command issued to the device when the command has
reached the point that either the command is completed or the long-term process is triggered. It is used by the device
to return control to the caller with the appropriate result. Command response events carry an opcode that corresponds
to the opcode of the command (API) that generates them and a status that reflects the return code of the calling
function.
Unsolicited Events
The system provides unsolicited events triggered by the device. These events are generated asynchronously to
indicate an occurrence of a system event. The following figure shows the basic event sequences:
Unsolicited events that are generated by the device have their own unique opcode.
A callback function that corresponds to the event is invoked and carries on event handling thereafter, if the callback
is registered by the user application.
All unsolicited events can be masked using a special command that controls the event mask. Command completion
events cannot be masked (because they deliver the result code and thus are required to maintain API integrity) and
are not passed to the user application.
Because there is no queuing mechanism within the CC3000 host drive, the hci_unsolicited_event_handler function
must be called by the user periodically each 500 ms. The function determines if unsolicited event handling is
required and, if so, triggers the appropriate callback function. The periodic call to the function can be executed either
in the dedicated context of the timer interrupt, for example, or within the main loop of the user application, as occurs
in the Basic WiFi Applications.
Unsolicited Events list
The following lists all of the asynchronous events that can be generated by CC3000 device:
€ HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE – Notification that the first-time configuration
process is complete
€ HCI_EVNT_WLAN_KEEPALIVE – Periodic keep-alive event between the CC3000 and the host
microcontroller unit (MCU)
€ HCI_EVNT_WLAN_UNSOL_CONNECT – WLAN-connected event
€ HCI_EVNT_WLAN_UNSOL_DISCONNECT – Notification that CC3000 device is disconnected from the
access point (AP)
€ HCI_EVNT_WLAN_UNSOL_DHCP – Notification of a Dynamic Host Configuration Protocol (DHCP) state
change
€ HCI_EVNT_WLAN_UNSOL_INIT – Notification that the CC3000 device finished the initialization process
€ HCI_EVNT_WLAN_ASYNC_PING_REPORT – Notification of ping results
评论4
最新资源