Using gdbus for IPC instead of com-core package
[platform/core/api/notification.git] / include / notification_private.h
1 /*
2  *  libnotification
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef __NOTIFICATION_PRIVATE_H__
23 #define __NOTIFICATION_PRIVATE_H__
24
25 #ifndef EXPORT_API
26 #define EXPORT_API __attribute__ ((visibility("default")))
27 #endif
28
29 #define SAFE_STRDUP(s) \
30                 ({\
31         char* _s = (char*)s;\
32         (_s)? strdup(_s) : NULL;\
33 })
34
35 #define SAFE_FREE(s) \
36                 ({\
37         if (s) {\
38                 free(s);\
39                 s = NULL;\
40         }\
41 })
42
43 #define NOTIFICATION_SETTING_DB_TABLE "notification_setting"
44 #define NOTIFICATION_SYSTEM_SETTING_DB_TABLE "notification_system_setting"
45
46 struct _notification {
47         notification_type_e type;
48         notification_ly_type_e layout;
49
50         int group_id;           /* Group ID */
51         int internal_group_id;  /* Internal Group ID */
52         int priv_id;            /* Private ID */
53
54         char *caller_pkgname;   /* Caller App package name */
55         char *launch_pkgname;   /* Launch App package name. It will be from appsvc_set_pkgname */
56         bundle *args;           /* Will be removed. */
57         bundle *group_args;     /* Will be removed. */
58
59         bundle *b_execute_option;
60         bundle *b_service_responding;
61         bundle *b_service_single_launch;
62         bundle *b_service_multi_launch;
63
64         bundle *b_event_handler[NOTIFICATION_EVENT_TYPE_MAX];
65
66         char *domain;           /* Text domain for localization */
67         char *dir;              /* Text dir for localization */
68
69         bundle *b_text;         /* basic text */
70         bundle *b_key;          /* key for localized text */
71         bundle *b_format_args;  /* args type and value for format string */
72         int num_format_args;    /* number of format string args */
73
74         bundle *b_image_path;   /* image path */
75
76         notification_sound_type_e sound_type;
77         char *sound_path;
78         notification_vibration_type_e vibration_type;
79         char *vibration_path;
80         notification_led_op_e led_operation;
81         int led_argb;
82         int led_on_ms;
83         int led_off_ms;
84
85         time_t time;            /* time set by application */
86         time_t insert_time;     /* insert time */
87
88         int flags_for_property; /* property NOTIFICATION_PROP_XXX */
89         int display_applist;    /* display app list  NOTIFICATION_DISPLAY_APP_XXX */
90
91         double progress_size;   /* size of progress */
92         double progress_percentage;     /* percentage of progress */
93
94         char *app_icon_path;    /* Temporary stored app icon path from AIL */
95         char *app_name;         /* Temporary stored app name from AIL */
96         char *temp_title;
97         char *temp_content;
98         char *tag;
99         bool ongoing_flag;
100         bool auto_remove;
101 };
102
103 struct notification_system_setting {
104         bool do_not_disturb;
105         int  visibility_class;
106 };
107
108 typedef enum notification_data_type {
109     NOTIFICATION_DATA_TYPE_NOTI_TYPE = 1,
110     NOTIFICATION_DATA_TYPE_LAYOUT,
111     NOTIFICATION_DATA_TYPE_GROUP_ID,
112     NOTIFICATION_DATA_TYPE_INTERNAL_GROUP_ID,
113     NOTIFICATION_DATA_TYPE_PRIV_ID,
114     NOTIFICATION_DATA_TYPE_CALLER_PKGNAME,
115     NOTIFICATION_DATA_TYPE_LAUNCH_PKGNAME,
116     NOTIFICATION_DATA_TYPE_ARGS,
117     NOTIFICATION_DATA_TYPE_GROUP_ARGS,
118     NOTIFICATION_DATA_TYPE_EXECUTE_OPTION,
119     NOTIFICATION_DATA_TYPE_SERVICE_RESPONDING,
120     NOTIFICATION_DATA_TYPE_SERVICE_SINGLE_LAUNCH,
121     NOTIFICATION_DATA_TYPE_SERVICE_MULTI_LAUNCH,
122     NOTIFICATION_DATA_TYPE_BUTTON1_EVENT,
123     NOTIFICATION_DATA_TYPE_BUTTON2_EVENT,
124     NOTIFICATION_DATA_TYPE_BUTTON3_EVENT,
125     NOTIFICATION_DATA_TYPE_BUTTON4_EVENT,
126     NOTIFICATION_DATA_TYPE_BUTTON5_EVENT,
127     NOTIFICATION_DATA_TYPE_BUTTON6_EVENT,
128     NOTIFICATION_DATA_TYPE_ICON_EVENT,
129     NOTIFICATION_DATA_TYPE_THUMBNAIL_EVENT,
130     NOTIFICATION_DATA_TYPE_DOMAIN,
131     NOTIFICATION_DATA_TYPE_DIR,
132     NOTIFICATION_DATA_TYPE_TEXT,
133     NOTIFICATION_DATA_TYPE_KEY,
134     NOTIFICATION_DATA_TYPE_FORMAT_ARGS,
135     NOTIFICATION_DATA_TYPE_NUM_FORMAT_ARGS,
136     NOTIFICATION_DATA_TYPE_IMAGE_PATH,
137     NOTIFICATION_DATA_TYPE_SOUND_TYPE,
138     NOTIFICATION_DATA_TYPE_SOUND_PATH,
139     NOTIFICATION_DATA_TYPE_VIBRATION_TYPE,
140     NOTIFICATION_DATA_TYPE_VIBRATION_PATH,
141     NOTIFICATION_DATA_TYPE_LED_OPERATION,
142     NOTIFICATION_DATA_TYPE_LED_ARGB,
143     NOTIFICATION_DATA_TYPE_LED_ON_MS,
144     NOTIFICATION_DATA_TYPE_LED_OFF_MS,
145     NOTIFICATION_DATA_TYPE_TIME,
146     NOTIFICATION_DATA_TYPE_INSERT_TIME,
147     NOTIFICATION_DATA_TYPE_FLAGS_FOR_PROPERTY,
148     NOTIFICATION_DATA_TYPE_DISPLAY_APPLIST,
149     NOTIFICATION_DATA_TYPE_PROGRESS_SIZE,
150     NOTIFICATION_DATA_TYPE_PROGRESS_PERCENTAGE,
151     NOTIFICATION_DATA_TYPE_APP_ICON_PATH,
152     NOTIFICATION_DATA_TYPE_APP_NAME,
153     NOTIFICATION_DATA_TYPE_TEMP_TITLE,
154     NOTIFICATION_DATA_TYPE_TEMP_CONTENT,
155     NOTIFICATION_DATA_TYPE_TAG,
156     NOTIFICATION_DATA_TYPE_ONGOING_FLAG,
157     NOTIFICATION_DATA_TYPE_AUTO_REMOVE,
158 } notification_data_type_e;
159
160 void notification_call_changed_cb(notification_op *op_list, int op_num);
161
162 char *notification_get_pkgname_by_pid(void);
163
164 #endif                          /* __NOTIFICATION_PRIVATE_H__ */