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

queue.c File Reference

#include <glib.h>
#include <glib-object.h>
#include "rpc-systemui.h"
#include "xml-common.h"
#include "debug.h"
#include "queue.h"

Include dependency graph for queue.c:

Go to the source code of this file.

Defines

#define ALARMD_QUEUE_GET_PRIVATE(obj)

Typedefs

typedef _AlarmdQueuePrivate AlarmdQueuePrivate

Enumerations

enum  properties {
  PROP_TIMER = 1,
  PROP_TIMER_POWERUP,
  PROP_SNOOZE
}
enum  saved_props {
  S_SNOOZE,
  S_COUNT
}

Functions

static void alarmd_queue_init (AlarmdQueue *queue)
 This file is part of alarmd.
static void alarmd_queue_class_init (AlarmdQueueClass *klass)
static void _alarmd_queue_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec)
static void _alarmd_queue_get_property (GObject *object, guint param_id, GValue *value, GParamSpec *pspec)
static void _alarmd_queue_real_time_changed (AlarmdObject *object)
static void _alarmd_queue_finalize (GObject *object)
static glong _alarmd_queue_real_add_event (AlarmdQueue *queue, AlarmdEvent *event)
static gboolean _alarmd_queue_real_remove_event (AlarmdQueue *queue, glong event_id)
static AlarmdEvent_alarmd_queue_real_get_event (AlarmdQueue *queue, glong event_id)
static xmlNode * _alarmd_queue_to_xml (AlarmdObject *object)
static void _alarmd_queue_event_dequeued (AlarmdQueue *queue, AlarmdEvent *event)
static void _alarmd_queue_event_queued (AlarmdQueue *queue, gpointer plugin, AlarmdEvent *event)
static void _alarmd_queue_event_changed (AlarmdQueue *queue, AlarmdEvent *event)
static void _alarmd_queue_event_fired (AlarmdQueue *queue, gboolean delayed, AlarmdEvent *event)
static void _alarmd_queue_event_cancelled (AlarmdQueue *queue, AlarmdEvent *event)
static gint _alarmd_event_compare_func (gconstpointer lval, gconstpointer rval)
static AlarmdEvent_alarmd_queue_find_event (GSList *list, glong event_id)
static AlarmdEvent_alarmd_queue_find_first_event (GSList *list, gboolean need_power_up)
static glong * _alarmd_queue_real_query_events (AlarmdQueue *queue, gint64 start_time, gint64 end_time, gint32 flag_mask, gint32 flags, guint *n_events)
static GSList * _alarmd_queue_get_saved_properties (void)
GType alarmd_queue_get_type (void)
 SECTION:queue : Object type to handle the event queue.
AlarmdQueuealarmd_queue_new (void)
 alarmd_queue_new:
gulong alarmd_queue_add_event (AlarmdQueue *queue, AlarmdEvent *event)
 alarmd_queue_add_event: : A AlarmdQueue the should be added into.
gboolean alarmd_queue_remove_event (AlarmdQueue *queue, gulong event_id)
 alarmd_queue_remove_event: : The #AlamrmdQueue from where the event should be removed from.
AlarmdEventalarmd_queue_get_event (AlarmdQueue *queue, gulong event_id)
 alarmd_queue_get_event: : The AlarmdQueue that contains the event.
glong * alarmd_queue_query_events (AlarmdQueue *queue, gint64 start_time, gint64 end_time, gint32 flag_mask, gint32 flags, guint *n_events)
 alarmd_queue_query_events: : The AlarmdQueue that should be queried.
static void _alarmd_queue_remove_event (gpointer object, gpointer queue)
static void _alarmd_queue_event_to_xml (gpointer child, gpointer node)

Variables

static const gchar *const saved_properties [S_COUNT]


Define Documentation

#define ALARMD_QUEUE_GET_PRIVATE obj   ) 
 

Value:

(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
                              ALARMD_TYPE_QUEUE, AlarmdQueuePrivate));

Definition at line 86 of file queue.c.

