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.
22 #include <livebox-errno.h>
24 #include "livebox-cpp.h"
25 #include "livebox-impl.h"
29 #define EAPI __attribute__((visibility("default")))
31 EAPI int livebox_initialize(const char *pkgname)
35 module = CModule::FindModule(pkgname);
37 return LB_STATUS_SUCCESS;
40 module = CModule::Load(pkgname);
42 return LB_STATUS_ERROR_FAULT;
45 return LB_STATUS_SUCCESS;
48 EAPI int livebox_finalize(const char *pkgname)
52 module = CModule::FindModule(pkgname);
54 return LB_STATUS_ERROR_NOT_EXIST;
58 return LB_STATUS_SUCCESS;
61 EAPI int livebox_create(const char *pkgname, const char *id, const char *content, const char *cluster, const char *category)
67 module = CModule::FindModule(pkgname);
69 return LB_STATUS_ERROR_INVALID;
72 box = module->FindLiveBox(id);
74 return LB_STATUS_ERROR_NOT_EXIST;
77 ret = module->Create(id, content, cluster, category);
81 EAPI int livebox_destroy(const char *pkgname, const char *id)
87 module = CModule::FindModule(pkgname);
89 return LB_STATUS_ERROR_INVALID;
92 box = module->FindLiveBox(id);
94 return LB_STATUS_ERROR_NOT_EXIST;
97 ret = module->Destroy(box);
101 EAPI int livebox_need_to_update(const char *pkgname, const char *id)
106 module = CModule::FindModule(pkgname);
108 return LB_STATUS_ERROR_INVALID;
111 box = module->FindLiveBox(id);
113 return LB_STATUS_ERROR_NOT_EXIST;
116 return box->NeedToUpdate();
119 EAPI int livebox_need_to_destroy(const char *pkgname, const char *id)
124 module = CModule::FindModule(pkgname);
126 return LB_STATUS_ERROR_INVALID;
129 box = module->FindLiveBox(id);
131 return LB_STATUS_ERROR_NOT_EXIST;
134 return box->NeedToDestroy();
137 EAPI int livebox_update_content(const char *pkgname, const char *id)
142 module = CModule::FindModule(pkgname);
144 return LB_STATUS_ERROR_INVALID;
147 box = module->FindLiveBox(id);
149 return LB_STATUS_ERROR_NOT_EXIST;
152 return box->UpdateContent();
155 EAPI int livebox_clicked(const char *pkgname, const char *id, const char *event, double timestamp, double x, double y)
160 module = CModule::FindModule(pkgname);
162 return LB_STATUS_ERROR_INVALID;
165 box = module->FindLiveBox(id);
167 return LB_STATUS_ERROR_NOT_EXIST;
170 return box->Clicked(event, timestamp, x, y);
173 EAPI int livebox_content_event(const char *pkgname, const char *id, const char *emission, const char *source, struct event_info *event_info)
178 module = CModule::FindModule(pkgname);
180 return LB_STATUS_ERROR_INVALID;
183 box = module->FindLiveBox(id);
185 return LB_STATUS_ERROR_NOT_EXIST;
188 return box->ContentEvent(emission, source, event_info);
191 EAPI int livebox_resize(const char *pkgname, const char *id, int type)
196 module = CModule::FindModule(pkgname);
198 return LB_STATUS_ERROR_INVALID;
201 box = module->FindLiveBox(id);
203 return LB_STATUS_ERROR_NOT_EXIST;
206 return box->Resize(type);
209 EAPI int livebox_change_group(const char *pkgname, const char *id, const char *cluster, const char *category)
214 module = CModule::FindModule(pkgname);
216 return LB_STATUS_ERROR_INVALID;
219 box = module->FindLiveBox(id);
221 return LB_STATUS_ERROR_NOT_EXIST;
224 return box->ChangeGroup(cluster, category);
227 EAPI int livebox_get_info(const char *pkgname, const char *id, int *w, int *h, double *priority, char **content, char **title)
232 module = CModule::FindModule(pkgname);
234 return LB_STATUS_ERROR_INVALID;
237 box = module->FindLiveBox(id);
239 return LB_STATUS_ERROR_NOT_EXIST;
242 return box->GetInfo(w, h, priority, content, title);
245 EAPI int livebox_need_to_create(const char *pkgname, const char *cluster, const char *category)
249 module = CModule::FindModule(pkgname);
251 return LB_STATUS_ERROR_INVALID;
254 return module->NeedToCreate(cluster, category);
257 EAPI char *livebox_pinup(const char *pkgname, const char *id, int pinup)
262 module = CModule::FindModule(pkgname);
267 box = module->FindLiveBox(id);
272 return box->PinUp(pinup);
275 EAPI int livebox_is_pinned_up(const char *pkgname, const char *id)
280 module = CModule::FindModule(pkgname);
285 box = module->FindLiveBox(id);
290 return box->IsPinnedUp();
293 EAPI int livebox_system_event(const char *pkgname, const char *id, int event)
298 module = CModule::FindModule(pkgname);
303 box = module->FindLiveBox(id);
308 return box->SystemEvent(event);