timer-interface

timer-interface — The API for timer plugins.

Synopsis




void        (*TimerCallback)                (gpointer user_data,
                                             gboolean delayed);
void        (*TimerCancel)                  (gpointer user_data);
            TimerPlugin;
gboolean    plugin_initialize               (TimerPlugin *plugin);

Description

Here is defined the API that the timer plugins need to implement.

Details

TimerCallback ()

void        (*TimerCallback)                (gpointer user_data,
                                             gboolean delayed);

Callback notify for timed events.

user_data : user data set when the callback was connected.
delayed : TRUE if the event is happening after supposed time.

TimerCancel ()

void        (*TimerCancel)                  (gpointer user_data);

Callback called when an event is taken off the timer.

user_data : user data set when the callback was connected.

TimerPlugin

typedef struct {
	/* Filled in by alarmd: */
	gboolean is_startup;

	/* Filled by the plugin: */
	gboolean (*set_event)(TimerPlugin *plugin, time_t wanted_time, TimerCallback cb, TimerCancel cancel, gpointer user_data);
	gboolean (*remove_event)(TimerPlugin *plugin);
	time_t (*get_time)(TimerPlugin *plugin);
	void (*time_changed)(TimerPlugin *plugin);
	void (*plugin_deinit)(TimerPlugin *plugin);

	guint priority;
	gboolean can_power_up;

	gpointer plugin_data;
} TimerPlugin;

Struct that defines the API for a timer plugin.

gboolean is_startup; Boolean that indicates if alarmd is starting up.
set_event () Function the events should call when they put self on the timer.
remove_event () Function that removes the currently timed event.
get_time () Gets the time of the currently timed event.
time_changed () Indicates that the system time has changed.
plugin_deinit () Deinitializes the plugin.
guint priority; Priority of the plugin.
gboolean can_power_up; TRUE if the plugin can power up the device.
gpointer plugin_data; Plugins internal data.

plugin_initialize ()

gboolean    plugin_initialize               (TimerPlugin *plugin);

Function all timer plugins should implement. Fills in the struct that describes the plugin.

plugin : Pointer to the struct the plugin should fill.
Returns : TRUE if plugin initialization was successful.