2d292ea482cbbba95b0158b566a0fd25dbd241fc
[platform/core/api/notification.git] / include / notification_private.h
1 /*
2  * Copyright (c) 2000 - 2016 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
20 #ifndef EXPORT_API
21 #define EXPORT_API __attribute__ ((visibility("default")))
22 #endif
23
24 #define SAFE_STRDUP(s) ((s) ? strdup(s) : NULL)
25 #define SAFE_FREE(s)                    \
26         do {                            \
27                 if (s) {                \
28                         free(s);        \
29                         s = NULL;       \
30                 }                       \
31         } while (0)
32
33 #define NOTIFICATION_SETTING_DB_TABLE "notification_setting"
34 #define NOTIFICATION_SYSTEM_SETTING_DB_TABLE "notification_system_setting"
35
36 struct _notification {
37         notification_type_e type;
38         notification_ly_type_e layout;
39
40         int group_id;           /* Group ID */
41         int internal_group_id;  /* Internal Group ID */
42         int priv_id;            /* Private ID */
43
44         char *caller_pkgname;   /* Caller App package name */
45         char *launch_pkgname;   /* Launch App package name. It will be from appsvc_set_pkgname */
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];
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
66         notification_sound_type_e sound_type;
67         char *sound_path;
68         notification_vibration_type_e vibration_type;
69         char *vibration_path;
70         notification_led_op_e led_operation;
71         int led_argb;
72         int led_on_ms;
73         int led_off_ms;
74
75         time_t time;            /* time set by application */
76         time_t insert_time;     /* insert time */
77
78         int flags_for_property; /* property NOTIFICATION_PROP_XXX */
79         int display_applist;    /* display app list  NOTIFICATION_DISPLAY_APP_XXX */
80
81         double progress_size;   /* size of progress */
82         double progress_percentage;     /* percentage of progress */
83
84         char *app_icon_path;    /* Temporary stored app icon path from AIL */
85         char *app_name;         /* Temporary stored app name from AIL */
86         char *temp_title;
87         char *temp_content;
88         char *tag;
89         bool ongoing_flag;
90         bool auto_remove;
91 };
92
93 struct notification_system_setting {
94         bool do_not_disturb;
95         int  visibility_class;
96 };
97
98 typedef enum notification_data_type {
99         NOTIFICATION_DATA_TYPE_NOTI_TYPE = 1,
100         NOTIFICATION_DATA_TYPE_LAYOUT,
101         NOTIFICATION_DATA_TYPE_GROUP_ID,
102         NOTIFICATION_DATA_TYPE_INTERNAL_GROUP_ID,
103         NOTIFICATION_DATA_TYPE_PRIV_ID,
104         NOTIFICATION_DATA_TYPE_CALLER_PKGNAME,
105         NOTIFICATION_DATA_TYPE_LAUNCH_PKGNAME,
106         NOTIFICATION_DATA_TYPE_ARGS,
107         NOTIFICATION_DATA_TYPE_GROUP_ARGS,
108         NOTIFICATION_DATA_TYPE_EXECUTE_OPTION,
109         NOTIFICATION_DATA_TYPE_SERVICE_RESPONDING,
110         NOTIFICATION_DATA_TYPE_SERVICE_SINGLE_LAUNCH,
111         NOTIFICATION_DATA_TYPE_SERVICE_MULTI_LAUNCH,
112         NOTIFICATION_DATA_TYPE_BUTTON1_EVENT,
113         NOTIFICATION_DATA_TYPE_BUTTON2_EVENT,
114         NOTIFICATION_DATA_TYPE_BUTTON3_EVENT,
115         NOTIFICATION_DATA_TYPE_BUTTON4_EVENT,
116         NOTIFICATION_DATA_TYPE_BUTTON5_EVENT,
117         NOTIFICATION_DATA_TYPE_BUTTON6_EVENT,
118         NOTIFICATION_DATA_TYPE_ICON_EVENT,
119         NOTIFICATION_DATA_TYPE_THUMBNAIL_EVENT,
120         NOTIFICATION_DATA_TYPE_DOMAIN,
121         NOTIFICATION_DATA_TYPE_DIR,
122         NOTIFICATION_DATA_TYPE_TEXT,
123         NOTIFICATION_DATA_TYPE_KEY,
124         NOTIFICATION_DATA_TYPE_FORMAT_ARGS,
125         NOTIFICATION_DATA_TYPE_NUM_FORMAT_ARGS,
126         NOTIFICATION_DATA_TYPE_IMAGE_PATH,
127         NOTIFICATION_DATA_TYPE_SOUND_TYPE,
128         NOTIFICATION_DATA_TYPE_SOUND_PATH,
129         NOTIFICATION_DATA_TYPE_VIBRATION_TYPE,
130         NOTIFICATION_DATA_TYPE_VIBRATION_PATH,
131         NOTIFICATION_DATA_TYPE_LED_OPERATION,
132         NOTIFICATION_DATA_TYPE_LED_ARGB,
133         NOTIFICATION_DATA_TYPE_LED_ON_MS,
134         NOTIFICATION_DATA_TYPE_LED_OFF_MS,
135         NOTIFICATION_DATA_TYPE_TIME,
136         NOTIFICATION_DATA_TYPE_INSERT_TIME,
137         NOTIFICATION_DATA_TYPE_FLAGS_FOR_PROPERTY,
138         NOTIFICATION_DATA_TYPE_DISPLAY_APPLIST,
139         NOTIFICATION_DATA_TYPE_PROGRESS_SIZE,
140         NOTIFICATION_DATA_TYPE_PROGRESS_PERCENTAGE,
141         NOTIFICATION_DATA_TYPE_APP_ICON_PATH,
142         NOTIFICATION_DATA_TYPE_APP_NAME,
143         NOTIFICATION_DATA_TYPE_TEMP_TITLE,
144         NOTIFICATION_DATA_TYPE_TEMP_CONTENT,
145         NOTIFICATION_DATA_TYPE_TAG,
146         NOTIFICATION_DATA_TYPE_ONGOING_FLAG,
147         NOTIFICATION_DATA_TYPE_AUTO_REMOVE,
148 } notification_data_type_e;
149
150 void notification_call_changed_cb(notification_op *op_list, int op_num);
151
152 char *notification_get_pkgname_by_pid(void);
153
154 #endif /* __NOTIFICATION_PRIVATE_H__ */
155