Main Page | Data Structures | File List | Data Fields | Globals

include/timer-interface.h

Go to the documentation of this file.
00001 /**
00002  * This file is part of alarmd
00003  *
00004  * Contact Person: David Weinehall <david.weinehall@nokia.com>
00005  *
00006  * Copyright (C) 2006 Nokia Corporation
00007  * alarmd and libalarm are free software; you can redistribute them
00008  * and/or modify them under the terms of the GNU Lesser General Public
00009  * License version 2.1 as published by the Free Software Foundation.
00010  *
00011  * alarmd and libalarm are distributed in the hope that they will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this software; if not, write to the Free
00018  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00019  * 02110-1301 USA
00020  */
00021 
00022 #ifndef TIMER_INTERFACE_H
00023 #define TIMER_INTERFACE_H
00024 
00025 #include <glib/gtypes.h>
00026 #include <time.h>
00027 
00028 /**
00029  * SECTION:timer-interface
00030  * @short_description: The API for timer plugins.
00031  *
00032  * Here is defined the API that the timer plugins need to implement.
00033  **/
00034 
00035 /**
00036  * TimerCallback:
00037  * @user_data: user data set when the callback was connected.
00038  * @delayed: TRUE if the event is happening after supposed time.
00039  *
00040  * Callback notify for timed events.
00041  **/
00042 typedef void (*TimerCallback)(gpointer user_data, gboolean delayed);
00043 
00044 /**
00045  * TimerCancel:
00046  * @user_data: user data set when the callback was connected.
00047  *
00048  * Callback called when an event is taken off the timer.
00049  **/
00050 typedef void (*TimerCancel)(gpointer user_data);
00051 
00052 /**
00053  * TimerPlugin:
00054  * @is_startup: Boolean that indicates if alarmd is starting up.
00055  * @set_event: Function the events should call when they put self on the timer.
00056  * @remove_event: Function that removes the currently timed event.
00057  * @get_time: Gets the time of the currently timed event.
00058  * @time_changed: Indicates that the system time has changed.
00059  * @plugin_deinit: Deinitializes the plugin.
00060  * @priority: Priority of the plugin.
00061  * @can_power_up: TRUE if the plugin can power up the device.
00062  * @plugin_data: Plugins internal data.
00063  *
00064  * Struct that defines the API for a timer plugin.
00065  **/
00066 typedef struct _TimerPlugin TimerPlugin;
00067 struct _TimerPlugin {
00068         /* Filled in by alarmd: */
00069         gboolean is_startup;
00070 
00071         /* Filled by the plugin: */
00072         gboolean (*set_event)(TimerPlugin *plugin, time_t wanted_time, TimerCallback cb, TimerCancel cancel, gpointer user_data);
00073         gboolean (*remove_event)(TimerPlugin *plugin);
00074         time_t (*get_time)(TimerPlugin *plugin);
00075         void (*time_changed)(TimerPlugin *plugin);
00076         void (*plugin_deinit)(TimerPlugin *plugin);
00077 
00078         guint priority;
00079         gboolean can_power_up;
00080 
00081         gpointer plugin_data;
00082 };
00083 
00084 /**
00085  * plugin_initialize:
00086  * @plugin: Pointer to the struct the plugin should fill.
00087  *
00088  * Function all timer plugins should implement. Fills in the struct that
00089  * describes the plugin.
00090  * Returns: TRUE if plugin initialization was successful.
00091  **/
00092 gboolean plugin_initialize(TimerPlugin *plugin);
00093 
00094 #endif

Generated on Thu Dec 21 18:23:30 2006 for Alarmd by  doxygen 1.4.2