2 * Copyright 2013 Samsung Electronics Co., Ltd
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
8 * http://floralicense.org/license/
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.
17 #ifndef __LIVEBOX_SERVICE_H
18 #define __LIVEBOX_SERVICE_H
24 #define NR_OF_SIZE_LIST 13
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,
43 enum livebox_script_event {
44 LB_SCRIPT_ACCESS_EVENT = 0x01000000,
45 LB_SCRIPT_MOUSE_EVENT = 0x02000000,
46 LB_SCRIPT_KEY_EVENT = 0x04000000,
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,
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,
62 LB_SCRIPT_KEY_DOWN = LB_SCRIPT_KEY_EVENT | 0x00020000,
63 LB_SCRIPT_KEY_UP = LB_SCRIPT_KEY_EVENT | 0x00040000,
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 */
79 * \return 0 for success
81 extern int livebox_service_get_size(int type, int *width, int *height);
87 * \return Type of a livebox
89 extern int livebox_service_size_type(int width, int height);
93 * \param[in] pkgid Livebox's appid
94 * \return true(1) / false(0)
96 extern int livebox_service_mouse_event(const char *pkgid);
100 * \param[in] pkgid Livebox's appid
101 * \param[in] size_type
102 * \return true(1) / false(0)
104 extern int livebox_service_touch_effect(const char *pkgid, int size_type);
108 * \param[in] pkgid Livebox's appid
109 * \param[in] size_type
110 * \return true(1) / false(0)
112 extern int livebox_service_need_frame(const char *pkgid, int size_type);
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
122 extern int livebox_service_trigger_update(const char *pkgname, const char *id, const char *cluster, const char *category, int force);
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
130 extern int livebox_service_change_period(const char *pkgname, const char *id, double period);
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)
141 extern int livebox_service_get_pkglist(int (*cb)(const char *appid, const char *lbid, int is_prime, void *data), void *data);
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
148 extern char *livebox_service_pkgname(const char *id);
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
155 extern int livebox_service_is_primary(const char *lbid);
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)
162 extern char *livebox_service_provider_name(const char *lbid);
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
169 extern char *livebox_service_setup_appid(const char *lbid);
172 *\brief Get the application pkgname(appid) of given livebox package name, <manifest package="AAA">
174 * \return appid String which is allocated on the heap
176 extern char *livebox_service_appid(const char *pkgname);
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.
185 extern char *livebox_service_i18n_name(const char *pkgid, const char *lang);
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
193 extern char *livebox_service_preview(const char *pkgid, int size_type);
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
200 extern char *livebox_service_content(const char *pkgid);
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.
209 extern char *livebox_service_i18n_icon(const char *pkgid, const char *lang);
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
216 extern char *livebox_service_libexec(const char *appid);
219 * \brief Get the "nodisplay" value
220 * \param[in] pkgid Livebox package id.
223 extern int livebox_service_nodisplay(const char *pkgid);
226 * \brief Check the status of the livebox
227 * \param[in] lbid Livebox Id
228 * \return int 1 enabled, 0 disabled
230 extern int livebox_service_is_enabled(const char *lbid);
237 extern char *livebox_service_lb_script_path(const char *pkgid);
244 extern char *livebox_service_lb_script_group(const char *pkgid);
251 extern char *livebox_service_pd_script_path(const char *pkgid);
258 extern char *livebox_service_pd_script_group(const char *pkgid);
264 extern int livebox_service_get_supported_sizes(const char *pkgid, int *cnt, int *w, int *h);
270 extern int livebox_service_get_supported_size_types(const char *pkgid, int *cnt, int *types);
274 extern int livebox_service_enumerate_category_list(const char *cluster, int (*cb)(const char *cluster, const char *category, void *data), void *data);
278 extern int livebox_service_enumerate_cluster_list(int (*cb)(const char *cluster, void *data), void *data);
284 extern int livebox_service_init(void);
290 extern int livebox_service_fini(void);