SWRU455M February 2017 – October 2020 CC3120 , CC3120MOD , CC3130 , CC3135 , CC3135MOD , CC3220MOD , CC3220MODA , CC3220R , CC3220S , CC3220SF , CC3230S , CC3230SF , CC3235MODAS , CC3235MODASF , CC3235MODS , CC3235MODSF , CC3235S , CC3235SF
The trigger mode enables host applications to be triggered by the SimpleLink device when network activity is detected, without using the blocking mode or polling the socket. This mode is useful when the power consumption is extremely sensitive and the host processor is able to enter a deep sleep, recover fast, and retain memory. The trigger mode is implemented by calling sl_Select. The host enters a deep sleep and wakes up due to an event, when one or more sockets become ready. After the host wakes up, sl_Select must be called again to identify the network activity. All blocking socket operations can be monitored by sl_Select, called with time-out values set to 0 (sec and µs), which allow application flexibility to implement many communication use cases. Only one select operation is supported at a time.
To define the host application in trigger mode follow these steps:
Figure 7-4 describes a general flow of using trigger mode for accept on a server socket.
An example of select trigger event handle:
void SimpleLinkSocketTriggerEventHandler(SlSockTriggerEvent_t*pSlTriggerEvent)
{
switch (pSlTriggerEvent ->Id)
{
case SL_SOCKET_TRIGGER_EVENT_SELECT:
{
//Notify main task trigger event arrive, wake up and call select againbreak;
}
default:
break;
}
}