Events, Callbacks, Event Handlers and Execution Contexts

Events and Contexts

Gecko OS is an event driven system. See App Operation .

There are several types of event, grouped according to the triggers for the event and the context in which the event executes. See Native API Event Types below.

In this documentation we distinguish between the terms callback and event handler , according to the execution context:

Gecko OS can respond to events with callbacks or event handlers that execute in a particular execution contexts . An Execution Context is a thread, except in the cases of the IRQ Execution Context and the RTOS Timer Context.

Execution contexts are listed below. These are covered in more detail in Execution Contexts .

Event handlers for TCP events are executed in the App context.

Special Context Considerations

Some execution contexts have limited resources. To switch processing to another execution context, you can issue an event with an event handler that executes in another context. For example, you can issue an event with gos_event_issue .

Limited resource contexts include RTOS Timer , IRQ and System Event Thread .

System Event Context

Events executing in the System event thread MUST NOT block as no other events can execute until it completes.

Command Context

Gecko OS commands and custom commands execute in the Command thread context. Custom commands cannot call any of the gos_cmd_issue functions, as it would create a deadlock. The Gecko OS API explicitly prevents a deadlock: a call to gos_cmd_issue* from within the Command thread fails automatically with a GOS_NESTED_CMD result code. See gos_result_t .

Native API Event Types

In this section, events are listed according to type, with details of:

Commands

Issued Events

Timed Events

For more detail see Timed Events .

Event API

RTOS Timer

File System Events

Hardware IRQ Events

UART Events

HTTP/S Server Events

Network Events

Unregistering a Network Event

There is only one network event. To unregister it, pass a NULL to the register API:

gos_network_register_event_handler(WLAN, NULL)
gos_network_register_softap_event_handler(NULL)

Periodic Broadcast Events

System

System Functions, Miscellaneous

System Monitor Events

TCP Events

UDP Events

Button Events

Web Setup Events

WebSocket Events