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

include/alarm_event.h File Reference

#include <stdint.h>
#include <time.h>

Include dependency graph for alarm_event.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef long cookie_t
 cookie_t:

Enumerations

enum  alarmeventflags {
  ALARM_EVENT_NO_DIALOG = 1 << 0,
  ALARM_EVENT_NO_SNOOZE = 1 << 1,
  ALARM_EVENT_SYSTEM = 1 << 2,
  ALARM_EVENT_BOOT = 1 << 3,
  ALARM_EVENT_ACTDEAD = 1 << 4,
  ALARM_EVENT_SHOW_ICON = 1 << 5,
  ALARM_EVENT_RUN_DELAYED = 1 << 6,
  ALARM_EVENT_CONNECTED = 1 << 7,
  ALARM_EVENT_ACTIVATION = 1 << 8,
  ALARM_EVENT_POSTPONE_DELAYED = 1 << 9,
  ALARM_EVENT_BACK_RESCHEDULE = 1 << 10
}
 alarmeventflags: : The alarm event should not show a dialog. More...
enum  alarm_error_t {
  ALARMD_SUCCESS,
  ALARMD_ERROR_DBUS,
  ALARMD_ERROR_CONNECTION,
  ALARMD_ERROR_INTERNAL,
  ALARMD_ERROR_MEMORY,
  ALARMD_ERROR_ARGUMENT
}

Functions

cookie_t alarm_event_add (alarm_event_t *event)
 alarm_event_add: : alarm_event_t struct describing the event to be added.
int alarm_event_del (cookie_t event_cookie)
 alarm_event_del: : Unique identifier of the alarm to be removed.
cookie_talarm_event_query (const time_t first, const time_t last, int32_t flag_mask, int32_t flags)
 alarm_event_query: : Alarms happening after this time will be returned.
alarm_event_talarm_event_get (cookie_t event_cookie)
 alarm_event_get: : Unique identifier of the alarm.
void alarm_event_free (alarm_event_t *event)
 alarm_event_free: : The alarm_event struct to be free'd.
char * alarm_escape_string (const char *string)
 alarm_escape_string: : The string that should be escaped.
char * alarm_unescape_string (const char *string)
 alarm_unescape_string: : The string that should be unescaped.
char * alarm_unescape_string_noalloc (char *string)
 alarm_unescape_string_noalloc: : The string that should be unescaped.
alarm_error_t alarmd_get_error (void)
 alarmd_get_error:
int alarmd_set_default_snooze (unsigned int snooze)
 alarmd_set_default_snooze: : The preferred snooze time in minutes.
unsigned int alarmd_get_default_snooze (void)
 alarmd_get_default_snooze:


Typedef Documentation

typedef long cookie_t
 

cookie_t:

Unique identifier type for the alarm events.

Definition at line 41 of file alarm_event.h.


Enumeration Type Documentation

enum alarm_error_t
 

Enumeration values:
ALARMD_SUCCESS 
ALARMD_ERROR_DBUS 
ALARMD_ERROR_CONNECTION 
ALARMD_ERROR_INTERNAL 
ALARMD_ERROR_MEMORY 
ALARMD_ERROR_ARGUMENT 

Definition at line 82 of file alarm_event.h.

enum alarmeventflags
 

alarmeventflags: : The alarm event should not show a dialog.

: The alarm dialog shoud not have snooze enabled. : The dbus call should be done on system bus. : The event should boot up the system, if powered off. : The device should only be powered to acting dead mode. : The event should show a icon in the status bar. : The event should be launched on next startup, if missed or immediately if jumped over. : The event should be launched only when connected to the internet. : The dbus action should use DBus activation. : The event should be postponed to next day if miesed or jumped over. : The event should be moved backwards, if the time is moved backwards. Applies only to recurring events.

Describes alarm event. These should be bitwise orred to the flags field in alarm_event_t.

Enumeration values:
ALARM_EVENT_NO_DIALOG 
ALARM_EVENT_NO_SNOOZE 
ALARM_EVENT_SYSTEM 
ALARM_EVENT_BOOT 
ALARM_EVENT_ACTDEAD 
ALARM_EVENT_SHOW_ICON 
ALARM_EVENT_RUN_DELAYED 
ALARM_EVENT_CONNECTED 
ALARM_EVENT_ACTIVATION 
ALARM_EVENT_POSTPONE_DELAYED 
ALARM_EVENT_BACK_RESCHEDULE 

Definition at line 64 of file alarm_event.h.


Function Documentation

char* alarm_escape_string const char *  string  ) 
 

alarm_escape_string: : The string that should be escaped.

Escapes a string to be used as alarm dialog message or title. All { and } characters will be escaped with backslash and all backslashes will be duplicated. Returns: Newly allocated string, should be freed with free().

Definition at line 560 of file alarm_event.c.

References strspncount().

cookie_t alarm_event_add alarm_event_t event  ) 
 

alarm_event_add: : alarm_event_t struct describing the event to be added.

Adds an event to the alarm queue. If event->exec_name and event->dbus_path are NULL, the alarm will be only show a dialog (unless ALARM_EVENT_NO_DIALOG is set in flags, in which case, the event does nothing). If only event->dbus_path is NULL, the alarm will run a program at given time (and show a dialog unless otherwise instructed). If recurrence > 0, the alarm will repeat recurrence_count times. If snooze_time is zero, default of 10 minutes is used. Returns: Unique identifier for the alarm, or 0 on failure.

Definition at line 180 of file alarm_event.c.

