a9ce8edbdd3febfb03864afb215a647e34dce2b5
[platform/core/api/notification.git] / include / notification_private.h
1 /*
2  * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __NOTIFICATION_PRIVATE_H__
18 #define __NOTIFICATION_PRIVATE_H__
19 #include <sys/types.h>
20 #include <notification_internal.h>
21
22 #ifndef EXPORT_API
23 #define EXPORT_API __attribute__ ((visibility("default")))
24 #endif
25
26 #define SAFE_STRDUP(s) ((s) ? strdup(s) : NULL)
27 #define SAFE_FREE(s)                    \
28         do {                            \
29                 if (s) {                \
30                         free(s);        \
31                         s = NULL;       \
32                 }                       \
33         } while (0)
34
35 struct _notification {
36         notification_type_e type;
37         notification_ly_type_e layout;
38
39         int group_id;           /* Group ID */
40         int internal_group_id;  /* Internal Group ID */
41         int priv_id;            /* Private ID */
42
43         char *pkg_id;
44         char *caller_app_id;    /* Caller App ID */
45         char *launch_app_id;    /* Launch App ID */
46         bundle *args;           /* Will be removed. */
47         bundle *group_args;     /* Will be removed. */
48
49         bundle *b_execute_option;
50         bundle *b_service_responding;
51         bundle *b_service_single_launch;
52         bundle *b_service_multi_launch;
53
54         bundle *b_event_handler[NOTIFICATION_EVENT_TYPE_MAX+1];
55
56         char *domain;           /* Text domain for localization */
57         char *dir;              /* Text dir for localization */
58
59         bundle *b_text;         /* basic text */
60         bundle *b_key;          /* key for localized text */
61         bundle *b_format_args;  /* args type and value for format string */
62         int num_format_args;    /* number of format string args */
63
64         bundle *b_image_path;   /* image path */
65         bundle *b_priv_image_path;      /* resource path for image */
66
67         notification_sound_type_e sound_type;
68         char *sound_path;
69         char *priv_sound_path; /* resource path for sound */
70         notification_vibration_type_e vibration_type;
71         char *vibration_path;
72         char *priv_vibration_path; /* resource path for vibration */
73         notification_led_op_e led_operation;
74         int led_argb;
75         int led_on_ms;
76         int led_off_ms;
77
78         time_t time;            /* time set by application */
79         time_t insert_time;     /* insert time */
80
81         int flags_for_property; /* property NOTIFICATION_PROP_XXX */
82         int display_applist;    /* display app list  NOTIFICATION_DISPLAY_APP_XXX */
83
84         double progress_size;   /* size of progress */
85         double progress_percentage;     /* percentage of progress */
86
87         char *app_icon_path;    /* Temporary stored app icon path from AIL */
88         char *app_label;
89         char *temp_title;
90         char *temp_content;
91         char *tag;
92         bool ongoing_flag;
93         int ongoing_value_type;
94         int ongoing_current;            /* Ongoing current time */
95         int ongoing_duration;           /* Ongoing duration time */
96         bool auto_remove;
97         notification_button_index_e default_button_index;
98         int hide_timeout;               /* Time for hide in banner */
99         int delete_timeout;             /* Time for delete in view notification */
100         int text_input_max_length;
101         bool event_flag;
102         bool is_translation;
103         int extension_image_size;
104
105         uid_t uid;
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_PKG_ID,
115         NOTIFICATION_DATA_TYPE_CALLER_APP_ID,
116         NOTIFICATION_DATA_TYPE_LAUNCH_APP_ID,
117         NOTIFICATION_DATA_TYPE_ARGS,
118         NOTIFICATION_DATA_TYPE_GROUP_ARGS,
119         NOTIFICATION_DATA_TYPE_EXECUTE_OPTION,
120         NOTIFICATION_DATA_TYPE_SERVICE_RESPONDING,
121         NOTIFICATION_DATA_TYPE_SERVICE_SINGLE_LAUNCH,
122         NOTIFICATION_DATA_TYPE_SERVICE_MULTI_LAUNCH,
123         NOTIFICATION_DATA_TYPE_BUTTON1_EVENT,
124         NOTIFICATION_DATA_TYPE_BUTTON2_EVENT,
125         NOTIFICATION_DATA_TYPE_BUTTON3_EVENT,
126         NOTIFICATION_DATA_TYPE_BUTTON4_EVENT,
127         NOTIFICATION_DATA_TYPE_BUTTON5_EVENT,
128         NOTIFICATION_DATA_TYPE_BUTTON6_EVENT,
129         NOTIFICATION_DATA_TYPE_ICON_EVENT,
130         NOTIFICATION_DATA_TYPE_THUMBNAIL_EVENT,
131         NOTIFICATION_DATA_TYPE_TEXT_INPUT_BUTTON_EVENT,
132         NOTIFICATION_DATA_TYPE_BUTTON7_EVENT,
133         NOTIFICATION_DATA_TYPE_BUTTON8_EVENT,
134         NOTIFICATION_DATA_TYPE_BUTTON9_EVENT,
135         NOTIFICATION_DATA_TYPE_BUTTON10_EVENT,
136         NOTIFICATION_DATA_TYPE_DOMAIN,
137         NOTIFICATION_DATA_TYPE_DIR,
138         NOTIFICATION_DATA_TYPE_TEXT,
139         NOTIFICATION_DATA_TYPE_KEY,
140         NOTIFICATION_DATA_TYPE_FORMAT_ARGS,
141         NOTIFICATION_DATA_TYPE_NUM_FORMAT_ARGS,
142         NOTIFICATION_DATA_TYPE_IMAGE_PATH,
143         NOTIFICATION_DATA_TYPE_PRIV_IMAGE_PATH,
144         NOTIFICATION_DATA_TYPE_SOUND_TYPE,
145         NOTIFICATION_DATA_TYPE_SOUND_PATH,
146         NOTIFICATION_DATA_TYPE_PRIV_SOUND_PATH,
147         NOTIFICATION_DATA_TYPE_VIBRATION_TYPE,
148         NOTIFICATION_DATA_TYPE_VIBRATION_PATH,
149         NOTIFICATION_DATA_TYPE_PRIV_VIBRATION_PATH,
150         NOTIFICATION_DATA_TYPE_LED_OPERATION,
151         NOTIFICATION_DATA_TYPE_LED_ARGB,
152         NOTIFICATION_DATA_TYPE_LED_ON_MS,
153         NOTIFICATION_DATA_TYPE_LED_OFF_MS,
154         NOTIFICATION_DATA_TYPE_TIME,
155         NOTIFICATION_DATA_TYPE_INSERT_TIME,
156         NOTIFICATION_DATA_TYPE_FLAGS_FOR_PROPERTY,
157         NOTIFICATION_DATA_TYPE_DISPLAY_APPLIST,
158         NOTIFICATION_DATA_TYPE_PROGRESS_SIZE,
159         NOTIFICATION_DATA_TYPE_PROGRESS_PERCENTAGE,
160         NOTIFICATION_DATA_TYPE_APP_ICON_PATH,
161         NOTIFICATION_DATA_TYPE_APP_LABEL,
162         NOTIFICATION_DATA_TYPE_TEMP_TITLE,
163         NOTIFICATION_DATA_TYPE_TEMP_CONTENT,
164         NOTIFICATION_DATA_TYPE_TAG,
165         NOTIFICATION_DATA_TYPE_ONGOING_FLAG,
166         NOTIFICATION_DATA_TYPE_ONGOING_VALUE_TYPE,
167         NOTIFICATION_DATA_TYPE_ONGOING_CURRENT,
168         NOTIFICATION_DATA_TYPE_ONGOING_DURATION,
169         NOTIFICATION_DATA_TYPE_AUTO_REMOVE,
170         NOTIFICATION_DATA_TYPE_DEFAULT_BUTTON,
171         NOTIFICATION_DATA_TYPE_HIDE_TIMEOUT,
172         NOTIFICATION_DATA_TYPE_DELETE_TIMEOUT,
173         NOTIFICATION_DATA_TYPE_TEXT_INPUT_MAX_LENGTH,
174         NOTIFICATION_DATA_TYPE_EVENT_FLAG,
175         NOTIFICATION_DATA_TYPE_TRANSLATION,
176         NOTIFICATION_DATA_TYPE_EXTENSION_IMAGE_SIZE,
177         NOTIFICATION_DATA_TYPE_UID,
178 } notification_data_type_e;
179
180 void notification_call_changed_cb_for_uid(notification_op *op_list, int op_num, uid_t uid);
181 void notification_call_dnd_changed_cb_for_uid(int do_not_disturb, uid_t uid);
182 void notification_call_event_handler_cb(notification_h noti, int event_type);
183 void notification_delete_event_handler_cb(int priv_id);
184 char *notification_get_app_id_by_pid(int pid);
185
186 #endif /* __NOTIFICATION_PRIVATE_H__ */
187