#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 }