From 8fc9b01a4e9a6a03d064dea785eae654bd771651 Mon Sep 17 00:00:00 2001 From: Masayuki Sasaki Date: Wed, 26 Mar 2014 17:13:41 +0900 Subject: [PATCH] Notification launch support. (TIVI-2926/1892) A spec file is changed corresponding to the packages of GENIVI layer management. Live thumbnail not updated at the time of menu un-displaying. Correction of the review indication from a Tizen team. Change-Id: I46e2edfeb2d6d908bd01f69a93a8ecbcf6504f69 Signed-off-by: Masayuki Sasaki --- configure.ac | 4 - include/ico_syc_inputctl.h | 2 +- include/ico_syc_msg_cmd_def.h | 2 + include/ico_syc_type.h | 9 +- include/ico_syc_winctl.h | 3 +- lib/apps-framework/ico_syc_appresctl.c | 22 +- lib/apps-framework/ico_syc_userctl.c | 2 +- lib/apps-framework/ico_syc_winctl.c | 10 +- lib/common/CicoConf.h | 112 +++--- lib/common/CicoSystemConfig.cpp | 138 +++---- lib/system-controller/CicoSCLayer.cpp | 10 +- lib/system-controller/CicoSCResourceManager.cpp | 82 ++-- lib/system-controller/CicoSCWayland.cpp | 4 +- lib/system-controller/CicoSCWindowController.cpp | 90 +++-- lib/system-controller/CicoSCWlInputMgrIF.h | 2 +- lib/system-controller/CicoSCWlWinMgrIF.cpp | 28 +- lib/system-controller/CicoSCWlWinMgrIF.h | 15 +- lib/system-controller/Makefile.am | 2 - packaging/ico-uxf-homescreen.changes | 12 + src/homescreen/CicoHSMenuTile.cpp | 17 +- src/homescreen/CicoHSMenuTile.h | 4 +- src/homescreen/CicoHSSwipeTouch.cpp | 12 +- src/homescreen/CicoHomeScreenCommon.h | 2 +- src/homescreen/Makefile.am | 2 - src/onscreen/CicoOSClient.cpp | 309 +++++++++++++++ src/onscreen/CicoOSClient.h | 90 +++++ src/onscreen/CicoOSPopWindow.cpp | 52 ++- src/onscreen/CicoOSPopWindow.h | 11 +- src/onscreen/CicoOnScreen.cpp | 14 +- src/onscreen/Makefile.am | 8 +- src/statusbar/CicoCommonComponent.cpp | 199 ---------- src/statusbar/CicoCommonComponent.h | 72 ---- src/statusbar/CicoCommonModule.cpp | 25 +- src/statusbar/CicoCommonWindow.cpp | 28 +- src/statusbar/CicoCommonWindow.h | 13 +- src/statusbar/CicoComponentImplementation.cpp | 481 ++++++++++------------- src/statusbar/CicoComponentImplementation.h | 143 ++++--- src/statusbar/CicoComponentInterface.h | 39 -- src/statusbar/CicoModuleImplementation.cpp | 229 ----------- src/statusbar/CicoModuleImplementation.h | 131 ------ src/statusbar/CicoModuleInterface.h | 39 -- src/statusbar/CicoSBEFLApp.cpp | 2 + src/statusbar/CicoStatusBar.cpp | 102 ++--- src/statusbar/CicoStatusBar.h | 19 +- src/statusbar/CicoWindowInterface.h | 35 -- src/statusbar/Makefile.am | 14 +- src/statusbar/main.cpp | 6 +- src/statusbar/statusbar.edc | 182 +++++++++ src/syscond/Makefile.am | 2 - tool/ico_clear_screen.c | 25 +- tool/notification/Makefile.am | 11 + tool/notification/send_notification2.cpp | 179 +++++++++ 52 files changed, 1485 insertions(+), 1561 deletions(-) create mode 100644 src/onscreen/CicoOSClient.cpp create mode 100644 src/onscreen/CicoOSClient.h delete mode 100644 src/statusbar/CicoCommonComponent.cpp delete mode 100644 src/statusbar/CicoCommonComponent.h delete mode 100644 src/statusbar/CicoComponentInterface.h delete mode 100644 src/statusbar/CicoModuleImplementation.cpp delete mode 100644 src/statusbar/CicoModuleImplementation.h delete mode 100644 src/statusbar/CicoModuleInterface.h delete mode 100644 src/statusbar/CicoWindowInterface.h create mode 100644 src/statusbar/statusbar.edc create mode 100644 tool/notification/send_notification2.cpp diff --git a/configure.ac b/configure.ac index 59d9445..83d5826 100644 --- a/configure.ac +++ b/configure.ac @@ -79,9 +79,7 @@ UWS_LIBS="-lico-util" AC_SUBST(UWS_CFLAGS) AC_SUBST(UWS_LIBS) -GENIVI_CFLAGS="-I/usr/include/ilm" GENIVI_LIBS="-lilmCommon -lilmControl -lilmClient" -AC_SUBST(GENIVI_CFLAGS) AC_SUBST(GENIVI_LIBS) SLPPKGMGR_CFLAGS="$SLPPKGMGR_CFLAGS" @@ -94,9 +92,7 @@ WL_LIBS="$WAYLANDCLIENT_LIBS $WAYLANDCURSOR_LIBS" AC_SUBST(WL_CFLAGS) AC_SUBST(WL_LIBS) -WESTONPLUGIN_CFLAGS="-I/usr/include/ico-uxf-weston-plugin" WESTONPLUGIN_LIBS="-lico-uxf-weston-plugin" -AC_SUBST(WESTONPLUGIN_CFLAGS) AC_SUBST(WESTONPLUGIN_LIBS) if test "x$GCC" = "xyes"; then diff --git a/include/ico_syc_inputctl.h b/include/ico_syc_inputctl.h index 0d4af98..e38ac9e 100644 --- a/include/ico_syc_inputctl.h +++ b/include/ico_syc_inputctl.h @@ -16,7 +16,7 @@ #ifndef _ICO_SYC_INPUTCTL_H_ #define _ICO_SYC_INPUTCTL_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/ico_syc_msg_cmd_def.h b/include/ico_syc_msg_cmd_def.h index cf6ce00..7227656 100644 --- a/include/ico_syc_msg_cmd_def.h +++ b/include/ico_syc_msg_cmd_def.h @@ -174,6 +174,8 @@ extern "C" { /* notify state changed to homescreen */ #define MSG_CMD_NOTIFY_CHANGED_STATE 0x00060001 +#define DEF_WS_CLI_HS_PORT "ws://127.0.0.1:10001" +#define DEF_WS_CLI_HS_PROTOCOL "ico_hs_protocol" /* application operation */ #define MSG_CMD_APP_START 1000 #define MSG_CMD_APP_STOP 1001 diff --git a/include/ico_syc_type.h b/include/ico_syc_type.h index 5beda15..43db1f8 100644 --- a/include/ico_syc_type.h +++ b/include/ico_syc_type.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, TOYOTA MOTOR CORPORATION. + * Copyright (c) 2013-2014, TOYOTA MOTOR CORPORATION. * * This program is licensed under the terms and conditions of the * Apache License, version 2.0. The full text of the Apache License is at @@ -10,13 +10,13 @@ * @brief header file of System Controller * for privilege and general applications * - * @date Aug-6-2013 + * @date Feb-21-2014 */ #ifndef _ICO_SYC_TYPE_H_ #define _ICO_SYC_TYPE_H_ -#include +#include #ifdef __cplusplus extern "C" { @@ -272,9 +272,6 @@ typedef struct _user_list { * window resource information */ typedef struct _res_win { -/*- char *zone; */ /* area of showing application window */ -/*- char *name; */ /* window's surface name */ -/*- char *id; */ /* window id */ char *ECU; /* name to identify ECU */ char *display; /* name to identify Display in ECU */ char *layer; /* name to identify Layer in Display */ diff --git a/include/ico_syc_winctl.h b/include/ico_syc_winctl.h index fb5fbd6..c95accc 100644 --- a/include/ico_syc_winctl.h +++ b/include/ico_syc_winctl.h @@ -16,7 +16,7 @@ #ifndef _ICO_SYC_WINCTL_H_ #define _ICO_SYC_WINCTL_H_ -#include +#include #ifdef __cplusplus extern "C" { @@ -43,6 +43,7 @@ typedef enum _window_show { #define ICO_SYC_WIN_SURF_LOWER 0x02000000 #define ICO_SYC_WIN_SURF_NOCHANGE 0x04000000 #define ICO_SYC_WIN_SURF_NORESCTL 0x40000000 +#define ICO_SYC_WIN_SURF_ONESHOT 0x10000000 #define ICO_SYC_WIN_SURF_FLAGS 0xff000000 typedef struct _animation_info { char *name; /* name of animation (ex. fade,slide,zoom etc..) */ diff --git a/lib/apps-framework/ico_syc_appresctl.c b/lib/apps-framework/ico_syc_appresctl.c index 7fcf933..edf5c1e 100644 --- a/lib/apps-framework/ico_syc_appresctl.c +++ b/lib/apps-framework/ico_syc_appresctl.c @@ -204,13 +204,13 @@ _free_res_window(ico_syc_res_window_t *w) } /* free element */ - if (NULL != w->ECU) free(w->ECU); - if (NULL != w->display) free(w->display); - if (NULL != w->layer) free(w->layer); - if (NULL != w->layout) free(w->layout); - if (NULL != w->area) free(w->area); - if (NULL != w->dispatchApp) free(w->dispatchApp); - if (NULL != w->role) free(w->role); + free(w->ECU); + free(w->display); + free(w->layer); + free(w->layout); + free(w->area); + free(w->dispatchApp); + free(w->role); /* free */ free(w); @@ -234,9 +234,9 @@ _free_res_sound(ico_syc_res_sound_t *sound) } /* free element */ - if (sound->zone != NULL) free(sound->zone); - if (sound->name != NULL) free(sound->name); - if (sound->id != NULL) free(sound->id); + free(sound->zone); + free(sound->name); + free(sound->id); /* free */ free(sound); @@ -260,7 +260,7 @@ _free_res_input(ico_syc_res_input_t *input) } /* free element */ - if (input->name != NULL) free(input->name); + free(input->name); /* free */ free(input); diff --git a/lib/apps-framework/ico_syc_userctl.c b/lib/apps-framework/ico_syc_userctl.c index 8fa5155..8d43058 100644 --- a/lib/apps-framework/ico_syc_userctl.c +++ b/lib/apps-framework/ico_syc_userctl.c @@ -421,7 +421,7 @@ ico_syc_cb_lastinfo(ico_syc_callback_t callback, void *user_data, int event, /* free memory */ g_object_unref(parser); - if (lastinfo != NULL) free(lastinfo); + free(lastinfo); return; } diff --git a/lib/apps-framework/ico_syc_winctl.c b/lib/apps-framework/ico_syc_winctl.c index a8b03d8..624e777 100644 --- a/lib/apps-framework/ico_syc_winctl.c +++ b/lib/apps-framework/ico_syc_winctl.c @@ -627,8 +627,8 @@ ico_syc_cb_win(ico_syc_callback_t callback, void *user_data, /* free memory */ g_object_unref(parser); - if (win_info->appid != NULL) free(win_info->appid); - if (win_info->name != NULL) free(win_info->name); + free(win_info->appid); + free(win_info->name); free(win_info); return; @@ -719,9 +719,9 @@ ico_syc_cb_win_attr(ico_syc_callback_t callback, void *user_data, /* free memory */ g_object_unref(parser); - if (win_attr->appid != NULL) free(win_attr->appid); - if (win_attr->name != NULL) free(win_attr->name); - if (win_attr->zone != NULL) free(win_attr->zone); + free(win_attr->appid); + free(win_attr->name); + free(win_attr->zone); free(win_attr); return; diff --git a/lib/common/CicoConf.h b/lib/common/CicoConf.h index 36c6821..8df71f0 100644 --- a/lib/common/CicoConf.h +++ b/lib/common/CicoConf.h @@ -92,6 +92,10 @@ typedef enum _privilege { #define ICO_SYC_ROLE_CONF_RST 14999 #define ICO_SYC_ROLE_CONF_RST_STR "RESET" +#define ICO_SYC_ONSCREEN_WINDOW_START_X 0 +#define ICO_SYC_ONSCREEN_WINDOW_START_Y 0 +#define ICO_SYC_ONSCREEN_WINDOW_WIDTH 1080 +#define ICO_SYC_ONSCREEN_WINDOW_HEIGHT 1920 //========================================================================== /** * @brief This class holds display information of system config @@ -102,13 +106,13 @@ class CicoSCNodeConf public: /// default constructor CicoSCNodeConf() - : id(-1), name(""), address(""), type(-1) {} + : id(-1), type(-1) {} /// destructor - virtual ~CicoSCNodeConf() {} + ~CicoSCNodeConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG("node: id=%d name=%s address=%s type=%d", id, name.c_str(), address.c_str(), type); @@ -131,14 +135,13 @@ class CicoSCLayerConf public: /// default constructor CicoSCLayerConf() - : id(-1), name(""), type(-1), menuoverlap(false), - layout_id(-1), layout_name(""), area_id(-1), area_name("") {} + : id(-1), type(-1), menuoverlap(false), layout_id(-1), area_id(-1) {} /// destructor - virtual ~CicoSCLayerConf() {} + ~CicoSCLayerConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { if(-1 != layout_id) { ICO_DBG(" layer: %d, \"%s\" type=%d menuoverlap=%s layout: %d, \"%s\" area: %d, \"%s\"", @@ -172,16 +175,16 @@ class CicoSCDisplayZoneConf public: /// default constructor CicoSCDisplayZoneConf() - : id(-1), name(""), fullname(""), x(-1), y(-1), w(-1), h(-1), + : id(-1), x(-1), y(-1), w(-1), h(-1), aspectFixed(false), aspectAlignLeft(false), aspectAlignRight(false), aspectAlignTop(false), aspectAlignBottom(false) {} /// destructor - virtual ~CicoSCDisplayZoneConf() {} + ~CicoSCDisplayZoneConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG(" zone: id=%d name=%s fullname=%s x/y=%d/%d " "w/h=%d/%d aspect(fixed=%s l/r=%s/%s t/b=%s/%s", @@ -224,14 +227,14 @@ class CicoSCDisplayConf public: /// default constructor CicoSCDisplayConf() - : id(-1), name(""), node(-1), no(-1), + : id(-1), node(-1), no(-1), type(-1), width(-1), height(-1), inch(-1) {} /// destructor - virtual ~CicoSCDisplayConf() {} + ~CicoSCDisplayConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG("display: id=%d name=%s node=%d no=%d " "type=%d width=%d height=%d inch=%d", @@ -265,13 +268,13 @@ class CicoSCSoundZoneConf public: /// default constructor CicoSCSoundZoneConf() - : id(-1), name(""), fullname("") {} + : id(-1) {} /// destructor - virtual ~CicoSCSoundZoneConf() {} + ~CicoSCSoundZoneConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG(" zone: id=%d name=%s fullname=%s", id, name.c_str(), fullname.c_str()); @@ -293,13 +296,13 @@ class CicoSCSoundConf public: /// default constructor CicoSCSoundConf() - : id(-1), name(""), no(-1) {} + : id(-1), no(-1) {} /// destructor - virtual ~CicoSCSoundConf() {} + ~CicoSCSoundConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG("sound: id=%d name=%s no=%d", id, name.c_str(), no); } @@ -321,14 +324,13 @@ class CicoSCCategoryConf public: /// default constructor CicoSCCategoryConf() - : id(-1), name(""), type(""), - view(-1), sound(-1), input(-1), priority(0), rctrl(-1) {} + : id(-1), view(-1), sound(-1), input(-1), priority(0), rctrl(-1) {} /// destructor - virtual ~CicoSCCategoryConf() {} + ~CicoSCCategoryConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG("category: id=%d name=%s type=%s " "view=%d sound=%d input=%d priority=%d", @@ -367,13 +369,13 @@ public: /// default constructor CicoSCAppKindConf() - : id(-1), name(""), privilege(-1), priority(0){} + : id(-1), privilege(-1), priority(0){} /// destructor - virtual ~CicoSCAppKindConf() {} + ~CicoSCAppKindConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG("appkind: id=%d name=%s priority=%d priority=%d", id, name.c_str(), privilege, priority); @@ -396,13 +398,13 @@ class CicoSCSwitchConf public: /// default constructor CicoSCSwitchConf() - : id(-1), name(""), appid(""), keycode(0){} + : id(-1), keycode(0){} /// destructor - virtual ~CicoSCSwitchConf() {} + ~CicoSCSwitchConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG(" switch: id=%d name=%s appid=%s", id, name.c_str(), appid.c_str()); @@ -425,13 +427,13 @@ class CicoSCInputDevConf public: /// default constructor CicoSCInputDevConf() - : id(-1), name("") {} + : id(-1) {} /// destructor - virtual ~CicoSCInputDevConf() {} + ~CicoSCInputDevConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG("inputdev: id=%d name=%s", id, name.c_str()); } @@ -452,16 +454,15 @@ class CicoSCDefaultConf public: /// default constructor CicoSCDefaultConf() - : topdir(""), confdir(""), - node(-1), appkind(-1), category(-1), display(-1), + : node(-1), appkind(-1), category(-1), display(-1), layer(-1), displayzone(-1), sound(-1), soundzone(-1), inputdev(-1), inputsw(-1) {}; /// destructor - virtual ~CicoSCDefaultConf() {} + ~CicoSCDefaultConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG("default: topdir=%s confdir=%s " "node=%d appkind=%d category=%d " @@ -497,13 +498,13 @@ class CicoSCCpuResourceGrp public: /// default constructor CicoSCCpuResourceGrp() - :m_id(-1), m_bDoIt(false), m_grpNm("") {} + :m_id(-1), m_bDoIt(false) {} /// destructor - virtual ~CicoSCCpuResourceGrp() {} + ~CicoSCCpuResourceGrp() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { std::stringstream hightlist; { @@ -546,15 +547,15 @@ class CicoSCResourceConf public: /// default constructor CicoSCResourceConf() - :m_bDoIt(false), m_bDoItApp(false), m_bLog(false), m_cpuCGRPPath(""), + :m_bDoIt(false), m_bDoItApp(false), m_bLog(false), m_sampling(-1), m_retryCnt(5), m_lowLimitVal(25), m_highLimitVal(90) {} /// destructor - virtual ~CicoSCResourceConf() {} + ~CicoSCResourceConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG("do:%s,%s log:%s, dir:%s, smpl:%d r:%d l:%d h:%d sz:%d", m_bDoIt? "true": "false", m_bDoItApp? "true": "false", @@ -585,10 +586,10 @@ public: /// default constructor CicoSCUserConf() :m_parent_dir("/home/app/ico") {} /// destructor - virtual ~CicoSCUserConf() {} + ~CicoSCUserConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG("parent dir:%s", m_parent_dir.c_str()); } @@ -607,14 +608,13 @@ class CicoSCVIPropertyConf public: /// default constructor CicoSCVIPropertyConf() - : name(""), objname(""), property(""), typestr(""), - type(ICO_TYPE_UNKNOW) {} + : type(ICO_TYPE_UNKNOW) {} /// destructor - virtual ~CicoSCVIPropertyConf() {} + ~CicoSCVIPropertyConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG("vehicle_info: id=%02d name=%s objname=%s property=%s " "zone=%d typestr=%s type=%d", @@ -687,10 +687,10 @@ public: CicoSCVehicleInfoConf() : retryCnt(0), waitTime(0) {} /// destructor - virtual ~CicoSCVehicleInfoConf() {} + ~CicoSCVehicleInfoConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG("vehicle info: retry=%d waitTime=%d", retryCnt, waitTime); std::map::iterator itr; @@ -723,9 +723,9 @@ public: CicoSCRoleConf() : m_def(ICO_SYC_ROLE_CONF_DEF), m_rst(ICO_SYC_ROLE_CONF_RST) {} /// destructor - virtual ~CicoSCRoleConf() {} + ~CicoSCRoleConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG("Role info: default=%d, reset=%d, size=%d", (int)m_def, (int)m_rst, (int)m_stt.size()); @@ -753,12 +753,12 @@ class CicoSCPositionOSConf { public: /// constructor - CicoSCPositionOSConf() - : m_x(0), m_y(0), m_w(1080), m_h(1920) {} + CicoSCPositionOSConf(int x, int y, int w, int h) + : m_x(x), m_y(y), m_w(w), m_h(h) {} /// destructor - virtual ~CicoSCPositionOSConf() {} + ~CicoSCPositionOSConf() {} /// dump log this class member variables - void dumpConf(void) + void dumpConf() { ICO_DBG("OnScreen Window position : x:%d, y:%d, w:%d, h:%d", m_x, m_y, m_w, m_h); } diff --git a/lib/common/CicoSystemConfig.cpp b/lib/common/CicoSystemConfig.cpp index 1b45b5f..199c3d3 100644 --- a/lib/common/CicoSystemConfig.cpp +++ b/lib/common/CicoSystemConfig.cpp @@ -1381,10 +1381,10 @@ CicoSystemConfig::calcGeometryExpr(const string & expr, const CicoSCNodeConf* CicoSystemConfig::findNodeConfbyName(const string & name) { - vector::iterator itr; + vector::const_iterator itr; itr = m_nodeConfList.begin(); for (; itr != m_nodeConfList.end(); ++itr) { - const CicoSCNodeConf* conf = const_cast(*itr); + const CicoSCNodeConf* conf = (*itr); if (name == conf->name) { return conf; } @@ -1403,11 +1403,10 @@ CicoSystemConfig::findNodeConfbyName(const string & name) const CicoSCDisplayConf* CicoSystemConfig::findDisplayConfbyName(const string & name) { - vector::iterator itr; + vector::const_iterator itr; itr = m_displayConfList.begin(); for (; itr != m_displayConfList.end(); ++itr) { - const CicoSCDisplayConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCDisplayConf* conf = (*itr); if (name == conf->name) { return conf; } @@ -1427,11 +1426,10 @@ const CicoSCDisplayConf* CicoSystemConfig::findDisplayConfbyName(const string& ECU, const string& name) { int nodeId = getNodeIdbyName(ECU); - vector::iterator itr; + vector::const_iterator itr; itr = m_displayConfList.begin(); for (; itr != m_displayConfList.end(); ++itr) { - const CicoSCDisplayConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCDisplayConf* conf = (*itr); if ((name == conf->name)&&(nodeId == conf->node)) { return conf; } @@ -1450,11 +1448,10 @@ CicoSystemConfig::findDisplayConfbyName(const string& ECU, const string& name) const CicoSCDisplayConf* CicoSystemConfig::findDisplayConfbyId(int id) { - vector::iterator itr; + vector::const_iterator itr; itr = m_displayConfList.begin(); for (; itr != m_displayConfList.end(); ++itr) { - const CicoSCDisplayConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCDisplayConf* conf = (*itr); if (id == conf->id) { return conf; } @@ -1482,8 +1479,7 @@ CicoSystemConfig::findLayerConfbyName(const string & displayName, vector::const_iterator itr; itr = displayConf->layerConfList.begin(); for (; itr != displayConf->layerConfList.end(); ++itr) { - const CicoSCLayerConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCLayerConf* conf = (*itr); // if (layerName == conf->name) { if ((layerName == conf->name) && (-1 == conf->layout_id)) { return conf; @@ -1516,8 +1512,7 @@ CicoSystemConfig::findLayerConfbyName(const string& ECU, vector::const_iterator itr; itr = displayConf->layerConfList.begin(); for (; itr != displayConf->layerConfList.end(); ++itr) { - const CicoSCLayerConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCLayerConf* conf = (*itr); if ((layer == conf->name)&&(layout == conf->layout_name)&& (area == conf->area_name)) { return conf; @@ -1546,8 +1541,7 @@ CicoSystemConfig::findLayerConfbyIdx(int displayid, int idx) vector::const_iterator itr; itr = displayConf->layerConfList.begin(); for (; itr != displayConf->layerConfList.end(); ++itr) { - const CicoSCLayerConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCLayerConf* conf = (*itr); if (idx <= 0) { return conf; } @@ -1581,8 +1575,7 @@ CicoSystemConfig::findDisplayZoneConfbyName(const string & displayName, vector::const_iterator itr; itr = displayConf->zoneConfList.begin(); for (; itr != displayConf->zoneConfList.end(); ++itr) { - const CicoSCDisplayZoneConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCDisplayZoneConf* conf = (*itr); if (zoneName == conf->name) { // ICO_TRA("CicoSystemConfig::findDisplayZoneConfbyName Leave" // "(0x%08x)", conf); @@ -1604,11 +1597,10 @@ CicoSystemConfig::findDisplayZoneConfbyName(const string & displayName, const CicoSCSoundConf* CicoSystemConfig::findSoundConfbyName(const string & name) { - vector::iterator itr; + vector::const_iterator itr; itr = m_soundConfList.begin(); for (; itr != m_soundConfList.end(); ++itr) { - const CicoSCSoundConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCSoundConf* conf = (*itr); if (name == conf->name) { return conf; } @@ -1641,8 +1633,7 @@ CicoSystemConfig::findSoundZoneConfbyName(const string & soundName, vector::const_iterator itr; itr = soundConf->zoneConfList.begin(); for (; itr != soundConf->zoneConfList.end(); ++itr) { - const CicoSCSoundZoneConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCSoundZoneConf* conf = (*itr); if (zoneName == conf->name) { return conf; } @@ -1661,11 +1652,10 @@ CicoSystemConfig::findSoundZoneConfbyName(const string & soundName, const CicoSCInputDevConf* CicoSystemConfig::findInputDevConfbyName(const string & name) { - vector::iterator itr; + vector::const_iterator itr; itr = m_inputDevConfList.begin(); for (; itr != m_inputDevConfList.end(); ++itr) { - const CicoSCInputDevConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCInputDevConf* conf = (*itr); if (name == conf->name) { return conf; } @@ -1696,8 +1686,7 @@ CicoSystemConfig::findSwitchConfbyName(const string & inputDevName, vector::const_iterator itr; itr = inputDevConf->switchConfList.begin(); for (; itr != inputDevConf->switchConfList.end(); ++itr) { - const CicoSCSwitchConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCSwitchConf* conf = (*itr); if (switchName == conf->name) { return conf; } @@ -1717,11 +1706,10 @@ CicoSystemConfig::findSwitchConfbyName(const string & inputDevName, const CicoSCAppKindConf* CicoSystemConfig::findAppKindConfbyName(const string & name) { - vector::iterator itr; + vector::const_iterator itr; itr = m_appKindConfList.begin(); for (; itr != m_appKindConfList.end(); ++itr) { - const CicoSCAppKindConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCAppKindConf* conf = (*itr); if (name == conf->name) { return conf; } @@ -1740,10 +1728,10 @@ CicoSystemConfig::findAppKindConfbyName(const string & name) const CicoSCDisplayZoneConf* CicoSystemConfig::findDisplayZoneConfbyId(int id) { - vector::iterator itr; + vector::const_iterator itr; itr = m_displayConfList.begin(); for (; itr != m_displayConfList.end(); ++itr) { - vector::iterator itr2; + vector::const_iterator itr2; itr2 = (*itr)->zoneConfList.begin(); for (; itr2 != (*itr)->zoneConfList.end(); ++itr2) { if (id == (*itr2)->id) { @@ -1765,10 +1753,10 @@ CicoSystemConfig::findDisplayZoneConfbyId(int id) const CicoSCSoundZoneConf* CicoSystemConfig::findSoundZoneConfbyId(int id) { - vector::iterator itr; + vector::const_iterator itr; itr = m_soundConfList.begin(); for (; itr != m_soundConfList.end(); ++itr) { - vector::iterator itr2; + vector::const_iterator itr2; itr2 = (*itr)->zoneConfList.begin(); for (; itr2 != (*itr)->zoneConfList.end(); ++itr2) { if (id == (*itr2)->id) { @@ -1790,11 +1778,10 @@ CicoSystemConfig::findSoundZoneConfbyId(int id) const CicoSCCategoryConf* CicoSystemConfig::findCategoryConfbyName(const string & name) { - vector::iterator itr; + vector::const_iterator itr; itr = m_categoryConfList.begin(); for (; itr != m_categoryConfList.end(); ++itr) { - const CicoSCCategoryConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCCategoryConf* conf = (*itr); if (name == conf->name) { //return const_cast(itr->pointer); return conf; @@ -1814,11 +1801,10 @@ CicoSystemConfig::findCategoryConfbyName(const string & name) const CicoSCCategoryConf* CicoSystemConfig::findCategoryConfbyId(int id) { - vector::iterator itr; + vector::const_iterator itr; itr = m_categoryConfList.begin(); for (; itr != m_categoryConfList.end(); ++itr) { - const CicoSCCategoryConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCCategoryConf* conf = (*itr); if (id == conf->id) { return conf; } @@ -1837,7 +1823,7 @@ CicoSystemConfig::findCategoryConfbyId(int id) const CicoSCAppKindConf * CicoSystemConfig::findAppKindConfbyId(int id) { - vector::iterator itr; + vector::const_iterator itr; itr = m_appKindConfList.begin(); for (; itr != m_appKindConfList.end(); ++itr) { if (id == (*itr)->id) { @@ -1909,11 +1895,10 @@ CicoSystemConfig::getDisplayIdbyName(const string & name) int CicoSystemConfig::getDisplayIdbyNo(int no) { - vector::iterator itr; + vector::const_iterator itr; itr = m_displayConfList.begin(); for (; itr != m_displayConfList.end(); ++itr) { - const CicoSCDisplayConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCDisplayConf* conf = (*itr); if (no == conf->no) { return conf->id; } @@ -2178,11 +2163,10 @@ CicoSystemConfig::getCategoryObjbyCaategoryID(int id) if (-1 == id) { return NULL; } - vector::iterator itr; + vector::const_iterator itr; itr = m_categoryConfList.begin(); for (; itr != m_categoryConfList.end(); ++itr) { - const CicoSCCategoryConf* conf = NULL; - conf = const_cast(*itr); + const CicoSCCategoryConf* conf = (*itr); if (id == conf->id) { //return const_cast(itr->pointer); return conf; @@ -2291,52 +2275,34 @@ void CicoSystemConfig::createRoleConf(const ptree& root) //-------------------------------------------------------------------------- void CicoSystemConfig::createPositionOSConf(const ptree& root) { - m_positionOSConf = new CicoSCPositionOSConf(); ptree posc = root.get_child("systemconfig.on_screen_position"); - try { - optional opts = posc.get_optional("x"); - if (true == opts.is_initialized()) { - m_positionOSConf->m_x = atoi(opts.get().c_str()); - } - } - catch (...) { - ICO_WRN("NG x"); - m_positionOSConf->m_x = 0; - } + int x = ICO_SYC_ONSCREEN_WINDOW_START_X; + int y = ICO_SYC_ONSCREEN_WINDOW_START_Y; + int w = ICO_SYC_ONSCREEN_WINDOW_WIDTH; + int h = ICO_SYC_ONSCREEN_WINDOW_HEIGHT; - try { - optional opts = posc.get_optional("y"); - if (true == opts.is_initialized()) { - m_positionOSConf->m_y = atoi(opts.get().c_str()); - } - } - catch (...) { - ICO_WRN("NG y"); - m_positionOSConf->m_y = 0; + optional optsx = posc.get_optional("x"); + if (true == optsx.is_initialized()) { + x = atoi(optsx.get().c_str()); } - try { - optional opts = posc.get_optional("w"); - if (true == opts.is_initialized()) { - m_positionOSConf->m_w = atoi(opts.get().c_str()); - } - } - catch (...) { - ICO_WRN("NG w"); - m_positionOSConf->m_w = 1080; + optional optsy = posc.get_optional("y"); + if (true == optsy.is_initialized()) { + y = atoi(optsy.get().c_str()); } - try { - optional opts = posc.get_optional("h"); - if (true == opts.is_initialized()) { - m_positionOSConf->m_h = atoi(opts.get().c_str()); - } + optional optsw = posc.get_optional("w"); + if (true == optsw.is_initialized()) { + w = atoi(optsw.get().c_str()); } - catch (...) { - ICO_WRN("NG h"); - m_positionOSConf->m_h = 1920; + + optional optsh = posc.get_optional("h"); + if (true == optsh.is_initialized()) { + h = atoi(optsh.get().c_str()); } + + m_positionOSConf = new CicoSCPositionOSConf(x, y, w, h); m_positionOSConf->dumpConf(); } diff --git a/lib/system-controller/CicoSCLayer.cpp b/lib/system-controller/CicoSCLayer.cpp index 95b5ffe..49eae2f 100644 --- a/lib/system-controller/CicoSCLayer.cpp +++ b/lib/system-controller/CicoSCLayer.cpp @@ -130,10 +130,7 @@ CicoSCLayer::removeSurface(int surfaceid) bool CicoSCLayer::is_topSurface(int surfaceid) { - if ((numsurfaces > 0) && (surfaceids[numsurfaces-1] == surfaceid)) { - return true; - } - return false; + return (numsurfaces > 0) && (surfaceids[numsurfaces-1] == surfaceid); } //-------------------------------------------------------------------------- @@ -144,10 +141,7 @@ CicoSCLayer::is_topSurface(int surfaceid) bool CicoSCLayer::is_buttomSurface(int surfaceid) { - if ((numsurfaces > 0) && (surfaceids[0-1] == surfaceid)) { - return true; - } - return false; + return (numsurfaces > 0) && (surfaceids[0] == surfaceid); } //-------------------------------------------------------------------------- diff --git a/lib/system-controller/CicoSCResourceManager.cpp b/lib/system-controller/CicoSCResourceManager.cpp index beaab1e..39e4016 100644 --- a/lib/system-controller/CicoSCResourceManager.cpp +++ b/lib/system-controller/CicoSCResourceManager.cpp @@ -196,7 +196,7 @@ CicoSCResourceManager::initialize(void) ICO_TRA("CicoSCResourceManager::initialize Leave"); return ret; } - + void CicoSCResourceManager::terminate(void) { @@ -220,7 +220,7 @@ CicoSCResourceManager::handleCommand(const CicoSCCommand &cmd, int reqtype = internal ? REQTYPE_AUTO : REQTYPE_APP; if ((MSG_CMD_CREATE_RES == cmd.cmdid) || (MSG_CMD_ACQUIRE_RES == cmd.cmdid)) { - + if (true == opt->dispres) { resource_request_t *req = newResourceRequest(RESID_KIND_DISPLAY, reqtype, @@ -233,7 +233,7 @@ CicoSCResourceManager::handleCommand(const CicoSCCommand &cmd, if (true == isTypeOnScreen(*req)) { acquireOnScreenDisplayResource(req); } - else + else if ((true == m_policyMgr->getRegulation()) && (false == isMatchDisplayed())) { updateDispResRegulationPreProc(req); @@ -320,7 +320,7 @@ CicoSCResourceManager::setInputController(CicoSCInputController *inputCtrl) } #if 0 -resource_request_t * +resource_request_t * CicoSCResourceManager::popDispResReq(resource_request_t *req) { ICO_TRA("CicoSCResourceManager::popDispResReq Enter"); @@ -371,7 +371,7 @@ CicoSCResourceManager::popSoundResReq(resource_request_t *req) return NULL; } -resource_request_t * +resource_request_t * CicoSCResourceManager::popInputResReq(resource_request_t *req) { ICO_TRA("CicoSCResourceManager::popInputResReq Enter"); @@ -460,7 +460,7 @@ CicoSCResourceManager::acquireDisplayResource(resource_request_t *newreq, } bool displayMatch = false; - // + // if (req != newreq) { char zoneO[128],zoneN[128]; zoneO[0] = zoneN[0] = '\0'; @@ -493,17 +493,17 @@ CicoSCResourceManager::acquireDisplayResource(resource_request_t *newreq, } // update request data req->dispzoneid = newreq->dispzoneid; - if (NULL != req->dispzone) free(req->dispzone); + free(req->dispzone); req->dispzone = strdup(newreq->dispzone); req->layerid = newreq->layerid; - if (NULL != req->animation) free(req->animation); + free(req->animation); req->animation = strdup(newreq->animation); req->animationTime = newreq->animationTime; // delete new request delResourceRequest(newreq); } - + if (false == control) { ICO_TRA("Enqueue waiting display resource request" "(req=0x%08x appid=%s)", req, req->appid); @@ -683,7 +683,7 @@ CicoSCResourceManager::releaseSoundResource(resource_request_t *newreq) } } - // If current request is not changed, + // If current request is not changed, // remove the request from the waiting queue. if (false == curchg) { resource_request_t *req = popSoundResReq(newreq); @@ -792,7 +792,7 @@ CicoSCResourceManager::releaseInputResource(resource_request_t *newreq) } } - // If current request is not changed, + // If current request is not changed, // remove the request from the waiting queue. if (false == curchg) { resource_request_t *req = popInputResReq(newreq); @@ -853,7 +853,7 @@ CicoSCResourceManager::newResourceRequest(int resid, } req->prio = req->category; - + req->released = 0; /* set resource id */ @@ -924,20 +924,20 @@ CicoSCResourceManager::delResourceRequest(resource_request_t *req) { if (NULL == req) return; - if (NULL != req->appid) free(req->appid); - if (NULL != req->dispzone) free(req->dispzone); - if (NULL != req->winname) free(req->winname); - if (NULL != req->animation) free(req->animation); - if (NULL != req->soundzone) free(req->soundzone); - if (NULL != req->soundname) free(req->soundname); - if (NULL != req->device) free(req->device); - if (NULL != req->ECU) free(req->ECU); // name to identify ECU - if (NULL != req->display) free(req->display); // name to identify Display in ECU - if (NULL != req->layer) free(req->layer); // name to identify Layer in Display - if (NULL != req->layout) free(req->layout); // name to identify layout in Layer - if (NULL != req->area) free(req->area); // name to Output position in Layout - if (NULL != req->dispatchApp) free(req->dispatchApp); // origin of application - if (NULL != req->role) free(req->role); // role of notice + free(req->appid); + free(req->dispzone); + free(req->winname); + free(req->animation); + free(req->soundzone); + free(req->soundname); + free(req->device); + free(req->ECU); // name to identify ECU + free(req->display); // name to identify Display in ECU + free(req->layer); // name to identify Layer in Display + free(req->layout); // name to identify layout in Layer + free(req->area); // name to Output position in Layout + free(req->dispatchApp); // origin of application + free(req->role); // role of notice free(req); } @@ -950,7 +950,7 @@ CicoSCResourceManager::enforceSound(unsigned short state, /* NOP */ ICO_TRA("CicoSCResourceManager::enforceSound Leave"); } - + // receive changed state void CicoSCResourceManager::receiveChangedState(int state) @@ -958,7 +958,7 @@ CicoSCResourceManager::receiveChangedState(int state) ICO_TRA("CicoSCResourceManager::receiveChangedState Enter" "(state=%d)", state); - if (STID_DRVREGULATION_ON == state) { + if (STID_DRVREGULATION_ON == state) { if (true == isMatchDisplayed()) { updateDisplayResourceRegulation(state); updateSoundResourceRegulation(state); @@ -1034,7 +1034,7 @@ CicoSCResourceManager::updateDisplayResource(resource_request_t *req, itr2 = m_curDispResOwerReq.begin(); for (; itr2 != m_curDispResOwerReq.end(); ++itr2) { resource_request_t *tmpreq = itr2->second; - + if (true == m_policyMgr->getDispZoneState(itr2->first)) { continue; } @@ -1213,7 +1213,7 @@ CicoSCResourceManager::updateInputResource(resource_request_t *req) // initialize current zone request ICO_DBG("Dequeue current input request queue " "(req=0x%08x input:%d appid=%s)", - m_curInputResReq[i], + m_curInputResReq[i], m_curInputResReq[i]->input, m_curInputResReq[i]->appid); ICO_PRF("CHG_GUI_RES input deprived input=%d appid=%s", m_curInputResReq[i]->input, @@ -1340,7 +1340,7 @@ CicoSCResourceManager::updateDisplayResourceRegulation(int state) m_waitingDispResReq.erase(itr2); ICO_DBG("Enqueue current display resource request" "(req=0x%08x zone=%02d:%s appid=%s)", - req, req->dispzoneid, + req, req->dispzoneid, req->dispzone, req->appid); ICO_PRF("CHG_GUI_RES display acquired zone=%02d:%s " "appid=%s", @@ -1372,7 +1372,7 @@ CicoSCResourceManager::updateDisplayResourceRegulation(int state) m_winCtrl->hide(surfaceid, m_animaName.c_str(), m_animaTime); } - + // show current window m_winCtrl->show(current->surfaceid, m_animaName.c_str(), m_animaTime); @@ -1530,7 +1530,7 @@ CicoSCResourceManager::updateInputResourceRegulation(int state) * @brief find currnet dipalay resource ower request * * @param [in] request compare requset - * + * * @return request object on same requeset found, NULL on not found */ //-------------------------------------------------------------------------- @@ -1557,7 +1557,7 @@ CicoSCResourceManager::findCurDispResOwerReq(resource_request_t *req) * @brief pop currnet dipalay resource ower request from list * * @param [in] request compare requset - * + * * @return request object on same requeset found, NULL on not found */ //-------------------------------------------------------------------------- @@ -1618,7 +1618,7 @@ CicoSCResourceManager::dumpCurDispResOwerReq(void) * @brief find waiting dipalay resource request * * @param [in] request compare requset - * + * * @return request object on same requeset found, NULL on not found */ //-------------------------------------------------------------------------- @@ -1643,7 +1643,7 @@ CicoSCResourceManager::findWaitingDispResReq(resource_request_t *req) * @brief pop waiting dipalay resource request from waiting list * * @param [in] request compare requset - * + * * @return request object on same requeset found, NULL on not found */ //-------------------------------------------------------------------------- @@ -1770,10 +1770,10 @@ CicoSCResourceManager::updateDispResRegulationPreProc(resource_request_t *req) } } } - + min = ICO_DISPLAY1_ZONEID_MIN; max = ICO_DISPLAY1_ZONEID_MAX; - if ((NULL == curreq) && + if ((NULL == curreq) && (req->dispzoneid >= min) && (req->dispzoneid <= max)) { for (int i = min; i <= max; ++i) { std::map::iterator itr; @@ -2165,7 +2165,7 @@ CicoSCResourceManager::releaseOnScreenDisplayResource(resource_request_t *req) if (NULL != bwo) { m_winCtrl->hide(bwo->surfaceid, NULL, 0); if (m_rrtHO != tgt) { - ICO_DBG("_____ NG Control OnScreen Resource %x(%d, %d), %x", + ICO_DBG("_____ NG Control OnScreen Resource %x(%d, %d), %x", m_rrtHO, m_rrtHO->pid, m_rrtHO->resourceId, tgt); resCB(ICO_SYC_EV_RES_WAITING, *m_rrtHO); } @@ -2308,9 +2308,13 @@ const resource_request_t* CicoSCResourceManager::getNoticeOfHighOder() if ((ICO_SYC_ROLE_CONF_DEF == hEv) || (0 == hEv)) { continue; // continue of for itr } + bool test = m_policyMgr->testSMEvent(hEv); if (true == m_policyMgr->sendSMEvent(hEv)) { r = (*itr); } + else if (true == test) { + r = (*itr); + } } ICO_TRA("Leave %x", r); return r; diff --git a/lib/system-controller/CicoSCWayland.cpp b/lib/system-controller/CicoSCWayland.cpp index ea95bf4..b0b4c42 100644 --- a/lib/system-controller/CicoSCWayland.cpp +++ b/lib/system-controller/CicoSCWayland.cpp @@ -28,8 +28,8 @@ using namespace std; #include -#include -#include +#include +#include #include "CicoSCWayland.h" #include "CicoSCWlWinMgrIF.h" diff --git a/lib/system-controller/CicoSCWindowController.cpp b/lib/system-controller/CicoSCWindowController.cpp index 8e934dd..d1c8e4c 100644 --- a/lib/system-controller/CicoSCWindowController.cpp +++ b/lib/system-controller/CicoSCWindowController.cpp @@ -191,9 +191,12 @@ CicoSCWindowController::show(int surfaceid, const char *animation, int animationTime) { + int type = animationTime & ICO_SYC_WIN_SURF_FLAGS; + animationTime &= ~ICO_SYC_WIN_SURF_FLAGS; + ICO_TRA("CicoSCWindowController::show Enter" - "(surfaceid=0x%08X animation=%s animationTime=%d)", - surfaceid, animation, animationTime); + "(surfaceid=%08x animation=%s type=%x animationTime=%d)", + surfaceid, animation, type, animationTime); // find window information in window list CicoSCWindow *window = findWindow(surfaceid); @@ -220,21 +223,24 @@ CicoSCWindowController::show(int surfaceid, // set animation request to Multi Window Manager int raiseFlag = ICO_SYC_WIN_RAISE_NOCHANGE; - if (animationTime & ICO_SYC_WIN_SURF_RAISE) { + if (type & ICO_SYC_WIN_SURF_RAISE) { raiseFlag = ICO_SYC_WIN_RAISE_RAISE; } - else if (animationTime & ICO_SYC_WIN_SURF_LOWER) { + else if (type & ICO_SYC_WIN_SURF_LOWER) { raiseFlag = ICO_SYC_WIN_RAISE_LOWER; } - else if (((animationTime & ICO_SYC_WIN_SURF_NOCHANGE) == 0) && + else if (((type & ICO_SYC_WIN_SURF_NOCHANGE) == 0) && (false == window->raise)) { raiseFlag = ICO_SYC_WIN_RAISE_RAISE; } if ((NULL != animation) && (animation[0] != '\0')) { // set animation request to Multi Window Manager CicoSCWlWinMgrIF::setAnimation(window->surfaceid, - ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW, - animation, animationTime & ~ICO_SYC_WIN_SURF_FLAGS); + (type & ICO_SYC_WIN_SURF_ONESHOT) ? + ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW | + ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT : + ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW, + animation, animationTime); } // set raise/lower request (if need) @@ -315,9 +321,12 @@ CicoSCWindowController::hide(int surfaceid, const char *animation, int animationTime) { + int type = animationTime & ICO_SYC_WIN_SURF_FLAGS; + animationTime &= ~ICO_SYC_WIN_SURF_FLAGS; + ICO_TRA("CicoSCWindowController::hide Enter" - "(surfaceid=0x%08X animation=%s animationTime=%d)", - surfaceid, animation, animationTime); + "(surfaceid=%08x animation=%s type=%x animationTime=%d)", + surfaceid, animation, type, animationTime); // find window information in window list CicoSCWindow *window = findWindow(surfaceid); @@ -352,8 +361,11 @@ CicoSCWindowController::hide(int surfaceid, // set animation request to Multi Window Manager if ((NULL != animation) && (animation[0] != '\0')) { CicoSCWlWinMgrIF::setAnimation(window->surfaceid, - ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE, - animation, animationTime & ~ICO_SYC_WIN_SURF_FLAGS); + (type & ICO_SYC_WIN_SURF_ONESHOT) ? + ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE | + ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT : + ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE, + animation, animationTime); } // set visible request to Multi Window Manager @@ -389,9 +401,12 @@ CicoSCWindowController::resize(int surfaceid, const char *animation, int animationTime) { + int type = animationTime & ICO_SYC_WIN_SURF_FLAGS; + animationTime &= ~ICO_SYC_WIN_SURF_FLAGS; + ICO_TRA("CicoSCWindowController::resize Enter" - "(surfaceid=0x%08X h=%d w=%d animation=%s animationTime=%d)", - surfaceid, w, h, animation, animationTime); + "(surfaceid=%08x h=%d w=%d animation=%s type=%x animationTime=%d)", + surfaceid, w, h, animation, type, animationTime); // find window information in window list CicoSCWindow *window = findWindow(surfaceid); @@ -404,7 +419,10 @@ CicoSCWindowController::resize(int surfaceid, // set animation request to Multi Window Manager if ((NULL != animation) && (animation[0] != '\0')) { CicoSCWlWinMgrIF::setAnimation(window->surfaceid, - ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE, + (type & ICO_SYC_WIN_SURF_ONESHOT) ? + ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE | + ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT : + ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE, animation, animationTime); } @@ -446,10 +464,13 @@ CicoSCWindowController::move(int surfaceid, const char *animation, int animationTime) { + int type = animationTime & ICO_SYC_WIN_SURF_FLAGS; + animationTime &= ~ICO_SYC_WIN_SURF_FLAGS; + ICO_TRA("CicoSCWindowController::move Enter" - "(surfaceid=0x%08X nodeid=%d x=%d y=%d " - "animation=%s animationTime=%d)", - surfaceid, nodeid, x, y, animation, animationTime); + "(surfaceid=%08x nodeid=%d x=%d y=%d " + "animation=%s type=%x animationTime=%d)", + surfaceid, nodeid, x, y, animation, type, animationTime); // find window information in window list CicoSCWindow *window = findWindow(surfaceid); @@ -468,7 +489,10 @@ CicoSCWindowController::move(int surfaceid, // set animation request to Multi Window Manager if ((NULL != animation) && (animation[0] != '\0')) { CicoSCWlWinMgrIF::setAnimation(window->surfaceid, - ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE, + (type & ICO_SYC_WIN_SURF_ONESHOT) ? + ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE | + ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT : + ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE, animation, animationTime); } @@ -510,9 +534,12 @@ CicoSCWindowController::raise(int surfaceid, const char *animation, int animationTime) { + int type = animationTime & ICO_SYC_WIN_SURF_FLAGS; + animationTime &= ~ICO_SYC_WIN_SURF_FLAGS; + ICO_TRA("CicoSCWindowController::raise Enter" - "(surfaceid=0x%08X animation=%s animationTime=%d)", - surfaceid, animation, animationTime); + "(surfaceid=%08x animation=%s type=%x animationTime=%d)", + surfaceid, animation, type, animationTime); // find window information in window list CicoSCWindow *window = findWindow(surfaceid); @@ -525,7 +552,10 @@ CicoSCWindowController::raise(int surfaceid, // set animation request to Multi Window Manager if ((NULL != animation) && (animation[0] != '\0')) { CicoSCWindowController::setAnimation(window->surfaceid, - ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW, + (type & ICO_SYC_WIN_SURF_ONESHOT) ? + ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW | + ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT : + ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW, animation, animationTime); } // set raise request to Multi Window Manager @@ -577,7 +607,7 @@ CicoSCWindowController::setGeometry(int surfaceid, int moveAnimationTime) { ICO_TRA("CicoSCWindowController::setGeometry Enter" - "(surfaceid=0x%08X nodeid=%d layerid=%d x=%d y=%d w=%d h=%d " + "(surfaceid=%08x nodeid=%d layerid=%d x=%d y=%d w=%d h=%d " "resizeAnimation=%s resizeAnimationTime=%d " "moveAnimation=%s moveAnimationTime=%d)", surfaceid, nodeid, layerid, x, y, w, h, @@ -806,9 +836,12 @@ CicoSCWindowController::lower(int surfaceid, const char *animation, int animationTime) { + int type = animationTime & ICO_SYC_WIN_SURF_FLAGS; + animationTime &= ~ICO_SYC_WIN_SURF_FLAGS; + ICO_TRA("CicoSCWindowController::lower Enter" - "(surfaceid=0x%08X animation=%s animationTime=%d)", - surfaceid, animation, animationTime); + "(surfaceid=08x animation=%s type=%x animationTime=%d)", + surfaceid, animation, type, animationTime); // find window information in window list CicoSCWindow *window = findWindow(surfaceid); @@ -821,7 +854,10 @@ CicoSCWindowController::lower(int surfaceid, // set animation request to Multi Window Manager if ((NULL != animation) && (animation[0] != '\0')) { CicoSCWlWinMgrIF::setAnimation(window->surfaceid, - ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE, + (type & ICO_SYC_WIN_SURF_ONESHOT) ? + ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW | + ICO_WINDOW_MGR_ANIMATION_TYPE_ONESHOT : + ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW, animation, animationTime); } @@ -1170,10 +1206,6 @@ CicoSCWindowController::mapSurface(int surfaceid, int framerate, const char *fil return ICO_SYC_ENOENT; } - if (framerate < 0) { - framerate = 0; - } - CicoSCWlWinMgrIF::mapSurface(surfaceid, framerate, filepath); CicoSCWayland::getInstance()->flushDisplay(); diff --git a/lib/system-controller/CicoSCWlInputMgrIF.h b/lib/system-controller/CicoSCWlInputMgrIF.h index 41328c3..261684c 100644 --- a/lib/system-controller/CicoSCWlInputMgrIF.h +++ b/lib/system-controller/CicoSCWlInputMgrIF.h @@ -18,7 +18,7 @@ #define __CICO_SC_WL_INPUT_MGR_IF_H__ #include -#include +#include #include "CicoSCWaylandIF.h" //-------------------------------------------------------------------------- diff --git a/lib/system-controller/CicoSCWlWinMgrIF.cpp b/lib/system-controller/CicoSCWlWinMgrIF.cpp index dda5c06..e0bfce4 100644 --- a/lib/system-controller/CicoSCWlWinMgrIF.cpp +++ b/lib/system-controller/CicoSCWlWinMgrIF.cpp @@ -56,7 +56,6 @@ CicoSCWlWinMgrIF::CicoSCWlWinMgrIF() m_listener.destroy_surface = wlDestroySurfaceCB; // genivi ivi_application listener - m_ivi_app_listener.error = wlIviAppErrorCB; m_ivi_app_listener.wl_shell_info = wlIviAppNativeShellInfoCB; // genivi ivi_controller listener @@ -470,6 +469,8 @@ CicoSCWlWinMgrIF::wlIviCtrlRemoveSurface(uint32_t id_surface) ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlRemoveSurface(%x) removed", id_surface); return; } + bp = tp; + tp = tp->next; } ICO_TRA("CicoSCWlWinMgrIF::wlIviCtrlRemoveSurface(%x) dose not exist", id_surface); } @@ -875,31 +876,6 @@ CicoSCWlWinMgrIF::wlOutputModeCB(void *data, //-------------------------------------------------------------------------- /** - * @brief wayland ivi-shell ivi-application protocol error callback - * - * @param [in] data user data(unused) - * @param [in] ivi_application wayland ivi-application interface - * @param [in] error_code error code - * @param [in] error_text error message - */ -//-------------------------------------------------------------------------- -void -CicoSCWlWinMgrIF::wlIviAppErrorCB(void *data, - struct ivi_application *ivi_application, - int32_t error_code, const char *error_text) -{ - ICO_TRA("CicoSCWlWinMgrIF::wlIviAppErrorCB: Enter(%d,%s)", - error_code, error_text ? error_text : "(null)"); - - if (NULL == data) { - ICO_WRN("CicoSCWlWinMgrIF::wlIviAppErrorCB: data is null"); - return; - } - ICO_TRA("CicoSCWlWinMgrIF::wlIviAppErrorCB: Leave"); -} - -//-------------------------------------------------------------------------- -/** * @brief wayland ivi-shell ivi-application protocol create wl_surface callback * * @param [in] data user data(unused) diff --git a/lib/system-controller/CicoSCWlWinMgrIF.h b/lib/system-controller/CicoSCWlWinMgrIF.h index 89bbcda..e464192 100644 --- a/lib/system-controller/CicoSCWlWinMgrIF.h +++ b/lib/system-controller/CicoSCWlWinMgrIF.h @@ -18,11 +18,11 @@ #define __CICO_SC_WL_WINMGR_IF_H__ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "ico_syc_type.h" #include "CicoSCWaylandIF.h" @@ -205,11 +205,6 @@ private: int32_t height, int32_t refresh); - static void wlIviAppErrorCB(void *data, - struct ivi_application *ivi_application, - int32_t error_code, - const char *error_text); - static void wlIviAppNativeShellInfoCB(void *data, struct ivi_application *ivi_application, int32_t pid, diff --git a/lib/system-controller/Makefile.am b/lib/system-controller/Makefile.am index 082ade4..80f91d4 100644 --- a/lib/system-controller/Makefile.am +++ b/lib/system-controller/Makefile.am @@ -53,8 +53,6 @@ libico_system_controller_la_CPPFLAGS = \ @MURPHYRESOURCE_CFLAGS@ \ @EDBUS_CFLAGS@ \ $(UWS_CFLAGS) \ - $(GENIVI_CFLAGS) \ - $(WESTONPLUGIN_CFLAGS) \ -I../../include \ -I../common \ -I../misc/state-machine diff --git a/packaging/ico-uxf-homescreen.changes b/packaging/ico-uxf-homescreen.changes index b5e7a3f..d49582d 100644 --- a/packaging/ico-uxf-homescreen.changes +++ b/packaging/ico-uxf-homescreen.changes @@ -1,3 +1,15 @@ +* Wed Mar 26 2014 Shibata Makoto accepted/tizen/ivi/release/20140312.115201@3fee487 +- bug fix: Notification launch support. (TIVI-2926/1892) +- bug fix: HomeScreen sometimes fails in connection with SystemController at the time of starting. +- bug fix: Local time is supported in the clock display of StatusBar. +- improve: A multiplex notice is supported in OnScreen. +- bug fix: LiveThumbnail of HomeScreen not works when APP installed. +- Homescreen take over the SURFACE of the old menu to the new menu, when that regenerate the menu. +- Delete as named ico_send_inputevent tool (It is contained in weston-plugin). +- bug fix: Swipe operation cannot be performed. +- Live thumbnail not updated at the time of menu un-displaying. +- Correction of the review indication from a Tizen team. + * Fri Feb 28 2014 Shibata Makoto accepted/tizen/ivi/20140226.204656@99d1ebc - 0.9.21 release -- A spec file is changed corresponding to the packages of GENIVI layer management. diff --git a/src/homescreen/CicoHSMenuTile.cpp b/src/homescreen/CicoHSMenuTile.cpp index ee6291c..5b5c7b3 100644 --- a/src/homescreen/CicoHSMenuTile.cpp +++ b/src/homescreen/CicoHSMenuTile.cpp @@ -490,10 +490,8 @@ CicoHSMenuTile::ValidMenuIcon(void) if (app_running) { ICO_DBG("CicoHSMenuTile::ValidMenuIcon: %s show icon", appid); app_running = false; - if (thumb.pixel_data) { - free(thumb.pixel_data); - thumb.pixel_data = NULL; - } + free(thumb.pixel_data); + thumb.pixel_data = NULL; if (icon == thumb_tile) { icon = tile; if (thumb_tile) { @@ -532,8 +530,7 @@ CicoHSMenuTile::ValidThumbnail(int surface) ICO_HS_THUMB_FILEEXT, thumb.surface); (void) unlink(sWork); ico_syc_unmap_thumb(thumb.surface); - // delete image and texture - if ((surface == 0) && (thumb.pixel_data)) { + if (surface == 0) { free(thumb.pixel_data); thumb.pixel_data = NULL; } @@ -728,7 +725,7 @@ CicoHSMenuTile::SetThumbnail(ico_syc_thumb_info_t *info) /* read surface image pixel */ int bufsize = ((thumb.width * thumb.height * 4 + 4095) / 4096) * 4096; if ((! thumb.pixel_data) || (bufsize > thumb.pixel_bufsize)) { - if (thumb.pixel_data) free(thumb.pixel_data); + free(thumb.pixel_data); thumb.pixel_data = (char *)malloc(bufsize); thumb.pixel_bufsize = bufsize; if (thumb.pixel_data) { @@ -785,10 +782,8 @@ CicoHSMenuTile::SetThumbnail(ico_syc_thumb_info_t *info) ico_syc_unmap_thumb(thumb.surface); thumb.surface = 0; } - if (thumb.pixel_data) { - free(thumb.pixel_data); - thumb.pixel_data = NULL; - } + free(thumb.pixel_data); + thumb.pixel_data = NULL; icon = tile; } diff --git a/src/homescreen/CicoHSMenuTile.h b/src/homescreen/CicoHSMenuTile.h index 17319d6..1950504 100644 --- a/src/homescreen/CicoHSMenuTile.h +++ b/src/homescreen/CicoHSMenuTile.h @@ -75,8 +75,8 @@ #define ICO_HS_MENUTILE_TERM_ICON_WIDTH 64 #define ICO_HS_MENUTILE_TERM_ICON_HEIGHT 64 -#define ICO_HS_MENUTILE_THUMBNAIL_FPS_SHOW 10 -#define ICO_HS_MENUTILE_THUMBNAIL_FPS_HIDE 1 +#define ICO_HS_MENUTILE_THUMBNAIL_FPS_SHOW 15 /* 15 frames/sec */ +#define ICO_HS_MENUTILE_THUMBNAIL_FPS_HIDE -1 /* meanse 'not update' */ #define ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX 4 #define ICO_HS_MENUTILE_THUMBNAIL_REDUCE_PIX2 6 #define ICO_HS_MENUTILE_THUMBNAIL_REDUCE_RATE 10 diff --git a/src/homescreen/CicoHSSwipeTouch.cpp b/src/homescreen/CicoHSSwipeTouch.cpp index e705dd9..b23b318 100644 --- a/src/homescreen/CicoHSSwipeTouch.cpp +++ b/src/homescreen/CicoHSSwipeTouch.cpp @@ -212,7 +212,8 @@ CicoHSSwipeTouch::TouchUpSwipe(void *data, Evas *evas, Evas_Object *obj, void *e } else { animation.time = ICO_HS_SWIPE_TOUCH_SWIPE_ANIMA_TIME | - ICO_SYC_WIN_SURF_RAISE | ICO_SYC_WIN_SURF_NORESCTL; + ICO_SYC_WIN_SURF_RAISE | ICO_SYC_WIN_SURF_NORESCTL | + ICO_SYC_WIN_SURF_ONESHOT; /* show before application with slide to right */ appinfo = CicoHomeScreen::GetAppInfo(histapp.c_str()); @@ -237,7 +238,8 @@ CicoHSSwipeTouch::TouchUpSwipe(void *data, Evas *evas, Evas_Object *obj, void *e } else { animation.time = ICO_HS_SWIPE_TOUCH_SWIPE_ANIMA_TIME | - ICO_SYC_WIN_SURF_NORESCTL; + ICO_SYC_WIN_SURF_NORESCTL | + ICO_SYC_WIN_SURF_ONESHOT; appinfo = CicoHomeScreen::GetAppInfo(curapp.c_str()); if (appinfo) { animation.name = (char *)"slide.toleft"; @@ -303,7 +305,8 @@ CicoHSSwipeTouch::TouchUpSwipe(void *data, Evas *evas, Evas_Object *obj, void *e } else { animation.time = ICO_HS_SWIPE_TOUCH_SWIPE_ANIMA_TIME | - ICO_SYC_WIN_SURF_RAISE | ICO_SYC_WIN_SURF_NORESCTL; + ICO_SYC_WIN_SURF_RAISE | ICO_SYC_WIN_SURF_NORESCTL | + ICO_SYC_WIN_SURF_ONESHOT; /* show next application with slide to left */ appinfo = CicoHomeScreen::GetAppInfo(histapp.c_str()); @@ -328,7 +331,8 @@ CicoHSSwipeTouch::TouchUpSwipe(void *data, Evas *evas, Evas_Object *obj, void *e } else { animation.time = ICO_HS_SWIPE_TOUCH_SWIPE_ANIMA_TIME | - ICO_SYC_WIN_SURF_NORESCTL; + ICO_SYC_WIN_SURF_NORESCTL | + ICO_SYC_WIN_SURF_ONESHOT; appinfo = CicoHomeScreen::GetAppInfo(curapp.c_str()); if (appinfo) { animation.name = (char *)"slide.toright"; diff --git a/src/homescreen/CicoHomeScreenCommon.h b/src/homescreen/CicoHomeScreenCommon.h index 0161d22..aa0d8d2 100644 --- a/src/homescreen/CicoHomeScreenCommon.h +++ b/src/homescreen/CicoHomeScreenCommon.h @@ -15,7 +15,7 @@ #define __CICO_HOMESCREEN_COMMON_H__ #include -#include +#include #include "ico_syc_sysdef.h" #define ICO_OK 0 diff --git a/src/homescreen/Makefile.am b/src/homescreen/Makefile.am index 4bfbffc..be4cf9d 100644 --- a/src/homescreen/Makefile.am +++ b/src/homescreen/Makefile.am @@ -43,7 +43,6 @@ HomeScreen_CFLAGS= \ $(UWS_CFLAGS) \ $(PKGMGR_CFLAGS) \ $(UWS_CFLAGS) \ - $(WESTONPLUGIN_CFLAGS) \ -I../../include \ -I../../lib/common @@ -57,7 +56,6 @@ HomeScreen_CXXFLAGS= \ $(UWS_CFLAGS) \ $(PKGMGR_CFLAGS) \ $(UWS_CFLAGS) \ - $(WESTONPLUGIN_CFLAGS) \ -I../../include \ -I../../lib/common diff --git a/src/onscreen/CicoOSClient.cpp b/src/onscreen/CicoOSClient.cpp new file mode 100644 index 0000000..47646ff --- /dev/null +++ b/src/onscreen/CicoOSClient.cpp @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2013, TOYOTA MOTOR CORPORATION. + * + * This program is licensed under the terms and conditions of the + * Apache License, version 2.0. The full text of the Apache License is at + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ + +//========================================================================== +/** + * @file CicoOSClient.cpp + * + * @brief This file implementation of CicoOSClient class + */ +//========================================================================== + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace boost::property_tree; +using namespace std; + +#include "CicoOSClient.h" + +#include +#include "ico_syc_error.h" +#include "ico_syc_msg_cmd_def.h" + +//========================================================================== +// private static variable +//========================================================================== +CicoOSClient* CicoOSClient::ms_myInstance = NULL; + +//-------------------------------------------------------------------------- +/** + * @brief default constructor + */ +//-------------------------------------------------------------------------- +CicoOSClient::CicoOSClient() + :m_uwsContext(NULL), m_id(NULL), m_seqNum(seqMin) +{ +} + +//-------------------------------------------------------------------------- +/** + * @brief destructor + */ +//-------------------------------------------------------------------------- +CicoOSClient::~CicoOSClient() +{ + if (NULL != m_uwsContext) { + ico_uws_close(m_uwsContext); + } +} + +//-------------------------------------------------------------------------- +/** + * @brief get CicoOSClient instance + * + * @return CicoOSClient instance + */ +//-------------------------------------------------------------------------- +CicoOSClient* +CicoOSClient::getInstance() +{ + if (NULL == ms_myInstance) { + ms_myInstance = new CicoOSClient(); + } + + return ms_myInstance; +} + +//-------------------------------------------------------------------------- +/** + * @brief connect + * + * @param [in] port websocket port + * @param [in] protocol websocket protocol name + * + * @return ICO_SYC_EOK on success, other on error + * @retval ICO_SYC_EOK success + * @retval ICO_SYC_ENOSYS error(connection fail) + */ +//-------------------------------------------------------------------------- +bool +CicoOSClient::connect() +{ + ICO_TRA("CicoOSClient::connect Enter"); + + /* create context */ + m_uwsContext = ico_uws_create_context(DEF_WS_CLI_HS_PORT, + DEF_WS_CLI_HS_PROTOCOL); + if (NULL == m_uwsContext) { + ICO_ERR("ico_uws_create_context() failed."); + ICO_TRA("CicoOSClient::connect Leave false"); + return false; + } + + /* set callback */ + int ret = ico_uws_set_event_cb(m_uwsContext, uwsReceiveEventCB, + (void *)this); + if (ret != ICO_UWS_ERR_NONE) { + ICO_ERR("ico_uws_set_event_cb() failed(%d).", ret); + ICO_TRA("CicoOSClient::connect Leave false"); + return false; + } + + ecore_timer_add(timerCount, CicoOSClient::ecoreTimerCB, this); + + ICO_TRA("CicoOSClient::connect Leave ture"); + + return true; +} + +//-------------------------------------------------------------------------- +/** + * @brief control sequence number + */ +//-------------------------------------------------------------------------- +void CicoOSClient::updateSeqNum() +{ + m_seqNum++; + if (seqMax < m_seqNum) { + m_seqNum = seqMin; + } +} + +//-------------------------------------------------------------------------- +/** + * @brief get sequence number + */ +//-------------------------------------------------------------------------- +int CicoOSClient::getSeqNum() const +{ + return m_seqNum; +} + +//-------------------------------------------------------------------------- +/** + * @brief send message to application client + * + * @param [in] appid application id of destination + * @param [in] msg message + * + * @return ICO_SYC_EOK on success, other on error + */ +//-------------------------------------------------------------------------- +bool +CicoOSClient::sendLaunchMessage(const string& op_app) +{ + ICO_TRA("CicoOSClient::sendMessage Enter(%s)", op_app.c_str()); + if ((NULL == m_uwsContext) && (NULL == m_id)) { + ICO_TRA("CicoOSClient::sendMessage Leave(false)"); + return false; + } + ico_uws_service(m_uwsContext); + + ptree pt; + pt.put("command", MSG_CMD_WIN_CHANGE); +#if 0 + pt.put("source.appid", "org.tizen.onscreen"); +#else + pt.put("source.pid", (int)getpid()); +#endif + pt.put("source.seq_no", getSeqNum()); + updateSeqNum(); + pt.put("arg.appid", op_app); + pt.put("arg.zone", "Center"); + pt.put("arg.visible", 1); + stringstream ss; + write_json(ss, pt, false); + string m = ss.str(); + + size_t l = m.length(); + char b[l+1]; + strcpy(b, m.c_str()); + ICO_DBG("msg:%d, %s", l, b); + ico_uws_send(m_uwsContext, (void*)m_id, (unsigned char*)b, l); + ico_uws_service(m_uwsContext); +#if 0 + usleep(200); +#endif + + ICO_TRA("CicoOSClient::sendMessage Leave(true)"); + return true; +} + +//-------------------------------------------------------------------------- +/* + * @brief websocket utility callback function + * + * @param [in] context context + * @param [in] event event kinds + * @param [in] id client id + * @param [in] detail event detail + * @param [in] data user data + */ +//-------------------------------------------------------------------------- +void +CicoOSClient::uwsReceiveEventCB(const struct ico_uws_context* context, + const ico_uws_evt_e event, + const void* id, + const ico_uws_detail* detail, + void* user_data) +{ + if (NULL == user_data) { + ICO_ERR("user_data is NULL"); + return; + } + + CicoOSClient* cosc = static_cast(user_data); + cosc->receiveEventCB(context, event, id, detail, user_data); +} + +//-------------------------------------------------------------------------- +/** + * @brief websocket callback function + * + * @param [in] context websocket context + * @param [in] event changed event + * @param [in] id source applicatin id + * @param [in] detail event detail information + * @param [in] user_data user data + */ +//-------------------------------------------------------------------------- +void +CicoOSClient::receiveEventCB(const struct ico_uws_context* context, + const ico_uws_evt_e event, + const void* id, + const ico_uws_detail* detail, + void* user_data) +{ +// ICO_TRA("CicoOSClient::receiveEventCB Enter"); + + switch (event) { + case ICO_UWS_EVT_CLOSE: + ICO_DBG(">>>RECV ICO_UWS_EVT_CLOSE(id=0x%08x)", (int)id); +// ICO_TRA("CicoOSClient::receiveEventCB Leave"); + return; + case ICO_UWS_EVT_ERROR: + ICO_DBG(">>>RECV ICO_UWS_EVT_ERROR(id=0x%08x, err=%d)", + (int)id, detail->_ico_uws_error.code); +// ICO_TRA("CicoOSClient::receiveEventCB Leave"); + return; + default: + break; + } + + if (id != m_id) { + ICO_DBG(">>>CHANGE id %x -> %x", m_id, id); + m_id = id; + } + + switch (event) { + case ICO_UWS_EVT_OPEN: + ICO_DBG(">>>RECV ICO_UWS_EVT_OPEN(id=0x%08x)", (int)id); + break; + case ICO_UWS_EVT_CLOSE: + ICO_DBG(">>>RECV ICO_UWS_EVT_CLOSE(id=0x%08x)", (int)id); + break; + case ICO_UWS_EVT_RECEIVE: + { + ICO_DBG(">>>RECV ICO_UWS_EVT_RECEIVE(id=0x%08x, msg=%s, len=%d)", + (int)id, (char *)detail->_ico_uws_message.recv_data, + detail->_ico_uws_message.recv_len); + break; + } + case ICO_UWS_EVT_ADD_FD: + ICO_DBG(">>>RECV ICO_UWS_EVT_ADD_FD(id=0x%08x, fd=%d)", + (int)id, detail->_ico_uws_fd.fd); + break; + case ICO_UWS_EVT_DEL_FD: + ICO_DBG(">>>RECV ICO_UWS_EVT_DEL_FD(id=0x%08x, fd=%d)", + (int)id, detail->_ico_uws_fd.fd); + break; + default: + break; + } +// ICO_TRA("CicoOSClient::receiveEventCB Leave"); +} + +Eina_Bool +CicoOSClient::ecoreTimerCB(void *data) +{ + CicoOSClient* cosc = (CicoOSClient*)data; + cosc->refresh(); + return ECORE_CALLBACK_RENEW; +} + +bool +CicoOSClient::refresh() +{ + if (NULL == m_uwsContext) { + ICO_TRA("NG refresh"); + return false; + } + ico_uws_service(m_uwsContext); + return true; +} + +// vim:set expandtab ts=4 sw=4: diff --git a/src/onscreen/CicoOSClient.h b/src/onscreen/CicoOSClient.h new file mode 100644 index 0000000..4199857 --- /dev/null +++ b/src/onscreen/CicoOSClient.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2013, TOYOTA MOTOR CORPORATION. + * + * This program is licensed under the terms and conditions of the + * Apache License, version 2.0. The full text of the Apache License is at + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ + +//========================================================================== +/** + * @file CicoOSClient.h + * + * @brief This file is definition of CicoOSClient class + */ +//========================================================================== +#ifndef __CICO_OS_CLIENT_H__ +#define __CICO_OS_CLIENT_H__ + +#include +#include + +#include +#include + +#include + +//========================================================================== +// forward declaration +//========================================================================== +const int seqMax = 10000; +const int seqMin = 1; +const double timerCount = 0.1; + +//========================================================================== +/** + * @brief This class has function of interprocess message server + */ +//========================================================================== +class CicoOSClient +{ +public: + // get CicoOSClient instance + static CicoOSClient* getInstance(); + + // startup server + bool connect(); + + // send message to application client + bool sendLaunchMessage(const std::string& appid); + + // websocket callback function + void receiveEventCB(const struct ico_uws_context* context, + const ico_uws_evt_e event, + const void* id, + const ico_uws_detail* detail, + void* user_data); +private: + // default constructor + CicoOSClient(); + + // destructor + ~CicoOSClient(); + + // copy constructor + CicoOSClient(const CicoOSClient &object); + + // websocket utility callback function + static void uwsReceiveEventCB(const struct ico_uws_context* context, + const ico_uws_evt_e event, + const void* id, + const ico_uws_detail* detail, + void* user_data); + + static Eina_Bool ecoreTimerCB(void *data); + + void updateSeqNum(); + int getSeqNum() const; + bool refresh(); + +private: + static CicoOSClient* ms_myInstance; ///< this class instance + + struct ico_uws_context* m_uwsContext; ///< websocket utility context + const void* m_id; + + int m_seqNum; +}; +#endif // __CICO_OS_CLIENT_H__ +// vim:set expandtab ts=4 sw=4: diff --git a/src/onscreen/CicoOSPopWindow.cpp b/src/onscreen/CicoOSPopWindow.cpp index 104fda2..ecdec09 100644 --- a/src/onscreen/CicoOSPopWindow.cpp +++ b/src/onscreen/CicoOSPopWindow.cpp @@ -13,11 +13,13 @@ */ #include #include +#include #include "CicoOnScreen.h" #include "CicoNotification.h" #include "CicoOSPopWindow.h" #include "ico_syc_type.h" #include "ico_syc_appresctl.h" +#include "CicoOSClient.h" using namespace std; @@ -41,22 +43,24 @@ using namespace std; CicoOSPopWindow::CicoOSPopWindow(notification_type_e type) : CicoNotification(type) { ICO_TRA("Enter type(%d)", (int)type); - m_window = NULL; - m_icon = NULL; - m_theme = NULL; - m_resourceId = 0; - m_context = NULL; + m_window = NULL; + m_icon = NULL; + m_theme = NULL; + m_resourceId = 0; + m_context = NULL; + m_buttonTouch = false; ICO_TRA("Leave"); } CicoOSPopWindow::CicoOSPopWindow(notification_h noti) : CicoNotification(noti) { ICO_TRA("Enter"); - m_window = NULL; - m_icon = NULL; - m_theme = NULL; - m_resourceId = 0; - m_context = NULL; + m_window = NULL; + m_icon = NULL; + m_theme = NULL; + m_resourceId = 0; + m_context = NULL; + m_buttonTouch = false; ICO_TRA("Leave"); } //-------------------------------------------------------------------------- @@ -84,6 +88,16 @@ CicoOSPopWindow::~CicoOSPopWindow(void) ICO_DBG("_____ %d = ico_syc_release_res", r); } + ICO_DBG("_____ %d, %d", (int)m_buttonTouch, (int)m_appsvc_pkgname.empty()); + + if ((true == m_buttonTouch) && (false == m_appsvc_pkgname.empty())) { + CicoOSClient* cosc = CicoOSClient::getInstance(); + if (NULL != cosc) { + int r = cosc->sendLaunchMessage(m_appsvc_pkgname); + ICO_DBG("_____ SendMsg:%d, %s", r, m_appsvc_pkgname.c_str()); + } + } + ICO_TRA("Leave"); } @@ -130,6 +144,15 @@ CicoOSPopWindow::showPopup() pkgname, priv_id, title, content, text, (int)service_handle); + if (NULL != service_handle) { + const char* pn = appsvc_get_pkgname(service_handle); + if (NULL != pn) { + ICO_DBG("Received: appsvc_get_pkgname:%s", pn); + m_appsvc_pkgname = pn; + m_buttonTouch = false; + } + } + if (icon) { if (NULL != m_icon) { evas_object_image_file_set(m_icon, icon, NULL); @@ -213,11 +236,11 @@ CicoOSPopWindow::acquireRes() */ //-------------------------------------------------------------------------- void -CicoOSPopWindow::hidePopup(void) +CicoOSPopWindow::hidePopup(bool buttonTouch) { - ICO_TRA("Enter"); + ICO_TRA("Enter %s", buttonTouch? "true": "false"); + m_buttonTouch = buttonTouch; releaseRes(); - ICO_TRA("Leave"); } @@ -314,6 +337,7 @@ CicoOSPopWindow::createMainWindow() ICO_TRA("Leave(ERR)"); return false; } + ecore_evas_alpha_set(m_window, EINA_TRUE); ecore_evas_show(m_window); ICO_TRA("Leave"); return true; @@ -339,7 +363,7 @@ CicoOSPopWindow::evasMouseUpCB(void *data, Evas *e, Evas_Object *obj, if (NULL != obj) { ICO_DBG("_____ obj name=%s", evas_object_name_get(obj)); } - static_cast(data)->hidePopup(); + static_cast(data)->hidePopup(true); ICO_TRA("Leave"); } diff --git a/src/onscreen/CicoOSPopWindow.h b/src/onscreen/CicoOSPopWindow.h index 5c27360..ff67716 100644 --- a/src/onscreen/CicoOSPopWindow.h +++ b/src/onscreen/CicoOSPopWindow.h @@ -23,7 +23,8 @@ #include #include -#include +#include +#include #include #include @@ -47,7 +48,11 @@ #define STATUS_BAR_HEIGHT 64 #define CTRL_BAR_HEIGHT 128 #define WIDTH 1080 +#if 1 +#define HEIGHT 1920 +#else #define HEIGHT (1920 - STATUS_BAR_HEIGHT - CTRL_BAR_HEIGHT) +#endif /* Popup Size */ #define POPUP_WIDTH 640 @@ -119,7 +124,7 @@ public: CicoOSPopWindow(notification_h noti); virtual ~CicoOSPopWindow(); bool showPopup(); - void hidePopup(); + void hidePopup(bool buttonTouch = false); bool acquireRes(); bool releaseRes(); const CicoNotification& getNotif() const { @@ -138,6 +143,8 @@ public: Evas_Object* m_theme; uint32_t m_resourceId; struct ico_syc_res_context* m_context; + std::string m_appsvc_pkgname; + bool m_buttonTouch; }; #endif // __CICO_ONSCREEN_POP_WINDOW_H__ diff --git a/src/onscreen/CicoOnScreen.cpp b/src/onscreen/CicoOnScreen.cpp index 69b64e0..9ba5b3b 100644 --- a/src/onscreen/CicoOnScreen.cpp +++ b/src/onscreen/CicoOnScreen.cpp @@ -15,6 +15,7 @@ #include "CicoOSPopWindow.h" #include #include +#include "CicoOSClient.h" using namespace std; @@ -70,10 +71,8 @@ CicoOnScreen::~CicoOnScreen(void) } m_waitMngWin.clear(); - if (NULL != m_request) { - delete m_request; - m_request = NULL; - } + delete m_request; + m_request = NULL; // ICO_TRA("CicoOnScreen::~CicoOnScreen Leave"); } @@ -93,13 +92,15 @@ CicoOnScreen::StartOnScreen(void) ICO_TRA("Enter"); ico_syc_connect(EventCallBack, NULL); - // save instance pointer os_instance = this; // Initialize ecore_evas_init(); + CicoOSClient* cosc = CicoOSClient::getInstance(); + cosc->connect(); + if (NULL == m_reserve) { m_reserve = new CicoOSPopWindow(NOTIFICATION_TYPE_NONE); m_reserve->createMainWindow(); @@ -129,7 +130,6 @@ bool CicoOnScreen::insertNoti(notification_h noti_h) } if (NULL != w) { delete w; - w = NULL; ICO_TRA("Leave (false)"); return false; } @@ -267,7 +267,7 @@ bool CicoOnScreen::requestShowSC() ICO_TRA("Leave %s", r? "true": "false"); return r; } - + //-------------------------------------------------------------------------- /** * @brief callback for system controller diff --git a/src/onscreen/Makefile.am b/src/onscreen/Makefile.am index dc4783d..0dcde3b 100644 --- a/src/onscreen/Makefile.am +++ b/src/onscreen/Makefile.am @@ -9,7 +9,8 @@ OnScreen_SOURCES = \ on_screen_main.cpp \ CicoOSEFLApp.cpp \ CicoOnScreen.cpp \ - CicoOSPopWindow.cpp + CicoOSPopWindow.cpp \ + CicoOSClient.cpp OnScreen_CFLAGS= \ @CAPIAPPFWAPPLICATION_CFLAGS@ \ @@ -18,7 +19,6 @@ OnScreen_CFLAGS= \ $(AUL_CFLAGS) \ $(UWS_CFLAGS) \ $(NOTIFICATION_CFLAGS) \ - $(WESTONPLUGIN_CFLAGS) \ -I../../include \ -I../../lib/common \ -I../../lib/notification @@ -30,7 +30,6 @@ OnScreen_CXXFLAGS= \ $(AUL_CFLAGS) \ $(UWS_CFLAGS) \ $(NOTIFICATION_CFLAGS) \ - $(WESTONPLUGIN_CFLAGS) \ -I../../include \ -I../../lib/common \ -I../../lib/notification @@ -43,7 +42,8 @@ OnScreen_LDADD = \ $(OPT_LIBS) \ $(AUL_LIBS) \ $(UWS_LIBS) \ - $(NOTIFICATION_LIBS) \ + $(NOTIFICATION_LIBS) \ + -lappsvc \ ../../lib/apps-framework/.libs/libico-appfw.so SUFFIXES = .edc .edj diff --git a/src/statusbar/CicoCommonComponent.cpp b/src/statusbar/CicoCommonComponent.cpp deleted file mode 100644 index 0fa161e..0000000 --- a/src/statusbar/CicoCommonComponent.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2013, TOYOTA MOTOR CORPORATION. - * - * This program is licensed under the terms and conditions of the - * Apache License, version 2.0. The full text of the Apache License is at - * http://www.apache.org/licenses/LICENSE-2.0 - * - */ - -//========================================================================== -/** - * @file CicoCommonComponent.cpp - * - * @brief This file is definition of CicoCommonComponent class - */ -//========================================================================== - -#include -#include - -#include -#include "CicoCommonComponent.h" - -//-------------------------------------------------------------------------- -/** - * @brief default constructor - * - * @param[in] none - * @return none - */ -//-------------------------------------------------------------------------- -CicoCommonComponent::CicoCommonComponent() - : posx_(0), posy_(0), width_(0), height_(0) -{ - ICO_TRA("CicoCommonComponent::CicoCommonComponent Enter"); - ICO_TRA("CicoCommonComponent::CicoCommonComponent Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief destructor - * - * param[in] none - * return none - */ -//-------------------------------------------------------------------------- -CicoCommonComponent::~CicoCommonComponent() -{ - ICO_TRA("CicoCommonComponent::~CicoCommonComponent Enter"); - ICO_TRA("CicoCommonComponent::~CicoCommonComponent Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief terminate component - * - * @param[in] none - * @return bool - * @retval true: success - */ -//-------------------------------------------------------------------------- -bool -CicoCommonComponent::Terminate(void) -{ - ICO_TRA("CicoCommonComponent::Terminate Enter"); - std::list>::iterator itr; - std::list>::iterator itr_end; - for (itr = modulelist_.begin(); itr != itr_end; itr++) { - (*itr)->Terminate(); - } - - modulelist_.clear(); - ICO_TRA("CicoCommonComponent::Terminate Leave"); - return true; -} - -//-------------------------------------------------------------------------- -/** - * @brief show component - * - * @param[in] none - * @return none - */ -//-------------------------------------------------------------------------- -void -CicoCommonComponent::Show(void) -{ - ICO_TRA("CicoCommonComponent::Show Enter"); - - std::list>::iterator itr; - std::list>::iterator itr_end; - itr_end = modulelist_.end(); - for (itr = modulelist_.begin(); itr != itr_end; itr++) { - (*itr)->Show(); - } - - ICO_TRA("CicoCommonComponent::Show Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief hide component - * @param[in] none - * @return none - */ -//-------------------------------------------------------------------------- -void -CicoCommonComponent::Hide(void) -{ - ICO_TRA("CicoCommonComponent::Hide Enter"); - std::list>::iterator itr; - std::list>::iterator itr_end; - itr_end = modulelist_.end(); - for (itr = modulelist_.begin(); itr != itr_end; itr++) { - (*itr)->Hide(); - } - ICO_TRA("CicoCommonComponent::Hide Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief set position of component - * - * @param [in] x position of x - * @param [in] y position of y - * @return none - */ -//-------------------------------------------------------------------------- -void -CicoCommonComponent::SetPos(int x, int y) -{ - ICO_TRA("CicoCommonComponent::SetPos Enter(x/y=%d/%d)", x, y); - int diffx = x - posx_; - int diffy = y - posy_; - posx_ = x; - posy_ = y; - std::list>::iterator itr; - std::list>::iterator itr_end; - itr_end = modulelist_.end(); - for (itr = modulelist_.begin(); itr != itr_end; itr++) { - (*itr)->Move(diffx, diffy); - } - ICO_TRA("CicoCommonComponent::SetPos Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief set size of component - * - * @param [in] w width of component - * @param [in] h height of component - * @return none -*/ -//-------------------------------------------------------------------------- -void -CicoCommonComponent::SetSize(int w, int h) -{ - ICO_TRA("CicoCommonComponent::SetSize Enter(w/h=%d/%d)", w, h); - double rate_w = width_ / w; - double rate_h = height_ / h; - width_ = w; - height_ = h; - std::list>::iterator itr; - std::list>::iterator itr_end; - itr_end = modulelist_.end(); - for (itr = modulelist_.begin(); itr != itr_end; itr++) { - (*itr)->Reallocate(posx_, posy_, rate_w, rate_h); -} - ICO_TRA("CicoCommonComponent::SetSize Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief pack module - * - * @param [in] module add module object - * @return none -*/ -//-------------------------------------------------------------------------- -void -CicoCommonComponent::PackModule(std::shared_ptr module) -{ - modulelist_.push_back(module); -} - -//-------------------------------------------------------------------------- -/** - * @brief unpack module - * - * @param [in] module remove module object - * @return none - */ -//-------------------------------------------------------------------------- -void -CicoCommonComponent::UnpackModule(std::shared_ptr module) -{ - modulelist_.remove(module); -} -// vim: set expandtab ts=4 sw=4: diff --git a/src/statusbar/CicoCommonComponent.h b/src/statusbar/CicoCommonComponent.h deleted file mode 100644 index 79feecb..0000000 --- a/src/statusbar/CicoCommonComponent.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013, TOYOTA MOTOR CORPORATION. - * - * This program is licensed under the terms and conditions of the - * Apache License, version 2.0. The full text of the Apache License is at - * http://www.apache.org/licenses/LICENSE-2.0 - * - */ - -//========================================================================== -/** - * @file CicoCommonComponent.h - * - * @brief This file is definition of CicoCommonComponent class - */ -//========================================================================== -#ifndef __CICO_COMMON_COMPONENT_H__ -#define __CICO_COMMON_COMPONENT_H__ - -#include -#include -#include -#include -#include -#include "CicoComponentInterface.h" -#include "CicoModuleImplementation.h" - -//========================================================================== -/** - * @brief This class provide the common component interfaces - */ -//========================================================================== -class CicoCommonComponent : public CicoComponentInterface -{ -public: - // default constructor - CicoCommonComponent(); - - // destructor - virtual ~CicoCommonComponent(); - - // terminate component - virtual bool Terminate(void); - - // show component - virtual void Show(void); - - // hide component - virtual void Hide(void); - - // set position of component - virtual void SetPos(int x, int y); - - // set size of component - virtual void SetSize(int w, int h); - -protected: - // pack module - void PackModule(std::shared_ptr module); - - // unpack module - void UnpackModule(std::shared_ptr module); - -protected: - int posx_; /// position x - int posy_; /// position y - int width_; /// componet width - int height_; /// componet height - std::list > modulelist_; ///module list -}; -#endif // __CICO_COMMON_COMPONENT_H__ -// vim: set expandtab ts=4 sw=4: diff --git a/src/statusbar/CicoCommonModule.cpp b/src/statusbar/CicoCommonModule.cpp index d6912ea..82eae0c 100644 --- a/src/statusbar/CicoCommonModule.cpp +++ b/src/statusbar/CicoCommonModule.cpp @@ -19,8 +19,7 @@ #include #include -#include "CicoModuleInterface.h" -#include "CicoModuleImplementation.h" +#include "CicoComponentImplementation.h" //-------------------------------------------------------------------------- /** @@ -30,7 +29,7 @@ * @return none */ //-------------------------------------------------------------------------- -CicoCommonModule::CicoCommonModule() +CicoCommonModule::CicoCommonModule() : evasobj_(NULL), posx_(0), posy_(0), width_(0), height_(0) { ICO_TRA("CicoCommonModule::CicoCommonModule Enter"); @@ -49,6 +48,7 @@ CicoCommonModule::CicoCommonModule() CicoCommonModule::~CicoCommonModule() { ICO_TRA("CicoCommonModule::~CicoCommonModule Enter"); + Terminate(); ICO_TRA("CicoCommonModule::~CicoCommonModule Leave"); } @@ -64,11 +64,14 @@ bool CicoCommonModule::Terminate(void) { ICO_TRA("CicoCommonModule::Terminate Enter"); - if (evas_object_ref_get(evasobj_) > 1) { - evas_object_unref(evasobj_); - } - else { - evas_object_del(evasobj_); + if (evasobj_ != NULL) { + if (evas_object_ref_get(evasobj_) > 1) { + evas_object_unref(evasobj_); + } + else { + evas_object_del(evasobj_); + } + evasobj_ = NULL; } ICO_TRA("CicoCommonModule::Terminate Leave"); return true; @@ -76,7 +79,7 @@ CicoCommonModule::Terminate(void) //-------------------------------------------------------------------------- /** - * @brief show module + * @brief show module * * @param[in] none * @return none @@ -85,11 +88,11 @@ CicoCommonModule::Terminate(void) void CicoCommonModule::Show(void) { - // ICO_TRA("CicoCommonModule::Show Enter"); + //ICO_TRA("CicoCommonModule::Show Enter"); assert(evasobj_!=NULL); evas_object_show(evasobj_); assert (evas_object_visible_get(evasobj_) == EINA_TRUE); - // ICO_TRA("CicoCommonModule::Show Leave"); + //ICO_TRA("CicoCommonModule::Show Leave"); } //-------------------------------------------------------------------------- diff --git a/src/statusbar/CicoCommonWindow.cpp b/src/statusbar/CicoCommonWindow.cpp index 82ce6c5..c41814a 100644 --- a/src/statusbar/CicoCommonWindow.cpp +++ b/src/statusbar/CicoCommonWindow.cpp @@ -50,12 +50,6 @@ bool CicoCommonWindow::Terminate(void) { ICO_TRA("CicoCommonWindow::Terminate Enter"); - std::list::iterator itr, itr_end; - itr_end = componentlist_.end(); - for (itr = componentlist_.begin(); itr != itr_end; itr++) { - delete (*itr); - } - componentlist_.clear(); ICO_TRA("CicoCommonWindow::Terminate Leave"); return true; } @@ -75,11 +69,6 @@ CicoCommonWindow::Show(void) ecore_evas_show(window_); if (windowobj_ != NULL) { evas_object_show(windowobj_); - std::list::iterator itr, itr_end; - itr_end = componentlist_.end(); - for (itr = componentlist_.begin(); itr != itr_end; itr++) { - (*itr)->Show(); - } } ICO_TRA("CicoCommonWindow::Show Leave"); } @@ -99,11 +88,6 @@ CicoCommonWindow::Hide(void) ecore_evas_hide(window_); if (windowobj_ != NULL) { evas_object_hide(windowobj_); - std::list::iterator itr, itr_end; - itr_end = componentlist_.end(); - for (itr = componentlist_.begin(); itr != itr_end; itr++) { - (*itr)->Hide(); - } } ICO_TRA("CicoCommonWindow::Show Enter"); } @@ -125,11 +109,6 @@ CicoCommonWindow::SetPos(int x, int y) ecore_evas_move(window_, posx_, posy_); if (windowobj_ != NULL) { evas_object_move(windowobj_, posx_, posy_); - std::list::iterator itr, itr_end; - itr_end = componentlist_.end(); - for (itr = componentlist_.begin(); itr != itr_end; itr++) { - (*itr)->SetPos(posx_, posy_); - } } } @@ -150,14 +129,10 @@ CicoCommonWindow::SetSize(int w, int h) ecore_evas_resize(window_, width_, height_); if (windowobj_ != NULL) { evas_object_resize(windowobj_, width_, height_); - std::list::iterator itr, itr_end; - itr_end = componentlist_.end(); - for (itr = componentlist_.begin(); itr != itr_end; itr++) { - (*itr)->SetSize(width_, height_); - } } } +#if 0 //-------------------------------------------------------------------------- /** * @brief set component @@ -185,4 +160,5 @@ CicoCommonWindow::UnsetComponent(CicoCommonComponent *component) { componentlist_.remove(component); } +#endif // vim: set expandtab ts=4 sw=4: diff --git a/src/statusbar/CicoCommonWindow.h b/src/statusbar/CicoCommonWindow.h index a6d4b5d..bbc3afa 100644 --- a/src/statusbar/CicoCommonWindow.h +++ b/src/statusbar/CicoCommonWindow.h @@ -17,25 +17,24 @@ #ifndef __CICO_COMMON_WINDOW_H__ #define __CICO_COMMON_WINDOW_H__ +#include #include #include #include -#include "CicoWindowInterface.h" -#include "CicoCommonComponent.h" //========================================================================== /** * @brief This class provide the common window interfaces */ //========================================================================== -class CicoCommonWindow : public CicoWindowInterface +class CicoCommonWindow { public: // default constructor CicoCommonWindow(); // destructor - ~CicoCommonWindow(); + virtual ~CicoCommonWindow(); // terminate the window virtual bool Terminate(void); @@ -53,11 +52,6 @@ public: virtual void SetSize(int w, int h); protected: - // set component - void SetComponent(CicoCommonComponent *component); - - // unset component - void UnsetComponent(CicoCommonComponent *component); Ecore_Evas *window_; /// main window Evas_Object *windowobj_; /// background @@ -65,7 +59,6 @@ protected: int posy_; /// position y int width_; /// window width int height_; /// window height - std::list componentlist_; /// componet list }; #endif // __CICO_COMMON_WINDOW_H__ // vim: set expandtab ts=4 sw=4: diff --git a/src/statusbar/CicoComponentImplementation.cpp b/src/statusbar/CicoComponentImplementation.cpp index 8f7a15a..afafb01 100644 --- a/src/statusbar/CicoComponentImplementation.cpp +++ b/src/statusbar/CicoComponentImplementation.cpp @@ -23,68 +23,47 @@ #include #include "CicoComponentImplementation.h" +/* define of path */ #define IMG_DIR "/usr/apps/org.tizen.ico.statusbar/res/images/" +#define THEME_PATH "/usr/apps/org.tizen.ico.statusbar/res/themes/statusbar.edj" -// set image size of clock -const int CicoStatusBarClockComponent::AMPM_WIDTH = 47; -const int CicoStatusBarClockComponent::AMPM_HEIGHT = 30; -const int CicoStatusBarClockComponent::HOUR10_WIDTH = 20; -const int CicoStatusBarClockComponent::HOUR10_HEIGHT = 30; -const int CicoStatusBarClockComponent::HOUR1_WIDTH = 20; -const int CicoStatusBarClockComponent::HOUR1_HEIGHT = 30; -const int CicoStatusBarClockComponent::COLON_WIDTH = 8; -const int CicoStatusBarClockComponent::COLON_HEIGHT = 20; -const int CicoStatusBarClockComponent::MIN10_WIDTH = 20; -const int CicoStatusBarClockComponent::MIN10_HEIGHT = 30; -const int CicoStatusBarClockComponent::MIN1_WIDTH = 20; -const int CicoStatusBarClockComponent::MIN1_HEIGHT = 30; - -// set blank size -const int CicoStatusBarClockComponent::COLON_BLANK = 7; -const int CicoStatusBarClockComponent::AMPM_BLANK = 7; -const int CicoStatusBarClockComponent::LAST_BLANK = 20; - -// set image position of clock -const int CicoStatusBarClockComponent::AMPM_POSX = 0; -const int CicoStatusBarClockComponent::AMPM_POSY = 8; -const int CicoStatusBarClockComponent::RELATIVE_HOUR10_POSX = AMPM_WIDTH + AMPM_BLANK; -const int CicoStatusBarClockComponent::RELATIVE_HOUR10_POSY = -8; -const int CicoStatusBarClockComponent::RELATIVE_HOUR1_POSX = RELATIVE_HOUR10_POSX + HOUR10_WIDTH; -const int CicoStatusBarClockComponent::RELATIVE_HOUR1_POSY = -8; -const int CicoStatusBarClockComponent::RELATIVE_COLON_POSX = RELATIVE_HOUR1_POSX + HOUR1_WIDTH + COLON_BLANK; -const int CicoStatusBarClockComponent::RELATIVE_COLON_POSY = -3; -const int CicoStatusBarClockComponent::RELATIVE_MIN10_POSX = RELATIVE_COLON_POSX + COLON_WIDTH + COLON_BLANK; -const int CicoStatusBarClockComponent::RELATIVE_MIN10_POSY = -8; -const int CicoStatusBarClockComponent::RELATIVE_MIN1_POSX = RELATIVE_MIN10_POSX + MIN10_WIDTH; -const int CicoStatusBarClockComponent::RELATIVE_MIN1_POSY = -8; +/* Theme group name */ +#define THEME_CLOCK_NAME "ClockImage" +#define THEME_NOTIFICATION_NAME "Notification" // set image file path of clock -const char *CicoStatusBarClockComponent::imgfilepath_am = IMG_DIR"time_am.png"; -const char *CicoStatusBarClockComponent::imgfilepath_pm = IMG_DIR"time_pm.png"; -const char *CicoStatusBarClockComponent::imgfilepath_0 = IMG_DIR"time_0.png"; -const char *CicoStatusBarClockComponent::imgfilepath_1 = IMG_DIR"time_1.png"; -const char *CicoStatusBarClockComponent::imgfilepath_2 = IMG_DIR"time_2.png"; -const char *CicoStatusBarClockComponent::imgfilepath_3 = IMG_DIR"time_3.png"; -const char *CicoStatusBarClockComponent::imgfilepath_4 = IMG_DIR"time_4.png"; -const char *CicoStatusBarClockComponent::imgfilepath_5 = IMG_DIR"time_5.png"; -const char *CicoStatusBarClockComponent::imgfilepath_6 = IMG_DIR"time_6.png"; -const char *CicoStatusBarClockComponent::imgfilepath_7 = IMG_DIR"time_7.png"; -const char *CicoStatusBarClockComponent::imgfilepath_8 = IMG_DIR"time_8.png"; -const char *CicoStatusBarClockComponent::imgfilepath_9 = IMG_DIR"time_9.png"; -const char *CicoStatusBarClockComponent::imgfilepath_colon = IMG_DIR"time_ten.png"; - -// set clock component size -const int CicoStatusBarClockComponent::CLOCK_COMPONENT_WIDTH = AMPM_WIDTH + - AMPM_BLANK + - HOUR10_WIDTH + - HOUR1_WIDTH + - COLON_BLANK + - COLON_WIDTH + - COLON_BLANK + - MIN10_WIDTH + - MIN1_WIDTH; - -const int CicoStatusBarClockComponent::CLOCK_COMPONENT_HEIGHT = HOUR10_HEIGHT; +static const char *clock_image_path[] = { + IMG_DIR"time_0.png", + IMG_DIR"time_1.png", + IMG_DIR"time_2.png", + IMG_DIR"time_3.png", + IMG_DIR"time_4.png", + IMG_DIR"time_5.png", + IMG_DIR"time_6.png", + IMG_DIR"time_7.png", + IMG_DIR"time_8.png", + IMG_DIR"time_9.png", + IMG_DIR"time_am.png", + IMG_DIR"time_pm.png", + IMG_DIR"time_ten.png", + NULL +}; + +/* define of special image index */ +#define TIME_IMAGE_AM (10) +#define TIME_IMAGE_PM (11) +#define TIME_IMAGE_SP (12) + +/* array of clock object name */ +static const char *clock_image_object[] = { + "AM_PM_img", + "HOUR10_img", + "HOUR1_img", + "TIME_SP_img", + "MIN10_img", + "MIN1_img", + NULL +}; /*--------------------------------------------------------------------------*/ /** @@ -95,7 +74,6 @@ const int CicoStatusBarClockComponent::CLOCK_COMPONENT_HEIGHT = HOUR10_HEIGHT; */ /*--------------------------------------------------------------------------*/ CicoStatusBarClockComponent::CicoStatusBarClockComponent() - : rate_(1.0) { } @@ -109,7 +87,6 @@ CicoStatusBarClockComponent::CicoStatusBarClockComponent() /*--------------------------------------------------------------------------*/ CicoStatusBarClockComponent::~CicoStatusBarClockComponent() { - imgfilelist_number.clear(); } /*--------------------------------------------------------------------------*/ @@ -123,76 +100,49 @@ CicoStatusBarClockComponent::~CicoStatusBarClockComponent() */ /*--------------------------------------------------------------------------*/ bool -CicoStatusBarClockComponent::Initialize(Evas_Object *windowobj, int posx, int posy) +CicoStatusBarClockComponent::Initialize(Evas_Object *windowobj, Evas *evas) { ICO_TRA("CicoStatusBarClockComponent::Initialize Enter"); - if (imgfilelist_number.empty()) { - imgfilelist_number.push_back(imgfilepath_0); - imgfilelist_number.push_back(imgfilepath_1); - imgfilelist_number.push_back(imgfilepath_2); - imgfilelist_number.push_back(imgfilepath_3); - imgfilelist_number.push_back(imgfilepath_4); - imgfilelist_number.push_back(imgfilepath_5); - imgfilelist_number.push_back(imgfilepath_6); - imgfilelist_number.push_back(imgfilepath_7); - imgfilelist_number.push_back(imgfilepath_8); - imgfilelist_number.push_back(imgfilepath_9); - } - - std::shared_ptr ampm_module; - ampm_module = std::make_shared(CicoImageModule()); - if (!ampm_module->Initialize(windowobj)) { - ICO_TRA("CicoStatusBarClockComponent::Initialize Leave(false)"); - return false; - } - - std::shared_ptr hour10_module; - hour10_module = std::make_shared(CicoImageModule()); - if (!hour10_module->Initialize(windowobj)) { - ICO_TRA("CicoStatusBarClockComponent::Initialize Leave(false)"); - return false; - } - std::shared_ptr hour1_module; - hour1_module = std::make_shared(CicoImageModule()); - if (!hour1_module->Initialize(windowobj)) { - ICO_TRA("CicoStatusBarClockComponent::Initialize Leave(false)"); - return false; + /* initialize display clock image */ + int i; + for(i=0; i colon_module; - colon_module = std::make_shared(CicoImageModule()); - if (!colon_module->Initialize(windowobj)) { - ICO_TRA("CicoStatusBarClockComponent::Initialize Leave(false)"); + /* make TimeImage object */ + evasobj_=edje_object_add(evas); + if (!edje_object_file_set(evasobj_, THEME_PATH, THEME_CLOCK_NAME )) { + Edje_Load_Error err = edje_object_load_error_get(evasobj_); + const char *errmsg = edje_load_error_str(err); + ICO_ERR("could not load 'main' from statusbar.edj: %s", + errmsg); return false; } - std::shared_ptr min10_module; - min10_module = std::make_shared(CicoImageModule()); - if (!min10_module->Initialize(windowobj)) { - ICO_TRA("CicoStatusBarClockComponent::Initialize Leave(false)"); - return false; - } - - std::shared_ptr min1_module; - min1_module = std::make_shared(CicoImageModule()); - if (!min1_module->Initialize(windowobj)) { - ICO_TRA("CicoStatusBarClockComponent::Initialize Leave(false)"); - return false; + /* move TimeImage to UpRight of window */ + /* Do not need this process , if positiong of UpRight enabled with .EDC file */ + Evas_Coord x,y,w,h; + Evas_Coord w_width=0; + Evas_Object* obj = NULL; + evas_object_geometry_get( windowobj, &x, &y, &w_width, &h ); + evas_object_resize( evasobj_, w_width, h ); + obj = (Evas_Object*)edje_object_part_object_get(evasobj_,"MIN1_img" ); + evas_object_geometry_get( obj, &x, &y, &w, &h ); + Evas_Coord offset = w_width - x - w; + + for ( i=0; itm_min; int hour = tm->tm_hour; - std::shared_ptr imagemodule; - assert(!modulelist_.empty()); - std::list>::iterator itr; - itr = modulelist_.begin(); - imagemodule = std::static_pointer_cast((*itr)); - assert(imagemodule != NULL); - + /* Make now clock image tabel */ + int now_clock_image[CLOCK_OBJECT_COUNT]; if (hour > 11) { - if (!imagemodule->SetFilePath(imgfilepath_pm)) { - ICO_TRA("CicoStatusBarClockComponent::Update Leave(false)"); - return false; - } + now_clock_image[0]=TIME_IMAGE_PM; } else { - if (!imagemodule->SetFilePath(imgfilepath_am)) { - ICO_TRA("CicoStatusBarClockComponent::Update Leave(false)"); - return false; - } + now_clock_image[0]=TIME_IMAGE_AM; } - imagemodule->SetSize(rate_ * AMPM_WIDTH, rate_ * AMPM_HEIGHT); - imagemodule->SetPos(posx_, posy_); - imagemodule->Show(); - time_t hour_m = hour % 12; - itr++; - imagemodule = std::static_pointer_cast((*itr)); - assert(imagemodule != NULL); - if (!imagemodule->SetFilePath(imgfilelist_number[hour_m / 10])) { - ICO_TRA("CicoStatusBarClockComponent::Update Leave(false)"); - return false; - } - imagemodule->SetSize(rate_ * HOUR10_WIDTH, rate_ * HOUR10_HEIGHT); - imagemodule->SetPos(posx_ + rate_ * RELATIVE_HOUR10_POSX, - posy_ + rate_ * RELATIVE_HOUR10_POSY); - imagemodule->Show(); - - itr++; - imagemodule = std::static_pointer_cast((*itr)); - assert(imagemodule != NULL); - if (!imagemodule->SetFilePath(imgfilelist_number[hour_m % 10])) { - ICO_TRA("CicoStatusBarClockComponent::Update Leave(false)"); - return false; - } - imagemodule->SetSize(rate_ * HOUR1_WIDTH, rate_ * HOUR1_HEIGHT); - imagemodule->SetPos(posx_ + rate_ * RELATIVE_HOUR1_POSX, - posy_ + rate_ * RELATIVE_HOUR1_POSY); - imagemodule->Show(); - - itr++; - imagemodule = std::static_pointer_cast((*itr)); - assert(imagemodule != NULL); - if (!imagemodule->SetFilePath(imgfilepath_colon)) { - ICO_TRA("CicoStatusBarClockComponent::Update Leave(false)"); - return false; - } - imagemodule->SetSize(rate_ * COLON_WIDTH, rate_ * COLON_HEIGHT); - imagemodule->SetPos(posx_ + rate_ * RELATIVE_COLON_POSX, - posy_ + rate_ * RELATIVE_COLON_POSY); - imagemodule->Show(); - - itr++; - imagemodule = std::static_pointer_cast((*itr)); - assert(imagemodule != NULL); - if (!imagemodule->SetFilePath(imgfilelist_number[min / 10])) { - ICO_TRA("CicoStatusBarClockComponent::Update Leave(false)"); - return false; - } - imagemodule->SetSize(rate_ * MIN10_WIDTH, rate_ * MIN10_HEIGHT); - imagemodule->SetPos(posx_ + rate_ * RELATIVE_MIN10_POSX, - posy_ + rate_ * RELATIVE_MIN10_POSY); - imagemodule->Show(); - - itr++; - imagemodule = std::static_pointer_cast((*itr)); - assert(imagemodule != NULL); - if (!imagemodule->SetFilePath(imgfilelist_number[min % 10])) { - ICO_TRA("CicoStatusBarClockComponent::Update Leave(false)"); - return false; + now_clock_image[1]=hour_m / 10; + now_clock_image[2]=hour_m % 10; + now_clock_image[3]=TIME_IMAGE_SP; + now_clock_image[4]=min / 10; + now_clock_image[5]=min % 10; + + /* Set now clock image */ + int i; + for ( i=0; iSetSize(rate_ * MIN1_WIDTH, rate_ * MIN1_HEIGHT); - imagemodule->SetPos(posx_ + rate_ * RELATIVE_MIN1_POSX, - posy_ + rate_ * RELATIVE_MIN1_POSY); - imagemodule->Show(); //ICO_TRA("CicoStatusBarClockComponent::Update Leave(true)"); return true; @@ -310,39 +212,39 @@ CicoStatusBarClockComponent::Update() /*--------------------------------------------------------------------------*/ /** - * @brief set rate of clock component + * @brief get clock start position * - * @param[in] rate + * @param[out] x X axis + * @param[out] y Y axis * @return true: success false: failed */ /*--------------------------------------------------------------------------*/ bool -CicoStatusBarClockComponent::SetRate(double rate) +CicoStatusBarClockComponent::GetClockStart( Evas_Coord *x_ret, Evas_Coord *y_ret) { - if (modulelist_.empty()) { + ICO_TRA("CicoStatusBarClockComponent::GetClockStart Enter"); + if (evasobj_ == NULL) { + ICO_TRA("CicoStatusBarClockComponent::GetClockStart Leave(false)"); return false; } - rate_ = rate; - width_ *= rate_; - height_ *= rate_; - SetPos(posx_, posy_); - SetSize(width_, height_); + Evas_Object* obj = NULL; + obj = (Evas_Object*)edje_object_part_object_get( + evasobj_, clock_image_object[0] ); + if ( obj == NULL ) { + ICO_TRA("CicoStatusBarClockComponent::GetClockStart Leave(false)"); + return false; + } + + Evas_Coord x,y,w,h; + evas_object_geometry_get( obj, &x, &y, &w, &h ); + *x_ret = x; + *y_ret = y; + + ICO_TRA("CicoStatusBarClockComponent::GetClockStart Leave(true)"); return true; } -// set notification(icon-image, text) position and font -const int CicoNotificationPanelComponent::ICON_POSX = 0; -const int CicoNotificationPanelComponent::ICON_POSY = 0; -const int CicoNotificationPanelComponent::ICON_WIDTH = 48; -const int CicoNotificationPanelComponent::ICON_HEIGHT = 48; -const int CicoNotificationPanelComponent::RELATIVE_TEXT_POSX = 70; -const int CicoNotificationPanelComponent::RELATIVE_TEXT_POSY = 10; -const int CicoNotificationPanelComponent::TEXT_WIDTH = 450; -const int CicoNotificationPanelComponent::TEXT_HEIGHT = 50; -const char *CicoNotificationPanelComponent::FONT_STYLE = "Sans"; -const int CicoNotificationPanelComponent::FONT_SIZE = 50; - /*--------------------------------------------------------------------------*/ /** * @brief default constructor @@ -352,13 +254,13 @@ const int CicoNotificationPanelComponent::FONT_SIZE = 50; */ /*--------------------------------------------------------------------------*/ CicoNotificationPanelComponent::CicoNotificationPanelComponent() - : CicoCommonComponent(), rate_(1.0) + : CicoCommonModule() { } /*--------------------------------------------------------------------------*/ /** - * @brief destructor + * @brief destructor * * @param[in] none * @return none @@ -370,18 +272,18 @@ CicoNotificationPanelComponent::~CicoNotificationPanelComponent() /*--------------------------------------------------------------------------*/ /** - * @brief initialize of notification component + * @brief initialize of notification component * * @param[in] window * @return true: success false: failed */ /*--------------------------------------------------------------------------*/ bool -CicoNotificationPanelComponent::Initialize(Evas_Object *window) +CicoNotificationPanelComponent::Initialize(Evas_Object *window, Evas *evas) { ICO_TRA("CicoNotificationPanelComponent::Initialize Enter"); - if (!modulelist_.empty()) { + if (evasobj_ != NULL) { ICO_TRA("CicoNotificationPanelComponent::Initialize Levae(false)"); return false; } @@ -391,46 +293,23 @@ CicoNotificationPanelComponent::Initialize(Evas_Object *window) return false; } - posx_= ICON_POSX; - posy_ = ICON_POSY; - width_ = RELATIVE_TEXT_POSX + TEXT_WIDTH; - height_ = ICON_HEIGHT - ICON_POSY; - - imgmod_ = std::make_shared(CicoImageModule()); - if (imgmod_ == NULL) { - ICO_TRA("CicoNotificationPanelComponent::Initialize Levae(false)"); - return false; - } - - if (!imgmod_->Initialize(window)) { - ICO_TRA("CicoNotificationPanelComponent::Initialize Levae(false)"); - return false; - } - - imgmod_->SetPos(posx_,7); - - imgmod_->SetSize(ICON_WIDTH, ICON_HEIGHT); - imgmod_->Show(); - - ICO_DBG("Create Text Module start"); - textmod_ = std::make_shared(CicoTextModule()); - if (textmod_ == NULL) { - ICO_TRA("CicoNotificationPanelComponent::Initialize Levae(false)"); - return false; - } + /* create Notification object */ ICO_DBG("Create Text Module end"); - if (!textmod_->Initialize(window)) { - ICO_TRA("CicoNotificationPanelComponent::Initialize Levae(false)"); + evasobj_=edje_object_add(evas); + if (!edje_object_file_set(evasobj_, THEME_PATH, THEME_NOTIFICATION_NAME)) { + Edje_Load_Error err = edje_object_load_error_get(evasobj_); + const char *errmsg = edje_load_error_str(err); + ICO_ERR("could not load 'main' from statusbar.edj: %s", + errmsg); return false; } + Evas_Coord x,y,w,h; + evas_object_geometry_get( window, &x, &y, &w, &h ); + evas_object_resize( evasobj_, w, h ); - textmod_->SetPos(posx_ + RELATIVE_TEXT_POSX, posy_ + RELATIVE_TEXT_POSY); - textmod_->SetSize(TEXT_WIDTH, TEXT_HEIGHT); - textmod_->SetFont(FONT_STYLE, FONT_SIZE); - textmod_->Show(); - - PackModule(imgmod_); - PackModule(textmod_); + /* initial display */ + SetText(""); + Hide(); ICO_TRA("CicoNotificationPanelComponent::Initialize Levae(true)"); return true; @@ -438,7 +317,7 @@ CicoNotificationPanelComponent::Initialize(Evas_Object *window) /*--------------------------------------------------------------------------*/ /** - * @brief set notification panel + * @brief set notification panel * * @param[in] text * @param[in] iconpaht @@ -454,40 +333,84 @@ CicoNotificationPanelComponent::SetNotification(const char *text, ICO_TRA("CicoNotificationPanelComponent::SetNotification Enter" "(text=%s icon=%s sound=%s)", text, iconpath, soundpath); + /* set image file */ if (iconpath != NULL) { - imgmod_->SetFilePath(iconpath); + Evas_Object* obj = NULL; + obj = (Evas_Object*)edje_object_part_object_get( + evasobj_, "noti_image"); + if ( obj != NULL ) { + ICO_DBG("SetNotification image set[%s]",iconpath); + evas_object_image_file_set(obj, iconpath, NULL); + } + else { + ICO_DBG("SetNotification image set error[object not found]" ); + } } + /* set text */ if (text != NULL) { - textmod_->SetText(text); + SetText(text); } - textmod_->SetFont(NULL,50); - textmod_->SetColor(0, 255, 255, 255); Show(); ICO_TRA("CicoNotificationPanelComponent::SetNotification Leave"); } -/*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- /** - * @brief set rate of notification component - * - * @param[in] rate - * @return true: success false: failed + * @brief set text to Content_text + * @param[in] text + * @return true: success */ -/*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- bool -CicoNotificationPanelComponent::SetRate(double rate) +CicoNotificationPanelComponent::SetText(const char *text) { - if (modulelist_.empty()) { - return false; + ICO_TRA("CicoNotificationPanelComponent::SetText Enter(text=%s)", text? text:"NULL"); + if ( text == NULL ) { + edje_object_part_text_set(evasobj_, "content_text", ""); + return true; } - rate_ = rate; - width_ *= rate; - height_ *= rate; - SetPos(posx_, posy_); - SetSize(width_, height_); + edje_object_part_text_set(evasobj_, "content_text", text); + + ICO_TRA("CicoNotificationPanelComponent::SetText Leave"); return true; } + +//-------------------------------------------------------------------------- +/** + * @brief set text to Content_text + * @param[in] text + * @return true: success + */ +//-------------------------------------------------------------------------- +void +CicoNotificationPanelComponent::SetTextEndPosition( Evas_Coord x_end, Evas_Coord y_end) +{ + ICO_TRA("CicoNotificationPanelComponent::SetTextEndPosition Enter(%d,%d)",x_end,y_end); + + if (evasobj_ == NULL) { + ICO_TRA("CicoNotificationPanelComponent::SetTextEndPosition Leave(false)"); + return; + } + + Evas_Object* obj = NULL; + obj = (Evas_Object*)edje_object_part_object_get( + evasobj_, "content_text" ); + if ( obj == NULL ) { + ICO_TRA("CicoNotificationPanelComponent::SetTextEndPosition Leave(false)"); + return; + } + + Evas_Coord x,y,w,h; + evas_object_geometry_get( obj, &x, &y, &w, &h ); + evas_object_resize( evasobj_, x_end, h ); + ICO_TRA("CicoNotificationPanelComponent::text width %d -> %d",w, x_end - x -1); + evas_object_resize( obj, x_end - x -1, h ); + edje_object_calc_force( obj ); + + ICO_TRA("CicoNotificationPanelComponent::SetTextEndPosition Leave" ); +} + // vim: set expandtab ts=4 sw=4: diff --git a/src/statusbar/CicoComponentImplementation.h b/src/statusbar/CicoComponentImplementation.h index 024b428..d11f778 100644 --- a/src/statusbar/CicoComponentImplementation.h +++ b/src/statusbar/CicoComponentImplementation.h @@ -21,16 +21,68 @@ #include #include #include -#include "CicoComponentInterface.h" -#include "CicoCommonComponent.h" -#include "CicoModuleImplementation.h" + +#define CLOCK_OBJECT_COUNT (6) + +//========================================================================== +/** + * @brief This class provide the common module component interfaces + */ +//========================================================================== +class CicoCommonModule +{ +public: + // default constructor + CicoCommonModule(); + + // destructor + virtual ~CicoCommonModule(); + + // terminate module + virtual bool Terminate(void); + + // show module + virtual void Show(void); + + // hide module + virtual void Hide(void); + + // set position of module + virtual void SetPos(int x, int y); + + // set size of module + virtual void SetSize(int w, int h); + + // move module + virtual void Move(int diffx, int diffy); + + // resize module + virtual void Resize(double ratew, double rateh); + + // reset position and size of module + virtual void Reallocate(int standardx, int standardy, + double ratew, double rateh); + + // get raw data + Evas_Object *GetRawData(void) const; + bool operator==(const CicoCommonModule& moduleb) { + return (this->evasobj_ == moduleb.evasobj_); + } + +protected: + Evas_Object *evasobj_; /// module object + int posx_; /// module position x + int posy_; /// module position y + int width_; /// module width + int height_; /// module height +}; //========================================================================== /** * @brief This class provide the clock component */ //========================================================================== -class CicoStatusBarClockComponent : public CicoCommonComponent +class CicoStatusBarClockComponent : public CicoCommonModule { public: // default constructor @@ -40,64 +92,20 @@ public: ~CicoStatusBarClockComponent(); // initialize of clock component - bool Initialize(Evas_Object *window, int posx, int posy); + bool Initialize(Evas_Object *window, Evas *evas); // update of clock component bool Update(void); - // set rate of clock component + // set rate of clock component bool SetRate(double rate); - static const int CLOCK_COMPONENT_WIDTH; /// clock component width - static const int CLOCK_COMPONENT_HEIGHT;/// clock component height + // get clock start position + bool GetClockStart( Evas_Coord *x, Evas_Coord *y); private: - static const int AMPM_WIDTH; /// ampm image width - static const int AMPM_HEIGHT; /// ampm image height - static const int HOUR10_WIDTH; /// hour10 image width - static const int HOUR10_HEIGHT; /// hour10 image height - static const int HOUR1_WIDTH; /// hour1 image width - static const int HOUR1_HEIGHT; /// hour1 image height - static const int COLON_WIDTH; /// colon image width - static const int COLON_HEIGHT; /// colon image height - static const int MIN10_WIDTH; /// min10 image width - static const int MIN10_HEIGHT; /// min10 image height - static const int MIN1_WIDTH; /// min1 image width - static const int MIN1_HEIGHT; /// min1 image height - - static const int COLON_BLANK; /// colon blank size - static const int AMPM_BLANK; /// ampm blank size - static const int LAST_BLANK; /// last blank size - - static const int AMPM_POSX; /// ampm image position x - static const int AMPM_POSY; /// ampm image position y - static const int RELATIVE_HOUR10_POSX; /// hour10 image position x - static const int RELATIVE_HOUR10_POSY; /// hour10 image position y - static const int RELATIVE_HOUR1_POSX; /// hour1 image position x - static const int RELATIVE_HOUR1_POSY; /// hour1 image position y - static const int RELATIVE_COLON_POSX; /// colon image position x - static const int RELATIVE_COLON_POSY; /// colon image position y - static const int RELATIVE_MIN10_POSX; /// min10 image position x - static const int RELATIVE_MIN10_POSY; /// min10 image position y - static const int RELATIVE_MIN1_POSX; /// min1 image position x - static const int RELATIVE_MIN1_POSY; /// min1 image position y - - static const char *imgfilepath_am; /// am image filepath - static const char *imgfilepath_pm; /// pm image filepath - static const char *imgfilepath_0; /// 0 image filepath - static const char *imgfilepath_1; /// 1 image filepath - static const char *imgfilepath_2; /// 2 image filepath - static const char *imgfilepath_3; /// 3 image filepath - static const char *imgfilepath_4; /// 4 image filepath - static const char *imgfilepath_5; /// 5 image filepath - static const char *imgfilepath_6; /// 6 image filepath - static const char *imgfilepath_7; /// 7 image filepath - static const char *imgfilepath_8; /// 8 image filepath - static const char *imgfilepath_9; /// 9 image filepath - static const char *imgfilepath_colon; /// colon image filepath - - std::vector imgfilelist_number; /// image filepath list - double rate_; + int last_clock_image[6]; + }; //========================================================================== @@ -105,7 +113,7 @@ private: * @brief This class provide the notification panel component */ //========================================================================== -class CicoNotificationPanelComponent : public CicoCommonComponent +class CicoNotificationPanelComponent : public CicoCommonModule { public: // default constructor @@ -115,31 +123,20 @@ public: ~CicoNotificationPanelComponent(); // initialize of notification component - bool Initialize(Evas_Object *window); + bool Initialize(Evas_Object *window,Evas *evas); // set notification panel void SetNotification(const char *text, const char *iconpath, const char *soundpath); - // set rate of notification component - bool SetRate(double rate); + // set text end position + void SetTextEndPosition( Evas_Coord x, Evas_Coord y); + +private: + // set text to content_text + bool SetText(const char *text); -protected: - static const int ICON_POSX; /// notification icon position x - static const int ICON_POSY; /// notification icon position y - static const int ICON_WIDTH; /// notification icon width - static const int ICON_HEIGHT; /// notification icon height - static const int RELATIVE_TEXT_POSX; /// notification text position x - static const int RELATIVE_TEXT_POSY; /// notification text position y - static const int TEXT_WIDTH; /// notification text width - static const int TEXT_HEIGHT; /// notification text height - static const char *FONT_STYLE; /// notification text font-style - static const int FONT_SIZE; /// notification text font-size - - std::shared_ptr textmod_; /// notification text module - std::shared_ptr imgmod_; /// notification icon module - double rate_; /// view rate of notification component }; #endif // __CICO_COMPONENT_IMPLEMENTATION_H__ // vim: set expandtab ts=4 sw=4: diff --git a/src/statusbar/CicoComponentInterface.h b/src/statusbar/CicoComponentInterface.h deleted file mode 100644 index a93410d..0000000 --- a/src/statusbar/CicoComponentInterface.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2013, TOYOTA MOTOR CORPORATION. - * - * This program is licensed under the terms and conditions of the - * Apache License, version 2.0. The full text of the Apache License is at - * http://www.apache.org/licenses/LICENSE-2.0 - * - */ - -//========================================================================== -/** - * @file CicoComponentInterface.h - * - * @brief This file is definition of CicoComponentInterface class - */ -//========================================================================== -#ifndef __CICO_COMPONENT_INTERFACE_H__ -#define __CICO_COMPONENT_INTERFACE_H__ - -//========================================================================== -/** - * @brief This class provide the component interfaces - */ -//========================================================================== -class CicoComponentInterface -{ -public: - virtual bool Terminate(void) = 0; - virtual void Show(void) = 0; - virtual void Hide(void) = 0; - virtual void SetPos(int x, int y) = 0; - virtual void SetSize(int w, int h) = 0; - -protected: - CicoComponentInterface() {}; - virtual ~CicoComponentInterface() {}; -}; -#endif // __CICO_COMPONENT_INTERFACE_H__ -// vim: set expandtab ts=4 sw=4: diff --git a/src/statusbar/CicoModuleImplementation.cpp b/src/statusbar/CicoModuleImplementation.cpp deleted file mode 100644 index 66035e8..0000000 --- a/src/statusbar/CicoModuleImplementation.cpp +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2013, TOYOTA MOTOR CORPORATION. - * - * This program is licensed under the terms and conditions of the - * Apache License, version 2.0. The full text of the Apache License is at - * http://www.apache.org/licenses/LICENSE-2.0 - * - */ - -//========================================================================== -/** - * @file CicoModuleImplementation.cpp - * - * @brief This file is implimention of CicoTextModule class - */ -//========================================================================== - -#include -#include -#include -#include - -#include -#include "CicoModuleImplementation.h" - -//-------------------------------------------------------------------------- -/** - * @brief default constructor - * @param[in] none - * @return none - */ -//-------------------------------------------------------------------------- -CicoImageModule::CicoImageModule() - : CicoCommonModule() -{ - memset(filepath_, 0, sizeof(filepath_)); -} - -//-------------------------------------------------------------------------- -/** - * @brief destructor - * @param[in] none - * @return none - */ -//-------------------------------------------------------------------------- -CicoImageModule::~CicoImageModule() -{ -} - -//-------------------------------------------------------------------------- -/** - * @brief initialize of image module - * @param[in] windowobj - * @return true: success false: failed - */ -//-------------------------------------------------------------------------- -bool -CicoImageModule::Initialize(Evas_Object *windowobj) -{ - ICO_TRA("CicoImageModule::Initialize Enter"); - if (windowobj == NULL) { - return false; - } - evasobj_ = elm_image_add(windowobj); - if (evasobj_ == NULL) { - ICO_ERR("elm_image_add() failed."); - ICO_TRA("CicoImageModule::Initialize Leave(false)"); - return false; - } - if (strcmp("elm_image", evas_object_type_get(evasobj_)) != 0) { - ICO_TRA("CicoImageModule::Initialize Leave(false)"); - return false; - } - ICO_DBG("object name=%s", evas_object_name_get(evasobj_)); - ICO_TRA("CicoImageModule::Initialize Leave(true)"); - return true; -} - -//-------------------------------------------------------------------------- -/** - * @brief set filepaht of image module - * @param[in] path image file path - * @return none - */ -//-------------------------------------------------------------------------- -bool -CicoImageModule::SetFilePath(const char *path) -{ - //ICO_TRA("CicoImageModule::SetFilePath Enter"); - assert(evasobj_ != NULL); - memset(filepath_, 0, sizeof(filepath_)); - strcpy(filepath_, path); - //ICO_TRA("CicoImageModule::SetFilePath Leave"); - return (elm_image_file_set(evasobj_, filepath_, NULL) == EINA_TRUE) ? true : false; -} - -const double CicoTextModule::FONT_SIZE_RATE = 0.7; - -//-------------------------------------------------------------------------- -/** - * @brief default constructor - * @param[in] none - * @return none - */ -//-------------------------------------------------------------------------- -CicoTextModule::CicoTextModule() - : CicoCommonModule(), fontsize_(50) -{ - ICO_TRA("CicoTextModule::CicoTextModule Enter"); - memset(text_, 0, sizeof(text_)); - memset(fontstyle_, 0, sizeof(fontstyle_)); - strcpy(fontstyle_, "Sans"); - ICO_TRA("CicoTextModule::CicoTextModule Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief destructor - * @param[in] none - * @return none - */ -//-------------------------------------------------------------------------- -CicoTextModule::~CicoTextModule() -{ - ICO_TRA("CicoTextModule::~CicoTextModule Enter"); - ICO_TRA("CicoTextModule::~CicoTextModule Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief initialize of text module - * @param[in] windowobj - * @return none - */ -//-------------------------------------------------------------------------- -bool -CicoTextModule::Initialize(Evas_Object *windowobj) -{ - ICO_TRA("CicoTextModule::Initialize Enter"); - evasobj_ = elm_label_add(windowobj); - elm_label_line_wrap_set(evasobj_, ELM_WRAP_NONE); - elm_object_style_set(evasobj_, "default"); - - strcpy(fontstyle_, "Sans"); - SetFont(fontstyle_, fontsize_); - - ICO_DBG("object name=%s", evas_object_name_get(evasobj_)); - ICO_TRA("CicoTextModule::Initialize Leave"); - return (evasobj_ != NULL); -} - -//-------------------------------------------------------------------------- -/** - * @brief set text of text module - * @param[in] text - * @return true: success - */ -//-------------------------------------------------------------------------- -bool -CicoTextModule::SetText(const char *text) -{ - ICO_TRA("CicoTextModule::SetText Enter(text=%s)", text); - memset(text_, 0, sizeof(text_)); - strncpy(text_, text, (sizeof(text_)-1)); - ICO_DBG("text_=%s", text_); - - elm_object_part_text_set(evasobj_, NULL, text_); - SetFont(fontstyle_, fontsize_); - SetSize(FONT_SIZE_RATE * fontsize_ * strlen(text), height_); - - ICO_TRA("CicoTextModule::SetText Leave"); - return true; -} - -//-------------------------------------------------------------------------- -/** - * @brief set font of text module - * @param[in] style font style - * @param[in] size font size - * @return none - */ -//-------------------------------------------------------------------------- -void -CicoTextModule::SetFont(const char *style, const int size) -{ - ICO_TRA("CicoTextModule::SetFont Enter" - "(style=%s size=%d)", style, size); - - if (style != NULL) { - strcpy(fontstyle_, style); - } - if (size > 0) { - fontsize_ = size; - } - - const char *textclassname = evas_object_type_get(evasobj_); - char textclassname2[strlen(textclassname) + 1]; - if (strncmp(textclassname, "elm_", 4) == 0) { - memset(textclassname2, 0, sizeof(textclassname2)); - for (int i = 0; textclassname[i + 4] != '\0'; i++) { - textclassname2[i] = textclassname[i + 4]; - } - textclassname = textclassname2; - } - elm_config_font_overlay_set(textclassname, fontstyle_, fontsize_); - elm_config_font_overlay_apply(); - ICO_TRA("CicoTextModule::SetFont Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief set color of text module - * @param[in] r Red color - * @param[in] g Green color - * @param[in] b Blue color - * @param[in] a alpha color - * @return none - */ -//-------------------------------------------------------------------------- -void CicoTextModule::SetColor(const int r, const int g, - const int b, const int a) -{ - ICO_TRA("CicoTextModule::SetColor Enter" - "(r/g/b/a=%d/%d/%d/%d)", r, g, b, a); - elm_object_style_set(evasobj_, "marker"); - evas_object_color_set(evasobj_, r, g, b, a); - ICO_TRA("CicoTextModule::SetColor Leave"); -} -// vim: set expandtab ts=4 sw=4: diff --git a/src/statusbar/CicoModuleImplementation.h b/src/statusbar/CicoModuleImplementation.h deleted file mode 100644 index 4d79c40..0000000 --- a/src/statusbar/CicoModuleImplementation.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2013, TOYOTA MOTOR CORPORATION. - * - * This program is licensed under the terms and conditions of the - * Apache License, version 2.0. The full text of the Apache License is at - * http://www.apache.org/licenses/LICENSE-2.0 - * - */ - -//========================================================================== -/** - * @file CicoModuleInterface.h - * - * @brief This file is definition of CicoModuleInterface class - */ -//========================================================================== -#ifndef __CICO_MODULE_IMPLEMENTATION_H__ -#define __CICO_MODULE_IMPLEMENTATION_H__ - -#include -#include "CicoModuleInterface.h" - -//========================================================================== -/** - * @brief This class provide the common module component interfaces - */ -//========================================================================== -class CicoCommonModule : public CicoModuleInterface -{ -public: - // default constructor - CicoCommonModule(); - - // destructor - virtual ~CicoCommonModule(); - - // terminate module - virtual bool Terminate(void); - - // show module - virtual void Show(void); - - // hide module - virtual void Hide(void); - - // set position of module - virtual void SetPos(int x, int y); - - // set size of module - virtual void SetSize(int w, int h); - - // move module - virtual void Move(int diffx, int diffy); - - // resize module - virtual void Resize(double ratew, double rateh); - - // reset position and size of module - virtual void Reallocate(int standardx, int standardy, - double ratew, double rateh); - - // get raw data - Evas_Object *GetRawData(void) const; - bool operator==(const CicoCommonModule& moduleb) { - return (this->evasobj_ == moduleb.evasobj_); - } - -protected: - Evas_Object *evasobj_; /// module object - int posx_; /// module position x - int posy_; /// module position y - int width_; /// module width - int height_; /// module height -}; - -//========================================================================== -/** - * @brief This class provide the image module - */ -//========================================================================== -class CicoImageModule : public CicoCommonModule -{ -public: - // default constructor - CicoImageModule(); - - // destructor - virtual ~CicoImageModule(); - - // initialize of image module - bool Initialize(Evas_Object *windowobj); - - // set filepath of image module - bool SetFilePath(const char *path); -protected: - char filepath_[256]; ///image file path -}; - -//========================================================================== -/** - * @brief This class provide the text module - */ -//========================================================================== -class CicoTextModule : public CicoCommonModule -{ -public: - // default contructor - CicoTextModule(); - - // destructor - ~CicoTextModule(); - - // initialize of text module - bool Initialize(Evas_Object *windowobj); - - // set text of text module - bool SetText(const char *text); - - // set font of text module - void SetFont(const char *style, const int size); - - // set color of text module - void SetColor(const int r, const int g, const int b, const int a); -protected: - static const double FONT_SIZE_RATE; /// rate of font size - char text_[256]; /// text of textmodule - char fontstyle_[256]; /// font style of textmodule - int fontsize_; /// font size of textmodule -}; -#endif // __CICO_MODULE_IMPLEMENTATION_H__ -// vim: set expandtab ts=4 sw=4: diff --git a/src/statusbar/CicoModuleInterface.h b/src/statusbar/CicoModuleInterface.h deleted file mode 100644 index 85a3a4e..0000000 --- a/src/statusbar/CicoModuleInterface.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2013, TOYOTA MOTOR CORPORATION. - * - * This program is licensed under the terms and conditions of the - * Apache License, version 2.0. The full text of the Apache License is at - * http://www.apache.org/licenses/LICENSE-2.0 - * - */ - -//========================================================================== -/** - * @file CicoModuleInterface.h - * - * @brief This file is definition of CicoModuleInterface class - */ -//========================================================================== -#ifndef __CICO_MODULE_INTERFACE_H__ -#define __CICO_MODULE_INTERFACE_H__ - -//========================================================================== -/** - * @brief This class provide the module interfaces - */ -//========================================================================== -class CicoModuleInterface -{ -public: - virtual bool Terminate(void) = 0; - virtual void Show(void) = 0; - virtual void Hide(void) = 0; - virtual void SetPos(int x, int y) = 0; - virtual void SetSize(int w, int h) = 0; - virtual void Move(int diffx, int diffy) = 0; - virtual void Resize(double ratew, double rateh) = 0; - virtual void Reallocate(int standardx, int standardy, - double ratew, double rateh) = 0; -}; -#endif // __CICO_MODULE_INTERFACE_H__ -// vim: set expandtab ts=4 sw=4: diff --git a/src/statusbar/CicoSBEFLApp.cpp b/src/statusbar/CicoSBEFLApp.cpp index b3b2edb..09dd2a2 100644 --- a/src/statusbar/CicoSBEFLApp.cpp +++ b/src/statusbar/CicoSBEFLApp.cpp @@ -32,6 +32,7 @@ CicoSBEFLApp::CicoSBEFLApp() { ICO_TRA("CicoSBEFLApp::CicoSBEFLApp Enter"); + m_statusbar = NULL; ICO_TRA("CicoSBEFLApp::CicoSBEFLApp Leave"); } @@ -104,6 +105,7 @@ void CicoSBEFLApp::onTerminate(void *user_data) { ICO_TRA("CicoSBEFLApp::onTerminate Enter"); + delete m_statusbar; ICO_TRA("CicoSBEFLApp::onTerminate Leave"); } diff --git a/src/statusbar/CicoStatusBar.cpp b/src/statusbar/CicoStatusBar.cpp index fc3bd75..242dc44 100644 --- a/src/statusbar/CicoStatusBar.cpp +++ b/src/statusbar/CicoStatusBar.cpp @@ -17,15 +17,10 @@ using namespace std; -const int CicoStatusBar::STATUSBAR_POSX = 0; -const int CicoStatusBar::STATUSBAR_POSY = 0; +const int CicoStatusBar::STATUSBAR_POSX = 0; +const int CicoStatusBar::STATUSBAR_POSY = 0; const int CicoStatusBar::STATUSBAR_HEIGHT = 64; -const int CicoStatusBar::CLOCK_WIDTH = - CicoStatusBarClockComponent::CLOCK_COMPONENT_WIDTH; -const int CicoStatusBar::CLOCK_HEIGHT = - CicoStatusBarClockComponent::CLOCK_COMPONENT_HEIGHT; - //-------------------------------------------------------------------------- /** * @brief default constructor @@ -36,6 +31,9 @@ const int CicoStatusBar::CLOCK_HEIGHT = CicoStatusBar::CicoStatusBar() : CicoCommonWindow() { + notitimer_ = NULL; + clockcomp_ = NULL; + noticomp_ = NULL; } //-------------------------------------------------------------------------- @@ -47,9 +45,18 @@ CicoStatusBar::CicoStatusBar() //-------------------------------------------------------------------------- CicoStatusBar::~CicoStatusBar() { + ICO_TRA("CicoStatusBar::~CicoStatusBar() Enter"); + if (notitimer_ != NULL) { + ecore_timer_del(notitimer_); + } + while( !noti_list.empty() ) { - DeleteNotification( this ); + DeleteNotification(); } + + delete clockcomp_; + delete noticomp_; + ICO_TRA("CicoStatusBar::~CicoStatusBar() Leave"); } //-------------------------------------------------------------------------- @@ -65,6 +72,9 @@ CicoStatusBar::Initialize(void) ICO_TRA("CicoStatusBar::Initialize() Enter"); ICO_DBG("Initialize start window_."); + ecore_evas_init(); + edje_init(); + window_ = ecore_evas_new(NULL, 0, 0, 1, 1, "frame=0"); if (window_ == NULL) { return false; @@ -84,7 +94,7 @@ CicoStatusBar::Initialize(void) ICO_DBG("Initialize start windowobj_."); windowobj_ = evas_object_rectangle_add(ecore_evas_get(window_)); - //statusbar RGBcolor setting + // statusbar RGBcolor setting evas_object_color_set(windowobj_, 0, 0, 0, 255); ICO_DBG("Initialize setpos windowobj_."); @@ -97,18 +107,16 @@ CicoStatusBar::Initialize(void) ICO_DBG("Initialize end windowobj_."); ICO_DBG("Initialize start Clock_Component."); - clockcomp_ = std::make_shared(CicoStatusBarClockComponent()); - if (!clockcomp_->Initialize(windowobj_, - (width_ - CLOCK_WIDTH - 100), - ((STATUSBAR_HEIGHT - CLOCK_HEIGHT) / 2))){ + clockcomp_ = new CicoStatusBarClockComponent(); + if (!clockcomp_->Initialize(windowobj_, ecore_evas_get(window_) )){ ICO_ERR("Failed to initialize Clock_Componet."); return false; } ICO_DBG("Initialize end Clock_Component."); ICO_DBG("Initialize start Notification_Component."); - noticomp_ = std::make_shared(CicoNotificationPanelComponent()); - if (!noticomp_->Initialize(windowobj_)) { + noticomp_ = new CicoNotificationPanelComponent(); + if (!noticomp_->Initialize(windowobj_,ecore_evas_get(window_))) { ICO_ERR("Failed to initialize Notification_Component."); return false; } @@ -117,6 +125,12 @@ CicoStatusBar::Initialize(void) notiservice_.SetCallback(NotificationCallback, this); ICO_DBG("Initialize end Notification_Component."); + // set notification text end + Evas_Coord x, y; + if ( clockcomp_-> GetClockStart( &x, &y ) ) { + noticomp_->SetTextEndPosition( x, y ); + } + Show(); // add timer callback function of time update @@ -150,7 +164,7 @@ CicoStatusBar::UpdateTime() /*--------------------------------------------------------------------------*/ /** - * @brief update notification panel + * @brief update notification panel * @param[in] msg message * @param[in] iconpaht icon image path * @param[in] soundpath sound data path @@ -158,7 +172,7 @@ CicoStatusBar::UpdateTime() */ /*--------------------------------------------------------------------------*/ bool -CicoStatusBar::UpdateNotificationPanel( CicoStatusBar *sb ) +CicoStatusBar::UpdateNotificationPanel() { /* if timer is active then wait timeout */ @@ -168,12 +182,11 @@ CicoStatusBar::UpdateNotificationPanel( CicoStatusBar *sb ) } /* get Notification , if it is empty then return */ - CicoNotification* noti = sb->GetNotification(sb); - if ( noti == NULL ) { + CicoNotification* noti = GetNotification(); + if (noti == NULL) { ICO_TRA("CicoStatusBar::UpdateNotificationPanel empty" ); return false; } - //const char *msg = noti->GetTitle(); const char *msg = noti->GetContent(); const char *iconpath = noti->GetIconPath(); const char *soundpath = NULL; @@ -183,14 +196,14 @@ CicoStatusBar::UpdateNotificationPanel( CicoStatusBar *sb ) "(msg=%s icon=%s sound=%s)", msg, iconpath, soundpath); if (msg == NULL && iconpath == NULL && soundpath == NULL) { ICO_ERR("notification info is NULL."); - sb->DeleteNotification(sb); + DeleteNotification(); return false; } noticomp_->SetNotification(msg, iconpath, soundpath); noticomp_->Show(); /* delete Notification and set disp timer */ - sb->DeleteNotification(sb); + DeleteNotification(); notitimer_ = ecore_timer_add(3.0, HideNotification, this); ICO_TRA("CicoStatusBar::UpdateNotificationPanel Leave"); @@ -227,13 +240,13 @@ CicoStatusBar::NotificationCallback(void *data, ICO_DBG("NOTIFICATION_OP_INSERT/NOTIFICATION_OP_UPDATE"); /* add notification and update SB */ - sb->AddNotification( sb, op_list[i].noti ); - sb->UpdateNotificationPanel( sb ); + sb->AddNotification( op_list[i].noti ); + sb->UpdateNotificationPanel(); break; case NOTIFICATION_OP_DELETE: ICO_DBG("NOTIFICATION_OP_DELETE"); - sb->DeleteNotification( sb, op_list[i].priv_id ); + sb->DeleteNotification( op_list[i].priv_id ); break; case NOTIFICATION_OP_DELETE_ALL: ICO_DBG("NOTIFICATION_OP_DELETE_ALL"); @@ -253,7 +266,7 @@ CicoStatusBar::NotificationCallback(void *data, /*--------------------------------------------------------------------------*/ /** - * @brief hide notification panel + * @brief hide notification panel * * @param[in] data StatusBar object * @return ECORE_CALLBACK_CANCEL @@ -269,7 +282,7 @@ CicoStatusBar::HideNotification(void *data) sb->notitimer_ = NULL; /* update notification ,if Notification exist in the queue */ - sb->UpdateNotificationPanel( sb ); + sb->UpdateNotificationPanel(); ICO_TRA("CicoStatusBar::HideNotification Leave"); return ECORE_CALLBACK_CANCEL; @@ -284,8 +297,8 @@ CicoStatusBar::HideNotification(void *data) * @return non */ /*--------------------------------------------------------------------------*/ -void -CicoStatusBar::AddNotification(CicoStatusBar* sb, notification_h noti_h) +void +CicoStatusBar::AddNotification(notification_h noti_h) { ICO_TRA("CicoStatusBar::AddNotification() Enter"); @@ -294,7 +307,7 @@ CicoStatusBar::AddNotification(CicoStatusBar* sb, notification_h noti_h) delete noti; return; } - sb->noti_list.push_back(noti); + noti_list.push_back(noti); ICO_TRA("CicoStatusBar::AddNotification Leave"); } @@ -307,18 +320,18 @@ CicoStatusBar::AddNotification(CicoStatusBar* sb, notification_h noti_h) * @return CicoNotification class pointer */ /*--------------------------------------------------------------------------*/ -CicoNotification* -CicoStatusBar::GetNotification(CicoStatusBar* sb) +CicoNotification* +CicoStatusBar::GetNotification() { ICO_TRA("CicoStatusBar::GetNotification() Enter"); - if ( ! sb->noti_list.empty() ) { - CicoNotification *noti = sb->noti_list.front(); + if ( ! noti_list.empty() ) { + CicoNotification *noti = noti_list.front(); if ( noti ) { return noti; } else { - DeleteNotification(sb); + DeleteNotification(); } } ICO_TRA("CicoStatusBar::GetNotification Leave"); @@ -326,7 +339,7 @@ CicoStatusBar::GetNotification(CicoStatusBar* sb) } /*--------------------------------------------------------------------------*/ -/** +/* * @brief delete first notification * * @param[in] sb StatusBar object @@ -334,16 +347,14 @@ CicoStatusBar::GetNotification(CicoStatusBar* sb) */ /*--------------------------------------------------------------------------*/ void -CicoStatusBar::DeleteNotification(CicoStatusBar *sb) +CicoStatusBar::DeleteNotification() { ICO_TRA("CicoStatusBar::DeleteNotification() Enter"); - if ( ! sb->noti_list.empty() ) { - CicoNotification *noti = sb->noti_list.front(); - if ( noti ) { - delete noti; - } - sb->noti_list.pop_front(); + if ( ! noti_list.empty() ) { + CicoNotification *noti = noti_list.front(); + delete noti; + noti_list.pop_front(); } ICO_TRA("CicoStatusBar::DeleteNotification Leave"); @@ -359,7 +370,7 @@ CicoStatusBar::DeleteNotification(CicoStatusBar *sb) */ /*--------------------------------------------------------------------------*/ void -CicoStatusBar::DeleteNotification(CicoStatusBar *sb, int priv_id) +CicoStatusBar::DeleteNotification(int priv_id) { ICO_TRA("CicoStatusBar::DeleteNotification() Enter"); @@ -379,13 +390,12 @@ CicoStatusBar::DeleteNotification(CicoStatusBar *sb, int priv_id) } - //========================================================================== // public functions //========================================================================== //-------------------------------------------------------------------------- /** - * @brief callback function of time update + * @brief callback function of time update * * @param [in] data user date */ diff --git a/src/statusbar/CicoStatusBar.h b/src/statusbar/CicoStatusBar.h index 5ceeac6..9dfa088 100644 --- a/src/statusbar/CicoStatusBar.h +++ b/src/statusbar/CicoStatusBar.h @@ -43,28 +43,26 @@ public: // destructor ~CicoStatusBar(); - // initialize status bar + // initialize status bar bool Initialize(void); // update clock bool UpdateTime(void); // add last Notification queue - void AddNotification(CicoStatusBar *sb, notification_h noti_h); + void AddNotification( notification_h noti_h); // get first Notification queue - CicoNotification* GetNotification(CicoStatusBar *sb); + CicoNotification* GetNotification(); // delete first Notification queue - void DeleteNotification(CicoStatusBar *sb); + void DeleteNotification(); // delete Notification queue - void DeleteNotification(CicoStatusBar *sb, int priv_id); + void DeleteNotification(int priv_id); // update notification panel - //bool UpdateNotificationPanel(const char *msg, const char *icopath, - // const char *soundpath); - bool UpdateNotificationPanel(CicoStatusBar *sb); + bool UpdateNotificationPanel(); // notification callback static void NotificationCallback(void *data, notification_type_e type, @@ -86,8 +84,9 @@ protected: Ecore_Timer *notitimer_; /// notification timer List_CicoNoti noti_list; /// notification Queue - std::shared_ptr clockcomp_; /// clock component - std::shared_ptr noticomp_; /// notification component + CicoStatusBarClockComponent *clockcomp_; /// clock component + CicoNotificationPanelComponent *noticomp_; /// notification component + CicoNotificationService notiservice_; /// notification service }; #endif // __CICO_STATUSBAR_H__ diff --git a/src/statusbar/CicoWindowInterface.h b/src/statusbar/CicoWindowInterface.h deleted file mode 100644 index 9ee3bbd..0000000 --- a/src/statusbar/CicoWindowInterface.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2013, TOYOTA MOTOR CORPORATION. - * - * This program is licensed under the terms and conditions of the - * Apache License, version 2.0. The full text of the Apache License is at - * http://www.apache.org/licenses/LICENSE-2.0 - * - */ - -//========================================================================== -/** - * @file CicoWindowInterface.h - * - * @brief This file is definition of CicoWindowInterface class - */ -//========================================================================== -#ifndef CICO_WINDOW_INTERFACE_H_ -#define CICO_WINDOW_INTERFACE_H_ - -//========================================================================== -/** - * @brief This class provide the window interfaces - */ -//========================================================================== -class CicoWindowInterface -{ -public: - virtual bool Terminate(void) = 0; - virtual void Show(void) = 0; - virtual void Hide(void) = 0; - virtual void SetPos(int x, int y) = 0; - virtual void SetSize(int w, int h) = 0; -}; -#endif // __CICO_WINDOW_INTERFACE_H__ -// vim: set expandtab ts=4 sw=4: diff --git a/src/statusbar/Makefile.am b/src/statusbar/Makefile.am index 51de669..2ac802e 100644 --- a/src/statusbar/Makefile.am +++ b/src/statusbar/Makefile.am @@ -6,10 +6,8 @@ noinst_PROGRAMS = \ StatusBar StatusBar_SOURCES = \ - CicoCommonComponent.cpp \ CicoCommonModule.cpp \ CicoCommonWindow.cpp \ - CicoModuleImplementation.cpp \ CicoComponentImplementation.cpp \ CicoStatusBar.cpp \ CicoSBEFLApp.cpp \ @@ -50,17 +48,29 @@ StatusBar_LDADD = \ $(UWS_LIBS) \ $(NOTIFICATION_LIBS) +SUFFIXES = .edc .edj + +BUILT_SOURCES = \ + statusbar.edj + +.edc.edj: + edje_cc $< -id ../../res/org.tizen.ico.statusbar/res/images \ + -fd ../../res/org.tizen.ico.statusbar/res/images \ + -sd ../../res/org.tizen.ico.statusbar/res/sounds -o $@ + CLEANFILES = $(BUILT_SOURCES) install-exec-hook: mkdir -p $(INSTALL_ROOT)/usr/apps/org.tizen.ico.statusbar/bin mkdir -p $(INSTALL_ROOT)/usr/apps/org.tizen.ico.statusbar/res/config mkdir -p $(INSTALL_ROOT)/usr/apps/org.tizen.ico.statusbar/res/images + mkdir -p $(INSTALL_ROOT)/usr/apps/org.tizen.ico.statusbar/res/themes mkdir -p $(INSTALL_ROOT)/usr/share/packages install -m 0755 StatusBar $(INSTALL_ROOT)/usr/apps/org.tizen.ico.statusbar/bin install -m 0644 $(top_srcdir)/res/org.tizen.ico.statusbar/res/images/time*.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.statusbar/res/images install -m 0644 $(top_srcdir)/data/share/packages/org.tizen.ico.statusbar.xml $(INSTALL_ROOT)/usr/share/packages install -m 0644 $(top_srcdir)/res/org.tizen.ico.statusbar/res/config/* $(INSTALL_ROOT)/usr/apps/org.tizen.ico.statusbar/res/config + install -m 0644 *.edj $(INSTALL_ROOT)/usr/apps/org.tizen.ico.statusbar/res/themes uninstall: rm -rf $(INSTALL_ROOT)/usr/apps/org.tizen.ico.statusbar diff --git a/src/statusbar/main.cpp b/src/statusbar/main.cpp index e18418c..03e8087 100644 --- a/src/statusbar/main.cpp +++ b/src/statusbar/main.cpp @@ -33,7 +33,7 @@ //-------------------------------------------------------------------------- /** * @brief setup log - * @param[in] void + * @param[in] void * @return none */ //-------------------------------------------------------------------------- @@ -115,7 +115,7 @@ setupLog(void) //-------------------------------------------------------------------------- /** - * @brief status bar main + * @brief status bar main * * @param [in] argc counts of argment * @param [in] argv argment @@ -129,7 +129,7 @@ main(int argc, char *argv[]) { try { printf("=== start Status Bar main entry\n"); - + // setupLog setupLog(); ICO_INF( "START_MODULE StatusBar"); diff --git a/src/statusbar/statusbar.edc b/src/statusbar/statusbar.edc new file mode 100644 index 0000000..7ece7e9 --- /dev/null +++ b/src/statusbar/statusbar.edc @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2014, TOYOTA MOTOR CORPORATION. + * + * This program is licensed under the terms and conditions of the + * Apache License, version 2.0. The full text of the Apache License is at + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ + +collections { + group { + name: "Notification"; + + styles { + style { + name: "content_style_left"; + base: "font="Sans" font_size=22 color=#00FFFFFF shadow_color=#80808032 style=shadow wrap=mixed"; + } + style { + name: "content_style_center"; + base: "font="Sans" font_size=25 color=#00FFFFFF shadow_color=#80808032 align=center style=shadow wrap=mixed"; + } + } + + parts { + part { + name: "noti_image"; + type: IMAGE; + description { + min: 50 50; + max: 50 50; + align: 0.0 0.0; + rel1 { + relative: 0.0 0.0; + offset: 0 7; + } +/* + image{ + normal: "time_0.png"; + } +*/ + } + } + + + part { + name: "content_text"; + type: TEXTBLOCK; + scale: 1; + effect: FAR_SOFT_SHADOW; + description { + min: 300 50; + max: 1500 50; + state: "default" 0.0; + align: 0.0 0.0; + rel1.relative: 0.0 0.0; + rel1.offset: 70 5; + color: 0 255 255 255; + text { + style: "content_style_left"; + text: "text"; + align: 0.0 0.5; + } + } + } + } + } + group { + name: "ClockImage"; + + images{ + image:"time_am.png" COMP; + image:"time_ten.png" COMP; + image:"time_0.png" COMP; + } + + + parts { + part { + name: "MIN1_img"; + type: IMAGE; + description { + min: 30 45; + max: 30 45; + align: 0.0 0.0; + rel1 { + relative: 0.0 0.0; + offset: 500 3; + } + image{ + normal: "time_0.png"; + } + } + } + part { + name: "MIN10_img"; + type: IMAGE; + description { + min: 30 45; + max: 30 45; + align: 0.0 0.0; + rel1 { + to: "MIN1_img"; + relative: 0.0 0.0; + offset: -31 0; + } + image{ + normal: "time_0.png"; + } + } + } + part { + name: "TIME_SP_img"; + type: IMAGE; + description { + min: 12 30; + max: 12 30; + align: 0.0 0.0; + rel1 { + to: "MIN10_img"; + relative: 0.0 0.0; + offset: -13 8; + } + image{ + normal: "time_ten.png"; + } + } + } + part { + name: "HOUR1_img"; + type: IMAGE; + description { + min: 30 45; + max: 30 45; + align: 0.0 0.0; + rel1 { + to: "TIME_SP_img"; + relative: 0.0 0.0; + offset: -31 -8; + } + image{ + normal: "time_0.png"; + } + } + } + part { + name: "HOUR10_img"; + type: IMAGE; + description { + min: 30 45; + max: 30 45; + align: 0.0 0.0; + rel1 { + to: "HOUR1_img"; + relative: 0.0 0.0; + offset: -31 0; + } + image{ + normal: "time_0.png"; + } + } + } + part { + name: "AM_PM_img"; + type: IMAGE; + description { + min: 60 45; + max: 60 45; + align: 0.0 0.0; + rel1 { + to: "HOUR10_img"; + relative: 0.0 0.0; + offset: -61 12; + } + image{ + normal: "time_am.png"; + } + } + } + } + } +} diff --git a/src/syscond/Makefile.am b/src/syscond/Makefile.am index d862bb2..16701e7 100644 --- a/src/syscond/Makefile.am +++ b/src/syscond/Makefile.am @@ -28,8 +28,6 @@ IcoSysconDaemon_CPPFLAGS = \ @MURPHYRESOURCE_CFLAGS@ \ @EDBUS_CFLAGS@ \ $(UWS_CFLAGS) \ - $(GENIVI_CFLAGS) \ - $(WESTONPLUGIN_CFLAGS) \ -I../../include \ -I../../lib/system-controller \ -I../../lib/common diff --git a/tool/ico_clear_screen.c b/tool/ico_clear_screen.c index 63d59b3..e13ce1f 100644 --- a/tool/ico_clear_screen.c +++ b/tool/ico_clear_screen.c @@ -28,14 +28,10 @@ sigterm_catch(int signo) { signal_flag = 1; -#if 0 if (_display->ico_window_mgr) { - ico_window_mgr_set_visible(_display->ico_window_mgr, ICO_WINDOW_MGR_V_MAINSURFACE, - ICO_WINDOW_MGR_VISIBLE_HIDE, ICO_WINDOW_MGR_V_NOCHANGE, - ICO_WINDOW_MGR_FLAGS_ANIMATION | - ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE); + ico_window_mgr_layout_surface(_display->ico_window_mgr, -1, -1, + -1, -1, -1, -1, 0); } -#endif } void @@ -141,23 +137,12 @@ opengl_create_window(struct display *display, struct wl_surface *surface, opengl_swap_buffer(display->display, dpy, egl_surface); -#if 0 - ico_window_mgr_set_animation(display->ico_window_mgr, ICO_WINDOW_MGR_V_MAINSURFACE, + ico_window_mgr_set_animation(display->ico_window_mgr, 0, ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE| ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW, display->animation, display->animatime); - ico_window_mgr_set_positionsize(display->ico_window_mgr, ICO_WINDOW_MGR_V_MAINSURFACE, - displayno, posx, posy, - ICO_WINDOW_MGR_V_NOCHANGE, ICO_WINDOW_MGR_V_NOCHANGE, - ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE); - ico_window_mgr_set_window_layer(display->ico_window_mgr, ICO_WINDOW_MGR_V_MAINSURFACE, - display->init_layer); - ico_window_mgr_set_layer_visible(display->ico_window_mgr, display->init_layer, 1); - ico_window_mgr_set_visible(display->ico_window_mgr, ICO_WINDOW_MGR_V_MAINSURFACE, - ICO_WINDOW_MGR_VISIBLE_SHOW, ICO_WINDOW_MGR_RAISE_RAISE, - ICO_WINDOW_MGR_FLAGS_ANIMATION | - ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE); -#endif + ico_window_mgr_layout_surface(display->ico_window_mgr, 0, display->init_layer, + posx, posy, width, height, 1); return(egl_surface); } diff --git a/tool/notification/Makefile.am b/tool/notification/Makefile.am index da306f9..fafb454 100644 --- a/tool/notification/Makefile.am +++ b/tool/notification/Makefile.am @@ -3,11 +3,13 @@ AM_CPPFLAGS = $(GCC_CXXFLAGS) noinst_PROGRAMS = \ ico_send_notification \ + ico_send_notification2 \ ico_dump_notification \ ico_del_notification check_PROGRAMS = \ ico_send_notification \ + ico_send_notification2 \ ico_dump_notification \ ico_dump_notification @@ -23,6 +25,15 @@ ico_send_notification_CXXFLAGS = \ ico_send_notification_LDADD = \ $(NOTIFICATION_LIBS) +ico_send_notification2_SOURCES = \ + send_notification2.cpp + +ico_send_notification2_CXXFLAGS = \ + $(NOTIFICATION_CFLAGS) + +ico_send_notification2_LDADD = \ + $(NOTIFICATION_LIBS) -lappsvc + # # # diff --git a/tool/notification/send_notification2.cpp b/tool/notification/send_notification2.cpp new file mode 100644 index 0000000..3b84b99 --- /dev/null +++ b/tool/notification/send_notification2.cpp @@ -0,0 +1,179 @@ +#include +#include +#include +#include +#include +#include +#include "notification.h" +using namespace std; + +const char * +errorToString(notification_error_e error) +{ + const char *strerr = NULL; + + switch (error) { + case NOTIFICATION_ERROR_NONE: + strerr = "NOTIFICATION_ERROR_NONE"; + break; + case NOTIFICATION_ERROR_INVALID_DATA: + strerr = "NOTIFICATION_ERROR_INVALID_DATA"; + break; + case NOTIFICATION_ERROR_NO_MEMORY: + strerr = "NOTIFICATION_ERROR_NO_MEMORY"; + break; + case NOTIFICATION_ERROR_FROM_DB: + strerr = "NOTIFICATION_ERROR_FROM_DB"; + break; + case NOTIFICATION_ERROR_ALREADY_EXIST_ID: + strerr = "NOTIFICATION_ERROR_ALREADY_EXIST_ID"; + break; + case NOTIFICATION_ERROR_FROM_DBUS: + strerr = "NOTIFICATION_ERROR_FROM_DBUS"; + break; + case NOTIFICATION_ERROR_NOT_EXIST_ID: + strerr = "NOTIFICATION_ERROR_NOT_EXIST_ID"; + break; + case NOTIFICATION_ERROR_IO: + strerr = "NOTIFICATION_ERROR_IO"; + break; + case NOTIFICATION_ERROR_SERVICE_NOT_READY: + strerr = "NOTIFICATION_ERROR_SERVICE_NOT_READY"; + break; + case NOTIFICATION_ERROR_PERMISSION_DENIED: + strerr = "NOTIFICATION_ERROR_PERMISSION_DENIED"; + break; + default: + strerr = "UNKOWN"; + break; + } + + return strerr; +} + +int +insert_notification(notification_type_e type, + int group_id, + int priv_id, + const char *pkgname, + const char *title, + const char *content, + const char *icon) +{ + notification_h noti = notification_new(type, + group_id, + priv_id); + if (NULL == noti) { + cout << "notification_new() failed." << endl; + return -1; + } + + //set Pkgname + if (NULL == pkgname) { + return -1; + } + + notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_set_pkgname(noti, pkgname); + if (noti_err != NOTIFICATION_ERROR_NONE) { + printf("notification_set_pkgname failed(%s).\n", + errorToString(noti_err)); + return -1; + } + + //set Title + if (NULL == title) { + return -1; + } + noti_err = notification_set_text(noti, + NOTIFICATION_TEXT_TYPE_TITLE, + title, + NULL, + NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + cout << "Failed to set notification title :"<< noti_err<:"<< noti_err<:"<< noti_err <:"<< noti_err <