* 700x172
* 700x700
*/
-#define NR_OF_SIZE_LIST 6
#define DEFAULT_PERIOD -1.0f
-static const struct supported_size_list {
- int w;
- int h;
-} SIZE_LIST[NR_OF_SIZE_LIST] = {
- { 172, 172 }, /*!< 1x1 */
- { 348, 172 }, /*!< 2x1 */
- { 348, 348 }, /*!< 2x2 */
- { 700, 348 }, /*!< 4x2 */
- { 700, 172 }, /*!< 4x1 */
- { 700, 700 }, /*!< 4x4 */
-};
-
enum content_event_type {
LB_MOUSE_DOWN = 0x0001, /*!< LB mouse down event for livebox */
LB_MOUSE_UP = 0x0002, /*!< LB mouse up event for livebox */
* \return handle
*/
extern struct livebox *livebox_add(const char *pkgname, const char *content, const char *cluster, const char *category, double period, ret_cb_t cb, void *data);
-extern struct livebox *livebox_add_with_size(const char *pkgname, const char *content, const char *cluster, const char *category, double period, int width, int height, ret_cb_t cb, void *data);
+extern struct livebox *livebox_add_with_size(const char *pkgname, const char *content, const char *cluster, const char *category, double period, int type, ret_cb_t cb, void *data);
/*!
* \brief Delete a livebox
/*!
* \brief Resize the livebox
* \param[in] handler Handler of a livebox
- * \param[in] w Width of a livebox
- * \param[in] h Height of a livebox
+ * \param[in] type Type of a livebox size, LB_SIZE_TYPE_1x1, ...
* \param[in] cb Result callback of the resize operation.
* \param[in] data User data for return callback
* \return int
*/
-extern int livebox_resize(struct livebox *handler, int w, int h, ret_cb_t cb, void *data);
+extern int livebox_resize(struct livebox *handler, int type, ret_cb_t cb, void *data);
/*!
* \brief Send the click event for a livebox.
* \param[out] h
* \return int
*/
-extern int livebox_get_size(struct livebox *handler, int *w, int *h);
+extern int livebox_size(struct livebox *handler);
/*!
* \brief Get the size of the Progressive Disclosure
* \param[out] h
* \return int
*/
-extern int livebox_get_supported_sizes(struct livebox *handler, int *cnt, int *w, int *h);
+extern int livebox_get_supported_sizes(struct livebox *handler, int *cnt, int *size_list);
/*!
* \brief BUFFER SIZE of the livebox if it is a buffer type
INCLUDE(FindPkgConfig)
pkg_check_modules(pkgs REQUIRED
- dlog
+ capi-appfw-application
+ capi-appfw-app-manager
ail
+ bundle
+ dlog
elementary
ecore-x
appcore-efl
livebox-viewer
+ livebox-service
)
FOREACH(flag ${pkgs_CFLAGS})
int OnTerminate(void);
int OnPause(void);
int OnResume(void);
- int OnReset(bundle *b);
+ int OnReset(service_h b);
int UpdateCtrl(CLiveBox *box);
int AppendLog(const char *str);
BuildRequires: pkgconfig(appcore-efl)
BuildRequires: pkgconfig(livebox-viewer)
BuildRequires: pkgconfig(ecore-x)
+BuildRequires: pkgconfig(livebox-service)
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-appfw-app-manager)
BuildRequires: edje-bin
%description
#include <livebox.h>
#include <dlog.h>
#include <bundle.h>
+#include <app.h>
#include <X11/Xlib.h>
#include <Ecore_X.h>
+#include <livebox-service.h>
+
#include "dlist.h"
#include "CUtil.h"
#include "CResourceMgr.h"
{
int w, h;
int ow, oh;
- char buffer[LOGSIZE];
enum livebox_lb_type type;
- const char *tmp;
if (!m_pIconSlot || !m_pLBImage)
return;
return;
/*
+ char buffer[LOGSIZE];
+ const char *tmp;
snprintf(buffer, sizeof(buffer), "LB Updated (%dx%d)", w, h);
CMain::GetInstance()->AppendLog(buffer);
{
int w;
int h;
- char buffer[LOGSIZE];
enum livebox_pd_type type;
if (!m_pPDImage)
return;
/*
+ char buffer[LOGSIZE];
snprintf(buffer, sizeof(buffer), "PD Updated (%dx%d)", w, h);
CMain::GetInstance()->AppendLog(buffer);
*/
int CLiveBox::Resize(int w, int h)
{
- livebox_resize(m_pHandler, w, h, s_ResizeCB, this);
+ enum livebox_size_type type;
+ type = livebox_service_size_type(w, h);
+ if (type == LB_SIZE_TYPE_UNKNOWN) {
+ ErrPrint("Unsupported size type %dx%d\n", w, h);
+ return -1;
+ }
+
+ livebox_resize(m_pHandler, type, s_ResizeCB, this);
return 0;
}
#include <dlog.h>
#include <ail.h>
+#include <app.h>
+#include <bundle.h>
#include <livebox.h>
+#include <livebox-service.h>
#include "dlist.h"
#include "CUtil.h"
return 0;
}
-int CMain::OnReset(bundle *b)
+int CMain::OnReset(service_h service)
{
- const char *tmp;
- const char *pkgname;
- const char *cluster;
- const char *category;
- const char *content;
+ char *tmp;
+ char *pkgname;
+ char *cluster;
+ char *category;
+ char *content;
double period;
CLiveBox *box;
+ int ret;
- pkgname = bundle_get_val(b, "pkgname");
- if (!pkgname) {
+ ret = service_get_extra_data(service, "pkgname", &pkgname);
+ if (ret != SERVICE_ERROR_NONE) {
DbgPrint("reset ignored\n");
return 0;
}
- cluster = bundle_get_val(b, "cluster");
- if (!cluster)
+ ret = service_get_extra_data(service, "cluster", &cluster);
+ if (ret != SERVICE_ERROR_NONE)
cluster = "user,created";
- category = bundle_get_val(b, "category");
- if (!category)
+ ret = service_get_extra_data(service, "category", &category);
+ if (ret != SERVICE_ERROR_NONE)
category = "default";
- content = bundle_get_val(b, "content");
- if (!content)
+ ret = service_get_extra_data(service, "content", &content);
+ if (ret != SERVICE_ERROR_NONE)
content = NULL;
- tmp = bundle_get_val(b, "verbose");
- if (!tmp || sscanf(tmp, "%d", &m_fVerbose) != 1)
+ ret = service_get_extra_data(service, "verbose", &tmp);
+ if (ret != SERVICE_ERROR_NONE || !tmp || sscanf(tmp, "%d", &m_fVerbose) != 1)
m_fVerbose = 0;
- tmp = bundle_get_val(b, "period");
- if (!tmp || sscanf(tmp, "%lf", &period) != 1)
+ ret = service_get_extra_data(service, "period", &tmp);
+ if (ret != SERVICE_ERROR_NONE || !tmp || sscanf(tmp, "%lf", &period) != 1)
period = DEFAULT_PERIOD;
DbgPrint("App reset (dump info)\n");
return CMain::m_pInstance;
}
-static int app_create(void *data)
+static bool app_create(void *data)
{
DbgPrint("[%s:%d]\n", __func__, __LINE__);
CMain::GetInstance()->OnCreate();
- return 0;
+ return true;
}
-static int app_terminate(void *data)
+static void app_terminate(void *data)
{
DbgPrint("[%s:%d]\n", __func__, __LINE__);
CMain::GetInstance()->OnTerminate();
- return 0;
}
-static int app_pause(void *data)
+static void app_pause(void *data)
{
DbgPrint("[%s:%d]\n", __func__, __LINE__);
CMain::GetInstance()->OnPause();
- return 0;
}
-static int app_resume(void *data)
+static void app_resume(void *data)
{
DbgPrint("[%s:%d]\n", __func__, __LINE__);
CMain::GetInstance()->OnResume();
- return 0;
}
-static int app_reset(bundle *b, void *data)
+static void app_reset(service_h service, void *data)
{
DbgPrint("[%s:%d]\n", __func__, __LINE__);
- CMain::GetInstance()->OnReset(b);
- return 0;
+ CMain::GetInstance()->OnReset(service);
}
int main(int argc, char *argv[])
{
- struct appcore_ops ops;
-
- ops.create = app_create;
- ops.terminate = app_terminate;
- ops.pause = app_pause;
- ops.resume = app_resume;
- ops.reset = app_reset;
- ops.data = NULL;
-
- return appcore_efl_main("live-viewer", &argc, &argv, &ops);
+ int ret;
+ app_event_callback_s event_callback;
+
+ event_callback.create = app_create;
+ event_callback.terminate = app_terminate;
+ event_callback.pause = app_pause;
+ event_callback.resume = app_resume;
+ event_callback.service = app_reset;
+ event_callback.low_memory = NULL;
+ event_callback.low_battery = NULL;
+ event_callback.device_orientation = NULL;
+ event_callback.language_changed = NULL;
+
+ ret = app_efl_main(&argc, &argv, &event_callback, NULL);
+ return ret;
}
/* End of a file */
Name: liblivebox-viewer
Summary: Library for the development of a livebox viewer
-Version: 0.6.9
+Version: 0.7.0
Release: 1
Group: main/app
License: Samsung Proprietary License
break;
}
- {
- FILE *fp;
- static int idx = 0;
- char filename[256];
-
- DbgPrint("Flush %s\n", info->id);
- snprintf(filename, sizeof(filename), "/opt/%d.raw", idx++);
- fp = fopen(filename, "w+");
- if (fp) {
- fwrite(buffer->data, 1, info->bufsz, fp);
- fclose(fp);
- }
- }
-
return buffer->data;
}
*/
EAPI struct livebox *livebox_add(const char *pkgname, const char *content, const char *cluster, const char *category, double period, ret_cb_t cb, void *data)
{
- return livebox_add_with_size(pkgname, content, cluster, category, period, 0, 0, cb, data);
+ return livebox_add_with_size(pkgname, content, cluster, category, period, LB_SIZE_TYPE_UNKNOWN, cb, data);
}
-EAPI struct livebox *livebox_add_with_size(const char *pkgname, const char *content, const char *cluster, const char *category, double period, int width, int height, ret_cb_t cb, void *data)
+EAPI struct livebox *livebox_add_with_size(const char *pkgname, const char *content, const char *cluster, const char *category, double period, int type, ret_cb_t cb, void *data)
{
struct livebox *handler;
struct packet *packet;
int ret;
+ int width = 0;
+ int height = 0;
if (!pkgname || !cluster || !category || width < 0 || height < 0) {
ErrPrint("Invalid arguments: pkgname[%p], cluster[%p], category[%p]\n",
return NULL;
}
+ if (type != LB_SIZE_TYPE_UNKNOWN)
+ livebox_service_get_size(type, &width, &height);
+
handler = calloc(1, sizeof(*handler));
if (!handler) {
ErrPrint("Error: %s\n", strerror(errno));
return NULL;
}
-EAPI int livebox_resize(struct livebox *handler, int w, int h, ret_cb_t cb, void *data)
+EAPI int livebox_resize(struct livebox *handler, int type, ret_cb_t cb, void *data)
{
struct packet *packet;
+ int w;
+ int h;
if (!handler) {
ErrPrint("Handler is NIL\n");
return -EPERM;
}
+ if (livebox_service_get_size(type, &w, &h) != 0) {
+ ErrPrint("Invalid size type\n");
+ return -EINVAL;
+ }
+
if (handler->lb.width == w && handler->lb.height == h) {
DbgPrint("No changes\n");
return -EALREADY;
return 0;
}
-EAPI int livebox_get_size(struct livebox *handler, int *w, int *h)
+EAPI int livebox_size(struct livebox *handler)
{
- int _w;
- int _h;
+ int w;
+ int h;
if (!handler) {
ErrPrint("Handler is NIL\n");
return -EINVAL;
}
- if (!w)
- w = &_w;
- if (!h)
- h = &_h;
-
- *w = handler->lb.width;
- *h = handler->lb.height;
+ w = handler->lb.width;
+ h = handler->lb.height;
switch (handler->lb.type) {
case _LB_TYPE_BUFFER:
case _LB_TYPE_SCRIPT:
if (!fb_is_created(handler->lb.data.fb)) {
DbgPrint("Buffer is not created yet - reset size\n");
- *w = 0;
- *h = 0;
+ w = 0;
+ h = 0;
}
break;
default:
break;
}
- return 0;
+ return livebox_service_size_type(w, h);
}
EAPI int livebox_set_group(struct livebox *handler, const char *cluster, const char *category, ret_cb_t cb, void *data)
return 0;
}
-EAPI int livebox_get_supported_sizes(struct livebox *handler, int *cnt, int *w, int *h)
+EAPI int livebox_get_supported_sizes(struct livebox *handler, int *cnt, int *size_list)
{
register int i;
register int j;
- if (!handler) {
- ErrPrint("Handler is NIL\n");
+ if (!handler || !size_list) {
+ ErrPrint("Invalid argument, handler(%p), size_list(%p)\n", handler, size_list);
return -EINVAL;
}
if (j == *cnt)
break;
- if (w)
- w[j] = SIZE_LIST[i].w;
- if (h)
- h[j] = SIZE_LIST[i].h;
- j++;
+ size_list[j++] = (0x01 << i);
}
}