a544d994148553e9ec39de4fdc3903e8d1449469
[platform/framework/web/livebox-service.git] / include / livebox-service.h
1 /*
2  * Copyright 2013  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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 __LIVEBOX_SERVICE_H
18 #define __LIVEBOX_SERVICE_H
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 #define NR_OF_SIZE_LIST 13
25
26 enum livebox_size_type {
27         LB_SIZE_TYPE_1x1 = 0x0001,
28         LB_SIZE_TYPE_2x1 = 0x0002,
29         LB_SIZE_TYPE_2x2 = 0x0004,
30         LB_SIZE_TYPE_4x1 = 0x0008,
31         LB_SIZE_TYPE_4x2 = 0x0010,
32         LB_SIZE_TYPE_4x3 = 0x0020,
33         LB_SIZE_TYPE_4x4 = 0x0040,
34         LB_SIZE_TYPE_4x5 = 0x0080,
35         LB_SIZE_TYPE_4x6 = 0x0100,
36         LB_SIZE_TYPE_EASY_1x1 = 0x1000,
37         LB_SIZE_TYPE_EASY_3x1 = 0x2000,
38         LB_SIZE_TYPE_EASY_3x3 = 0x4000,
39         LB_SIZE_TYPE_0x0 = 0x0800,
40         LB_SIZE_TYPE_UNKNOWN = 0xFFFF,
41 };
42
43 enum livebox_script_event {
44         LB_SCRIPT_ACCESS_EVENT          = 0x01000000,
45         LB_SCRIPT_MOUSE_EVENT           = 0x02000000,
46         LB_SCRIPT_KEY_EVENT             = 0x04000000,
47
48         LB_SCRIPT_ACCESS_HIGHLIGHT      = LB_SCRIPT_ACCESS_EVENT | 0x00000001,
49         LB_SCRIPT_ACCESS_HIGHLIGHT_NEXT = LB_SCRIPT_ACCESS_EVENT | 0x00000002,
50         LB_SCRIPT_ACCESS_HIGHLIGHT_PREV = LB_SCRIPT_ACCESS_EVENT | 0x00000004,
51         LB_SCRIPT_ACCESS_ACTIVATE       = LB_SCRIPT_ACCESS_EVENT | 0x00000008,
52         LB_SCRIPT_ACCESS_ACTION         = LB_SCRIPT_ACCESS_EVENT | 0x00000010,
53         LB_SCRIPT_ACCESS_SCROLL         = LB_SCRIPT_ACCESS_EVENT | 0x00000020,
54         LB_SCRIPT_ACCESS_UNHIGHLIGHT    = LB_SCRIPT_ACCESS_EVENT | 0x00000040,
55
56         LB_SCRIPT_MOUSE_DOWN    = LB_SCRIPT_MOUSE_EVENT | 0x00001000,
57         LB_SCRIPT_MOUSE_MOVE    = LB_SCRIPT_MOUSE_EVENT | 0x00002000,
58         LB_SCRIPT_MOUSE_UP      = LB_SCRIPT_MOUSE_EVENT | 0x00004000,
59         LB_SCRIPT_MOUSE_IN      = LB_SCRIPT_MOUSE_EVENT | 0x00008000,
60         LB_SCRIPT_MOUSE_OUT     = LB_SCRIPT_MOUSE_EVENT | 0x00010000,
61
62         LB_SCRIPT_KEY_DOWN      = LB_SCRIPT_KEY_EVENT | 0x00020000,
63         LB_SCRIPT_KEY_UP        = LB_SCRIPT_KEY_EVENT | 0x00040000,
64 };
65
66 enum livebox_access_status {
67         LB_ACCESS_STATUS_ERROR = 0x80000000,
68         LB_ACCESS_STATUS_DONE = 0x00000000,
69         LB_ACCESS_STATUS_FIRST, /*!< Reach to the first item */
70         LB_ACCESS_STATUS_LAST, /*!< Reach to the last item */
71         LB_ACCESS_STATUS_READ, /* TTS done */
72 };
73
74 /*!
75  * \brief
76  * \param[in] type
77  * \param[out] width
78  * \param[out] height
79  * \return 0 for success
80  */
81 extern int livebox_service_get_size(int type, int *width, int *height);
82
83 /*!
84  * \brief
85  * \param[in] width
86  * \param[in] height
87  * \return Type of a livebox
88  */
89 extern int livebox_service_size_type(int width, int height);
90
91 /*!
92  * \brief
93  * \param[in] pkgid Livebox's appid
94  * \return true(1) / false(0)
95  */
96 extern int livebox_service_mouse_event(const char *pkgid);
97
98 /*!
99  * \brief
100  * \param[in] pkgid Livebox's appid
101  * \param[in] size_type
102  * \return true(1) / false(0)
103  */
104 extern int livebox_service_touch_effect(const char *pkgid, int size_type);
105
106 /*!
107  * \brief
108  * \param[in] pkgid Livebox's appid
109  * \param[in] size_type
110  * \return true(1) / false(0)
111  */
112 extern int livebox_service_need_frame(const char *pkgid, int size_type);
113
114 /*!
115  * \brief
116  * \param[in] pkgname Livebox package name
117  * \param[in] id Set NULL if you don't know what the Id is.
118  * \param[in] cluster Cluster name. Default NULL
119  * \param[in] category Category name, Default NULL
120  * \param[in] force 1 if you want to update your livebox even if the provider is paused or 0. 0 is default
121  */
122 extern int livebox_service_trigger_update(const char *pkgname, const char *id, const char *cluster, const char *category, int force);
123
124 /*!
125  * \brief Change the period of given livebox instance
126  * \param[in] pkgname Livebox package name
127  * \param[in] id Livebox instance id
128  * \param[in] period New update period in sec
129  */
130 extern int livebox_service_change_period(const char *pkgname, const char *id, double period);
131
132 /*!
133  * \brief Synchronous package list getter
134  *        callback (appid, lbid, is_prime)
135  *        appid == Application Package ID (pkgname)
136  *        lbid = Livebox Package ID
137  *        is_prime = 1 if the livebox is default one for associated application package
138  * \param[in] cb Callback function
139  * \return Count of livebox packages or errno (-EIO, -EINVAL)
140  */
141 extern int livebox_service_get_pkglist(int (*cb)(const char *appid, const char *lbid, int is_prime, void *data), void *data);
142
143 /*!
144  * \brief Get the pkgname of a primary livebox using given lbid or pkgid.
145  * \param[in] id Livebox Id or Package Id
146  * \return pkgname String which is allocated on the heap
147  */
148 extern char *livebox_service_pkgname(const char *id);
149
150 /*!
151  * \brief Check the pirmary flag of given livebox Id.
152  * \param[in] lbid Livebox Id
153  * \return int 0 if is not a primary or 1
154  */
155 extern int livebox_service_is_primary(const char *lbid);
156
157 /*!
158  * \brief Get the name of a livebox (provider name == livebox appid), you have to release the return value after use it
159  * \param[in] Livebox AppID
160  * \return Livebox AppId (Same with input)
161  */
162 extern char *livebox_service_provider_name(const char *lbid);
163
164 /*!
165  * \brief Get the appId of setup app which is specified by given livebox Id's manifest.
166  * \param[in] Livebox AppId
167  * \return Setup AppId if exists or NULL
168  */
169 extern char *livebox_service_setup_appid(const char *lbid);
170
171 /*!
172  *\brief Get the application pkgname(appid) of given livebox package name, <manifest package="AAA">
173  * \param[in] pkgname
174  * \return appid String which is allocated on the heap
175  */
176 extern char *livebox_service_appid(const char *pkgname);
177
178 /*!
179  * \brief Internationalized name of given livebox package.
180  *        USER must has to do "free" after using the returned string.
181  * \param[in] pkgid App ID of a livebox. (It must has to be a livebox package ID. not the UI-APP and the PACKAGE.
182  * \param[in] lang locale(en-us, ko-kr, ...), if it is NULL, function will use the system locale automatically
183  * \return name if it fails to get name, returns NULL, or allocated heap address.
184  */
185 extern char *livebox_service_i18n_name(const char *pkgid, const char *lang);
186
187 /*!
188  * \brief
189  * \param[in] pkgid livebox ID. NOT the UI-APP ID and PACKAGE ID
190  * \param[in] size_type
191  * \return path preview image path
192  */
193 extern char *livebox_service_preview(const char *pkgid, int size_type);
194
195 /*!
196  * \brief Get the default content string of the given livebox
197  * \param[in] pkgid Livebox ID. Not the UI-APP ID and PACKAGE ID
198  * \return content content string
199  */
200 extern char *livebox_service_content(const char *pkgid);
201
202 /*!
203  * \brief Internationalized icon path of given livebox package.
204  *        USER must has to do "free" after using the returned string.
205  * \param[in] pkgid App ID of a livebox. (It must has to be a livebox package ID. not the UI-APP and the PACKAGE.
206  * \param[in] lang locale(en-us, ko-kr, ...), if it is NULL, function will use the system locale automatically
207  * \return name if it fails to get path of an icon, returns NULL, or allocated heap address.
208  */
209 extern char *livebox_service_i18n_icon(const char *pkgid, const char *lang);
210
211 /*!
212  * \brief Get the path of the plug-in module
213  * \param[in] appid Package name of a livebox
214  * \return path String which is allocated on the heap
215  */
216 extern char *livebox_service_libexec(const char *appid);
217
218 /*!
219  * \brief Get the "nodisplay" value
220  * \param[in] pkgid Livebox package id.
221  * \return true/false
222  */
223 extern int livebox_service_nodisplay(const char *pkgid);
224
225 /*!
226  * \brief Check the status of the livebox
227  * \param[in] lbid Livebox Id
228  * \return int 1 enabled, 0 disabled
229  */
230 extern int livebox_service_is_enabled(const char *lbid);
231
232 /*!
233  * \brief
234  * \param[in]
235  * \return
236  */
237 extern char *livebox_service_lb_script_path(const char *pkgid);
238
239 /*!
240  * \brief
241  * \param[in]
242  * \return
243  */
244 extern char *livebox_service_lb_script_group(const char *pkgid);
245
246 /*!
247  * \brief
248  * \param[in]
249  * \return
250  */
251 extern char *livebox_service_pd_script_path(const char *pkgid);
252
253 /*!
254  * \brief
255  * \param[in]
256  * \return
257  */
258 extern char *livebox_service_pd_script_group(const char *pkgid);
259
260 /*!
261  * \brief
262  * \return
263  */
264 extern int livebox_service_get_supported_sizes(const char *pkgid, int *cnt, int *w, int *h);
265
266 /*!
267  * \brief
268  * \return
269  */
270 extern int livebox_service_get_supported_size_types(const char *pkgid, int *cnt, int *types);
271
272 /*!
273  */
274 extern int livebox_service_enumerate_category_list(const char *cluster, int (*cb)(const char *cluster, const char *category, void *data), void *data);
275
276 /*!
277  */
278 extern int livebox_service_enumerate_cluster_list(int (*cb)(const char *cluster, void *data), void *data);
279
280 /*!
281  * \brief
282  * \return
283  */
284 extern int livebox_service_init(void);
285
286 /*!
287  * \brief
288  * \return
289  */
290 extern int livebox_service_fini(void);
291
292 #ifdef __cplusplus
293 }
294 #endif
295
296 #endif
297 /* End of a file */