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