Referenced by _alarmd_queue_event_cancelled(), _alarmd_queue_event_changed(), _alarmd_queue_event_dequeued(), _alarmd_queue_event_fired(), _alarmd_queue_event_queued(), _alarmd_queue_finalize(), _alarmd_queue_get_property(), _alarmd_queue_real_add_event(), _alarmd_queue_real_get_event(), _alarmd_queue_real_query_events(), _alarmd_queue_real_remove_event(), _alarmd_queue_real_time_changed(), _alarmd_queue_set_property(), _alarmd_queue_to_xml(), and alarmd_queue_init().


Typedef Documentation

typedef struct _AlarmdQueuePrivate AlarmdQueuePrivate
 

Definition at line 75 of file queue.c.


Enumeration Type Documentation

enum properties
 

Enumeration values:
PROP_TIMER 
PROP_TIMER_POWERUP 
PROP_SNOOZE 

Definition at line 59 of file queue.c.

enum saved_props
 

Enumeration values:
S_SNOOZE 
S_COUNT 

Definition at line 65 of file queue.c.


Function Documentation

static gint _alarmd_event_compare_func gconstpointer  lval,
gconstpointer  rval
[static]
 

Definition at line 437 of file queue.c.

References alarmd_event_get_time(), ENTER_FUNC, and LEAVE_FUNC.

Referenced by _alarmd_queue_event_changed(), and _alarmd_queue_real_add_event().

static void _alarmd_queue_event_cancelled AlarmdQueue queue,
AlarmdEvent event
[static]
 

Definition at line 665 of file queue.c.

References _alarmd_queue_event_changed(), _alarmd_queue_event_dequeued(), _alarmd_queue_event_fired(), _alarmd_queue_event_queued(), ALARMD_OBJECT, alarmd_object_changed(), ALARMD_QUEUE_GET_PRIVATE, DEBUG, ENTER_FUNC, _AlarmdQueuePrivate::events, LEAVE_FUNC, and _AlarmdQueuePrivate::pending.

Referenced by _alarmd_queue_real_add_event(), and _alarmd_queue_remove_event().

static void _alarmd_queue_event_changed AlarmdQueue queue,
AlarmdEvent event
[static]
 

Definition at line 627 of file queue.c.

References _alarmd_event_compare_func(), _alarmd_queue_event_dequeued(), ALARMD_EVENT, alarmd_event_dequeue(), ALARMD_OBJECT, alarmd_object_changed(), ALARMD_QUEUE_GET_PRIVATE, ENTER_FUNC, _AlarmdQueuePrivate::events, LEAVE_FUNC, _AlarmdQueuePrivate::pending, and _AlarmdQueuePrivate::queued.

Referenced by _alarmd_queue_event_cancelled(), _alarmd_queue_real_add_event(), and _alarmd_queue_remove_event().

static void _alarmd_queue_event_dequeued AlarmdQueue queue,
AlarmdEvent event
[static]
 

Definition at line 559 of file queue.c.

References _alarmd_queue_find_first_event(), alarmd_event_queue(), ALARMD_QUEUE_GET_PRIVATE, DEBUG, ENTER_FUNC, _AlarmdQueuePrivate::events, LEAVE_FUNC, _AlarmdQueuePrivate::queued, _AlarmdQueuePrivate::queued_powerup, _AlarmdQueuePrivate::timer, and _AlarmdQueuePrivate::timer_powerup.

Referenced by _alarmd_queue_event_cancelled(), _alarmd_queue_event_changed(), _alarmd_queue_event_fired(), _alarmd_queue_real_add_event(), _alarmd_queue_remove_event(), and _alarmd_queue_set_property().

static void _alarmd_queue_event_fired AlarmdQueue queue,
gboolean  delayed,
AlarmdEvent event
[static]
 

Definition at line 650 of file queue.c.

References _alarmd_queue_event_dequeued(), ALARMD_QUEUE_GET_PRIVATE, ENTER_FUNC, _AlarmdQueuePrivate::events, LEAVE_FUNC, and _AlarmdQueuePrivate::pending.

Referenced by _alarmd_queue_event_cancelled(), and _alarmd_queue_real_add_event().

static void _alarmd_queue_event_queued AlarmdQueue queue,
gpointer  plugin,
AlarmdEvent event
[static]
 

Definition at line 612 of file queue.c.

