Skip to content
tiffany352 edited this page Sep 3, 2012 · 5 revisions

Sypnosis

#include "common/event.h

const il_Event_Event* il_Event_new(uint16_t eventid, uint8_t size, void * data);
int il_Event_push(const il_Event_Event* event);
int il_Event_pushnew(unsigned id, size_t size, const void * data);
int il_Event_timer(const il_Event_Event* event, struct timeval * interval);
int il_Event_register(uint16_t eventid, void(*callback)(il_Event_Event*, void * ctx), void * ctx);

Description

This header provides an interface to the libevent-based event system for IntenseLogic.

The push and pushnew functions create a libevent event and make it pending and active, push takes an existing event, where pushnew will create one from the given arguments (similar to new).

The new and pushnew functions both create a new event from their supplied arguments.

The timer function will take the given event and convert it into a timer event, which will periodically push itself.

The register function will take an event ID and a callback, and push it into the data structure that holds events to call upon receiving an event of a corresponding ID. The context pointer is for manually implementing closures.

The event structure contains the following fields:

  • uint16_t eventid - Upper half contains the event range, and the lower half contains the individual ID. See Events for details.
  • uint8_t size - Contains the length of the data attribute.
  • uint8_t data[] - A variable-length array containing the data, placed after the event. Used for passing data to events.

See Also

Clone this wiki locally