3e9edf660c50a7233f93967002823e6c3ad52082
[framework/appfw/alarm-manager.git] / include / alarm.h
1 /*
2  *  alarm-manager
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Venkatesha Sarpangala <sarpangala.v@samsung.com>, Jayoun Lee <airjany@samsung.com>,
7  * Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22
23
24
25
26 #ifndef ALARM_LIB_H
27 #define ALARM_LIB_H
28
29 /**
30  * @open
31  * @addtogroup APPLICATION_FRAMEWORK
32  * @{
33  *
34  * @defgroup AlarmManager
35  * @version 0.4.2
36  *
37  *
38  * Alarm  supports APIs that add, delete, and update an alarm.
39  * @n An application can use alarm APIs by including @c alarm.h. The definitions
40  * of APIs are defined as follows:
41  *
42  * @li @c #alarmmgr_init initialize alarm library
43  * @li @c #alarmmgr_set_cb set the callback for an alarm event
44  * @li @c #alarmmgr_create_alarm create an alarm entry
45  * @li @c #alarmmgr_free_alarm free an alarm entry
46  * @li @c #alarmmgr_set_time set a time will be expired
47  * @li @c #alarmmgr_get_time get a time will be expired
48  * @li @c #alarmmgr_set_repeat_mode set repeat mode
49  * @li @c #alarmmgr_get_repeat_mode get repeat mode
50  * @li @c #alarmmgr_set_type set type
51  * @li @c #alarmmgr_get_type get type
52  * @li @c #alarmmgr_add_alarm_with_localtime add an alarm with localtime
53  * @li @c #alarmmgr_add_alarm add an alarm
54  * @li @c #alarmmgr_remove_alarm remove an alarm from alarm server
55  * @li @c #alarmmgr_enum_alarm_ids get the list of alarm ids
56  * @li @c #alarmmgr_get_info get the information of an alarm
57  * @li @c #alarmmgr_fini de-initialize alarm library
58  *
59  *
60  * The following code shows how to initialize alarm library, how to register the alarm handler, and how to add an alarm. It first calls alarm_init to initialize the alarm library and sets the callback to handle an alarm event it received. In create_test fucnction, the application add an alarm which will be expired in one minute from it execute and will expire everyday at same time.
61  *
62  *
63  * @code
64 #include<stdio.h>
65 #include<stdlib.h>
66 #include<glib.h>
67
68 #include "alarm.h"
69
70 int callback(alarm_id_t alarm_id, void *user_param)
71 {
72         int error;
73         time_t current_time;
74         time(&current_time);
75
76         printf("Alarm[%d] has expired at %s\n", alarm_id, ctime(&current_time));
77         return 0;
78 }
79
80 void create_test()
81 {
82         time_t current_time;
83         struct tm current_tm;
84         alarm_entry_t* alarm_info;
85         alarm_id_t alarm_id;
86         int result;
87         alarm_date_t test_time;
88
89         time(&current_time);
90
91         printf("current time: %s\n", ctime(&current_time));
92         localtime_r(&current_time, &current_tm);
93
94         alarm_info = alarmmgr_create_alarm();
95
96         test_time.year = current_tm.tm_year+1900;
97         test_time.month = current_tm.tm_mon+1;
98         test_time.day = current_tm.tm_mday;
99         test_time.hour = current_tm.tm_hour;
100         test_time.min = current_tm.tm_min+1;
101         test_time.sec = 0;
102
103         alarmmgr_set_time(alarm_info,test_time);
104         alarmmgr_set_repeat_mode(alarm_info,ALARM_REPEAT_MODE_WEEKLY,
105         ALARM_WDAY_MONDAY| \
106         ALARM_WDAY_TUESDAY|ALARM_WDAY_WEDNESDAY| \
107         ALARM_WDAY_THURSDAY|ALARM_WDAY_FRIDAY );
108
109         alarmmgr_set_type(alarm_info,ALARM_TYPE_VOLATILE);
110         alarmmgr_add_alarm_with_localtime(alarm_info,NULL,&alarm_id);
111
112         if(result != ALARMMGR_RESULT_SUCCESS)
113                 printf("fail to alarmmgr_create : error_code : %d\n",result);
114
115 }
116
117 int main(int argc, char** argv)
118 {
119         int error_code;
120         GMainLoop *mainloop;
121         int result;
122         g_type_init();
123
124         mainloop = g_main_loop_new(NULL, FALSE);
125         result = alarmmgr_init("org.tizen.test");
126
127         if(result != ALARMMGR_RESULT_SUCCESS) {
128                 printf("fail to alarmmgr_init : error_code : %d\n",result);
129         }
130         else {
131                 result = alarmmgr_set_cb(callback,NULL);
132                 if(result != ALARMMGR_RESULT_SUCCESS) {
133                         printf("fail to alarmmgr_set_cb : error_code :
134                                                         %d\n",result);
135                 }
136                 else {
137                         create_test();
138                 }
139         }
140         g_main_loop_run(mainloop);
141 }
142
143 * @endcode
144 *
145 */
146
147 /**
148  * @addtogroup AlarmManager
149  * @{
150  */
151
152 #include<sys/types.h>
153 #include<stdbool.h>
154
155 #ifdef __cplusplus
156 extern "C" {
157 #endif
158
159 /**
160 * Type of an alarm id
161 */
162 typedef int alarm_id_t;
163 /**
164 * The prototype of alarm handler.
165 * param [in]    alarm_id the id of expired alarm
166 */
167 typedef int (*alarm_cb_t) (alarm_id_t alarm_id, void *user_param);
168
169 typedef int (*alarm_enum_fn_t) (alarm_id_t alarm_id, void *user_param);
170
171 /**
172 * This enumeration has day of a week of alarm
173 */
174 typedef enum {
175         ALARM_WDAY_SUNDAY = 0x01, /**< enalbe alarm on Sunday*/
176         ALARM_WDAY_MONDAY = 0x02, /**< enalbe alarm on Monday*/
177         ALARM_WDAY_TUESDAY = 0x04, /**< enable alarm on Tuesday*/
178         ALARM_WDAY_WEDNESDAY = 0x08, /**< enalbe alarm on Wednesday*/
179         ALARM_WDAY_THURSDAY = 0x10, /**< enable alarm on Thursday*/
180         ALARM_WDAY_FRIDAY = 0x20,  /**< enable alarm on Friday*/
181         ALARM_WDAY_SATURDAY = 0x40,/**< enable alarm on Saturday*/
182 } alarm_day_of_week_t;
183
184 /**
185 * This enumeration has error codes of alarm
186 */
187         typedef enum {
188                 ERR_ALARM_INVALID_PARAM = -10,
189                                      /**<Invalid parameter*/
190                 ERR_ALARM_INVALID_ID,   /**<Invalid id*/
191                 ERR_ALARM_INVALID_REPEAT,
192                                         /**<Invalid repeat mode*/
193                 ERR_ALARM_INVALID_TIME, /**<Invalid time. */
194                 ERR_ALARM_INVALID_DATE, /**<Invalid date. */
195                 ERR_ALARM_NO_SERVICE_NAME,
196                                     /**<there is no alarm service
197                                         for this applicaation. */
198                 ERR_ALARM_INVALID_TYPE,  /*Invalid type*/
199                 ERR_ALARM_NO_PERMISSION, /*No permission*/
200                 ERR_ALARM_SYSTEM_FAIL = -1,
201                 ALARMMGR_RESULT_SUCCESS = 0,
202         } alarm_error_t;
203
204 /**
205 *  This enumeration has repeat mode of alarm
206 */
207 typedef enum {
208         ALARM_REPEAT_MODE_ONCE = 0,     /**<once : the alarm will be expired
209                                         only one time. */
210         ALARM_REPEAT_MODE_REPEAT,       /**<repeat : the alarm will be expired
211                                         repeatly*/
212         ALARM_REPEAT_MODE_WEEKLY,       /**<weekly*/
213         ALARM_REPEAT_MODE_MONTHLY,      /**< monthly*/
214         ALARM_REPEAT_MODE_ANNUALLY,     /**< annually*/
215         ALARM_REPEAT_MODE_MAX,
216 } alarm_repeat_mode_t;
217
218
219 typedef enum {
220         QUANTUMIZE = 0,
221         CUT_OFF,
222 } periodic_method_e;
223
224
225 #define ALARM_TYPE_DEFAULT      0x0     /*< non volatile */
226 #define ALARM_TYPE_VOLATILE     0x02    /*< volatile */
227 #define ALARM_TYPE_NOLAUNCH 0x04        /*<without launch */
228
229
230 /**
231 * This struct has date information
232 */
233 typedef struct {
234         int year;               /**< specifies the year */
235         int month;              /**< specifies the month */
236         int day;                /**< specifies the day */
237         int hour;               /**< specifies the hour */
238         int min;                /**< specifies the minute*/
239         int sec;                /**< specifies the second*/
240 } alarm_date_t;
241
242
243 typedef struct alarm_info_t alarm_entry_t;
244
245
246 /**
247  *
248  * This function initializes alarm library. It connects to system bus and registers the application's service name.
249  *
250  * @param       [in]    pkg_name        a package of application
251  *
252  * @return On success, ALARMMGR_RESULT_SUCCESS is returned. On error, a negative number is returned
253  *
254  * @pre None.
255  * @post None.
256  * @see None.
257  * @remark An application must call this function before using other alarm APIs.
258  * @par Sample code:
259  * @code
260 #include <alarm.h>
261
262 ...
263 {
264         int ret_val = ALARMMGR_RESULT_SUCCESS;
265         const char* pkg_name = "org.tizen.test";
266
267         g_type_init();
268
269         ret_val =alarmmgr_init(pkg_name) ;
270         if(ret_val == ALARMMGR_RESULT_SUCCESS)
271         {
272                  //alarmmgr_init() is successful
273         }
274         else
275         {
276                  //alarmmgr_init () failed
277         }
278 }
279  * @endcode
280  * @limo
281  */
282 int alarmmgr_init(const char *appid);
283
284 /**
285  *
286  * This function de-initializes alarm library. It un-registers the application's service name and dis-connects from system bus.
287  *
288  * @param       None
289  *
290  * @return      None
291  *
292  * @pre         Alarm manager is initialized
293  * @post        Alarm manager is de-initialized
294  * @remark An application must call this function once it is done with alarmmanger usage
295  * @par Sample code:
296  * @code
297 #include <alarm.h>
298
299 ...
300 {
301         // Initialize alarmmanager
302         // Set alarm
303
304         alarmmgr_fini() ;
305 }
306  * @endcode
307  */
308
309 void alarmmgr_fini();
310
311
312 /**
313  * This function registers handler which handles an alarm event. An application should register the alarm handler
314  * before it enters mainloop.
315  *
316  * @param       [in]    handler Callback function
317  * @param       [in]    user_param      User Parameter
318  *
319  * @return      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
320  *
321  * @pre alarmmgr_init().
322  * @post None.
323  * @see None.
324  * @remark      An application can have only one alarm handler. If an application
325  *          calls this function more than one times, the handler regitered during  the
326  *          last call of this funiction will be called when an alarm event has occured.
327  * @par Sample code:
328  * @code
329 #include <alarm.h>
330 ...
331
332 // Call back function
333 int callback(alarm_id_t alarm_id,void* user_param)
334 {
335         time_t current_time;
336         time(&current_time);
337
338         printf("Alarm[%d] has expired at %s\n", alarm_id, ctime(&current_time));
339
340         return 0;
341
342 }
343
344 ...
345 {
346         int ret_val = ALARMMGR_RESULT_SUCCESS;
347         void *user_param = NULL;
348
349         ret_val = alarmmgr_set_cb( callback, user_param);
350         if(ret_val == ALARMMGR_RESULT_SUCCESS)
351         {
352                 //alarmmgr_set_cb() is successful
353         }
354         else
355         {
356                  //alarmmgr_set_cb () failed
357         }
358 }
359
360  * @endcode
361  * @limo
362  */
363 int alarmmgr_set_cb(alarm_cb_t handler, void *user_param);
364
365
366 /**
367  * This function creates a new alarm entry, will not be known to the server until alarmmgr_add_alarm is called.
368  *
369  * @return      This function returns the pointer of alarm_entry_t
370  *
371  * @pre None.
372  * @post None.
373  * @see None.
374  * @remark      After an application use this object, an application free this pointer through alarmmgr_free_alarm
375  *
376  * @par Sample code:
377  * @code
378 #include <alarm.h>
379
380 ...
381 {
382         alarm_entry_t* alarm;
383
384         alarm = alarmmgr_create_alarm() ;
385         if(alarm != NULL)
386         {
387                  //alarmmgr_create_alarm() is successful
388         }
389         else
390         {
391                  //alarmmgr_create_alarm () failed
392         }
393 }
394
395
396  * @endcode
397  * @limo
398  */
399 alarm_entry_t *alarmmgr_create_alarm(void);
400
401
402 /**
403  * This function frees an alarm entry.
404  *
405  * @param       [in]    alarm   alarm entry
406  *
407  * @return      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
408  *
409  * @pre None.
410  * @post None.
411  * @see None.
412  * @remark      None.
413  *
414  * @par Sample code:
415  * @code
416 #include <alarm.h>
417
418 ...
419  {
420          int ret_val = ALARMMGR_RESULT_SUCCESS;
421          alarm_entry_t* alarm;
422
423          alarm = alarmmgr_create_alarm() ;
424          if(alarm == NULL)
425          {
426                   //alarmmgr_create_alarm () failed
427          }
428          else
429                  {
430
431                          ret_val = alarmmgr_free_alarm( alarm) ;
432                          if(ret_val == ALARMMGR_RESULT_SUCCESS)
433                          {
434                                   //alarmmgr_free_alarm() is successful
435                          }
436                          else
437                          {
438                                  //alarmmgr_free_alarm() failed
439                          }
440                  }
441  }
442
443  * @endcode
444  * @limo
445  */
446 int alarmmgr_free_alarm(alarm_entry_t *alarm);
447
448
449 /**
450  * This function sets time that alarm should be expried.
451  *
452  * @param       [in]    alarm   alarm entry
453  * @param       [in]    time            time the alarm should first go off
454  *
455  * @return      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
456  *
457  * @pre None.
458  * @post None.
459  * @see None.
460  * @remark  None.
461  *
462  * @par Sample code:
463  * @code
464 #include <alarm.h>
465
466  ...
467   {
468           int ret_val = ALARMMGR_RESULT_SUCCESS;
469           alarm_entry_t* alarm;
470           time_t current_time;
471           struct tm current_tm;
472           alarm_date_t test_time;
473
474
475          time(&current_time);
476          localtime_r(&current_time, &current_tm);
477
478          alarm = alarmmgr_create_alarm();
479           if(alarm == NULL)
480           {
481                    //alarmmgr_create_alarm () failed
482           }
483           else {
484                 test_time.year = current_tm.tm_year;
485                 test_time.month = current_tm.tm_mon;
486                 test_time.day = current_tm.tm_mday;
487
488                 test_time.hour = current_tm.tm_hour;
489                 test_time.min = current_tm.tm_min+1;
490                 test_time.sec = 0;
491
492                 ret_val=alarmmgr_set_time(alarm,test_time);
493                 if(ret_val == ALARMMGR_RESULT_SUCCESS)
494                 {
495                         //alarmmgr_set_time() is successful
496                 }
497                 else
498                 {
499                         //alarmmgr_set_time() failed
500                 }
501                           alarmmgr_free_alarm( alarm) ;
502           }
503  }
504
505  * @endcode
506  * @limo
507  */
508 int alarmmgr_set_time(alarm_entry_t *alarm, alarm_date_t time);
509
510 /**
511  * This function gives an application time that alarm should be expried.
512  *
513  * @param       [in]            alarm   alarm entry
514  * @param       [out]   time            time the alarm should first go off
515  *
516  * @return      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
517  *
518  * @pre None.
519  * @post None.
520  * @see None.
521  * @remark      But an application does not need to specify year, month, and day field of alarm_info. If an application sets
522  *                      those fields with zero, the function sets them with proper values.
523  *
524  * @par Sample code:
525  * @code
526 #include <alarm.h>
527
528  ...
529  {
530          int ret_val = ALARMMGR_RESULT_SUCCESS;
531          alarm_entry_t* alarm;
532
533          time_t current_time;
534                 struct tm current_tm;
535          alarm_date_t test_time;
536          alarm_date_t new_time;
537
538
539                 time(&current_time);
540                 localtime_r(&current_time, &current_tm);
541
542                 alarm = alarmmgr_create_alarm();
543          if(alarm == NULL) {
544                   //alarmmgr_create_alarm () failed
545          }
546          else {
547                 test_time.year = current_tm.tm_year;
548                 test_time.month = current_tm.tm_mon;
549                 test_time.day = current_tm.tm_mday;
550
551                 test_time.hour = current_tm.tm_hour;
552                 test_time.min = current_tm.tm_min+1;
553                 test_time.sec = 0;
554
555                 ret_val = alarmmgr_set_time(alarm,test_time);
556                 if(ret_val == ALARMMGR_RESULT_SUCCESS) {
557                         //alarmmgr_set_time() is successful
558                 }
559                 else {
560                         //alarmmgr_set_time() failed
561                 }
562
563                 ret_val = alarmmgr_get_time(alarm, &new_time);
564                 if(ret_val == ALARMMGR_RESULT_SUCCESS) {
565                         //alarmmgr_get_time() is successful
566                 }
567                 else {
568                         //alarmmgr_get_time() failed
569                 }
570                 alarmmgr_free_alarm( alarm) ;
571         }
572  }
573
574  * @endcode
575  * @limo
576  */
577 int alarmmgr_get_time(const alarm_entry_t *alarm, alarm_date_t *time);
578
579 /**
580  * This function sets an alarm repeat mode
581  *
582  * @param       [in]    alarm   alarm entry
583  * @param       [in]    repeat_mode     one of ALARM_REPEAT_MODE_ONCE, ALARM_REPEAT_MODE_REPEAT,
584  *                                                              ALARM_REPEAT_MODE_WEEKLY, ALARM_REPEAT_MODE_MONTHLY or ALARM_REPEAT_MODE_ANNUALLY.
585  * @param       [in]    repeat_value    the ALARM_REPEAT_MODE_REPEAT mode : interval between subsequent repeats of the alarm.
586  *                                                              the ALARM_REPEAT_MODE_WEEKLY mode : days of a week
587  *                                                              (ALARM_WDAY_SUNDAY, ALARM_WDAY_MONDAY, ALARM_WDAY_TUESDAY,      ALARM_WDAY_WEDNESDAY,
588  *                                                              ALARM_WDAY_THURSDAY,    ALARM_WDAY_FRIDAY, ALARM_WDAY_SATURDAY)
589  *                                                              the others : this parameter is ignored.
590  *
591  * @return      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
592  *
593  * @pre None.
594  * @post None.
595  * @see None.
596  * @remark  None.
597  *
598  * @par Sample code:
599  * @code
600 #include <alarm.h>
601
602   ...
603  {
604          int ret_val = ALARMMGR_RESULT_SUCCESS;
605          alarm_entry_t* alarm;
606          alarm_repeat_mode_t repeat_mode =ALARM_REPEAT_MODE_WEEKLY;
607          int interval = ALARM_WDAY_MONDAY; //| ALARM_WDAY_TUESDAY|
608                 ALARM_WDAY_WEDNESDAY| ALARM_WDAY_THURSDAY|ALARM_WDAY_FRIDAY ;
609
610
611          alarm = alarmmgr_create_alarm();
612          if(alarm == NULL)
613          {
614                   //alarmmgr_create_alarm () failed
615          }
616          else
617                  {
618                            ret_val = alarmmgr_set_repeat_mode
619                                         (alarm, repeat_mode,interval);
620
621                          if(ret_val == ALARMMGR_RESULT_SUCCESS)
622                          {
623                                   //alarmmgr_set_repeat_mode() is successful
624                          }
625                          else
626                          {
627                                  //alarmmgr_set_repeat_mode() failed
628                          }
629                          alarmmgr_free_alarm( alarm) ;
630                  }
631  }
632
633  * @endcode
634  * @limo
635  */
636 int alarmmgr_set_repeat_mode(alarm_entry_t *alarm,
637                                      alarm_repeat_mode_t repeat_mode,
638                                      int repeat_value);
639
640 /**
641  * This function gives an application an alarm mode
642  *
643  * @param       [in]            alarm   alarm entry
644  * @param       [out]   repeat_mode     one of ALARM_REPEAT_MODE_ONCE, ALARM_REPEAT_MODE_REPEAT,
645  *                                                                      ALARM_REPEAT_MODE_WEEKLY, ALARM_REPEAT_MODE_MONTHLY or ALARM_REPEAT_MODE_ANNUALLY.
646  * @param       [out]   repeat_value    the ALARM_REPEAT_MODE_REPEAT mode : interval between subsequent repeats of the alarm.
647  *                                                                      the ALARM_REPEAT_MODE_WEEKLY mode : days of a week
648  *                                                                      (ALARM_WDAY_SUNDAY, ALARM_WDAY_MONDAY, ALARM_WDAY_TUESDAY,      ALARM_WDAY_WEDNESDAY,
649  *                                                                      ALARM_WDAY_THURSDAY,    ALARM_WDAY_FRIDAY, ALARM_WDAY_SATURDAY)
650  *                                                                      the others : this parameter is ignored.
651  *
652  * @return      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
653  *
654  * @pre None.
655  * @post None.
656  * @see None.
657  * @remark  None.
658  *
659  * @par Sample code:
660  * @code
661 #include <alarm.h>
662
663    ...
664  {
665          int ret_val = ALARMMGR_RESULT_SUCCESS;
666          alarm_entry_t* alarm;
667          alarm_repeat_mode_t repeat;
668          int interval;
669
670          alarm = alarmmgr_create_alarm();
671          if(alarm == NULL)
672          {
673                  //alarmmgr_create_alarm () failed
674          }
675          else {
676                 ret_val =alarmmgr_get_repeat_mode
677                                         (alarm, &repeat, &interval) ;
678                          if(ret_val == ALARMMGR_RESULT_SUCCESS
679                         && repeat == ALARM_REPEAT_MODE_ONCE) {
680                                 //alarmmgr_get_repeat_mode() is successful
681                         }
682                         else {
683                                 //alarmmgr_get_repeat_mode() failed
684                         }
685                         alarmmgr_free_alarm(alarm) ;
686         }
687  }
688
689  * @endcode
690  * @limo
691  */
692 int alarmmgr_get_repeat_mode(const alarm_entry_t *alarm,
693                                      alarm_repeat_mode_t *repeat_mode,
694                                      int *repeat_value);
695
696 /**
697  * This function sets an alarm mode
698  *
699  * @param       [in]    alarm   alarm entry
700  * @param       [in]    alarm_type      one of ALARM_TYPE_DEFAULT : After the device reboot, the alarm still works.
701  *                                                      ALARM_TYPE_VOLATILE : After the device reboot, the alarm does not work.
702  *
703  * @return      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
704  *
705  * @pre None.
706  * @post None.
707  * @see None.
708  * @remark  None.
709  *
710  * @par Sample code:
711  * @code
712 #include <alarm.h>
713
714    ...
715  {
716          int ret_val = ALARMMGR_RESULT_SUCCESS;
717          alarm_entry_t* alarm;
718          int alarm_type = ALARM_TYPE_VOLATILE;
719
720          alarm = alarmmgr_create_alarm();
721          if(alarm == NULL)
722          {
723                   //alarmmgr_create_alarm () failed
724          }
725          else
726                  {
727                          ret_val = alarmmgr_set_type(alarm,  alarm_type);
728                          if(ret_val == ALARMMGR_RESULT_SUCCESS)
729                          {
730                                   //alarmmgr_set_type() is successful
731                          }
732                          else
733                          {
734                                   //alarmmgr_set_type() failed
735                          }
736                          alarmmgr_free_alarm( alarm) ;
737                  }
738  }
739
740  * @endcode
741  * @limo
742  */
743 int alarmmgr_set_type(alarm_entry_t *alarm, int alarm_type);
744
745 /**
746  * This function gives an application an alarm mode
747  *
748  * @param       [in]            alarm   alarm entry
749  * @param       [out]   alarm_type      one of ALARM_TYPE_DEFAULT, ALARM_TYPE_VOLATILE
750  *
751  * @return      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
752  *
753  * @pre None.
754  * @post None.
755  * @see None.
756  * @remark  None.
757  *
758  * @par Sample code:
759  * @code
760 #include <alarm.h>
761
762    ...
763  {
764         int ret_val = ALARMMGR_RESULT_SUCCESS;
765         alarm_entry_t* alarm;
766         int alarm_type;
767
768         alarm = alarmmgr_create_alarm();
769         if(alarm == NULL) {
770                 //alarmmgr_create_alarm () failed
771         }
772         else {
773                 ret_val = alarmmgr_get_type(  alarm, &alarm_type);
774                 if(ret_val == ALARMMGR_RESULT_SUCCESS && alarm_type
775                                                 == ALARM_TYPE_DEFAULT ) {
776                         //alarmmgr_get_type() is successful
777                 }
778                 else {
779                         //alarmmgr_get_type() failed
780                 }
781                 alarmmgr_free_alarm( alarm) ;
782         }
783  }
784
785  * @endcode
786  * @limo
787  */
788 int alarmmgr_get_type(const alarm_entry_t *alarm, int *alarm_type);
789
790 /**
791  * This function adds an alarm entry to the server.
792  * Server will remember this entry, and generate alarm events for it when necessary.
793  * Server will call app-svc interface to sent notification to destination application. Destination information
794  * should be available in the input bundle.
795  * Alarm entries registered with the server cannot be changed.
796  * Remove from server before changing.
797  * Before the application calls alarmmgr_add_alarm_appsvc_with_localtime(), the application have to call alarmmgr_set_time().
798  * The time set is localtime.
799  * If the application does not call alarmmgr_set_repeat_mode, the default repeat_mode is ALARM_REPEAT_MODE_ONCE.
800  * If the application does not call alarmmgr_set_type, the default alarm_type is ALARM_TYPE_DEFAULT.
801  * The id of the new alarm will be copied to  alarm_id if the fuction successes to create an alarm.
802  *
803  * @param       [in]            alarm           the entry of an alarm to be created.
804  * @param       [in]            bundle_data     bundle which contains information about the destination.
805  * @param       [out]           alarm_id        the id of the alarm added.
806  *
807  * @return      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
808  *
809  * @pre None.
810  * @post None.
811  * @see alarmmgr_add_alarm
812  * @remark  None.
813  *
814  * @par Sample code:
815  * @code
816 #include <alarm.h>
817
818    ...
819 {
820     time_t current_time;
821     struct tm current_tm;
822     alarm_entry_t* alarm_info;
823     alarm_id_t alarm_id;
824     int result;
825     alarm_date_t test_time;
826
827
828         bundle *b=NULL;
829
830         b=bundle_create();
831
832         if (NULL == b)
833         {
834                 printf("Unable to create bundle!!!\n");
835                 return;
836         }
837
838         appsvc_set_operation(b,APPSVC_OPERATION_DEFAULT);
839         appsvc_set_pkgname(b,"org.tizen.alarm-test");
840
841     time(&current_time);
842
843     printf("current time: %s\n", ctime(&current_time));
844     localtime_r(&current_time, &current_tm);
845
846     alarm_info = alarmmgr_create_alarm();
847
848     test_time.year = current_tm.tm_year;
849                         test_time.month = current_tm.tm_mon;
850                         test_time.day = current_tm.tm_mday;
851
852                         test_time.hour = current_tm.tm_hour;
853                         test_time.min = current_tm.tm_min+1;
854                         test_time.sec = 5;
855
856
857     alarmmgr_set_time(alarm_info,test_time);
858     alarmmgr_set_repeat_mode(alarm_info,ALARM_REPEAT_MODE_WEEKLY,ALARM_WDAY_MONDAY| \
859                 ALARM_WDAY_TUESDAY|ALARM_WDAY_WEDNESDAY| \
860                 ALARM_WDAY_THURSDAY|ALARM_WDAY_FRIDAY );
861
862     alarmmgr_set_type(alarm_info, ALARM_TYPE_DEFAULT);
863     //alarmmgr_set_type(alarm_info,ALARM_TYPE_VOLATILE);
864     if ((result = alarmmgr_add_alarm_appsvc_with_localtime(alarm_info,(void *)b,&alarm_id)) < 0)
865         {
866                 printf("Alarm creation failed!!! Alrmgr error code is %d\n",result);
867         }
868         else
869         {
870                 printf("Alarm created succesfully with alarm id %d\n",alarm_id);
871         }
872
873 }
874  * @endcode
875  * @limo
876  */
877 int alarmmgr_add_alarm_appsvc_with_localtime(alarm_entry_t *alarm,void *bundle_data, alarm_id_t *alarm_id);
878
879 /**
880  * This function adds an alarm entry to the server.
881  * Server will remember this entry, and generate alarm events for it when necessary.
882  * Alarm entries registered with the server cannot be changed.
883  * Remove from server before changing.
884  * Before the application calls alarmmgr_add_alarm_with_localtime(), the application have to call alarmmgr_set_time().
885  * The time set is localtime.
886  * If the application does not call alarmmgr_set_repeat_mode, the default repeat_mode is ALARM_REPEAT_MODE_ONCE.
887  * If the application does not call alarmmgr_set_type, the default alarm_type is ALARM_TYPE_DEFAULT.
888  * The id of the new alarm will be copied to  alarm_id if the fuction successes to create an alarm.
889  *
890  * @param       [in]            alarm           the entry of an alarm to be created.
891  * @param       [in]            destination     the packname of application that the alarm will be expired.
892  * @param       [out]   alarm_id                the id of the alarm added.
893  *
894  * @return      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
895  *
896  * @pre None.
897  * @post None.
898  * @see alarmmgr_add_alarm
899  * @remark  None.
900  *
901  * @par Sample code:
902  * @code
903 #include <alarm.h>
904
905    ...
906 {
907         int ret_val = ALARMMGR_RESULT_SUCCESS;
908         alarm_entry_t* alarm;
909         const char* destination = NULL;
910         alarm_id_t alarm_id;
911
912         time_t current_time;
913         struct tm current_tm;
914         alarm_date_t test_time;
915
916         const char* pkg_name = "org.tizen.test";
917
918         g_type_init();
919
920         ret_val =alarmmgr_init(pkg_name) ;
921         if(ret_val != ALARMMGR_RESULT_SUCCESS) {
922                 //alarmmgr_init () failed
923                 return;
924         }
925
926         time(&current_time);
927
928         printf("current time: %s\n", ctime(&current_time));
929         localtime_r(&current_time, &current_tm);
930
931         alarm = alarmmgr_create_alarm();
932
933         test_time.year = 0;
934         test_time.month = 0;test_time.day = 0;
935
936         test_time.hour = current_tm.tm_hour;
937         test_time.min = current_tm.tm_min+1;
938         test_time.sec = 0;
939
940
941          alarmmgr_set_time(alarm,test_time);
942          alarmmgr_set_repeat_mode(alarm,ALARM_REPEAT_MODE_WEEKLY, \
943                                         ALARM_WDAY_MONDAY);
944          alarmmgr_set_type(alarm,ALARM_TYPE_VOLATILE);
945
946
947         ret_val=alarmmgr_add_alarm_with_localtime(alarm,destination,&alarm_id);
948
949          if(ret_val == ALARMMGR_RESULT_SUCCESS)
950          {
951                   //alarmmgr_add_alarm_with_localtime() is successful
952          }
953          else
954          {
955                   //alarmmgr_add_alarm_with_localtime() failed
956          }
957          alarmmgr_free_alarm( alarm) ;
958  }
959  * @endcode
960  * @limo
961  */
962 int alarmmgr_add_alarm_with_localtime(alarm_entry_t *alarm,
963                                               const char *destination,
964                                               alarm_id_t *alarm_id);
965
966
967 /**
968  * This function adds an alarm entry to the server.
969  * Server will remember this entry, and generate alarm events for it when necessary.
970  * Server will call app-svc interface to sent notification to destination application. Destination information
971  * should be available in the input bundle.
972  * Alarm entries registered with the server cannot be changed.
973  * Remove from server before changing.
974  * After the trigger_at_time seconds from now, the alarm will be expired.
975  * If the interval is zero, the repeat_mode is ALARM_REPEAT_MODE_ONCE.
976  * If the interval is >0, the repeat_mode is ALARM_REPEAT_MODE_REPEAT.
977  * The id of the new alarm will be copied to  alarm_id if the fuction successes to create an alarm.
978  *
979  * @param       [in]            alarm_type              one of ALARM_TYPE_DEFAULT, ALARM_TYPE_VOLATILE
980  * @param       [in]            trigger_at_time time interval to be triggered from now(sec). an alarm also will be expired at triggering time.
981  * @param       [in]            interval                Interval between subsequent repeats of the alarm
982  * @param       [in]            bundle_data             bundle which contains information about the destination.
983  * @param       [out]   alarm_id                        the id of the alarm added.
984  *
985  * @return      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
986  *
987  * @pre None.
988  * @post None.
989  * @see alarmmgr_add_alarm_with_localtime alarmmgr_remove_alarm
990  * @remark  None.
991  *
992  * @par Sample code:
993  * @code
994 #include <alarm.h>
995
996  ...
997  {
998                 int result;
999                 alarm_id_t alarm_id;
1000
1001                 bundle *b=NULL;
1002
1003                 b=bundle_create();
1004
1005                 if (NULL == b)
1006                 {
1007                         printf("Unable to create bundle!!!\n");
1008                         return;
1009                 }
1010
1011                 appsvc_set_pkgname(b,"org.tizen.alarm-test");
1012                 //appsvc_set_operation(b,APPSVC_OPERATION_SEND_TEXT);
1013                 appsvc_set_operation(b,APPSVC_OPERATION_DEFAULT);
1014
1015                 if ((result = alarmmgr_add_alarm_appsvc(ALARM_TYPE_DEFAULT, 10, 0, (void *)b ,&alarm_id)))
1016                         printf("Unable to add alarm. Alarmmgr alarm no is %d\n", result);
1017                 else
1018                         printf("Alarm added successfully. Alarm Id is %d\n", alarm_id);
1019                 return;
1020
1021  }
1022
1023  * @endcode
1024  * @limo
1025  */
1026 int alarmmgr_add_alarm_appsvc(int alarm_type, time_t trigger_at_time,
1027                                time_t interval, void *bundle_data,
1028                                alarm_id_t *alarm_id);
1029
1030
1031 /**
1032  * This function adds an alarm entry to the server.
1033  * Server will remember this entry, and generate alarm events for it when necessary.
1034  * Alarm entries registered with the server cannot be changed.
1035  * Remove from server before changing.
1036  * After the trigger_at_time seconds from now, the alarm will be expired.
1037  * If the interval is zero, the repeat_mode is ALARM_REPEAT_MODE_ONCE.
1038  * If the interval is >0, the repeat_mode is ALARM_REPEAT_MODE_REPEAT.
1039  * The id of the new alarm will be copied to  alarm_id if the fuction successes to create an alarm.
1040  *
1041  * @param       [in]            alarm_type              one of ALARM_TYPE_DEFAULT, ALARM_TYPE_VOLATILE
1042  * @param       [in]            trigger_at_time time interval to be triggered from now(sec). an alarm also will be expired at triggering time.
1043  * @param       [in]            interval                        Interval between subsequent repeats of the alarm
1044  * @param       [in]            destination             the packname of application that the alarm will be expired.
1045  * @param       [out]   alarm_id                        the id of the alarm added.
1046  *
1047  * @return      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
1048  *
1049  * @pre None.
1050  * @post None.
1051  * @see alarmmgr_add_alarm_with_localtime alarmmgr_remove_alarm
1052  * @remark  None.
1053  *
1054  * @par Sample code:
1055  * @code
1056 #include <alarm.h>
1057
1058  ...
1059  {
1060          int ret_val = ALARMMGR_RESULT_SUCCESS;
1061
1062          int alarm_type = ALARM_TYPE_VOLATILE;
1063          time_t trigger_at_time = 10;
1064          time_t interval = 10;
1065          const char* destination = NULL;
1066          alarm_id_t alarm_id;
1067
1068          const char* pkg_name = "org.tizen.test";
1069
1070          g_type_init();
1071
1072          ret_val =alarmmgr_init(pkg_name) ;
1073          if(ret_val != ALARMMGR_RESULT_SUCCESS)
1074          {
1075                   //alarmmgr_init () failed
1076                   return;
1077          }
1078
1079          ret_val = alarmmgr_add_alarm( alarm_type, trigger_at_time, interval,
1080                                         destination, &alarm_id);
1081          if(ret_val == ALARMMGR_RESULT_SUCCESS)
1082          {
1083                   //alarmmgr_add_alarm() is successful
1084          }
1085          else
1086          {
1087                    //alarmmgr_add_alarm() failed
1088          }
1089          alarmmgr_remove_alarm( alarm_id) ;
1090  }
1091
1092  * @endcode
1093  * @limo
1094  */
1095 int alarmmgr_add_alarm(int alarm_type, time_t trigger_at_time,
1096                                time_t interval, const char *destination,
1097                                alarm_id_t *alarm_id);
1098
1099 /**
1100  * This function deletes the alarm associated with the given alarm_id.
1101  *
1102  * @param       [in]    alarm_id        Specifies the ID of the alarm to be deleted.
1103  *
1104  * @return      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
1105  *
1106  * @pre None.
1107  * @post None.
1108  * @see alarmmgr_add_alarm_with_localtime alarmmgr_add_alarm
1109  * @remark  None.
1110  *
1111  * @par Sample code:
1112  * @code
1113 #include <alarm.h>
1114
1115  ...
1116  {
1117         int ret_val = ALARMMGR_RESULT_SUCCESS;
1118         int alarm_type = ALARM_TYPE_VOLATILE;
1119         time_t trigger_at_time = 10;
1120         time_t interval = 10;
1121         const char* destination = NULL;
1122         alarm_id_t alarm_id;
1123
1124         const char* pkg_name = "org.tizen.test";
1125
1126         g_type_init();
1127
1128         ret_val =alarmmgr_init(pkg_name) ;
1129         if(ret_val != ALARMMGR_RESULT_SUCCESS) {
1130                 //alarmmgr_init () failed
1131                 return;
1132         }
1133
1134         alarmmgr_add_alarm( alarm_type,  trigger_at_time, interval,
1135                                                 destination, &alarm_id);
1136
1137         ret_val =alarmmgr_remove_alarm( alarm_id) ;
1138         if(ret_val == ALARMMGR_RESULT_SUCCESS) {
1139                 /alarmmgr_remove_alarm() is successful
1140         }
1141         else {
1142                 //alarmmgr_remove_alarm() failed
1143         }
1144  }
1145
1146  * @endcode
1147  * @limo
1148  */
1149 int alarmmgr_remove_alarm(alarm_id_t alarm_id);
1150
1151 /**
1152  * This function deletes all registered alarms
1153  *
1154  * @return      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
1155  */
1156 int alarmmgr_remove_all(void);
1157
1158 /**
1159  * This function gives a list of alarm ids that the application adds to the server.
1160  *
1161  * @param       [in]    fn                      a user callback function
1162  * @param       [in]    user_param      user parameter
1163  *
1164  * @return                      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
1165  *
1166  * @pre None.
1167  * @post None.
1168  * @see alarm_get_info
1169  * @remark  None.
1170  *
1171  * @par Sample code:
1172  * @code
1173 #include <alarm.h>
1174
1175  int callback_2(alarm_id_t id, void* user_param)
1176  {
1177          int* n = (int*)user_param;
1178          printf("[%d]alarm id : %d\n",*n,id);
1179          (*n)++;
1180          return 0;
1181  }
1182
1183 ...
1184  {
1185          int ret_val = ALARMMGR_RESULT_SUCCESS;
1186          int n = 1;
1187
1188          const char* pkg_name = "org.tizen.test";
1189
1190          g_type_init();
1191
1192          ret_val =alarmmgr_init(pkg_name) ;
1193          if(ret_val != ALARMMGR_RESULT_SUCCESS)
1194          {
1195                   //alarmmgr_init() failed
1196                   return;
1197          }
1198
1199          ret_val = alarmmgr_enum_alarm_ids( callback_2, (void*)&n) ;
1200          if(ret_val == ALARMMGR_RESULT_SUCCESS)
1201          {
1202                    //alarmmgr_enum_alarm_ids() is successful
1203          }
1204          else
1205          {
1206                  //alarmmgr_enum_alarm_ids() failed
1207          }
1208  }
1209
1210  * @endcode
1211  * @limo
1212  */
1213 int alarmmgr_enum_alarm_ids(alarm_enum_fn_t fn, void *user_param);
1214
1215
1216 /**
1217  * This function gets the information of the alarm assosiated with alarm_id to alarm_info. The application
1218  * must allocate alarm_info before calling this function.
1219  *
1220  * @param       [in]    alarm_id                the id of the alarm
1221  * @param       [out]   alarm   the buffer alarm informaiton will be copied to
1222  *
1223  * @return                      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
1224  *
1225  * @pre None.
1226  * @post None.
1227  * @see alarmmgr_enum_alarm_ids
1228  * @remark  None.
1229  *
1230  * @par Sample code:
1231  * @code
1232 #include <alarm.h>
1233
1234 ...
1235  {
1236         int ret_val = ALARMMGR_RESULT_SUCCESS;
1237         int alarm_type = ALARM_TYPE_VOLATILE;
1238         time_t trigger_at_time = 10;
1239         time_t interval = ALARM_WDAY_SUNDAY;
1240         const char* destination = NULL;
1241         alarm_id_t alarm_id;
1242
1243         alarm_entry_t *alarm;
1244
1245         const char* pkg_name = "org.tizen.test_get_info1";
1246
1247         g_type_init();
1248
1249         ret_val =alarmmgr_init(pkg_name) ;
1250         if(ret_val != ALARMMGR_RESULT_SUCCESS) {
1251                 //alarmmgr_init() failed
1252                 return;
1253         }
1254         ret_val = alarmmgr_add_alarm( alarm_type,trigger_at_time,interval,
1255                         destination, &alarm_id);
1256
1257         if(ret_val != ALARMMGR_RESULT_SUCCESS) {
1258                 //alarmmgr_add_alarm() failed
1259                 return;
1260         }
1261         ret_val = alarmmgr_get_info(alarm_id, alarm);
1262         if(ret_val == ALARMMGR_RESULT_SUCCESS) {
1263                 //alarmmgr_get_info() is successful
1264         }
1265         else {
1266                 //alarmmgr_get_info() failed
1267         }
1268         alarmmgr_remove_alarm( alarm_id) ;
1269  }
1270  * @endcode
1271  * @limo
1272  */
1273 int alarmmgr_get_info(alarm_id_t alarm_id, alarm_entry_t *alarm);
1274
1275
1276 /**
1277  * This function retrieves bundle associated with alarm.
1278  * Server will remember this entry, and pass the bundle information upon alarm expiry.
1279  * Server will call app-svc interface to sent notification to destination application. Destination information
1280  * should be available in the input bundle.
1281  * @param       [in]            alarm_id                alarm id
1282  * @param       [out]           ALARMMGR_RESULT_SUCCESS on success or negative number on failure.
1283  *
1284  * @return      This function returns bundle on success or NULL on failure.
1285  *
1286  * @pre None.
1287  * @post None.
1288  * @see None
1289  * @remark  None.
1290  *
1291  * @par Sample code:
1292  * @code
1293 #include <alarm.h>
1294
1295  ...
1296
1297 alarm_id_t alarm_id;
1298
1299 register_alarm(){
1300         int result;
1301         bundle *b=NULL;
1302         b=bundle_create();
1303
1304         if (NULL == b)
1305         {
1306                 printf("Unable to create bundle!!!\n");
1307                 return;
1308         }
1309
1310         appsvc_set_pkgname(b,"org.tizen.alarm-test");
1311         appsvc_set_operation(b,APPSVC_OPERATION_DEFAULT);
1312
1313         if ((result = alarmmgr_add_alarm_appsvc(ALARM_TYPE_DEFAULT, 10, 0, (void *)b ,&alarm_id)))
1314                 printf("Unable to add alarm. Alarmmgr alarm no is %d\n", result);
1315         else
1316                 printf("Alarm added successfully. Alarm Id is %d\n", alarm_id);
1317 }
1318 int main(int argc,char **argv {
1319         register_alarm();
1320
1321         int return_code = 0;
1322         bundle *b = NULL;
1323         b = alarmmgr_get_alarm_appsvc_info(alarm_id, &return_code);
1324         if (b){
1325                 const char *pkgname = appsvc_get_pkgname(b);
1326                 if (pkgname){
1327                         printf("Package name is %s\n",pkgname);
1328                 }
1329         }
1330
1331         return 0;
1332
1333  }
1334  * @endcode
1335  * @limo
1336  */
1337 void *alarmmgr_get_alarm_appsvc_info(alarm_id_t alarm_id, int *return_code);
1338
1339 /**
1340  * This function gets the scheduled time of the alarm assosiated with alarm_id.
1341  *
1342  * @param       [in]    alarm_id                the id of the alarm
1343  * @param       [out]   duetime the scheduled time of the alarm
1344  *
1345  * @return                      This function returns ALARMMGR_RESULT_SUCCESS on success or a negative number on failure.
1346  *
1347  * @pre None.
1348  * @post None.
1349  * @see None
1350  * @remark  None.
1351  */
1352  int alarmmgr_get_next_duetime(alarm_id_t alarm_id, time_t* duetime);
1353
1354 /**
1355  * This function sets power RTC (which can power on the system).
1356  * @param       [in]            alarm_date_t            time
1357  *
1358  * @return      This function returns the result. On success, ALARMMGR_RESULT_SUCCESS will be returned
1359  *              else, appropriate error no will be returned.
1360  * @pre None.
1361  * @post None.
1362  * @see None
1363  * @remark  None.
1364  *
1365  * @par Sample code:
1366  * @code
1367 #include <alarm.h>
1368
1369  ...
1370
1371 alarm_date_t alarm_date={2012,04,05,10,10,00};
1372
1373 int main(int argc,char **argv {
1374         int return_code = 0;
1375         return_code = alarmmgr_set_rtc_time(&alarm_date);
1376         if (return_code != ALARMMGR_RESULT_SUCCESS){
1377                 printf("Error returned is %d\n",return_code);
1378         }
1379         return 0;
1380
1381  }
1382  * @endcode
1383  * @limo
1384  */
1385 int alarmmgr_set_rtc_time(alarm_date_t *time);
1386
1387 /**
1388  * This function changes the system time which tranferred by other module
1389  * @param       [in]            new_time                epoch time to be set
1390  *
1391  * @return      @c ALARMMGR_RESULT_SUCCESS on success,
1392  *                      otherwise a negative error value
1393  * @retval      #ALARMMGR_RESULT_SUCCESS        Successful
1394  * @retval      #ERR_ALARM_SYSTEM_FAIL          System failure
1395  */
1396 int alarmmgr_set_systime(int new_time);
1397
1398 /**
1399  * This function changes the timezone which tranferred by other module
1400  * @param       [in]            tzpath_str      the path to timezone definition file
1401  *
1402  * @return      @c ALARMMGR_RESULT_SUCCESS on success,
1403  *                      otherwise a negative error value
1404  * @retval      #ALARMMGR_RESULT_SUCCESS        Successful
1405  * @retval      #ERR_ALARM_INVALID_PARAM        Invalid parameter
1406  * @retval      #ERR_ALARM_SYSTEM_FAIL          System failure
1407  */
1408 int alarmmgr_set_timezone(char *tzpath_str);
1409
1410
1411 int alarmmgr_add_alarm_withcb(int alarm_type, time_t trigger_at_time,
1412                                   time_t interval, alarm_cb_t handler, void *user_param, alarm_id_t *alarm_id);
1413
1414 int alarmmgr_add_periodic_alarm_withcb(int interval, periodic_method_e method, alarm_cb_t handler,
1415                 void *user_param, alarm_id_t *alarm_id);
1416
1417 int alarmmgr_add_reference_periodic_alarm_withcb(int interval, alarm_cb_t handler,
1418                 void *user_param, alarm_id_t *alarm_id);
1419
1420
1421 #ifdef __cplusplus
1422 }
1423 #endif
1424
1425
1426 #endif/* ALARM_LIB_H*/