References ALARMD_QUEUE_GET_PRIVATE, ENTER_FUNC, LEAVE_FUNC, _AlarmdQueuePrivate::queued, _AlarmdQueuePrivate::queued_powerup, and _AlarmdQueuePrivate::timer_powerup.

Referenced by _alarmd_queue_event_cancelled(), _alarmd_queue_real_add_event(), and _alarmd_queue_remove_event().

static void _alarmd_queue_event_to_xml gpointer  child,
gpointer  node
[static]
 

Definition at line 450 of file queue.c.

References ALARMD_OBJECT, alarmd_object_to_xml(), ENTER_FUNC, and LEAVE_FUNC.

Referenced by _alarmd_queue_to_xml().

static void _alarmd_queue_finalize GObject *  object  )  [static]
 

Definition at line 321 of file queue.c.

References _alarmd_queue_remove_event(), ALARMD_QUEUE_GET_PRIVATE, ALARMD_TYPE_QUEUE, ENTER_FUNC, _AlarmdQueuePrivate::events, LEAVE_FUNC, and _AlarmdQueuePrivate::pending.

Referenced by alarmd_queue_class_init().

static AlarmdEvent * _alarmd_queue_find_event GSList *  list,
glong  event_id
[static]
 

Definition at line 685 of file queue.c.

References ALARMD_EVENT, ENTER_FUNC, and LEAVE_FUNC.

Referenced by _alarmd_queue_real_add_event(), _alarmd_queue_real_get_event(), and _alarmd_queue_real_remove_event().

static AlarmdEvent * _alarmd_queue_find_first_event GSList *  list,
gboolean  need_power_up
[static]
 

Definition at line 704 of file queue.c.

References ALARMD_EVENT, alarmd_event_need_power_up(), ENTER_FUNC, and LEAVE_FUNC.

Referenced by _alarmd_queue_event_dequeued(), and _alarmd_queue_real_add_event().

static void _alarmd_queue_get_property GObject *  object,
guint  param_id,
GValue *  value,
GParamSpec *  pspec
[static]
 

Definition at line 268 of file queue.c.

References ALARMD_QUEUE_GET_PRIVATE, ENTER_FUNC, LEAVE_FUNC, PROP_SNOOZE, PROP_TIMER, PROP_TIMER_POWERUP, _AlarmdQueuePrivate::snooze, and _AlarmdQueuePrivate::timer.

Referenced by alarmd_queue_class_init().

static GSList * _alarmd_queue_get_saved_properties void   )  [static]
 

Definition at line 763 of file queue.c.

References ALARMD_OBJECT_CLASS, ALARMD_TYPE_EVENT, ENTER_FUNC, LEAVE_FUNC, S_COUNT, and saved_properties.

Referenced by alarmd_queue_class_init().

static glong _alarmd_queue_real_add_event AlarmdQueue queue,
AlarmdEvent event
[static]
 

Definition at line 336 of file queue.c.

References _alarmd_event_compare_func(), _alarmd_queue_event_cancelled(), _alarmd_queue_event_changed(), _alarmd_queue_event_dequeued(), _alarmd_queue_event_fired(), _alarmd_queue_event_queued(), _alarmd_queue_find_event(), _alarmd_queue_find_first_event(), ALARMD_EVENT, alarmd_event_dequeue(), alarmd_event_need_power_up(), ALARMD_QUEUE_GET_PRIVATE, DEBUG, ENTER_FUNC, _AlarmdQueuePrivate::events, LEAVE_FUNC, _AlarmdQueuePrivate::pending, _AlarmdQueuePrivate::queued, _AlarmdQueuePrivate::queued_powerup, and _AlarmdQueuePrivate::timer_powerup.

Referenced by alarmd_queue_class_init().

static AlarmdEvent * _alarmd_queue_real_get_event AlarmdQueue queue,
glong  event_id
[static]
 

Definition at line 422 of file queue.c.

References _alarmd_queue_find_event(), ALARMD_QUEUE_GET_PRIVATE, ENTER_FUNC, _AlarmdQueuePrivate::events, LEAVE_FUNC, and _AlarmdQueuePrivate::pending.

Referenced by alarmd_queue_class_init().

static glong * _alarmd_queue_real_query_events AlarmdQueue queue,
gint64  start_time,
gint64  end_time,
gint32  flag_mask,
gint32  flags,
guint *  n_events
[static]
 