References ACTION, ALARM_EVENT_ADD, alarm_event_t::alarm_time, ALARMD_ERROR_ARGUMENT, ALARMD_ERROR_CONNECTION, ALARMD_ERROR_DBUS, ALARMD_ERROR_INTERNAL, ALARMD_ERROR_MEMORY, ALARMD_INTERFACE, ALARMD_PATH, ALARMD_SERVICE, ALARMD_SUCCESS, APPEND_ARG, conn, alarm_event_t::dbus_interface, alarm_event_t::dbus_name, alarm_event_t::dbus_path, alarm_event_t::dbus_service, error_code, alarm_event_t::exec_name, alarm_event_t::flags, FLAGS, ICON, alarm_event_t::icon, INTERFACE, MESSAGE, alarm_event_t::message, NAME, NULL0, PATH, property, RECURRENCE, alarm_event_t::recurrence, RECURRENCE_COUNT, alarm_event_t::recurrence_count, SERVICE, alarm_event_t::snooze, SNOOZE_INT, SOUND, alarm_event_t::sound, TIME, TITLE, alarm_event_t::title, and ZERO0.

Referenced by main(), and tool_add().

int alarm_event_del cookie_t  event_cookie  ) 
 

alarm_event_del: : Unique identifier of the alarm to be removed.

Deletes alarm from the alarm queue. The alarm with the event_cookie identifier will be removed from the alarm queue, if it exists. Returns: 1 If alarm was on the queue, 0 otherwise.

Definition at line 304 of file alarm_event.c.

References _alarm_event_dbus_call(), ALARM_EVENT_DEL, ALARMD_ERROR_INTERNAL, ALARMD_SUCCESS, and error_code.

Referenced by main(), and tool_remove().

void alarm_event_free alarm_event_t event  ) 
 

alarm_event_free: : The alarm_event struct to be free'd.

Frees given alarm_event struct. Will free all memory associated with the alarm_event struct.

Definition at line 507 of file alarm_event.c.

References alarm_event_t::dbus_interface, alarm_event_t::dbus_name, alarm_event_t::dbus_path, alarm_event_t::dbus_service, alarm_event_t::exec_name, alarm_event_t::icon, alarm_event_t::message, alarm_event_t::sound, and alarm_event_t::title.

Referenced by main().

alarm_event_t* alarm_event_get cookie_t  event_cookie  ) 
 

alarm_event_get: : Unique identifier of the alarm.

Fetches alarm defails. Finds an alarm with given identifier and returns alarm_event struct describing it. Returns: Newly allocated alarm_event struct, should be free'd with alarm_event_free().

Definition at line 392 of file alarm_event.c.

References _alarm_event_dbus_call(), _get_id(), ACTION, ALARM_EVENT_GET, alarm_event_t::alarm_time, ALARMD_ERROR_INTERNAL, ALARMD_SUCCESS, alarm_event_t::dbus_interface, dbus_message_iter_get_string, alarm_event_t::dbus_name, alarm_event_t::dbus_path, error_code, alarm_event_t::exec_name, alarm_event_t::flags, FLAGS, alarm_event_t::icon, ICON, INTERFACE, alarm_event_t::message, MESSAGE, NAME, PATH, alarm_event_t::recurrence, RECURRENCE, alarm_event_t::recurrence_count, RECURRENCE_COUNT, SNOOZE, alarm_event_t::snooze, SNOOZE_INT, alarm_event_t::snoozed, alarm_event_t::sound, SOUND, TIME, alarm_event_t::title, and TITLE.

Referenced by main(), and tool_get().

cookie_t* alarm_event_query const time_t  first,
const time_t  last,
int32_t  flag_mask,
int32_t  flags
 

alarm_event_query: : Alarms happening after this time will be returned.

: Alarms: happening before this time will be returned. : A mask describing which flags you're interested in. Pass 0 to get all events. : Values for the flags you're querying.

Queries alarms in given time span. Finds every alarm whose _next_ occurence time is between first and last. Returns: Newly allocated, zero-terminated list of alarm id's, should be free()'d.

Definition at line 341 of file alarm_event.c.

References _alarm_event_dbus_call(), ALARM_EVENT_QUERY, ALARMD_ERROR_INTERNAL, ALARMD_SUCCESS, and error_code.

Referenced by main(), and tool_list().

char* alarm_unescape_string const char *  string  ) 
 

alarm_unescape_string: : The string that should be unescaped.

Unescapes a string escaped with alarm_escape_string. Returns: Newly allocated string, should be freed with free().

Definition at line 615 of file alarm_event.c.

References _alarm_do_unescape(), strchrcount(), and strstrcount().

char* alarm_unescape_string_noalloc char *  string  ) 
 

alarm_unescape_string_noalloc: : The string that should be unescaped.

Unescapes a string escaped with alarm_escape_string. Note, is modified. Returns: .

Definition at line 604 of file alarm_event.c.

References _alarm_do_unescape().

unsigned int alarmd_get_default_snooze void   ) 
 

alarmd_get_default_snooze:

Gets the amount events will be snoozed by default. Returns: The preferred snooze time in minutes.

Definition at line 679 of file alarm_event.c.

References _alarm_event_dbus_call(), ALARMD_ERROR_ARGUMENT, ALARMD_ERROR_INTERNAL, ALARMD_SNOOZE_GET, ALARMD_SUCCESS, and error_code.

alarm_error_t alarmd_get_error void   ) 
 

alarmd_get_error:

Gets the error code for previous action.

Definition at line 634 of file alarm_event.c.

References error_code.

int alarmd_set_default_snooze unsigned int  snooze  ) 
 

alarmd_set_default_snooze: : The preferred snooze time in minutes.

Sets the amount events will be snoozed by default. Returns: 1 on success, 0 on failure.

Definition at line 639 of file alarm_event.c.

References _alarm_event_dbus_call(), ALARMD_ERROR_ARGUMENT, ALARMD_ERROR_INTERNAL, ALARMD_SNOOZE_SET, ALARMD_SUCCESS, and error_code.


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