update for beta universally
[framework/appfw/alarm-manager.git] / test / appsvc-test / alarmmgr_get_info_appsvc.c
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 #include <stdio.h>
24 #include <stdlib.h>
25 #include <glib.h>
26 #include <glib-object.h>
27 #include <dlog/dlog.h>
28 #include <alarm.h>
29 #include <bundle.h>
30 #include <appsvc.h>
31
32
33 alarm_id_t alarm_id;
34
35 void create_test()
36 {
37         time_t current_time;
38         int result;
39         
40         alarm_entry_t * alarm_info;
41
42         alarm_info = alarmmgr_create_alarm();
43
44         bundle *b = NULL;
45
46         b = bundle_create();
47
48         if (NULL == b) {
49                 printf("Unable to create bundle!!!\n");
50                 return;
51         }
52
53         time(&current_time);
54
55         printf("current time: %s\n", ctime(&current_time));
56
57         appsvc_set_operation(b,APPSVC_OPERATION_DEFAULT);
58         appsvc_set_pkgname(b,"org.tizen.alarm-test");
59
60         result =
61             alarmmgr_add_alarm_appsvc(ALARM_TYPE_VOLATILE, 10, 0, (void *)b, &alarm_id);
62
63         printf("Alarm Id is %d\n", alarm_id);
64
65
66         result = alarmmgr_get_info(alarm_id, alarm_info);
67
68         alarm_date_t time={0,};
69         alarmmgr_get_time(alarm_info,&time);
70
71         printf("day is %d\n",time.day);
72
73 }
74
75 int main(int argc, char **argv)
76 {
77         GMainLoop *mainloop;
78         
79         g_type_init();
80
81         mainloop = g_main_loop_new(NULL, FALSE);
82
83         create_test();
84
85         g_main_loop_run(mainloop);
86         
87         return 0;
88 }