Definition at line 721 of file queue.c.

References ALARMD_EVENT, alarmd_event_get_flags(), alarmd_event_get_time(), ALARMD_QUEUE_GET_PRIVATE, DEBUG, ENTER_FUNC, _AlarmdQueuePrivate::events, LEAVE_FUNC, and _AlarmdQueuePrivate::pending.

Referenced by alarmd_queue_class_init().

static gboolean _alarmd_queue_real_remove_event AlarmdQueue queue,
glong  event_id
[static]
 

Definition at line 401 of file queue.c.

References _alarmd_queue_find_event(), alarmd_event_cancel(), ALARMD_QUEUE_GET_PRIVATE, ENTER_FUNC, _AlarmdQueuePrivate::events, LEAVE_FUNC, and _AlarmdQueuePrivate::pending.

Referenced by alarmd_queue_class_init().

static void _alarmd_queue_real_time_changed AlarmdObject object  )  [static]
 

Definition at line 293 of file queue.c.

References alarmd_object_time_changed(), ALARMD_QUEUE_GET_PRIVATE, ENTER_FUNC, _AlarmdQueuePrivate::events, LEAVE_FUNC, _AlarmdQueuePrivate::pending, _TimerPlugin::time_changed, _AlarmdQueuePrivate::timer, and _AlarmdQueuePrivate::timer_powerup.

Referenced by alarmd_queue_class_init().

static void _alarmd_queue_remove_event gpointer  object,
gpointer  queue
[static]
 

Definition at line 310 of file queue.c.

References _alarmd_queue_event_cancelled(), _alarmd_queue_event_changed(), _alarmd_queue_event_dequeued(), _alarmd_queue_event_queued(), ENTER_FUNC, and LEAVE_FUNC.

Referenced by _alarmd_queue_finalize().

static void _alarmd_queue_set_property GObject *  object,
guint  param_id,
const GValue *  value,
GParamSpec *  pspec
[static]
 

Definition at line 224 of file queue.c.

References _alarmd_queue_event_dequeued(), alarmd_event_dequeue(), alarmd_event_need_power_up(), ALARMD_OBJECT, alarmd_object_changed(), ALARMD_QUEUE, ALARMD_QUEUE_GET_PRIVATE, ENTER_FUNC, LEAVE_FUNC, PROP_SNOOZE, PROP_TIMER, PROP_TIMER_POWERUP, _AlarmdQueuePrivate::queued, _AlarmdQueuePrivate::queued_powerup, _AlarmdQueuePrivate::snooze, _AlarmdQueuePrivate::timer, and _AlarmdQueuePrivate::timer_powerup.

Referenced by alarmd_queue_class_init().

static xmlNode * _alarmd_queue_to_xml AlarmdObject object  )  [static]
 

Definition at line 468 of file queue.c.

References _alarmd_queue_event_to_xml(), alarmd_gparameterv_free(), ALARMD_OBJECT, alarmd_object_get_properties(), alarmd_object_to_xml(), ALARMD_QUEUE_GET_PRIVATE, ENTER_FUNC, _AlarmdQueuePrivate::events, LEAVE_FUNC, _AlarmdQueuePrivate::pending, type_gtypes, type_names, and Y_COUNT.

Referenced by alarmd_queue_class_init().

gulong alarmd_queue_add_event AlarmdQueue queue,
AlarmdEvent event
 

alarmd_queue_add_event: : A AlarmdQueue the should be added into.

: A AlarmdEvent that should be added to the queue.

Adds the to the to be launched at apecified time. Returns: Unique identifier for the event.

Definition at line 128 of file queue.c.

References ALARMD_QUEUE_GET_CLASS, ENTER_FUNC, and LEAVE_FUNC.

Referenced by _dbus_message_in(), and init_queue().

void alarmd_queue_class_init AlarmdQueueClass klass  )  [static]
 

Definition at line 164 of file queue.c.

