From 4f24029c42cd159fda7a638a90d329f2401d9fae Mon Sep 17 00:00:00 2001 From: Masayuki Sasaki Date: Fri, 28 Feb 2014 14:11:33 +0900 Subject: [PATCH] Some interfaces were added for SystemController corresponding to GENIVI layer management. Bug-Tizen: TIVI-1412 Change-Id: I2b28b6b5f01b8512ab20617bba4b72d9c3919a92 Signed-off-by: Masayuki Sasaki --- configure.ac | 2 +- include/ico_syc_appresctl.h | 3 +- include/ico_syc_msg_cmd_def.h | 13 +- include/ico_syc_sysdef.h | 8 +- include/ico_syc_type.h | 36 +- lib/apps-framework/ico_syc_appresctl.c | 95 +++- lib/apps-framework/ico_syc_common.c | 7 +- lib/common/CicoConf.h | 80 ++- lib/common/CicoSystemConfig.cpp | 431 ++++++++++++--- lib/common/CicoSystemConfig.h | 53 +- lib/system-controller/CicoSCCommand.cpp | 36 +- lib/system-controller/CicoSCCommand.h | 17 + lib/system-controller/CicoSCLayer.cpp | 32 +- lib/system-controller/CicoSCLayer.h | 2 + lib/system-controller/CicoSCMessage.h | 6 +- lib/system-controller/CicoSCPolicyDef.h | 12 +- lib/system-controller/CicoSCPolicyManager.cpp | 6 +- lib/system-controller/CicoSCResourceManager.cpp | 346 +++++++++++- lib/system-controller/CicoSCResourceManager.h | 55 +- lib/system-controller/CicoSCServer.cpp | 36 +- lib/system-controller/CicoSCUserManager.cpp | 2 +- lib/system-controller/CicoSCWayland.cpp | 2 +- lib/system-controller/CicoSCWaylandIF.cpp | 1 - lib/system-controller/CicoSCWindow.cpp | 4 +- lib/system-controller/CicoSCWindow.h | 8 +- lib/system-controller/CicoSCWindowController.cpp | 601 +++++++++++++++------ lib/system-controller/CicoSCWindowController.h | 32 +- lib/system-controller/CicoSCWlWinMgrIF.cpp | 205 ++++++- lib/system-controller/CicoSCWlWinMgrIF.h | 40 +- lib/system-controller/Makefile.am | 1 + .../ico_syc_mrp_resource_private.h | 10 + packaging/ico-uxf-homescreen.changes | 6 + packaging/ico-uxf-homescreen.spec | 4 + .../res/config/policy.json | 26 +- .../res/config/system.xml | 59 +- src/homescreen/CicoHomeScreen.cpp | 18 +- src/homescreen/CicoHomeScreenCommon.h | 4 +- src/onscreen/CicoOSEFLApp.cpp | 1 - src/onscreen/CicoOnScreen.cpp | 545 ++++++++----------- src/onscreen/CicoOnScreen.h | 100 +--- src/onscreen/Makefile.am | 3 +- .../apps-framework/tst_appresctl.c | 29 +- .../system-controller/apps-framework/tst_common.h | 10 + tool/Makefile.am | 3 +- tool/ico_clear_screen.c | 4 + tool/notification/send_notification.cpp | 29 +- 46 files changed, 2157 insertions(+), 866 deletions(-) diff --git a/configure.ac b/configure.ac index cb38794..59d9445 100644 --- a/configure.ac +++ b/configure.ac @@ -79,7 +79,7 @@ UWS_LIBS="-lico-util" AC_SUBST(UWS_CFLAGS) AC_SUBST(UWS_LIBS) -GENIVI_CFLAGS="-I/usr/include/ilm -I/usr/include/layermanager" +GENIVI_CFLAGS="-I/usr/include/ilm" GENIVI_LIBS="-lilmCommon -lilmControl -lilmClient" AC_SUBST(GENIVI_CFLAGS) AC_SUBST(GENIVI_LIBS) diff --git a/include/ico_syc_appresctl.h b/include/ico_syc_appresctl.h index 8084309..187f44a 100644 --- a/include/ico_syc_appresctl.h +++ b/include/ico_syc_appresctl.h @@ -37,7 +37,8 @@ struct ico_syc_res_context; */ typedef enum _resource_type { ICO_SYC_RES_BASIC = 0, - ICO_SYC_RES_INTERRUPT = 1 + ICO_SYC_RES_INTERRUPT = 1, + ICO_SYC_RES_ONSCREEN = 2 } ico_syc_res_type_e; /* diff --git a/include/ico_syc_msg_cmd_def.h b/include/ico_syc_msg_cmd_def.h index 7f2f87d..c735eee 100644 --- a/include/ico_syc_msg_cmd_def.h +++ b/include/ico_syc_msg_cmd_def.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2014, TOYOTA MOTOR CORPORATION. + * 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 @@ -68,6 +68,16 @@ extern "C" { #define MSG_PRMKEY_STRIDE (char *)"stride" #define MSG_PRMKEY_FORMAT (char *)"format" #define MSG_PRMKEY_RATE (char *)"framerate" + +#define MSG_PRMKEY_ECU (char *)"ECU" +#define MSG_PRMKEY_DISPLAY (char *)"display" +/* #define MSG_PRMKEY_LAYER (char *)"layer" */ +#define MSG_PRMKEY_LAYOUT (char *)"layout" +#define MSG_PRMKEY_AREA (char *)"area" +#define MSG_PRMKEY_DISPATCHAPP (char *)"dispatchApp" +#define MSG_PRMKEY_ROLE (char *)"role" +#define MSG_PRMKEY_RESOURCEID (char *)"resourceId" + /* user controller */ #define MSG_PRMKEY_USER (char *)"user" #define MSG_PRMKEY_PASSWD (char *)"password" @@ -150,6 +160,7 @@ extern "C" { #define MSG_CMD_DEPRIVE_RES 0x00040003 #define MSG_CMD_WAITING_RES 0x00040004 #define MSG_CMD_REVERT_RES 0x00040005 +#define MSG_CMD_WINDOW_ID_RES 0x00040006 /* input device setting */ #define MSG_CMD_SET_REGION 0x00050001 #define MSG_CMD_UNSET_REGION 0x00050002 diff --git a/include/ico_syc_sysdef.h b/include/ico_syc_sysdef.h index 5f2f650..0600ded 100644 --- a/include/ico_syc_sysdef.h +++ b/include/ico_syc_sysdef.h @@ -33,12 +33,14 @@ extern "C" { #define ICO_SYC_LAYER_APPLICATION 1 /* layer of Application */ #define ICO_SYC_LAYER_HOMESCREEN 2 /* layer of HomeScreen menu */ #define ICO_SYC_LAYER_CONTROLBAR 3 /* layer of Control/Status bar */ -#define ICO_SYC_LAYER_FULLSCREEN 4 /* layer of FullScreen Application */ -#define ICO_SYC_LAYER_ONSCREEN 5 /* layer of OnScreen */ +#define ICO_SYC_LAYER_INTERRUPTAPP 4 /* layer of Interrupt Application */ +#define ICO_SYC_LAYER_ONSCREEN 5 /* lay er of OnScreen */ #define ICO_SYC_LAYER_TOUCHPANEL 6 /* layer of TouchPanel input */ #define ICO_SYC_LAYER_CURSOR 7 /* layer of Cursor */ -#define ICO_SYC_LAYER_MATERAPP 3 /* layer of Meter application */ +#define ICO_SYC_LAYER_MATERMAIN 1001 /* layer of Meter Main display Application */ +#define ICO_SYC_LAYER_MATERSUB 1002 /* layer of Meter Sub display Application */ +#define ICO_SYC_LAYER_MATERSUBSUB 1003 /* layer of Meter Sub display SubApplication */ #ifdef __cplusplus } diff --git a/include/ico_syc_type.h b/include/ico_syc_type.h index a9fd14a..2f8db30 100644 --- a/include/ico_syc_type.h +++ b/include/ico_syc_type.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2014, TOYOTA MOTOR CORPORATION. + * 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 @@ -10,7 +10,7 @@ * @brief header file of System Controller * for privilege and general applications * - * @date Feb-21-2014 + * @date Aug-6-2013 */ #ifndef _ICO_SYC_TYPE_H_ @@ -53,11 +53,12 @@ typedef enum _event_id { ICO_SYC_EV_RES_WAITING = 13, /* waiting resource */ ICO_SYC_EV_RES_REVERT = 14, /* reverted resource */ ICO_SYC_EV_RES_RELEASE = 15, /* released resource */ - ICO_SYC_EV_INPUT_SET = 16, /* set input region */ - ICO_SYC_EV_INPUT_UNSET = 17, /* unset input region */ - ICO_SYC_EV_LASTINFO = 18, /* notify the last information */ - ICO_SYC_EV_STATE_CHANGE = 19, /* notify changed state */ - ICO_SYC_EV_WIN_NAME = 20 /* notify window name */ + ICO_SYC_EV_RES_WINDOW_ID = 16, /* notice window id resource */ + ICO_SYC_EV_INPUT_SET = 17, /* set input region */ + ICO_SYC_EV_INPUT_UNSET = 18, /* unset input region */ + ICO_SYC_EV_LASTINFO = 19, /* notify the last information */ + ICO_SYC_EV_STATE_CHANGE = 20, /* notify changed state */ + ICO_SYC_EV_WIN_NAME = 21 /* notify window name */ } ico_syc_ev_e; /* @@ -97,9 +98,9 @@ typedef enum _window_raise { * @ICO_SYC_WIN_VISIBLE_NOCHANGE: show/hide status is not change */ typedef enum _window_visible { - ICO_SYC_WIN_VISIBLE_SHOW = 1, - ICO_SYC_WIN_VISIBLE_HIDE = 0, - ICO_SYC_WIN_VISIBLE_NOCHANGE = 9 + ICO_SYC_WIN_VISIBLE_SHOW = 1, + ICO_SYC_WIN_VISIBLE_HIDE = 0, + ICO_SYC_WIN_VISIBLE_NOCHANGE = 9 } ico_syc_win_visible_e; /* @@ -255,9 +256,17 @@ 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 *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 */ + char *layout; /* name to identify Layout in Layer */ + char *area; /* name to Output position in Layout */ + char *dispatchApp; /* dispatch of application */ + char *role; /* role of notice */ + uint32_t resourceId;/* ID number of resource(surface id) */ } ico_syc_res_window_t; /* @@ -321,6 +330,7 @@ typedef struct _state_info { typedef void (*ico_syc_callback_t) (const ico_syc_ev_e event, const void *detail, void *user_data); + #ifdef __cplusplus } #endif diff --git a/lib/apps-framework/ico_syc_appresctl.c b/lib/apps-framework/ico_syc_appresctl.c index 9b6f77e..7fcf933 100644 --- a/lib/apps-framework/ico_syc_appresctl.c +++ b/lib/apps-framework/ico_syc_appresctl.c @@ -26,8 +26,14 @@ /*============================================================================*/ /* define static function prototype */ /*============================================================================*/ -static ico_syc_res_window_t *_create_res_window(char *zone, - char *name, char *id); +static ico_syc_res_window_t *_create_res_window(const char *ECU, + const char *display, + const char *layer, + const char *layout, + const char *area, + const char *dispatchApp, + const char *role, + uint32_t resourceId); static ico_syc_res_sound_t *_create_res_sound(char *zone, char *name, char *id, int adjust); static ico_syc_res_input_t *_create_res_input(char *name, int event); @@ -69,11 +75,16 @@ static msg_t _create_unset_region_msg(const char *appid, */ /*--------------------------------------------------------------------------*/ static ico_syc_res_window_t * -_create_res_window(char *zone, char *name, char *id) + _create_res_window(const char *ECU, const char *display, const char *layer, + const char *layout, const char *area, + const char *dispatchApp, const char *role, + uint32_t resourceId) { ico_syc_res_window_t *info = NULL; - if (zone == NULL || name == NULL) { + if ((NULL == ECU) || (NULL == display) || (NULL == layer) || + (NULL == layout) || (NULL == area) || (NULL == dispatchApp) || + (NULL == role)) { _ERR("invalid parameter (zone, name is NULL)"); return NULL; } @@ -86,11 +97,14 @@ _create_res_window(char *zone, char *name, char *id) } /* set element */ - info->zone = strdup(zone); - info->name = strdup(name); - if (id != NULL) { - info->id = strdup(id); - } + info->ECU = strdup(ECU); + info->display = strdup(display); + info->layer = strdup(layer); + info->layout = strdup(layout); + info->area = strdup(area); + info->dispatchApp = strdup(dispatchApp); + info->role = strdup(role); + info->resourceId = resourceId; return info; } @@ -183,18 +197,22 @@ _create_res_input(char *name, int event) */ /*--------------------------------------------------------------------------*/ static void -_free_res_window(ico_syc_res_window_t *window) +_free_res_window(ico_syc_res_window_t *w) { - if (window == NULL) { + if (w == NULL) { return; } /* free element */ - if (window->zone != NULL) free(window->zone); - if (window->name != NULL) free(window->name); - if (window->id != NULL) free(window->id); + 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 */ - free(window); + free(w); return; } @@ -266,7 +284,7 @@ _free_res_input(ico_syc_res_input_t *input) */ /*--------------------------------------------------------------------------*/ static struct ico_syc_res_context * -_create_context(char *appid, const ico_syc_res_window_t *window, +_create_context(char *appid, const ico_syc_res_window_t *w, const ico_syc_res_sound_t *sound, const ico_syc_res_input_t *input, int type) @@ -284,9 +302,11 @@ _create_context(char *appid, const ico_syc_res_window_t *window, strcpy(context->appid, appid); /* set window info */ - if (window != NULL) { - context->window = _create_res_window(window->zone, window->name, - window->id); + if (w != NULL) { + context->window = _create_res_window(w->ECU, w->display, w->layer, + w->layout, w->area, + w->dispatchApp, w->role, + w->resourceId); } /* set sound info */ if (sound != NULL) { @@ -299,7 +319,7 @@ _create_context(char *appid, const ico_syc_res_window_t *window, } /* set resource type */ - if (window != NULL || sound != NULL) { + if (w != NULL || sound != NULL) { context->type = type; } @@ -318,11 +338,11 @@ _create_context(char *appid, const ico_syc_res_window_t *window, */ /*--------------------------------------------------------------------------*/ static JsonObject * -_create_window_msg(ico_syc_res_window_t *window) +_create_window_msg(ico_syc_res_window_t *w) { JsonObject *info = NULL; - if (window == NULL) { + if (w == NULL) { _ERR("invalid parameter (window is NULL)"); return NULL; } @@ -335,9 +355,14 @@ _create_window_msg(ico_syc_res_window_t *window) } /* set member */ - json_object_set_string_member(info, MSG_PRMKEY_RES_ZONE, window->zone); - json_object_set_string_member(info, MSG_PRMKEY_RES_NAME, window->name); - json_object_set_string_member(info, MSG_PRMKEY_RES_ID, window->id); + json_object_set_string_member(info, MSG_PRMKEY_ECU, w->ECU); + json_object_set_string_member(info, MSG_PRMKEY_DISPLAY, w->display); + json_object_set_string_member(info, MSG_PRMKEY_LAYER, w->layer); + json_object_set_string_member(info, MSG_PRMKEY_LAYOUT, w->layout); + json_object_set_string_member(info, MSG_PRMKEY_AREA, w->area); + json_object_set_string_member(info, MSG_PRMKEY_DISPATCHAPP, w->dispatchApp); + json_object_set_string_member(info, MSG_PRMKEY_ROLE, w->role); + json_object_set_int_member(info, MSG_PRMKEY_RESOURCEID, w->resourceId); return info; } @@ -714,6 +739,9 @@ ico_syc_cb_res(ico_syc_callback_t callback, void *user_data, ico_syc_res_info_t *res_info = NULL; char *zone, *name, *id; int adjust, input_ev; + char *ECU, *display, *layer, *layout, *area, *dispatchApp, *role; + uint32_t resourceId; + /* alloc memory */ res_info = calloc(1, sizeof(ico_syc_res_info_t)); @@ -753,11 +781,18 @@ ico_syc_cb_res(ico_syc_callback_t callback, void *user_data, /* window resource */ if (json_object_has_member(resobj, MSG_PRMKEY_RES_WINDOW) == TRUE) { info = json_object_get_object_member(resobj, MSG_PRMKEY_RES_WINDOW); - zone = ico_syc_get_str_member(info, MSG_PRMKEY_RES_ZONE); - name = ico_syc_get_str_member(info, MSG_PRMKEY_RES_NAME); - id = ico_syc_get_str_member(info, MSG_PRMKEY_RES_ID); - - res_info->window = _create_res_window(zone, name, id); + ECU = ico_syc_get_str_member(info, MSG_PRMKEY_ECU); + display = ico_syc_get_str_member(info, MSG_PRMKEY_DISPLAY); + layer = ico_syc_get_str_member(info, MSG_PRMKEY_LAYER); + layout = ico_syc_get_str_member(info, MSG_PRMKEY_LAYOUT); + area = ico_syc_get_str_member(info, MSG_PRMKEY_AREA); + dispatchApp = ico_syc_get_str_member(info, MSG_PRMKEY_DISPATCHAPP); + role = ico_syc_get_str_member(info, MSG_PRMKEY_ROLE); + resourceId = (uint32_t) + ico_syc_get_int_member(info, MSG_PRMKEY_RESOURCEID); + res_info->window = _create_res_window(ECU, display, layer, layout, + area, dispatchApp, role, + resourceId); } /* sound resource */ diff --git a/lib/apps-framework/ico_syc_common.c b/lib/apps-framework/ico_syc_common.c index 5aa16eb..618b520 100644 --- a/lib/apps-framework/ico_syc_common.c +++ b/lib/apps-framework/ico_syc_common.c @@ -290,6 +290,9 @@ static int _get_event_from_cmd(int command) case MSG_CMD_RELEASE_RES: event = ICO_SYC_EV_RES_RELEASE; break; + case MSG_CMD_WINDOW_ID_RES: + event = ICO_SYC_EV_RES_WINDOW_ID; + break; case MSG_CMD_SET_REGION: event = ICO_SYC_EV_INPUT_SET; break; @@ -379,6 +382,7 @@ _exec_callback(void *user_data) case ICO_SYC_EV_RES_WAITING: case ICO_SYC_EV_RES_REVERT: case ICO_SYC_EV_RES_RELEASE: + case ICO_SYC_EV_RES_WINDOW_ID: ico_syc_cb_res(syc_callback, user_data, event, recv_data->data, recv_data->len); break; @@ -744,7 +748,8 @@ ico_syc_service(void) * ICO_SYC_EV_RES_DEPRIVE * ICO_SYC_EV_RES_WAITING * ICO_SYC_EV_RES_REVERT - * ICO_SYC_EV_RES_RELEASE) + * ICO_SYC_EV_RES_RELEASE + * ICO_SYC_EV_RES_WINDOW_ID) * * @param[in] callback callback function * @param[in] user_data pased data on called callback function diff --git a/lib/common/CicoConf.h b/lib/common/CicoConf.h index c947523..36c6821 100644 --- a/lib/common/CicoConf.h +++ b/lib/common/CicoConf.h @@ -87,6 +87,11 @@ typedef enum _privilege { #define ICO_SYC_CONFIG_APPATTR "app_attr.conf" //TODO +#define ICO_SYC_ROLE_CONF_DEF -1 +#define ICO_SYC_ROLE_CONF_DEF_STR "DEFAULT" +#define ICO_SYC_ROLE_CONF_RST 14999 +#define ICO_SYC_ROLE_CONF_RST_STR "RESET" + //========================================================================== /** * @brief This class holds display information of system config @@ -126,7 +131,8 @@ class CicoSCLayerConf public: /// default constructor CicoSCLayerConf() - : id(-1), name(""), type(-1), menuoverlap(false) {} + : id(-1), name(""), type(-1), menuoverlap(false), + layout_id(-1), layout_name(""), area_id(-1), area_name("") {} /// destructor virtual ~CicoSCLayerConf() {} @@ -134,8 +140,15 @@ public: /// dump log this class member variables void dumpConf(void) { - ICO_DBG(" layer: id=%d name=%s type=%d menuoverlap=%s", - id, name.c_str(), type, menuoverlap ? "true" : "false"); + if(-1 != layout_id) { + ICO_DBG(" layer: %d, \"%s\" type=%d menuoverlap=%s layout: %d, \"%s\" area: %d, \"%s\"", + id, name.c_str(), type, menuoverlap ? "true" : "false", + layout_id, layout_name.c_str(), area_id, area_name.c_str()); + } + else{ + ICO_DBG(" layer: %d, \"%s\" type=%d menuoverlap=%s", + id, name.c_str(), type, menuoverlap ? "true" : "false"); + } } public: @@ -143,6 +156,10 @@ public: std::string name; ///< layer name int type; ///< layer type bool menuoverlap; ///< menu overlap flag + int layout_id; ///< layoyt id + std::string layout_name; ///< layout name + int area_id; ///< area id + std::string area_name; ///< area name }; //========================================================================== @@ -694,5 +711,62 @@ public: std::map properties; }; +//========================================================================== +/** + * @brief This class Role of system config + */ +//========================================================================== +class CicoSCRoleConf +{ +public: + /// constructor + CicoSCRoleConf() + : m_def(ICO_SYC_ROLE_CONF_DEF), m_rst(ICO_SYC_ROLE_CONF_RST) {} + /// destructor + virtual ~CicoSCRoleConf() {} + /// dump log this class member variables + void dumpConf(void) + { + ICO_DBG("Role info: default=%d, reset=%d, size=%d", + (int)m_def, (int)m_rst, (int)m_stt.size()); + std::map::iterator itr; + itr = m_stt.begin(); + for(; itr != m_stt.end(); ++itr) { + ICO_DBG(" key=\"%s\", stt=%d", itr->first.c_str(), + (int)itr->second); + } + } + + +public: + short m_def; + short m_rst; + std::map m_stt; +}; + +//========================================================================== +/** + * @brief This class position onscreen window x,y + */ +//========================================================================== +class CicoSCPositionOSConf +{ +public: + /// constructor + CicoSCPositionOSConf() + : m_x(0), m_y(0), m_w(1080), m_h(1920) {} + /// destructor + virtual ~CicoSCPositionOSConf() {} + /// dump log this class member variables + void dumpConf(void) + { + ICO_DBG("OnScreen Window position : x:%d, y:%d, w:%d, h:%d", m_x, m_y, m_w, m_h); + } +public: + int m_x; + int m_y; + int m_w; + int m_h; +}; #endif // __CICO_CONF_H__ // vim:set expandtab ts=4 sw=4: diff --git a/lib/common/CicoSystemConfig.cpp b/lib/common/CicoSystemConfig.cpp index c57350b..460c91b 100644 --- a/lib/common/CicoSystemConfig.cpp +++ b/lib/common/CicoSystemConfig.cpp @@ -7,13 +7,13 @@ * */ -/*========================================================================*/ +/*========================================================================*/ /** * @file CicoSystemConfig.cpp * * @brief This file implementation of CicoSystemConfig class */ -/*========================================================================*/ +/*========================================================================*/ #include #include @@ -25,9 +25,9 @@ #include "CicoConf.h" using namespace boost::property_tree; -//========================================================================== +//========================================================================== // private static variable -//========================================================================== +//========================================================================== CicoSystemConfig* CicoSystemConfig::ms_myInstance = NULL; //-------------------------------------------------------------------------- @@ -55,7 +55,7 @@ CicoSystemConfig::CicoSystemConfig() m_displayTypeTable["rearleft"] = ICO_DISPLAYTYPE_REARLEFT; m_displayTypeTable["rearright"] = ICO_DISPLAYTYPE_REARRIGHT; - // + // m_categoryTalbe[""] = ICO_POLICY_ALWAYS; m_categoryTalbe["always"] = ICO_POLICY_ALWAYS; m_categoryTalbe["run"] = ICO_POLICY_RUNNING; @@ -131,6 +131,8 @@ CicoSystemConfig::load(const string & confFile) createResourceConf(root); createUserConf(root); createVehicleInfoConf(root); + createRoleConf(root); + createPositionOSConf(root); } catch (...) { ICO_ERR("catch exception!"); @@ -141,7 +143,7 @@ CicoSystemConfig::load(const string & confFile) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -154,7 +156,7 @@ CicoSystemConfig::getNodeConfList(void) const //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -167,7 +169,7 @@ CicoSystemConfig::getDisplayConfList(void) const //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -180,7 +182,7 @@ CicoSystemConfig::getSoundConfList(void) const //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -193,7 +195,7 @@ CicoSystemConfig::getInputDevConfList(void) const //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -206,7 +208,7 @@ CicoSystemConfig::getCategoryConfList(void) const //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -219,7 +221,7 @@ CicoSystemConfig::getAppKindConfList(void) const //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -277,7 +279,7 @@ CicoSystemConfig::createNodeConfList(const ptree & root) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -357,7 +359,98 @@ CicoSystemConfig::createDisplayConfList(const ptree & root) //-------------------------------------------------------------------------- /** - * @brief + * @brief + * + * @param [in] + */ +//-------------------------------------------------------------------------- +void +CicoSystemConfig::createLayoutConfContainedArea( + const ptree::value_type& layout, + const optional& layer_id, const optional& layer_name, + const optional& layout_id, const optional& layout_name, + CicoSCDisplayConf* displayConf) +{ + ptree areas = layout.second.get_child("areas"); + BOOST_FOREACH (const ptree::value_type& area, areas) { + optional id = optional(-1); + optional name; + optional type = optional(-1); + optional overlap = optional(false); + + id = area.second.get_optional(".id"); + if (false == id.is_initialized()) { + ICO_ERR("disply.layer.layout.area.id attr not found"); + continue; + } + name = area.second.get_optional(".name"); + if (false == name.is_initialized()) { + ICO_ERR("disply.layer.layout.area.name attr not found"); + continue; + } + type = area.second.get_optional("type"); + if (false == type.is_initialized()) { + ICO_ERR("disply.layer.layout.area.type element not found"); + continue; + } + overlap = area.second.get_optional("menuoverlap"); + if (false == overlap.is_initialized()) { + ICO_ERR("disply.layer.layout.area.overlap element not found"); + continue; + } + + CicoSCLayerConf* layerConf = new CicoSCLayerConf(); + layerConf->id = layer_id.get(); + layerConf->name = layer_name.get(); + layerConf->type = type.get(); + layerConf->menuoverlap = overlap.get(); + layerConf->layout_id = layout_id.get(); + layerConf->layout_name = layout_name.get(); + layerConf->area_id = id.get(); + layerConf->area_name = name.get(); + + displayConf->layerConfList.push_back(layerConf); + + layerConf->dumpConf(); + } +} + +//-------------------------------------------------------------------------- +/** + * @brief + * + * @param [in] + */ +//-------------------------------------------------------------------------- +void +CicoSystemConfig::createLayerConfContainedLayout( + const ptree::value_type& layer, + const optional& layer_id, const optional& layer_name, + CicoSCDisplayConf* displayConf) +{ + ptree layouts = layer.second.get_child("layouts"); + BOOST_FOREACH (const ptree::value_type& layout, layouts) { + optional id = optional(-1); + optional name; + + id = layout.second.get_optional(".id"); + if (false == id.is_initialized()) { + ICO_ERR("disply.layer.layout.id attr not found"); + continue; + } + name = layer.second.get_optional(".name"); + if (false == name.is_initialized()) { + ICO_ERR("disply.layer.layout.name attr not found"); + continue; + } + createLayoutConfContainedArea(layout, layer_id, layer_name, id, name, + displayConf); + } +} + +//-------------------------------------------------------------------------- +/** + * @brief * * @param [in] */ @@ -385,7 +478,8 @@ CicoSystemConfig::createLayerConf(const ptree::value_type & child, } type = layer.second.get_optional("type"); if (false == type.is_initialized()) { - ICO_ERR("disply.layer.type element not found"); +// ICO_ERR("disply.layer.type element not found"); + createLayerConfContainedLayout(layer, id, name, displayConf); continue; } overlap = layer.second.get_optional("menuoverlap"); @@ -408,7 +502,7 @@ CicoSystemConfig::createLayerConf(const ptree::value_type & child, //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -503,7 +597,7 @@ CicoSystemConfig::createDisplayZoneConf(const ptree::value_type & child, //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -548,7 +642,7 @@ CicoSystemConfig::createSoundConfList(const ptree & root) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -586,7 +680,7 @@ CicoSystemConfig::createSoundZoneConf(const ptree::value_type & child, //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -625,7 +719,7 @@ CicoSystemConfig::createPortConf(const ptree & root) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -644,7 +738,7 @@ CicoSystemConfig::createCategoryConf(const ptree & root) optional input; optional priority = optional(-1); optional r_ctrl = optional(-1); - + id = child.second.get_optional(".id"); if (false == id.is_initialized()) { continue; @@ -694,7 +788,7 @@ CicoSystemConfig::createCategoryConf(const ptree & root) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -742,7 +836,7 @@ CicoSystemConfig::createAppKindConf(const ptree & root) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -765,7 +859,7 @@ CicoSystemConfig::createInputDevList(const ptree & root) if (false == name.is_initialized()) { continue; } - + CicoSCInputDevConf* inputDevConf = new CicoSCInputDevConf(); inputDevConf->id = id.get(); inputDevConf->name = name.get(); @@ -778,7 +872,7 @@ CicoSystemConfig::createInputDevList(const ptree & root) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -819,7 +913,7 @@ CicoSystemConfig::createSwitchList(const ptree::value_type & child, //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -916,7 +1010,7 @@ CicoSystemConfig::createDefaultConf(const ptree & root) topdir = ICO_SYC_TOP_DIR; } m_defaultConf->topdir = topdir; - + //TODO #define ICO_SYC_CONFIG_ENV (char*)"SYSCON_CONFDIR" #define ICO_SYC_CONFIG_DIR (char*)"res/config" @@ -1189,7 +1283,7 @@ CicoSystemConfig::createUserConf(const ptree & root) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1277,7 +1371,7 @@ CicoSystemConfig::calcGeometryExpr(const string & expr, //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1299,7 +1393,7 @@ CicoSystemConfig::findNodeConfbyName(const string & name) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1322,7 +1416,31 @@ CicoSystemConfig::findDisplayConfbyName(const string & name) //-------------------------------------------------------------------------- /** - * @brief + * @brief + * + * @param [in] + */ +//-------------------------------------------------------------------------- +const CicoSCDisplayConf* +CicoSystemConfig::findDisplayConfbyName(const string& ECU, const string& name) +{ + int nodeId = getNodeIdbyName(ECU); + vector::iterator itr; + itr = m_displayConfList.begin(); + for (; itr != m_displayConfList.end(); ++itr) { + const CicoSCDisplayConf* conf = NULL; + conf = const_cast(*itr); + if ((name == conf->name)&&(nodeId == conf->node)) { + return conf; + } + } + + return NULL; +} + +//-------------------------------------------------------------------------- +/** + * @brief * * @param [in] */ @@ -1344,7 +1462,7 @@ CicoSystemConfig::findDisplayConfbyId(int id) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1364,7 +1482,42 @@ CicoSystemConfig::findLayerConfbyName(const string & displayName, for (; itr != displayConf->layerConfList.end(); ++itr) { const CicoSCLayerConf* conf = NULL; conf = const_cast(*itr); - if (layerName == conf->name) { +// if (layerName == conf->name) { + if ((layerName == conf->name) && (-1 == conf->layout_id)) { + return conf; + } + } + + return NULL; +} + +//-------------------------------------------------------------------------- +/** + * @brief + * + * @param [in] + */ +//-------------------------------------------------------------------------- +const CicoSCLayerConf* +CicoSystemConfig::findLayerConfbyName(const string& ECU, + const string& display, + const string& layer, + const string& layout, + const string& area) +{ + const CicoSCDisplayConf* displayConf = NULL; + displayConf = findDisplayConfbyName(ECU, display); + if (NULL == displayConf) { + return NULL; + } + + vector::const_iterator itr; + itr = displayConf->layerConfList.begin(); + for (; itr != displayConf->layerConfList.end(); ++itr) { + const CicoSCLayerConf* conf = NULL; + conf = const_cast(*itr); + if ((layer == conf->name)&&(layout == conf->layout_name)&& + (area == conf->area_name)) { return conf; } } @@ -1374,7 +1527,7 @@ CicoSystemConfig::findLayerConfbyName(const string & displayName, //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1393,17 +1546,17 @@ CicoSystemConfig::findLayerConfbyIdx(int displayid, int idx) for (; itr != displayConf->layerConfList.end(); ++itr) { const CicoSCLayerConf* conf = NULL; conf = const_cast(*itr); - if (idx <= 0) { + if (idx <= 0) { return conf; } - idx --; + idx --; } return NULL; } //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1441,7 +1594,7 @@ CicoSystemConfig::findDisplayZoneConfbyName(const string & displayName, //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1464,7 +1617,7 @@ CicoSystemConfig::findSoundConfbyName(const string & name) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1498,7 +1651,7 @@ CicoSystemConfig::findSoundZoneConfbyName(const string & soundName, //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1521,7 +1674,7 @@ CicoSystemConfig::findInputDevConfbyName(const string & name) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1554,7 +1707,7 @@ CicoSystemConfig::findSwitchConfbyName(const string & inputDevName, //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1577,7 +1730,7 @@ CicoSystemConfig::findAppKindConfbyName(const string & name) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1602,7 +1755,7 @@ CicoSystemConfig::findDisplayZoneConfbyId(int id) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1627,7 +1780,7 @@ CicoSystemConfig::findSoundZoneConfbyId(int id) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1651,7 +1804,7 @@ CicoSystemConfig::findCategoryConfbyName(const string & name) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1674,7 +1827,7 @@ CicoSystemConfig::findCategoryConfbyId(int id) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1695,7 +1848,7 @@ CicoSystemConfig::findAppKindConfbyId(int id) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1708,7 +1861,7 @@ CicoSystemConfig::getDefaultConf(void) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1727,7 +1880,7 @@ CicoSystemConfig::getNodeIdbyName(const string & name) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1746,7 +1899,7 @@ CicoSystemConfig::getDisplayIdbyName(const string & name) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1768,43 +1921,40 @@ CicoSystemConfig::getDisplayIdbyNo(int no) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ //-------------------------------------------------------------------------- -void -CicoSystemConfig::setDisplaySize(int id, int width, int height) +int +CicoSystemConfig::getLayerIdfbyName(const string & displayName, + const string & layerName) { - vector::iterator itr; - itr = m_displayConfList.begin(); - for (; itr != m_displayConfList.end(); ++itr) { - CicoSCDisplayConf* conf = NULL; - conf = const_cast(*itr); - if (id == conf->id) { - ICO_TRA("CicoSystemConfig::setDisplaySize(%d,%d,%d) change size from %d,%d", - id, width, height, conf->width, conf->height); - conf->width = width; - conf->height = height; - return; - } + const CicoSCLayerConf* conf = NULL; + conf = findLayerConfbyName(displayName, layerName); + if (NULL == conf) { + return -1; } - ICO_ERR("CicoSystemConfig::setDisplaySize(%d,%d,%d) Error", id, width, height); + + return conf->id; } //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ //-------------------------------------------------------------------------- int -CicoSystemConfig::getLayerIdfbyName(const string & displayName, - const string & layerName) +CicoSystemConfig::getLayerIdfbyName(const string& ECU, + const string& display, + const string& layer, + const string& layout, + const string& area) { const CicoSCLayerConf* conf = NULL; - conf = findLayerConfbyName(displayName, layerName); + conf = findLayerConfbyName(ECU, display, layer, layout, area); if (NULL == conf) { return -1; } @@ -1814,7 +1964,7 @@ CicoSystemConfig::getLayerIdfbyName(const string & displayName, //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1834,7 +1984,7 @@ CicoSystemConfig::getDizplayZoneIdbyName(const string & displayName, //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1860,7 +2010,7 @@ CicoSystemConfig::getDizplayZoneIdbyFullName(const string & zoneFullName) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1879,7 +2029,7 @@ CicoSystemConfig::getSoundIdbyName(const string & name) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1899,7 +2049,7 @@ CicoSystemConfig::getSoundZoneIdbyName(const string & soundName, //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1925,7 +2075,7 @@ CicoSystemConfig::getSoundZoneIdbyFullName(const string & zoneFullName) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1944,7 +2094,7 @@ CicoSystemConfig::getInputDevIdbyName(const string & name) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1964,7 +2114,7 @@ CicoSystemConfig::getSwitchIdbyName(const string & inputDevName, //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -1983,7 +2133,7 @@ CicoSystemConfig::getAppKindIdbyName(const string & name) //-------------------------------------------------------------------------- /** - * @brief + * @brief * * @param [in] */ @@ -2054,4 +2204,125 @@ void getArray(ptree& t, vector& vec) vec.push_back(value); } } + +//-------------------------------------------------------------------------- +/** + * @brief get state number from id key + * + * @param [in] + */ +//-------------------------------------------------------------------------- +short CicoSystemConfig::getRoleStt(const string& key) +{ + if ((CicoSCRoleConf*)NULL == m_roleConf) { + return ICO_SYC_ROLE_CONF_DEF; + } + short r; + map::iterator p; + p = m_roleConf->m_stt.find(key); + if (p == m_roleConf->m_stt.end()) { + r = m_roleConf->m_def; + } + else { + r = p->second; + } + return r; +} + +//-------------------------------------------------------------------------- +/** + * @brief array xml tree to vector + * + * @param [in] + */ +//-------------------------------------------------------------------------- +void CicoSystemConfig::createRoleConf(const ptree& root) +{ + m_roleConf = new CicoSCRoleConf(); + + ptree roles = root.get_child("systemconfig.on_screen_roles"); + BOOST_FOREACH (const ptree::value_type& role, roles) { + optional id; + optional stt; + id = role.second.get_optional(".id"); + if (false == id.is_initialized()) { + continue; + } + stt = role.second.get_optional(".state"); + if (false == stt.is_initialized()) { + continue; + } + string v_key = id.get(); + int v_stt = stt.get(); + if (0 == v_key.compare(ICO_SYC_ROLE_CONF_DEF_STR)) { // default define + m_roleConf->m_def = (short)v_stt; + } + else if (0 == v_key.compare(ICO_SYC_ROLE_CONF_RST_STR)) { // reset event number + m_roleConf->m_rst = (short)v_stt; + } + else { + m_roleConf->m_stt.insert(pair(v_key, (short)v_stt)); + } + } + m_roleConf->dumpConf(); +} + +//-------------------------------------------------------------------------- +/** + * @brief position OnScreen Config + * + * @param [in] + */ +//-------------------------------------------------------------------------- +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; + } + + 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; + } + + 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; + } + + try { + optional opts = posc.get_optional("h"); + if (true == opts.is_initialized()) { + m_positionOSConf->m_h = atoi(opts.get().c_str()); + } + } + catch (...) { + ICO_WRN("NG h"); + m_positionOSConf->m_h = 1920; + } + m_positionOSConf->dumpConf(); +} + // vim:set expandtab ts=4 sw=4: diff --git a/lib/common/CicoSystemConfig.h b/lib/common/CicoSystemConfig.h index e5a3847..892358a 100644 --- a/lib/common/CicoSystemConfig.h +++ b/lib/common/CicoSystemConfig.h @@ -28,7 +28,7 @@ using namespace std; using namespace boost; using namespace boost::property_tree; - + //========================================================================== // Forward declaration //========================================================================== @@ -47,6 +47,8 @@ class CicoSCDefaultConf; class CicoSCResourceConf; class CicoSCUserConf; class CicoSCVehicleInfoConf; +class CicoSCRoleConf; +class CicoSCPositionOSConf; #endif //========================================================================== @@ -54,7 +56,7 @@ class CicoSCVehicleInfoConf; * @brief This class has function of access to system config information */ //========================================================================== -class CicoSystemConfig +class CicoSystemConfig { public: static CicoSystemConfig* getInstance(void); @@ -70,10 +72,19 @@ public: const CicoSCNodeConf* findNodeConfbyName(const string & name); const CicoSCDisplayConf* findDisplayConfbyName(const string & name); + const CicoSCDisplayConf* findDisplayConfbyName(const string& ECU, + const string& name); const CicoSCDisplayConf* findDisplayConfbyId(int id); + const CicoSCLayerConf* findLayerConfbyName(const string & displayName, const string & layerName); - const CicoSCLayerConf* findLayerConfbyIdx(int displayid, int idx); + const CicoSCLayerConf* findLayerConfbyName(const string& ECU, + const string& display, + const string& layer, + const string& layout, + const string& area); + const CicoSCLayerConf* findLayerConfbyIdx(int displayid, int idx); + const CicoSCDisplayZoneConf* findDisplayZoneConfbyName(const string & displayName, const string & zoneName); const CicoSCSoundConf* findSoundConfbyName(const string & name); @@ -94,11 +105,16 @@ public: const CicoSCDefaultConf* getDefaultConf(void); - int getNodeIdbyName(const string & name); int getDisplayIdbyName(const string & name); + int getDisplayIdbyNo(int no); int getLayerIdfbyName(const string & displayName, const string & layerName); + int getLayerIdfbyName(const string& ECU, + const string& display, + const string& layer, + const string& layout, + const string& area); int getDizplayZoneIdbyName(const string & displayName, const string & zoneName); int getDizplayZoneIdbyFullName(const string & zoneFullName); @@ -112,22 +128,27 @@ public: const string & switchName); int getAppKindIdbyName(const string & name); int getCategoryIdbyName(const string & name); - int getDisplayIdbyNo(int no); - void setDisplaySize(int id, int width, int height); - const CicoSCResourceConf* getResourceConf() const { return m_resourceConf; }; const CicoSCCategoryConf* getCategoryObjbyCaategoryID(int id); - const CicoSCUserConf* getUserConf() const + const CicoSCUserConf* getUserConf() const { return m_userConf; }; CicoSCVehicleInfoConf* getVehicleInfoConf(void); - + short getRoleStt(const string& key); + const CicoSCRoleConf* getRoleConf() const + { + return m_roleConf; + }; + const CicoSCPositionOSConf* positionOSConf() const + { + return m_positionOSConf; + }; private: // default constructor CicoSystemConfig(); @@ -143,6 +164,16 @@ private: void createNodeConfList(const ptree & root); void createDisplayConfList(const ptree & root); + void createLayoutConfContainedArea(const ptree::value_type& layout, + const optional& layer_id, + const optional& layer_name, + const optional& layout_id, + const optional& layout_name, + CicoSCDisplayConf* displayConf); + void createLayerConfContainedLayout(const ptree::value_type& layer, + const optional& layer_id, + const optional& layer_name, + CicoSCDisplayConf* displayConf); void createLayerConf(const ptree::value_type & child, CicoSCDisplayConf* displayConf); void createDisplayZoneConf(const ptree::value_type & child, @@ -163,6 +194,8 @@ private: void createVehicleInfoConf(const ptree & root); int calcGeometryExpr(const string & expr, CicoSCDisplayConf* conf); + void createRoleConf(const ptree& root); + void createPositionOSConf(const ptree& root); private: static CicoSystemConfig* ms_myInstance; @@ -183,6 +216,8 @@ private: CicoSCResourceConf *m_resourceConf; CicoSCUserConf *m_userConf; CicoSCVehicleInfoConf *m_vehicleInfoConf; + CicoSCRoleConf *m_roleConf; + CicoSCPositionOSConf *m_positionOSConf; }; #endif // __CICO_SYSTEM_CONFIG_H__ // vim:set expandtab ts=4 sw=4: diff --git a/lib/system-controller/CicoSCCommand.cpp b/lib/system-controller/CicoSCCommand.cpp index 40d9524..7191cad 100644 --- a/lib/system-controller/CicoSCCommand.cpp +++ b/lib/system-controller/CicoSCCommand.cpp @@ -30,6 +30,7 @@ using namespace boost::property_tree; #include "CicoLog.h" #include "ico_syc_error.h" #include "ico_syc_msg_cmd_def.h" +#include "ico_syc_mrp_resource_private.h" //-------------------------------------------------------------------------- /** @@ -360,6 +361,14 @@ CicoSCCommand::parseUserMgrOpt(const ptree & root) * "zone": (string) window zone, * "name": (string) window's surface name, * "id": (string) window id + * "ECU": + * "display": + * "layer": + * "layout": + * "area": + * "dispatchApp": + * "role": + * "resourceId": * }, * "sound": { * "zone": (string) sound zone, @@ -388,6 +397,31 @@ CicoSCCommand::parseResCtrlOpt(const ptree & root) options->dispzone = getStrValue(root, "res.window.zone"); options->winname = getStrValue(root, "res.window.name"); options->surfaceid = getIntValue(root, "res.window.id"); + bool bEx = true; + options->ECU = getStrValue(root, "res.window.ECU"); + if (true == options->ECU.empty()) { + bEx = false; + } + options->display = getStrValue(root, "res.window.display"); + if (true == options->display.empty()) { + bEx = false; + } + options->layer = getStrValue(root, "res.window.layer"); + if (true == options->layer.empty()) { + bEx = false; + } + options->layout = getStrValue(root, "res.window.layout"); + if (true == options->layout.empty()) { + bEx = false; + } + options->area = getStrValue(root, "res.window.area"); + if (true == options->area.empty()) { + bEx = false; + } + options->dispatchApp= getStrValue(root, "res.window.dispatchApp"); + options->role = getStrValue(root, "res.window.role"); + options->resourceID= getIntValue(root, "res.window.resourceId"); + options->dispresEx = bEx; } if (true == isExistObject(root, "res.sound")) { @@ -404,7 +438,7 @@ CicoSCCommand::parseResCtrlOpt(const ptree & root) options->input = getIntValue(root, "res.input.event"); } - options->type = getIntValue(root, "type"); + options->type = getIntValue(root, "res.type"); } //-------------------------------------------------------------------------- diff --git a/lib/system-controller/CicoSCCommand.h b/lib/system-controller/CicoSCCommand.h index 719143e..f504f91 100644 --- a/lib/system-controller/CicoSCCommand.h +++ b/lib/system-controller/CicoSCCommand.h @@ -170,6 +170,8 @@ public: CicoSCCmdResCtrlOpt() : dispres(false), dispzone(""), layerid(-1), winname(""), surfaceid(-1), animation(""), animationTime(0), + ECU(""), display(""), layer(""), layout(""), area(""), dispatchApp(""), + role(""), resourceID(-1), soundres(false), soundzone(""), soundname(""), adjust(0), inputres(false), device(""), input(0), type(0) {} @@ -190,6 +192,12 @@ public: soundzone.c_str(), soundname.c_str(), soundid, adjust, inputres ? "true" : "false", device.c_str(), input, type); + ICO_DBG("ResCtrlOptEx: " + "dispresEx=%s ECU=%s display=%s layer=%s layout=%s area=%s " + "dispatchApp=%s role=%s resourceID=%d", + dispresEx? "true": "false", ECU.c_str(), display.c_str(), + layer.c_str(), layout.c_str(), area.c_str(), dispatchApp.c_str(), + role.c_str(), resourceID); } bool dispres; //!< flag of display resource @@ -199,6 +207,15 @@ public: int surfaceid; //!< id of surface std::string animation; //!< name of animation int animationTime; //!< time of animation[ms] + bool dispresEx; //!< Expansion flag + std::string ECU; //!< name to identify ECU + std::string display; //!< name to identify Display in ECU + std::string layer; //!< name to identify Layer in Display + std::string layout; //!< name to identify Layout in Layer + std::string area; //!< name to Output position in Layout + std::string dispatchApp; //!< dispatch of application + std::string role; //!< role of notice + int resourceID; //!< ID number of resource bool soundres; //!< flag of sound resource std::string soundzone; //!< name of sound zone diff --git a/lib/system-controller/CicoSCLayer.cpp b/lib/system-controller/CicoSCLayer.cpp index bf2d38b..95b5ffe 100644 --- a/lib/system-controller/CicoSCLayer.cpp +++ b/lib/system-controller/CicoSCLayer.cpp @@ -61,7 +61,7 @@ CicoSCLayer::addSurface(int surfaceid, bool top) { int idx, idx2; int *wksurfaceids; - ICO_DBG("CicoSCLayer::addSurface(%d,%d)", surfaceid, top); + ICO_DBG("CicoSCLayer::addSurface(%08x,%d)", surfaceid, top); idx2 = 0; for (idx = 0; idx < numsurfaces; idx++, idx2++) { @@ -108,7 +108,7 @@ void CicoSCLayer::removeSurface(int surfaceid) { int idx, idx2; - ICO_DBG("CicoSCLayer::removeSurface(%d)", surfaceid); + ICO_DBG("CicoSCLayer::removeSurface(%08x)", surfaceid); idx2 = 0; for (idx = 0; idx < numsurfaces; idx++, idx2++) { @@ -124,6 +124,34 @@ CicoSCLayer::removeSurface(int surfaceid) //-------------------------------------------------------------------------- /** + * @brief is_topSurface + */ +//-------------------------------------------------------------------------- +bool +CicoSCLayer::is_topSurface(int surfaceid) +{ + if ((numsurfaces > 0) && (surfaceids[numsurfaces-1] == surfaceid)) { + return true; + } + return false; +} + +//-------------------------------------------------------------------------- +/** + * @brief is_buttomSurface + */ +//-------------------------------------------------------------------------- +bool +CicoSCLayer::is_buttomSurface(int surfaceid) +{ + if ((numsurfaces > 0) && (surfaceids[0-1] == surfaceid)) { + return true; + } + return false; +} + +//-------------------------------------------------------------------------- +/** * @brief getSurfaces */ //-------------------------------------------------------------------------- diff --git a/lib/system-controller/CicoSCLayer.h b/lib/system-controller/CicoSCLayer.h index 47e97f0..299a613 100644 --- a/lib/system-controller/CicoSCLayer.h +++ b/lib/system-controller/CicoSCLayer.h @@ -37,6 +37,8 @@ public: void addSurface(int surfaceid, bool top); void removeSurface(int surfaceid); const int *getSurfaces(int *retsurfaces); + bool is_topSurface(int surfaceid); + bool is_buttomSurface(int surfaceid); // dump log this class member variables void dump(void); diff --git a/lib/system-controller/CicoSCMessage.h b/lib/system-controller/CicoSCMessage.h index b09cc46..c549de1 100644 --- a/lib/system-controller/CicoSCMessage.h +++ b/lib/system-controller/CicoSCMessage.h @@ -38,7 +38,7 @@ public: CicoSCMessage(); // destructor - ~CicoSCMessage(); + virtual ~CicoSCMessage(); // get message id unsigned int getId(void); @@ -77,7 +77,7 @@ public: void setHandle(CicoSCUwsHandle* handle); // get message data - const char* getData(void); + virtual const char* getData(void); // set application id of destination void setSendToAppid(const std::string & appid); @@ -92,7 +92,7 @@ private: // copy constructor CicoSCMessage(const CicoSCMessage &object); -private: +protected: static unsigned int ms_counter; //!< message id counter int m_id; //!< message id CicoSCUwsHandle *m_uwsHandle; //!< communication handler diff --git a/lib/system-controller/CicoSCPolicyDef.h b/lib/system-controller/CicoSCPolicyDef.h index b6b5c04..a07059d 100644 --- a/lib/system-controller/CicoSCPolicyDef.h +++ b/lib/system-controller/CicoSCPolicyDef.h @@ -110,7 +110,7 @@ #define STID_DISPLAY0_CATEGORY9 12009 #define STID_DISPLAY0_CATEGORY10 12010 #define STID_DISPLAY0_CATEGORY11 12011 -#if 1 // MK21031223 _MK_MK_ +#if 1 #define STID_DISP0_ZONE2_CATEGORY 12100 #define STID_DISP0_ZONE2_CATEGORY1 12101 #define STID_DISP0_ZONE2_CATEGORY2 12102 @@ -135,7 +135,7 @@ #define STID_DISP0_ZONE3_CATEGORY9 12209 #define STID_DISP0_ZONE3_CATEGORY10 12210 #define STID_DISP0_ZONE3_CATEGORY11 12211 -#endif // MK20131223 _MK_MK_ +#endif // display1 category state id #define STID_DISPLAY1_CATEGORY 13000 @@ -238,18 +238,18 @@ #define EVID_DISPLAY_ZONE_ACQUIRE 10000 #define EVID_DISPLAY_ZONE_RELEASE 10999 -#if 1 // MK20131223 _MK_MK_ +#if 1 #define ZONEID_CENTER_FULL 1 #define ZONEID_CENTER_UPPER 2 #define ZONEID_CENTER_LOWER 3 -#endif // MK20131223 _MK_MK_ +#endif #define EVID_DISPLAY0_CATEGORY 12000 -#if 1 // MK20131223 _MK_MK_ +#if 1 #define EVID_DISP0_ZONE2_CATEGORY 12100 #define EVID_DISP0_ZONE3_CATEGORY 12200 -#endif // MK20131223 _MK_MK_ +#endif #define EVID_DISPLAY1_CATEGORY 13000 #define EVID_ONSCREEN 14000 diff --git a/lib/system-controller/CicoSCPolicyManager.cpp b/lib/system-controller/CicoSCPolicyManager.cpp index 7b1c2ce..abc70ea 100644 --- a/lib/system-controller/CicoSCPolicyManager.cpp +++ b/lib/system-controller/CicoSCPolicyManager.cpp @@ -473,7 +473,7 @@ CicoSCPolicyManager::acquireDisplayResource(int type, int zoneid, int priority) bool chg = false; if (RESID_TYPE_BASIC == type) { -#if 1 // MK20131223 _MK_MK_ +#if 1 unsigned short category_ev = EVID_DISPLAY0_CATEGORY; if (ZONEID_CENTER_UPPER == zoneid) { category_ev = EVID_DISP0_ZONE2_CATEGORY; @@ -491,7 +491,7 @@ CicoSCPolicyManager::acquireDisplayResource(int type, int zoneid, int priority) sendSMEvent(category_ev, priority); chg = true; } -#else // MK20131223 _MK_MK_ +#else bool zoneChg = testSMEvent(EVID_DISPLAY_ZONE_ACQUIRE, zoneid); bool cateChg = testSMEvent(EVID_DISPLAY0_CATEGORY, priority); ICO_DBG("zoneChg=%d cateChg=%d", zoneChg, cateChg); @@ -500,7 +500,7 @@ CicoSCPolicyManager::acquireDisplayResource(int type, int zoneid, int priority) sendSMEvent(EVID_DISPLAY0_CATEGORY, priority); chg = true; } -#endif // MK20131223 _MK_MK_ +#endif #if 0 //-- { debug dump else { std::map::iterator itr; diff --git a/lib/system-controller/CicoSCResourceManager.cpp b/lib/system-controller/CicoSCResourceManager.cpp index 1f3a0d8..beaab1e 100644 --- a/lib/system-controller/CicoSCResourceManager.cpp +++ b/lib/system-controller/CicoSCResourceManager.cpp @@ -30,9 +30,13 @@ using namespace std; #include "CicoSCPolicyManager.h" #include "CicoSCLifeCycleController.h" #include "CicoAilItems.h" +#include "CicoSCWindow.h" #include "CicoSCWindowController.h" #include "CicoSCInputController.h" #include "CicoSCPolicyDef.h" +#include "CicoSCMessage.h" +#include "CicoSCMessageRes.h" +#include "CicoSCServer.h" struct CompDisplayResourceRequest { @@ -161,6 +165,7 @@ CicoSCResourceManager::CicoSCResourceManager() } } } + m_rrtHO = (resource_request_t*)NULL; } CicoSCResourceManager::~CicoSCResourceManager() @@ -213,7 +218,6 @@ CicoSCResourceManager::handleCommand(const CicoSCCommand &cmd, // request command from application or internal int reqtype = internal ? REQTYPE_AUTO : REQTYPE_APP; - if ((MSG_CMD_CREATE_RES == cmd.cmdid) || (MSG_CMD_ACQUIRE_RES == cmd.cmdid)) { @@ -225,6 +229,11 @@ CicoSCResourceManager::handleCommand(const CicoSCCommand &cmd, acquireDisplayResource(req, false); } else { + // cmdid is MSG_CMD_ACQUIRE_RES + if (true == isTypeOnScreen(*req)) { + acquireOnScreenDisplayResource(req); + } + else if ((true == m_policyMgr->getRegulation()) && (false == isMatchDisplayed())) { updateDispResRegulationPreProc(req); @@ -271,7 +280,12 @@ CicoSCResourceManager::handleCommand(const CicoSCCommand &cmd, resource_request_t *req = newResourceRequest(RESID_KIND_DISPLAY, reqtype, cmd); - releaseDisplayResource(req); + if (true == isTypeOnScreen(*req)) { + releaseOnScreenDisplayResource(req); + } + else { + releaseDisplayResource(req); + } } if (true == opt->soundres) { resource_request_t *req = newResourceRequest(RESID_KIND_SOUND, @@ -843,9 +857,16 @@ CicoSCResourceManager::newResourceRequest(int resid, req->released = 0; /* set resource id */ - req->resid = RESID_TYPE_BASIC; - if (1 == opt->type) { + switch (opt->type) { + case ICO_SYC_RES_INTERRUPT: req->resid = RESID_TYPE_INTERRUPT; + break; + case ICO_SYC_RES_ONSCREEN: + req->resid = RESID_TYPE_ONSCREEN; + break; + default: // include case ICO_SYC_RES_BASIC: + req->resid = RESID_TYPE_BASIC; + break; } req->resid |= resid; @@ -865,9 +886,18 @@ CicoSCResourceManager::newResourceRequest(int resid, req->layerid = opt->layerid; req->winname = strdup(opt->winname.c_str()); req->surfaceid = opt->surfaceid; - req->id = opt->surfaceid;; + req->id = opt->surfaceid; req->animation = strdup(opt->animation.c_str()); req->animationTime = opt->animationTime; + req->bEx = opt->dispresEx; + req->ECU = strdup(opt->ECU.c_str()); // name to identify ECU + req->display = strdup(opt->display.c_str()); // name to identify Display in ECU + req->layer = strdup(opt->layer.c_str()); // name to identify Layer in Display + req->layout = strdup(opt->layout.c_str()); // name to identify layout in Layer + req->area = strdup(opt->area.c_str()); // name to Output position in Layout + req->dispatchApp= strdup(opt->dispatchApp.c_str()); // dispatch of application + req->role = strdup(opt->role.c_str()); // role of notice + req->resourceId = opt->resourceID; // ID number of resource } else if (resid == RESID_KIND_SOUND) { req->soundzone = strdup(opt->soundzone.c_str()); @@ -901,7 +931,13 @@ CicoSCResourceManager::delResourceRequest(resource_request_t *req) 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); } @@ -967,7 +1003,7 @@ CicoSCResourceManager::updateDisplayResource(resource_request_t *req, req->appid, req->pid, req->surfaceid); // show request window m_winCtrl->show(req->surfaceid, req->animation, req->animationTime); -#if 0 // MKMK +#if 0 m_winCtrl->activeCB(NULL, NULL, req->surfaceid, -1); #endif ICO_TRA("CicoSCResourceManager::updateDisplayResource Leave"); @@ -1979,11 +2015,305 @@ CicoSCResourceManager::isMatchDisplayed(void) } if ((itr2->second->surfaceid == surfaceid)) { ret = true; - break; + break; // break of for itr2 } } } + if (true == ret) { + break; // break of for itr + } } return ret; } + +bool +CicoSCResourceManager::acquireOnScreenDisplayResource(resource_request_t *newreq) +{ + ICO_TRA("Enter (%08x)", newreq); + if (NULL == newreq) { + ICO_TRA("Leave param is NULL pointer"); + return false; + } + CicoSystemConfig *sysConf = CicoSystemConfig::getInstance(); + + if (0 == newreq->role_stt) { + newreq->role_stt = sysConf->getRoleStt(newreq->role); + } + m_OnScreenItems.push_back(newreq); + + const resource_request_t* rrtHO = getNoticeOfHighOder(); + if (NULL == rrtHO) { + ICO_TRA("Leave %s, %d is not notice", newreq->role, newreq->resourceId); + return false; + } +#if 1 + const CicoSCWindow* nwo = m_winCtrl->findWindowObj(newreq->pid, + newreq->resourceId); +#endif + const CicoSCWindow* bwo = NULL; // before window oject + const CicoSCWindow* awo = NULL; // after window object + + if (NULL != m_rrtHO) { + bwo = m_winCtrl->findWindowObj(m_rrtHO->pid, m_rrtHO->resourceId); + } + if (NULL != rrtHO) { + awo = m_winCtrl->findWindowObj(rrtHO->pid, rrtHO->resourceId); + } + if ((NULL == m_rrtHO) && (NULL != rrtHO)) { // none -> on notice + ICO_TRA("_____ OPEN Layer \"%s\":%d", rrtHO->role, rrtHO->resourceId); + if (NULL != awo) { + m_winCtrl->showLayer(awo->displayid, awo->layerid); + } + else { + ICO_WRN("ON SCREEN none layer"); + } + } +#if 1 + if ((NULL != nwo) && (awo != nwo) && (bwo != nwo)) { + ICO_TRA("_____ HIDW new REQUEST %x:%s:%d", newreq, newreq->role, + newreq->resourceId); + m_winCtrl->hide(nwo->surfaceid, NULL, 0); + } +#endif + if (rrtHO != m_rrtHO) { // change Hige Oder notice + if (NULL != m_rrtHO) { + ICO_TRA("_____ HIDE surface %x:%s:%d", m_rrtHO, m_rrtHO->role, + m_rrtHO->resourceId); + if (NULL != bwo) { + m_winCtrl->hide(bwo->surfaceid, NULL, 0); + } + else { + ICO_WRN("ON SCREEN none Hide control"); + } + resCB(ICO_SYC_EV_RES_WAITING, *m_rrtHO); + } + ICO_TRA("_____ SHOW surface %x:%s:%d", rrtHO, rrtHO->role, rrtHO->resourceId); + if (NULL != awo) { + m_winCtrl->show(awo->surfaceid, NULL, 0); + } + else { + ICO_WRN("ON SCREEN none show control"); + } + resCB(ICO_SYC_EV_RES_ACQUIRE, *rrtHO); + ICO_TRA("_____ change %x -> %x", m_rrtHO, rrtHO); + m_rrtHO = rrtHO; + } +//- if (m_rrtHO != newreq) { +//- resCB(ICO_SYC_EV_RES_WAITING, *newreq); +//- } + else { + ICO_TRA("_____ no change %x", m_rrtHO); + if (NULL != awo) { + m_winCtrl->show(awo->surfaceid, NULL, 0); + m_winCtrl->raise(awo->surfaceid, NULL, 0); + } + if (m_rrtHO != newreq) { + resCB(ICO_SYC_EV_RES_WAITING, *newreq); + } + } + ICO_TRA("Leave"); + return true; +} + +bool +CicoSCResourceManager::releaseOnScreenDisplayResource(resource_request_t *req) +{ + ICO_TRA("Enter %08x", req); + if (NULL == req) { + ICO_TRA("Leave param is NULL pointer"); + return false; + } + resource_request_t* tgt = NULL; + list::iterator itr = m_OnScreenItems.begin(); + for (; itr != m_OnScreenItems.end(); ++itr) { + if ((req->pid == (*itr)->pid) && + (req->resourceId == (*itr)->resourceId)) { + tgt = (*itr); + break; // break of for itr + } + } + + if (NULL != tgt) { + ICO_TRA("_____ erase list %x", tgt); + m_OnScreenItems.erase(itr); + } + + const resource_request_t* rrtHO = getNoticeOfHighOder(); + + const CicoSCWindow* bwo = NULL; // before window oject + const CicoSCWindow* awo = NULL; // after window object + if (NULL != m_rrtHO) { + bwo = m_winCtrl->findWindowObj(m_rrtHO->pid, m_rrtHO->resourceId); + } + if (NULL != rrtHO) { + awo = m_winCtrl->findWindowObj(rrtHO->pid, rrtHO->resourceId); + } + + if ((NULL == rrtHO) && (NULL == m_rrtHO)) { + ICO_WRN("ON SCREEN Resource NG"); + if (NULL != tgt) { + resCB(ICO_SYC_EV_RES_RELEASE, *tgt); + delResourceRequest(tgt); + } + delResourceRequest(req); + ICO_TRA("Leave ON SCREEN Resource NG"); + return false; + } + + if (rrtHO != m_rrtHO) { + if (NULL != m_rrtHO) { + if (NULL != bwo) { + m_winCtrl->hide(bwo->surfaceid, NULL, 0); + if (m_rrtHO != tgt) { + 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); + } + } + else { + ICO_WRN("ON SCREEN Hide control NG"); + } + } + if (NULL != rrtHO) { + if (NULL != awo) { + m_winCtrl->show(awo->surfaceid, NULL, 0); + m_winCtrl->raise(awo->surfaceid, NULL, 0); + resCB(ICO_SYC_EV_RES_ACQUIRE, *rrtHO); + } + else { + ICO_WRN("ON SCREEN Hide control NG"); + } + } + else { + if (NULL != bwo) { + m_winCtrl->hideLayer(bwo->displayid, bwo->layerid); + } + else { + ICO_WRN("ON SCREEN layer hide control NG"); + } + } + m_rrtHO = rrtHO; + } + else { + ICO_TRA("_____ no change"); + } + // memory free + if (NULL != tgt) { + resCB(ICO_SYC_EV_RES_RELEASE, *tgt); + delResourceRequest(tgt); + } + delResourceRequest(req); + ICO_TRA("Leave"); + return true; +} + +bool +CicoSCResourceManager::resCB(const ico_syc_ev_e ev, const resource_request_t& p) const +{ + ICO_TRA("Enter %d", (int)ev); + if ((NULL == p.appid) || (0 == strlen(p.appid))) { + ICO_TRA("Leave false"); + return false; + } + if (false == p.bEx) { + ICO_TRA("Leave false"); + return false; + } + int nEv = -1; + if (ICO_SYC_EV_RES_ACQUIRE == ev) { + nEv = MSG_CMD_ACQUIRE_RES; + } + else if (ICO_SYC_EV_RES_DEPRIVE == ev) { + nEv = MSG_CMD_DEPRIVE_RES; + } + else if (ICO_SYC_EV_RES_WAITING == ev) { + nEv = MSG_CMD_WAITING_RES; + } + else if (ICO_SYC_EV_RES_REVERT == ev) { + nEv = MSG_CMD_REVERT_RES; + } + else if (ICO_SYC_EV_RES_RELEASE == ev) { + nEv = MSG_CMD_RELEASE_RES; + } + else if (ICO_SYC_EV_RES_WINDOW_ID == ev) { + nEv = MSG_CMD_WINDOW_ID_RES; + } + else { + ICO_TRA("Leave false ev(%d) is not supp.",(int)ev); + return false; + } + + bool r; + r = resCB(p.appid, nEv, p.ECU, p.display, p.layer, p.layout, p.area, + p.dispatchApp, p.role, p.resourceId); + ICO_TRA("Leave %s", r? "true":"false"); + return r; +} + +bool +CicoSCResourceManager::resCB(const char* sendToAppid, const int ev, + const char* ECU, const char* display, + const char* layer, const char* layout, + const char* area, const char* dispatchApp, + const char* role, uint32_t resourceId) const +{ + ICO_TRA("Enter"); + if (NULL == sendToAppid) { + ICO_TRA("Leave false"); + return false; + } + CicoSCMessageRes* msg = new CicoSCMessageRes(); + msg->addRootObject("command", ev); + if (NULL != ECU) { + msg->addWinObject("ECU", ECU); + } + if (NULL != display) { + msg->addWinObject("display", display); + } + if (NULL != layer) { + msg->addWinObject("layer", layer); + } + if (NULL != layout) { + msg->addWinObject("layout", layout); + } + if (NULL != area) { + msg->addWinObject("area", area); + } + if (NULL != dispatchApp) { + msg->addWinObject("dispatchApp", dispatchApp); + } + if (NULL != role) { + msg->addWinObject("role", role); + } + msg->addWinObject("resourceId", resourceId); + CicoSCServer *cscs = CicoSCServer::getInstance(); + int r = cscs->sendMessage(sendToAppid, (CicoSCMessage*)msg); + if (ICO_SYC_EOK != r) { + ICO_TRA("Leave false(%d)", r); + return false; + } + ICO_TRA("Leave true"); + return true; +} + +const resource_request_t* CicoSCResourceManager::getNoticeOfHighOder() +{ + ICO_TRA("Enter (%d)", (int)m_OnScreenItems.size()); + const CicoSCRoleConf* rC = CicoSystemConfig::getInstance()->getRoleConf(); + m_policyMgr->sendSMEvent(rC->m_rst); // RESET OnScreen State + const resource_request_t* r = NULL; + list::iterator itr = m_OnScreenItems.begin(); + for (; itr != m_OnScreenItems.end(); ++itr) { + short hEv = (*itr)->role_stt; + if ((ICO_SYC_ROLE_CONF_DEF == hEv) || (0 == hEv)) { + continue; // continue of for itr + } + if (true == m_policyMgr->sendSMEvent(hEv)) { + r = (*itr); + } + } + ICO_TRA("Leave %x", r); + return r; +} + // vim:set expandtab ts=4 sw=4: diff --git a/lib/system-controller/CicoSCResourceManager.h b/lib/system-controller/CicoSCResourceManager.h index b3d13d9..c1b7df5 100644 --- a/lib/system-controller/CicoSCResourceManager.h +++ b/lib/system-controller/CicoSCResourceManager.h @@ -23,6 +23,7 @@ using namespace std; #include "ico_syc_mrp_resource_private.h" +#include "ico_syc_appresctl.h" //========================================================================== // Forward declaration @@ -121,7 +122,17 @@ private: void dumpWaitingDispResReq(void); bool isMatchDisplayed(void); - + bool acquireOnScreenDisplayResource(resource_request_t *req); + bool releaseOnScreenDisplayResource(resource_request_t *req); + const resource_request_t* getNoticeOfHighOder(); + bool resCB(const ico_syc_ev_e ev, const resource_request_t& p) const; + bool resCB(const char* sendToAppid, const int ev, const char* ECU, + const char* display, const char* layer, const char* layout, + const char* area, const char* dispatchApp, const char* role, + uint32_t resourceId) const; + bool isTypeBaseic(const resource_request_t& p); + bool isTypeInterrupt(const resource_request_t& p); + bool isTypeOnScreen(const resource_request_t& p); private: CicoSCPolicyManager *m_policyMgr; CicoSCWindowController *m_winCtrl; @@ -135,6 +146,8 @@ private: std::list m_waitingDispResReq; map > m_soundReqQueue; map > m_inputReqQueue; + std::list m_OnScreenItems; + const resource_request_t* m_rrtHO; // resource_request_t of High Oder // show/hide animation name at regulation on or off const std::string m_animaName; @@ -142,5 +155,45 @@ private: // show/hide animation time at regulation on or off int m_animaTime; }; + +//========================================================================== +/** + * @brief check type is basic + * @param p resorce request info + * @ret bool + * @retval true: basic + * @retval false: not basic + */ +inline bool CicoSCResourceManager::isTypeBaseic(const resource_request_t& p) +{ + return (RESID_TYPE_BASIC == (p.resid & RESID_TYPE_MASK)); +} + +//========================================================================== +/** + * @brief check type is interrupt + * @param p resorce request info + * @ret bool + * @retval true: interrupt + * @retval false: not interrupt + */ +inline bool CicoSCResourceManager::isTypeInterrupt(const resource_request_t& p) +{ + return (RESID_TYPE_INTERRUPT == (p.resid & RESID_TYPE_MASK)); +} + +//========================================================================== +/** + * @brief check type is onscreen + * @param p resorce request info + * @ret bool + * @retval true: onscreen + * @retval false: not onscreen + */ +//========================================================================== +inline bool CicoSCResourceManager::isTypeOnScreen(const resource_request_t& p) +{ + return (RESID_TYPE_ONSCREEN == (p.resid & RESID_TYPE_MASK)); +} #endif // __CICO_SC_RESOURCE_MANAGER_H__ // vim:set expandtab ts=4 sw=4: diff --git a/lib/system-controller/CicoSCServer.cpp b/lib/system-controller/CicoSCServer.cpp index 2be8fa5..fc26c58 100644 --- a/lib/system-controller/CicoSCServer.cpp +++ b/lib/system-controller/CicoSCServer.cpp @@ -51,9 +51,9 @@ public: string appid; }; -//========================================================================== +//========================================================================== // private static variable -//========================================================================== +//========================================================================== CicoSCServer* CicoSCServer::ms_myInstance = NULL; //-------------------------------------------------------------------------- @@ -76,10 +76,10 @@ CicoSCServer::CicoSCServer() //-------------------------------------------------------------------------- CicoSCServer::~CicoSCServer() { + CicoSCServer::ms_myInstance = NULL; if (NULL != m_uwsContext) { ico_uws_close(m_uwsContext); } - CicoSCServer::ms_myInstance = NULL; } //-------------------------------------------------------------------------- @@ -235,7 +235,7 @@ CicoSCServer::teardown(void) } m_sendMsgQueue.clear(); } - + { std::list::iterator itr; itr = m_recvCmdQueue.begin(); @@ -479,12 +479,14 @@ CicoSCServer::sendMessageToHomeScreen(CicoSCMessage* msg) // if user change processing(homescree is not running) if (true == m_userMgr->isStoppingNow()) { ICO_DBG("homescreen not running"); + delete msg; return ICO_SYC_ENOENT; } const CicoSCUser *loginUser = m_userMgr->getLoginUser(); if (NULL == loginUser) { ICO_WRN("homescreen unknown"); + delete msg; return ICO_SYC_ENOENT; } return sendMessage(loginUser->homescreen, msg); @@ -568,7 +570,7 @@ CicoSCServer::receiveEventCB(const struct ico_uws_context *context, // ICO_TRA("CicoSCServer::receiveEventCB Leave"); return; case ICO_UWS_EVT_ERROR: - ICO_DBG(">>>RECV ICO_UWS_EVT_ERROR(id=0x%08x, err=%d)", + ICO_DBG(">>>RECV ICO_UWS_EVT_ERROR(id=0x%08x, err=%d)", (int)id, detail->_ico_uws_error.code); // ICO_TRA("CicoSCServer::receiveEventCB Leave"); return; @@ -588,15 +590,15 @@ CicoSCServer::receiveEventCB(const struct ico_uws_context *context, switch (event) { case ICO_UWS_EVT_OPEN: - ICO_DBG(">>>RECV ICO_UWS_EVT_OPEN(id=0x%08x)", (int)id); - break; + ICO_DBG(">>>RECV ICO_UWS_EVT_OPEN(id=0x%08x)", (int)id); + break; // break of switch event case ICO_UWS_EVT_CLOSE: ICO_DBG(">>>RECV ICO_UWS_EVT_CLOSE(id=0x%08x)", (int)id); delete handler; - break; + break; // break of switch event case ICO_UWS_EVT_RECEIVE: { - ICO_DBG(">>>RECV ICO_UWS_EVT_RECEIVE(id=0x%08x, msg=%s, len=%d)", + 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); @@ -609,7 +611,7 @@ CicoSCServer::receiveEventCB(const struct ico_uws_context *context, if (0 == cmd->appid.length()) { ICO_WRN("command argument invalid appid null"); delete cmd; - break; + break; // break of switch event } handler->appid = cmd->appid; handler->serviceFlag = true; @@ -624,29 +626,29 @@ CicoSCServer::receiveEventCB(const struct ico_uws_context *context, notifyConnected(handler->appid); delete cmd; - break; + break; // break of switch event } - + // Enqueue command ICO_DBG("Enqueue command(0x%08x)", cmd->cmdid); m_recvCmdQueue.push_back(cmd); - break; + break; // break of switch event } 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); handler->fd = detail->_ico_uws_fd.fd; addPollFd(handler); - break; + break; // break of switch event case ICO_UWS_EVT_DEL_FD: ICO_DBG(">>>RECV ICO_UWS_EVT_DEL_FD(id=0x%08x, fd=%d, appid=%s)", (int)id, detail->_ico_uws_fd.fd, handler->appid.c_str()); clearRecvCmdQueue(handler->appid); clearSendMsgQueue(handler->appid); delPollFd(handler); - break; + break; // break of switch event default: - break; + break; // break of switch event } // ICO_TRA("CicoSCServer::receiveEventCB Leave"); } @@ -791,7 +793,7 @@ CicoSCServer::findUwsHandler(const string & appid) //-------------------------------------------------------------------------- bool CicoSCServer::isExistUwsHandler(const CicoSCUwsHandler *handler) -{ +{ list::iterator itr; itr = m_uwsHandlerList.begin(); for (; itr != m_uwsHandlerList.end(); ++itr) { diff --git a/lib/system-controller/CicoSCUserManager.cpp b/lib/system-controller/CicoSCUserManager.cpp index fee7373..e66c17a 100644 --- a/lib/system-controller/CicoSCUserManager.cpp +++ b/lib/system-controller/CicoSCUserManager.cpp @@ -816,7 +816,7 @@ CicoSCUserManager::loadLastInfo() int ret = stat(dir.c_str(), &st); if (0 != ret) { // lastinfo directory does not exist - ICO_ERR("lastinfo directory dose not exist)"); + ICO_WRN("lastinfo directory dose not exist)"); ICO_TRA("CicoSCUserManager::loadLastInfo Leave(dir dose not exist)"); return; } diff --git a/lib/system-controller/CicoSCWayland.cpp b/lib/system-controller/CicoSCWayland.cpp index d79dd7a..fea1e01 100644 --- a/lib/system-controller/CicoSCWayland.cpp +++ b/lib/system-controller/CicoSCWayland.cpp @@ -172,7 +172,7 @@ CicoSCWayland::initialize(void) ICO_DBG("CicoSCWayland::initialize: Wayland/Weston connect OK"); // initialize genivi callbacks - CicoSCWindowController::initializeGeniviNotifications(); + CicoSCWindowController::getInstance()->initializeGeniviLMS(); ICO_TRA("CicoSCWayland::initialize: Leave(EOK)"); return ICO_SYC_EOK; diff --git a/lib/system-controller/CicoSCWaylandIF.cpp b/lib/system-controller/CicoSCWaylandIF.cpp index c5774af..08b326b 100644 --- a/lib/system-controller/CicoSCWaylandIF.cpp +++ b/lib/system-controller/CicoSCWaylandIF.cpp @@ -18,7 +18,6 @@ #include "CicoSCWaylandIF.h" #include "CicoLog.h" - const char * CicoSCWaylandIF::ICO_WL_WIN_MGR_IF = "ico_window_mgr"; const char * CicoSCWaylandIF::ICO_WL_INPUT_MGR_CTRL_IF = "ico_input_mgr_control"; const char * CicoSCWaylandIF::ICO_WL_EXINPUT_IF = "ico_exinput"; diff --git a/lib/system-controller/CicoSCWindow.cpp b/lib/system-controller/CicoSCWindow.cpp index 37361fe..41a95f7 100644 --- a/lib/system-controller/CicoSCWindow.cpp +++ b/lib/system-controller/CicoSCWindow.cpp @@ -30,8 +30,8 @@ using namespace std; CicoSCWindow::CicoSCWindow() : surfaceid(-1), name(""), appid(""), pid(-1), nodeid(-1), displayid(-1), layerid(-1), zone(""), zoneid(-1), - subwindow(0), eventmask(0), x(-1), y(-1), width(-1), height(-1), - visible(false), raise(false), active(false) + subwindow(0), eventmask(0), srcwidth(0), srcheight(0), x(-1), y(-1), + width(-1), height(-1), visible(false), raise(false), active(false) { // ICO_TRA("CicoSCWindow::CicoSCWindow Enter"); // ICO_TRA("CicoSCWindow::CicoSCWindow Leave"); diff --git a/lib/system-controller/CicoSCWindow.h b/lib/system-controller/CicoSCWindow.h index 0122685..bc50191 100644 --- a/lib/system-controller/CicoSCWindow.h +++ b/lib/system-controller/CicoSCWindow.h @@ -63,9 +63,11 @@ public: std::string zone; ///< display zone name int zoneid; ///< display zone id int subwindow; ///< main window(0) or sub window(!0) - unsigned int eventmask; ///< Event to receive through this window - int x; ///< Upper left X coord of the window - int y; ///< Upper left Y coord of the window + unsigned int eventmask; ///< event to receive through this window + int srcwidth; ///< width of application frame buffer + int srcheight; ///< height of application frame buffer + int x; ///< upper left X coord of the window + int y; ///< upper left Y coord of the window int width; ///< width of window int height; ///< height of window bool visible; ///< visibility diff --git a/lib/system-controller/CicoSCWindowController.cpp b/lib/system-controller/CicoSCWindowController.cpp index 0c456d9..835e9d2 100644 --- a/lib/system-controller/CicoSCWindowController.cpp +++ b/lib/system-controller/CicoSCWindowController.cpp @@ -44,6 +44,7 @@ using namespace std; #include "ico_syc_msg_cmd_def.h" #include "CicoSCServer.h" #include "CicoSCMessage.h" +#include "CicoSCMessageRes.h" #include "CicoSCLifeCycleController.h" #include "CicoSCResourceManager.h" @@ -218,33 +219,31 @@ CicoSCWindowController::show(int surfaceid, } // set animation request to Multi Window Manager - int animaFlag = ICO_SYC_ANIMATION_OFF; int raiseFlag = ICO_SYC_WIN_RAISE_NOCHANGE; if (animationTime & ICO_SYC_WIN_SURF_RAISE) { raiseFlag = ICO_SYC_WIN_RAISE_RAISE; - window->raise = true; } else if (animationTime & ICO_SYC_WIN_SURF_LOWER) { raiseFlag = ICO_SYC_WIN_RAISE_LOWER; - window->raise = false; } else if (((animationTime & ICO_SYC_WIN_SURF_NOCHANGE) == 0) && (false == window->raise)) { raiseFlag = ICO_SYC_WIN_RAISE_RAISE; - window->raise = true; } 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); - animaFlag = ICO_SYC_ANIMATION_ON; + } + + // set raise/lower request (if need) + if (raiseFlag != ICO_SYC_WIN_RAISE_NOCHANGE) { + raiselower(window, (raiseFlag == ICO_SYC_WIN_RAISE_RAISE)); } // set visible request to Multi Window Manager - CicoSCWlWinMgrIF::setVisible(window->surfaceid, - ICO_SYC_WIN_VISIBLE_SHOW, - raiseFlag, animaFlag); + CicoSCWlWinMgrIF::setVisible(window->surfaceid, ICO_SYC_WIN_VISIBLE_SHOW); // flush display CicoSCWayland::getInstance()->flushDisplay(); @@ -255,6 +254,50 @@ CicoSCWindowController::show(int surfaceid, //-------------------------------------------------------------------------- /** + * @brief raise/lower a target window + * + * @param [in] window target window + * @param [in] raise raise(true)/lower(false) + * + * @return nothing + */ +//-------------------------------------------------------------------------- +void +CicoSCWindowController::raiselower(CicoSCWindow *window, bool raise) +{ + ICO_TRA("CicoSCWindowController::raiselower(%08x,%d)", window->surfaceid, raise); + + window->raise = raise; + + CicoSCLayer* layer = findLayer(window->displayid, window->layerid); + if (! layer) { + ICO_ERR("CicoSCWindowController::raiselower: surface.%08x has no layer(%d)", + window->surfaceid, window->layerid); + return; + } + if ((raise) && (layer->is_topSurface(window->surfaceid))) { + ICO_DBG("CicoSCWindowController::raiselower %08x raise but top", + window->surfaceid); + } + else if ((! raise) && (layer->is_buttomSurface(window->surfaceid))) { + ICO_DBG("CicoSCWindowController::raiselower %08x lower but buttom", + window->surfaceid); + } + else { + layer->addSurface(window->surfaceid, raise); + + int nsurf; + const int *surfs = layer->getSurfaces(&nsurf); + if (ilm_layerSetRenderOrder(window->layerid, (t_ilm_layer *)surfs, nsurf) + != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::raiselower " + "ilm_layerSetRenderOrder(%d,,%d) Error", window->layerid, nsurf); + } + } +} + +//-------------------------------------------------------------------------- +/** * @brief hide a target window * * @param [in] surfaceid wayland surface id @@ -307,18 +350,14 @@ CicoSCWindowController::hide(int surfaceid, } // set animation request to Multi Window Manager - int animaFlag = ICO_SYC_ANIMATION_OFF; if ((NULL != animation) && (animation[0] != '\0')) { CicoSCWlWinMgrIF::setAnimation(window->surfaceid, ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE, animation, animationTime & ~ICO_SYC_WIN_SURF_FLAGS); - animaFlag = ICO_SYC_ANIMATION_ON; } // set visible request to Multi Window Manager - CicoSCWlWinMgrIF::setVisible(window->surfaceid, - ICO_SYC_LAYER_VISIBLE_HIDE, - ICO_SYC_WIN_RAISE_NOCHANGE, animaFlag); + CicoSCWlWinMgrIF::setVisible(window->surfaceid, ICO_SYC_LAYER_VISIBLE_HIDE); // flush display CicoSCWayland::getInstance()->flushDisplay(); @@ -363,20 +402,17 @@ CicoSCWindowController::resize(int surfaceid, } // set animation request to Multi Window Manager - int animaFlag = ICO_SYC_ANIMATION_OFF; if ((NULL != animation) && (animation[0] != '\0')) { CicoSCWlWinMgrIF::setAnimation(window->surfaceid, ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE, animation, animationTime); - animaFlag = ICO_SYC_ANIMATION_ON; } // set visible request to Multi Window Manager window->width = w; window->height = h; CicoSCWlWinMgrIF::setPositionsize(window->surfaceid, window->nodeid, - window->x, window->y, - w, h, animaFlag); + window->x, window->y, w, h); // flush display CicoSCWayland::getInstance()->flushDisplay(); @@ -424,12 +460,10 @@ CicoSCWindowController::move(int surfaceid, } // set animation request to Multi Window Manager - int animaFlag = ICO_SYC_ANIMATION_OFF; if ((NULL != animation) && (animation[0] != '\0')) { CicoSCWlWinMgrIF::setAnimation(window->surfaceid, ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE, animation, animationTime); - animaFlag = ICO_SYC_ANIMATION_ON; } int moveNodeId = ICO_SYC_WIN_NOCHANGE; @@ -442,8 +476,7 @@ CicoSCWindowController::move(int surfaceid, window->y = y; CicoSCWlWinMgrIF::setPositionsize(window->surfaceid, moveNodeId, x, y, - window->width, window->height, - animaFlag); + window->width, window->height); // flush display CicoSCWayland::getInstance()->flushDisplay(); @@ -483,22 +516,17 @@ CicoSCWindowController::raise(int surfaceid, return ICO_SYC_ENOENT; } - // update visible attr - window->raise = true; - // set animation request to Multi Window Manager - int animaFlag = ICO_SYC_ANIMATION_OFF; if ((NULL != animation) && (animation[0] != '\0')) { CicoSCWindowController::setAnimation(window->surfaceid, ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW, animation, animationTime); - animaFlag = ICO_SYC_ANIMATION_ON; } - - // set visible request to Multi Window Manager - CicoSCWlWinMgrIF::setVisible(window->surfaceid, - ICO_SYC_WIN_VISIBLE_NOCHANGE, - ICO_SYC_WIN_RAISE_RAISE, animaFlag); + // set raise request to Multi Window Manager + raiselower(window, true); + if (ilm_commitChanges() != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::raise ilm_commitChanges() Error"); + } // flush display CicoSCWayland::getInstance()->flushDisplay(); @@ -623,8 +651,7 @@ CicoSCWindowController::setGeometry(int surfaceid, // set visible request to Multi Window Manager CicoSCWlWinMgrIF::setPositionsize(window->surfaceid, moveNodeId, - moveX, moveY, moveW, moveH, - ICO_SYC_ANIMATION_ON); + moveX, moveY, moveW, moveH); // flush display CicoSCWayland::getInstance()->flushDisplay(); @@ -780,21 +807,18 @@ CicoSCWindowController::lower(int surfaceid, return ICO_SYC_ENOENT; } - // update visible attr - window->raise = false; - // set animation request to Multi Window Manager - int animaFlag = ICO_SYC_ANIMATION_OFF; if ((NULL != animation) && (animation[0] != '\0')) { CicoSCWlWinMgrIF::setAnimation(window->surfaceid, ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE, animation, animationTime); - animaFlag = ICO_SYC_ANIMATION_ON; } - // set visible request to Multi Window Manager - CicoSCWlWinMgrIF::setVisible(window->surfaceid, ICO_SYC_WIN_VISIBLE_NOCHANGE, - ICO_SYC_WIN_RAISE_LOWER, animaFlag); + // set lower request to Multi Window Manager + raiselower(window, false); + if (ilm_commitChanges() != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::lower ilm_commitChanges() Error"); + } // flush display CicoSCWayland::getInstance()->flushDisplay(); @@ -819,8 +843,6 @@ CicoSCWindowController::lower(int surfaceid, int CicoSCWindowController::setWindowLayer(int surfaceid, int layerid) { - uint32_t oldlayerid; - ICO_TRA("CicoSCWindowController::setWindowLayer Enter" "(surfaceid=0x%08X layerid=%x)", surfaceid, layerid); @@ -831,8 +853,12 @@ CicoSCWindowController::setWindowLayer(int surfaceid, int layerid) ICO_TRA("CicoSCWindowController::setWindowLayer Leave(ENOENT)"); return ICO_SYC_ENOENT; } + if (window->layerid == layerid) { + ICO_TRA("CicoSCWindowController::setWindowLayer Leave(same layer %d)", layerid); + return ICO_SYC_EOK; + } - // find layer information in layer list + // find new layer information in layer list CicoSCLayer* layer = findLayer(window->displayid, layerid); if (NULL == layer) { ICO_TRA("CicoSCWindowController::setWindowLayer Leave(ENOENT[disp=%d,layer=%d])", @@ -840,13 +866,49 @@ CicoSCWindowController::setWindowLayer(int surfaceid, int layerid) return ICO_SYC_ENOENT; } + // find old layer information and remove surface if need + CicoSCLayer* oldlayer = findLayer(window->displayid, window->layerid); + if (oldlayer) { + if (ilm_layerRemoveSurface(window->layerid, window->surfaceid) != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::setWindowLayer ilm_layerRemoveSurface(%d,%08x)" + " Error", window->layerid, window->surfaceid); + } + oldlayer->removeSurface(window->surfaceid); + int noldsurf; + const int *oldsurfs = oldlayer->getSurfaces(&noldsurf); + if (ilm_layerSetRenderOrder(window->layerid, (t_ilm_layer *)oldsurfs, noldsurf) + != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::setWindowLayer " + "ilm_layerSetRenderOrder(%d,,%d) Error", window->layerid, noldsurf); + } + // must need ilm_commitChanges() after ilm_layerRemoveSurface() + if (ilm_commitChanges() != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::setWindowLayer ilm_commitChanges Error"); + } + } + // update window attr - oldlayerid = window->layerid; window->layerid = layerid; - // set window layer request to Multi Window Manager - CicoSCWlWinMgrIF::setWindowLayer(window->surfaceid, - (uint32_t)window->layerid, oldlayerid); + // set window layer request + if (ilm_layerAddSurface(window->layerid, window->surfaceid) != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::setWindowLayer ilm_layerAddSurface(%d,%08x) Error", + window->layerid, window->surfaceid); + } + + // add surface to new layer + layer->addSurface(window->surfaceid, true); + int nsurf; + const int *surfs = layer->getSurfaces(&nsurf); + if (ilm_layerSetRenderOrder(window->layerid, (t_ilm_layer *)surfs, nsurf) + != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::setWindowLayer " + "ilm_layerSetRenderOrder(%d,,%d) Error", window->layerid, nsurf); + } + if (ilm_commitChanges() != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::setWindowLayer ilm_commitChanges() Error"); + } + // flush display CicoSCWayland::getInstance()->flushDisplay(); @@ -1285,6 +1347,192 @@ CicoSCWindowController::mapSurfaceCB(void *data, //-------------------------------------------------------------------------- /** + * @brief surface update event callback + * + * @param [in] data user data(unused) + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface + * @param [in] surfaceid surface Id + * @param [in] visible visibility + * @param [in] srcwidth application buffer width + * @param [in] srcheight application buffer height + * @param [in] x X + * @param [in] y Y + * @param [in] width width + * @param [in] height height + */ +//-------------------------------------------------------------------------- +void +CicoSCWindowController::updateSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid, + int visible, + int srcwidth, + int srcheight, + int x, + int y, + int width, + int height) +{ + ICO_TRA("CicoSCWindowController::updateSurfaceCB: Enter(%08x %d,%d,%d,%d,%d,%d,%d)", + surfaceid, visible, srcwidth, srcheight, x, y, width, height); + + CicoSCWindow *window = findWindow(surfaceid); + if (NULL == window) { + ICO_WRN("CicoSCWindowController::updateSurfaceCB: not found window(%08x)", + surfaceid); + ICO_TRA("CicoSCWindowController::updateSurfaceCB: Leave"); + return; + } + + // update attr + window->visible = visible; + window->srcwidth = srcwidth; + window->srcheight = srcheight; + window->x = x; + window->y = y; + window->width = width; + window->height = height; + window->nodeid = window->layerid / 1000; + + // notify to homescreen + CicoSCMessage *message = new CicoSCMessage(); + message->addRootObject("command", MSG_CMD_CHANGE_ATTR); + message->addRootObject("appid", window->appid); + const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid); + if (NULL != zone) { + message->addArgObject("zone", zone->fullname); + } + else { + message->addArgObject("zone", ""); + } + message->addArgObject("surface", window->surfaceid); + message->addArgObject("winname", window->name); + message->addArgObject("node", window->nodeid); + message->addArgObject("layer", window->layerid); + message->addArgObject("pos_x", window->x); + message->addArgObject("pos_y", window->y); + message->addArgObject("width", window->width); + message->addArgObject("height", window->height); + message->addArgObject("raise", window->raise ? 1 : 0); + message->addArgObject("visible", window->visible ? 1 : 0); + message->addArgObject("active", window->active ? 1 : 0); + CicoSCServer::getInstance()->sendMessageToHomeScreen(message); + + ICO_TRA("CicoSCWindowController::updateSurfaceCB: Leave"); +} + +//-------------------------------------------------------------------------- +/** + * @brief wayland surface destroy callback + * + * @param [in] data user data(unused) + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface + * @param [in] surfaceid ico_window_mgr surface Id + */ +//-------------------------------------------------------------------------- +void +CicoSCWindowController::destroySurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid) +{ + ICO_TRA("CicoSCWindowController::destroySurfaceCB: Enter(%08x)", surfaceid); + + CicoSCWindow *window = findWindow(surfaceid); + if (NULL == window) { + ICO_WRN("not found window(%08x)", surfaceid); + ICO_TRA("CicoSCWindowController::destroySurfaceCB Leave"); + return; + } + + // send message + CicoSCMessage *message = new CicoSCMessage(); + message->addRootObject("command", MSG_CMD_DESTROY); + message->addRootObject("appid", window->appid); + message->addRootObject("pid", window->pid); + message->addArgObject("surface", window->surfaceid); + message->addArgObject("winname", window->name); + CicoSCServer::getInstance()->sendMessageToHomeScreen(message); + + // TODO delete window in application + if (NULL != m_resMgr) { + CicoSCCommand cmd; + CicoSCCmdResCtrlOpt *opt = new CicoSCCmdResCtrlOpt(); + + cmd.cmdid = MSG_CMD_DESTORY_RES; + cmd.appid = window->appid; + cmd.pid = window->pid; + cmd.opt = opt; + + opt->dispres = true; + opt->winname = window->name; + opt->surfaceid = window->surfaceid; + + string fullname; + const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid); + if (NULL != zone) { + opt->dispzone = zone->fullname; + } + + opt->soundres = true; + opt->soundname = window->appid; + opt->soundid = 0; + CicoSystemConfig *sysconf = CicoSystemConfig::getInstance(); + const CicoSCDefaultConf *defconf = sysconf->getDefaultConf(); + if (NULL != defconf) { + const CicoSCSoundZoneConf *zoneconf = + sysconf->findSoundZoneConfbyId(defconf->soundzone); + if (NULL != zoneconf) { + opt->soundzone = zoneconf->fullname; + } + } + m_resMgr->handleCommand((const CicoSCCommand&)cmd, true); + } + // delete window in list + m_windowList.erase(window->surfaceid); + delete(window); + + ICO_TRA("CicoSCWindowController::destroySurfaceCB: Leave"); +} + +//-------------------------------------------------------------------------- +/** + * @brief wayland update surface name callback + * + * @param [in] surfaceid surface Id + * @param [in] winname surface name (title) + */ +//-------------------------------------------------------------------------- +void +CicoSCWindowController::updateWinnameCB(uint32_t surfaceid, + const char *winname) +{ + ICO_TRA("CicoSCWindowController::updateWinnameCB: Enter(%08x,<%s>)", + surfaceid, winname ? winname : "(null)"); + + CicoSCWindow *window = findWindow(surfaceid); + if (NULL == window) { + ICO_WRN("CicoSCWindowController::updateWinnameCB: not found window(%08x)", + surfaceid); + ICO_TRA("CicoSCWindowController::updateWinnameCB Leave"); + return; + } + + window->name = winname; + + // send message + CicoSCMessage *message = new CicoSCMessage(); + message->addRootObject("command", MSG_CMD_NAME); + message->addRootObject("appid", window->appid); + message->addRootObject("pid", window->pid); + message->addArgObject("surface", window->surfaceid); + message->addArgObject("winname", window->name); + CicoSCServer::getInstance()->sendMessageToHomeScreen(message); + + ICO_TRA("CicoSCWindowController::updateWinnameCB: Leave"); +} + +//-------------------------------------------------------------------------- +/** * @brief wayland display attribute callback * * @param [in] data user data(unused) @@ -1415,21 +1663,18 @@ CicoSCWindowController::createSurfaceCB(void *data, uint32_t id_surface) { int pid; - int ret; struct ilmSurfaceProperties SurfaceProperties; ICO_TRA("CicoSCWindowController::createSurfaceCB Enter" "(surfaceid=0x%08x)", id_surface); - if ((ilm_getPropertiesOfSurface(id_surface, &SurfaceProperties) != ILM_SUCCESS) || - (ilm_commitChanges() != ILM_SUCCESS)) { + if (ilm_getPropertiesOfSurface(id_surface, &SurfaceProperties) != ILM_SUCCESS) { ICO_ERR("CicoSCWindowController::createSurfaceCB: ilm_getPropertiesOfSurface(%x) Error", id_surface); return; } - ICO_TRA("createSurfaceCB: surface=%08x pid=%d w/h=%d/%d->%d/%d", - id_surface, SurfaceProperties.creatorPid, - SurfaceProperties.sourceWidth, SurfaceProperties.sourceHeight, + ICO_TRA("createSurfaceCB: surface=%08x w/h=%d/%d->%d/%d", + id_surface, SurfaceProperties.sourceWidth, SurfaceProperties.sourceHeight, SurfaceProperties.destWidth, SurfaceProperties.destHeight); CicoSCWindow* window = new CicoSCWindow(); @@ -1438,6 +1683,11 @@ CicoSCWindowController::createSurfaceCB(void *data, window->pid = pid; window->displayid = 0; // currently fixed 0 window->raise = 1; // created surface is top of layer + window->srcwidth = SurfaceProperties.sourceWidth; + window->srcheight = SurfaceProperties.sourceHeight; + window->width = SurfaceProperties.destWidth; + window->height = SurfaceProperties.destHeight; + window->layerid = 0; CicoSCLifeCycleController* appctrl; appctrl = CicoSCLifeCycleController::getInstance(); @@ -1475,19 +1725,52 @@ CicoSCWindowController::createSurfaceCB(void *data, return; } - CicoSCLayer *blayer = findLayer(window->displayid, window->layerid); - if (blayer) { - blayer->addSurface(window->surfaceid, true); + t_ilm_uint Dimansion[2]; + Dimansion[0] = window->srcwidth; + Dimansion[1] = window->srcheight; + t_ilm_uint Position[2]; + Position[0] = window->x; + Position[1] = window->y; + if (ilm_surfaceSetOpacity(window->surfaceid , (t_ilm_float)1.0f) != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::createSurfaceCB " + "ilm_surfaceSetOpacity(%08x) Error", window->surfaceid); + } + else if (ilm_surfaceSetDimension(window->surfaceid, Dimansion) != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::createSurfaceCB " + "ilm_surfaceSetDimension(%08x) Error", window->surfaceid); + } + else if (ilm_surfaceSetDestinationRectangle(window->surfaceid, window->x, window->y, + window->width, window->height) != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::createSurfaceCB " + "ilm_surfaceSetDestinationRectangle(%08x) Error", window->surfaceid); + } + else if (ilm_surfaceSetPosition(window->surfaceid, Position) != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::createSurfaceCB " + "ilm_surfaceSetPosition(%08x) Error", window->surfaceid); + } + else if (ilm_surfaceSetOrientation(window->surfaceid, ILM_ZERO) != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::createSurfaceCB " + "ilm_surfaceSetOrientation(%08x) Error", window->surfaceid); + } + + CicoSCLayer *layer = findLayer(window->displayid, window->layerid); + if (layer) { + if (ilm_layerAddSurface(window->layerid, window->surfaceid) != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::createSurfaceCB ilm_layerAddSurface(%d,%08x) " + "Error", window->layerid, window->surfaceid); + } + + layer->addSurface(window->surfaceid, true); int nsurf; - const int *surfs = blayer->getSurfaces(&nsurf); + const int *surfs = layer->getSurfaces(&nsurf); if (ilm_layerSetRenderOrder(window->layerid, (t_ilm_layer *)surfs, nsurf) != ILM_SUCCESS) { ICO_ERR("CicoSCWindowController::createSurfaceCB: " "ilm_layerSetRenderOrder(%d,,%d) Error", window->layerid, nsurf); } - else if (ilm_commitChanges() != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::createSurfaceCB ilm_commitChanges() Error"); - } + } + if (ilm_commitChanges() != ILM_SUCCESS) { + ICO_ERR("CicoSCWindowController::createSurfaceCB ilm_commitChanges() Error"); } appctrl->enterAUL(window->appid.c_str(), window->pid, window); @@ -1509,6 +1792,23 @@ CicoSCWindowController::createSurfaceCB(void *data, message->addArgObject("winname", window->name); CicoSCServer::getInstance()->sendMessageToHomeScreen(message); + if (0 == window->appid.compare(ICO_SC_APPID_DEFAULT_ONS)) { + CicoSCMessageRes *msgOS = new CicoSCMessageRes(); + msgOS->addRootObject("command", MSG_CMD_WINDOW_ID_RES); + msgOS->addRootObject("appid", window->appid); + msgOS->addRootObject("pid", window->pid); + msgOS->addWinObject(MSG_PRMKEY_ECU, ""); + msgOS->addWinObject(MSG_PRMKEY_DISPLAY, ""); + msgOS->addWinObject(MSG_PRMKEY_LAYER, ""); + msgOS->addWinObject(MSG_PRMKEY_LAYOUT, ""); + msgOS->addWinObject(MSG_PRMKEY_AREA, ""); + msgOS->addWinObject(MSG_PRMKEY_DISPATCHAPP, ""); + msgOS->addWinObject(MSG_PRMKEY_ROLE, window->name); + msgOS->addWinObject(MSG_PRMKEY_RESOURCEID, window->surfaceid); + CicoSCServer::getInstance()->sendMessage(window->appid, + (CicoSCMessage*)msgOS); + } + if (NULL != m_resMgr) { CicoSCCommand cmd; CicoSCCmdResCtrlOpt *opt = new CicoSCCmdResCtrlOpt(); @@ -1547,13 +1847,6 @@ CicoSCWindowController::createSurfaceCB(void *data, else { show(window->surfaceid, NULL, 0); } - - // add notification - if ((ret = ilm_surfaceAddNotification(window->surfaceid, wlGeniviSurfaceNotification)) - != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::createSurfaceCB ilm_surfaceAddNotification(%08x) " - "Error.%d", window->surfaceid, ret); - } ICO_TRA("CicoSCWindowController::createSurfaceCB Leave"); } @@ -1587,82 +1880,13 @@ CicoSCWindowController::wlGeniviLayerNotification(t_ilm_layer layer, //-------------------------------------------------------------------------- /** - * @brief genivi ivi-shell surface propaty callback - * - * @param [in] surface surface id - * @param [in] SurfaceProperties surface properties - * @param [in] mask change properties - */ -//-------------------------------------------------------------------------- -void -CicoSCWindowController::wlGeniviSurfaceNotification(t_ilm_surface surface, - struct ilmSurfaceProperties *SurfaceProperties, - t_ilm_notification_mask mask) -{ - int newVisible; - - ICO_TRA("CicoSCWindowController::wlGeniviSurfaceNotification Enter(%x,,%x)", surface, mask); - newVisible = SurfaceProperties->visibility ? ICO_SYC_WIN_VISIBLE_SHOW - : ICO_SYC_WIN_VISIBLE_HIDE; - CicoSCWindow *window = CicoSCWindowController::getInstance()->findWindow(surface); - if (NULL == window) { - ICO_WRN("CicoSCWindowController::wlGeniviSurfaceNotification Leave(surface=%08x not exist)", surface); - return; - } - if ((window->visible != newVisible) || - (window->x != (int)SurfaceProperties->destX) || - (window->y != (int)SurfaceProperties->destY) || - (window->width != (int)SurfaceProperties->destWidth) || - (window->height != (int)SurfaceProperties->destHeight)) { - // change visibility - window->visible = newVisible; - window->x = (int)SurfaceProperties->destX; - window->y = (int)SurfaceProperties->destY; - window->width = (int)SurfaceProperties->destWidth; - window->height = (int)SurfaceProperties->destHeight; - - // update attr - window->visible = newVisible; - - // notify to homescreen - CicoSCMessage *message = new CicoSCMessage(); - message->addRootObject("command", MSG_CMD_CHANGE_ATTR); - message->addRootObject("appid", window->appid); - const CicoSCDisplayZone* zone - = CicoSCWindowController::getInstance()->findDisplayZone(window->zoneid); - if (NULL != zone) { - message->addArgObject("zone", zone->fullname); - } - else { - message->addArgObject("zone", ""); - } - message->addArgObject("surface", window->surfaceid); - message->addArgObject("winname", window->name); - message->addArgObject("node", window->nodeid); - message->addArgObject("layer", window->layerid); - message->addArgObject("pos_x", window->x); - message->addArgObject("pos_y", window->y); - message->addArgObject("width", window->width); - message->addArgObject("height", window->height); - message->addArgObject("raise", window->raise ? 1 : 0); - message->addArgObject("visible", window->visible ? 1 : 0); - message->addArgObject("active", window->active ? 1 : 0); - CicoSCServer::getInstance()->sendMessageToHomeScreen(message); - } - else { - ICO_TRA("CicoSCWindowController::wlGeniviSurfaceNotification Leave(no change)"); - } -} - -//-------------------------------------------------------------------------- -/** - * @brief setup Genivi ivi-shell notification(callback) finctions + * @brief setup Genivi ivi-shell layer managerment system finctions * * @param none */ //-------------------------------------------------------------------------- void -CicoSCWindowController::initializeGeniviNotifications(void) +CicoSCWindowController::initializeGeniviLMS(void) { t_ilm_uint NumberOfScreens = 16; t_ilm_uint ScreenIds[16]; @@ -1670,30 +1894,31 @@ CicoSCWindowController::initializeGeniviNotifications(void) t_ilm_int LayerNumber; t_ilm_uint *pScreenIds = ScreenIds; struct ilmScreenProperties ScreenProperties; - int idx, DisplayId; + int idx, idx2; + int DisplayId, LayerId; const CicoSCDisplayConf *DisplayConf; const CicoSCLayerConf *LayerConf; - int LayerId; // get all screen id memset(ScreenIds, 0, sizeof(ScreenIds)); if ((ilm_getScreenIDs(&NumberOfScreens, &pScreenIds) != ILM_SUCCESS) || (ilm_commitChanges() != ILM_SUCCESS)) { - ICO_ERR("CicoSCWindowController::initializeGeniviNotifications " + ICO_ERR("CicoSCWindowController::initializeGeniviLMS " "ilm_getScreenIDs() Error"); return; } - ICO_TRA("initializeGeniviNotifications: Screens=%d.%x %x %x %x", + ICO_TRA("initializeGeniviLMS: Screens=%d.%x %x %x %x", NumberOfScreens, ScreenIds[0], ScreenIds[1], ScreenIds[2], ScreenIds[3]); for (idx = 0; idx < (int)NumberOfScreens; idx++) { - ICO_TRA("CicoSCWindowController::initializeGeniviNotifications: call ilm_getPropertiesOfScreen(%x)", ScreenIds[idx]); + ICO_TRA("CicoSCWindowController::initializeGeniviLMS: " + "call ilm_getPropertiesOfScreen(%x)", ScreenIds[idx]); if ((ilm_getPropertiesOfScreen(ScreenIds[idx], &ScreenProperties) != ILM_SUCCESS) || (ilm_commitChanges() != ILM_SUCCESS)) { - ICO_ERR("CicoSCWindowController::initializeGeniviNotifications " + ICO_ERR("CicoSCWindowController::initializeGeniviLMS " "ilm_getPropertiesOfScreen(%d.%x) Error", idx, ScreenIds[idx]); continue; } - ICO_TRA("CicoSCWindowController::initializeGeniviNotifications: " + ICO_TRA("CicoSCWindowController::initializeGeniviLMS: " "Screen[%d.%x] w/h=%d/%d layers=%d", idx, ScreenIds[idx], ScreenProperties.screenWidth, ScreenProperties.screenHeight, ScreenProperties.layerCount); @@ -1702,15 +1927,10 @@ CicoSCWindowController::initializeGeniviNotifications(void) if ((DisplayId < 0) || ((DisplayConf = CicoSystemConfig::getInstance()->findDisplayConfbyId(DisplayId)) == NULL)) { - ICO_ERR("CicoSCWindowController::initializeGeniviNotifications " + ICO_ERR("CicoSCWindowController::initializeGeniviLMS " "ScreenId.%x not found", ScreenIds[idx]); } else { -#if 0 // TODO - CicoSystemConfig::getInstance()->setDisplaySize(DisplayId, - ScreenProperties.screenWidth, - ScreenProperties.screenHeight); -#endif // set genivi layers for (idx = 0; ; idx++) { LayerConf = CicoSystemConfig::getInstance()-> @@ -1726,50 +1946,59 @@ CicoSCWindowController::initializeGeniviNotifications(void) findLayerConfbyIdx(DisplayId, idx); if (! LayerConf) break; - LayerId = (DisplayId << 16) | LayerConf->id; + LayerId = LayerConf->id + DisplayId * 1000; + for (idx2 = 0; idx2 < LayerNumber; idx2++) { + if (LayerId == (int)pLayerId[idx2]) break; + } + if (idx2 < LayerNumber) { + ICO_TRA("CicoSCWindowController::initializeGeniviLMS: " + "layer.%d exist, Skip", LayerId); + continue; + } + if (ilm_layerCreateWithDimension((t_ilm_layer *)&LayerId, DisplayConf->width, DisplayConf->height) != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::initializeGeniviNotifications " - "ilm_layerCreateWithDimension(%x,%d,%d) Error", + ICO_ERR("CicoSCWindowController::initializeGeniviLMS " + "ilm_layerCreateWithDimension(%d,%d,%d) Error", LayerId, DisplayConf->width, DisplayConf->height); } else if (ilm_commitChanges() != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::initializeGeniviNotifications " + ICO_ERR("CicoSCWindowController::initializeGeniviLMS " "ilm_commitChanges() Error"); } else if (ilm_layerSetOpacity(LayerId, (t_ilm_float)1.0f) != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::initializeGeniviNotifications " - "ilm_layerSetOpacity(%x) Error", LayerId); + ICO_ERR("CicoSCWindowController::initializeGeniviLMS " + "ilm_layerSetOpacity(%d) Error", LayerId); } else if (ilm_layerSetSourceRectangle(LayerId, 0, 0, DisplayConf->width, DisplayConf->height) != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::initializeGeniviNotifications " - "ilm_layerSetSourceRectangle(%x) Error", LayerId); + ICO_ERR("CicoSCWindowController::initializeGeniviLMS " + "ilm_layerSetSourceRectangle(%d) Error", LayerId); } else if (ilm_layerSetDestinationRectangle(LayerId, 0, 0, DisplayConf->width, DisplayConf->height) != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::initializeGeniviNotifications " - "ilm_layerSetDestinationRectangle(%x) Error", LayerId); + ICO_ERR("CicoSCWindowController::initializeGeniviLMS " + "ilm_layerSetDestinationRectangle(%d) Error", LayerId); } else if (ilm_layerSetOrientation(LayerId, ILM_ZERO) != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::initializeGeniviNotifications " - "ilm_layerSetOrientation(%x) Error", LayerId); + ICO_ERR("CicoSCWindowController::initializeGeniviLMS " + "ilm_layerSetOrientation(%d) Error", LayerId); } else if (ilm_layerSetOrientation(LayerId, ILM_ZERO) != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::initializeGeniviNotifications " - "ilm_layerSetOrientation(%x) Error", LayerId); + ICO_ERR("CicoSCWindowController::initializeGeniviLMS " + "ilm_layerSetOrientation(%d) Error", LayerId); } else if (ilm_layerAddNotification(LayerId, wlGeniviLayerNotification) != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::initializeGeniviNotifications " - "ilm_layerAddNotification(%x) Error", LayerId); + ICO_ERR("CicoSCWindowController::initializeGeniviLMS " + "ilm_layerAddNotification(%d) Error", LayerId); } else { if (ilm_commitChanges() != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::initializeGeniviNotifications " + ICO_ERR("CicoSCWindowController::initializeGeniviLMS " "ilm_commitChanges() Error"); } - ICO_TRA("initializeGeniviNotifications: layer=%x created(%d,%d)", + ICO_TRA("initializeGeniviLMS: layer=%d created(%d,%d)", LayerId, DisplayConf->width, DisplayConf->height); *ppLayerId = LayerId; ppLayerId ++; @@ -1779,19 +2008,19 @@ CicoSCWindowController::initializeGeniviNotifications(void) if (LayerNumber > 0) { if (ilm_displaySetRenderOrder(ScreenIds[idx], pLayerId, LayerNumber) != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::initializeGeniviNotifications " + ICO_ERR("CicoSCWindowController::initializeGeniviLMS " "ilm_displaySetRenderOrder(%d) Error", LayerNumber); } else if (ilm_commitChanges() != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::initializeGeniviNotifications " + ICO_ERR("CicoSCWindowController::initializeGeniviLMS " "ilm_commitChanges() Error"); } ppLayerId = pLayerId; for (idx = 0; idx < LayerNumber; idx++) { if (ilm_layerAddNotification(*ppLayerId, wlGeniviLayerNotification) != ILM_SUCCESS) { - ICO_ERR("CicoSCWindowController::initializeGeniviNotifications " - "ilm_layerAddNotification(%x) Error", *ppLayerId); + ICO_ERR("CicoSCWindowController::initializeGeniviLMS " + "ilm_layerAddNotification(%d) Error", *ppLayerId); } ppLayerId ++; } @@ -2020,7 +2249,7 @@ CicoSCWindowController::notifyResourceManager(int surfaceid, else { opt->dispzone = zone; } -#if 1 +#if 1 //TODO opt->soundres = true; opt->soundname = window->appid; opt->soundid = 0; @@ -2040,4 +2269,26 @@ CicoSCWindowController::notifyResourceManager(int surfaceid, ICO_TRA("CicoSCWindowController::notifyResourceManager Leave(EOK)"); return ICO_SYC_EOK; } + +const CicoSCWindow* +CicoSCWindowController::findWindowObj(int32_t pid, uint32_t surfaceid) const +{ + const CicoSCWindow* r = NULL; + map::const_iterator itr = m_windowList.begin(); + for (; itr != m_windowList.end(); ++itr) { + const CicoSCWindow* tmp = itr->second; + if ((pid == tmp->pid) && (surfaceid == (uint32_t)tmp->surfaceid)) { + r = tmp; + break; // break of for itr + } + } + ICO_TRA("return %x", r); + return r; +} + +const CicoSCResourceManager* +CicoSCWindowController::getResourceManager(void) const +{ + return m_resMgr; +} // vim:set expandtab ts=4 sw=4: diff --git a/lib/system-controller/CicoSCWindowController.h b/lib/system-controller/CicoSCWindowController.h index de61303..7ac6eca 100644 --- a/lib/system-controller/CicoSCWindowController.h +++ b/lib/system-controller/CicoSCWindowController.h @@ -24,6 +24,8 @@ using namespace std; #include "CicoSCWlWinMgrIF.h" +#define ICO_SC_APPID_DEFAULT_ONS "org.tizen.ico.onscreen" + //========================================================================== // Forward declaration //========================================================================== @@ -123,15 +125,11 @@ public: int setAttributes(int surfaceid); - static void initializeGeniviNotifications(void); + void initializeGeniviLMS(void); static void wlGeniviLayerNotification(t_ilm_layer layer, struct ilmLayerProperties *LayerProperties, t_ilm_notification_mask mask); - - static void wlGeniviSurfaceNotification(t_ilm_surface surface, - struct ilmSurfaceProperties *SurfaceProperties, - t_ilm_notification_mask mask); // virtual void activeCB(void *data, struct ico_window_mgr *ico_window_mgr, @@ -148,6 +146,24 @@ public: int32_t stride, uint32_t format); + virtual void updateSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid, + int visible, + int srcwidth, + int srcheight, + int x, + int y, + int width, + int height); + + virtual void destroySurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid); + + virtual void updateWinnameCB(uint32_t surfaceid, + const char *winname); +// virtual void outputGeometryCB(void *data, struct wl_output *wl_output, int32_t x, @@ -170,6 +186,10 @@ public: struct ivi_controller *ivi_controller, uint32_t id_surface); + const CicoSCWindow* findWindowObj(int32_t pid, uint32_t surfaceid) const; + + const CicoSCResourceManager* getResourceManager(void) const; + private: // assignment operator CicoSCWindowController& operator=(const CicoSCWindowController &object); @@ -186,6 +206,8 @@ private: // fine display zone by id const CicoSCDisplayZone * findDisplayZone(int zoneid); + void raiselower(CicoSCWindow *window, bool raise); + int notifyResourceManager(int surfaceid, const char *zone, int layerid, diff --git a/lib/system-controller/CicoSCWlWinMgrIF.cpp b/lib/system-controller/CicoSCWlWinMgrIF.cpp index cdd1c38..342a510 100644 --- a/lib/system-controller/CicoSCWlWinMgrIF.cpp +++ b/lib/system-controller/CicoSCWlWinMgrIF.cpp @@ -51,6 +51,8 @@ CicoSCWlWinMgrIF::CicoSCWlWinMgrIF() // ico_window_mgr listener m_listener.window_active = wlActiveCB; m_listener.map_surface = wlMapSurfaceCB; + m_listener.update_surface = wlUpdateSurfaceCB; + m_listener.destroy_surface = wlDestroySurfaceCB; // genivi ivi_application listener m_ivi_app_listener.error = wlIviAppErrorCB; @@ -202,11 +204,23 @@ CicoSCWlWinMgrIF::setWindowLayer(uint32_t surfaceid, uint32_t layer, uint32_t ol ICO_DBG("CicoSCWlWinMgrIF::setWindowLayer: " "surfaceid=0x%08X layer=%d->%d", surfaceid, oldlayer, layer); + if (oldlayer == layer) { + ICO_DBG("CicoSCWlWinMgrIF::setWindowLayer: new layer same as old, NOP"); + return; + } + // remove original layer if (oldlayer <= 0x7fffffff) { ICO_TRA("CicoSCWlWinMgrIF::setWindowLayer: remove surface %08x " "from layer(%d)", surfaceid, oldlayer); - (void) ilm_layerRemoveSurface(oldlayer, surfaceid); + if (ilm_layerRemoveSurface(oldlayer, surfaceid) != ILM_SUCCESS) { + ICO_ERR("CicoSCWlWinMgrIF::setWindowLayer ilm_layerRemoveSurface(%d,%08x) " + "Error", oldlayer, surfaceid); + } + // must need ilm_commitChanges() after ilm_layerRemoveSurface() + if (ilm_commitChanges() != ILM_SUCCESS) { + ICO_ERR("CicoSCWlWinMgrIF::setWindowLayer ilm_commitChanges Error"); + } } else { ICO_TRA("CicoSCWlWinMgrIF::setWindowLayer: surface %08x has no old layer(%d)", @@ -233,24 +247,39 @@ CicoSCWlWinMgrIF::setWindowLayer(uint32_t surfaceid, uint32_t layer, uint32_t ol * @param [in] y * @param [in] width * @param [in] height - * @param [in] flags (unused) */ //-------------------------------------------------------------------------- void CicoSCWlWinMgrIF::setPositionsize(uint32_t surfaceid, uint32_t node, - int32_t x, int32_t y, int32_t width, - int32_t height, int32_t flags) + int32_t x, int32_t y, int32_t width, int32_t height) { // set position size request to Multi Window Manager ICO_DBG("called: ilm_surfaceSetDestinationRectangle" - "(surfaceid=0x%08X node=%d x=%d y=%d w=%d h=%d flags=%d)", - surfaceid, node, x, y, width, height, flags); - if ((ilm_surfaceSetDestinationRectangle(surfaceid, x, y, width, height) - != ILM_SUCCESS) || - (ilm_commitChanges() != ILM_SUCCESS)) { + "(surfaceid=0x%08X node=%d x=%d y=%d w=%d h=%d)", + surfaceid, node, x, y, width, height); + + t_ilm_uint Dimansion[2]; + Dimansion[0] = width; + Dimansion[1] = height; + t_ilm_uint Position[2]; + Position[0] = x; + Position[1] = y; + + if (ilm_surfaceSetDimension(surfaceid, Dimansion) != ILM_SUCCESS) { + ICO_ERR("CicoSCWlWinMgrIF::setPositionsize " + "ilm_surfaceSetDimension(%08x) Error", surfaceid); + } + else if (ilm_surfaceSetPosition(surfaceid, Position) != ILM_SUCCESS) { + ICO_ERR("CicoSCWlWinMgrIF::setPositionsize " + "ilm_surfaceSetPosition(%08x) Error", surfaceid); + } + else if (ilm_surfaceSetDestinationRectangle(surfaceid, x, y, width, height) + != ILM_SUCCESS) { ICO_ERR("CicoSCWlWinMgrIF::setPositionsize ilm_surfaceSetDestinationRectangle" - "(%08x,%d,%d,%d,%d) Error", - surfaceid, x, y, width, height); + "(%08x,%d,%d,%d,%d) Error", surfaceid, x, y, width, height); + } + else if (ilm_commitChanges() != ILM_SUCCESS) { + ICO_ERR("CicoSCWlWinMgrIF::setPositionsize ilm_commitChanges() Error"); } } @@ -260,26 +289,19 @@ CicoSCWlWinMgrIF::setPositionsize(uint32_t surfaceid, uint32_t node, * * @param [in] surfaceid wayland surface id * @param [in] visible visible state - * @param [in] raise raise state - * @param [in] flags (unused) */ //-------------------------------------------------------------------------- void -CicoSCWlWinMgrIF::setVisible(uint32_t surfaceid, int32_t visible, - int32_t raise, int32_t flags) +CicoSCWlWinMgrIF::setVisible(uint32_t surfaceid, int32_t visible) { // set visible request to Multi Window Manager - ICO_DBG("called: ilm_surfaceSetVisibility" - "(surfaceid=0x%08X visible=%d raise=%d anima=%d)", - surfaceid, visible, raise, flags); + ICO_DBG("called: ilm_surfaceSetVisibility(surfaceid=0x%08X visible=%d)", + surfaceid, visible); if ((visible == ICO_SYC_WIN_VISIBLE_SHOW) || (visible == ICO_SYC_WIN_VISIBLE_HIDE)) { ilm_surfaceSetVisibility(surfaceid, visible); - } - if ((raise == ICO_SYC_WIN_RAISE_RAISE) || (raise == ICO_SYC_WIN_RAISE_LOWER)) { - // TODO: need raise/lower control - } - if (ilm_commitChanges() != ILM_SUCCESS) { - ICO_ERR("CicoSCWlWinMgrIF::setVisible: ilm_commitChanges() Error"); + if (ilm_commitChanges() != ILM_SUCCESS) { + ICO_ERR("CicoSCWlWinMgrIF::setVisible: ilm_commitChanges() Error"); + } } } @@ -510,6 +532,69 @@ CicoSCWlWinMgrIF::mapSurfaceCB(void *data, //-------------------------------------------------------------------------- /** + * @brief surface update event callback + * + * @param [in] data user data(unused) + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface + * @param [in] surfaceid surface Id + * @param [in] visible visibility + * @param [in] srcwidth application buffer width + * @param [in] srcheight application buffer height + * @param [in] x X + * @param [in] y Y + * @param [in] width width + * @param [in] height height + */ +//-------------------------------------------------------------------------- +void +CicoSCWlWinMgrIF::updateSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid, + int visible, + int srcwidth, + int srcheight, + int x, + int y, + int width, + int height) +{ + ICO_WRN("CicoSCWlWinMgrIF::updateSurfaceCB called."); +} + +//-------------------------------------------------------------------------- +/** + * @brief wayland surface destroy callback + * + * @param [in] data user data(unused) + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface + * @param [in] surfaceid surface Id + */ +//-------------------------------------------------------------------------- +void +CicoSCWlWinMgrIF::destroySurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid) +{ + ICO_WRN("CicoSCWlWinMgrIF::destroySurfaceCB called."); +} + +//-------------------------------------------------------------------------- +/** + * @brief wayland update surface name callback + * + * @param [in] surfaceid surface Id + * @param [in] winname surface name (title) + */ +//-------------------------------------------------------------------------- +void +CicoSCWlWinMgrIF::updateWinnameCB(uint32_t surfaceid, + const char *winname) +{ + ICO_WRN("CicoSCWlWinMgrIF::updateWinnameCB called."); +} + +//-------------------------------------------------------------------------- +/** * @brief wayland display attribute callback * * @param [in] data user data(unused) @@ -653,6 +738,74 @@ CicoSCWlWinMgrIF::wlMapSurfaceCB(void *data, //-------------------------------------------------------------------------- /** + * @brief surface update event callback + * + * @param [in] data user data + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface + * @param [in] surfaceid surface Id + * @param [in] visible visibility + * @param [in] srcwidth application buffer width + * @param [in] srcheight application buffer height + * @param [in] x X + * @param [in] y Y + * @param [in] width width + * @param [in] height height + */ +//-------------------------------------------------------------------------- +void +CicoSCWlWinMgrIF::wlUpdateSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid, + int visible, + int srcwidth, + int srcheight, + int x, + int y, + int width, + int height) +{ +// ICO_TRA("CicoSCWlWinMgrIF::wlUpdateSurfaceCB Enter"); + + if (NULL == data) { + ICO_WRN("wlUpdateSurfaceCB: data is null"); + return; + } + static_cast(data)->updateSurfaceCB(data, ico_window_mgr, + surfaceid, visible, + srcwidth, srcheight, + x, y, width, height); +// ICO_TRA("CicoSCWlWinMgrIF::wlUpdateSurfaceCB Leave"); +} + +//-------------------------------------------------------------------------- +/** + * @brief surface destroy event callback + * + * @param [in] data user data + * @param [in] ico_window_mgr wayland ico_window_mgr plugin interface + * @param [in] surfaceid surface Id + */ +//-------------------------------------------------------------------------- +void +CicoSCWlWinMgrIF::wlDestroySurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid) +{ +// ICO_TRA("CicoSCWlWinMgrIF::wlDestroySurfaceCB Enter"); + + if (NULL == data) { + ICO_WRN("wlDestroySurfaceCB: data is null"); + return; + } + wlIviCtrlRemoveSurface(surfaceid); + + static_cast(data)->destroySurfaceCB(data, ico_window_mgr, + surfaceid); +// ICO_TRA("CicoSCWlWinMgrIF::wlDestroySurfaceCB Leave"); +} + +//-------------------------------------------------------------------------- +/** * @brief wayland display attribute callback * * @param [in] data user data(unused) @@ -830,6 +983,10 @@ CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB(void *data, strncpy(tp->title, title, ICO_SYC_MAX_WINNAME_LEN-1); tp->create_time = nowtime; + if (tp->id_surface) { + static_cast(data)->updateWinnameCB(tp->id_surface, tp->title); + } + ICO_TRA("CicoSCWlWinMgrIF::wlIviAppNativeShellInfoCB: Leave"); } diff --git a/lib/system-controller/CicoSCWlWinMgrIF.h b/lib/system-controller/CicoSCWlWinMgrIF.h index 1e5671c..252afc8 100644 --- a/lib/system-controller/CicoSCWlWinMgrIF.h +++ b/lib/system-controller/CicoSCWlWinMgrIF.h @@ -65,6 +65,23 @@ public: int32_t stride, uint32_t format); + virtual void updateSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid, + int visible, + int srcwidth, + int srcheight, + int x, + int y, + int width, + int height); + + virtual void destroySurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid); + + virtual void updateWinnameCB(uint32_t surfaceid, + const char *winname); // virtual void outputGeometryCB(void *data, struct wl_output *wl_output, @@ -108,12 +125,10 @@ protected: // wrapper function ico_window_mgr_set_positionsize void setPositionsize(uint32_t surfaceid, uint32_t node, - int32_t x, int32_t y, int32_t width, - int32_t height, int32_t flags); + int32_t x, int32_t y, int32_t width, int32_t height); // wrapper function ico_window_mgr_set_visible - void setVisible(uint32_t surfaceid, int32_t visible, - int32_t raise, int32_t flags); + void setVisible(uint32_t surfaceid, int32_t visible); // wrapper function of ico_window_mgr_set_animation void setAnimation(uint32_t surfaceid, int32_t type, @@ -153,6 +168,20 @@ private: int32_t stride, uint32_t format); + static void wlUpdateSurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid, + int layer, + int srcwidth, + int srcheight, + int x, + int y, + int width, + int height); + + static void wlDestroySurfaceCB(void *data, + struct ico_window_mgr *ico_window_mgr, + uint32_t surfaceid); // static void wlOutputGeometryCB(void *data, struct wl_output *wl_output, @@ -227,6 +256,9 @@ protected: // Wayland's genivi ivi_controller instance static struct ivi_controller *m_ivi_ctrl; + // Wayland's genivi ivi_controller_surface instance + static struct ivi_controller_surface *m_ivi_ctrl_surf; + // wayland output instance static struct wl_output *m_wloutput; diff --git a/lib/system-controller/Makefile.am b/lib/system-controller/Makefile.am index f3c04ac..082ade4 100644 --- a/lib/system-controller/Makefile.am +++ b/lib/system-controller/Makefile.am @@ -24,6 +24,7 @@ libico_system_controller_la_SOURCES = \ CicoSCServer.cpp \ CicoSCCommand.cpp \ CicoSCMessage.cpp \ + CicoSCMessageRes.cpp \ CicoSCUser.cpp \ CicoSCUserManager.cpp \ CicoSCSysResourceController.cpp \ diff --git a/lib/system-controller/ico_syc_mrp_resource_private.h b/lib/system-controller/ico_syc_mrp_resource_private.h index 8abcb82..6faab21 100644 --- a/lib/system-controller/ico_syc_mrp_resource_private.h +++ b/lib/system-controller/ico_syc_mrp_resource_private.h @@ -83,6 +83,16 @@ typedef struct _resource_request { int surfaceid; /* window id */ char *animation; /* name of animation */ int animationTime; /* time of animation[ms] */ + bool bEx; /* Expansion flag */ + char *ECU; /* name to identify ECU */ + char *display; /* name to identify Display in ECU */ + char *layer; /* name to identify Layer in Display */ + char *layout; /* name to identify layout in Layer */ + char *area; /* name to Output position in Layout */ + char *dispatchApp; /* origin of application */ + char *role; /* role of notice kind */ + int role_stt; /* state number change from role */ + int resourceId; /* ID number of resource */ char *soundzone; /* area of playing sound */ int soundzoneid; /* area of playing sound */ diff --git a/packaging/ico-uxf-homescreen.changes b/packaging/ico-uxf-homescreen.changes index 2bd4f09..b5e7a3f 100644 --- a/packaging/ico-uxf-homescreen.changes +++ b/packaging/ico-uxf-homescreen.changes @@ -1,3 +1,9 @@ +* 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. +-- Some interfaces were added for SystemController corresponding to GENIVI layer management. +-- It changes so that the layer controlling function of GENIVI may be used for surface management and layer management. + * Fri Feb 14 2014 Shibata Makoto submit/tizen/20140214.023123@397e77f - 0.9.14 release -- add: TIVI-1751 Home Screen needs to use system notifications framework diff --git a/packaging/ico-uxf-homescreen.spec b/packaging/ico-uxf-homescreen.spec index e407551..6c8a649 100644 --- a/packaging/ico-uxf-homescreen.spec +++ b/packaging/ico-uxf-homescreen.spec @@ -33,9 +33,13 @@ BuildRequires: pkgconfig(murphy-resource) BuildRequires: pkgconfig(notification) BuildRequires: boost-devel BuildRequires: mesa-devel +BuildRequires: weston-ivi-shell +BuildRequires: weston-ivi-shell-devel BuildRequires: genivi-shell +BuildRequires: genivi-shell-devel BuildRequires: ico-uxf-utilities-devel >= 0.9.07 Requires: weston >= 1.4 +Requires: weston-ivi-shell Requires: genivi-shell Requires: ico-uxf-weston-plugin >= 0.9.21 Requires: ico-uxf-utilities >= 0.9.07 diff --git a/res/org.tizen.ico.system-controller/res/config/policy.json b/res/org.tizen.ico.system-controller/res/config/policy.json index bb9a115..f6efa92 100644 --- a/res/org.tizen.ico.system-controller/res/config/policy.json +++ b/res/org.tizen.ico.system-controller/res/config/policy.json @@ -1036,32 +1036,32 @@ }, "state":{ - "name":"OnScreen", + "name":"OnScreen_Priority", "value":14000, "state":{ "name":"OnScreen_Invisible", "value":14999, - "event":{"name":"EV14000", "value":14000, "transition":14001, "guardCondition":[{"operator":"=", "value":1}]}, - "event":{"name":"EV14000", "value":14000, "transition":14002, "guardCondition":[{"operator":"=", "value":2}]}, - "event":{"name":"EV14000", "value":14000, "transition":14003, "guardCondition":[{"operator":"=", "value":3}]} + "event":{"name":"EV14001", "value":14001, "transition":14001}, + "event":{"name":"EV14002", "value":14002, "transition":14002}, + "event":{"name":"EV14003", "value":14003, "transition":14003} }, "state":{ - "name":"OnScreen_Warning", + "name":"OnScreen_PriorityLevel1", "value":14001, - "event":{"name":"EV14001", "value":14001, "transition":14999} + "event":{"name":"EV14999", "value":14999, "transition":14999} }, "state":{ - "name":"OnScreen_Attention", + "name":"OnScreen_PriorityLevel2", "value":14002, - "event":{"name":"EV14001", "value":14001, "transition":14999}, - "event":{"name":"EV14000", "value":14000, "transition":14001, "guardCondition":[{"operator":"=", "value":1}]} + "event":{"name":"EV14001", "value":14001, "transition":14001}, + "event":{"name":"EV14999", "value":14999, "transition":14999} }, "state":{ - "name":"OnScreen_Message", + "name":"OnScreen_PriorityLevel3", "value":14003, - "event":{"name":"EV14001", "value":14001, "transition":14999}, - "event":{"name":"EV14000", "value":14000, "transition":14001, "guardCondition":[{"operator":"=", "value":1}]}, - "event":{"name":"EV14000", "value":14000, "transition":14002, "guardCondition":[{"operator":"=", "value":2}]} + "event":{"name":"EV14001", "value":14001, "transition":14001}, + "event":{"name":"EV14002", "value":14002, "transition":14002}, + "event":{"name":"EV14999", "value":14999, "transition":14999} } }, diff --git a/res/org.tizen.ico.system-controller/res/config/system.xml b/res/org.tizen.ico.system-controller/res/config/system.xml index 76f1f97..c8f3d72 100644 --- a/res/org.tizen.ico.system-controller/res/config/system.xml +++ b/res/org.tizen.ico.system-controller/res/config/system.xml @@ -30,31 +30,47 @@ 2 false - - 101 - false - - + 3 false - + 3 false - + 4 false - - 5 - true + + + + + + 5 + true + + + + + + + 5 + true + + + 5 + true + + + + - + 102 false - + 103 false @@ -425,5 +441,24 @@ + + + + + + + + + + + + + + 0 + 0 + 1080 + 1920 + + diff --git a/src/homescreen/CicoHomeScreen.cpp b/src/homescreen/CicoHomeScreen.cpp index ee4e762..5ce5b46 100644 --- a/src/homescreen/CicoHomeScreen.cpp +++ b/src/homescreen/CicoHomeScreen.cpp @@ -856,15 +856,23 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event, // On Screen hs_instance->os_app_info->AddWindowInfo(win_info); - // show onscreen window - ico_syc_show(win_info->appid, win_info->surface, NULL); - // change the layer of onscreen window ico_syc_change_layer(win_info->appid, win_info->surface, HS_LAYER_ONSCREEN); - // hide onscreen layer - ico_syc_hide_layer(HS_LAYER_ONSCREEN); + const CicoSCPositionOSConf* oPOSC = + CicoSystemConfig::getInstance()->positionOSConf(); + ico_syc_win_move_t move; + move.zone = NULL; + move.layer = HS_LAYER_ONSCREEN; + move.pos_x = oPOSC->m_x; + move.pos_y = oPOSC->m_y; + move.width = oPOSC->m_w; + move.height = oPOSC->m_h; + ico_syc_animation_t animation; + animation.name = (char*)ICO_HS_MENU_SHOW_ANIMATION_SLIDE; + animation.time = ICO_HS_MENU_ANIMATION_DURATION; + ico_syc_move(win_info->appid, win_info->surface, &move, &animation); } else { diff --git a/src/homescreen/CicoHomeScreenCommon.h b/src/homescreen/CicoHomeScreenCommon.h index 36e5015..0161d22 100644 --- a/src/homescreen/CicoHomeScreenCommon.h +++ b/src/homescreen/CicoHomeScreenCommon.h @@ -104,12 +104,12 @@ #define HS_LAYER_APPLICATION ICO_SYC_LAYER_APPLICATION /* layer of Application */ #define HS_LAYER_HOMESCREEN ICO_SYC_LAYER_HOMESCREEN /* layer of HomeScreen menu */ #define HS_LAYER_CONTROLBAR ICO_SYC_LAYER_CONTROLBAR /* layer of Control/Status bar */ -#define HS_LAYER_FULLSCREEN ICO_SYC_LAYER_FULLSCREEN /* layer of FullScreen Application */ +#define HS_LAYER_INTERRUPTAPP ICO_SYC_LAYER_INTERRUPTAPP /* layer of Interrupt Application */ #define HS_LAYER_ONSCREEN ICO_SYC_LAYER_ONSCREEN /* layer of OnScreen */ #define HS_LAYER_TOUCHPANEL ICO_SYC_LAYER_TOUCHPANEL /* layer of TouchPanel input */ #define HS_LAYER_CURSOR ICO_SYC_LAYER_CURSOR /* layer of Cursor */ -#define HS_LAYER_2NDDISP_APP ICO_SYC_LAYER_MATERAPP /* second display application layer */ +#define HS_LAYER_2NDDISP_APP ICO_SYC_LAYER_MATERMAIN /* second display application layer */ /* config history name */ #define ICO_HS_CONFIG_HSTRY_KEY1 "timer" diff --git a/src/onscreen/CicoOSEFLApp.cpp b/src/onscreen/CicoOSEFLApp.cpp index 4f61181..89e09f4 100644 --- a/src/onscreen/CicoOSEFLApp.cpp +++ b/src/onscreen/CicoOSEFLApp.cpp @@ -104,7 +104,6 @@ CicoOSEFLApp::onTerminate(void *user_data) { ICO_TRA("CicoOSEFLApp::onTerminate Enter"); - m_onscreen->Finalize(); delete m_onscreen; ICO_TRA("CicoOSEFLApp::onTerminate Leave"); diff --git a/src/onscreen/CicoOnScreen.cpp b/src/onscreen/CicoOnScreen.cpp index 388d21f..270d07f 100644 --- a/src/onscreen/CicoOnScreen.cpp +++ b/src/onscreen/CicoOnScreen.cpp @@ -12,6 +12,7 @@ * @date Jan-07-2014 */ #include "CicoOnScreen.h" +#include "CicoOSPopWindow.h" #include #include @@ -21,7 +22,6 @@ using namespace std; // static members //========================================================================== CicoOnScreen * CicoOnScreen::os_instance=NULL; -struct popup_data CicoOnScreen::ico_appdata; //========================================================================== // functions @@ -39,9 +39,9 @@ struct popup_data CicoOnScreen::ico_appdata; CicoOnScreen::CicoOnScreen(void) { ICO_TRA("CicoOnScreen::CicoOnScreen Enter"); - - InitializePopupData(); - + m_request = NULL; + m_del = false; + m_reserve = NULL; ICO_TRA("CicoOnScreen::CicoOnScreen Leave"); } @@ -57,30 +57,24 @@ CicoOnScreen::CicoOnScreen(void) CicoOnScreen::~CicoOnScreen(void) { // ICO_TRA("CicoOnScreen::~CicoOnScreen Enter"); -// ICO_TRA("CicoOnScreen::~CicoOnScreen Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief CicoOnScreen::InitializePopupData - * Initialize popup struct data - * - * @param[in] none - * @return none - */ -//-------------------------------------------------------------------------- -void -CicoOnScreen::InitializePopupData(void) -{ - ICO_TRA("CicoOnScreen::InitializePopupData Enter"); - - ico_appdata.window = NULL; - ico_appdata.icon = NULL; - ico_appdata.noti = NULL; - ico_appdata.show_flag = FALSE; - ico_appdata.noti = NULL; + list::iterator p = m_mngWin.begin(); + while (p != m_mngWin.end()) { + CicoOSPopWindow* pt = *p; + delete pt; + } + m_mngWin.clear(); + p = m_waitMngWin.begin(); + while (p != m_waitMngWin.end()) { + CicoOSPopWindow* pt = *p; + delete pt; + } + m_waitMngWin.clear(); - ICO_TRA("CicoOnScreen::InitializePopupData Leave"); + if (NULL != m_request) { + delete m_request; + m_request = NULL; + } +// ICO_TRA("CicoOnScreen::~CicoOnScreen Leave"); } //-------------------------------------------------------------------------- @@ -96,7 +90,7 @@ CicoOnScreen::InitializePopupData(void) bool CicoOnScreen::StartOnScreen(void) { - ICO_TRA("CicoOnScreen::StartOnScreen Enter"); + ICO_TRA("Enter"); ico_syc_connect(EventCallBack, NULL); @@ -105,250 +99,73 @@ CicoOnScreen::StartOnScreen(void) // Initialize ecore_evas_init(); - InitializePopup(); + + if (NULL == m_reserve) { + m_reserve = new CicoOSPopWindow(NOTIFICATION_TYPE_NONE); + } // set notification callback function notiservice_.SetCallback(NotificationCallback, this); - ICO_TRA("CicoOnScreen::StartOnScreen Leave(true)"); + ICO_TRA("Leave(true)"); return true; } -//-------------------------------------------------------------------------- -/** - * @brief CicoOnScreen::Finalize - * Finalize - * - * @param[in] none - * @return none - */ -//-------------------------------------------------------------------------- -void -CicoOnScreen::Finalize(void) +bool CicoOnScreen::insertNoti(notification_h noti_h) { - ICO_TRA("CicoOnScreen::Finalize Enter"); - - // Free window handle - if (ico_appdata.window != NULL) { - ecore_evas_free(ico_appdata.window); + ICO_TRA("Enter"); + CicoOSPopWindow* w = new CicoOSPopWindow(noti_h); + if (NULL == w) { + ICO_ERR("FAIL new class"); + ICO_TRA("Leave (false)"); + return false; } - - ICO_TRA("CicoOnScreen::Finalize Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief CicoOnScreen::ShowPopup - * Show popup window - * - * @param[in] none - * @return none - */ -//-------------------------------------------------------------------------- -void -CicoOnScreen::ShowPopup(CicoNotification ¬i) -{ - ICO_TRA("CicoOnScreen::ShowPopup Enter"); - - ico_appdata.noti = new CicoNotification(noti.GetNotiHandle()); - - // get caller pachage name - const char *pkgname = noti.GetPkgname(); - - // get priv_id - int priv_id = noti.GetPrivId(); - - // Get title - const char *title = noti.GetTitle(); - - // Get content - const char *content = noti.GetContent(); - - // Get execute option - const char *text = NULL; - bundle *service_handle = NULL; - (void)noti.GetExecuteOption(NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, - &text, &service_handle); - - // Get icon path - const char *icon = noti.GetIconPath(); - ICO_DBG("Received: %s : %i : %s : %s : %s : %x", - pkgname, priv_id, title, content, - text, (int)service_handle); - - if (icon) { - if (NULL != ico_appdata.icon) { - evas_object_image_file_set(ico_appdata.icon, icon, NULL); - evas_object_show(ico_appdata.icon); - } - } - - if (title) { - if (!edje_object_part_text_set(ico_appdata.theme, "title_text", title)) { - ICO_WRN("could not set the text. Maybe part 'text' does not exist?"); - } - } - - if (content) { - if (strlen(content) <= 25) { - ICO_DBG("content text center"); - if (!edje_object_part_text_set(ico_appdata.theme, "content_text_center", content)) { - ICO_WRN("could not set the text. Maybe part 'text' does not exist?"); - } - if (!edje_object_part_text_set(ico_appdata.theme, "content_text_left", "")) { - ICO_WRN("could not set the text. Maybe part 'text' does not exist?"); - } - } - else { - ICO_DBG("content text left"); - if (!edje_object_part_text_set(ico_appdata.theme, "content_text_left", content)) { - ICO_WRN("could not set the text. Maybe part 'text' does not exist?"); - } - if (!edje_object_part_text_set(ico_appdata.theme, "content_text_center", "")) { - ICO_WRN("could not set the text. Maybe part 'text' does not exist?"); - } - } - } - - if (text) { - if (!edje_object_part_text_set(ico_appdata.theme, "button_text", text)) { - ICO_WRN("could not set the text. Maybe part 'text' does not exist?"); + if (!w->Empty()) { + if (NOTIFICATION_TYPE_NOTI == w->GetType()) { + m_waitMngWin.push_back(w); + w = NULL; } } - else { - if (!edje_object_part_text_set(ico_appdata.theme, "button_text", "OK")) { - ICO_WRN("could not set the text. Maybe part 'text' does not exist?"); - } + if (NULL != w) { + delete w; + w = NULL; + ICO_TRA("Leave (false)"); + return false; } - - evas_object_show(ico_appdata.theme); - - // TODO show onscreen layer - ico_syc_show_layer(6); - - ecore_evas_show(ico_appdata.window); - - ICO_TRA("CicoOnScreen::ShowPopup Leave"); + ICO_TRA("Leave (true)"); + return true; } - -//-------------------------------------------------------------------------- -/** - * @brief CicoOnScreen::HidePopup - * Hide popup window - * - * @param[in] data The user data passed from the callback - * registration function - * @param[in] e The handle to the popup window - * @param[in] obj The handle to the Evas object - * @param[in] event_info Event information - * @return none - */ -//-------------------------------------------------------------------------- -void -CicoOnScreen::HidePopup(void) +bool CicoOnScreen::deleteNoti(int priv_id) { - ICO_TRA("CicoOnScreen::HidePopup Enter"); - - // TODO hide onscreen layer - ico_syc_hide_layer(6); - - // Background(popup frame) hide - evas_object_hide(ico_appdata.theme); - - if (NULL != ico_appdata.noti) { - notification_error_e err = NOTIFICATION_ERROR_NONE; - err = notification_delete(ico_appdata.noti->GetNotiHandle()); - if (NOTIFICATION_ERROR_NONE != err) { - ICO_ERR("notification_delete faile(%d)."); + ICO_TRA("Enter"); + list::iterator p = m_mngWin.begin(); + for (; p != m_mngWin.end(); ++p) { + CicoOSPopWindow* w = *p; + if (priv_id == w->GetPrivId()) { + w->hidePopup(); } - delete ico_appdata.noti; - ico_appdata.noti = NULL; - } - - ico_appdata.show_flag = FALSE; - - ICO_TRA("CicoOnScreen::HidePopup Leave"); -} - -//-------------------------------------------------------------------------- -/** - * @brief CicoOnScreen::InitializePopup - * Initialize popup window - * - * @param[in] none - * @return none - */ -//-------------------------------------------------------------------------- -void -CicoOnScreen::InitializePopup(void) -{ - ICO_TRA("CicoOnScreen::InitializePopup Enter"); - - // Window setup - ico_appdata.window = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, "frame=0"); - if (ico_appdata.window == NULL) { - ICO_ERR("ecore_evas_new() error"); - Finalize(); - ICO_TRA("CicoOnScreen::InitializePopup Leave(ERR)"); - return; } - ecore_evas_show(ico_appdata.window); - - ico_appdata.theme = edje_object_add(ecore_evas_get(ico_appdata.window)); - if (NULL == ico_appdata.theme) { - ICO_ERR("could not create edje object!"); - return; - } - - if (!edje_object_file_set(ico_appdata.theme, "/usr/apps/org.tizen.ico.onscreen/res/themes/onscreen.edj", "main")) { - Edje_Load_Error err = edje_object_load_error_get(ico_appdata.theme); - const char *errmsg = edje_load_error_str(err); - ICO_ERR("could not load 'main' from onscreen.edj: %s", - errmsg); - evas_object_del(ico_appdata.theme); - ico_appdata.theme = NULL; - return; + list tmp; + p = m_waitMngWin.begin(); + for (; p != m_waitMngWin.end(); ++p) { + CicoOSPopWindow* w = *p; + if (priv_id == w->GetPrivId()) { + tmp.push_back(w); + } } - - // icon setup - ico_appdata.icon = evas_object_image_filled_add(ecore_evas_get(ico_appdata.window)); - edje_object_part_swallow(ico_appdata.theme, "icon", ico_appdata.icon); - - /* getting size of screen */ - /* home screen size is full of display*/ - int display_width = 0; - int display_height = 0; - ecore_wl_screen_size_get(&display_width, &display_height); - - ICO_DBG("display size w/h=%d/%d", display_width, display_height); - int popup_x = (display_width / 2) - (POPUP_FRAME_WIDTH / 2); - int popup_y = (display_height / 2) - (POPUP_FRAME_HEIGHT/ 2); - ICO_DBG("popup postion x/y=%d/%d", popup_x, popup_y); - evas_object_move(ico_appdata.theme, popup_x, popup_y); - evas_object_resize(ico_appdata.theme, POPUP_FRAME_WIDTH, POPUP_FRAME_HEIGHT); - - Evas_Object* obj = NULL; - obj = (Evas_Object*)edje_object_part_object_get(ico_appdata.theme, - "button_text"); - if (NULL != obj) { - evas_object_event_callback_add(obj, - EVAS_CALLBACK_MOUSE_UP, - evasMouseUpCB, - this); + p = tmp.begin(); + for (; p != tmp.end(); ++p) { + CicoOSPopWindow* w = *p; + m_waitMngWin.remove(w); + delete w; } - - obj = (Evas_Object*)edje_object_part_object_get(ico_appdata.theme, - "button"); - if (NULL != obj) { - evas_object_event_callback_add(obj, - EVAS_CALLBACK_MOUSE_UP, - evasMouseUpCB, - this); + if (NULL != m_request) { + if (priv_id == m_request->GetPrivId()) { + m_del = true; + } } - - evas_object_show(ico_appdata.theme); - - ICO_TRA("CicoOnScreen::InitializePopup Leave(OK)"); + ICO_TRA("Leave (true)"); + return true; } //-------------------------------------------------------------------------- @@ -366,8 +183,8 @@ void CicoOnScreen::NotificationCallback(void *data, notification_type_e type, notification_op *op_list, int num_op) { - ICO_TRA("CicoOnScreen::NotificationCallback Enter"); - + ICO_TRA("Enter"); + bool bInsFlag = false; for (int i = 0; i < num_op; i++) { notification_op_type_e op_type = op_list[i].type; int priv_id = op_list[i].priv_id; @@ -378,86 +195,78 @@ CicoOnScreen::NotificationCallback(void *data, notification_type_e type, switch (op_type) { case NOTIFICATION_OP_INSERT : { - ICO_DBG("NOTIFICATION_OP_INSERT(%d)", op_type); - - CicoNotification noti(noti_h); - if (noti.Empty()) { - break; + ICO_DBG("NOTIFICATION_OP_INSERT"); + if (true == os_instance->insertNoti(noti_h)) { + bInsFlag = true; } - - // check notification type - // TODO config - notification_type_e type = noti.GetType(); - if (NOTIFICATION_TYPE_NOTI != type) { - break; - } - - // Show popup window - if (ico_appdata.show_flag == FALSE) { - ico_appdata.show_flag = TRUE; - os_instance->ShowPopup(noti); - } - break; + break; // break of switch op_type } case NOTIFICATION_OP_UPDATE : - ICO_DBG("NOTIFICATION_OP_UPDATE(%d)", op_type); - break; + ICO_DBG("NOTIFICATION_OP_UPDATE"); + break; // break of switch op_type case NOTIFICATION_OP_DELETE: { - ICO_DBG("NOTIFICATION_OP_DELETE(%d)", op_type); - - if (NULL == ico_appdata.noti) { - break; - } - - if (priv_id == ico_appdata.noti->GetPrivId()) { - delete ico_appdata.noti; - ico_appdata.noti = NULL; - os_instance->HidePopup(); - } - break; + ICO_DBG("NOTIFICATION_OP_DELETE"); + os_instance->deleteNoti(priv_id); + break; // break of switch op_type } case NOTIFICATION_OP_DELETE_ALL: - ICO_DBG("NOTIFICATION_OP_DELETE_ALL(%d)", op_type); - break; + ICO_DBG("NOTIFICATION_OP_DELETE_ALL"); + break; // break of switch op_type case NOTIFICATION_OP_REFRESH: - ICO_DBG("NOTIFICATION_OP_REFRESH(%d)", op_type); - break; + ICO_DBG("NOTIFICATION_OP_REFRESH"); + break; // break of switch op_type case NOTIFICATION_OP_SERVICE_READY: - ICO_DBG("NOTIFICATION_OP_SERVICE_READY(%d)", op_type); - break; + ICO_DBG("NOTIFICATION_OP_SERVICE_READY"); + break; // break of switch op_type default : - break; + ICO_DBG("UNKOWN OP_TYPE(%d)", (int)op_type); + break; // break of switch op_type } } - ICO_TRA("CicoOnScreen::NotificationCallback Leave"); + if (true == bInsFlag) { + os_instance->requestShowSC(); + } + + ICO_TRA("Leave"); } -//-------------------------------------------------------------------------- -/** - * @brief callback function of evas mouse up event - * - * @param [in] data The user data passed from the callback - * registration function - * @param [in] e The handle to the popup window - * @param [in] obj The handle to the Evas object - * @param [in] event_info Event information - * - */ -//-------------------------------------------------------------------------- -void -CicoOnScreen::evasMouseUpCB(void *data, Evas *e, - Evas_Object *obj, void *event_info) +bool CicoOnScreen::requestShowSC() { - ICO_TRA("CicoOnScreen::evasMouseUpCB Enter"); - ICO_DBG("obj name=%s", evas_object_name_get(obj)); - - static_cast(data)->HidePopup(); + ICO_TRA("Enter"); + if (NULL != m_request) { + ICO_TRA("Leave false(request now)"); + return false; + } + if (m_waitMngWin.empty()) { + ICO_TRA("Leave false(nothing window)"); + return false; + } - ICO_TRA("CicoOnScreen::evasMouseUpCB Leave"); + list::iterator p = m_waitMngWin.begin(); + m_del = false; + m_request = *p; + m_waitMngWin.remove(m_request); + bool r = m_request->showPopup(); + while (false == r) { // fail showPop request + ICO_ERR("_____ Fail SHOW POP REQUEST(%d)", + m_request->GetPrivId()); + delete m_request; + m_request = NULL; + if (m_waitMngWin.empty()) { + break; + } + p = m_waitMngWin.begin(); + m_del = false; + m_request = *p; + m_waitMngWin.remove(m_request); + r = m_request->showPopup(); + } + ICO_TRA("Leave %s", r? "true": "false"); + return r; } - + //-------------------------------------------------------------------------- /** * @brief callback for system controller @@ -471,28 +280,102 @@ void CicoOnScreen::EventCallBack(const ico_syc_ev_e event, const void *detail, void *user_data) { - ICO_TRA("CicoOnScreen::EventCallBack Enter(event %d)", event); - + ICO_TRA("Enter(event %d, %x, %x)", (int)event, detail, user_data); + ico_syc_res_info_t *ri = (ico_syc_res_info_t*) detail; + if (NULL == ri) { + ICO_ERR("____ CALLBACK NG PARAM"); + return; + } switch (event) { case ICO_SYC_EV_RES_ACQUIRE: - ICO_TRA("Received: ico syc event(ICO_SYC_EV_RES_ACQUIRE)"); - break; + ICO_TRA("_____ ICO_SYC_EV_RES_ACQUIRE"); + break; // break of switch event case ICO_SYC_EV_RES_DEPRIVE: - ICO_TRA("Received: ico syc event(ICO_SYC_EV_RES_DEPRIVE)"); - break; + ICO_TRA("_____ ICO_SYC_EV_RES_DEPRIVE"); + break; // break of switch event case ICO_SYC_EV_RES_WAITING: - ICO_TRA("Received: ico syc event(ICO_SYC_EV_RES_WAITING)"); - break; + ICO_TRA("_____ ICO_SYC_EV_RES_WAITING"); + break; // break of switch event case ICO_SYC_EV_RES_REVERT: - ICO_TRA("Received: ico syc event(ICO_SYC_EV_RES_REVERT)"); - break; + ICO_TRA("_____ ICO_SYC_EV_RES_REVERT"); + break; // break of switch event case ICO_SYC_EV_RES_RELEASE: - ICO_TRA("Received: ico syc event(ICO_SYC_EV_RES_RELEASE)"); - break; + { + ICO_TRA("_____ ICO_SYC_EV_RES_RELEASE"); + if (NULL == ri->window) { + ICO_TRA("_____ no WINDOW"); + break; // break of switch event + } + os_instance->releaseWindow(ri->window->resourceId); + break; // break of switch event + } + case ICO_SYC_EV_RES_WINDOW_ID: + { + ICO_TRA("_____ ICO_SYC_EV_RES_WINDOW_ID"); + if (NULL == ri->window) { + ICO_TRA("_____ no WINDOW"); + break; // break of switch event + } + os_instance->entryWindowId(ri->window->resourceId); + break; // break of switch event + } default: - break; + ICO_TRA("_____ UNKNOWN event(%d)", (int)event); + break; // break of switch event } - ICO_TRA("CicoOnScreen::EventCallBack Leave"); + ICO_TRA("Leave"); +} + +bool +CicoOnScreen::releaseWindow(uint32_t resourceId) +{ + ICO_TRA("Enter(%d)", resourceId); + bool bR = false; + list tmp; + + list::iterator p = m_mngWin.begin(); + for (; p != m_mngWin.end(); ++p) { + CicoOSPopWindow* w = *p; + if (resourceId == w->m_resourceId) { + tmp.push_back(w); + } + } + p = tmp.begin(); + for (; p != tmp.end(); ++p) { + CicoOSPopWindow* w = *p; + m_mngWin.remove(w); + delete w; + bR = true; + } + tmp.clear(); + + ICO_TRA("Leave %s", bR? "true": "false"); + return bR; +} + +bool +CicoOnScreen::entryWindowId(uint32_t resourceId) +{ + ICO_TRA("Enter(%d)", resourceId); + bool bR = false; + if (NULL != m_request) { + m_request->m_resourceId = resourceId; + if (true == m_request->acquireRes()) { + m_mngWin.push_back(m_request); + if (true == m_del) { + ICO_TRA("____ HIDE REQUEST"); + m_request->hidePopup(); + } + } + else { + delete m_request; + } + m_del = false; + m_request = NULL; + bR = requestShowSC(); + } + ICO_TRA("Leave %s", bR? "true": "false"); + return bR; } // vim: set expandtab ts=4 sw=4: diff --git a/src/onscreen/CicoOnScreen.h b/src/onscreen/CicoOnScreen.h index 372950a..74f5abd 100644 --- a/src/onscreen/CicoOnScreen.h +++ b/src/onscreen/CicoOnScreen.h @@ -21,9 +21,10 @@ #define __UNUSED__ #endif -#include +#include #include -#include +#include +#include #include #include @@ -39,84 +40,15 @@ #include "ico_syc_privilege.h" #include "ico_log.h" +#include "CicoOSPopWindow.h" /*============================================================================*/ /* Define fixed parameters */ /*============================================================================*/ -/* Window Size */ -#define STATUS_BAR_HEIGHT 64 -#define CTRL_BAR_HEIGHT 128 -#define WIDTH 1080 -#define HEIGHT (1920 - STATUS_BAR_HEIGHT - CTRL_BAR_HEIGHT) - -/* Popup Size */ -#define POPUP_WIDTH 640 -#define POPUP_HEIGHT 300 - -/* Popup Frame Size */ -#define POPUP_FRAME_THICK 10 -#define POPUP_FRAME_WIDTH (POPUP_WIDTH+POPUP_FRAME_THICK) -#define POPUP_FRAME_HEIGHT (POPUP_HEIGHT+POPUP_FRAME_THICK) - -#if 0 -#define POPUP_ST_X ((WIDTH-POPUP_WIDTH)/2) -#define POPUP_ST_Y ((HEIGHT-POPUP_HEIGHT)/2) - -/* Popup Frame Size */ -#define POPUP_FRAME_THICK 10 -#define POPUP_FRAME_WIDTH (POPUP_WIDTH+POPUP_FRAME_THICK) -#define POPUP_FRAME_HEIGHT (POPUP_HEIGHT+POPUP_FRAME_THICK) -#define POPUP_FRAME_ST_X (POPUP_ST_X-POPUP_FRAME_THICK/2) -#define POPUP_FRAME_ST_Y (POPUP_ST_Y-POPUP_FRAME_THICK/2) - -/* Popup Icon Size */ -#define POPUP_ICON_WIDTH 50 -#define POPUP_ICON_HEIGHT 50 -#define POPUP_ICON_ST_X POPUP_ST_X -#define POPUP_ICON_ST_Y POPUP_ST_Y - -/* Popup Title Size */ -#define POPUP_TITLE_WIDTH (POPUP_WIDTH-POPUP_ICON_WIDTH) -#define POPUP_TITLE_HEIGHT POPUP_ICON_HEIGHT -#define POPUP_TITLE_ST_X (POPUP_ST_X+POPUP_ICON_WIDTH) -#define POPUP_TITLE_ST_Y POPUP_ST_Y - -/* Popup Content BG Size */ -#define POPUP_CONTENT_BG_WIDTH POPUP_WIDTH -#define POPUP_CONTENT_BG_HEIGHT (POPUP_HEIGHT-POPUP_TITLE_HEIGHT) -#define POPUP_CONTENT_BG_ST_X POPUP_ST_X -#define POPUP_CONTENT_BG_ST_Y (POPUP_ST_Y+POPUP_TITLE_HEIGHT) - -/* Popup Content Size */ -#define POPUP_CONTENT_WIDTH POPUP_WIDTH -#define POPUP_CONTENT_HEIGHT POPUP_TITLE_HEIGHT -#define POPUP_CONTENT_ST_X POPUP_ST_X -#define POPUP_CONTENT_ST_Y (POPUP_ST_Y+POPUP_TITLE_HEIGHT+(POPUP_HEIGHT-POPUP_CONTENT_HEIGHT)/2) - -#define ICO_ORIENTATION_VERTICAL (1) -#define ICO_ORIENTATION_HORIZONTAL (2) - -#define LEMOLO_PKGNAME "org.tizen.dialer" -#endif - -#define FALSE 0 -#define TRUE 1 - -#if 0 -#define ICON_PATH (char *)"/usr/share/icons/default/small/org.tizen.dialer.png" -#endif /*============================================================================*/ /* Define data types */ /*============================================================================*/ -struct popup_data -{ - Ecore_Evas *window; - Evas_Object *icon; - Evas_Object *theme; - int show_flag; - CicoNotification *noti; -}; /*============================================================================*/ /* Define class */ @@ -127,33 +59,31 @@ public: CicoOnScreen(void); ~CicoOnScreen(void); bool StartOnScreen(void); - void Finalize(void); - void HidePopup(void); static void NotificationCallback(void *data, notification_type_e type, notification_op *op_list, int num_op); - -private: - void ShowPopup(CicoNotification ¬i); - void InitializePopup(void); - void InitializePopupData(void); - - static void evasMouseUpCB(void *data, - Evas *e, - Evas_Object *obj, - void *event_info); +protected: + bool requestShowSC(); static void EventCallBack(const ico_syc_ev_e event, const void *detail, void *user_data); + bool entryWindowId(uint32_t resourceId); + bool releaseWindow(uint32_t resourceId); + bool insertNoti(notification_h noti_h); + bool deleteNoti(int priv_id); static CicoOnScreen *os_instance; - static struct popup_data ico_appdata; protected: CicoNotificationService notiservice_; + std::list m_mngWin; + std::list m_waitMngWin; + CicoOSPopWindow* m_request; + bool m_del; + CicoOSPopWindow* m_reserve; }; #endif // __CICO_ON_SCREEN_H__ // vim:set expandtab ts=4 sw=4: diff --git a/src/onscreen/Makefile.am b/src/onscreen/Makefile.am index 0f81618..dc4783d 100644 --- a/src/onscreen/Makefile.am +++ b/src/onscreen/Makefile.am @@ -8,7 +8,8 @@ noinst_PROGRAMS = \ OnScreen_SOURCES = \ on_screen_main.cpp \ CicoOSEFLApp.cpp \ - CicoOnScreen.cpp + CicoOnScreen.cpp \ + CicoOSPopWindow.cpp OnScreen_CFLAGS= \ @CAPIAPPFWAPPLICATION_CFLAGS@ \ diff --git a/tests/system-controller/apps-framework/tst_appresctl.c b/tests/system-controller/apps-framework/tst_appresctl.c index 1d93cf1..b4df4a9 100644 --- a/tests/system-controller/apps-framework/tst_appresctl.c +++ b/tests/system-controller/apps-framework/tst_appresctl.c @@ -64,11 +64,19 @@ _check_res_info(const char *ev_name, ico_syc_res_info_t *info) sound = info->sound; input = info->input; if (window != NULL) { - printf("\t(window zone[%s], name[%s], id[%s]\n", - window->zone, window->name, window->id); - if (strcmp(window->zone, TST_ZONE_A) != 0 - || strcmp(window->name, TST_NAME_A) != 0 - || strcmp(window->id, TST_ID_A) != 0) { + ico_syc_res_window_t *w = window; + printf("\t(window ECU[%s].display[%s].layer[%s].layout[%s].area[%s], app[%s], role[%s], resId[%d]", + w->ECU, w->display, w->layer, w->layout, w->area, + w->dispatchApp, w->role, w->resourceId); + + if ((0 != strcmp(w->ECU, TST_ECU)) || + (0 != strcmp(w->display, TST_display)) || + (0 != strcmp(w->layer, TST_layer)) || + (0 != strcmp(w->layout, TST_layout)) || + (0 != strcmp(w->area, TST_area)) || + (0 != strcmp(w->dispatchApp, TST_dispatchApp)) || + (0 != strcmp(w->role, TST_role)) || + (w->resourceId != TST_resourceId)) { check_flag = 1; } } @@ -253,9 +261,14 @@ Eina_Bool ico_syc_appresctl_test(void *data) int attr = 1; /* set window resource info */ - window.zone = "center"; - window.name = "window A"; - window.id = "id A"; + window.ECU = "Center"; + window.display = "Center"; + window.layer = "OnScreen"; + window.layout = "Full"; + window.area = "Full"; + window.dispatchApp = "zzzzzzzz"; + window.role = "Message"; + window.resourceId = 8888; /* set sound resource info */ sound.zone = "all"; sound.name = "sound B"; diff --git a/tests/system-controller/apps-framework/tst_common.h b/tests/system-controller/apps-framework/tst_common.h index 0f6e4bb..ed8242a 100644 --- a/tests/system-controller/apps-framework/tst_common.h +++ b/tests/system-controller/apps-framework/tst_common.h @@ -61,6 +61,16 @@ extern "C" { #define TST_ID_A (char *)"id A" #define TST_ID_B (char *)"id B" +#define TST_ECU (char *)"ECU A" +#define TST_display (char *)"display A" +#define TST_layer (char *)"layer A" +#define TST_layout (char *)"layout A" +#define TST_area (char *)"area A" +#define TST_dispatchApp (char *)"dispatchApp A" +#define TST_role (char *)"role A" +#define TST_resourceId 55555 + + #define TST_ADJUST 1 #define TST_INPUT_EV 2 #define TST_RES_TYPE 0 diff --git a/tool/Makefile.am b/tool/Makefile.am index 93f5fc3..062704d 100644 --- a/tool/Makefile.am +++ b/tool/Makefile.am @@ -9,7 +9,8 @@ AM_CFLAGS = $(GCC_CFLAGS) -I../include -I/usr/include/ico-util $(wayland_ivi_cli AM_LDFLAGS = -module -avoid-version -rpath $(libdir) $(GLIB_LIBS) bin_PROGRAMS = \ - ico_change_loginuser + ico_change_loginuser \ + ico_clear_screen check_LTLIBRARIES = $(TESTS) check_PROGRAMS = ico_clear_screen ico_login_user diff --git a/tool/ico_clear_screen.c b/tool/ico_clear_screen.c index 527519c..63d59b3 100644 --- a/tool/ico_clear_screen.c +++ b/tool/ico_clear_screen.c @@ -28,12 +28,14 @@ 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); } +#endif } void @@ -139,6 +141,7 @@ 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_ANIMATION_TYPE_HIDE| ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW, @@ -154,6 +157,7 @@ opengl_create_window(struct display *display, struct wl_surface *surface, ICO_WINDOW_MGR_VISIBLE_SHOW, ICO_WINDOW_MGR_RAISE_RAISE, ICO_WINDOW_MGR_FLAGS_ANIMATION | ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE); +#endif return(egl_surface); } diff --git a/tool/notification/send_notification.cpp b/tool/notification/send_notification.cpp index fef72da..d7070e9 100644 --- a/tool/notification/send_notification.cpp +++ b/tool/notification/send_notification.cpp @@ -1,5 +1,8 @@ -#include +#include #include +#include +#include +#include #include "notification.h" using namespace std; @@ -139,9 +142,20 @@ insert_notification(notification_type_e type, int main(int argc, char **argv) { - cout << "Notification TestProgram Start=========" <