Difference between revisions of "The Queue of Events"

From Hydrover
Jump to: navigation, search
(Structure of an Event)
Line 16: Line 16:
 
= Events' Library Functions =
 
= Events' Library Functions =
  
 +
The library functions for events management are:
  
 +
* <code>#define BASE_EVENT(%1) Event:%1[.opcode, .p0, .p1, .p2, .p3]</code> is a macro to help in creating an event container
 +
* <code>SysEvEnable()</code> enable the system to post events into the queue
 +
* <code>SysEvDisable()</code> disable the system to post events into the queue
 +
* <code>EventGet( BASE_EVENT(ev) )</code> get an event from the queue, if an event is not available will wait for
 +
* <code>EventSend( BASE_EVENT(ev) )</code> send an event to the queue, can be used to inject custom and/or simulated events
  
 
= Processing Events =
 
= Processing Events =

Revision as of 16:07, 21 June 2017

Introduction

The queue of events is the queue where the system send events such as: input change, user action, encoder or transducer match, and from where the user's program get events to process and react to.

Structure of an Event

An event is defined in the library as an array of values:

[.opcode, .p0, .p1, .p2, .p3]

where:

  • .opcode is used to uniquely identify the event
  • .p0, .p1, .p2, .p3 contains informations specific to that event

Events' Library Functions

The library functions for events management are:

  • #define BASE_EVENT(%1) Event:%1[.opcode, .p0, .p1, .p2, .p3] is a macro to help in creating an event container
  • SysEvEnable() enable the system to post events into the queue
  • SysEvDisable() disable the system to post events into the queue
  • EventGet( BASE_EVENT(ev) ) get an event from the queue, if an event is not available will wait for
  • EventSend( BASE_EVENT(ev) ) send an event to the queue, can be used to inject custom and/or simulated events

Processing Events