References _alarmd_queue_finalize(), _alarmd_queue_get_property(), _alarmd_queue_get_saved_properties(), _alarmd_queue_real_add_event(), _alarmd_queue_real_get_event(), _alarmd_queue_real_query_events(), _alarmd_queue_real_remove_event(), _alarmd_queue_real_time_changed(), _alarmd_queue_set_property(), _alarmd_queue_to_xml(), ALARMD_OBJECT_CLASS, ENTER_FUNC, _AlarmdObjectClass::get_saved_properties, LEAVE_FUNC, PROP_SNOOZE, PROP_TIMER, PROP_TIMER_POWERUP, _AlarmdObjectClass::time_changed, and _AlarmdObjectClass::to_xml.

Referenced by alarmd_queue_get_type().

AlarmdEvent* alarmd_queue_get_event AlarmdQueue queue,
gulong  event_id
 

alarmd_queue_get_event: : The AlarmdQueue that contains the event.

: The identifier for the AlarmdEvent.

Finds and returns the wanted event from the queue. The event is still on the queue. Returns: The AlarmdEvent with the wanted identifier or NULL if not found.

Definition at line 146 of file queue.c.

References ALARMD_QUEUE_GET_CLASS, ENTER_FUNC, and LEAVE_FUNC.

Referenced by _dbus_message_in(), and _real_write_data().

GType alarmd_queue_get_type void   ) 
 

SECTION:queue : Object type to handle the event queue.

: AlarmdEvent

The AlarmdQueue handles the AlarmdEvent objects. It has timer plugins that handle the events; one that can power up the device and one that cannot. If only one timer is available, it is used for all events.

Definition at line 91 of file queue.c.

References alarmd_queue_class_init(), alarmd_queue_init(), and ALARMD_TYPE_OBJECT.

static void alarmd_queue_init AlarmdQueue queue  )  [static]
 

This file is part of alarmd.

Contact Person: David Weinehall <david.weinehall@nokia.com>

Copyright (C) 2006 Nokia Corporation alarmd and libalarm are free software; you can redistribute them and/or modify them under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation.

alarmd and libalarm are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this software; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Definition at line 210 of file queue.c.

References ALARMD_QUEUE_GET_PRIVATE, ENTER_FUNC, _AlarmdQueuePrivate::events, LEAVE_FUNC, _AlarmdQueuePrivate::pending, _AlarmdQueuePrivate::queued, _AlarmdQueuePrivate::queued_powerup, _AlarmdQueuePrivate::snooze, _AlarmdQueuePrivate::timer, and _AlarmdQueuePrivate::timer_powerup.

Referenced by alarmd_queue_get_type().

AlarmdQueue* alarmd_queue_new void   ) 
 

alarmd_queue_new:

Creates new alarmd queue. Returns: Newly created AlarmdQueue

Definition at line 119 of file queue.c.

References ALARMD_TYPE_QUEUE, ENTER_FUNC, and LEAVE_FUNC.

Referenced by init_queue().

glong* alarmd_queue_query_events AlarmdQueue queue,
gint64  start_time,
gint64  end_time,
gint32  flag_mask,
gint32  flags,
guint *  n_events
 

alarmd_queue_query_events: : The AlarmdQueue that should be queried.

: Events that launch avter this time should be returned. : Events that launch before this time should be returned. : Bitfield that specifies whchi fields should be checked. : The values wanted for the flags specified in . : Pointer to an integer that should contain the number of events found.

Queries events that occurr between adn with flags chosen with that have values specified in . Returns: Array of identifiers for the found events.

Definition at line 155 of file queue.c.

References ALARMD_QUEUE_GET_CLASS, ENTER_FUNC, and LEAVE_FUNC.

Referenced by _dbus_message_in(), and _real_write_data().

gboolean alarmd_queue_remove_event AlarmdQueue queue,
gulong  event_id
 

alarmd_queue_remove_event: : The #AlamrmdQueue from where the event should be removed from.

: The identifier for the AlarmdEvent.

Removes the event specified by the identifier from the . Returns: TRUE if the event was found and removed, FALSE otherwise.

Definition at line 137 of file queue.c.

References ALARMD_QUEUE_GET_CLASS, ENTER_FUNC, and LEAVE_FUNC.

Referenced by _alarmd_event_set_property(), and _dbus_message_in().


Variable Documentation

const gchar* const saved_properties[S_COUNT] [static]
 

Initial value:

{
        "snooze",
}

Definition at line 70 of file queue.c.


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