Definitions in event.h

Preprocessor macro definitions for the event.h header file in the libhnm library.


#define hnm_EventClassShift 8

Number of bits to shift; used in hnm_EventTypeID and hnm_EventClassID

#define hnm_EventClassMask (0xffff << hnm_EventClassShift)

Mask to extract class ID; used by hnm_EventTypeID, hnm_EventClassID, and hnm_Event_typeof

#define hnm_EventTypeMask ~hnm_EventClassMask
#define hnm_EventTypeID ( hnm_EventType )( class << hnm_EventClassShift | ( type & hnm_EventTypeMask ) )
Aggregate the event class and subtype IDs into a single event-type ID.
#define hnm_EventClassID ( hnm_EventClass )( event_id >> hnm_EventClassShift )
Extract the event class ID from the event-type ID.
#define hnm_Event_typeof ( event && hnm_EventClassID( event->type ) == class )
Macro used to perform runtime type-checking of events.

This macro evaluates to true if the specified event corresponds to the specified event class.

#define EVENT_BASE queue_Element           queue_elem ;            \
                char                    name[ 256 ] ;           \
                hnm_Priority            priority ;              \
                hnm_EventType           type ;                  \
				/* Callbacks associated with the Event structure. */            \
                bool                    ( *appraise )( hnm_Event* self, void* data ) ; \
				void                    ( *service )( hnm_Event* self, void* data )

EVENT_BASE defines the base structure for events.

EVENT_BASE contains the following:
  • queue_elem The queue member of the Event structure. This member must be the first one defined in the structure to allow it to be used with the generic Queue data structure and its associated functions.
  • name[ 256 ] The name of the event. If this string corresponds to an event name in the policy configuration, the associated priority will be assigned to events with that name.
  • priority The priority of the event. The minimum value is HNM_DEFAULT_PRIORITY. The maximum value is HNM_MAX_PRIORITY.
  • type The event type (e.g. display_start or display_end ). A display_start event signifies that an application or service wishes to display some information in a window of a specified type. A display_end event may occur when an application no longer has information to display (e.g. if a handsfree phone call is terminated on the remote end).
The following callbacks are associated with the Event structure:
  • (*appraise)() This callback is called to appraise the current event. This function takes a pointer to the HNM data structure and the event instance as arguments. It returns a Boolean flag to indicate whether to service the event.
  • (*service)() This callback is called to service the current event.