|
|
2008-02-20
, 15:33
|
|
Posts: 99 |
Thanked: 65 times |
Joined on Jan 2008
@ Finland
|
#2
|
Also, if I try to check what alarms are set in my program using alarmd commands I get a segfault. -- My program crashes every time at the "list=..."
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <alarmd/alarm_event.h>
int
main(int argc, char **argv)
{
cookie_t *list, *iter;
time_t now;
now = time(NULL);
list = alarm_event_query(now, now + 60, 0, 0);
if (list == NULL) {
fprintf(stderr, "alarm_event_query() failed\n");
return EXIT_FAILURE;
}
if (list[0] == (cookie_t) 0) {
printf("no alarms set\n");
} else {
printf("alarm ids:");
for (iter = list; *iter != (cookie_t) 0; iter++) {
printf(" %u\n", (unsigned int) *iter);
}
printf("\n");
}
free(list);
return EXIT_SUCCESS;
}
|
|
2008-02-20
, 15:34
|
|
|
Posts: 475 |
Thanked: 771 times |
Joined on Dec 2007
@ Hamilton, Ontario, Canada
|
#3
|
|
|
2008-02-21
, 15:56
|
|
|
Posts: 475 |
Thanked: 771 times |
Joined on Dec 2007
@ Hamilton, Ontario, Canada
|
#4
|
|
|
2008-02-28
, 21:02
|
|
|
Posts: 475 |
Thanked: 771 times |
Joined on Dec 2007
@ Hamilton, Ontario, Canada
|
#5
|
run-standalone.sh alarmd
| The Following User Says Thank You to fiferboy For This Useful Post: | ||
|
|
2011-04-27
, 15:55
|
|
Posts: 74 |
Thanked: 34 times |
Joined on Jan 2008
|
#6
|
|
|
2012-08-12
, 22:50
|
|
Posts: 309 |
Thanked: 518 times |
Joined on Oct 2010
|
#7
|
#include <alarmd/libalarm.h>
#include <iostream>
#define APPID "example-apps"
cookie_t MyClass::addAlarmdJob(){
cookie_t cookie = 0;
alarm_event_t *eve = 0;
alarm_action_t *act = 0;
/* Create alarm event structure, set application
* identifier and dialog message */
eve = alarm_event_create();
alarm_event_set_alarm_appid(eve, APPID);
/* Use absolute time triggering, show dialog
* ten seconds from now */
eve->alarm_time = time(0) + 10;
/* Add command*/
act = alarm_event_add_actions(eve,1);
act->flags |= ALARM_ACTION_WHEN_TRIGGERED;
act->flags |= ALARM_ACTION_TYPE_EXEC;
act->exec_command = "phone-control --notify Hello!";
/* Send the alarm to alarmd */
cookie = alarmd_event_add(eve);
std::cout << cookie << std::endl;
/* Free all dynamic memory associated with the*/
//alarm_event_delete(eve); //<-- Invalid pointer exception
return cookie; //Cookie ID of event
}

| The Following User Says Thank You to tetris11_ For This Useful Post: | ||
I have been looking for an easy way to access all the alarms set in chinook. osso_worldclock has a nifty little dialog for viewing/adding/editing/deleting alarms that would be perfect to add to my statusbar clock except that I cannot find the source for osso_worldclock anywhere.
The alarm statusbar plugin uses the same dialog, but its source is also unavailable. Does anyone know if this dialog can be called using a command or dbus? That would be very helpful.
Also, if I try to check what alarms are set in my program using alarmd commands I get a segfault. The following is the code I was using:
Last edited by fiferboy; 2008-02-28 at 21:03.