Additional functions of policy and resource management. 29/10129/1 accepted/tizen/20130919.180956 accepted/tizen/20130919.204217 submit/tizen/20130919.120856
authorHayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
Thu, 19 Sep 2013 11:05:03 +0000 (20:05 +0900)
committerHayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
Thu, 19 Sep 2013 11:05:41 +0000 (20:05 +0900)
Change-Id: I5ff408b6e781ee90b6df362e2ab979f9218e0f7b
Signed-off-by: Hayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
134 files changed:
configure.ac
data/lib/systemd/user/ico-system-controller.service
include/ico_syc_error.h
include/ico_syc_msg_cmd_def.h
include/ico_syc_private.h
include/ico_syc_public.h [new file with mode: 0644]
include/ico_syc_type.h
include/ico_syc_userctl.h
include/ico_syc_winctl.h
lib/apps-framework/ico_syc_appresctl.c
lib/apps-framework/ico_syc_common.c
lib/apps-framework/ico_syc_msg.c
lib/apps-framework/ico_syc_userctl.c
lib/apps-framework/ico_syc_winctl.c
lib/misc/Makefile.am
lib/misc/state-machine/CicoStateAction.cpp
lib/misc/state-machine/CicoStateAction.h
lib/misc/state-machine/CicoStateCore.cpp
lib/misc/state-machine/CicoStateInternal.h
lib/misc/state-machine/Makefile.am
lib/misc/state-machine/ico_StateMachine_CWrapper.cpp
lib/misc/state-machine/ico_log.c [deleted file]
lib/misc/state-machine/ico_log.h [deleted file]
lib/system-controller/CicoLog.h
lib/system-controller/CicoSCAilItems.cpp
lib/system-controller/CicoSCAilItems.h
lib/system-controller/CicoSCAulItems.cpp
lib/system-controller/CicoSCAulItems.h
lib/system-controller/CicoSCCommand.cpp [new file with mode: 0644]
lib/system-controller/CicoSCCommand.h [new file with mode: 0644]
lib/system-controller/CicoSCCommandParser.cpp [deleted file]
lib/system-controller/CicoSCCommandParser.h [deleted file]
lib/system-controller/CicoSCConf.h
lib/system-controller/CicoSCDisplay.cpp
lib/system-controller/CicoSCDisplay.h
lib/system-controller/CicoSCDisplayZone.cpp
lib/system-controller/CicoSCDisplayZone.h
lib/system-controller/CicoSCInputController.cpp
lib/system-controller/CicoSCInputController.h
lib/system-controller/CicoSCInputDev.cpp
lib/system-controller/CicoSCInputDev.h
lib/system-controller/CicoSCLastInfo.h [new file with mode: 0644]
lib/system-controller/CicoSCLayer.cpp
lib/system-controller/CicoSCLayer.h
lib/system-controller/CicoSCLifeCycleController.cpp
lib/system-controller/CicoSCLifeCycleController.h
lib/system-controller/CicoSCMessage.cpp
lib/system-controller/CicoSCMessage.h
lib/system-controller/CicoSCPolicyDef.h [new file with mode: 0644]
lib/system-controller/CicoSCPolicyManager.cpp
lib/system-controller/CicoSCPolicyManager.h
lib/system-controller/CicoSCResourceManager.cpp
lib/system-controller/CicoSCResourceManager.h
lib/system-controller/CicoSCServer.cpp
lib/system-controller/CicoSCServer.h
lib/system-controller/CicoSCSwitch.cpp
lib/system-controller/CicoSCSwitch.h
lib/system-controller/CicoSCSysResourceController.cpp
lib/system-controller/CicoSCSysResourceController.h
lib/system-controller/CicoSCSysResourceMonitor.cpp
lib/system-controller/CicoSCSysResourceMonitor.h
lib/system-controller/CicoSCSystemConfig.cpp
lib/system-controller/CicoSCSystemConfig.h
lib/system-controller/CicoSCUser.cpp
lib/system-controller/CicoSCUser.h
lib/system-controller/CicoSCUserManager.cpp
lib/system-controller/CicoSCUserManager.h
lib/system-controller/CicoSCWayland.cpp
lib/system-controller/CicoSCWayland.h
lib/system-controller/CicoSCWaylandIF.cpp
lib/system-controller/CicoSCWaylandIF.h
lib/system-controller/CicoSCWindow.cpp
lib/system-controller/CicoSCWindow.h
lib/system-controller/CicoSCWindowController.cpp
lib/system-controller/CicoSCWindowController.h
lib/system-controller/CicoSCWlInputMgrIF.cpp
lib/system-controller/CicoSCWlInputMgrIF.h
lib/system-controller/CicoSCWlWinMgrIF.cpp
lib/system-controller/CicoSCWlWinMgrIF.h
lib/system-controller/Makefile.am
lib/system-controller/ico_log.c [deleted file]
lib/system-controller/ico_log.h [deleted file]
lib/system-controller/ico_syc_error.h [deleted file]
lib/system-controller/ico_syc_mrp_resource.c
lib/system-controller/ico_syc_mrp_resource_private.h
packaging/ico-uxf-homescreen.changes
packaging/ico-uxf-homescreen.spec
res/org.tizen.ico.homescreen/res/images/applist_off_2.png [new file with mode: 0644]
res/org.tizen.ico.homescreen/res/images/applist_on.png
res/org.tizen.ico.homescreen/res/images/applist_on_2.png [new file with mode: 0644]
res/org.tizen.ico.system-controller/res/config/app_attr.conf
res/org.tizen.ico.system-controller/res/config/policy.json
res/org.tizen.ico.system-controller/res/config/system.xml
res/org.tizen.ico.system-controller/res/ico/defaultApps.info [new file with mode: 0644]
src/homescreen/CicoHSAppHistory.cpp [new file with mode: 0644]
src/homescreen/CicoHSAppHistory.h [new file with mode: 0644]
src/homescreen/CicoHSControlBarWindow.cpp
src/homescreen/CicoHSControlBarWindow.h
src/homescreen/CicoHSMenuTile.cpp
src/homescreen/CicoHSMenuTile.h
src/homescreen/CicoHSMenuWindow.cpp
src/homescreen/CicoHSMenuWindow.h
src/homescreen/CicoHSSystemState.cpp [new file with mode: 0644]
src/homescreen/CicoHSSystemState.h [new file with mode: 0644]
src/homescreen/CicoHomeScreen.cpp
src/homescreen/CicoHomeScreenCommon.h
src/homescreen/CicoLog.h
src/homescreen/CicoOnScreenAppList.cpp
src/homescreen/CicoSCAilItems.cpp
src/homescreen/CicoSCConf.h
src/homescreen/CicoSCLifeCycleController.cpp
src/homescreen/CicoSCLifeCycleController.h
src/homescreen/CicoSCSystemConfig.cpp
src/homescreen/CicoSCSystemConfig.h
src/homescreen/Makefile.am
src/homescreen/home_screen_main.cpp
src/homescreen/ico_log.c [deleted file]
src/homescreen/ico_log.h [deleted file]
src/syscond/CicoSysConDaemon.cpp
src/syscond/Makefile.am
tests/system-controller/Makefile.am
tests/system-controller/apps-framework/run_test.sh
tests/system-controller/apps-framework/tst_appresctl.c
tests/system-controller/apps-framework/tst_common.h
tests/system-controller/apps-framework/tst_server.c
tests/system-controller/apps-framework/tst_userctl.c
tests/system-controller/apps-framework/tst_winctl.c
tests/system-controller/test-dummy-hs/CicoLog.cpp
tests/system-controller/test-dummy-hs/CicoUISample.cpp
tests/system-controller/test-dummy-hs/Makefile.am
tests/system-controller/test-dummy-hs/main.cpp
tool/kill_syscond.sh
tool/rm_autogen-file.sh [new file with mode: 0755]
tool/start_syscond.sh

index 6b3267c..3b9947a 100644 (file)
@@ -73,7 +73,7 @@ AC_SUBST(AUL_CFLAGS)
 AC_SUBST(AUL_LIBS)
 
 UWS_CFLAGS="-I/usr/include/ico-util"
-UWS_LIBS="-lico-util-com"
+UWS_LIBS="-lico-util"
 AC_SUBST(UWS_CFLAGS)
 AC_SUBST(UWS_LIBS)
 
@@ -87,6 +87,11 @@ WL_LIBS="$WAYLANDCLIENT_LIBS $WAYLANDCURSOR_LIBS"
 AC_SUBST(WL_CFLAGS)
 AC_SUBST(WL_LIBS)
 
+WESTONPLUGIN_CFLAGS="-I/usr/include/ico-uxf-weston-plugin"
+WESTONPLUGIN_LIBS="-lico-uxf-weston-plugin"
+AC_SUBST(WESTONPLUGIN_CFLAGS)
+AC_SUBST(WESTONPLUGIN_LIBS)
+
 if test "x$GCC" = "xyes"; then
     my_common_gcc_flags="-Wall -Wextra -Wno-unused-parameter \
         -Wno-missing-field-initializers -g -fvisibility=hidden"
@@ -125,7 +130,6 @@ AC_CONFIG_FILES([Makefile
                  src/homescreen/Makefile
                                  tests/Makefile
                  tests/system-controller/Makefile
-                 tests/system-controller/apps-framework/Makefile
-                 tests/system-controller/test-dummy-hs/Makefile])
+                 tests/system-controller/apps-framework/Makefile])
 AC_PROG_RANLIB([ranlib])
 AC_OUTPUT
index 64551d8..b4b4974 100644 (file)
@@ -1,10 +1,13 @@
 [Unit]
 Description=ico system controller
+Requires=weston.service
+Before=weston.service
+Before=ico-app-meter.service
 
 [Service]
 Environment=TIZEN_PLATFORMLOGGING_MODE=1
 Environment=TIZEN_DLOG_LEVEL=1
 Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%U/dbus/user_bus_socket
-Environment=XDG_RUNTIME_DIR=/run/user/5000
+#Environment=XDG_RUNTIME_DIR=/run/user/5000
 Type=oneshot
 ExecStart=/usr/bin/launch_app org.tizen.ico.system-controller
index f0ecc9f..a205f39 100644 (file)
@@ -36,6 +36,21 @@ typedef enum _ico_syc_error {
     ICO_SYC_ERR_UNKNOWN         = -200  /* unknown error */
 } ico_syc_err_e;
 
+#define ICO_SYC_EOK          0  /* OK                       */
+#define ICO_SYC_EPERM       -1  /* Operation not permitted  */
+#define ICO_SYC_ENOENT      -2  /* No such object           */
+#define ICO_SYC_ESRCH       -3  /* Not initialized          */
+#define ICO_SYC_EIO         -5  /* I/O(send/receive) error  */
+#define ICO_SYC_ENXIO       -6  /* Not exist                */
+#define ICO_SYC_E2BIG       -7  /* Buffer size too smale    */
+#define ICO_SYC_EBADF       -9  /* Illegal data type        */
+#define ICO_SYC_EAGAIN      -11 /* Try again                */
+#define ICO_SYC_ENOMEM      -12 /* Out of memory            */
+#define ICO_SYC_EFAULT      -14 /* Bad address              */
+#define ICO_SYC_EBUSY       -16 /* Not available now        */
+#define ICO_SYC_EEXIST      -17 /* Multiple define          */
+#define ICO_SYC_EINVAL      -22 /* Invalid argument         */
+#define ICO_SYC_ENOSYS      -38 /* System error             */
 
 #ifdef __cplusplus
 }
index f11221d..997956c 100644 (file)
@@ -91,12 +91,20 @@ extern "C" {
 #define MSG_PRMKEY_RES_POS_Y    (char *)"pos_y"
 #define MSG_PRMKEY_RES_WIDTH    (char *)"width"
 #define MSG_PRMKEY_RES_HEIGHT   (char *)"height"
+#define MSG_PRMKEY_RES_HOT_X    (char *)"hotspot_x"
+#define MSG_PRMKEY_RES_HOT_Y    (char *)"hotspot_y"
+#define MSG_PRMKEY_RES_CUR_X    (char *)"cursor_x"
+#define MSG_PRMKEY_RES_CUR_Y    (char *)"cursor_x"
+#define MSG_PRMKEY_RES_CUR_WIDTH  (char *)"cursor_width"
+#define MSG_PRMKEY_RES_CUR_HEIGHT (char *)"cursor_height"
 #define MSG_PRMKEY_RES_ATTR     (char *)"attr"
+/* user controller */
+#define MSG_PRMKEY_LASTINFO     (char *)"lastinfo"
 
+/* notify changed system state */
+#define MSG_PRMKEY_STATEID      (char *)"stateid"
+#define MSG_PRMKEY_STATE        (char *)"state"
 
-/*
- *
- */
 /* commnad type mask */
 #define MSG_CMD_TYPE_WINCTRL            0x00010000
 #define MSG_CMD_TYPE_INPUTCTRL          0x00020000
@@ -119,28 +127,36 @@ extern "C" {
 #define MSG_CMD_CHANGE_ACTIVE       0x00010006
 #define MSG_CMD_CHANGE_LAYER        0x00010007
 #define MSG_CMD_CHANGE_ATTR         0x00010008
-#define MSG_CMD_PREPARE_THUMB       0x00010010
 #define MSG_CMD_MAP_THUMB           0x00010011
 #define MSG_CMD_UNMAP_THUMB         0x00010012
 #define MSG_CMD_SHOW_LAYER          0x00010020
 #define MSG_CMD_HIDE_LAYER          0x00010021
 #define MSG_CMD_CHANGE_LAYER_ATTR   0x00010022
 /* input controller */
-#define MSG_CMD_ADD_INPUT       0x00020001
-#define MSG_CMD_DEL_INPUT       0x00020002
-#define MSG_CMD_SEND_INPUT      0x00020003
+#define MSG_CMD_ADD_INPUT           0x00020001
+#define MSG_CMD_DEL_INPUT           0x00020002
+#define MSG_CMD_SEND_INPUT          0x00020003
 /* user controller */
-#define MSG_CMD_CHANGE_USER     0x00030001
-#define MSG_CMD_GET_USERLIST    0x00030002
+#define MSG_CMD_CHANGE_USER         0x00030001
+#define MSG_CMD_GET_USERLIST        0x00030002
+#define MSG_CMD_GET_LASTINFO        0x00030003
+#define MSG_CMD_SET_LASTINFO        0x00030004
+/* app resource controller */
+#define MSG_CMD_ACQUIRE_RES         0x00040001
+#define MSG_CMD_RELEASE_RES         0x00040002
+#define MSG_CMD_DEPRIVE_RES         0x00040003
+#define MSG_CMD_WAITING_RES         0x00040004
+#define MSG_CMD_REVERT_RES          0x00040005
+/* input device setting */
+#define MSG_CMD_SET_REGION          0x00050001
+#define MSG_CMD_UNSET_REGION        0x00050002
+
 /* app resource controller */
-#define MSG_CMD_ACQUIRE_RES     0x00040001
-#define MSG_CMD_RELEASE_RES     0x00040002
-#define MSG_CMD_DEPRIVE_RES     0x00040003
-#define MSG_CMD_WAITING_RES     0x00040004
-#define MSG_CMD_REVERT_RES      0x00040005
-#define MSG_CMD_SET_REGION      0x00040010
-#define MSG_CMD_UNSET_REGION    0x00040011
+#define MSG_CMD_CREATE_RES          0x00040011
+#define MSG_CMD_DESTORY_RES         0x00040012
 
+/* notify state changed to homescreen */
+#define MSG_CMD_NOTIFY_CHANGED_STATE    0x00060001
 #ifdef __cplusplus
 }
 #endif
index 1f72e56..e58d67f 100644 (file)
@@ -9,7 +9,7 @@
 /**
  * @brief   header file of System Controller internal definition
  *
- * @date    Aug-7-2013
+ * @date    Sep-4-2013
  */
 
 #ifndef _ICO_SYC_PRIVATE_H_
@@ -138,7 +138,7 @@ void ico_syc_cb_win_attr(ico_syc_callback_t callback, void *user_data,
 /**
  * @internal
  * @brief   ico_syc_cb_thumb
- *          Execute callback function. (ICO_SYC_EV_THUMB_PREPARE
+ *          Execute callback function. (ICO_SYC_EV_THUMB_ERROR
  *                                      ICO_SYC_EV_THUMB_CHANGE
  *                                      ICO_SYC_EV_THUMB_UNMAP)
  *
@@ -204,6 +204,23 @@ void ico_syc_cb_auth(ico_syc_callback_t callback, void *user_data, int event);
 void ico_syc_cb_userlist(ico_syc_callback_t callback, void *user_data,
                          int event, const void *data, size_t len);
 
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_lastinfo
+ *          Execute callback function. (ICO_SYC_EV_LASTINFO)
+ *
+ * @param[in]   callback                callback function
+ * @param[in]   user_data               passed data on called callback function
+ * @param[in]   event                   event code
+ * @param[in]   data                    message data
+ * @param[in]   len                     length of data
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void ico_syc_cb_lastinfo(ico_syc_callback_t callback, void *user_data,
+                         int event, const void *data, size_t len);
+
 /*============================================================================*/
 /* internal function (appresctl)                                              */
 /*============================================================================*/
diff --git a/include/ico_syc_public.h b/include/ico_syc_public.h
new file mode 100644 (file)
index 0000000..a4731c9
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   header file of System Controller internal definition
+ *
+ * @date    Sep-12-2013
+ */
+
+#ifndef _ICO_SYC_PUBLIC_H_
+#define _ICO_SYC_PUBLIC_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*============================================================================*/
+/* definition                                                                 */
+/*============================================================================*/
+#define ICO_SYC_APP_BUNDLE_KEY1 "HS_PARAM_U"
+#define ICO_SYC_APP_BUNDLE_KEY2 "HS_PARAM_D"
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*_ICO_SYC_PUBLIC_H_*/
index 0e9de4e..c711ca5 100644 (file)
@@ -42,9 +42,9 @@ typedef enum _event_id {
     ICO_SYC_EV_WIN_DESTROY          = 2,  /* destroy window */
     ICO_SYC_EV_WIN_ACTIVE           = 3,  /* active window */
     ICO_SYC_EV_WIN_ATTR_CHANGE      = 4,  /* change window attribute */
-    ICO_SYC_EV_THUMB_PREPARE        = 5,  /* prepare thumbnail data */
-    ICO_SYC_EV_THUMB_CHANGE         = 6,  /* map thumbnail data */
-    ICO_SYC_EV_THUMB_UNMAP          = 7,  /* unmap thumbnail data */
+    ICO_SYC_EV_THUMB_CHANGE         = 5,  /* map thumbnail data */
+    ICO_SYC_EV_THUMB_UNMAP          = 6,  /* unmap thumbnail data */
+    ICO_SYC_EV_THUMB_ERROR          = 7,  /* error map thumbnail */
     ICO_SYC_EV_LAYER_ATTR_CHANGE    = 8,  /* change layer attribute */
     ICO_SYC_EV_USERLIST             = 9,  /* notify the user list */
     ICO_SYC_EV_AUTH_FAIL            = 10, /* fail in the user authentication */
@@ -54,7 +54,9 @@ typedef enum _event_id {
     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_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_e;
 
 /*
@@ -124,6 +126,22 @@ typedef enum _layer_visible {
     ICO_SYC_LAYER_VISIBLE_HIDE  = 1
 } ico_syc_layer_visible_e;
 
+/**
+ *  system state
+ */
+typedef enum _system_state {
+    ICO_SYC_STATE_REGULATION = 1,   /**< regulation state */
+    ICO_SYC_STATE_NIGHTMODE  = 2    /**< night mode state */
+} ico_syc_system_state_e;
+
+/**
+ *  state on/off
+ */
+typedef enum _state_onoff {
+    ICO_SYC_STATE_OFF = 0,   /**< state of off */
+    ICO_SYC_STATE_ON  = 1    /**< state of on */
+} ico_syc_state_onoff_e;
+
 /*============================================================================*/
 /* structure                                                                  */
 /*============================================================================*/
@@ -172,10 +190,11 @@ typedef struct _win_attr {
 typedef struct _thumb_info {
     char *appid;    /* application id */
     int  surface;   /* window's surface id */
+    int  name;      /* EGL buffer name */
     int  width;     /* window width */
     int  height;    /* window height */
-    int  stride;    /* bites par line of frame buffer */
-    int  format;    /* format of thumbnail data */
+    int  stride;    /* byte par line of frame buffer */
+    int  format;    /* format of buffer */
 } ico_syc_thumb_info_t;
 
 /*
@@ -225,12 +244,21 @@ typedef struct _res_input {
 /*
  * input region information
  */
+#define ICO_SYC_MAX_WINNAME_LEN 40
 typedef struct _input_region {
-    int  surface;       /* window's surface id */
-    int  pos_x;         /* surface of setting input region display position x */
-    int  pos_y;         /* surface of setting input region display position y */
-    int  width;         /* input region's width */
-    int  height;        /* input region's height */
+    char    winname[ICO_SYC_MAX_WINNAME_LEN];
+                            /* target window name                   */
+    short   pos_x;          /* input region X coordinate of surface */
+    short   pos_y;          /* input region Y coordinate of surface */
+    short   width;          /* input region's width                 */
+    short   height;         /* input region's height                */
+    short   hotspot_x;      /* hotspot of X relative coordinate     */
+    short   hotspot_y;      /* hotspot of Y relative coordinate     */
+    short   cursor_x;       /* cursor region X coordinate           */
+    short   cursor_y;       /* cursor region X coordinate           */
+    short   cursor_width;   /* cursor region width                  */
+    short   cursor_height;  /* cursor region height                 */
+    int     attr;           /* region attributes(currently unused)  */
 } ico_syc_input_region_t;
 
 /*
@@ -242,6 +270,14 @@ typedef struct _res_info {
     ico_syc_res_input_t  *input;   /* input resource information */
 } ico_syc_res_info_t;
 
+/*
+ * notify changed state information
+ */
+typedef struct _state_info {
+    int id;
+    int state;
+} ico_syc_state_info_t;
+
 /*============================================================================*/
 /* callback function                                                          */
 /*============================================================================*/
index ebd7d5f..8ac50c4 100644 (file)
@@ -10,7 +10,7 @@
  * @brief   header file of User Control API
  *          for privilege applications
  *
- * @date    July-31-2013
+ * @date    Sep-4-2013
  */
 
 #ifndef _ICO_SYC_USERCTL_H_
@@ -49,6 +49,29 @@ void ico_syc_change_user(const char *name, const char *password);
 /*--------------------------------------------------------------------------*/
 void ico_syc_get_userlist(void);
 
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_get_lastinfo
+ *          Get the application's last information.
+ *          Callback function notifies the application's last information.
+ *
+ * @param       none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void ico_syc_get_lastinfo(void);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_set_lastinfo
+ *          Set the application's last information.
+ *
+ * @param[in]   lastinfo                application's last information
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void ico_syc_set_lastinfo(const char *lastinfo);
+
 
 #ifdef __cplusplus
 }
index cd0a3d1..e0f3534 100644 (file)
@@ -33,17 +33,6 @@ typedef enum _window_show {
     ICO_SYC_WIN_SHOW_ALL = -1
 } ico_syc_win_show_e;
 
-/*
- * thumbnail data
- */
-typedef struct _thumb_data {
-    int   width;    /* window width */
-    int   height;   /* window height */
-    int   stride;   /* bites par line of frame buffer */
-    int   format;   /* format of thumbnail data */
-    void  *data;    /* thumbnail data */
-} ico_syc_thumb_data_t;
-
 /*============================================================================*/
 /* structure                                                                  */
 /*============================================================================*/
@@ -143,32 +132,17 @@ int ico_syc_change_layer(const char *appid, int surface, int layer);
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   ico_syc_prepare_thumb
- *          Prepare the thumbnail data for mapping to the memory.
- *          User must call this API before calling ico_syc_map_thumb API.
+ * @brief   ico_syc_map_thumb
+ *          Map the thumbnail data for mapping to the memory.
  *
  * @param[in]   surface                 window's surface id
- * @param[in]   framerate               notify cycle [ms]
+ * @param[in]   framerate               notify cycle [frames par sec]
  * @return      result
  * @retval      0                       success
  * @retval      not 0                   error
  */
 /*--------------------------------------------------------------------------*/
-int ico_syc_prepare_thumb(int surface, int framerate);
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_syc_map_thumb
- *          Map the thumbnail data.
- *          User must call free() when delete thumbnail data.
- *
- * @param[in]   surface                 window's surface id
- * @return      Address of the thumbnail data
- * @retval      address                 success
- * @retval      NULL                    error
- */
-/*--------------------------------------------------------------------------*/
-ico_syc_thumb_data_t *ico_syc_map_thumb(int surface);
+int ico_syc_map_thumb(int surface, int framerate);
 
 /*--------------------------------------------------------------------------*/
 /**
index 7220b3e..9b6f77e 100644 (file)
@@ -61,7 +61,7 @@ static msg_t _create_unset_region_msg(const char *appid,
  *          Allocate memory for window resource information.
  *
  * @param[in]   zone                    window zone
- * @param[in]   name                    windo name 
+ * @param[in]   name                    windo name
  * @param[in]   id                      window id
  * @return      resource info
  * @retval      address                 success
@@ -84,8 +84,6 @@ _create_res_window(char *zone, char *name, char *id)
         _ERR("calloc failed");
         return NULL;
     }
-    /* clear memory */
-    memset(info, 0, sizeof(ico_syc_res_window_t));
 
     /* set element */
     info->zone = strdup(zone);
@@ -103,7 +101,7 @@ _create_res_window(char *zone, char *name, char *id)
  *          Allocate memory for sound resource information.
  *
  * @param[in]   zone                    sound zone
- * @param[in]   name                    sound name 
+ * @param[in]   name                    sound name
  * @param[in]   id                      sound id
  * @param[in]   adjust                  adjust type
  * @return      resource info
@@ -127,8 +125,6 @@ _create_res_sound(char *zone, char *name, char *id, int adjust)
         _ERR("calloc failed");
         return NULL;
     }
-    /* clear memory */
-    memset(info, 0, sizeof(ico_syc_res_sound_t));
 
     /* set element */
     info->zone = strdup(zone);
@@ -169,8 +165,6 @@ _create_res_input(char *name, int event)
         _ERR("calloc failed");
         return NULL;
     }
-    /* clear memory */
-    memset(info, 0, sizeof(ico_syc_res_input_t));
 
     /* set element */
     info->name = strdup(name);
@@ -280,12 +274,11 @@ _create_context(char *appid, const ico_syc_res_window_t *window,
     struct ico_syc_res_context *context = NULL;
 
     context = (struct ico_syc_res_context *)
-                              malloc(sizeof(struct ico_syc_res_context));
+                              calloc(1, sizeof(struct ico_syc_res_context));
     if (context == NULL) {
-        _ERR("malloc failed");
+        _ERR("calloc failed");
         return NULL;
     }
-    memset(context, 0, sizeof(struct ico_syc_res_context));
 
     /* set appid */
     strcpy(context->appid, appid);
@@ -600,11 +593,17 @@ _create_set_region_msg(const char *appid, const ico_syc_input_region_t *input,
     json_object_set_string_member(obj, MSG_PRMKEY_APPID, appid);
     json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
 
-    json_object_set_int_member(resobj, MSG_PRMKEY_RES_SURFACE, input->surface);
+    json_object_set_string_member(resobj, MSG_PRMKEY_WINNAME, input->winname);
     json_object_set_int_member(resobj, MSG_PRMKEY_RES_POS_X, input->pos_x);
     json_object_set_int_member(resobj, MSG_PRMKEY_RES_POS_Y, input->pos_y);
     json_object_set_int_member(resobj, MSG_PRMKEY_RES_WIDTH, input->width);
     json_object_set_int_member(resobj, MSG_PRMKEY_RES_HEIGHT, input->height);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_HOT_X, input->hotspot_x);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_HOT_Y, input->hotspot_y);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_CUR_X, input->cursor_x);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_CUR_Y, input->cursor_y);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_CUR_WIDTH, input->cursor_width);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_CUR_HEIGHT, input->cursor_height);
     json_object_set_int_member(resobj, MSG_PRMKEY_RES_ATTR, attr);
     json_object_set_object_member(obj, MSG_PRMKEY_REGION, resobj);
 
@@ -652,11 +651,20 @@ _create_unset_region_msg(const char *appid, const ico_syc_input_region_t *input)
     json_object_set_string_member(obj, MSG_PRMKEY_APPID, appid);
     json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
 
-    json_object_set_int_member(resobj, MSG_PRMKEY_RES_SURFACE, input->surface);
-    json_object_set_int_member(resobj, MSG_PRMKEY_RES_POS_X, input->pos_x);
-    json_object_set_int_member(resobj, MSG_PRMKEY_RES_POS_Y, input->pos_y);
-    json_object_set_int_member(resobj, MSG_PRMKEY_RES_WIDTH, input->width);
-    json_object_set_int_member(resobj, MSG_PRMKEY_RES_HEIGHT, input->height);
+    if (input)  {
+        json_object_set_string_member(resobj, MSG_PRMKEY_WINNAME, input->winname);
+        json_object_set_int_member(resobj, MSG_PRMKEY_RES_POS_X, input->pos_x);
+        json_object_set_int_member(resobj, MSG_PRMKEY_RES_POS_Y, input->pos_y);
+        json_object_set_int_member(resobj, MSG_PRMKEY_RES_WIDTH, input->width);
+        json_object_set_int_member(resobj, MSG_PRMKEY_RES_HEIGHT, input->height);
+    }
+    else    {
+        json_object_set_string_member(resobj, MSG_PRMKEY_WINNAME, " ");
+        json_object_set_int_member(resobj, MSG_PRMKEY_RES_POS_X, 0);
+        json_object_set_int_member(resobj, MSG_PRMKEY_RES_POS_Y, 0);
+        json_object_set_int_member(resobj, MSG_PRMKEY_RES_WIDTH, 0);
+        json_object_set_int_member(resobj, MSG_PRMKEY_RES_HEIGHT, 0);
+    }
     json_object_set_object_member(obj, MSG_PRMKEY_REGION, resobj);
 
     /* create root object */
@@ -713,8 +721,6 @@ ico_syc_cb_res(ico_syc_callback_t callback, void *user_data,
         _ERR("calloc failed");
         return;
     }
-    /* clear memory */
-    memset(res_info, 0, sizeof(ico_syc_res_info_t));
 
     /* start parser */
     parser = json_parser_new();
@@ -821,8 +827,6 @@ ico_syc_cb_region(ico_syc_callback_t callback, void *user_data,
         _ERR("calloc failed");
         return;
     }
-    /* clear memory */
-    memset(region, 0, sizeof(ico_syc_input_region_t));
 
     /* start parser */
     parser = json_parser_new();
@@ -851,13 +855,23 @@ ico_syc_cb_region(ico_syc_callback_t callback, void *user_data,
         return;
     }
     resobj = json_object_get_object_member(obj, MSG_PRMKEY_REGION);
-    
+
     /* get input region information */
-    region->surface = ico_syc_get_int_member(resobj, MSG_PRMKEY_RES_SURFACE);
+    char *p = ico_syc_get_str_member(resobj, MSG_PRMKEY_WINNAME);
+    if (p)  {
+        strncpy(region->winname, p, ICO_SYC_MAX_WINNAME_LEN-1);
+    }
     region->pos_x = ico_syc_get_int_member(resobj, MSG_PRMKEY_RES_POS_X);
     region->pos_y = ico_syc_get_int_member(resobj, MSG_PRMKEY_RES_POS_Y);
     region->width = ico_syc_get_int_member(resobj, MSG_PRMKEY_RES_WIDTH);
     region->height = ico_syc_get_int_member(resobj, MSG_PRMKEY_RES_HEIGHT);
+    region->hotspot_x = ico_syc_get_int_member(resobj, MSG_PRMKEY_RES_HOT_X);
+    region->hotspot_y = ico_syc_get_int_member(resobj, MSG_PRMKEY_RES_HOT_Y);
+    region->cursor_x = ico_syc_get_int_member(resobj, MSG_PRMKEY_RES_CUR_X);
+    region->cursor_y = ico_syc_get_int_member(resobj, MSG_PRMKEY_RES_CUR_Y);
+    region->cursor_width = ico_syc_get_int_member(resobj, MSG_PRMKEY_RES_CUR_WIDTH);
+    region->cursor_height = ico_syc_get_int_member(resobj, MSG_PRMKEY_RES_CUR_HEIGHT);
+    region->attr = ico_syc_get_int_member(resobj, MSG_PRMKEY_RES_ATTR);
 
     /* exec callback */
     callback(event, region, user_data);
index dc51c79..d3ab6d6 100644 (file)
@@ -10,7 +10,7 @@
  * @brief   Common API to connect System Controller
  *          for privilege and general applications
  *
- * @date    Aug-19-2013
+ * @date    Sep-4-2013
  */
 
 #include <stdlib.h>
@@ -48,6 +48,9 @@ static void _del_poll_fd(int fd);
 static void *_poll_fd_thread(void *args);
 static int _connect_client(ico_syc_callback_t callback, void *user_data);
 static void _disconnect_client(void);
+static void ico_syc_cb_notify_changed_state(ico_syc_callback_t callback,
+                                            void *user_data, int event,
+                                            const void *data, size_t len);
 
 /*============================================================================*/
 /* variable & table                                                           */
@@ -211,8 +214,9 @@ _add_queue(void *data, size_t len)
             _ERR("g_queue_pop_head failed");
             return;
         }
+        /* clear data */
+        memset(recv_data, 0, sizeof(recv_info_t));
     }
-    memset(recv_data, 0, sizeof(recv_info_t));
 
     /* set data */
     snprintf(recv_data->data, sizeof(recv_data->data), "%s", (char *)data);
@@ -253,9 +257,6 @@ static int _get_event_from_cmd(int command)
     case MSG_CMD_CHANGE_ACTIVE:
         event = ICO_SYC_EV_WIN_ACTIVE;
         break;
-    case MSG_CMD_PREPARE_THUMB:
-        event = ICO_SYC_EV_THUMB_PREPARE;
-        break;
     case MSG_CMD_MAP_THUMB:
         event = ICO_SYC_EV_THUMB_CHANGE;
         break;
@@ -292,6 +293,9 @@ static int _get_event_from_cmd(int command)
     case MSG_CMD_UNSET_REGION:
         event = ICO_SYC_EV_INPUT_UNSET;
         break;
+    case MSG_CMD_NOTIFY_CHANGED_STATE:
+        event = ICO_SYC_EV_STATE_CHANGE;
+        break;
     default:
         break;
     }
@@ -342,9 +346,9 @@ _exec_callback(void *user_data)
             ico_syc_cb_win_attr(syc_callback, user_data, event,
                                 recv_data->data, recv_data->len);
             break;
-        case ICO_SYC_EV_THUMB_PREPARE:
         case ICO_SYC_EV_THUMB_CHANGE:
         case ICO_SYC_EV_THUMB_UNMAP:
+        case ICO_SYC_EV_THUMB_ERROR:
             ico_syc_cb_thumb(syc_callback, user_data, event,
                              recv_data->data, recv_data->len);
             break;
@@ -356,6 +360,10 @@ _exec_callback(void *user_data)
             ico_syc_cb_userlist(syc_callback, user_data, event,
                                 recv_data->data, recv_data->len);
             break;
+        case ICO_SYC_EV_LASTINFO:
+            ico_syc_cb_lastinfo(syc_callback, user_data, event,
+                                recv_data->data, recv_data->len);
+            break;
         case ICO_SYC_EV_AUTH_FAIL:
             ico_syc_cb_auth(syc_callback, user_data, event);
             break;
@@ -372,6 +380,10 @@ _exec_callback(void *user_data)
             ico_syc_cb_region(syc_callback, user_data, event,
                               recv_data->data, recv_data->len);
             break;
+        case ICO_SYC_EV_STATE_CHANGE:
+            ico_syc_cb_notify_changed_state(syc_callback, user_data, event,
+                                            recv_data->data, recv_data->len);
+            break;
         default:
             break;
         }
@@ -697,4 +709,77 @@ ico_syc_disconnect(void)
 
     return;
 }
+
+/*============================================================================*/
+/* internal common function                                                   */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_res
+ *          Execute callback function. (ICO_SYC_EV_RES_ACQUIRE
+ *                                      ICO_SYC_EV_RES_DEPRIVE
+ *                                      ICO_SYC_EV_RES_WAITING
+ *                                      ICO_SYC_EV_RES_REVERT
+ *                                      ICO_SYC_EV_RES_RELEASE)
+ *
+ * @param[in]   callback                callback function
+ * @param[in]   user_data               pased data on called callback function
+ * @param[in]   event                   event code
+ * @param[in]   data                    message data
+ * @param[in]   len                     length of data
+ */
+/*--------------------------------------------------------------------------*/
+static void
+ico_syc_cb_notify_changed_state(ico_syc_callback_t callback, void *user_data,
+                                int event, const void *data, size_t len)
+{
+    JsonParser *parser  = NULL;
+    GError *error       = NULL;
+    gboolean gbool      = FALSE;
+    JsonNode *root      = NULL;
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+
+    ico_syc_state_info_t state_info;
+
+    /* start parser */
+    parser = json_parser_new();
+    gbool = json_parser_load_from_data(parser, data, len, &error);
+    if (gbool == FALSE) {
+        g_object_unref(parser);
+        _ERR("json_parser_load_from_data failed");
+        return;
+    }
+
+    /* get root node */
+    root = json_parser_get_root(parser);
+    if (root == NULL) {
+        g_object_unref(parser);
+        _ERR("json_parser_get_root failed (root is NULL)");
+        return;
+    }
+
+    /* get object from root */
+    obj = json_node_get_object(root);
+    /* check message */
+    if (json_object_has_member(obj, MSG_PRMKEY_ARG) == FALSE) {
+        g_object_unref(parser);
+        _ERR("invalid message" );
+        return;
+    }
+    /* get object from obj */
+    argobj = json_object_get_object_member(obj, MSG_PRMKEY_ARG);
+
+    state_info.id    = ico_syc_get_int_member(argobj, MSG_PRMKEY_STATEID);
+    state_info.state = ico_syc_get_int_member(argobj, MSG_PRMKEY_STATE);
+
+    /* exec callback */
+    callback(event, &state_info, user_data);
+
+    /* free memory */
+    g_object_unref(parser);
+
+    return;
+}
 /* vim: set expandtab ts=4 sw=4: */
index 370e183..f567019 100644 (file)
@@ -85,8 +85,9 @@ _store_data(msg_str_t data, size_t len)
             _ERR("g_queue_pop_head failed");
             return;
         }
+        /* clear data */
+        memset(send_data, 0, sizeof(send_info_t));
     }
-    memset(send_data, 0, sizeof(send_info_t));
 
     /* set data */
     snprintf(send_data->data, sizeof(send_data->data), "%s", (char *)data);
index 4b0376d..625cf36 100644 (file)
@@ -10,7 +10,7 @@
  * @brief   User Control API
  *          for privilege applications
  *
- * @date    Aug-22-2013
+ * @date    Sep-4-2013
  */
 
 #include <string.h>
@@ -25,7 +25,9 @@
 /*============================================================================*/
 static msg_t _create_change_user_msg(const char *appid, const char *name,
                                      const char *password);
-static msg_t _create_userlist_msg(const char *appid);
+static msg_t _create_get_userlist_msg(const char *appid);
+static msg_t _create_get_lastinfo_msg(const char *appid);
+static msg_t _create_set_lastinfo_msg(const char *appid, const char *lastinfo);
 
 /*============================================================================*/
 /* static function                                                            */
@@ -82,7 +84,7 @@ _create_change_user_msg(const char *appid, const char *name,
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   _create_userlist_msg
+ * @brief   _create_get_userlist_msg
  *          Create the message to get the user list.
  *
  * @param[in]   appid                   application id
@@ -92,7 +94,7 @@ _create_change_user_msg(const char *appid, const char *name,
  */
 /*--------------------------------------------------------------------------*/
 static msg_t
-_create_userlist_msg(const char *appid)
+_create_get_userlist_msg(const char *appid)
 {
     JsonObject *obj     = NULL;
     JsonGenerator *gen  = NULL;
@@ -122,6 +124,95 @@ _create_userlist_msg(const char *appid)
     return gen;
 }
 
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_get_lastinfo_msg
+ *          Create the message to get the application's last information.
+ *
+ * @param[in]   appid                   application id
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_get_lastinfo_msg(const char *appid)
+{
+    JsonObject *obj     = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object */
+    obj = json_object_new();
+    if (obj == NULL) {
+        _ERR("json_object_new failed");
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_GET_LASTINFO);
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, appid);
+    json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
+    json_object_set_null_member(obj, MSG_PRMKEY_ARG);
+
+    /* create root object */
+    root = json_node_new(JSON_NODE_OBJECT);
+    json_node_take_object(root, obj);
+
+    /* create generator object */
+    gen = json_generator_new();
+    json_generator_set_root(gen, root);
+
+    return gen;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_set_lastinfo_msg
+ *          Create the message to set the application's last information.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   lastinfo                application's last information
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_set_lastinfo_msg(const char *appid, const char *lastinfo)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object */
+    obj = json_object_new();
+    argobj = json_object_new();
+    if (obj == NULL || argobj == NULL) {
+        _ERR("json_object_new failed");
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_GET_LASTINFO);
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, appid);
+    json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
+
+    json_object_set_string_member(argobj, MSG_PRMKEY_LASTINFO, lastinfo);
+    json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
+
+    /* create root object */
+    root = json_node_new(JSON_NODE_OBJECT);
+    json_node_take_object(root, obj);
+
+    /* create generator object */
+    gen = json_generator_new();
+    json_generator_set_root(gen, root);
+
+    return gen;
+}
+
 /*============================================================================*/
 /* internal common function                                                   */
 /*============================================================================*/
@@ -182,8 +273,6 @@ ico_syc_cb_userlist(ico_syc_callback_t callback, void *user_data,
         _ERR("calloc failed");
         return;
     }
-    /* clear memory */
-    memset(userlist, 0, sizeof(ico_syc_userlist_t));
 
     /* start parser */
     parser = json_parser_new();
@@ -226,11 +315,11 @@ ico_syc_cb_userlist(ico_syc_callback_t callback, void *user_data,
     }
     else {
         /* alloc memory */
-        list = malloc(sizeof(char *) * num);
+        list = calloc(1, sizeof(char *) * num);
         if (list == NULL) {
             g_object_unref(parser);
             free(userlist);
-            _ERR("malloc failed");
+            _ERR("calloc failed");
             return;
         }
         /* set user name */
@@ -262,6 +351,81 @@ ico_syc_cb_userlist(ico_syc_callback_t callback, void *user_data,
     return;
 }
 
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_lastinfo
+ *          Execute callback function. (ICO_SYC_EV_LASTINFO)
+ *
+ * @param[in]   callback                callback function
+ * @param[in]   user_data               passed data on called callback function
+ * @param[in]   event                   event code
+ * @param[in]   data                    message data
+ * @param[in]   len                     length of data
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+ico_syc_cb_lastinfo(ico_syc_callback_t callback, void *user_data, int event,
+                    const void *data, size_t len)
+{
+    JsonParser *parser  = NULL;
+    GError *error       = NULL;
+    gboolean gbool      = FALSE;
+    JsonNode *root      = NULL;
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+
+    char *lastinfo      = NULL;
+
+    /* start parser */
+    parser = json_parser_new();
+    gbool = json_parser_load_from_data(parser, data, len, &error);
+    if (gbool == FALSE) {
+        g_object_unref(parser);
+        _ERR("json_parser_load_from_data failed");
+        return;
+    }
+
+    /* get root node */
+    root = json_parser_get_root(parser);
+    if (root == NULL) {
+        g_object_unref(parser);
+        _ERR("json_parser_get_root failed (root is NULL)");
+        return;
+    }
+
+    /* get object from root */
+    obj = json_node_get_object(root);
+    /* check message */
+    if (json_object_has_member(obj, MSG_PRMKEY_ARG) == FALSE) {
+        g_object_unref(parser);
+        _INFO("last information does not exist");
+        return;
+    }
+    /* get object from obj */
+    argobj = json_object_get_object_member(obj, MSG_PRMKEY_ARG);
+
+    /* check message */
+    if (json_object_has_member(argobj, MSG_PRMKEY_LASTINFO) == FALSE) {
+        g_object_unref(parser);
+        _INFO("last information does not exist");
+        return;
+    }
+
+    /* set data */
+    lastinfo = strdup(ico_syc_get_str_member(argobj, MSG_PRMKEY_LASTINFO));
+
+    /* exec callback */
+    callback(event, lastinfo, user_data);
+
+    /* free memory */
+    g_object_unref(parser);
+    if (lastinfo != NULL) free(lastinfo);
+
+    return;
+}
+
 /*============================================================================*/
 /* public interface function                                                  */
 /*============================================================================*/
@@ -316,7 +480,64 @@ ico_syc_get_userlist(void)
     appid = ico_syc_get_appid();
 
     /* make message */
-    msg = _create_userlist_msg(appid);
+    msg = _create_get_userlist_msg(appid);
+    /* send message */
+    (void)ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_get_lastinfo
+ *          Get the application's last information.
+ *          Callback function notifies the application's last information.
+ *
+ * @param       none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API void
+ico_syc_get_lastinfo(void)
+{
+    msg_t msg;
+    char *appid;
+
+    /* get appid */
+    appid = ico_syc_get_appid();
+
+    /* make message */
+    msg = _create_get_lastinfo_msg(appid);
+    /* send message */
+    (void)ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_set_lastinfo
+ *          Set the application's last information.
+ *
+ * @param[in]   lastinfo                application's last information
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API void
+ico_syc_set_lastinfo(const char *lastinfo)
+{
+    msg_t msg;
+    char *appid;
+
+    /* get appid */
+    appid = ico_syc_get_appid();
+
+    /* make message */
+    msg = _create_set_lastinfo_msg(appid, lastinfo);
     /* send message */
     (void)ico_syc_send_msg(msg);
     /* free send message */
index ae85481..c3fa0e2 100644 (file)
 /*============================================================================*/
 #define _CMD_SHOW_WIN           0
 #define _CMD_HIDE_WIN           1
-#define _CMD_MAP_THUMB          10
-#define _CMD_UNMAP_THUMB        11
-#define _CMD_SHOW_LAYER         20
-#define _CMD_HIDE_LAYER         21
-#define _CMD_SET_LAYER_ATTR     22
+#define _CMD_SHOW_LAYER         10
+#define _CMD_HIDE_LAYER         11
+#define _CMD_SET_LAYER_ATTR     12
 
 /*============================================================================*/
 /* define static function prototype                                           */
@@ -43,9 +41,8 @@ static msg_t _create_win_move_msg(const char *appid, int surface,
 static msg_t _create_active_win_msg(const char *appid, int surface);
 static msg_t _create_change_layer_msg(const char *appid, int surface,
                                       int layer);
-static msg_t _create_prepare_thumb_msg(const char *appid, int surface,
-                                       int framerate);
-static msg_t _create_thumb_msg(const char *appid, int surface, int type);
+static msg_t _create_map_thumb_msg(const char *appid, int surface, int framerate);
+static msg_t _create_unmap_thumb_msg(const char *appid, int surface);
 static msg_t _create_layer_msg(const char *appid, int layer, int attr,
                                int type);
 
@@ -284,25 +281,24 @@ _create_change_layer_msg(const char *appid, int surface, int layer)
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   _create_prepare_thumb_msg
- *          Create the message to prepare thumbnail.
+ * @brief   _create_map_thumb_msg
+ *          Create the message to map thumbnail.
  *
  * @param[in]   appid                   application id
  * @param[in]   surface                 window's surface id
- * @param[in]   framerate               notify cycle [ms]
+ * @param[in]   framerate               notify cycle [frames par sec]
  * @return      json generator
  * @retval      json generator          success
  * @retval      NULL                    error
  */
 /*--------------------------------------------------------------------------*/
 static msg_t
-_create_prepare_thumb_msg(const char *appid, int surface, int framerate)
+_create_map_thumb_msg(const char *appid, int surface, int framerate)
 {
     JsonObject *obj     = NULL;
     JsonObject *argobj  = NULL;
     JsonGenerator *gen  = NULL;
     JsonNode *root      = NULL;
-    int cmd             = -1;
 
     /* create json object */
     obj = json_object_new();
@@ -313,7 +309,7 @@ _create_prepare_thumb_msg(const char *appid, int surface, int framerate)
     }
 
     /* set message */
-    json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_MAP_THUMB);
     json_object_set_string_member(obj, MSG_PRMKEY_APPID, appid);
     json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
 
@@ -334,25 +330,23 @@ _create_prepare_thumb_msg(const char *appid, int surface, int framerate)
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   _create_thumb_msg
- *          Create the message to map/unmap thumbnail.
+ * @brief   _create_unmap_thumb_msg
+ *          Create the message to unmap thumbnail.
  *
  * @param[in]   appid                   application id
  * @param[in]   surface                 window's surface id
- * @param[in]   type                    type of command
  * @return      json generator
  * @retval      json generator          success
  * @retval      NULL                    error
  */
 /*--------------------------------------------------------------------------*/
 static msg_t
-_create_thumb_msg(const char *appid, int surface, int type)
+_create_unmap_thumb_msg(const char *appid, int surface)
 {
     JsonObject *obj     = NULL;
     JsonObject *argobj  = NULL;
     JsonGenerator *gen  = NULL;
     JsonNode *root      = NULL;
-    int cmd             = -1;
 
     /* create json object */
     obj = json_object_new();
@@ -362,16 +356,8 @@ _create_thumb_msg(const char *appid, int surface, int type)
         return NULL;
     }
 
-    /* set command */
-    if (type == _CMD_MAP_THUMB) {
-        cmd = MSG_CMD_MAP_THUMB;
-    }
-    else if (type == _CMD_UNMAP_THUMB) {
-        cmd = MSG_CMD_UNMAP_THUMB;
-    }
-
     /* set message */
-    json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_UNMAP_THUMB);
     json_object_set_string_member(obj, MSG_PRMKEY_APPID, appid);
     json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
 
@@ -485,8 +471,6 @@ ico_syc_cb_win(ico_syc_callback_t callback, void *user_data,
         _ERR("calloc failed");
         return;
     }
-    /* clear memory */
-    memset(win_info, 0, sizeof(ico_syc_win_info_t));
 
     /* start parser */
     parser = json_parser_new();
@@ -569,8 +553,6 @@ ico_syc_cb_win_attr(ico_syc_callback_t callback, void *user_data,
         _ERR("calloc failed");
         return;
     }
-    /* clear memory */
-    memset(win_attr, 0, sizeof(ico_syc_win_attr_t));
 
     /* start parser */
     parser = json_parser_new();
@@ -633,7 +615,7 @@ ico_syc_cb_win_attr(ico_syc_callback_t callback, void *user_data,
 /**
  * @internal
  * @brief   ico_syc_cb_thumb
- *          Execute callback function. (ICO_SYC_EV_THUMB_PREPARE
+ *          Execute callback function. (ICO_SYC_EV_THUMB_ERROR
  *                                      ICO_SYC_EV_THUMB_CHANGE
  *                                      ICO_SYC_EV_THUMB_UNMAP)
  *
@@ -664,8 +646,6 @@ ico_syc_cb_thumb(ico_syc_callback_t callback, void *user_data,
         _ERR("calloc failed");
         return;
     }
-    /* clear memory */
-    memset(thumb_info, 0, sizeof(ico_syc_thumb_info_t));
 
     /* start parser */
     parser = json_parser_new();
@@ -752,8 +732,6 @@ ico_syc_cb_layer(ico_syc_callback_t callback, void *user_data,
         _ERR("calloc failed");
         return;
     }
-    /* clear memory */
-    memset(layer_attr, 0, sizeof(ico_syc_layer_attr_t));
 
     /* start parser */
     parser = json_parser_new();
@@ -987,9 +965,8 @@ ico_syc_change_layer(const char *appid, int surface, int layer)
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   ico_syc_prepare_thumb
+ * @brief   ico_syc_map_thumb
  *          Prepare the thumbnail data for mapping to the memory.
- *          User must call this API before calling ico_syc_map_thumb API.
  *
  * @param[in]   surface                 window's surface id
  * @param[in]   framerate               notify cycle [ms]
@@ -999,7 +976,7 @@ ico_syc_change_layer(const char *appid, int surface, int layer)
  */
 /*--------------------------------------------------------------------------*/
 ICO_API int
-ico_syc_prepare_thumb(int surface, int framerate)
+ico_syc_map_thumb(int surface, int framerate)
 {
     int ret = ICO_SYC_ERR_NONE;
     msg_t msg;
@@ -1009,7 +986,7 @@ ico_syc_prepare_thumb(int surface, int framerate)
     appid = ico_syc_get_appid();
 
     /* make message */
-    msg = _create_prepare_thumb_msg(appid, surface, framerate);
+    msg = _create_map_thumb_msg(appid, surface, framerate);
     /* send message */
     ret = ico_syc_send_msg(msg);
     /* free send message */
@@ -1020,50 +997,6 @@ ico_syc_prepare_thumb(int surface, int framerate)
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   ico_syc_map_thumb
- *          Map the thumbnail data.
- *
- * @param[in]   surface                 window's surface id
- * @return      Address of the thumbnail data
- * @retval      address                 success
- * @retval      NULL                    error
- */
-/*--------------------------------------------------------------------------*/
-ICO_API ico_syc_thumb_data_t *
-ico_syc_map_thumb(int surface)
-{
-    ico_syc_thumb_data_t *thumb = NULL;
-    int ret = ICO_SYC_ERR_NONE;
-    msg_t msg;
-    char *appid;
-
-    thumb = (ico_syc_thumb_data_t *)calloc(1, sizeof(ico_syc_thumb_data_t));
-    if (thumb == NULL) {
-        _ERR("calloc failed");
-        return NULL;
-    }
-
-    /* get appid */
-    appid = ico_syc_get_appid();
-
-    /* make message */
-    msg = _create_thumb_msg(appid, surface, _CMD_MAP_THUMB);
-    /* send message */
-    ret = ico_syc_send_msg(msg);
-    /* free send message */
-    ico_syc_free_msg(msg);
-
-    if (ret != ICO_SYC_ERR_NONE) {
-        free(thumb);
-        _ERR("send message failed");
-        return NULL;
-    }
-
-    return thumb;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
  * @brief   ico_syc_unmap_thumb
  *          Unmap the thumbnail data.
  *          User calls this API when receiving the notification that
@@ -1086,7 +1019,7 @@ ico_syc_unmap_thumb(int surface)
     appid = ico_syc_get_appid();
 
     /* make message */
-    msg = _create_thumb_msg(appid, surface, _CMD_UNMAP_THUMB);
+    msg = _create_unmap_thumb_msg(appid, surface);
     /* send message */
     ret = ico_syc_send_msg(msg);
     /* free send message */
index 43f6785..525c015 100644 (file)
@@ -1,2 +1,2 @@
 SUBDIRS=\
-   state-machine 
+   state-machine
index fa315c1..17885ba 100644 (file)
@@ -31,32 +31,32 @@ CicoStateAction::CicoStateAction()
 }
 
 /**
- * @brief CicoStateAction::onEnttry
+ * @brief CicoStateAction::onEntry
  * @param const CicoEvent& trigger event data
  * @param const CicoState* Object of the caller
  * @param int Added value at the time of registration action
  */
-void CicoStateAction::onEnttry(const CicoEvent&, const CicoState*, int)
+void CicoStateAction::onEntry(const CicoEvent&, const CicoState*, int)
 {
 }
 
 /**
- * @brief CicoStateAction::onEnttry
+ * @brief CicoStateAction::onEntry
  * @param const CicoEvent& trigger event data
  * @param const CicoFinalState* Object of the caller
  * @param int Added value at the time of registration action
  */
-void CicoStateAction::onEnttry(const CicoEvent&, const CicoFinalState*, int)
+void CicoStateAction::onEntry(const CicoEvent&, const CicoFinalState*, int)
 {
 }
 
 /**
- * @brief CicoStateAction::onEnttry
+ * @brief CicoStateAction::onEntry
  * @param const CicoEvent& trigger event data
  * @param const CicoHistoryState* Object of the caller
  * @param int Added value at the time of registration action
  */
-void CicoStateAction::onEnttry(const CicoEvent&, const CicoHistoryState*, int)
+void CicoStateAction::onEntry(const CicoEvent&, const CicoHistoryState*, int)
 {
 }
 
index 04ef4ad..7e6bde2 100644 (file)
@@ -46,11 +46,11 @@ public:
     // Constructior
                 CicoStateAction();
 
-    virtual void onEnttry(const CicoEvent& ev, const CicoState* stt,
+    virtual void onEntry(const CicoEvent& ev, const CicoState* stt,
                           int addval);
-    virtual void onEnttry(const CicoEvent& ev, const CicoFinalState* stt,
+    virtual void onEntry(const CicoEvent& ev, const CicoFinalState* stt,
                           int addval);
-    virtual void onEnttry(const CicoEvent& ev, const CicoHistoryState* stt,
+    virtual void onEntry(const CicoEvent& ev, const CicoHistoryState* stt,
                           int addval);
 
     virtual void onExit(const CicoEvent& ev, const CicoState* stt,
index 51a4f6b..a416c2e 100644 (file)
@@ -521,13 +521,13 @@ void CicoStateCore::onEntryRun(CicoStateAction* run, const CicoEvent& ev,
 {
     if (run) {
         if (true == isState()) {
-            run->onEnttry(ev, (CicoState*)this, val);
+            run->onEntry(ev, (CicoState*)this, val);
         }
         else if (true == isFinalState()) {
-            run->onEnttry(ev, (CicoFinalState*)this, val);
+            run->onEntry(ev, (CicoFinalState*)this, val);
         }
         else if (true == isHistoryState()) {
-            run->onEnttry(ev, (CicoHistoryState*)this, val);
+            run->onEntry(ev, (CicoHistoryState*)this, val);
         }
     }
 }
@@ -960,7 +960,8 @@ bool CicoStateCore::onDoExec(const CicoEvent& ev)
             getLogPartF(this, sl);
             std::string el;
             getLogPartF(ev, el);
-            _INFO("%s.onDoExec(%s).onDo", sl.c_str(), el.c_str());
+            //_INFO("%s.onDoExec(%s).onDo", sl.c_str(), el.c_str());
+            _INFO("TRANSITION:%s-%s(onDo)", sl.c_str(), el.c_str());
         }
     }
     else if (EPUnused != m_entry.suk) {
@@ -971,7 +972,18 @@ bool CicoStateCore::onDoExec(const CicoEvent& ev)
             getLogPartF(this, sl);
             std::string el;
             getLogPartF(ev, el);
-            _INFO("%s.onDoExec(%s).onEntry", sl.c_str(), el.c_str());
+           // _INFO("%s.onDoExec(%s).onEntry", sl.c_str(), el.c_str());
+            _INFO("TRANSITION:%s-%s(onEntry)", sl.c_str(), el.c_str(), sl.c_str());
+        }
+    }
+    else {
+        bR = false;
+        {
+            std::string sl;
+            getLogPartF(this, sl);
+            std::string el;
+            getLogPartF(ev, el);
+            _INFO("TRANSITION:%s-%s->%s(no tran.)", sl.c_str(), el.c_str(), sl.c_str());
         }
     }
     return bR;
index 2570039..7bd5b7a 100644 (file)
@@ -30,7 +30,7 @@
 #define LOG_TAG "STT_MCN"
 
 #ifdef LOG_CICO
-#   include "ico_log.h"
+#   include <ico_log.h>
 #   define _ERR(fmt, ...)  ICO_ERR(fmt, ##__VA_ARGS__)
 #   define _INFO(fmt, ...) ICO_INF(fmt, ##__VA_ARGS__)
 #   define _DBG(fmt, ...)  ICO_DBG(fmt, ##__VA_ARGS__)
index 25b3a77..c6dd664 100644 (file)
@@ -8,23 +8,24 @@ lib_LTLIBRARIES =                             \
 libico_state_machine_la_LDFLAGS = -version-info 0:9:0 
 
 libico_state_machine_la_SOURCES =      \
-       CicoStateCore.cpp \
-       CicoEvent.cpp \
-       CicoEventInfo.cpp \
-       CicoStateMachine.cpp \
-       CicoState.cpp \
-       CicoFinalState.cpp \
-       CicoHistoryState.cpp \
-       CicoStateAction.cpp \
-       CicoStateMachineCreator.cpp \
-       CicoBlockParser.cpp \
-       ico_StateMachine_CWrapper.cpp \
-    ico_log.c
+       CicoStateCore.cpp                               \
+       CicoEvent.cpp                                   \
+       CicoEventInfo.cpp                               \
+       CicoStateMachine.cpp                    \
+       CicoState.cpp                                   \
+       CicoFinalState.cpp                              \
+       CicoHistoryState.cpp                    \
+       CicoStateAction.cpp                     \
+       CicoStateMachineCreator.cpp     \
+       CicoBlockParser.cpp                     \
+       ico_StateMachine_CWrapper.cpp
 
 libico_state_machine_la_CPPFLAGS =     \
        $(GCC_CXXFLAGS)                                 \
        -DLOG_CICO                                              \
-    @DLOG_CFLAGS@
+    @DLOG_CFLAGS@                                      \
+       -I../../../include                              \
+       -I/usr/include/ico-util
 
 libico_state_machine_la_LIBADD =       \
     @DLOG_LIBS@
index 89fe910..67957a3 100644 (file)
@@ -1460,9 +1460,9 @@ class CicoCWrapperCallbackAction :public CicoStateAction
 public:
     CicoCWrapperCallbackAction();
     // entry-Action
-    void onEnttry(const CicoEvent& ev, const CicoState* stt, int addval);
-    void onEnttry(const CicoEvent& ev, const CicoFinalState* stt, int addval);
-    void onEnttry(const CicoEvent& ev, const CicoHistoryState* stt,
+    void onEntry(const CicoEvent& ev, const CicoState* stt, int addval);
+    void onEntry(const CicoEvent& ev, const CicoFinalState* stt, int addval);
+    void onEntry(const CicoEvent& ev, const CicoHistoryState* stt,
                   int addval);
     // exit-Action
     void onExit(const CicoEvent& ev, const CicoState* stt, int addval);
@@ -1486,19 +1486,19 @@ CicoCWrapperCallbackAction::CicoCWrapperCallbackAction()
  * @param stt entery state-object
  * @param addval Additional information
  */
-void CicoCWrapperCallbackAction::onEnttry(const CicoEvent& ev,
+void CicoCWrapperCallbackAction::onEntry(const CicoEvent& ev,
                                           const CicoState* stt, int addval)
 {
     callbackActionCPP(ev, (CicoStateCore*)stt, addval);
 }
 
-void CicoCWrapperCallbackAction::onEnttry(const CicoEvent& ev,
+void CicoCWrapperCallbackAction::onEntry(const CicoEvent& ev,
                                           const CicoFinalState* stt, int addval)
 {
     callbackActionCPP(ev, (CicoStateCore*)stt, addval);
 }
 
-void CicoCWrapperCallbackAction::onEnttry(const CicoEvent& ev,
+void CicoCWrapperCallbackAction::onEntry(const CicoEvent& ev,
                                           const CicoHistoryState* stt, int addval)
 {
     callbackActionCPP(ev, (CicoStateCore*)stt, addval);
diff --git a/lib/misc/state-machine/ico_log.c b/lib/misc/state-machine/ico_log.c
deleted file mode 100644 (file)
index fad8324..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-
-/*------------------------------------------------------------------------*/
-/**
- *  @file   ico_log.c
- *
- *  @brief  
- */
-/*------------------------------------------------------------------------*/
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <time.h>
-#include "ico_log.h"
-
-/*========================================================================*/
-/**
- *  static variable
- */
-/*========================================================================*/
-
-int  time_zone    = 99*60*60;   /*!< local time difference(sec)           */
-int  log_level    = 0x7FFFFFFF; /*!< output level debug log               */
-bool flush_mode   = true;       /*!< flush mode flag                      */  
-bool initialized  = false;      /*!< initialized flag                     */
-FILE *log_fd      = NULL;       /*!< file descriptor of output debug log  */
-int  log_lines    = 0;          /*!< output lines                         */
-char log_prog[32] = {0,};       /*!< name of output source module         */
-
-                                                                            
-/*------------------------------------------------------------------------*/
-/**
- *  @brief  printout log message
- *
- *  @param [in] level   log output level
- *  @param [in] fmt     message format(same as printf)
- *  @param [in] ...     arguments if need
- */
-/*------------------------------------------------------------------------*/
-void
-ico_log_print(int level, const char *fmt, ...)
-{
-    if (log_level < level) {
-        return;
-    }
-    va_list     list;
-
-    if (NULL == log_fd) {
-        ico_log_open(NULL);
-    }
-#if ICO_APF_LOG_STDOUT == 0
-    else if (log_lines >= (ICO_LOG_MAXLINES-2)) {
-        if (log_lines >= ICO_LOG_MAXLINES)  {
-            ico_log_close();
-            ico_log_open(log_prog);
-        }
-        else    {
-            fflush(log_fd);
-        }
-    }
-#endif /*ICO_APF_LOG_STDOUT*/
-    if (NULL != log_fd) {
-        va_start(list, fmt);
-        vfprintf(log_fd, fmt, list);
-        va_end(list);
-        if (flush_mode)  {
-            fflush(log_fd);
-        }
-    }
-    if (log_fd != stdout)   {
-        log_lines ++;
-    }
-}
-
-/*------------------------------------------------------------------------*/
-/**
- *  @brief  open log file
- *
- *  @param [in] prog    program name
- */
-/*------------------------------------------------------------------------*/
-void
-ico_log_open(const char *prog)
-{
-#if ICO_LOG_STDOUT == 0
-    int     idx;
-    char    sPath[128];
-    char    sPath2[128];
-#endif /*ICO_LOG_STDOUT*/
-
-    if (NULL != log_fd) {
-        fflush(log_fd);
-        if (log_fd != stdout)   {
-            fclose(log_fd);
-        }
-    }
-
-    log_lines = 0;
-
-    if ((! prog) || (*prog == 0)) {
-        log_fd = stdout;
-        log_prog[0] = 0;
-        return;
-    }
-    else {
-        strncpy(log_prog, prog, sizeof(log_prog)-1);
-        log_prog[sizeof(log_prog)-1] = 0;
-    }
-#if ICO_LOG_STDOUT > 0
-    log_fd = stdout;
-#else  /*ICO_LOG_STDOUT*/
-    snprintf(sPath, sizeof(sPath)-1, "%s/%s.log%d",
-             ICO_LOG_DIR, log_prog, ICO_LOG_MAXFILES-1);
-    (void)remove(sPath);
-
-    for (idx = (ICO_LOG_MAXFILES-1); idx > 0; idx--) {
-        strcpy(sPath2, sPath);
-        if (idx > 1)    {
-            snprintf(sPath, sizeof(sPath)-1, "%s/%s.log%d",
-                     ICO_LOG_DIR, log_prog, idx-1);
-        }
-        else    {
-            snprintf(sPath, sizeof(sPath)-1, "%s/%s.log",
-                     ICO_LOG_DIR, log_prog);
-        }
-        (void)rename(sPath, sPath2);
-    }
-
-    log_fd = fopen(sPath, "w");
-    if (NULL == log_fd) {
-        log_fd = stdout;
-    }
-    else if ((initialized == false) &&
-             (log_fd != stdout) && (log_fd != stderr)) {
-        initialized = true;
-        fflush(stdout);
-        fflush(stderr);
-        stdout = log_fd;
-        stderr = log_fd;
-    }
-#endif /*ICO_LOG_STDOUT*/
-}
-
-/*------------------------------------------------------------------------*/
-/**
- *  @brief  close log file
- */
-/*------------------------------------------------------------------------*/
-void
-ico_log_close(void)
-{
-#if ICO_LOG_STDOUT == 0
-    if (NULL != log_fd) {
-        fflush(log_fd);
-        if (log_fd != stdout) {
-            fclose(log_fd);
-        }
-        log_fd = (FILE *)NULL;
-    }
-#endif /*ICO_LOG_STDOUT*/
-}
-
-/*------------------------------------------------------------------------*/
-/**
- *  @brief  flush log file
- */
-/*------------------------------------------------------------------------*/
-void
-ico_log_flush(void)
-{
-    if ((NULL != log_fd) && (false == flush_mode)) {
-        fflush(log_fd);
-    }
-}
-
-/*------------------------------------------------------------------------*/
-/**
- *  @brief   get current time string
- *
- *  @param [in] level   log level string(header of log message)
- *  @return current time string
- */
-/*------------------------------------------------------------------------*/
-char *
-ico_get_str_cur_time(const char *level)
-{
-    struct timeval  NowTime;
-    extern long     timezone;
-    static char     sBuf[28];
-
-    gettimeofday(&NowTime, (struct timezone *)0);
-    if (time_zone > (24*60*60)) {
-        tzset();
-        time_zone = timezone;
-    }
-    NowTime.tv_sec -= time_zone;
-
-    sprintf(sBuf, "%02d:%02d:%02d.%03d[%s]@%d",
-            (int)((NowTime.tv_sec/3600) % 24),
-            (int)((NowTime.tv_sec/60) % 60),
-            (int)(NowTime.tv_sec % 60),
-            (int)NowTime.tv_usec/1000, level, getpid());
-
-    return sBuf;
-}
-
-/*------------------------------------------------------------------------*/
-/**
- *  @brief  set log output level
- *
- *  @param [in] level   log output level
- */
-/*------------------------------------------------------------------------*/
-void
-ico_log_set_level(int level)
-{
-    log_level = level & (~(ICO_LOG_FLUSH|ICO_LOG_NOFLUSH));
-
-    if (log_level & (ICO_LOG_FLUSH|ICO_LOG_NOFLUSH)) {
-        if (log_level & ICO_LOG_FLUSH) {
-            flush_mode = true;
-        }
-        else    {
-            flush_mode = false;
-        }
-    }
-}
-/* vim:set expandtab ts=4 sw=4: */
diff --git a/lib/misc/state-machine/ico_log.h b/lib/misc/state-machine/ico_log.h
deleted file mode 100644 (file)
index 3b5e224..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-
-/*========================================================================*/    
-/**
- *  @file   ico_log.h
- *
- *  @brief  debug log function
- */
-/*========================================================================*/    
-#ifndef __ICO_LOG_H__
-#define __ICO_LOG_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef ICO_LOG_STDOUT
-#define ICO_LOG_STDOUT      0
-                            /**!< Log output to stdout(=1) or file(=0) */
-#endif /*ICO_APF_LOG_STDOUT*/
-
-#define ICO_LOG_DIR         "/var/log/ico"
-                           /**!< Directory name of Log destination */
-
-/* Maximum lines/files */
-#define ICO_LOG_MAXLINES    10000
-                            /**!< Maximum output lines of log file  */
-#define ICO_LOG_MAXFILES    6
-                            /**!< Maximum number of the log file    */
-
-/* Log output level */
-#define ICO_LOG_DEBUG       0x0080  /**!< Debug write */
-#define ICO_LOG_INFO        0x0040  /**!< Information */
-#define ICO_LOG_WARNING     0x0010  /**!< Warning     */
-#define ICO_LOG_CRITICAL    0x0008  /**!< Critical    */
-#define ICO_LOG_ERROR       0x0004  /**!< Error       */
-
-/* Log output flush */
-#define ICO_LOG_FLUSH       0x4000  /**!< Log outout with log flush     */
-#define ICO_LOG_NOFLUSH     0x2000  /**!< Log output without log flush  */
-
-#define ICO_TRA(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_DEBUG,                \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("DBG"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-#define ICO_DBG(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_DEBUG,                \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("DBG"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-#define ICO_INF(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_INFO,                 \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("INF"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-#define ICO_WRN(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_WARNING,              \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("WRN"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-#define ICO_CRI(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_CRITICAL,             \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("CRI"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-#define ICO_ERR(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_ERROR,                \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("ERR"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-
-void ico_log_print(int level, const char *fmt, ...);
-void ico_log_open(const char *prog);
-void ico_log_close(void);
-void ico_log_flush(void);
-char * ico_get_str_cur_time(const char *level);
-void ico_log_set_level(int level);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // __ICO__LOG_H__
-/* vim:set expandtab ts=4 sw=4: */
index e93b991..ff6711b 100644 (file)
@@ -7,17 +7,17 @@
  *
  */
 
-/*========================================================================*/    
+//==========================================================================
 /**
- *  @file   ico_log.h
+ *  @file   CicoLog.h
  *
- *  @brief  debug log function
+ *  @brief  This file is definition of dubug log functions
  */
-/*========================================================================*/    
+//==========================================================================
 #ifndef __CICO_LOG_H__
 #define __CICO_LOG_H__
 
-#include "ico_log.h"
+#include <ico_log.h>
 
 #endif  // __CICO__LOG_H__
-/* vim:set expandtab ts=4 sw=4: */
+// vim:set expandtab ts=4 sw=4:
index 78cde86..327e6ca 100644 (file)
@@ -42,11 +42,11 @@ CicoSCAilItems::CicoSCAilItems()
 
 /**
  * @brief constructor
- * @param pkg package name(appid) by ail infomation data
- * @param icon icon path and file name by ail infomation data
- * @param nam name by ail infomation data
- * @param ctgry category by ail infomation data
- * @param exe exec path by ail infomation data
+ * @param pkg package name(appid) by ail information data
+ * @param icon icon path and file name by ail information data
+ * @param nam name by ail information data
+ * @param ctgry category by ail information data
+ * @param exe exec path by ail information data
  * @param cateforys environ file data
  */
 CicoSCAilItems::CicoSCAilItems(const char* pkg, const char* icon,
@@ -164,11 +164,11 @@ void CicoSCAilItems::init()
 
 /**
  * @brief constructor
- * @param pkg package name(appid) by ail infomation data
- * @param icon icon path and file name by ail infomation data
- * @param nam name by ail infomation data
- * @param ctgry category by ail infomation data
- * @param exe exec path by ail infomation data
+ * @param pkg package name(appid) by ail information data
+ * @param icon icon path and file name by ail information data
+ * @param nam name by ail information data
+ * @param ctgry category by ail information data
+ * @param exe exec path by ail information data
  * @param cateforys environ file data
  */
 void CicoSCAilItems::setup(const char* pkg, const char* icon,
@@ -178,22 +178,27 @@ void CicoSCAilItems::setup(const char* pkg, const char* icon,
 {
     ICO_TRA("start");
     m_appid.assign(pkg);
+    ICO_DBG("package name=%s", pkg? pkg: "(NULL)");
 
     m_noIcon = ndisp;
     if (NULL != icon) {
         m_icon.assign(icon);
+        ICO_DBG("icon path=%s", icon? icon: "(NULL)");
     }
 
     if (NULL != nam) {
         m_name.assign(nam);
+        ICO_DBG("name=%s", nam? nam: "(NULL)");
     }
 
     if (NULL != exe) {
         m_execPath.assign(exe);
+        ICO_DBG("exec path=%s", exe? exe: "(NULL)");
     }
 
     if (NULL != typ) {
         m_type.assign(typ);
+        ICO_DBG("type=%s", typ? typ: "(NULL)");
     }
 
     categoryParse(categorys);
@@ -249,6 +254,8 @@ void CicoSCAilItems::categoryParse(const std::string categorys)
     inputDevName.clear();
     switchName.clear();
 
+    CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
+
     ICO_DBG("category def size = %d", x.size());
     for (it = x.begin(); it != x.end(); it++) {
 
@@ -391,6 +398,16 @@ void CicoSCAilItems::categoryParse(const std::string categorys)
                 continue;
             }
         }
+
+        int categoryID = CSCSC->getCategoryIdbyName(*it);
+        const char* ttt = it->c_str()? it->c_str(): "(NULL)";
+        ICO_DBG("Category %s->%d", ttt, categoryID);
+        if (-1 != categoryID) {
+            ICO_DBG("Category %d -> %d(%s)", m_categoryID, categoryID, ttt);
+            m_categoryID = categoryID;
+            continue;
+        }
+
         ICO_DBG("Parse UNKOWN %s", it->c_str());
     }
     categoryGetDisplay(displayName, layerName, dispZoneName);
@@ -480,7 +497,7 @@ bool CicoSCAilItems::categoryParseCategory(const string& s)
         return false; // unkown category xxx
     }
     m_categoryID = categoryID;
-    ICO_TRA("end");
+    ICO_TRA("end %d", m_categoryID);
     return true;
 }
 
@@ -627,7 +644,7 @@ bool CicoSCAilItems::categoryParseNodisplay(const string& s)
     else {
         m_noIcon = true;
     }
-    ICO_TRA("end");
+    ICO_TRA("end %s", m_noIcon? "true": "false");
     return true;
 }
 
index f6cbde2..600707d 100644 (file)
@@ -27,7 +27,7 @@
 #define DINITm_invisibleCPU 0
 
 /**
- * @brief AIL infomation data class
+ * @brief AIL information data class
  *
  */
 
index 47e998c..f3c84b2 100644 (file)
@@ -46,17 +46,18 @@ CicoSCAulItems::CicoSCAulItems(const char* appid, int pid, int ctgry,
                                const CicoSCWindow* obj)
     :m_appid(appid), m_pid(pid), m_category(ctgry)
 {
-    ICO_TRA("CicoSCAulItems::CicoSCAulItems");
+    ICO_TRA("constructor %s, %d, %x", appid? appid: "(NIL)", pid, obj);
     enterWindow(obj);
     getPidCgroupInfo(pid, m_defCgrpMem, m_defCgrpCpu);
     m_cpucgroup = -1;
     m_memcgroup = -1;
-    if (DINITm_categoryID == m_category) {
+    if (DINITm_categoryID != m_category) {
         CicoSCSystemConfig* conf = CicoSCSystemConfig::getInstance();
-        const CicoSCCategoryConf* obj = 
+        const CicoSCCategoryConf* objX = 
             conf->getCategoryObjbyCaategoryID(m_category);
-        if (NULL != obj) {
-            m_cpucgroup = obj->rctrl;
+        if (NULL != objX) {
+            m_cpucgroup = objX->rctrl;
+            ICO_DBG("categ:%d -> cgroup: %d", m_category, m_cpucgroup);
         }
     }
 }
index 7880220..2903e5d 100644 (file)
@@ -19,7 +19,7 @@ class CicoSCWindow;
 
 /**
  * @brief System controller unit
- *        application life cycle infomation data
+ *        application life cycle information data
  *
  */
 
diff --git a/lib/system-controller/CicoSCCommand.cpp b/lib/system-controller/CicoSCCommand.cpp
new file mode 100644 (file)
index 0000000..772ba06
--- /dev/null
@@ -0,0 +1,454 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+//==========================================================================
+/**
+ *  @file   CicoSCCommand.cpp
+ *
+ *  @brief  This file is implementation of CicoSCCommand class
+ */
+//==========================================================================
+
+#include <iostream>
+#include <sstream>
+#include <exception>
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/json_parser.hpp>
+#include <boost/foreach.hpp>
+#include <boost/optional.hpp>
+using namespace std;
+using namespace boost;
+using namespace boost::property_tree;
+
+#include "CicoSCCommand.h"
+#include "CicoLog.h"
+#include "ico_syc_error.h"
+#include "ico_syc_msg_cmd_def.h"
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
+CicoSCCommand::CicoSCCommand()
+    : cmdid(0), appid(""), pid(-1), opt(NULL)
+{
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
+CicoSCCommand::~CicoSCCommand()
+{
+    delete opt;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  parse from message, create command
+ *
+ *  @param [in] message     message of interprocess communication
+ *
+ *  @note
+ *  message format(json format)
+ *  key name of "appid", "command", "pid" is common command propety.
+ *  <pre>
+ *  {
+ *    "appid":   (string) application id,
+ *    "command": (int)    command id,
+ *    "pid":     (int)    process id
+ *    ...
+ *    }
+ *  }
+ *  </pre>
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCCommand::parseMessage(const char *message)
+{
+    ICO_DBG("CicoSCCommand::parseMessage Enter(%s)", message);
+    try {
+        stringstream jsonString(message);
+        ptree root;
+        read_json(jsonString, root);
+
+        this->appid = getStrValue(root, MSG_PRMKEY_APPID);
+        this->cmdid = getIntValue(root, MSG_PRMKEY_CMD);
+        this->pid   = getIntValue(root, MSG_PRMKEY_PID);
+
+        switch ((this->cmdid & MSG_CMD_TYPE_MASK)) {
+        case MSG_CMD_TYPE_WINCTRL:
+            parseWinCtrlOpt(root);
+            break;
+        case MSG_CMD_TYPE_INPUTCTRL:
+            parseInputDevCtrlOpt(root);
+            break;
+        case MSG_CMD_TYPE_USERMGR:
+            parseUserMgrOpt(root);
+            break;
+        case MSG_CMD_TYPE_RESOURCEMGR:
+            parseResCtrlOpt(root);
+            break;
+        case MSG_CMD_TYPE_INPUTDEVSETTING:
+            parseInputDevSettingOpt(root);
+            break;
+        default:
+            break;
+        }
+
+        // dump log command variables
+        dump();
+    }
+    catch (std::exception const& e)
+    {
+        ICO_WRN("catch exception %s", e.what());
+        ICO_DBG("CicoSCCommand::parseMessage Leave(EINVAL)");
+        return ICO_SYC_EINVAL;
+    }
+
+    ICO_DBG("CicoSCCommand::parseMessage Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  dump log this class member variables
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCCommand::dump(void)
+{
+    ICO_DBG("Command: cmdid=0x%08X appid=%s pid=%d", cmdid, appid.c_str(), pid);
+    if (NULL != this->opt) {
+        this->opt->dump();
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get integer value by key
+ *
+ *  @param [in] root    root object of json object
+ *  @param [in] key     Key to get the value
+ *
+ *  @return integer value on success, INT_MAX on error
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCCommand::getIntValue(const ptree & root, const char* key)
+{
+    int intValue = -1;
+    try {
+        intValue = root.get<int>(key);
+    }
+    catch (std::exception const& e)
+    {
+        //ICO_WRN("catch exception %s", e.what());
+        return intValue;
+    }
+    return intValue;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get string value by key
+ *
+ *  @param [in] root    root object of json object
+ *  @param [in] key     Key to get the value
+ *
+ *  @return string value on success, empty string on error
+ */
+//--------------------------------------------------------------------------
+string
+CicoSCCommand::getStrValue(const ptree & root, const char* key)
+{
+    string strValue = "";
+    try {
+        strValue = root.get<string>(key);
+    }
+    catch (std::exception const& e)
+    {
+        //ICO_WRN("catch exception %s", e.what());
+        return strValue;
+    }
+
+    if (strValue == "null") {
+        strValue = "";
+    }
+
+    return strValue;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  query whether the object exists
+ *
+ *  @param [in] root    root object of json object
+ *  @param [in] key     Key to get the value
+ *
+ *  @return true on exist, false on not exist
+ */
+//--------------------------------------------------------------------------
+bool
+CicoSCCommand::isExistObject(const ptree & root, const char *key)
+{
+    try {
+        (void)root.get_child(key);
+    }
+    catch (std::exception const& e)
+    {
+        //ICO_WRN("catch exception %s", e.what());
+        return false;
+    }
+
+    return true;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  parse from message, create window control options
+ *
+ *  @param [in] root    root object of json object
+ *
+ *  @note
+ *  message format of window control(json format)
+ *  <pre>
+ *  {
+ *    "arg": {
+ *      "surface":   (int)    surface id
+ *      "layer":     (int)    layer id
+ *      "node":      (int)    node id
+ *      "zone":      (string) display zone name
+ *      "anim_name": (string) animation name
+ *      "anim_time": (int)    animation time
+ *      "pos_x":     (int)    window x position
+ *      "pos_y":     (int)    window y position
+ *      "width":     (int)    window width
+ *      "height":    (int)    window height
+ *      "raise":     (int)    raise flag
+ *      "visible":   (int)    visible flag
+ *      "active":    (int)    active flag
+ *      "stride":    (int)    stride
+ *      "format":    (int)    format
+ *      "framerate": (int)    frame rate
+ *    }
+ *  }
+ *  </pre>
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCCommand::parseWinCtrlOpt(const ptree & root)
+{
+    CicoSCCmdWinCtrlOpt* options = new CicoSCCmdWinCtrlOpt();
+    this->opt = options;
+
+    options->surfaceid     = getIntValue(root, "arg.surface");
+    options->layerid       = getIntValue(root, "arg.layer");
+    options->nodeid        = getIntValue(root, "arg.node");
+    options->zone          = getStrValue(root, "arg.zone");
+    options->animation     = getStrValue(root, "arg.anim_name");
+    options->animationTime = getIntValue(root, "arg.anim_time");
+    options->x             = getIntValue(root, "arg.pos_x");
+    options->y             = getIntValue(root, "arg.pos_y");
+    options->width         = getIntValue(root, "arg.width");
+    options->height        = getIntValue(root, "arg.height");
+    options->raise         = getIntValue(root, "arg.raise");
+    options->visible       = getIntValue(root, "arg.visible");
+    options->active        = getIntValue(root, "arg.active");
+    options->stride        = getIntValue(root, "arg.stride");
+    options->format        = getIntValue(root, "arg.format");
+    options->framerate     = getIntValue(root, "arg.framerate");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  parse from message, create input device control options
+ *
+ *  @param [in] root    root object of json object
+ *
+ *  @note
+ *  message format of input device control(json format)
+ *  <pre>
+ *  {
+ *    "arg": {
+ *      "device":     (string) device name
+ *      "input_num":  (int) input number
+ *      "surface":    (int) surface id
+ *      "deviceno":   (int) device number
+ *      "alloc_type": (int) allocation type
+ *      "keycode":    (int) key code
+ *      "ev_type":    (int) event type
+ *      "ev_code":    (int) event cord
+ *      "ev_value":   (int) event value
+ *    }
+ *  }
+ *  </pre>
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCCommand::parseInputDevCtrlOpt(const ptree & root)
+{
+    CicoSCCmdInputDevCtrlOpt* options = new CicoSCCmdInputDevCtrlOpt();
+    this->opt = options;
+
+    options->device    = getStrValue(root, "arg.device");
+    options->input     = getIntValue(root, "arg.input_num");
+    options->surfaceid = getIntValue(root, "arg.surface");
+    options->deviceno  = getIntValue(root, "arg.deviceno");
+    options->fix       = getIntValue(root, "arg.alloc_type");
+    options->keycode   = getIntValue(root, "arg.keycode");
+    options->evtype    = getIntValue(root, "arg.ev_type");
+    options->evcode    = getIntValue(root, "arg.ev_code");
+    options->evvalue   = getIntValue(root, "arg.ev_value");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  parse from message, create user manager options
+ *
+ *  @param [in] root    root object of json object
+ *
+ *  @note
+ *  message format of user manager options(json format)
+ *  <pre>
+ *  {
+ *    "arg": {
+ *      "user":     (string) user name
+ *      "password": (string) user password
+ *      "lastinof": (string) infomation of application last state
+ *    }
+ *  }
+ *  </pre>
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCCommand::parseUserMgrOpt(const ptree & root)
+{
+    CicoSCCmdUserMgrOpt* options = new CicoSCCmdUserMgrOpt();
+    this->opt = options;
+
+    options->user     = getStrValue(root, "arg.user");
+    options->pass     = getStrValue(root, "arg.password");
+    options->lastinfo = getStrValue(root, "arg.lastinfo");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  parse from message, create resource manage options
+ *
+ *  @param [in] root    root object of json object
+ *
+ *  @note
+ *  message format of resource manage options(json format)
+ *  <pre>
+ *  {
+ *    "res": {
+ *      "window": {
+ *        "zone":    (string) window zone,
+ *        "name":    (string) window's surface name,
+ *        "id":      (string) window id
+ *      },
+ *      "sound": {
+ *        "zone":    (string) sound zone,
+ *        "name":    (string) sound's stream name,
+ *        "id":      (string) sound id,
+ *        "adjust":  (int)    sound adjust type
+ *      },
+ *      "input": {
+ *        "name":    (string) input device name,
+ *        "event":   (int)    input event id
+ *      }
+ *      "type":      (int)    basic or interruption
+ *    }
+ *  }
+ *  </pre>
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCCommand::parseResCtrlOpt(const ptree & root)
+{
+    CicoSCCmdResCtrlOpt* options = new CicoSCCmdResCtrlOpt();
+    this->opt = options;
+
+    if (true == isExistObject(root, "res.window")) {
+        options->dispres   = true;
+        options->dispzone  = getStrValue(root, "res.window.zone");
+        options->winname   = getStrValue(root, "res.window.name");
+        options->surfaceid = getIntValue(root, "res.window.id");
+    }
+
+    if (true == isExistObject(root, "res.sound")) {
+        options->soundres  = true;
+        options->soundzone = getStrValue(root, "res.sound.zone");
+        options->soundname = getStrValue(root, "res.sound.name");
+        options->soundid   = getIntValue(root, "res.sound.id");
+        options->adjust    = getIntValue(root, "res.sound.adjust");
+    }
+
+    if (true == isExistObject(root, "res.input")) {
+        options->inputres = true;
+        options->device   = getStrValue(root, "res.input.name");
+        options->input    = getIntValue(root, "res.input.event");
+    }
+
+    options->type = getIntValue(root, "type");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  parse from message, create input device setting options
+ *
+ *  @param [in] root    root object of json object
+ *
+ *  @note
+ *  message format of input device setting(json format)
+ *  <pre>
+ *  {
+ *    "region": {
+ *      "winname":      (string) window name,
+ *      "pos_x":        (int) position x,
+ *      "pos_y":        (int) position y,
+ *      "width":        (int) width,
+ *      "height":       (int) height,
+ *      "hotspot_x":    (int) cursor hotspot x,
+ *      "hotspot_y":    (int) cursor hotspot y,
+ *      "cursor_x":     (int) cursor position x,
+ *      "cursor_y":     (int) cursor position y,
+ *      "cursor_width": (int) cursor width,
+ *      "cursor_height":(int) cursor height,
+ *      "attr":         (int) attribute
+ *    }
+ *  }
+ *  </pre>
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCCommand::parseInputDevSettingOpt(const ptree & root)
+{
+    CicoSCCmdInputDevSettingOpt* options = new CicoSCCmdInputDevSettingOpt();
+    this->opt = options;
+
+    if (true == isExistObject(root, "region")) {
+        options->winname    = getStrValue(root, "region.winname");
+        options->x          = getIntValue(root, "region.pos_x");
+        options->y          = getIntValue(root, "region.pos_y");
+        options->width      = getIntValue(root, "region.width");
+        options->height     = getIntValue(root, "region.height");
+        options->hotspot_x  = getIntValue(root, "region.hotspot_x");
+        options->hotspot_y  = getIntValue(root, "region.hotspot_y");
+        options->cursor_x   = getIntValue(root, "region.cursor_x");
+        options->cursor_y   = getIntValue(root, "region.cursor_y");
+        options->cursor_width  = getIntValue(root, "region.cursor_width");
+        options->cursor_height = getIntValue(root, "region.cursor_height");
+        options->attr       = getIntValue(root, "region.attr");
+    }
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCCommand.h b/lib/system-controller/CicoSCCommand.h
new file mode 100644 (file)
index 0000000..3fdedba
--- /dev/null
@@ -0,0 +1,307 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+//==========================================================================
+/**
+ *  @file   CicoSCCommand.h
+ *
+ *  @brief  This file is definition of CicoSCCommand class
+ */
+//==========================================================================
+#ifndef __CICO_SC_COMMAND_H__
+#define __CICO_SC_COMMAND_H__
+
+#include <string>
+#include <boost/property_tree/ptree.hpp>
+
+#include "CicoLog.h"
+
+//==========================================================================
+/**
+ *  @brief  command option variables
+ *          This class is abstract class
+ */
+//==========================================================================
+class CicoSCCommandOption
+{
+public:
+    /// default constructor
+    CicoSCCommandOption() {}
+
+    /// destructor
+    virtual ~CicoSCCommandOption() {}
+
+    /// dump log this class member variables
+    virtual void dump(void) {}
+};
+
+//==========================================================================
+/**
+ *  @brief  This class holds the option of window control command
+ */
+//==========================================================================
+class CicoSCCmdWinCtrlOpt : public CicoSCCommandOption
+{
+public:
+    /// default constructor
+    CicoSCCmdWinCtrlOpt()
+        : nodeid(0), displayid(0), layerid(0),
+          zone(""), surfaceid(-1), animation(""), animationTime(-1),
+          x(-1), y(-1), width(-1), height(-1), raise(-1),
+          visible(-1), active(-1), framerate(0), stride(-1), format(-1) {}
+
+    /// destructor
+    virtual ~CicoSCCmdWinCtrlOpt() {}
+
+    /// dump log this class member variables
+    void dump(void)
+    {
+        ICO_DBG("WinCtrlOpt: "
+                "surfaceid=0x%08X layerid=%d nodeid=%d zone=%s "
+                "animation=%s animationTime=%d "
+                "x=%d y=%d w=%d h=%d raise=%d "
+                "visible=%d active=%d framerate=%d stride=%d format=%d",
+                surfaceid, layerid, nodeid, zone.c_str(),
+                animation.c_str(), animationTime,
+                x, y, width, height, raise,
+                visible, active, framerate, stride, format);
+
+    }
+
+    int         nodeid;         //!< id of node
+    int         displayid;      //!< id of display
+    int         layerid;        //!< id of layer
+    std::string zone;           //!< name of display zone
+    int         surfaceid;      //!< id of surface
+    std::string animation;      //!< name of animation
+    int         animationTime;  //!< time of animation
+    int         x;              //!< x position of window
+    int         y;              //!< y position of window
+    int         width;          //!< width of window
+    int         height;         //!< height of window
+    int         raise;          //!< status of raise(raise/lower)
+    int         visible;        //!< status of visible(visible/invisible)
+    int         active;         //!< status of active(active/nonactive):
+    int         framerate;      //!< frame rate for thumbnail
+    int         stride;         //!< stride for thumbnail
+    int         format;         //!< format of color for thumbnail
+};
+
+//==========================================================================
+/**
+ *  @brief  This class holds the option of input device control command
+ */
+//==========================================================================
+class CicoSCCmdInputDevCtrlOpt : public CicoSCCommandOption
+{
+public:
+    /// default constructor
+    CicoSCCmdInputDevCtrlOpt()
+        : device(""), input(-1), surfaceid(-1), deviceno(-1),
+          fix(-1), keycode(-1), evtype(-1), evcode(-1),
+          evvalue(-1) {}
+
+    /// destructor
+    virtual ~CicoSCCmdInputDevCtrlOpt() {}
+
+    /// dump log this class member variables
+    void dump(void)
+    {
+        ICO_DBG("InputCtrlOpt: "
+                "device=%s input=%d surfaceid=0x%08X deviceno=%d "
+                "fix=%d keycode=%d evtype=%d evcode=%d evvalue=%d",
+                device.c_str(), input, surfaceid, deviceno,
+                fix, keycode, evtype, evcode, evvalue);
+    }
+
+    std::string device;     //!< name of input device
+    int         input;      //!< number of input
+    int         surfaceid;  //!< id of surface
+    int         deviceno;   //!< number of device
+    int         fix;        //!< status of fix
+    int         keycode;    //!< code of key
+    int         evtype;     //!< type of event
+    int         evcode;     //!< code of event
+    int         evvalue;    //!< value of event
+};
+
+//==========================================================================
+/**
+ *  @brief  This class holds the option of user manager command
+ */
+//==========================================================================
+class CicoSCCmdUserMgrOpt : public CicoSCCommandOption
+{
+public:
+    /// default constructor
+    CicoSCCmdUserMgrOpt()
+        : user(""), pass(""), lastinfo("") {}
+
+    /// destructor
+    virtual ~CicoSCCmdUserMgrOpt() {}
+
+    /// dump log this class member variables
+    void dump(void)
+    {
+        ICO_DBG("UserMgrOpt: user=%s pass=%s lastinfo=%s",
+                user.c_str(), pass.c_str(), lastinfo.c_str());
+    }
+
+    std::string user;
+    std::string pass;
+    std::string lastinfo;
+};
+
+//==========================================================================
+/**
+ *  @brief  This class holds the option of resource control command
+ */
+//==========================================================================
+class CicoSCCmdResCtrlOpt : public CicoSCCommandOption
+{
+public:
+    /// default constructor
+    CicoSCCmdResCtrlOpt()
+        : dispres(false), dispzone(""), winname(""), surfaceid(-1),
+          animation(""), animationTime(-1),
+          soundres(false), soundzone(""), soundname(""), adjust(0),
+          inputres(false), device(""), input(0), type(0) {}
+
+    /// destructor
+    virtual ~CicoSCCmdResCtrlOpt() {}
+
+    /// dump log this class member variables
+    void dump(void)
+    {
+        ICO_DBG("ResCtrlOpt: "
+                "diapres=%s dispzone=%s winname=%s srufaceid=0x%08X "
+                "animation=%s animatime=%d soundres=%s soundzone=%s"
+                "soundname=%s soundid=%d adjust=%d inputres=%s "
+                "device=%s input=%d type=%d",
+                dispres ? "true" : "false",  dispzone.c_str(),
+                winname.c_str(), surfaceid, animation.c_str(),
+                animationTime, soundres ? "true" : "false",
+                soundzone.c_str(), soundname.c_str(),
+                soundid, adjust, inputres ? "true" : "false",
+                device.c_str(), input, type);
+    }
+
+    bool        dispres;         //!< flag of display resource
+    std::string dispzone;        //!< name of display zone
+    std::string winname;         //!< name of window
+    int         surfaceid;       //!< id of surface
+    std::string animation;       //!< name of animation
+    int         animationTime;   //!< time of animation[ms]
+
+    bool        soundres;        //!< flag of sound resource
+    std::string soundzone;       //!< name of sound zone
+    std::string soundname;       //!< name of sound(stream)
+    int         soundid;         //!< id of sound(stream)
+    int         adjust;          //!< parameter of adjust
+
+    bool        inputres;        //!< flag of input resource
+    std::string device;          //!< name of input device
+    int         input;           //!< input
+
+    int         type;            //!<< type of request for display and sound
+};
+
+//==========================================================================
+/**
+ *  @brief  This class holds the option of input device setting command
+ */
+//==========================================================================
+class CicoSCCmdInputDevSettingOpt: public CicoSCCommandOption
+{
+public:
+    /// default constructor
+    CicoSCCmdInputDevSettingOpt()
+        : winname(""), x(0), y(0), width(0), height(0), hotspot_x(0), hotspot_y(0),
+          cursor_x(0), cursor_y(0), cursor_width(0), cursor_height(0), attr(0) {}
+
+    /// destructor
+    virtual ~CicoSCCmdInputDevSettingOpt() {}
+
+    /// dump log this class member variables
+    void dump(void)
+    {
+        ICO_DBG("InputDevSettingOpt: winname=%s x=%d y=%d w=%d h=%d attr=%d",
+                winname.c_str(), x, y, width, height, attr);
+    }
+
+    std::string winname;//!< window name of surface
+    short x;            //!< x position of input region
+    short y;            //!< y position of input region
+    short width;        //!< width of input region
+    short height;       //!< height of input region
+    short hotspot_x;    //!< hotspot of X relative coordinate
+    short hotspot_y;    //!< hotspot of Y relative coordinate
+    short cursor_x;     //!< cursor region X coordinate
+    short cursor_y;     //!< cursor region Y coordinate
+    short cursor_width; //!< cursor region width
+    short cursor_height;//!< cursor region height
+    int attr;           //!< attribute of input region
+};
+
+//==========================================================================
+/**
+ *  @brief  This class holds command information
+ */
+//==========================================================================
+class CicoSCCommand
+{
+public:
+    // default constructor
+    CicoSCCommand();
+
+    // destructor
+    ~CicoSCCommand();
+
+    // parse from message of process communication
+    int parseMessage(const char *cmdMessage);
+
+    // dump log this class member variables
+    void dump(void);
+
+private:
+    // get integer value
+    int getIntValue(const boost::property_tree::ptree & root,
+                    const char* key);
+
+    // get string value
+    std::string getStrValue(const boost::property_tree::ptree & root,
+                            const char* key);
+
+    // check exist object
+    bool isExistObject(const boost::property_tree::ptree & root,
+                       const char *key);
+
+    // parse window control options
+    void parseWinCtrlOpt(const boost::property_tree::ptree & root);
+
+    // parse input device control options
+    void parseInputDevCtrlOpt(const boost::property_tree::ptree & root);
+
+    // parse user control options
+    void parseUserMgrOpt(const boost::property_tree::ptree & root);
+
+    // parse resource control options
+    void parseResCtrlOpt(const boost::property_tree::ptree & root);
+
+    // parse input device setting options
+    void parseInputDevSettingOpt(const boost::property_tree::ptree & root);
+
+public:
+    unsigned long       cmdid;  //!< id of command
+    std::string         appid;  //!< id of application
+    int                 pid;    //!< id of process
+    CicoSCCommandOption *opt;   //!< command option instance
+};
+#endif  // __CICO_SC_COMMAND_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCCommandParser.cpp b/lib/system-controller/CicoSCCommandParser.cpp
deleted file mode 100644 (file)
index 23a1b9b..0000000
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-
-/**
- * @brief   Application Framework debug log function
- *
- * @date    Feb-28-2013
- */
-
-#include <iostream>
-#include <sstream>
-#include <exception>
-#include <boost/property_tree/ptree.hpp>
-#include <boost/property_tree/json_parser.hpp>
-#include <boost/foreach.hpp>
-#include <boost/optional.hpp>
-using namespace boost;
-using namespace boost::property_tree;
-
-#include "CicoSCCommandParser.h"
-#include "CicoLog.h"
-#include "ico_syc_error.h"
-#include "ico_syc_msg_cmd_def.h"
-
-CicoSCCommandParser::CicoSCCommandParser()
-{
-}
-
-CicoSCCommandParser::~CicoSCCommandParser()
-{
-}
-
-int
-CicoSCCommandParser::parse(const char *cmdMessage, CicoSCCommand & cmd)
-{
-    ICO_DBG("CicoSCCommandParser::parse : Enter(%s)", cmdMessage);
-    try {
-        stringstream jsonString(cmdMessage);
-        ptree root;
-        read_json(jsonString, root);
-
-        cmd.appid = getStrValue(root, "appid");
-        cmd.cmdid = getIntValue(root, "command");
-        cmd.pid   = getIntValue(root, "pid");
-
-        switch ((cmd.cmdid & MSG_CMD_TYPE_MASK)) {
-        case MSG_CMD_TYPE_WINCTRL:
-            parseWinCtrlOpt(root, cmd);
-            break;
-        case MSG_CMD_TYPE_INPUTCTRL:
-            parseInputDevCtrlOpt(root, cmd);
-            break;
-        case MSG_CMD_TYPE_USERMGR:
-            parseUserMgrOpt(root, cmd);
-            break;
-        case MSG_CMD_TYPE_RESOURCEMGR:
-            parseResCtrlOpt(root, cmd);
-            break;
-        case MSG_CMD_TYPE_INPUTDEVSETTING:
-            parseInputDevSettingOpt(root, cmd);
-            break;
-        default:
-            break;
-        }
-    }
-    catch (std::exception const& e)
-    {
-        ICO_WRN("catch exception %s", e.what());
-        return ICO_SYC_EINVAL;
-    }
-
-    ICO_DBG("CicoSCCommandParser::parse : Leave");
-    return ICO_SYC_EOK;
-}
-
-int
-CicoSCCommandParser::getIntValue(const ptree & root, const char* key)
-{
-    int intValue = -1;
-    try {
-        intValue = root.get<int>(key);
-    }
-    catch (std::exception const& e)
-    {
-        ICO_WRN("catch exception %s", e.what());
-        return intValue;
-    }
-    return intValue;
-}
-
-string
-CicoSCCommandParser::getStrValue(const ptree & root, const char* key)
-{
-    string strValue = "";
-    try {
-        strValue = root.get<string>(key);
-    }
-    catch (std::exception const& e)
-    {
-        ICO_WRN("catch exception %s", e.what());
-        return strValue;
-    }
-
-    if (strValue == "null") {
-        strValue = "";
-    }
-
-    return strValue;
-}
-
-bool
-CicoSCCommandParser::isExistObject(const ptree & root, const char *key)
-{
-    string strValue = "";
-    try {
-        (void)root.get_child(key);
-    }
-    catch (std::exception const& e)
-    {
-        ICO_WRN("catch exception %s", e.what());
-        return false;
-    }
-    return true;
-
-}
-
-void
-CicoSCCommandParser::parseWinCtrlOpt(const ptree & root,
-                                     CicoSCCommand & cmd)
-{
-    ICO_DBG("CicoSCCommandParser::parseWinCtrlOpt: Enter");
-
-    CicoSCCmdWinCtrlOpt* opt = new CicoSCCmdWinCtrlOpt();
-    cmd.opt = opt;
-
-    opt->surfaceid     = getIntValue(root, "arg.surface");
-    opt->layerid       = getIntValue(root, "arg.layer");
-    opt->nodeid        = getIntValue(root, "arg.node");
-    opt->zone          = getStrValue(root, "arg.zone");
-    opt->animation     = getStrValue(root, "arg.anim_name");
-    opt->animationTime = getIntValue(root, "arg.anim_time");
-    opt->layerAttr     = getIntValue(root, "arg.attr");
-    opt->x             = getIntValue(root, "arg.pos_x");
-    opt->y             = getIntValue(root, "arg.pos_y");
-    opt->width         = getIntValue(root, "arg.width");
-    opt->height        = getIntValue(root, "arg.height");
-    opt->raise         = getIntValue(root, "arg.raise");
-    opt->visible       = getIntValue(root, "arg.visible");
-    opt->active        = getIntValue(root, "arg.active");
-    opt->stride        = getIntValue(root, "arg.stride");
-    opt->format        = getIntValue(root, "arg.format");
-    opt->framerate     = getIntValue(root, "arg.framerate");
-
-    opt->dumpOpt();
-    ICO_DBG("CicoSCCommandParser::parseWinCtrlOpt: Leave");
-}
-
-void
-CicoSCCommandParser::parseInputDevCtrlOpt(const ptree & root,
-                                          CicoSCCommand & cmd)
-{
-    ICO_DBG("CicoSCCommandParser::parseInputDevCtrlOpt: Enter");
-
-    CicoSCCmdInputDevCtrlOpt* opt = new CicoSCCmdInputDevCtrlOpt();
-    cmd.opt = opt;
-
-    opt->device     = getStrValue(root, "arg.device");
-    opt->inputNum   = getIntValue(root, "arg.input_num");
-    opt->surfaceid  = getIntValue(root, "arg.surface");
-    opt->deviceno   = getIntValue(root, "arg.deviceno");
-    opt->fix        = getIntValue(root, "arg.alloc_type");
-    opt->keyCode    = getIntValue(root, "arg.keycode");
-    opt->eventType  = getIntValue(root, "arg.ev_type");
-    opt->eventCode  = getIntValue(root, "arg.ev_code");
-    opt->eventValue = getIntValue(root, "arg.ev_value");
-
-    ICO_DBG("CicoSCCommandParser::parseInputDevCtrlOpt: Leave");
-}
-
-void
-CicoSCCommandParser::parseUserMgrOpt(const ptree & root,
-                                      CicoSCCommand & cmd)
-{
-    ICO_DBG("CicoSCCommandParser::parseUserMgrOpt: Enter");
-
-    CicoSCCmdUserMgrOpt* opt = new CicoSCCmdUserMgrOpt();
-    cmd.opt = opt;
-
-    opt->user = getStrValue(root, "arg.user");
-    opt->pass = getStrValue(root, "arg.password");
-
-    ICO_DBG("CicoSCCommandParser::parseUserMgrOpt: Leave");
-}
-
-//--------------------------------------------------------------------------
-/**
- *  @brief   TODO
- *
- *  @pre
- *{
- *  "appid":   (string) appid,
- *  "command": (int) command id,
- *  "res": {
- *    "window": {
- *      "zone":(string) window zone,
- *      "name":(string) window's surface name,
- *      "id":(string) window id
- *    },
- *    "sound": {
- *      "zone":(string) sound zone,
- *      "name":(string) sound's stream name,
- *      "id":(string) sound id,
- *      "adjust":(int) sound adjust type
- *    },
- *    "input": {
- *      "name":(string) input device name,
- *      "event":(int) input event id
- *    },
- *    "type":(int) basic or interruption
- *  },
- *  "region": {
- *    "surface": (int) surface id,
- *    "pos_x":   (int) position x,
- *    "pos_y":   (int) position y,
- *    "width":   (int) width,
- *    "height":  (int) height,
- *    "attr":    (int) attribute
- *  }
- *}
- */
-//--------------------------------------------------------------------------
-void
-CicoSCCommandParser::parseResCtrlOpt(const ptree & root,
-                                     CicoSCCommand & cmd)
-{
-    ICO_DBG("CicoSCCommandParser::parseResCtrlOpt: Enter");
-
-    CicoSCCmdResCtrlOpt* opt = new CicoSCCmdResCtrlOpt();
-    cmd.opt = opt;
-
-    if (true == isExistObject(root, "res.window")) {
-        opt->displayres  = true;
-        opt->displayZone = getStrValue(root, "res.window.zone");
-        opt->windowName  = getStrValue(root, "res.window.name");
-        opt->surfaceid   = getIntValue(root, "res.window.id");
-    }
-        
-    if (true == isExistObject(root, "res.sound")) {
-        opt->soundres  = true;
-        opt->soundZone = getStrValue(root, "res.sound.zone");
-        opt->soundName = getStrValue(root, "res.sound.name");
-        opt->soundid   = getIntValue(root, "res.sound.id");
-        opt->adjust    = getIntValue(root, "res.sound.adjust");
-    }
-
-    if (true == isExistObject(root, "res.input")) {
-        opt->inputres = true;
-        opt->device  = getStrValue(root, "res.input.name");
-        opt->input   = getIntValue(root, "res.input.event");
-    }
-
-    opt->type = getIntValue(root, "type");
-
-    ICO_DBG("CicoSCCommandParser::parseResCtrlOpt: Leave");
-}
-
-//--------------------------------------------------------------------------
-/**
- *  @brief   TODO
- *
- *  @pre
- *{
- *  "appid":   (string) appid,
- *  "command": (int) command id,
- *  "region": {
- *    "surface": (int) surface id,
- *    "pos_x":   (int) position x,
- *    "pos_y":   (int) position y,
- *    "width":   (int) width,
- *    "height":  (int) height,
- *    "attr":    (int) attribute
- *  }
- *}
- */
-//--------------------------------------------------------------------------
-void
-CicoSCCommandParser::parseInputDevSettingOpt(const ptree & root,
-                                             CicoSCCommand & cmd)
-{
-    ICO_DBG("CicoSCCommandParser::parseResCtrlOpt: Enter");
-
-    CicoSCCmdInputDevSettingOpt* opt = new CicoSCCmdInputDevSettingOpt();
-    cmd.opt = opt;
-
-    if (true == isExistObject(root, "region")) {
-        opt->surfaceid  = getIntValue(root, "region.surface");
-        opt->x          = getIntValue(root, "region.pos_x");
-        opt->y          = getIntValue(root, "region.pos_y");
-        opt->width      = getIntValue(root, "region.width");
-        opt->height     = getIntValue(root, "region.height");
-        opt->attr       = getIntValue(root, "region.attr");
-    }
-
-    ICO_DBG("CicoSCCommandParser::parseResCtrlOpt: Leave");
-}
-// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCCommandParser.h b/lib/system-controller/CicoSCCommandParser.h
deleted file mode 100644 (file)
index 57e7c16..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-
-//==========================================================================
-/**
- *  @file   CicoSCCommandParser.h
- *
- *  @brief  
- */
-//==========================================================================
-#ifndef __CICO_SC_COMMAND_PARSER_H__
-#define __CICO_SC_COMMAND_PARSER_H__
-
-#include <string>
-using namespace std;
-
-#include "CicoLog.h"
-
-class CicoSCCommandOption
-{
-public:
-    CicoSCCommandOption() {};
-    virtual ~CicoSCCommandOption() {};
-};
-
-class CicoSCCmdWinCtrlOpt : public CicoSCCommandOption
-{
-public:
-    CicoSCCmdWinCtrlOpt()
-        : nodeid(0), displayid(0), layerid(0), layerAttr(0),
-          zone(""), surfaceid(-1), animation(""), animationTime(-1),
-          x(-1), y(-1), width(-1), height(-1), raise(-1),
-          visible(-1), active(-1), framerate(0), stride(-1), format(-1) {}
-    void dumpOpt(void)
-    {
-        ICO_DBG("WinCtrlOpt : "
-                "surfaceid(%d) layerid(%d) nodeid(%d) zone(%s) "
-                "animation(%s) animationTime(%d) layerAttr(%d) "
-                "x(%d) y(%d) width(%d) height(%d) raise(%d) "
-                "visible(%d) active(%d) framerate(%d) stride(%d) format(%d)",
-                surfaceid, layerid, nodeid, zone.c_str(),
-                animation.c_str(), animationTime, layerAttr,
-                x, y, width, height, raise,
-                visible, active, framerate, stride, format);
-
-    }
-
-    int    nodeid;
-    int    displayid;
-    int    layerid;
-    int    layerAttr;
-    string zone;
-    int    surfaceid;
-    string animation;
-    int    animationTime;
-    int    x;
-    int    y;
-    int    width;
-    int    height;
-    int    raise;
-    int    visible;
-    int    active;
-    int    framerate;
-    int    stride;
-    int    format;
-};
-
-class CicoSCCmdInputDevCtrlOpt : public CicoSCCommandOption
-{
-public:
-    CicoSCCmdInputDevCtrlOpt()
-        : device(""), inputNum(-1), surfaceid(-1), deviceno(-1),
-          fix(-1), keyCode(-1), eventType(-1), eventCode(-1),
-          eventValue(-1) {}
-
-    string device;
-    int    inputNum;
-    int    surfaceid;
-    int    deviceno;
-    int    fix;
-    int    keyCode;
-    int    eventType;
-    int    eventCode;
-    int    eventValue;
-};
-
-class CicoSCCmdUserMgrOpt : public CicoSCCommandOption
-{
-public:
-    CicoSCCmdUserMgrOpt()
-        : user(""), pass("") {}
-
-    string user;
-    string pass;
-};
-
-class CicoSCCmdResCtrlOpt : public CicoSCCommandOption
-{
-public:
-    CicoSCCmdResCtrlOpt()
-        : displayres(false), displayZone(""), windowName(""), surfaceid(-1),
-          soundres(false), soundZone(""), soundName(""), adjust(0),
-          inputres(false), device(""), input(0), type(0) {}
-
-    bool displayres;
-    string displayZone;
-    string windowName;
-    int surfaceid;
-
-    bool soundres;
-    string soundZone;
-    string soundName;
-    int soundid;
-    int adjust;
-
-    bool inputres;
-    string device;
-    int input;
-
-    int type;
-
-};
-
-class CicoSCCmdInputDevSettingOpt: public CicoSCCommandOption
-{
-public:
-    CicoSCCmdInputDevSettingOpt()
-        : surfaceid(-1), x(-1), y(-1), width(-1), height(-1), attr(-1) {}
-
-    int surfaceid;
-    int x;
-    int y;
-    int width;
-    int height;
-    int attr;
-};
-
-class CicoSCCommand
-{
-public:
-    CicoSCCommand()
-        : appid(""), pid(-1), cmdid(0), opt(NULL) {}
-    ~CicoSCCommand() { delete opt; }
-
-public:
-    string             appid;
-    int                pid;
-    unsigned long      cmdid;
-    CicoSCCommandOption* opt;
-};
-
-#include <string>
-#include <boost/property_tree/ptree.hpp>
-using namespace boost::property_tree;
-
-class CicoSCCommandParser
-{
-public:
-    CicoSCCommandParser();
-
-    ~CicoSCCommandParser();
-
-    int parse(const char *cmdMessage, CicoSCCommand & cmd);
-
-private:
-    int getIntValue(const ptree & root, const char* key);
-    string getStrValue(const ptree & root, const char* key);
-    bool isExistObject(const ptree & root, const char *key);
-
-    void parseWinCtrlOpt(const ptree & root, CicoSCCommand & cmd);
-    void parseInputDevCtrlOpt(const ptree & root, CicoSCCommand & cmd);
-    void parseUserMgrOpt(const ptree & root, CicoSCCommand & cmd);
-    void parseResCtrlOpt(const ptree & root, CicoSCCommand & cmd);
-    void parseInputDevSettingOpt(const ptree & root, CicoSCCommand & cmd);
-
-};
-#endif  // __CICO_SC_COMMAND_PARSER_H__
-// vim:set expandtab ts=4 sw=4:
index bee360f..eaab789 100644 (file)
 /**
  *  @file   CicoSCConf.h
  *
- *  @brief  
+ *  @brief  This file is definition of SystemConfigs
  */
 //==========================================================================
 #ifndef __CICO_SC_CONF_H__
 #define __CICO_SC_CONF_H__
 
-#include <boost/property_tree/ptree.hpp>
-#include <boost/property_tree/xml_parser.hpp>
-#include <boost/foreach.hpp>
-
 #include <string>
-#include <map>
 #include <vector>
-#include <iostream>
-#include <cstdlib>
-using namespace std;
-using namespace boost;
-using namespace boost::property_tree;
+#include <sstream>
 
 #include "CicoLog.h"
    
+//==========================================================================
+/**
+ *  @brief  enumeration of node type
+ */
+//==========================================================================
 typedef enum _node_type {
-    ICO_NODETYPE_CENTER     = 0,    //!< Center display
-    ICO_NODETYPE_METER      = 1,    //!< Meter display
-    ICO_NODETYPE_REMOTE     = 2,    //!< Information device(mobile device)
-    ICO_NODETYPE_PASSENGER  = 3,    //!< Passenger display
-    ICO_NODETYPE_REAR       = 4,    //!< Rear-seat entertainment
-    ICO_NODETYPE_REARLEFT   = 5,    //!< Rear-seat entertainment(Left)
-    ICO_NODETYPE_REARRIGHT  = 6,    //!< Rear-seat entertainment(right)
+    ICO_NODETYPE_CENTER     = 0,    ///< Center display
+    ICO_NODETYPE_METER      = 1,    ///< Meter display
+    ICO_NODETYPE_REMOTE     = 2,    ///< Information device(mobile device)
+    ICO_NODETYPE_PASSENGER  = 3,    ///< Passenger display
+    ICO_NODETYPE_REAR       = 4,    ///< Rear-seat entertainment
+    ICO_NODETYPE_REARLEFT   = 5,    ///< Rear-seat entertainment(Left)
+    ICO_NODETYPE_REARRIGHT  = 6,    ///< Rear-seat entertainment(right)
 } ico_nodetype_e;
 
+//==========================================================================
+/**
+ *  @brief  enumeration of display type
+ */
+//==========================================================================
 typedef enum _display_type {
-    ICO_DISPLAYTYPE_CENTER    = 0,  //!< Center display           
-    ICO_DISPLAYTYPE_METER     = 1,  //!< Meter display            
-    ICO_DISPLAYTYPE_REMOTE    = 2,  //!< Information device(mobile device)
-    ICO_DISPLAYTYPE_PASSENGER = 3,  //!< Passenger display        
-    ICO_DISPLAYTYPE_REAR      = 4,  //!< Rear-seat display        
-    ICO_DISPLAYTYPE_REARLEFT  = 5,  //!< Rear-seat display(left)  
-    ICO_DISPLAYTYPE_REARRIGHT = 6,  //!< Rear-seat display(right) 
+    ICO_DISPLAYTYPE_CENTER    = 0,  ///< Center display
+    ICO_DISPLAYTYPE_METER     = 1,  ///< Meter display
+    ICO_DISPLAYTYPE_REMOTE    = 2,  ///< Information device(mobile device)
+    ICO_DISPLAYTYPE_PASSENGER = 3,  ///< Passenger display
+    ICO_DISPLAYTYPE_REAR      = 4,  ///< Rear-seat display
+    ICO_DISPLAYTYPE_REARLEFT  = 5,  ///< Rear-seat display(left)
+    ICO_DISPLAYTYPE_REARRIGHT = 6,  ///< Rear-seat display(right)
 } ico_display_type_e;
 
+//==========================================================================
+/**
+ *  @brief  enumeration of policy type
+ */
+//==========================================================================
 typedef enum _policy {
-    ICO_POLICY_ALWAYS         = 0,  //!< No control
-    ICO_POLICY_RUNNING        = 1,  //!< Runnning only
-    ICO_POLICY_PARKED         = 2,  //!< Parked only
-    ICO_POLICY_SHIFT_PARKING  = 3,  //!< Shift-position is park
-    ICO_POLICY_SHIFT_REVERSES = 4,  //!< Shift-position is reverses
-    ICO_POLICY_BLINKER_LEFT   = 5,  //!< Blinker is left
-    ICO_POLICY_BLINKER_RIGHT  = 6,  //!< Blinker is right
+    ICO_POLICY_ALWAYS         = 0,  ///< No control
+    ICO_POLICY_RUNNING        = 1,  ///< Running only
+    ICO_POLICY_PARKED         = 2,  ///< Parked only
+    ICO_POLICY_SHIFT_PARKING  = 3,  ///< Shift-position is park
+    ICO_POLICY_SHIFT_REVERSES = 4,  ///< Shift-position is reverses
+    ICO_POLICY_BLINKER_LEFT   = 5,  ///< Blinker is left
+    ICO_POLICY_BLINKER_RIGHT  = 6,  ///< Blinker is right
 } ico_policy_e;
 
+//==========================================================================
+/**
+ *  @brief  enumeration of application privilege
+ */
+//==========================================================================
 typedef enum _privilege {
-    ICO_PRIVILEGE_ALMIGHTY       = 0,   //!< almighty privilege
-    ICO_PRIVILEGE_SYSTEM         = 1,   //!< system level
-    ICO_PRIVILEGE_SYSTEM_AUDIO   = 2,   //!< system level(audio only)
-    ICO_PRIVILEGE_SYSTEM_VISIBLE = 3,   //!< system level(visible only)
-    ICO_PRIVILEGE_MAKER          = 4,   //!< maker level
-    ICO_PRIVILEGE_CERTIFICATE    = 5,   //!< certificated
-    ICO_PRIVILEGE_NONE           = 6,   //!< no privilege
+    ICO_PRIVILEGE_ALMIGHTY       = 0,   ///< almighty privilege
+    ICO_PRIVILEGE_SYSTEM         = 1,   ///< system level
+    ICO_PRIVILEGE_SYSTEM_AUDIO   = 2,   ///< system level(audio only)
+    ICO_PRIVILEGE_SYSTEM_VISIBLE = 3,   ///< system level(visible only)
+    ICO_PRIVILEGE_MAKER          = 4,   ///< maker level
+    ICO_PRIVILEGE_CERTIFICATE    = 5,   ///< certificated
+    ICO_PRIVILEGE_NONE           = 6,   ///< no privilege
 } ico_privilege_e;
 
-#define ICO_SYC_CONFIG_APPATTR  "app_attr.conf"
+#define ICO_SYC_CONFIG_APPATTR  "app_attr.conf" //TODO
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds display information of system config
  */
 //==========================================================================
 class CicoSCNodeConf
 {
 public:
+    /// default constructor
     CicoSCNodeConf()
-        : id(-1), name(""), address(""), type(-1) { }
+        : id(-1), name(""), address(""), type(-1) {}
+
+    /// destructor
+    virtual ~CicoSCNodeConf() {}
 
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("node : id(%d) name(%s) address(%s) type(%d)",
+        ICO_DBG("node: id=%d name=%s address=%s type=%d",
                  id, name.c_str(), address.c_str(), type);
     }
 
-    int    id;      //!< node id
-    string name;    //!< node name
-    string address; //!< node ip address
-    int    type;    //!< node type
+public:
+    int         id;      ///< node id
+    std::string name;    ///< node name
+    std::string address; ///< node ip address
+    int         type;    ///< node type
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds layer information of system config
  */
 //==========================================================================
 class CicoSCLayerConf
 {
 public:
+    /// default constructor
     CicoSCLayerConf()
         : id(-1), name(""), type(-1), menuoverlap(false) {}
+
+    /// destructor
+    virtual ~CicoSCLayerConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("\tlayer : id(%d) name(%s) type(%d) menuoverlap(%s)",
-                id, name.c_str(), type,
-                menuoverlap ? "true" : "false");
+        ICO_DBG("  layer: id=%d name=%s type=%d menuoverlap=%s",
+                id, name.c_str(), type, menuoverlap ? "true" : "false");
     }
-    int    id;          //!< layer id
-    string name;        //!< layer name
-    int    type;        //!< layer type
-    bool   menuoverlap; //!< menu overlap flag
+
+public:
+    int         id;          ///< layer id
+    std::string name;        ///< layer name
+    int         type;        ///< layer type
+    bool        menuoverlap; ///< menu overlap flag
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds display zone information of system config
  */
 //==========================================================================
 class CicoSCDisplayZoneConf
 {
 public:
+    /// default constructor
     CicoSCDisplayZoneConf()
-        : id(-1), name(""), fullname(""), x(-1), y(-1), w(-1), h(-1){}
+        : id(-1), name(""), fullname(""), x(-1), y(-1), w(-1), h(-1) {}
+
+    /// destructor
+    virtual ~CicoSCDisplayZoneConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("\tdisplay zone : id(%d) name(%s) fullname(%s) x(%d) y(%d) "
-                 "w(%d) h(%d) overlap(%s)",
+        ICO_DBG("  zone: id=%d name=%s fullname=%s x=%d y=%d "
+                 "w=%d h=%d overlap=%s",
                  id, name.c_str(), fullname.c_str(),
                  x, y, w, h, overlapStr.c_str());
     }
-    int    id;          //!< display zone id
-    string name;        //!< display zone name
-    string fullname;    //!< display zone name
-    int    x;           //!< display zone x position
-    int    y;           //!< display zone y position
-    int    w;           //!< display zone width
-    int    h;           //!< display zone height
-    string overlapStr;
-    vector<bool> overlap;
+
+public:
+    int    id;              ///< display zone id
+    std::string name;       ///< display zone name
+    std::string fullname;   ///< display zone name
+    int    x;               ///< display zone x position
+    int    y;               ///< display zone y position
+    int    w;               ///< display zone width
+    int    h;               ///< display zone height
+    std::string overlapStr; ///< display overlap
+    std::vector<bool> overlap;  ///< display enable table
 
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds display information of system config
  */
 //==========================================================================
 class CicoSCDisplayConf
 {
 public:
+    /// default constructor
     CicoSCDisplayConf()
         : id(-1), name(""), node(-1), no(-1),
-          type(-1), width(-1), height(-1), inch(-1){}
+          type(-1), width(-1), height(-1), inch(-1) {}
+
+    /// destructor
+    virtual ~CicoSCDisplayConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("display : id(%d) name(%s) node(%d) no(%d)"
-                "type(%d), width(%d) height(%d) inch(%d)",
+        ICO_DBG("display: id=%d name=%s node=%d no=%d "
+                "type=%d width=%d height=%d inch=%d",
                 id, name.c_str(), node, no, type, width, height, inch);
     }
-    int    id;
-    string name;
-    int    node;
-    int    no;
-    int    type;
-    int    width;
-    int    height;
-    int    inch;
-    vector<CicoSCLayerConf*> layerConfList;
-    vector<CicoSCDisplayZoneConf*>  zoneConfList;
+
+public:
+    int         id;      ///< display id
+    std::string name;    ///< display name
+    int         node;    ///< display node id
+    int         no;      ///< display number
+    int         type;    ///< display type
+    int         width;   ///< display width resolution
+    int         height;  ///< display height resolution
+    int         inch;    ///< display inch size
+    std::vector<CicoSCLayerConf*>        layerConfList;  // layer config list
+    std::vector<CicoSCDisplayZoneConf*>  zoneConfList;   // zone config list
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds sound zone information of system config
  */
 //==========================================================================
 class CicoSCSoundZoneConf
 {
 public:
+    /// default constructor
     CicoSCSoundZoneConf()
-        : id(-1), name(""){}
+        : id(-1), name(""), fullname("") {}
+
+    /// destructor
+    virtual ~CicoSCSoundZoneConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("\tsound zone : id(%d) name(%s)", id, name.c_str());
+        ICO_DBG(" zone: id=%d name=%s fullname=%s",
+                id, name.c_str(), fullname.c_str());
     }
-    int    id;
-    string name;
+
+public:
+    int         id;         ///< sound zone id
+    std::string name;       ///< sound zone name
+    std::string fullname;   ///< sound zone full name
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds sound information of system config
  */
 //==========================================================================
 class CicoSCSoundConf
 {
 public:
+    /// default constructor
     CicoSCSoundConf()
-        : id(-1), name(""), no(-1){}
+        : id(-1), name(""), no(-1) {}
+
+    /// destructor
+    virtual ~CicoSCSoundConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("sound : id(%d) name(%s) no(%d)", id, name.c_str(), no);
+        ICO_DBG("sound: id=%d name=%s no=%d", id, name.c_str(), no);
     }
-    int    id;
-    string name;
-    int    no;
-    vector<CicoSCSoundZoneConf*>  zoneConfList;
+
+public:
+    int    id;          ///< sound id
+    std::string name;   ///< sound name
+    int    no;          ///< sound number
+    std::vector<CicoSCSoundZoneConf*>  zoneConfList; ///< sound config list
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds category information of system config
  */
 //==========================================================================
 class CicoSCCategoryConf
 {
 public:
+    /// default constructor
     CicoSCCategoryConf()
         : id(-1), name(""), type(""),
-          view(-1), sound(-1), input(-1), priority(0), rctrl(-1){}
+          view(-1), sound(-1), input(-1), priority(0), rctrl(-1) {}
+
+    /// destructor
+    virtual ~CicoSCCategoryConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("category : id(%d) name(%s) type(%s)"
-                 "view(%d) sound(%d) input(%d) priority(%d)",
+        ICO_DBG("category: id=%d name=%s type=%s "
+                 "view=%d sound=%d input=%d priority=%d",
                  id, name.c_str(), type.c_str(),
                  view, sound, input, priority);
     }
-    int id;
-    string name;
-    string type;
-    int view;
-    int sound;
-    int input;
-    int priority;
-    int rctrl; /* resource control infomation */
+
+public:
+    int         id;         ///< category id
+    std::string name;       ///< category name
+    std::string type;       ///< category type
+    int         view;       ///< category view
+    int         sound;      ///< category sound
+    int         input;      ///< category input
+    int         priority;   ///< category priority
+    int         rctrl;      ///< resource control information
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds application kind information of system config
  */
 //==========================================================================
 class CicoSCAppKindConf
 {
 public:
+    enum _privilege {
+        PRIVILEGE_ALMIGHTY       = 0, ///< almighty privilege
+        PRIVILEGE_SYSTEM         = 1, ///< system level
+        PRIVILEGE_SYSTEM_AUDIO   = 2, ///< system level(audio only)
+        PRIVILEGE_SYSTEM_VISIBLE = 3, ///< system level(visible only)
+        PRIVILEGE_MAKER          = 4, ///< maker level
+        PRIVILEGE_CERTIFICATE    = 5, ///< certificated
+        PRIVILEGE_NONE           = 6, ///< no privilege
+    };
+
+    /// default constructor
     CicoSCAppKindConf()
         : id(-1), name(""), privilege(-1), priority(0){}
+
+    /// destructor
+    virtual ~CicoSCAppKindConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("appkind : id(%d) name(%s) priority(%d) priority(%d)",
+        ICO_DBG("appkind: id=%d name=%s priority=%d priority=%d",
                  id, name.c_str(), privilege, priority);
     }
-    int id;
-    string name;
-    int privilege;
-    int priority;
+
+public:
+    int         id;         ///< application kind id
+    std::string name;       ///< application kind name
+    int         privilege;  ///< application privilege
+    int         priority;   ///< application priority
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds input device switch information of system config
  */
 //==========================================================================
 class CicoSCSwitchConf
 {
 public:
+    /// default constructor
     CicoSCSwitchConf()
         : id(-1), name(""), appid(""), keycode(0){}
+
+    /// destructor
+    virtual ~CicoSCSwitchConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("\tswitch : id(%d) name(%s) appid(%s)",
+        ICO_DBG("  switch: id=%d name=%s appid=%s",
                  id, name.c_str(), appid.c_str());
     }
-    int    id;
-    string name;
-    string appid;
-    int    keycode;
+
+public:
+    int         id;         ///< input device switch id
+    std::string name;       ///< input device switch name
+    std::string appid;      ///< fixed assign apllication name
+    int         keycode;    ///< keycode of input device switch
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds input device information of system config
  */
 //==========================================================================
 class CicoSCInputDevConf
 {
 public:
+    /// default constructor
     CicoSCInputDevConf()
-        : id(-1), name(""){}
+        : id(-1), name("") {}
+
+    /// destructor
+    virtual ~CicoSCInputDevConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("inputdev : id(%d) name(%s)", id, name.c_str());
+        ICO_DBG("inputdev: id=%d name=%s", id, name.c_str());
     }
-    int id;
-    string name;
-    vector<CicoSCSwitchConf*> switchConfList;
+
+public:
+    int         id;     ///< input device id
+    std::string name;   ///< input device name
+    std::vector<CicoSCSwitchConf*> switchConfList;  ///< switch list
 };
 
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds default information of system config
  */
 //==========================================================================
 class CicoSCDefaultConf
 {
 public:
+    /// default constructor
     CicoSCDefaultConf()
         : topdir(""), confdir(""),
           node(-1), appkind(-1), category(-1), display(-1), 
           layer(-1), displayzone(-1), sound(-1), soundzone(-1),
           inputdev(-1), inputsw(-1) {};
+
+    /// destructor
+    virtual ~CicoSCDefaultConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("default : topdir(%s) confdir(%s) "
-                 "node(%d) appkind(%d) category(%d) "
-                 "display(%d) layer(%d) displayzone(%d) "
-                 "sound(%d)" "soundzone(%d) "
-                 "inputdev(%d) inputsw(%d)",
-                 topdir.c_str(), confdir.c_str(),
-                 node, appkind, category,
-                 display, layer, displayzone,
-                 sound, soundzone,
-                 inputdev, inputsw);
+        ICO_DBG("default: topdir=%s confdir=%s "
+                "node=%d appkind=%d category=%d "
+                "display=%d layer=%d displayzone=%d "
+                "sound=%d soundzone=%d inputdev=%d inputsw=%d",
+                topdir.c_str(), confdir.c_str(),
+                node, appkind, category, display, layer, displayzone,
+                sound, soundzone, inputdev, inputsw);
     }
-    string topdir;
-    string confdir;
-    int node;
-    int appkind;
-    int category;
-    int display;
-    int layer;
-    int displayzone;
-    int sound;
-    int soundzone;
-    int inputdev;
-    int inputsw;
+
+public:
+    std::string topdir;         ///< top directory path
+    std::string confdir;        ///< config directory path
+    int         node;           ///< default application node id
+    int         appkind;        ///< default application kind
+    int         category;       ///< default application category
+    int         display;        ///< default application display
+    int         layer;          ///< default application display layer
+    int         displayzone;    ///< default application display zone
+    int         sound;          ///< default application sound
+    int         soundzone;      ///< default application sound zone
+    int         inputdev;       ///< default input device
+    int         inputsw;        ///< default input device switch
 };
 
 //==========================================================================
 /**
- *  @brief  CPU resouce control group data
+ *  @brief  This class holds cpu resource group information of system config
  */
 //==========================================================================
 class CicoSCCpuResourceGrp
 {
 public:
+    /// default constructor
     CicoSCCpuResourceGrp()
-        :m_id(-1), m_bDoIt(false), m_grpNm(""){};
-#if 0
-    void getDumpStr(string& s)
+        :m_id(-1), m_bDoIt(false), m_grpNm("") {}
+
+    /// destructor
+    virtual ~CicoSCCpuResourceGrp() {}
+
+    /// dump log this class member variables
+    void dumpConf(void)
     {
-        ostringstream strm;
-        strm << m_id << ", " << m_bDoIt << ", " << m_grpNm << ", H[";
-        for (int i = 0; i < m_hight.size(); << i++) {
-            if (i != 0) strm << ", ";
-            strm << m_hight[i];
+        std::stringstream hightlist;
+        {
+            std::vector<int>::iterator itr = m_hight.begin();
+            for (; itr != m_hight.end(); ++itr) {
+                hightlist << " " << *itr;
+            }
+
         }
-        strm << "], L[";
-        for (int i = 0; i < m_low.size(); << i++) {
-            if (i != 0) strm << ", ";
-            strm << m_low[i];
+
+        std::stringstream lowlist;
+        {
+            std::vector<int>::iterator itr = m_low.begin();
+            for (; itr != m_low.end(); ++itr) {
+                lowlist << " " << *itr;
+            }
+
         }
-        strm << "]";
-        s = strm.str();
-    };
-#endif
-    void dumpConf(void)
-    {
-#if 0
-        string s;
-        getDumpStr(s);
-        ICO_DBG(s.c_str());
-#else
-        ICO_DBG("%d, %s, %s, H%d, L%d", m_id, m_bDoIt? "true": "false",
-                m_grpNm.c_str(), m_hight.size(), m_low.size());
-#endif
+
+        ICO_DBG("cpu reousrce group; id=%d doIt=%s grpNm=%s, high=%d, low=%d",
+                m_id, m_bDoIt? "true": "false", m_grpNm.c_str(),
+                hightlist.str().c_str(), lowlist.str().c_str());
     };
 
 public:
-    int   m_id;
-    bool  m_bDoIt;
-    string m_grpNm;
-    vector<int> m_hight;
-    vector<int> m_low;
+    int              m_id;      ///< cpu resource group id
+    bool             m_bDoIt;   ///< cpu resouce control enable flag
+    std::string      m_grpNm;   ///< cpu resource group name
+    std::vector<int> m_hight;   ///< hight threshold list
+    std::vector<int> m_low;     ///< low threshold list
 };
 
-
 //==========================================================================
 /**
- *  @brief  
+ *  @brief  This class holds system resource information of system config
  */
 //==========================================================================
 class CicoSCResourceConf
 {
 public:
+    /// default constructor
     CicoSCResourceConf()
-        :m_bDoIt(false), m_bLog(false), m_cpuCGRPPath(""), m_sampling(-1) {};
+        :m_bDoIt(false), m_bLog(false), m_cpuCGRPPath(""), m_sampling(-1),
+         m_retryCnt(5), m_lowLimitVal(25), m_highLimitVal(90) {}
+
+    /// destructor
+    virtual ~CicoSCResourceConf() {}
+
+    /// dump log this class member variables
     void dumpConf(void)
     {
-        ICO_DBG("monstt:%s, log:%s, dir:%s, smpl:%d sz:%d",
+        ICO_DBG("do:%s, log:%s, dir:%s, smpl:%d r:%d l:%d h:%d sz:%d",
                 m_bDoIt? "true": "false", m_bLog? "true": "false",
-                m_cpuCGRPPath.c_str(), m_sampling, m_cpuCtrl.size());
+                m_cpuCGRPPath.c_str(), m_sampling, m_retryCnt, m_lowLimitVal,
+                m_highLimitVal, m_cpuCtrl.size());
+    }
+
+public:
+    bool        m_bDoIt;        ///< resource control enable flag
+    bool        m_bLog;         ///< resource control log enable flag
+    std::string m_cpuCGRPPath;  ///< cpu cgroup path
+    int         m_sampling;     ///< sampling period
+    int         m_retryCnt;     ///< retry count
+    int         m_lowLimitVal;  ///< low limit value
+    int         m_highLimitVal; ///< high limit value
+    std::vector<CicoSCCpuResourceGrp*> m_cpuCtrl; ///< cpu control config list
+};
+
+//==========================================================================
+/**
+ *  @brief  This class holds user information of system config
+ */
+//==========================================================================
+class CicoSCUserConf
+{
+public:
+    /// default constructor
+    CicoSCUserConf() :m_parent_dir("/home/app/ico") {}
+    /// destructor
+    virtual ~CicoSCUserConf() {}
+
+    /// dump log this class member variables
+    void dumpConf(void)
+    {
+        ICO_DBG("parent dir:%s", m_parent_dir.c_str());
     }
+
 public:
-    bool m_bDoIt;
-    bool m_bLog;
-    string m_cpuCGRPPath;
-    int  m_sampling;
-    vector<CicoSCCpuResourceGrp*> m_cpuCtrl;
+    std::string m_parent_dir;  ///< parent dir
 };
 
 #endif  // __CICO_SC_CONF_H__
index 4ac4dc0..2b0f376 100644 (file)
@@ -9,14 +9,19 @@
 
 /*========================================================================*/
 /**
- *  @file   CicoSCDisplay.h
+ *  @file   CicoSCDisplay.cpp
  *
- *  @brief  
+ *  @brief  This file implementation of CicoSCDisplay class
  */
 /*========================================================================*/
 
+#include <string>
+#include <vector>
+using namespace std;
+
 #include "CicoSCDisplay.h"
 #include "CicoSCLayer.h"
+#include "CicoSCDisplayZone.h"
 #include "CicoLog.h"
 
 //--------------------------------------------------------------------------
@@ -50,7 +55,7 @@ CicoSCDisplay::~CicoSCDisplay()
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  dump log CicoSCDisplay member variables
+ *  @brief  dump log this class member variables
  */
 //--------------------------------------------------------------------------
 void
index d304d41..8afbedd 100644 (file)
 /**
  *  @file   CicoSCDisplay.h
  *
- *  @brief  definition of CicoSCDisplay class
+ *  @brief  This file is definition of CicoSCDisplay class
  */
 //==========================================================================
 #ifndef __CICO_SC_DISPLAY_H__
 #define __CICO_SC_DISPLAY_H__
 
-#include "wayland-client.h"
-
 #include <string>
 #include <vector>
 
-using namespace std;
-
 //==========================================================================
 //  Forward declaration
 //==========================================================================
@@ -32,7 +28,7 @@ class CicoSCDisplayZone;
 
 //==========================================================================
 /**
- *  @brief  display information
+ *  @brief  This class hold display information
  */
 //==========================================================================
 class CicoSCDisplay
@@ -44,36 +40,36 @@ public:
     // destructor
     ~CicoSCDisplay();
 
-    // dump log CicoSCDisplay member variables
+    // dump log this class member variables
     void dump(void);
 
 private:
-    // assignment operator
+    /// assignment operator
     CicoSCDisplay& operator=(const CicoSCDisplay &object);
 
-    // copy constructor
+    /// copy constructor
     CicoSCDisplay(const CicoSCDisplay &object);
 
 public:
-    // definition value of horizontal
-    const static int ORIENTATION_HORIZONTAL = 0;    
-    // definition value of vartical
+    ///< definition value of horizontal
+    const static int ORIENTATION_HORIZONTAL = 0;
+    ///< definition value of vertical
     const static int ORIENTATION_VERTICAL   = 1;
 
-    int    displayid;   //!< Display ID
-    int    type;        //!< Type
-    int    nodeid;      //!< Host ID
-    int    displayno;   //!< Consecutive numbers
-    int    width;       //!< The number of the lateral pixels
-    int    height;      //!< The number of vertical pixels
-    int    inch;        //!< Screen physical size(0.1 inches of units)
-    int    pWidth;      //!< compositor width
-    int    pHeight;     //!< compositor height
-    int    orientation; //!< screen orientation
-    string name;        //!< Display name
-    vector<CicoSCLayer*> layerList;      //!< list of display layer
-    vector<CicoSCDisplayZone*> zoneList; //!< list of display zone
+    int         displayid;   ///< display id
+    int         type;        ///< display type
+    int         nodeid;      ///< node id
+    int         displayno;   ///< consecutive numbers
+    int         width;       ///< the number of the lateral pixels
+    int         height;      ///< the number of vertical pixels
+    int         inch;        ///< ccreen physical size(0.1 inches of units)
+    int         pWidth;      ///< compositor width
+    int         pHeight;     ///< compositor height
+    int         orientation; ///< screen orientation
+    std::string name;        ///< display name
+
+    std::vector<CicoSCLayer*>       layerList; ///< list of display layer
+    std::vector<CicoSCDisplayZone*> zoneList;  ///< list of display zone
 };
-#endif // __CICO_SC_DISPLAY_H__
+#endif  // __CICO_SC_DISPLAY_H__
 // vim:set expandtab ts=4 sw=4:
index 938d379..4e31cf4 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCDisplayZone.h
  *
- *  @brief  
+ *  @brief  This file implementation of CicoSCDisplayZone class
  */
 /*========================================================================*/
 
index 992f406..7947b2f 100644 (file)
 /**
  *  @file   CicoSCDisplayZone.h
  *
- *  @brief  
+ *  @brief  This file is definition of CicoSCDisplayZone class
  */
 //==========================================================================
 #ifndef __CICO_SC_DISPLAYZONE_H__
 #define __CICO_SC_DISPLAYZONE_H__
 
+#include <string>
+
 //==========================================================================
 /**
- *  @brief  display zone information
+ *  @brief  This class hold display zone information
  */
 //==========================================================================
 class CicoSCDisplayZone
@@ -42,11 +44,12 @@ private:
     CicoSCDisplayZone(const CicoSCDisplayZone &object);
 
 public:
-    int zoneid;  //!< layer ID
-    int x;       //!< display zone x position
-    int y;       //!< display zone y position
-    int width;   //!< display zone width
-    int height;  //!< display zone height
+    int zoneid;           //!< display zone id
+    int x;                //!< display zone x position
+    int y;                //!< display zone y position
+    int width;            //!< display zone width
+    int height;           //!< display zone height
+    std::string fullname; //!< full name of layer
 };
-#endif // __CICO_SC_DISPLAYZONE_H__
+#endif  // __CICO_SC_DISPLAYZONE_H__
 // vim:set expandtab ts=4 sw=4:
index e8ef5b9..aec799a 100644 (file)
 /**
  *  @file   CicoSCInputController.cpp
  *
- *  @brief  
+ *  @brief  This file is implementation of CicoSCInputController class
  */
 //==========================================================================
 
+#include <string>
+#include <vector>
+using namespace std;
+
 #include "CicoSCInputController.h"
 #include "CicoSCWayland.h"
 #include "CicoLog.h"
 #include "CicoSCInputDev.h"
 #include "ico_syc_error.h"
 #include "ico_syc_msg_cmd_def.h"
+#include "ico_syc_private.h"
 #include "CicoSCSystemConfig.h"
 #include "CicoSCConf.h"
-#include "CicoSCCommandParser.h"
+#include "CicoSCCommand.h"
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
 CicoSCInputController::CicoSCInputController()
 {
     CicoSCWayland* wayland = CicoSCWayland::getInstance();
@@ -35,11 +45,16 @@ CicoSCInputController::CicoSCInputController()
 
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
 CicoSCInputController::~CicoSCInputController()
 {
 }
 
-#if 0
+#if 0 //TODO
 int
 initDB(void)
 {
@@ -72,11 +87,18 @@ initDB(void)
 }
 #endif
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief\81@executes an input control process corresponding to the command
+ *
+ *  @param  cmd     command
+ */
+//--------------------------------------------------------------------------
 void
 CicoSCInputController::handleCommand(const CicoSCCommand *cmd)
 {
     ICO_DBG("CicoSCInputController::handleCommand Enter"
-            "(cmdid=%08X)", cmd->cmdid);
+            "(cmdid=0x%08X)", cmd->cmdid);
 
     CicoSCCmdInputDevCtrlOpt *opt;
     CicoSCCmdInputDevSettingOpt *set_opt; 
@@ -84,36 +106,50 @@ CicoSCInputController::handleCommand(const CicoSCCommand *cmd)
     switch (cmd->cmdid) {
     case MSG_CMD_ADD_INPUT:
         opt = static_cast<CicoSCCmdInputDevCtrlOpt*>(cmd->opt);
-        addInputApp(cmd->appid, opt->device, opt->inputNum, opt->fix,
-                    opt->keyCode);
+        addInputApp(cmd->appid, opt->device, opt->input, opt->fix,
+                    opt->keycode);
         break;
     case MSG_CMD_DEL_INPUT:
         opt = static_cast<CicoSCCmdInputDevCtrlOpt*>(cmd->opt);
-        delInputApp(cmd->appid, opt->device, opt->inputNum);
+        delInputApp(cmd->appid, opt->device, opt->input);
         break;
     case MSG_CMD_SEND_INPUT:
         opt = static_cast<CicoSCCmdInputDevCtrlOpt*>(cmd->opt);
-        sendInputEvent(cmd->appid, opt->surfaceid, opt->eventType,
-                       opt->deviceno, opt->eventCode, opt->eventValue);
+        sendInputEvent(cmd->appid, opt->surfaceid, opt->evtype,
+                       opt->deviceno, opt->evcode, opt->evvalue);
         break;
     case MSG_CMD_SET_REGION:
         set_opt = static_cast<CicoSCCmdInputDevSettingOpt*>(cmd->opt);
-        setInputRegion(set_opt->surfaceid, set_opt->x, set_opt->y,
-                       set_opt->width, set_opt->height, set_opt->attr);
+        setInputRegion(cmd->appid, set_opt->winname, set_opt->x, set_opt->y,
+                       set_opt->width, set_opt->height,
+                       set_opt->hotspot_x, set_opt->hotspot_y,
+                       set_opt->cursor_x, set_opt->cursor_y,
+                       set_opt->cursor_width, set_opt->cursor_height, set_opt->attr);
         break;
     case MSG_CMD_UNSET_REGION:
         set_opt = static_cast<CicoSCCmdInputDevSettingOpt*>(cmd->opt);
-        resetInputRegion(set_opt->surfaceid, set_opt->x, set_opt->y,
+        unsetInputRegion(cmd->appid, set_opt->winname, set_opt->x, set_opt->y,
                          set_opt->width, set_opt->height);
         break;
     default:
-        ICO_WRN("Unknown Command(0x%08x)", cmd->cmdid);
+        ICO_WRN("Unknown Command(0x%08X)", cmd->cmdid);
         break;
     }
 
     ICO_DBG("CicoSCInputController::handleCommand Leave");
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  register input device control application
+ *
+ *  @param [in] appid   application id
+ *  @param [in] device  input device name
+ *  @param [in] input   input number
+ *  @parma [in] fix     fixed assign flag
+ *  @parma [in] keycode assigned keycode value
+ */
+//--------------------------------------------------------------------------
 int
 CicoSCInputController::addInputApp(const string &appid,
                                    const string &device,
@@ -125,15 +161,22 @@ CicoSCInputController::addInputApp(const string &appid,
             "(appid=%s device=%s input=%d fix=%d keycode=%d)",
             appid.c_str(), device.c_str(), input, fix, keycode);
 
-    ICO_DBG("ico_input_mgr_control_del_input_app(%s,%s,%d,%d,%d) called.",
-            appid.c_str(), device.c_str(), input, fix, keycode);
-    ico_input_mgr_control_add_input_app(m_inputmgr, appid.c_str(),
-                                        device.c_str(), input, fix, keycode);
+    CicoSCWlInputMgrIF::addInputApp(appid.c_str(), device.c_str(),
+                                    input, fix, keycode);
 
-    ICO_DBG("CicoSCInputController::addInputApp Leave");
+    ICO_DBG("CicoSCInputController::addInputApp Leave(EOK)");
     return ICO_SYC_EOK;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  unregister input device control application
+ *
+ *  @param [in] appid   application id
+ *  @param [in] device  input device name
+ *  @param [in] input   input number
+ */
+//--------------------------------------------------------------------------
 int
 CicoSCInputController::delInputApp(const string &appid,
                                    const string &device,
@@ -143,15 +186,24 @@ CicoSCInputController::delInputApp(const string &appid,
             "(appid=%s device=%s input=%d)",
             appid.c_str(), device.c_str(), input);
 
-    ICO_DBG("ico_input_mgr_control_del_input_app(%s,%s,%d) called.",
-            appid.c_str(), device.c_str(), input);
-    ico_input_mgr_control_del_input_app(m_inputmgr, appid.c_str(),
-                                        device.c_str(), input);
+    CicoSCWlInputMgrIF::delInputApp(appid.c_str(), device.c_str(), input);
 
-    ICO_DBG("CicoSCInputController::delInputApp Leave");
+    ICO_DBG("CicoSCInputController::delInputApp Leave(EOK)");
     return ICO_SYC_EOK;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  send input device event
+ *
+ *  @param [in] appid     application id
+ *  @param [in] surfaceid surface id
+ *  @param [in] type      //TODO
+ *  @param [in] deviceno  input device number
+ *  @param [in] code      //TODO
+ *  @param [in] value     //TODO
+ */
+//--------------------------------------------------------------------------
 int
 CicoSCInputController::sendInputEvent(const string &appid,
                                       int          surfaceid,
@@ -161,52 +213,98 @@ CicoSCInputController::sendInputEvent(const string &appid,
                                       int          value)
 {
     ICO_DBG("CicoSCInputController::sendInputEvent Enter"
-            "(appid=%s surfaceid=%08X type=%d dev_no=%d code=%d value=%d)",
+            "(appid=%s surfaceid=0x%08X type=%d dev_no=%d code=%d value=%d)",
             appid.c_str(), surfaceid, type, deviceno, code, value);
 
-    ICO_DBG("ico_input_mgr_control_send_input_event"
-            "(%s,%08X,%d,%d,%d,%d) called.",
-            appid.c_str(), surfaceid, type, deviceno, code, value);
-    ico_input_mgr_control_send_input_event(m_inputmgr, appid.c_str(), surfaceid,
-                                           type, deviceno, code, value);
-    ICO_DBG("CicoSCInputController::sendInputEvent Leave");
+    CicoSCWlInputMgrIF::sendInputEvent(appid.c_str(), surfaceid,
+                                       type, deviceno, code, value);
+
+    ICO_DBG("CicoSCInputController::sendInputEvent Leave(EOK)");
     return ICO_SYC_EOK;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  set input region informantion
+ *
+ *  @param [in] appid     application id
+ *  @param [in] winname   window name
+ *  @param [in] x         region x positon
+ *  @param [in] y         region y positon
+ *  @param [in] width     region width
+ *  @param [in] height    region height
+ *  @param [in] hotspot_x hotspot x position
+ *  @param [in] hotspot_y hotspot y position
+ *  @param [in] cursor_x  cursor x position
+ *  @param [in] cursor_y  cursor y position
+ *  @param [in] cursor_width  cursor width
+ *  @param [in] cursor_height cursor height
+ *  @param [in] attr      region attribute
+ */
+//--------------------------------------------------------------------------
 int
-CicoSCInputController::setInputRegion(int surfaceid,
+CicoSCInputController::setInputRegion(const string &appid,
+                                      const string &winname,
                                       int x,
                                       int y,
                                       int width,
                                       int height,
+                                      int hotspot_x,
+                                      int hotspot_y,
+                                      int cursor_x,
+                                      int cursor_y,
+                                      int cursor_width,
+                                      int cursor_height,
                                       int attr)
 {
+    char    target[ICO_SYC_MAX_LEN];
+
+    snprintf(target, ICO_SYC_MAX_LEN-1, "%s@%s", winname.c_str(), appid.c_str());
+
     ICO_DBG("CicoSCInputController::setInputRegion Enter"
-            "(surfaceid=%08X x=%d y=%d width=%d height=%d attr=%d)",
-            surfaceid, x, y, width, height, attr);
-
-    ICO_DBG("ico_exinput_set_input_region(%08X,%d,%d,%d,%d,%d) called.",
-            surfaceid, x, y, width, height, attr);
-    ico_exinput_set_input_region(m_exinput, surfaceid, x, y,
-                                 width, height, attr);
-    ICO_DBG("CicoSCInputController::setInputRegion Leave");
+            "(target=%s x=%d y=%d width=%d height=%d "
+            "hotspot=%d/%d cursor=%d/%d-%d/%d attr=%d)",
+            target, x, y, width, height, hotspot_x, hotspot_y,
+            cursor_x, cursor_y, cursor_width, cursor_height, attr);
+
+    CicoSCWlInputMgrIF::setInputRegion(target, x, y, width, height,
+                                       hotspot_x, hotspot_y, cursor_x, cursor_y,
+                                       cursor_width, cursor_height, attr);
+
+    ICO_DBG("CicoSCInputController::setInputRegion Leave(EOK)");
     return ICO_SYC_EOK;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  unset input region informantion
+ *
+ *  @param [in] appid     application id
+ *  @param [in] winname   window name
+ *  @param [in] x         region x positon
+ *  @param [in] y         region y positon
+ *  @param [in] width     region width
+ *  @param [in] height    region height
+ */
+//--------------------------------------------------------------------------
 int
-CicoSCInputController::resetInputRegion(int surfaceid,
+CicoSCInputController::unsetInputRegion(const string &appid,
+                                        const string &winname,
                                         int x,
                                         int y,
                                         int width,
                                         int height)
 {
-    ICO_DBG("CicoSCInputController::resetInputRegion Enter"
-            "(surfaceid=%08X x=%d y=%d width=%d height=%d",
-            surfaceid, x, y, width, height);
-    ICO_DBG("ico_exinput_reset_input_region(%08X,%d,%d,%d,%d) called.",
-            surfaceid, x, y, width, height);
-    ico_exinput_reset_input_region(m_exinput, surfaceid, x, y, width, height);
-    ICO_DBG("CicoSCInputController::resetInputRegion Leave");
+    char    target[ICO_SYC_MAX_LEN];
+
+    snprintf(target, ICO_SYC_MAX_LEN-1, "%s@%s", winname.c_str(), appid.c_str());
+
+    ICO_DBG("CicoSCInputController::unsetInputRegion Enter"
+            "(target=%s x=%d y=%d width=%d height=%d", target, x, y, width, height);
+
+    CicoSCWlInputMgrIF::unsetInputRegion(target, x, y, width, height);
+
+    ICO_DBG("CicoSCInputController::unsetInputRegion Leave(EOK)");
     return ICO_SYC_EOK;
 }
 
@@ -214,14 +312,14 @@ CicoSCInputController::resetInputRegion(int surfaceid,
 /**
  *  @brief  callback to application for input switch information
  *
- *  @param [IN] data        user data
- *  @param [IN] ico_exinput wayland ico_exinput interface
- *  @param [IN] device      input device name
- *  @param [IN] type        input device type (as enum type)
- *  @param [IN] swname      input switch name
- *  @param [IN] input       input switch number
- *  @param [IN] codename    input code name
- *  @param [IN] code        input code number
+ *  @param [in] data        user data
+ *  @param [in] ico_exinput wayland ico_exinput interface
+ *  @param [in] device      input device name
+ *  @param [in] type        input device type (as enum type)
+ *  @param [in] swname      input switch name
+ *  @param [in] input       input switch number
+ *  @param [in] codename    input code name
+ *  @param [in] code        input code number
  */
 //--------------------------------------------------------------------------
 void
@@ -275,12 +373,12 @@ CicoSCInputController::capabilitiesCB(void               *data,
 /**
  *  @brief  callback to application for input code information
  *  
- *  @param [IN] data        user data
- *  @param [IN] ico_exinput wayland ico_exinput interface
- *  @param [IN] device      input device name
- *  @param [IN] input       input switch number
- *  @param [IN] codename    input code name
- *  @param [IN] code        input code number
+ *  @param [in] data        user data
+ *  @param [in] ico_exinput wayland ico_exinput interface
+ *  @param [in] device      input device name
+ *  @param [in] input       input switch number
+ *  @param [in] codename    input code name
+ *  @param [in] code        input code number
  */
 //--------------------------------------------------------------------------
 void
@@ -292,7 +390,7 @@ CicoSCInputController::codeCB(void               *data,
                               int32_t            code)
 {
     ICO_DBG("CicoSCInputController::codeCB Enter"
-            "(device=%s input=%d codename=%s code=%d",
+            "(device=%s input=%d codename=%s code=%d)",
             device, input, codename, code);
 
     CicoSCSwitch *sw = findInputSwitch(device, input);
@@ -323,13 +421,13 @@ CicoSCInputController::codeCB(void               *data,
 /**
  *  @brief  callback to application for switch input 
  *
- *  @param [IN] data        user data
- *  @param [IN] ico_exinput wayland ico_exinput interface
- *  @param [IN] time        input time of miri-sec
- *  @param [IN] device      input device name
- *  @param [IN] input       input switch number
- *  @param [IN] code        input switch code
- *  @param [IN] state       Of/Off status
+ *  @param [in] data        user data
+ *  @param [in] ico_exinput wayland ico_exinput interface
+ *  @param [in] time        input time of millisecond
+ *  @param [in] device      input device name
+ *  @param [in] input       input switch number
+ *  @param [in] code        input switch code
+ *  @param [in] state       Of/Off status
  */
 //--------------------------------------------------------------------------
 void
@@ -348,7 +446,7 @@ CicoSCInputController::inputCB(void               *data,
     // TODO send message
 #if 0
     CicoSCMessage message;
-    message.addElement("commnd", ICO_SYC_EV_WIN_CREATE);
+    message.addElement("command", ICO_SYC_EV_WIN_CREATE);
     message.addElement("appid", TODO);
     message.addElement("arg.device", device);
     message.addElement("arg.input", input);
@@ -364,9 +462,9 @@ CicoSCInputController::inputCB(void               *data,
 /**
  *  @brief  callback to application for change input region
  *
- *  @param [IN] data                user data
- *  @param [IN] ico_input_mgr_dev   wayland ico_exinput interface
- *  @param [IN] region              input regions
+ *  @param [in] data                user data
+ *  @param [in] ico_input_mgr_dev   wayland ico_exinput interface
+ *  @param [in] region              input regions
  */
 //--------------------------------------------------------------------------
 void
@@ -378,6 +476,15 @@ CicoSCInputController::regionCB(void                        *data,
     ICO_DBG("CicoSCInputController::regionCB Leave");
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  find input device information
+ *
+ *  @param [in] device  input device name
+ *
+ *  @return CicoSCInputDev instance on found, NULL on not found
+ */
+//--------------------------------------------------------------------------
 CicoSCInputDev*
 CicoSCInputController::findInputDev(const char *device)
 {
@@ -392,6 +499,16 @@ CicoSCInputController::findInputDev(const char *device)
     return NULL;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  find input device switch information
+ *
+ *  @param [in] device  input device name
+ *  @param [in] input   input number
+ *
+ *  @return CicoSCSwitch instance on found, NULL on not found
+ */
+//--------------------------------------------------------------------------
 CicoSCSwitch*
 CicoSCInputController::findInputSwitch(const char *device, int input)
 {
index 9f03f06..e1e83ea 100644 (file)
 /**
  *  @file   CicoSCInputController.h
  *
- *  @brief  
+ *  @brief  This file is definition of CicoSCInputController class
  */
 //==========================================================================
 #ifndef __CICO_SC_INPUT_CONTROLLER_H__
 #define __CICO_SC_INPUT_CONTROLLER_H__
 
+#include <string>
 #include <vector>
-using namespace std;
 
 #include "CicoSCWlInputMgrIF.h"
 
@@ -31,7 +31,7 @@ class CicoSCSwitch;
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  input device controller
+ *  @brief  This class is controller of input device
  */
 //--------------------------------------------------------------------------
 class CicoSCInputController : public CicoSCWlInputMgrIF
@@ -43,40 +43,56 @@ public:
     // destructor
     ~CicoSCInputController();
 
+    // initialize input device information 
     int initDB(void);
 
+    // executes an input control process corresponding to the command
     void handleCommand(const CicoSCCommand *cmd);
 
-    int addInputApp(const string &appid,
-                    const string &device,
-                    int          input,
-                    int          fix,
-                    int          keycode);
-
-    int delInputApp(const string &appid,
-                    const string &device,
-                    int          input);
-
-    int sendInputEvent(const string &appid,
-                       int          surfaceid,
-                       int          type,
-                       int          deviceno,
-                       int          code,
-                       int          value);
-
-    int setInputRegion(int surfaceid,
+    // register input device control application
+    int addInputApp(const std::string &appid,
+                    const std::string &device,
+                    int               input,
+                    int               fix,
+                    int               keycode);
+
+    // unregister input device control application
+    int delInputApp(const std::string &appid,
+                    const std::string &device,
+                    int               input);
+
+    // send input device event
+    int sendInputEvent(const std::string &appid,
+                       int               surfaceid,
+                       int               type,
+                       int               deviceno,
+                       int               code,
+                       int               value);
+
+    // set input region informantion
+    int setInputRegion(const std::string &appid,
+                       const std::string &winname,
                        int x,
                        int y,
                        int width,
                        int height,
+                       int hotspot_x,
+                       int hotspot_y,
+                       int cursor_x,
+                       int cursor_y,
+                       int cursor_width,
+                       int cursor_height,
                        int attr);
 
-    int resetInputRegion(int surfaceid,
+    // unset input region informantion
+    int unsetInputRegion(const std::string &appid,
+                         const std::string &winname,
                          int x,
                          int y,
                          int width,
                          int height);
 
+    // callback to application for input switch information
     void capabilitiesCB(void               *data,
                         struct ico_exinput *ico_exinput,
                         const char         *device,
@@ -86,6 +102,7 @@ public:
                         const char          *codename,
                         int32_t            code);
 
+    // callback to application for input code information
     void codeCB(void               *data,
                 struct ico_exinput *ico_exinput,
                 const char         *device,
@@ -93,6 +110,7 @@ public:
                 const char         *codename,
                 int32_t            code);
 
+    // callback to application for switch input 
     void inputCB(void               *data,
                  struct ico_exinput *ico_exinput,
                  uint32_t           time,
@@ -101,6 +119,7 @@ public:
                  int32_t            code,
                  int32_t            state);
 
+    // callback to application for change input region
     void regionCB(void                        *data,
                   struct ico_input_mgr_device *ico_input_mgr_device,
                   struct wl_array             *region);
@@ -113,13 +132,15 @@ protected:
     CicoSCInputController(const CicoSCInputController &object);
 
 private:
+    // find input device information
     CicoSCInputDev* findInputDev(const char *device);
 
+    // find input device switch information
     CicoSCSwitch* findInputSwitch(const char *device, int input);
 
 private:
-    //
-    vector<CicoSCInputDev*> m_inputDevList;
+    /// input device information list
+    std::vector<CicoSCInputDev*> m_inputDevList;
 };
-#endif // __CICO_SC_INPUT_CONTROLLER_H__
+#endif  // __CICO_SC_INPUT_CONTROLLER_H__
 // vim:set expandtab ts=4 sw=4:
index db219ce..8e3fa65 100644 (file)
 /**
  *  @file   CicoSCInputDev.cpp
  *
- *  @brief  
+ *  @brief  This file is implementation of CicoSCInputDev class
  */
 //==========================================================================
 
+#include <string>
+#include <vector>
+using namespace std;
+
 #include "CicoSCInputDev.h"
 #include "CicoLog.h"
 
-// default constructor
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
 CicoSCInputDev::CicoSCInputDev()
-    : device("")
+    : device(""), type(-1)
 {
 }
 
-// destructor
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
 CicoSCInputDev::~CicoSCInputDev()
 {
 }
 
-// dump log CicoSCInputDev member variables
+//--------------------------------------------------------------------------
+/**
+ *  @brief  dump log this class member variables
+ */
+//--------------------------------------------------------------------------
 void
 CicoSCInputDev::dump(void)
 {
-    ICO_DBG("CicoSCInputDev: device=%d", device.c_str());
+    ICO_DBG("CicoSCInputDev: device=%d type=%d", device.c_str(), type);
 }
 // vim:set expandtab ts=4 sw=4:
index aa15e9f..7308bad 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCInputDev.h
  *
- *  @brief  
+ *  @brief  This file is definition of CicoSCInputDev class
  */
 //==========================================================================
 #ifndef __CICO_SC_INPUT_DEV_H__
@@ -19,7 +19,6 @@
 
 #include <string>
 #include <vector>
-using namespace std;
 
 //==========================================================================
 //  Forward declaration
@@ -28,7 +27,7 @@ class CicoSCSwitch;
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  input device information
+ *  @brief  This class hold input device information
  */
 //--------------------------------------------------------------------------
 class CicoSCInputDev
@@ -40,7 +39,7 @@ public:
     // destructor
     virtual ~CicoSCInputDev();
 
-    // dump log CicoSCInputDev member variables
+    // dump log this class member variables
     void dump(void);
 
 private:
@@ -51,10 +50,10 @@ private:
     CicoSCInputDev(const CicoSCInputDev &object);
 
 public:
-    string device;  //!< input device name
-    int    type;    //!< type
+    std::string device;  //!< input device name
+    int         type;    //!< type
 
-    vector<CicoSCSwitch*> switchList;   //!< switch list
+    std::vector<CicoSCSwitch*> switchList;   //!< switch list
 };
-#endif // __CICO_SC_INPUT_DEV_H__
+#endif  // __CICO_SC_INPUT_DEV_H__
 // vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCLastInfo.h b/lib/system-controller/CicoSCLastInfo.h
new file mode 100644 (file)
index 0000000..cf4c672
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+//==========================================================================
+/**
+ *  @file   CicoSCLastInfo.h
+ *
+ *  @brief  This file is definition of CicoSCLastInfo class
+ */
+//==========================================================================
+#ifndef __CICO_SC_LAST_INFO_H__
+#define __CICO_SC_LAST_INFO_H__
+
+#include <string>
+
+#include "CicoLog.h"
+   
+//==========================================================================
+/**
+ *  @brief  This class hold application's last information
+ */
+//==========================================================================
+class CicoSCLastInfo
+{
+public:
+    // default constructor
+    CicoSCLastInfo()
+        : appid(""), lastinfo("") {}
+
+    // destructor
+    ~CicoSCLastInfo() {}
+
+    // dump log this class member variables
+    void dumpLastInfo(void)
+    {
+        ICO_DBG("CicoSCLastInfo: appid=%s lastinfo=%s",
+                appid.c_str(), lastinfo.c_str());
+    }
+
+public:
+    std::string appid;       ///< application id
+    std::string lastinfo;    ///< application's last information
+};
+#endif  // __CICO_SC_LAST_INFO_H__
+// vim:set expandtab ts=4 sw=4:
index 3efde68..7abcbc3 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCLayer.h
  *
- *  @brief  
+ *  @brief  This file is implementation of CicoSCLayer class
  */
 /*========================================================================*/
 
@@ -24,6 +24,9 @@
  */
 //--------------------------------------------------------------------------
 CicoSCLayer::CicoSCLayer()
+    : layerid(-1), type(-1), width(-1), height(-1),
+      displayid(-1), menuoverlap(false)
+
 {
 }
 
@@ -38,7 +41,7 @@ CicoSCLayer::~CicoSCLayer()
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  dump log CicoSCLayer member variables
+ *  @brief  dump log this class member variables
  */
 //--------------------------------------------------------------------------
 void
index 6db38c7..c2edeee 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCLayer.h
  *
- *  @brief  
+ *  @brief  This file is definition of CicoSCLayer class
  */
 //==========================================================================
 #ifndef __CICO_SC_LAYER_H__
@@ -19,7 +19,7 @@
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  layer information
+ *  @brief  This class hold layer information
  */
 //--------------------------------------------------------------------------
 class CicoSCLayer
@@ -31,7 +31,7 @@ public:
     // destructor
     virtual ~CicoSCLayer();
 
-    // dump log CicoSCLayer member variables
+    // dump log this class member variables
     void dump(void);
 
 private:
@@ -42,12 +42,12 @@ private:
     CicoSCLayer(const CicoSCLayer &object);
 
 public:
-    int     layerid;      //!< layer ID
+    int     layerid;      //!< layer id
     int     type;         //!< enum ico_window_mgr_layer_attr
     int     width;        //!< The number of the lateral pixels
     int     height;       //!< The number of vertical pixels
     int     displayid;    //!< display ID
     bool    menuoverlap;  //!< overlap menu window flag
 };
-#endif // __CICO_SC_LAYER_H__
+#endif  // __CICO_SC_LAYER_H__
 // vim:set expandtab ts=4 sw=4:
index 656dba5..fe3980c 100644 (file)
@@ -14,6 +14,7 @@
 #include <glib.h>
 #include <ail.h>
 #include <aul/aul.h>
+#include <bundle.h>
 #include <sys/stat.h>
 
 #include "ico_syc_error.h"
@@ -132,7 +133,7 @@ CicoSCLifeCycleController::getInstance(void)
  * @retval ICO_SYC_EBUSY error(already launch)
  * @retval ICO_SYC_EPERM error(no authority)
  */
-int CicoSCLifeCycleController::launch(const char* appid)
+int CicoSCLifeCycleController::launch(const char* appid, bundle* b)
 {
     ICO_TRA("start %s", appid);
     // appid check AIL table exist
@@ -140,7 +141,7 @@ int CicoSCLifeCycleController::launch(const char* appid)
         ICO_TRA("not find");
         return ICO_SYC_ENOSYS;
     }
-    int r = aul_launch_app(appid, NULL);
+    int r = aul_launch_app(appid, b);
     if (0 > r) {
         ICO_TRA("aul_launch_app NG %d", r);
         return ICO_SYC_ENOSYS;
@@ -158,9 +159,9 @@ int CicoSCLifeCycleController::launch(const char* appid)
  * @retval ICO_SYC_EBUSY error(already launch)
  * @retval ICO_SYC_EPERM error(no authority)
  */
-int CicoSCLifeCycleController::launch(const std::string& appid)
+int CicoSCLifeCycleController::launch(const std::string& appid, bundle* b)
 {
-    return launch((const char*)appid.c_str());
+    return launch((const char*)appid.c_str(), b);
 }
 
 /**
@@ -447,7 +448,7 @@ const CicoSCAulItems* CicoSCLifeCycleController::findAUL(int pid) const
 
 
 /**
- * @brief ail infomation data initialization
+ * @brief ail information data initialization
  */
 void CicoSCLifeCycleController::initAIL()
 {
@@ -635,7 +636,7 @@ ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
 }
 
 /**
- * @brief create infomation ail data
+ * @brief create information ail data
  * @retval true success
  * @retval false fail create
  */
@@ -647,8 +648,8 @@ bool CicoSCLifeCycleController::createAilItems()
         m_gconf = g_key_file_new();
         GString* gsfp = g_string_new("xx");
         CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
-               g_string_printf(gsfp, "%s/%s", CSCSC->getDefaultConf()->confdir.c_str(),
-                                               ICO_SYC_CONFIG_APPATTR);
+        g_string_printf(gsfp, "%s/%s", CSCSC->getDefaultConf()->confdir.c_str(),
+                        ICO_SYC_CONFIG_APPATTR);
         GError  *gerr = NULL;
         int flg;
         flg = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS;
@@ -656,8 +657,8 @@ bool CicoSCLifeCycleController::createAilItems()
             ICO_ERR("load error conf:%s %s", (char*)gsfp->str, gerr->message);
             g_key_file_free(m_gconf);
             m_gconf = NULL;
-                       g_string_free(gsfp, TRUE);
-                       return false;
+            g_string_free(gsfp, TRUE);
+            return false;
         }
         g_string_free(gsfp, TRUE);
     }
@@ -699,7 +700,7 @@ bool CicoSCLifeCycleController::createAilItems()
 }
 
 /**
- * @brief ail infomation data add one item
+ * @brief ail information data add one item
  * @param sPkg string package (appid)
  * @param sIco string icon full path
  * @param sNm string name
@@ -766,8 +767,8 @@ void CicoSCLifeCycleController::getCategory(const char* sPkg, const char* sNm,
     }
     else {
         for (int i = 1;; i++) {
-            strncpy(&addCtgry[addCtgryLen],
-            appCtgry, sizeof(addCtgry)-addCtgryLen-2);
+            strncpy(&addCtgry[addCtgryLen], appCtgry,
+                    sizeof(addCtgry)-addCtgryLen-2);
             addCtgry[sizeof(addCtgry)-2] = 0;
             addCtgryLen = strlen(addCtgry);
             if (addCtgryLen > 0) {
@@ -800,7 +801,7 @@ void CicoSCLifeCycleController::getCategory(const char* sPkg, const char* sNm,
 }
 
 /**
- * @brief aul infomation data initialization
+ * @brief aul information data initialization
  */
 void CicoSCLifeCycleController::initAUL()
 {
index 3928d11..6cdf7f5 100644 (file)
@@ -12,6 +12,7 @@
 #include <vector>
 #include <map>
 #include <ail.h>
+#include <aul/aul.h>
 #include <package-manager.h>
 
 #include "CicoSCAilItems.h"
@@ -31,11 +32,11 @@ public:
     CicoSCLifeCycleController();
     ~CicoSCLifeCycleController();
 
-       static CicoSCLifeCycleController* getInstance(void);
+    static CicoSCLifeCycleController* getInstance(void);
 
     // Starting application
-    int launch(const char* appid);
-    int launch(const std::string& appid);
+    int launch(const char* appid, bundle* b = NULL);
+    int launch(const std::string& appid, bundle* b = NULL);
     // Stopping application
     int terminate(const char* appid);
     int terminate(const std::string& appid);
@@ -89,7 +90,7 @@ protected:
                 bool bndsp);
     bool removeAUL(int pid);
 private:
-       static CicoSCLifeCycleController* ms_myInstance;
+    static CicoSCLifeCycleController* ms_myInstance;
 
 protected:
     std::vector<CicoSCAilItems> m_ail;
@@ -101,7 +102,7 @@ protected:
 
 /**
  * @brief AIL infomaton list
- * @return AIL infomation item list Container
+ * @return AIL information item list Container
  */
 inline
 const std::vector<CicoSCAilItems>& CicoSCLifeCycleController::getAilList() const
@@ -112,7 +113,7 @@ const std::vector<CicoSCAilItems>& CicoSCLifeCycleController::getAilList() const
 
 /**
  * @brief AUL infomaton list
- * @return AUL infomation item list Container
+ * @return AUL information item list Container
  */
 inline
 const std::vector<CicoSCAulItems>& CicoSCLifeCycleController::getAulList() const
index e4eb5a5..6485bdd 100644 (file)
 /**
  *  @file   CicoSCMessage.cpp
  *
- *  @brief  Implementation of CicoSCMessage class
+ *  @brief  This file implementation of CicoSCMessage class
  */
 //==========================================================================
+
+#include <string>
 #include <limits.h>
 
 #include "CicoSCMessage.h"
@@ -49,13 +51,13 @@ CicoSCMessage::CicoSCMessage()
 //--------------------------------------------------------------------------
 CicoSCMessage::~CicoSCMessage()
 {
-    ICO_DBG("CicoSCMessage::~CicoSCMessage Entry");
+    //ICO_DBG("CicoSCMessage::~CicoSCMessage Enter");
     json_array_unref(m_array);
     json_object_unref(m_rootObj);
     json_object_unref(m_argObj);
     json_node_free(m_root);
     g_object_unref(m_generator);
-    ICO_DBG("CicoSCMessage::~CicoSCMessage Leave");
+    //ICO_DBG("CicoSCMessage::~CicoSCMessage Leave");
 }
 
 //--------------------------------------------------------------------------
@@ -82,7 +84,7 @@ CicoSCMessage::getId(void)
 void
 CicoSCMessage::addRootObject(const char * key, const char * value)
 {
-    ICO_DBG("json_object_set_string_member(%s, %s) called.", key, value);
+//    ICO_DBG("json_object_set_string_member(%s, %s) called.", key, value);
     json_object_set_string_member(m_rootObj, key, value);
 }
 
@@ -97,7 +99,7 @@ CicoSCMessage::addRootObject(const char * key, const char * value)
 void
 CicoSCMessage::addRootObject(const char * key, const std::string & value)
 {
-    ICO_DBG("json_object_set_string_member(%s, %s) called.", key, value.c_str());
+//    ICO_DBG("json_object_set_string_member(%s, %s) called.", key, value.c_str());
     json_object_set_string_member(m_rootObj, key, value.c_str());
 }
 
@@ -112,7 +114,7 @@ CicoSCMessage::addRootObject(const char * key, const std::string & value)
 void
 CicoSCMessage::addRootObject(const char * key, int value)
 {
-    ICO_DBG("json_object_set_int_member(%s, %d) called.", key, value);
+//    ICO_DBG("json_object_set_int_member(%s, %d) called.", key, value);
     json_object_set_int_member(m_rootObj, key, value);
 }
 
@@ -127,7 +129,7 @@ CicoSCMessage::addRootObject(const char * key, int value)
 void
 CicoSCMessage::addArgObject(const char * key, const char * value)
 {
-    ICO_DBG("json_object_set_string_member(%s, %s) called.", key, value);
+//    ICO_DBG("json_object_set_string_member(%s, %s) called.", key, value);
     json_object_set_string_member(m_argObj, key, value);
 }
 
@@ -142,7 +144,7 @@ CicoSCMessage::addArgObject(const char * key, const char * value)
 void
 CicoSCMessage::addArgObject(const char * key, const std::string & value)
 {
-    ICO_DBG("json_object_set_string_member(%s, %s) called.", key, value.c_str());
+//    ICO_DBG("json_object_set_string_member(%s, %s) called.", key, value.c_str());
     json_object_set_string_member(m_argObj, key, value.c_str());
 }
 
@@ -157,7 +159,7 @@ CicoSCMessage::addArgObject(const char * key, const std::string & value)
 void
 CicoSCMessage::addArgObject(const char * key, int value)
 {
-    ICO_DBG("json_object_set_int_member(%s, %d) called.", key, value);
+//    ICO_DBG("json_object_set_int_member(%s, %d) called.", key, value);
     json_object_set_int_member(m_argObj, key, value);
 }
 
@@ -174,7 +176,7 @@ CicoSCMessage::addArgObject(const char * key)
     // count up reference
     json_array_ref(m_array);
 
-    ICO_DBG("json_object_set_array_member(%s) called.", key);
+//    ICO_DBG("json_object_set_array_member(%s) called.", key);
     json_object_set_array_member(m_argObj, key, m_array);
 }
 
@@ -188,7 +190,7 @@ CicoSCMessage::addArgObject(const char * key)
 void
 CicoSCMessage::addElmArray(const char * value)
 {
-    ICO_DBG("json_array_add_string_element(%s) called.", value);
+//    ICO_DBG("json_array_add_string_element(%s) called.", value);
     json_array_add_string_element(m_array, value);
 }
 
@@ -202,7 +204,7 @@ CicoSCMessage::addElmArray(const char * value)
 void
 CicoSCMessage::addElmArray(const std::string & value)
 {
-    ICO_DBG("json_array_add_string_element(%s) called.", value.c_str());
+//    ICO_DBG("json_array_add_string_element(%s) called.", value.c_str());
     json_array_add_string_element(m_array, value.c_str());
 }
 
@@ -253,15 +255,27 @@ CicoSCMessage::getData(void)
     return json_generator_to_data(m_generator, &len);
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get application id of destination
+ *
+ *  @return application id
+ */
+//--------------------------------------------------------------------------
 const std::string &
 CicoSCMessage::getSendToAppid(void)
 {
     return m_toAppid;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  set application id of destination
+ */
+//--------------------------------------------------------------------------
 void
 CicoSCMessage::setSendToAppid(const std::string & appid)
 {
     m_toAppid = appid;
 }
-// vim:set expandtab ts=4 sw=4:
\ No newline at end of file
+// vim:set expandtab ts=4 sw=4:
index aea28a2..f5ba8de 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCMessage.h
  *
- *  @brief  Definition of CicoSCMessage class
+ *  @brief  This file is definition of CicoSCMessage class
  */
 //==========================================================================
 #ifndef __CICO_SC_MESSAGE_H__
@@ -28,7 +28,7 @@ class CicoSCUwsHandle;
 
 //==========================================================================
 /**
- *  @brief  communication message representation
+ *  @brief  This class hold communication message
  */
 //==========================================================================
 class CicoSCMessage
@@ -79,8 +79,10 @@ public:
     // get message data
     const char* getData(void);
 
+    // set application id of destination
     void setSendToAppid(const std::string & appid);
 
+    // get application id of destination
     const std::string & getSendToAppid(void);
 
 private:
@@ -91,9 +93,9 @@ private:
     CicoSCMessage(const CicoSCMessage &object);
 
 private:
-    static unsigned int ms_counter;     //!< meesage id counter
+    static unsigned int ms_counter;     //!< message id counter
     int                 m_id;           //!< message id
-    CicoSCUwsHandle     *m_uwsHandle;   //!< communication handller
+    CicoSCUwsHandle     *m_uwsHandle;   //!< communication handler
     JsonGenerator       *m_generator;   //!< json generator
     JsonNode            *m_root;        //!< json root node
     JsonObject          *m_rootObj;     //!< json root objects
diff --git a/lib/system-controller/CicoSCPolicyDef.h b/lib/system-controller/CicoSCPolicyDef.h
new file mode 100644 (file)
index 0000000..4bd2973
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+//==========================================================================
+/**
+ *  @file   CicoSCPolicyDef.h
+ *
+ *  @brief  This file is definition of StateMachine state and event for policy
+ */
+//==========================================================================
+#ifndef __CICO_SC_POLICY_DEF_H__
+#define __CICO_SC_POLICY_DEF_H__
+
+// running state id
+#define STID_DRIVING                    1000
+#define STID_DRIVING_STOPPING           1001
+#define STID_DRIVING_RUNNING            1002
+
+// shift position state
+#define STID_SHIFTPOS_PARKING           2001
+#define STID_SHIFTPOS_REVERSE           2002
+#define STID_SHIFTPOS_OTHER             2003
+
+// winker state id
+#define STID_WINKER_OFF                 3001
+#define STID_WINKER_RIGHT               3002
+#define STID_WINKER_LEFT                3003
+
+// camera state id
+#define STID_CAMERA                     4000
+#define STID_CAMERA_OFF                 4001
+#define STID_CAMERA_BACK                4002
+#define STID_CAMERA_RIGHT               4003
+#define STID_CAMERA_LEFT                4004
+
+// winker state id
+#define STID_NIGHTMODE                  5000
+#define STID_NIGHTMODE_OFF              5001
+#define STID_NIGHTMODE_ON               5002
+
+// driving regulation state id
+#define STID_DRVREGULATION              9000
+#define STID_DRVREGULATION_OFF          9001
+#define STID_DRVREGULATION_ON           9002
+
+// display0 zone state id
+#define STID_DISPLAY0_ZONE              10000
+#define STID_DISPLAY0_ZONE1             10001
+#define STID_DISPLAY0_ZONE2             10002
+#define STID_DISPLAY0_ZONE3             10003
+
+// display1 zone state id
+#define STID_DISPLAY1_ZONE              11000
+#define STID_DISPLAY1_ZONE1             11001
+#define STID_DISPLAY1_ZONE2             11002
+#define STID_DISPLAY1_ZONE3             11003
+
+// display0 category state id
+#define STID_DISPLAY0_CATEGORY          12000
+#define STID_DISPLAY0_CATEGORY1         12001
+#define STID_DISPLAY0_CATEGORY2         12002
+#define STID_DISPLAY0_CATEGORY3         12003
+#define STID_DISPLAY0_CATEGORY4         12004
+#define STID_DISPLAY0_CATEGORY5         12005
+#define STID_DISPLAY0_CATEGORY6         12006
+#define STID_DISPLAY0_CATEGORY7         12007
+#define STID_DISPLAY0_CATEGORY8         12008
+#define STID_DISPLAY0_CATEGORY9         12009
+#define STID_DISPLAY0_CATEGORY10        12010
+#define STID_DISPLAY0_CATEGORY11        12011
+
+// display1 category state id
+#define STID_DISPLAY1_CATEGORY          13000
+#define STID_DISPLAY1_CATEGORY1         13001
+#define STID_DISPLAY1_CATEGORY2         13002
+#define STID_DISPLAY1_CATEGORY3         13003
+#define STID_DISPLAY1_CATEGORY4         13004
+#define STID_DISPLAY1_CATEGORY5         13005
+#define STID_DISPLAY1_CATEGORY6         13006
+#define STID_DISPLAY1_CATEGORY7         13007
+#define STID_DISPLAY1_CATEGORY8         13008
+#define STID_DISPLAY1_CATEGORY9         13009
+#define STID_DISPLAY1_CATEGORY10        13010
+#define STID_DISPLAY1_CATEGORY11        13011
+
+// onscreen state id
+#define STID_ONSCREEN                   14000
+#define STID_ONSCREEN_WARNING           14001
+#define STID_ONSCREEN_ATTENTION         14002
+#define STID_ONSCREEN_MESSAGE           14003
+
+// interrput display0 zone1 state id
+#define STID_INTTERPUT_D0_Z1            15000
+#define STID_INTTERPUT_D0_Z1_PRI1       15001
+#define STID_INTTERPUT_D0_Z1_PRI2       15002
+#define STID_INTTERPUT_D0_Z1_PRI3       15003
+#define STID_INTTERPUT_D0_Z1_INVISIBLE  15999
+
+// interrput display0 zone2 state id
+#define STID_INTTERPUT_D0_Z2            16000
+#define STID_INTTERPUT_D0_Z2_PRI1       16001
+#define STID_INTTERPUT_D0_Z2_PRI2       16002
+#define STID_INTTERPUT_D0_Z2_PRI3       16003
+#define STID_INTTERPUT_D0_Z2_INVISIBLE  16999
+
+// interrput display0 zone3 state id
+#define STID_INTTERPUT_D0_Z3            17000
+#define STID_INTTERPUT_D0_Z3_PRI1       17001
+#define STID_INTTERPUT_D0_Z3_PRI2       17002
+#define STID_INTTERPUT_D0_Z3_PRI3       17003
+#define STID_INTTERPUT_D0_Z3_INVISIBLE  17999
+
+// sound zone state id
+#define STID_SOUND_ZONE                 20000
+#define STID_SOUND_ZONE1                20001
+#define STID_SOUND_ZONE2                20002
+#define STID_SOUND_ZONE3                20003
+
+// display0 category state id
+#define STID_SOUND_CATEGORY             22000
+#define STID_SOUND_CATEGORY1            22001
+#define STID_SOUND_CATEGORY2            22002
+#define STID_SOUND_CATEGORY3            22003
+#define STID_SOUND_CATEGORY4            22004
+#define STID_SOUND_CATEGORY5            22005
+#define STID_SOUND_CATEGORY6            22006
+#define STID_SOUND_CATEGORY7            22007
+#define STID_SOUND_CATEGORY8            22008
+#define STID_SOUND_CATEGORY9            22009
+#define STID_SOUND_CATEGORY10           22010
+#define STID_SOUND_CATEGORY11           22011
+
+// interrupt display0 zone1 state id
+#define STID_INTTERPUT_S_Z1             25000
+#define STID_INTTERPUT_S_Z1_PRI1        25001
+#define STID_INTTERPUT_S_Z1_PRI2        25002
+#define STID_INTTERPUT_S_Z1_PRI3        25003
+#define STID_INTTERPUT_S_Z1_INVISIBLE   25999
+
+// interrupt display0 zone2 state id
+#define STID_INTTERPUT_S_Z2            26000
+#define STID_INTTERPUT_S_Z2_PRI1       26001
+#define STID_INTTERPUT_S_Z2_PRI2       26002
+#define STID_INTTERPUT_S_Z2_PRI3       26003
+#define STID_INTTERPUT_S_Z2_INVISIBLE  26999
+
+// interrupt display0 zone3 state id
+#define STID_INTTERPUT_S_Z3            27000
+#define STID_INTTERPUT_S_Z3_PRI1       27001
+#define STID_INTTERPUT_S_Z3_PRI2       27002
+#define STID_INTTERPUT_S_Z3_PRI3       27003
+#define STID_INTTERPUT_S_Z3_INVISIBLE  27999
+
+// steering switch state id
+#define STID_INPUT1_NOTUSING           30001
+#define STID_INPUT1_USING              30002
+#define STID_INPUT2_NOTUSING           30101
+#define STID_INPUT2_USING              30102
+
+// event id
+#define EVID_VELOCTY                   1000
+#define EVID_SHIFTPOS                  2000
+#define EVID_TURN_OFF                  3000
+#define EVID_TURN_LEFT                 3001
+#define EVID_TURN_RIGHT                3002
+#define EVID_CAMERA                    4000
+#define EVID_NIGHTMODE                 5000
+#define EVID_DRVREGULATION             9000
+
+#define EVID_DISPLAY0_ZONE             10000
+#define EVID_DISPLAY1_ZONE             11000
+
+#define EVID_DISPLAY0_CATEGORY         12000
+#define EVID_DISPLAY1_CATEGORY         13000
+
+#define EVID_ONSCREEN                  14000
+
+#define EVID_INTTERPUT_D0_Z1           15000
+#define EVID_INTTERPUT_D0_Z2           16000
+#define EVID_INTTERPUT_D0_Z3           17000
+
+#define EVID_SOUND_ZONE                20000
+#define EVID_SOUND_ZONE_NOUSE          20999
+
+#define EVID_SOUND_CATEGORY            22000
+#define EVID_SOUND_CATEGORY_UNKNOWN    22999
+
+#define EVID_INTTERPUT_S_Z1            25000
+#define EVID_INTTERPUT_S_Z1_NOOUTPUT   25999
+#define EVID_INTTERPUT_S_Z2            26000
+#define EVID_INTTERPUT_S_Z2_NOOUTPUT   26999
+#define EVID_INTTERPUT_S_Z3            27000
+#define EVID_INTTERPUT_S_Z3_NOOUTPUT   27999
+
+#define EVID_INPUT1_ACQUIRE            30000
+#define EVID_INPUT1_RELEASE            30001
+
+#define EVID_INPUT2_ACQUIRE            30100
+#define EVID_INPUT2_RELEASE            30101
+
+#endif  // __CICO_SC_POLICY_DEF_H__
+// vim:set expandtab ts=4 sw=4:
index e11bcac..d861f43 100644 (file)
 /**
  *  @file   CicoSCPolicyManager.cpp
  *
- *  @brief 
+ *  @brief  This file implementation of CicoSCPolicyManager class
  */
 //==========================================================================
-#include <Ecore.h>
 
+#include "CicoSCPolicyManager.h"
 #include "CicoStateMachine.h"
 #include "CicoState.h"
 #include "CicoHistoryState.h"
 #include "CicoStateMachineCreator.h"
-#include "CicoSCPolicyManager.h"
+#include "CicoSCPolicyDef.h"
 #include "CicoSCResourceManager.h"
 #include "CicoLog.h"
 #include "ico_syc_error.h"
+#include "CicoSCServer.h"
+#include "CicoSCMessage.h"
+#include "ico_syc_msg_cmd_def.h"
+#include "ico_syc_type.h"
 
 //==========================================================================
 //  define
 #define DBUS_INTERFACE  "org.freedesktop.DBus.Properties"
 #define DBUS_METHOD     "Get"
 
-// Defines of Muximum number.
+// Defines of maximum number.
 #define AMB_MAX_VHCLINFO    10  /**< maximum number of vehicle info */
 
 // Enumerations of Vehicle information key.
 typedef enum {
     AMB_VHCL_SPEED  = 1,  /**< Vehicle speed */
     AMB_SHIFT_POSITION,   /**< Shift position */
-    AMB_WINKER,           /**< Winker (not implement in AMB) */
+    AMB_LIGHT_LEFT,       /**< Light left(Turn left) */
+    AMB_LIGHT_RIGHT,      /**< Light right(Turn right) */
+    AMB_NIGHT_MODE,       /**< Night mode */
     AMB_MAX_INFO          /**< Maximum number of type */
 } _amb_vhcl_key_e;
 
-
-/**
- *
- */
+// 
 typedef struct _vehicle_info_property_t {
     int     key;        /* Vehicle Information key */
     const char    *property;  /* D-Bus property name     */
@@ -66,118 +69,82 @@ typedef struct _vehicle_info_data {
 
 _vhcldata_t vhcl_data[AMB_MAX_INFO];
 
-// running state
-#define STID_DRIVING           1000
-#define STID_DRIVING_STOPPING  1001
-#define STID_DRIVING_RUNNING   1002
-
-// shift position state
-#define STID_SHIFTPOS_PARKING  2001
-#define STID_SHIFTPOS_REVERSE  2002
-#define STID_SHIFTPOS_OTHER    2003
-
-// winker state
-#define STID_WINKER_OFF        2001
-#define STID_WINKER_RIGHT      2002
-#define STID_WINKER_LEFT       2003
-
-// driving regulation state
-#define STID_DRVREGULATION     9000
-#define STID_DRVREGULATION_OFF 9001
-#define STID_DRVREGULATION_ON  9002
-
-// camera state
-#define STID_CAMERA        10600 //TODO
-
-#define EVID_VELOCTY        1000
-#define EVID_SHIFTPOS       2000
-#define EVID_WINKER         3000
-#define EVID_DRVREGULATION  9000
-#define EVID_CAMERA        10600
-
-#define EVID_ZONE1_ACQUIRE 10000
-#define EVID_ZONE1_RELEASE 10002
-
-#define EVID_ZONE2_ACQUIRE 10003
-#define EVID_ZONE2_RELEASE 10004
-
-#define EVID_ZONE3_ACQUIRE 10005
-#define EVID_ZONE3_RELEASE 10006
-
-#define EVID_SCR1_RLS      10001
-#define EVID_SCR1_CAMERA   10600
-#define EVID_SCR2_GET      12000
-#define EVID_SCR2_RLS      12001
-#define EVID_ON_SCR_GET    14000
-#define EVID_ON_SCR_RLS    14001
-#define EVID_INT_SCR1_GET  16000
-#define EVID_INT_SCR1_RLS  16001
-#define EVID_INT_SCR2_GET  18000
-#define EVID_INT_SCR2_RLS  18001
-#define EVID_SND_GET       20000
-#define EVID_SND_RLS       20001
-#define EVID_INT_SND_R_GET 22000
-#define EVID_INT_SND_R_RLS 22001
-#define EVID_INT_SND_L_GET 24000
-#define EVID_INT_SND_L_RLS 24001
-#define EVID_INT_STSW_GET  30000
-#define EVID_INT_STSW_RLS  30001
-#define EVID_INT_ESW_GET   32000
-#define EVID_INT_ESW_RLS   32001
-
-/*========================================================================*/    
-/*
- *  private global variable
- */
-/*========================================================================*/    
-/*
- *
- */
+//*========================================================================
+//  global variable
+//========================================================================
+
 static const vhcl_info_prop_t apf_vhcl_info[] = {
-    { AMB_VHCL_SPEED,
-      "VehicleSpeed",
-      "/org/automotive/runningstatus/VehicleSpeed",
-      "org.automotive.VehicleSpeed"
+    {
+        AMB_VHCL_SPEED,
+        "VehicleSpeed",
+        "/org/automotive/runningstatus/VehicleSpeed",
+        "org.automotive.VehicleSpeed"
+    },
+    {
+        AMB_SHIFT_POSITION,
+        "ShiftPosition",
+        "/org/automotive/runningstatus/Transmission",
+        "org.automotive.Transmission"
+    },
+#if 0   // use LightStatus
+/* use LightStatus, because AMB not support access of TurnSignal by D-Bus   */
+    {
+        ICO_SYC_VEHICLEINFO_TURN_SIGNAL,
+        "TurnSignal",
+        "/org/automotive/runningstatus/TurnSignal",
+        "org.automotive.TurnSignal"
     },
-    { AMB_SHIFT_POSITION,
-      "ShiftPosition",
-      "/org/automotive/runningstatus/Transmission",
-      "org.automotive.Transmission"
+#else   // use LightStatus
+    {
+        AMB_LIGHT_LEFT,
+        "LeftTurn",
+        "/org/automotive/runningstatus/LightStatus",
+        "org.automotive.LightStatus"
+    },
+    {
+        AMB_LIGHT_RIGHT,
+        "RightTurn",
+        "/org/automotive/runningstatus/LightStatus",
+        "org.automotive.LightStatus"
+    },
+#endif   // use LightStatus
+    {
+        AMB_NIGHT_MODE,
+        "NightMode",
+        "/org/automotive/custom/NightMode",
+        "org.automotive.NightMode"
     },
-    { AMB_WINKER,
-      "Winker",
-      "\0",
-      "\0" },
     { 0, "\0", "\0", "\0" }
 };
 
-/*
- *  Ecore/D-Bus static variables
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
  */
-static DBusConnection *dbus_connection = NULL;
-
-static Ecore_Timer *vehicle_timer = NULL;
-
-//static int amb_initialized = 0;
-
+//--------------------------------------------------------------------------
 CicoSCPolicyManager::CicoSCPolicyManager(CicoSCResourceManager* resourceMgr)
-    : m_initialized(false), m_resourceMgr(resourceMgr)
+    : m_initialized(false),
+      m_dbusConnection(NULL),
+      m_ecoreTimer(NULL),
+      m_stateMachine(NULL),
+      m_resourceMgr(resourceMgr)
 {
-    m_acquireDispResEventTable.push_back(0);
-    m_acquireDispResEventTable.push_back(EVID_ZONE1_ACQUIRE);
-    m_acquireDispResEventTable.push_back(EVID_ZONE2_ACQUIRE);
-    m_acquireDispResEventTable.push_back(EVID_ZONE3_ACQUIRE);
-
-    m_releaseDispResEventTable.push_back(0);
-    m_releaseDispResEventTable.push_back(EVID_ZONE1_RELEASE);
-    m_releaseDispResEventTable.push_back(EVID_ZONE2_RELEASE);
-    m_releaseDispResEventTable.push_back(EVID_ZONE3_RELEASE);
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
 CicoSCPolicyManager::~CicoSCPolicyManager()
 {
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  initialize policy manager
+ */
+//--------------------------------------------------------------------------
 int
 CicoSCPolicyManager::initialize(void)
 {
@@ -198,6 +165,11 @@ CicoSCPolicyManager::initialize(void)
     return ret;
 }
   
+//--------------------------------------------------------------------------
+/**
+ *  @brief  terminate policy manager
+ */
+//--------------------------------------------------------------------------
 void
 CicoSCPolicyManager::terminate(void)
 {
@@ -205,6 +177,11 @@ CicoSCPolicyManager::terminate(void)
     ICO_DBG("CicoSCPolicyManager::terminate Leave");
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  initialize amb connection
+ */
+//--------------------------------------------------------------------------
 int
 CicoSCPolicyManager::initAMB(void)
 {
@@ -225,8 +202,8 @@ CicoSCPolicyManager::initAMB(void)
     dbus_error_init(&dbus_error);
 
     /* Get D-Bus connection */
-    dbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &dbus_error);
-    if (! dbus_connection) {
+    m_dbusConnection = dbus_bus_get(DBUS_BUS_SYSTEM, &dbus_error);
+    if (! m_dbusConnection) {
         ICO_ERR("dbus_bus_get failed.");
         ICO_ERR("CicoSCPolicyManager::initAMB Leave(EIO)");
         return ICO_SYC_EIO;
@@ -243,10 +220,9 @@ CicoSCPolicyManager::initAMB(void)
         return ICO_SYC_ENOSYS;
     }
 
-    vehicle_timer = ecore_timer_add(1,//TODO
-                                    CicoSCPolicyManager::ecoreTimerCB,
-                                    this);
-    if (! vehicle_timer)    {
+    m_ecoreTimer = ecore_timer_add(0.2, //TODO
+                                   CicoSCPolicyManager::ecoreTimerCB, this);
+    if (! m_ecoreTimer)    {
         ICO_ERR("ecore_timer_add failed.");
         ICO_ERR("CicoSCPolicyManager::initAMB Leave(ENOSYS)");
         return ICO_SYC_ENOSYS;
@@ -258,6 +234,11 @@ CicoSCPolicyManager::initAMB(void)
     return ICO_SYC_EOK;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  send AMB request
+ */
+//--------------------------------------------------------------------------
 int
 CicoSCPolicyManager::sendAMBRequest(void)
 {
@@ -308,16 +289,16 @@ CicoSCPolicyManager::sendAMBRequest(void)
             ret = ICO_SYC_EIO;
         }
         /* Send message */
-        else if (! dbus_connection_send_with_reply(dbus_connection, 
-                                                   dbus_message,
-                                                   &vhcl_data[idx].pending,
-                                                   200)) {
+        else if (! dbus_connection_send_with_reply(m_dbusConnection, 
+                                                    dbus_message,
+                                                    &vhcl_data[idx].pending,
+                                                    200)) {
             ICO_ERR("dbus_connection_send");
             vhcl_data[idx].pending = NULL;
             ret = ICO_SYC_EIO;
         }
         else {
-//            ICO_DBG("REQUEST req (%s)", apf_vhcl_info[idx].property);
+            //ICO_DBG("REQUEST req (%s)", apf_vhcl_info[idx].property);
         }
 
         if (dbus_message) {
@@ -328,14 +309,19 @@ CicoSCPolicyManager::sendAMBRequest(void)
 
     /* dispatch if data queue exist */
     do  {
-        dbus_connection_read_write_dispatch(dbus_connection, 0);
-    } while (dbus_connection_get_dispatch_status(dbus_connection)
+        dbus_connection_read_write_dispatch(m_dbusConnection, 0);
+    } while (dbus_connection_get_dispatch_status(m_dbusConnection)
              == DBUS_DISPATCH_DATA_REMAINS);
 
-//    ICO_DBG("CicoSCPolicyManager::sendAMBRequest Leave");
+    //ICO_DBG("CicoSCPolicyManager::sendAMBRequest Leave");
     return ret;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get vehicle information
+ */
+//--------------------------------------------------------------------------
 int
 CicoSCPolicyManager::getVehicleInfo(void)
 {
@@ -354,23 +340,23 @@ CicoSCPolicyManager::getVehicleInfo(void)
 
     /* dispatch if data queue exist */
     do {
-        dbus_connection_read_write_dispatch(dbus_connection, 0);
-    } while (dbus_connection_get_dispatch_status(dbus_connection)
+        dbus_connection_read_write_dispatch(m_dbusConnection, 0);
+    } while (dbus_connection_get_dispatch_status(m_dbusConnection)
              == DBUS_DISPATCH_DATA_REMAINS);
 
-    /* analize reply datas */
+    /* analyze reply data */
     for (idx = 0; apf_vhcl_info[idx].key; idx++) {
         if (! vhcl_data[idx].pending)    {
             continue;
         }
         if (! dbus_pending_call_get_completed(vhcl_data[idx].pending))   {
-            ICO_WRN("(%s) NOT complete", apf_vhcl_info[idx].property);
+            //ICO_WRN("(%s) NOT complete", apf_vhcl_info[idx].property);
             continue;
         }
 
         dbus_message = dbus_pending_call_steal_reply(vhcl_data[idx].pending);
         if (! dbus_message) {
-            ICO_WRN("(%s) NO reply", apf_vhcl_info[idx].property);
+            //ICO_WRN("(%s) NO reply", apf_vhcl_info[idx].property);
             continue;
         }
 
@@ -378,7 +364,7 @@ CicoSCPolicyManager::getVehicleInfo(void)
             dbus_message_unref(dbus_message);
             dbus_pending_call_cancel(vhcl_data[idx].pending);
             vhcl_data[idx].pending = NULL;
-            ICO_ERR("(%s) reply error", apf_vhcl_info[idx].property);
+            //ICO_ERR("(%s) reply error", apf_vhcl_info[idx].property);
             continue;
         }
 
@@ -420,8 +406,8 @@ CicoSCPolicyManager::getVehicleInfo(void)
                     apf_vhcl_info[idx].property, ((int)type) & 0x0ff);
             break;
         }
-        ICO_DBG("REQUEST ans (%s) = %.2f",
-                apf_vhcl_info[idx].property, vhcl_data[idx].val);
+        //ICO_DBG("REQUEST ans (%s) = %.2f",
+        //        apf_vhcl_info[idx].property, vhcl_data[idx].val);
 
         /* free message and pending */
         dbus_message_unref(dbus_message);
@@ -432,6 +418,11 @@ CicoSCPolicyManager::getVehicleInfo(void)
     return ICO_SYC_EOK;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  ecore timer callback
+ */
+//--------------------------------------------------------------------------
 Eina_Bool
 CicoSCPolicyManager::ecoreTimerCB(void *user_data)
 {
@@ -442,6 +433,11 @@ CicoSCPolicyManager::ecoreTimerCB(void *user_data)
     return ECORE_CALLBACK_RENEW;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  receive AMB vehicle information
+ */
+//--------------------------------------------------------------------------
 void
 CicoSCPolicyManager::recvAMBVehicleInfo(void)
 {
@@ -449,9 +445,9 @@ CicoSCPolicyManager::recvAMBVehicleInfo(void)
 
     int idx = 0;
     int key = 0;
-    bool chgDrvState = false;
-    bool chgShiftPosState = false;
-    bool chgWinkerState = false;
+    bool chgCamera     = false;
+    bool chgRegulation = false;
+    bool chgNightMode  = false;
 
     getVehicleInfo();
 
@@ -461,17 +457,41 @@ CicoSCPolicyManager::recvAMBVehicleInfo(void)
         key = vhcl_data[idx].key;
         switch (key) {
         case AMB_VHCL_SPEED:
-            ICO_DBG("AMB_VHCL_SPEED : %d",(int)vhcl_data[idx].val);
-            chgDrvState = sendSMEvent(EVID_VELOCTY,
-                                      (int)vhcl_data[idx].val);
+            (void)sendSMEvent(EVID_VELOCTY, (int)vhcl_data[idx].val);
+            if (true == sendSMEvent(EVID_DRVREGULATION)) {
+                chgRegulation = true;
+            }
             break;
         case AMB_SHIFT_POSITION:
-            chgShiftPosState = sendSMEvent(EVID_SHIFTPOS,
-                                           (int)vhcl_data[idx].val);
+            (void)sendSMEvent(EVID_SHIFTPOS, (int)vhcl_data[idx].val);
+            if (true == sendSMEvent(EVID_CAMERA)) {
+                chgCamera = true;
+            }
+            break;
+        case AMB_LIGHT_LEFT:
+            if (0.0 == vhcl_data[idx].val) {
+                (void)sendSMEvent(EVID_TURN_OFF);
+            }
+            else {
+                (void)sendSMEvent(EVID_TURN_LEFT);
+            }
+            if (true == sendSMEvent(EVID_CAMERA)) {
+                chgCamera = true;
+            }
+            break;
+        case AMB_LIGHT_RIGHT:
+            if (0.0 == vhcl_data[idx].val) {
+                (void)sendSMEvent(EVID_TURN_OFF);
+            }
+            else {
+                (void)sendSMEvent(EVID_TURN_LEFT);
+            }
+            if (true == sendSMEvent(EVID_CAMERA)) {
+                chgCamera = true;
+            }
             break;
-        case AMB_WINKER:
-            chgWinkerState = sendSMEvent(EVID_WINKER,
-                                         (int)vhcl_data[idx].val);
+        case AMB_NIGHT_MODE:
+            chgNightMode = sendSMEvent(EVID_NIGHTMODE, (int)vhcl_data[idx].val);
             break;
         default:
             ICO_WRN("not such key (%d)", key);
@@ -479,34 +499,61 @@ CicoSCPolicyManager::recvAMBVehicleInfo(void)
         }
     }
 
-    if (true == chgDrvState) {
-        bool chg = sendSMEvent(EVID_DRVREGULATION);
-        if (true == chg) {
-            // notify changed state to resource manager
-            CicoState* state =
+    if (true == chgRegulation) {
+        ICO_DBG("true == chgRegulation");
+        // notify changed state to resource manager
+        CicoState* state =
                 (CicoState*)m_stateMachine->getState(STID_DRVREGULATION);
+        if (NULL != state) {
             vector<const CicoState*> currents;
-            if ((NULL != state) && (0 != currents.size())) {
-                state->getCurrentState(currents, CicoStateCore::ELvlTop);
+            state->getCurrentState(currents, CicoStateCore::ELvlTop);
+            if (0 != currents.size()) {
                 ICO_DBG("current=%s", currents[0]->getName().c_str());
                 notifyChangedState(currents[0]->getValue());
             }
         }
+
+        // Notify regulation changed state
+        CicoSCMessage *message = new CicoSCMessage();
+        message->addRootObject("command", MSG_CMD_NOTIFY_CHANGED_STATE);
+        message->addArgObject(MSG_PRMKEY_STATEID, ICO_SYC_STATE_REGULATION);
+        if (true == m_policyStates[STID_DRVREGULATION_ON]->isActive()) {
+            message->addArgObject(MSG_PRMKEY_STATE, ICO_SYC_STATE_ON);
+        }
+        else {
+            message->addArgObject(MSG_PRMKEY_STATE, ICO_SYC_STATE_OFF);
+        }
+        CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
     }
-    if (true == chgShiftPosState || true == chgWinkerState) {
-        bool chg = sendSMEvent(EVID_CAMERA);
-        if (true == chg) {
-            // notify changed state to resource manager
-            CicoState* state =
-                (CicoState*)m_stateMachine->getState(STID_CAMERA);
+
+    if (true == chgCamera) {
+        ICO_DBG("true == chgCamera");
+        // notify changed state to resource manager
+        CicoState* state = (CicoState*)m_stateMachine->getState(STID_CAMERA);
+        if (NULL != state) {
             vector<const CicoState*> currents;
-            if ((NULL != state) && (0 != currents.size())) {
-                state->getCurrentState(currents, CicoStateCore::ELvlTop);
+            state->getCurrentState(currents, CicoStateCore::ELvlTop);
+            if (0 != currents.size()) {
                 ICO_DBG("current=%s", currents[0]->getName().c_str());
                 notifyChangedState(currents[0]->getValue());
             }
         }
     }
+
+    if (true == chgNightMode) {
+        ICO_DBG("true == chgNightMode");
+        // Notify NightMode changed state
+        CicoSCMessage *message = new CicoSCMessage();
+        message->addRootObject("command", MSG_CMD_NOTIFY_CHANGED_STATE);
+        message->addArgObject(MSG_PRMKEY_STATEID, ICO_SYC_STATE_NIGHTMODE);
+        if (true == m_policyStates[STID_NIGHTMODE_ON]->isActive()) {
+            message->addArgObject(MSG_PRMKEY_STATE, ICO_SYC_STATE_ON);
+        }
+        else {
+            message->addArgObject(MSG_PRMKEY_STATE, ICO_SYC_STATE_OFF);
+        }
+        CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
+    }
         
     /* send request to AMB */
     sendAMBRequest();
@@ -514,6 +561,22 @@ CicoSCPolicyManager::recvAMBVehicleInfo(void)
 //    ICO_DBG("CicoSCPolicyManager::recvAMBVehicleInfo Leave");
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get policy states
+ */
+//--------------------------------------------------------------------------
+const std::map<int, const CicoState*>&
+CicoSCPolicyManager::getPolicyStates(void)
+{
+    return m_policyStates;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  initialize state machine
+ */
+//--------------------------------------------------------------------------
 int
 CicoSCPolicyManager::initStateMachine(void)
 {
@@ -521,22 +584,61 @@ CicoSCPolicyManager::initStateMachine(void)
 
     CicoStateMachineCreator creator;
 
+    //TODO
     m_stateMachine = creator.createFile("/usr/apps/org.tizen.ico.system-controller/res/config/policy.json");
     if (NULL == m_stateMachine) {
-        ICO_ERR("CicoStateMachineCreator::createFile failed.");
+        ICO_ERR("CicoStateMachineCreator::createFile failed.(reason:%s)",
+                creator.getError().c_str());
         return ICO_SYC_ENOSYS;
     }
 
     int ret = m_stateMachine->start();
     if (ret == 0) {
-        ICO_ERR("CicoStateMachine::start faile.");
+        ICO_ERR("CicoStateMachine::start failed.");
         return ICO_SYC_ENOSYS;
     }
 
+    vector<CicoStateCore*> objects;
+    m_stateMachine->getObjects(objects);
+    vector<CicoStateCore*>::iterator itr;
+    itr = objects.begin();
+    for (; itr != objects.end(); ++itr) {
+        const CicoState* state = static_cast<const CicoState*>(*itr);
+        m_policyStates[state->getValue()] = state;
+#if 1   //-- { debug dump
+        ICO_DBG("State=[%-45s] Active=%s",
+                state->getName().c_str(),
+                state->isActive() ? "true" : "false");
+#endif  //-- } debug dump
+    }
+
+    m_dispZoneStates.push_back(NULL);
+    m_dispZoneStates.push_back(m_policyStates[STID_DISPLAY0_ZONE1]);
+    m_dispZoneStates.push_back(m_policyStates[STID_DISPLAY0_ZONE2]);
+    m_dispZoneStates.push_back(m_policyStates[STID_DISPLAY0_ZONE3]);
+
+    m_soundZoneStates.push_back(NULL);
+    m_soundZoneStates.push_back(m_policyStates[STID_SOUND_ZONE1]);
+    m_soundZoneStates.push_back(m_policyStates[STID_SOUND_ZONE2]);
+    m_soundZoneStates.push_back(m_policyStates[STID_SOUND_ZONE3]);
+
+    m_inputStates.push_back(NULL);
+    m_inputStates.push_back(m_policyStates[STID_INPUT1_USING]);
+    m_inputStates.push_back(m_policyStates[STID_INPUT2_USING]);
+
     ICO_DBG("CicoSCPolicyManager::initStateMachine Leave");
     return ICO_SYC_EOK;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  query whether a state transition
+ *
+ *  @param [in] event_id    trigger event id
+ *
+ *  @return true on test success, false on test failed
+ */
+//--------------------------------------------------------------------------
 bool
 CicoSCPolicyManager::testSMEvent(unsigned short event_id)
 {
@@ -544,6 +646,16 @@ CicoSCPolicyManager::testSMEvent(unsigned short event_id)
     return m_stateMachine->eventTest(event);
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  query whether a state transition
+ *
+ *  @param [in] event_id    trigger event id
+ *  @param [in] value       trigger optional integer value
+ *
+ *  @return true on test success, false on test failed
+ */
+//--------------------------------------------------------------------------
 bool
 CicoSCPolicyManager::testSMEvent(unsigned short event_id, int value)
 {
@@ -551,6 +663,15 @@ CicoSCPolicyManager::testSMEvent(unsigned short event_id, int value)
     return m_stateMachine->eventTest(event);
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  send tigger event
+ *
+ *  @param [in] event_id    trigger event id
+ *
+ *  @return true on state transition, false on not state transition
+ */
+//--------------------------------------------------------------------------
 bool
 CicoSCPolicyManager::sendSMEvent(unsigned short event_id)
 {
@@ -558,6 +679,16 @@ CicoSCPolicyManager::sendSMEvent(unsigned short event_id)
     return m_stateMachine->eventEntry(event);
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  send tigger event
+ *
+ *  @param [in] event_id    trigger event id
+ *  @param [in] value       trigger optional integer value
+ *
+ *  @return true on state transition, false on not state transition
+ */
+//--------------------------------------------------------------------------
 bool
 CicoSCPolicyManager::sendSMEvent(unsigned short event_id, int value)
 {
@@ -566,31 +697,141 @@ CicoSCPolicyManager::sendSMEvent(unsigned short event_id, int value)
 }
 
 bool
-CicoSCPolicyManager::acquireDisplayResource(int zoneid, int category)
+CicoSCPolicyManager::acquireDisplayResource(int type, int zoneid, int priority)
 {
     ICO_DBG("CicoSCPolicyManager::acquireDisplayResource Enter"
-            "(zoneid=%d category=%d)", zoneid, category);
-    bool ret = sendSMEvent(m_acquireDispResEventTable[zoneid], category);
+            "(type=0x%08X zoneid=%d priority=%d)", type, zoneid, priority);
+
+    bool chg = false;
+
+    if (RESID_TYPE_BASIC == type) {
+        bool zoneChg = testSMEvent(EVID_DISPLAY0_ZONE, zoneid);
+        bool cateChg = testSMEvent(EVID_DISPLAY0_CATEGORY, priority);
+        ICO_DBG("zoneChg=%d cateChg=%d", zoneChg, cateChg);
+        if ((true == zoneChg) && (true == cateChg)) {
+            sendSMEvent(EVID_DISPLAY0_ZONE, zoneid);
+            sendSMEvent(EVID_DISPLAY0_CATEGORY, priority);
+            chg = true;
+        }
+    }
+    else if (RESID_TYPE_INTERRUPT == type) {
+        if (1 == zoneid) {
+            chg = sendSMEvent(EVID_INTTERPUT_D0_Z1, priority);
+        }
+        else if (2 == zoneid) {
+            chg = sendSMEvent(EVID_INTTERPUT_D0_Z2, priority);
+        }
+        else if (3 == zoneid) {
+            chg = sendSMEvent(EVID_INTTERPUT_D0_Z3, priority);
+        }
+    }
+    else if (RESID_TYPE_ONSCREEN == type) {
+        chg = sendSMEvent(EVID_ONSCREEN, priority);
+    }
     ICO_DBG("CicoSCPolicyManager::acquireDisplayResource Leave(%s)",
-            ret ? "true" : "false");
-    return ret;
+            chg ? "true" : "false");
+    return chg;
+}
+
+bool
+CicoSCPolicyManager::releaseDisplayResource(int zoneid, int priority)
+{
+    return true;
+}
+
+bool
+CicoSCPolicyManager::acquireSoundResource(int type, int zoneid, int priority)
+{
+    ICO_DBG("CicoSCPolicyManager::acquireSoundResource Enter"
+            "(type=0x%08X zoneid=%d priority=%d)", type, zoneid, priority);
+
+    bool chg = false;
+
+    if (RESID_TYPE_BASIC == type) {
+        bool zoneChg = testSMEvent(EVID_SOUND_ZONE, zoneid);
+        bool cateChg = testSMEvent(EVID_SOUND_CATEGORY, priority);
+        ICO_DBG("zoneChg=%d cateChg=%d", zoneChg, cateChg);
+        if ((true == zoneChg) && (true == cateChg)) {
+            sendSMEvent(EVID_SOUND_ZONE, zoneid);
+            sendSMEvent(EVID_SOUND_CATEGORY, priority);
+            chg = true;
+        }
+    }
+    else if (RESID_TYPE_INTERRUPT == type) {
+        if (1 == zoneid) {
+            chg = sendSMEvent(EVID_INTTERPUT_S_Z1, priority);
+        }
+        else if (2 == zoneid) {
+            chg = sendSMEvent(EVID_INTTERPUT_S_Z2, priority);
+        }
+        else if (3 == zoneid) {
+            chg = sendSMEvent(EVID_INTTERPUT_S_Z3, priority);
+        }
+    }
+
+    ICO_DBG("CicoSCPolicyManager::acquireSoundResource Leave(%s)",
+            chg ? "true" : "false");
+    return chg;
 }
 
 bool
-CicoSCPolicyManager::releaseDisplayResource(int zoneid, int category)
+CicoSCPolicyManager::releaseSoundResource(int type, int zoneid)
 {
+    ICO_DBG("CicoSCPolicyManager::acquireDisplayResource Enter"
+            "(type=%d zoneid=%d)", type, zoneid);
+
+    bool chg = false;
+    if (RESID_TYPE_BASIC == type) {
+        chg = sendSMEvent(EVID_SOUND_ZONE_NOUSE);
+        chg = sendSMEvent(EVID_SOUND_CATEGORY_UNKNOWN);
+    }
+    else if (RESID_TYPE_INTERRUPT == type) {
+        if (1 == zoneid) {
+            chg = sendSMEvent(EVID_INTTERPUT_S_Z1_NOOUTPUT);
+        }
+        else if (2 == zoneid) {
+            chg = sendSMEvent(EVID_INTTERPUT_S_Z2_NOOUTPUT);
+        }
+        else if (3 == zoneid) {
+            chg = sendSMEvent(EVID_INTTERPUT_S_Z3_NOOUTPUT);
+        }
+    }
+
+    ICO_DBG("CicoSCPolicyManager::acquireDisplayResource Leave(%s)",
+            chg ? "true" : "false");
+
     return true;
 }
 
 bool
-CicoSCPolicyManager::acquireInputResource(int zoneid, int category)
+CicoSCPolicyManager::acquireInputResource(int input, int priority)
 {
-    return sendSMEvent(m_acquireDispResEventTable[zoneid], category);
+    ICO_DBG("CicoSCPolicyManager::acquireInputResource Enter"
+            "input=%d priority=%d", input, priority);
+
+    bool chg = false;
+
+    if (1 == input) {
+        chg = sendSMEvent(EVID_INPUT1_ACQUIRE, input);
+    }
+    else if (2 == input) {
+        chg = sendSMEvent(EVID_INPUT2_ACQUIRE, input);
+    }
+
+    ICO_DBG("CicoSCPolicyManager::acquireInputResource Leave(%s)",
+            chg ? "true" : "false");
+    return chg;
 }
 
 bool
-CicoSCPolicyManager::releaseInputResource(int zoneid, int category)
+CicoSCPolicyManager::releaseInputResource(int input)
 {
+    if (1 == input) {
+        (void)sendSMEvent(EVID_INPUT1_RELEASE, input);
+    }
+    else if (2 == input) {
+        (void)sendSMEvent(EVID_INPUT2_RELEASE, input);
+    }
     return true;
 }
 
@@ -599,4 +840,31 @@ CicoSCPolicyManager::notifyChangedState(int state)
 {
     m_resourceMgr->receiveChangedState(state);
 }
+
+bool
+CicoSCPolicyManager::getDispZoneState(int zoneid) const
+{
+    if ((0 < zoneid) && ((int)m_dispZoneStates.size()-1 > zoneid)) {
+        return m_dispZoneStates[zoneid]->isActive();
+    }
+    return false;
+}
+
+bool
+CicoSCPolicyManager::getSoundZoneState(int zoneid) const
+{
+    if ((0 < zoneid) && ((int)m_soundZoneStates.size()-1 > zoneid)) {
+        return m_soundZoneStates[zoneid]->isActive();
+    }
+    return false;
+}
+
+bool
+CicoSCPolicyManager::getInputState(int input) const
+{
+    if ((0 < input) && ((int)m_inputStates.size()-1 > input)) {
+        return m_inputStates[input]->isActive();
+    }
+    return false;
+}
 // vim:set expandtab ts=4 sw=4:
index 9838751..2c0733e 100644 (file)
 /**
  *  @file   CicoSCPolicyManager.h
  *
- *  @brief 
+ *  @brief  This file is definition of CicoSCPolicyManager class
  */
 //==========================================================================
 #ifndef __CICO_SC_POLICY_MANAGER_H__
 #define __CICO_SC_POLICY_MANAGER_H__
 
-#include <vector>
-using namespace std;
-
+#include <Ecore.h>
 #include <Eina.h>
 #include <dbus/dbus.h>
 
+#include <map>
+#include <vector>
+using namespace std;
+
+//==========================================================================
+//  Forward declaration
+//==========================================================================
 class CicoStateMachine;
+class CicoState;
 class CicoSCResourceManager;
 
+//==========================================================================
+/*
+ *  @brief  This class manages the policy of resource
+ */
+//==========================================================================
 class CicoSCPolicyManager
 {
 public:
@@ -41,10 +52,14 @@ public:
     // terminate resource manager
     void terminate(void);
 
-    bool acquireDisplayResource(int zoneid, int category);
+    bool acquireDisplayResource(int type, int zoneid, int priority);
     bool releaseDisplayResource(int zoneid, int category);
-    bool acquireInputResource(int zoneid, int category);
-    bool releaseInputResource(int zoneid, int category);
+
+    bool acquireSoundResource(int type, int zoneid, int priority);
+    bool releaseSoundResource(int input, int priority);
+
+    bool acquireInputResource(int input, int priority);
+    bool releaseInputResource(int input);
 
     bool testSMEvent(unsigned short event_id);
     bool testSMEvent(unsigned short event_id, int value);
@@ -56,6 +71,13 @@ public:
 
     void recvAMBVehicleInfo(void);
 
+    // get states
+    const std::map<int, const CicoState*>& getPolicyStates(void);
+
+    bool getDispZoneState(int zoneid) const;
+    bool getSoundZoneState(int zoneid) const;
+    bool getInputState(int input) const;
+
 private:
     // default constructor
     CicoSCPolicyManager();
@@ -75,19 +97,23 @@ private:
     // get vehicle information
     int getVehicleInfo(void);
 
+    // timer callback function for ecore
     static Eina_Bool ecoreTimerCB(void *user_data);
 
+    // initialize state machine
     int initStateMachine(void);
-
 private:
-    bool m_initialized;
-
-    CicoStateMachine *m_stateMachine;
+    bool                  m_initialized;
+    DBusConnection        *m_dbusConnection;
+    Ecore_Timer           *m_ecoreTimer;
 
+    CicoStateMachine      *m_stateMachine;
     CicoSCResourceManager *m_resourceMgr;
 
-    vector<int> m_acquireDispResEventTable;
-    vector<int> m_releaseDispResEventTable;
+    std::map<int, const CicoState*>  m_policyStates;
+    std::vector<const CicoState*> m_dispZoneStates;
+    std::vector<const CicoState*> m_soundZoneStates;
+    std::vector<const CicoState*> m_inputStates;
 };
 #endif  // __CICO_SC_POLICY_MANAGER_H__
 // vim:set expandtab ts=4 sw=4:
index f847287..a7cfc78 100644 (file)
 /**
  *  @file   CicoSCResourceManager.cpp
  *
- *  @brief 
+ *  @brief  This file implementation of CicoSCResourceManager class
  */
 //==========================================================================
+
+#include <sstream>
+using namespace std;
+
 #include "CicoSCResourceManager.h"
 #include "CicoLog.h"
 #include "ico_syc_error.h"
 
 #include "ico_syc_msg_cmd_def.h"
 #include "CicoSCSystemConfig.h"
-#include "CicoSCCommandParser.h"
+#include "CicoSCConf.h"
+#include "CicoSCCommand.h"
 #include "CicoSCPolicyManager.h"
 #include "CicoSCLifeCycleController.h"
 #include "CicoSCAilItems.h"
 #include "CicoSCWindowController.h"
 #include "CicoSCInputController.h"
+#include "CicoSCPolicyDef.h"
+
+struct CompDisplayResourceRequest
+{
+    CompDisplayResourceRequest(const resource_request_t *req)
+        : m_req(req) {}
+
+    bool operator() (const resource_request_t *req)
+    {
+        if (NULL == req) {
+            return false;
+        }
+        ICO_DBG("appid=%s:%s", req->appid, m_req->appid);
+        if ((0 == strcmp(m_req->appid, req->appid)) &&
+            (m_req->pid == req->pid) &&
+            ((m_req->resid & RESID_TYPE_MASK) == (req->resid & RESID_TYPE_MASK)) &&
+            (m_req->surfaceid == req->surfaceid)) {
+            return true;
+        }
+        return false;
+    }
+
+    const resource_request_t *m_req;
+};
+
+struct CompSoundResourceRequest
+{
+    CompSoundResourceRequest(const resource_request_t *req)
+        : m_req(req) {}
+
+    bool operator() (const resource_request_t *req)
+    {
+        if (NULL == req) {
+            return false;
+        }
+
+        ICO_DBG("appid=%s:%s", req->appid, m_req->appid);
+        if ((0 == strcmp(m_req->appid, req->appid)) &&
+            (m_req->pid == req->pid) &&
+            ((m_req->resid & RESID_TYPE_MASK) == (req->resid & RESID_TYPE_MASK)) &&
+            (m_req->soundid == req->soundid)) {
+            return true;
+        }
+        return false;
+    }
+
+    const resource_request_t *m_req;
+};
+
+struct CompInputResourceRequest
+{
+    CompInputResourceRequest(const resource_request_t *req)
+        : m_req(req) {}
+
+    bool operator() (const resource_request_t *req)
+    {
+        if (NULL == req) {
+            return false;
+        }
+
+        ICO_DBG("appid=%s:%s", req->appid, m_req->appid);
+        if ((0 == strcmp(m_req->appid, req->appid)) &&
+            (0 == strcmp(m_req->device, req->device)) &&
+            (m_req->pid == req->pid) &&
+            ((m_req->resid & RESID_TYPE_MASK) == (req->resid & RESID_TYPE_MASK))) {
+            return true;
+        }
+        return false;
+    }
+
+    const resource_request_t *m_req;
+};
+
 
 CicoSCResourceManager::CicoSCResourceManager()
     : m_winCtrl(NULL), m_inputCtrl(NULL)
 {
     m_policyMgr = new CicoSCPolicyManager(this);
+
+    CicoSCSystemConfig *sysConf = CicoSCSystemConfig::getInstance();
+    list<resource_request_t*> l;
+
+    {
+        // initialize display current request and waiting queue
+        const vector<CicoSCDisplayConf*>& dispConfList
+            = sysConf->getDisplayConfList();
+        vector<CicoSCDisplayConf*>::const_iterator itr;
+        itr = dispConfList.begin();
+        for (; itr != dispConfList.end(); ++itr) {
+            vector<CicoSCDisplayZoneConf*>::iterator itr2;
+            itr2 = (*itr)->zoneConfList.begin();
+            for (; itr2 != (*itr)->zoneConfList.end(); ++itr2) {
+                m_curDispResReq[(*itr2)->id] = NULL;
+                m_dispReqQueue[(*itr2)->id]  = l;
+            }
+        }
+    }
+
+    {
+        // initialize sound current request and waiting queue
+        const vector<CicoSCSoundConf*>& soundConfList
+            = sysConf->getSoundConfList();
+        vector<CicoSCSoundConf*>::const_iterator itr;
+        itr = soundConfList.begin();
+        for (; itr != soundConfList.end(); ++itr) {
+            vector<CicoSCSoundZoneConf*>::iterator itr2;
+            itr2 = (*itr)->zoneConfList.begin();
+            for (; itr2 != (*itr)->zoneConfList.end(); ++itr2) {
+                m_curSoundResReq[(*itr2)->id] = NULL;
+                m_soundReqQueue[(*itr2)->id]  = l;
+            }
+        }
+    }
+
+   {
+        // initialize input current request and waiting queue
+        const vector<CicoSCInputDevConf*>& inputDevConfList
+            = sysConf->getInputDevConfList();
+        vector<CicoSCInputDevConf*>::const_iterator itr;
+        itr = inputDevConfList.begin();
+        for (; itr != inputDevConfList.end(); ++itr) {
+            vector<CicoSCSwitchConf*>::iterator itr2;
+            itr2 = (*itr)->switchConfList.begin();
+            for (; itr2 != (*itr)->switchConfList.end(); ++itr2) {
+                m_curInputResReq[(*itr2)->id] = NULL;
+                m_inputReqQueue[(*itr2)->id]  = l;
+            }
+        }
+    }
 }
 
 CicoSCResourceManager::~CicoSCResourceManager()
@@ -46,7 +175,7 @@ CicoSCResourceManager::initialize(void)
 
     int ret = ICO_SYC_EOK;
 
-    ret = ico_syc_mrp_init(enforceDisplay, enforceSound, enforceInput, this);
+    ret = ico_syc_mrp_init(enforceSound, this);
     if (ICO_SYC_EOK != ret) {
         return ret;
     }
@@ -56,6 +185,7 @@ CicoSCResourceManager::initialize(void)
         return ret;
     }
 
+
     ICO_DBG("CicoSCResourceManager::initialize Leave");
     return ret;
 }
@@ -73,37 +203,46 @@ CicoSCResourceManager::handleCommand(const CicoSCCommand &cmd,
                                      bool internal)
 {
     ICO_DBG("CicoSCResourceManager::handleCommand Enter"
-            "(cmdid=%08X)", cmd.cmdid);
+            "(cmdid=0x%08X internal=%s)",
+            cmd.cmdid, internal ? "true" : "false");
 
     CicoSCCmdResCtrlOpt *opt = (CicoSCCmdResCtrlOpt*)cmd.opt;
 
     // request command from application or internal
     int reqtype = internal ? REQTYPE_AUTO : REQTYPE_APP;
 
-    if (MSG_CMD_ACQUIRE_RES == cmd.cmdid) {
+    if ((MSG_CMD_CREATE_RES == cmd.cmdid) ||
+        (MSG_CMD_ACQUIRE_RES == cmd.cmdid)) {
         
-        if (true == opt->displayres) {
+        if (true == opt->dispres) {
             resource_request_t *req = newResourceRequest(RESID_KIND_DISPLAY,
                                                          reqtype,
                                                          cmd);
-            acquireDisplayResource(req, 0);
+            if (MSG_CMD_CREATE_RES == cmd.cmdid) {
+                acquireDisplayResource(req, false);
+            }
+            else {
+                acquireDisplayResource(req);
+            }
+
         }
         if (true == opt->soundres) {
             resource_request_t *req = newResourceRequest(RESID_KIND_SOUND,
                                                          reqtype,
                                                          cmd);
-            acquireSoundResource(req, 0);
+            acquireSoundResource(req);
         }
         if (true == opt->inputres) {
             resource_request_t *req = newResourceRequest(RESID_KIND_INPUT,
                                                          reqtype,
                                                          cmd);
-            acquireInputResource(req, 0);
+            acquireInputResource(req);
         }
     }
-    else if (MSG_CMD_RELEASE_RES == cmd.cmdid) {
+    else if ((MSG_CMD_RELEASE_RES == cmd.cmdid) ||
+             (MSG_CMD_DESTORY_RES == cmd.cmdid)) {
 
-        if (true == opt->displayres) {
+        if (true == opt->dispres) {
             resource_request_t *req = newResourceRequest(RESID_KIND_DISPLAY,
                                                          reqtype,
                                                          cmd);
@@ -141,51 +280,433 @@ CicoSCResourceManager::setInputController(CicoSCInputController *inputCtrl)
     m_inputCtrl = inputCtrl;
 }
 
+resource_request_t * 
+CicoSCResourceManager::popDispResReq(resource_request_t *req)
+{
+    ICO_DBG("CicoSCResourceManager::popDispResReq Enter");
+
+    map<int, list<resource_request_t*> >::iterator itr;
+    itr = m_dispReqQueue.begin();
+    CompDisplayResourceRequest comp(req);
+    for (; itr != m_dispReqQueue.end(); ++itr) {
+        list<resource_request_t*>::iterator itr2;
+        itr2 = find_if(itr->second.begin(), itr->second.end(), comp);
+        if (itr->second.end() != itr2) {
+            ICO_DBG("Dequeue waiting display request queue zone=%d req=0x%08x",
+                    itr->first, *itr2);
+            m_dispReqQueue[req->dispzoneid].erase(itr2);
+            ICO_DBG("CicoSCResourceManager::popDispResReq Leave"
+                    "(0x%08x)", *itr2);
+            return *itr2;
+        }
+    }
+
+    ICO_DBG("CicoSCResourceManager::popDispResReq Leave(NULL)");
+    return NULL;
+}
+
+resource_request_t *
+CicoSCResourceManager::popSoundResReq(resource_request_t *req)
+{
+    ICO_DBG("CicoSCResourceManager::popSoundResReq Enter");
+
+    map<int, list<resource_request_t*> >::iterator itr;
+    itr = m_soundReqQueue.begin();
+    CompSoundResourceRequest comp(req);
+    for (; itr != m_soundReqQueue.end(); ++itr) {
+        list<resource_request_t*>::iterator itr2;
+        itr2 = find_if(itr->second.begin(), itr->second.end(), comp);
+        if (itr->second.end() != itr2) {
+            ICO_DBG("Dequeue waiting sound request queue zone=%d req=0x%08x",
+                    itr->first, *itr2);
+            m_soundReqQueue[req->soundzoneid].erase(itr2);
+            ICO_DBG("CicoSCResourceManager::popSoundResReq Leave"
+                    "(0x%08x)", *itr2);
+            return *itr2;
+        }
+    }
+    ICO_DBG("CicoSCResourceManager::popSoundResReq Leave(NULL)");
+    return NULL;
+}
+
+resource_request_t * 
+CicoSCResourceManager::popInputResReq(resource_request_t *req)
+{
+    ICO_DBG("CicoSCResourceManager::popInputResReq Enter");
+
+    map<int, list<resource_request_t*> >::iterator itr;
+    itr = m_inputReqQueue.begin();
+    CompInputResourceRequest comp(req);
+    for (; itr != m_inputReqQueue.end(); ++itr) {
+        list<resource_request_t*>::iterator itr2;
+        itr2 = find_if(itr->second.begin(), itr->second.end(), comp);
+        if (itr->second.end() != itr2) {
+            ICO_DBG("Dequeue waiting input request queue input=%d req=0x%08x",
+                    itr->first, *itr2);
+            m_inputReqQueue[req->input].erase(itr2);
+            ICO_DBG("CicoSCResourceManager::popInputResReq Leave"
+                    "(0x%08x)", *itr2);
+            return *itr2;
+        }
+    }
+
+    ICO_DBG("CicoSCResourceManager::popDispResReq Leave(NULL)");
+    return NULL;
+}
+
+
 bool
-CicoSCResourceManager::acquireDisplayResource(resource_request_t *req,
-                                              int addprio)
+CicoSCResourceManager::acquireDisplayResource(resource_request_t *newreq,
+                                              bool control)
 {
-    bool state = m_policyMgr->acquireDisplayResource(req->dispzoneid,
-                                                     req->category);
-    if (true == state) {
-        if (NULL != m_winCtrl) {
-            //m_winCtrl->show(req->surfaceid, NULL, 0);
+    ICO_DBG("CicoSCResourceManager::acquireDisplayResource Enter");
+
+    CicoSCSystemConfig *sysConf = CicoSCSystemConfig::getInstance();
+    const CicoSCAppKindConf *appKindConf = NULL;
+    appKindConf = sysConf->findAppKindConfbyId(newreq->appkind);
+    if (NULL == appKindConf) {
+        ICO_ERR("not found CicoSCAppKindConf instance");
+        ICO_DBG("CicoSCResourceManager::acquireDisplayResource Leave(false)");
+        return false;
+    }
+
+    if ((appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_ALMIGHTY) ||
+        (appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_SYSTEM)   ||
+        (appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_SYSTEM_VISIBLE)) {
+
+        if ((NULL != m_winCtrl) && (true == control)) {
+            m_winCtrl->show(newreq->surfaceid,
+                            newreq->animation,
+                            newreq->animationTime);
+        }
+        delResourceRequest(newreq);
+
+        ICO_DBG("kind of system application");
+        ICO_DBG("CicoSCResourceManager::acquireDisplayResource Leave(true)");
+        return true;
+    }
+
+    resource_request_t *req = NULL;
+    // equal current request?
+    CompDisplayResourceRequest comp(newreq);
+    resource_request_t *curreq = m_curDispResReq[newreq->dispzoneid];
+    if ((NULL != curreq) && (true == comp(curreq))) {
+        ICO_DBG("already acquired appid=%s pid=%d surfaceid=0x%08X",
+                curreq->appid, curreq->pid, curreq->surfaceid);
+        ICO_DBG("CicoSCResourceManager::acquireDisplayResource Leave(true)");
+        // is change zone?
+        if (newreq->dispzoneid == curreq->dispzoneid) {
+            // free new request
+            delResourceRequest(newreq);
+            return true;
+        }
+        req = curreq;
+        curreq->dispzoneid = newreq->dispzoneid;
+        delResourceRequest(newreq);
+    }
+    else {
+        // watting request?
+        req = popDispResReq(newreq);
+        if (NULL == req) {
+            req = newreq;
         }
     }
+
+    if (false == control) {
+        ICO_DBG("Enqueue waiting display request queue zone=%d req=0x%08x",
+                req->dispzoneid, req);
+        m_dispReqQueue[req->dispzoneid].push_front(req);
+        return true;
+    }
+
+    int type = req->resid & RESID_TYPE_MASK;
+    bool state = m_policyMgr->acquireDisplayResource(type,
+                                                     req->dispzoneid,
+                                                     req->prio);
+    if (true == state) {
+        updateDisplayResource(req);
+    }
+    else {
+        ICO_DBG("Enqueue waiting display request queue zone=%d req=0x%08x",
+                req->dispzoneid, req);
+        m_dispReqQueue[req->dispzoneid].push_front(req);
+    }
+
+
+    ICO_DBG("CicoSCResourceManager::acquireDisplayResource Leave");
     return true;
 }
 
-bool
-CicoSCResourceManager::releaseDisplayResource(resource_request_t *req)
-                                                 
+void
+CicoSCResourceManager::releaseDisplayResource(resource_request_t *newreq)
 {
-    return ico_syc_mrp_release_display_resource(req);
+    ICO_DBG("CicoSCResourceManager::releaseDisplayResource Enter");
+
+    bool curchg = false;
+    CompDisplayResourceRequest comp(newreq);
+    for (int i = 0; i < (int)m_curDispResReq.size(); ++i) {
+         if (NULL == m_curDispResReq[i]) {
+            continue;
+         }
+
+         if (true == comp(m_curDispResReq[i])) {
+            if (NULL != m_winCtrl) {
+                // hide current window
+                m_winCtrl->hide(m_curDispResReq[i]->surfaceid, NULL, 0);
+            }
+            delResourceRequest(newreq);
+            delResourceRequest(m_curDispResReq[i]);
+            m_curDispResReq[i] = NULL;
+            curchg = true;
+            break;
+         }
+    }
+
+    // If current request is not changed, 
+    // remove the request from the waiting queue.
+    if (false == curchg) {
+       resource_request_t *req = popDispResReq(newreq);
+        if (NULL != req) {
+            delResourceRequest(req);
+            req = NULL;
+        }
+        delResourceRequest(newreq);
+        ICO_DBG("CicoSCResourceManager::releaseDisplayResource Leave");
+        return;
+    }
+
+    map<int, list<resource_request_t*> >::iterator itr;
+    itr = m_dispReqQueue.begin();
+    for (; itr != m_dispReqQueue.end(); ++itr) {
+        list<resource_request_t*>::iterator itr2;
+        itr2 = itr->second.begin();
+        for (; itr2 !=  itr->second.end(); ++itr2) {
+            int type = (*itr2)->resid & RESID_TYPE_MASK;
+            bool active = m_policyMgr->acquireDisplayResource(type,
+                                                         (*itr2)->dispzoneid,
+                                                         (*itr2)->prio);
+            if (true == active) {
+                resource_request_t* req = *itr2;
+                ICO_DBG("Dequeue waiting display request queue "
+                        "zone=%d req=0x%08x", itr->first, *itr2);
+                itr->second.erase(itr2);
+                updateDisplayResource(req);
+                break;
+            }
+        }
+    }
+
+    ICO_DBG("CicoSCResourceManager::releaseDisplayResource Leave");
 }
 
 bool
-CicoSCResourceManager::acquireSoundResource(resource_request_t *req,
-                                            int addprio)
+CicoSCResourceManager::acquireSoundResource(resource_request_t *newreq)
 {
-    return ico_syc_mrp_acquire_sound_resource(req, addprio);
+    ICO_DBG("CicoSCResourceManager::acquireSoundResource Enter");
+
+    CicoSCSystemConfig *sysConf = CicoSCSystemConfig::getInstance();
+    const CicoSCAppKindConf *appKindConf = NULL;
+    appKindConf = sysConf->findAppKindConfbyId(newreq->appkind);
+    if (NULL == appKindConf) {
+        ICO_ERR("not found CicoSCAppKindConf instance");
+        ICO_DBG("CicoSCResourceManager::acquireSoundResource Leave(false)");
+        return false;
+    }
+
+    if ((appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_ALMIGHTY) ||
+        (appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_SYSTEM)   ||
+        (appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_SYSTEM_AUDIO)) {
+
+        delResourceRequest(newreq);
+
+        ICO_DBG("kind of system application");
+        ICO_DBG("CicoSCResourceManager::acquireSoundResource Leave(true)");
+        return true;
+    }
+
+    resource_request_t *req = popSoundResReq(newreq);
+    if (NULL == req) {
+        req = newreq;
+    }
+
+    // is change zone?
+    CompSoundResourceRequest comp(req);
+    if (true == comp(m_curSoundResReq[req->soundzoneid])) {
+        ICO_DBG("already acquired appid=%s pid=%d soundid=0x%08X",
+                req->appid, req->pid, req->soundid);
+        ICO_DBG("CicoSCResourceManager::acquireSoundResource Leave(true)");
+        // free new request
+        delResourceRequest(newreq);
+        return true;
+    }
+
+    int type = req->resid & RESID_TYPE_MASK;
+    bool state = m_policyMgr->acquireSoundResource(type,
+                                                   req->soundzoneid,
+                                                   req->prio);
+    if (true == state) {
+        updateSoundResource(req);
+    }
+    else {
+        ICO_DBG("Enqueue waiting sound request queue zone=%d req=0x%08x",
+                req->soundzoneid, req);
+        m_soundReqQueue[req->soundzoneid].push_front(req);
+    }
+
+    ICO_DBG("CicoSCResourceManager::acquireSoundResource Leave");
+    return true;
 }
 
-bool
-CicoSCResourceManager::releaseSoundResource(resource_request_t *req)
+void
+CicoSCResourceManager::releaseSoundResource(resource_request_t *newreq)
 {
-    return ico_syc_mrp_release_sound_resource(req);
+    ICO_DBG("CicoSCResourceManager::releaseSoundResource Enter");
+
+    bool curchg = false;
+    CompSoundResourceRequest comp(newreq);
+    for (int i = 0; i < (int)m_curSoundResReq.size(); ++i) {
+         if (NULL == m_curSoundResReq[i]) {
+            continue;
+         }
+
+         if (true == comp(m_curSoundResReq[i])) {
+            ico_syc_mrp_release_sound_resource(m_curSoundResReq[i]);
+            delResourceRequest(newreq);
+            delResourceRequest(m_curSoundResReq[i]);
+            m_curSoundResReq[i] = NULL;
+            curchg = true;
+            break;
+         }
+    }
+
+    // If current request is not changed, 
+    // remove the request from the waiting queue.
+    if (false == curchg) {
+       resource_request_t *req = popSoundResReq(newreq);
+        if (NULL != req) {
+            ico_syc_mrp_release_sound_resource(req);
+            delResourceRequest(req);
+            req = NULL;
+        }
+        delResourceRequest(newreq);
+        ICO_DBG("CicoSCResourceManager::releaseSoundResource Leave");
+        return;
+    }
+
+    map<int, list<resource_request_t*> >::iterator itr;
+    itr = m_soundReqQueue.begin();
+    for (; itr != m_soundReqQueue.end(); ++itr) {
+        list<resource_request_t*>::iterator itr2;
+        itr2 = itr->second.begin();
+        for (; itr2 !=  itr->second.end(); ++itr2) {
+            int type = (*itr2)->resid & RESID_TYPE_MASK;
+            bool active = m_policyMgr->acquireSoundResource(type,
+                                                            (*itr2)->soundzoneid,
+                                                            (*itr2)->prio);
+            if (true == active) {
+                resource_request_t* req = *itr2;
+                ICO_DBG("Dequeue waiting sound request queue "
+                        "zone=%d req=0x%08x", itr->first, *itr2);
+                itr->second.erase(itr2);
+                updateSoundResource(req);
+                break;
+            }
+        }
+    }
+
+    ICO_DBG("CicoSCResourceManager::releaseSoundResource Leave");
 }
 
 bool
-CicoSCResourceManager::acquireInputResource(resource_request_t *req,
-                                            int addprio)
+CicoSCResourceManager::acquireInputResource(resource_request_t *newreq)
 {
-    return ico_syc_mrp_acquire_input_resource(req, addprio);
+    ICO_DBG("CicoSCResourceManager::acquireInputResource Enter");
+
+    resource_request_t *req = popInputResReq(newreq);
+    if (NULL == req) {
+        req = newreq;
+    }
+
+    // is change zone?
+    CompInputResourceRequest comp(req);
+    if (true == comp(m_curInputResReq[req->input])) {
+        ICO_DBG("already acquired appid=%s pid=%d input=0x%08X",
+                req->appid, req->pid, req->input);
+        ICO_DBG("CicoSCResourceManager::acquireInputResource Leave(true)");
+        // free new request
+        delResourceRequest(newreq);
+        return true;
+    }
+
+    bool state = m_policyMgr->acquireInputResource(req->input, req->prio);
+    if (true == state) {
+        updateInputResource(req);
+    }
+    else {
+        ICO_DBG("Enqueue waiting input request queue input=%d req=0x%08x",
+                req->input, req);
+        m_inputReqQueue[req->input].push_front(req);
+    }
+
+    ICO_DBG("CicoSCResourceManager::acquireInputResource Leave");
+    return true;
 }
 
-bool
-CicoSCResourceManager::releaseInputResource(resource_request_t *req)
+void
+CicoSCResourceManager::releaseInputResource(resource_request_t *newreq)
 {
-    return ico_syc_mrp_release_input_resource(req);
+    bool curchg = false;
+    CompInputResourceRequest comp(newreq);
+    for (int i = 0; i < (int)m_curInputResReq.size(); ++i) {
+         if (NULL == m_curInputResReq[i]) {
+            continue;
+         }
+
+         if (true == comp(m_curInputResReq[i])) {
+            if (NULL != m_inputCtrl) {
+                m_inputCtrl->delInputApp(m_curInputResReq[i]->appid,
+                                         m_curInputResReq[i]->device,
+                                         m_curInputResReq[i]->input);
+            }
+            delResourceRequest(newreq);
+            delResourceRequest(m_curInputResReq[i]);
+            m_curInputResReq[i] = NULL;
+            curchg = true;
+            break;
+         }
+    }
+
+    // If current request is not changed, 
+    // remove the request from the waiting queue.
+    if (false == curchg) {
+       resource_request_t *req = popInputResReq(newreq);
+        if (NULL != req) {
+            delResourceRequest(req);
+            req = NULL;
+        }
+        delResourceRequest(newreq);
+        ICO_DBG("CicoSCResourceManager::releaseInputResource Leave");
+        return;
+    }
+
+    map<int, list<resource_request_t*> >::iterator itr;
+    itr = m_inputReqQueue.begin();
+    for (; itr != m_inputReqQueue.end(); ++itr) {
+        list<resource_request_t*>::iterator itr2;
+        itr2 = itr->second.begin();
+        for (; itr2 !=  itr->second.end(); ++itr2) {
+            bool active = m_policyMgr->acquireInputResource((*itr2)->input,
+                                                            (*itr2)->prio);
+            if (true == active) {
+                resource_request_t* req = *itr2;
+                ICO_DBG("Dequeue waiting input request queue "
+                        "input=%d req=0x%08x", itr->first, *itr2);
+                itr->second.erase(itr2);
+                updateInputResource(req);
+                break;
+            }
+        }
+    }
 }
 
 resource_request_t *
@@ -193,25 +714,24 @@ CicoSCResourceManager::newResourceRequest(int resid,
                                           int reqtype,
                                           const CicoSCCommand &cmd)
 {
+    ICO_DBG("CicoSCResourceManager::newResourceRequest Enter");
+
     resource_request_t *req = NULL;
     req = (resource_request_t*)calloc(1, sizeof(resource_request_t));
     CicoSCCmdResCtrlOpt *opt = (CicoSCCmdResCtrlOpt*)cmd.opt;
     CicoSCSystemConfig *systemConfig = CicoSCSystemConfig::getInstance();
 
-    req->reqtype     = reqtype;
+    req->reqtype = reqtype;
 
     CicoSCLifeCycleController *lifeCycle =
         CicoSCLifeCycleController::getInstance();
     const CicoSCAilItems* ailItem = lifeCycle->findAIL(cmd.appid);
-    req->category = ailItem->m_categoryID;
-    ICO_DBG("req->category=%d", req->category);
-
-    // TODO
-    const CicoSCCategoryConf *categoryConf =
-        systemConfig->findCategoryConfbyId(req->category);
-    if (NULL == categoryConf) {
-        req->prio = 10;
+    if (NULL != ailItem) {
+        req->category = ailItem->m_categoryID;
+        req->appkind = ailItem->m_kindID;
     }
+
+    req->prio = req->category;
  
     req->released = 0;
 
@@ -227,22 +747,25 @@ CicoSCResourceManager::newResourceRequest(int resid,
         req->resid |= RESID_CMD_ACQUIRE;
     }
 
-    /* set application infomartion */
+    /* set application information */
     req->appid = strdup(cmd.appid.c_str());
     req->pid   = cmd.pid;
-    req->state = ICO_APF_RESOURCE_STATE_WAITTING;
+    req->state = RES_STATE_WAITING;
 
     if (resid == RESID_KIND_DISPLAY) {
-        req->dispzone   = strdup(opt->displayZone.c_str());
+        req->dispzone   = strdup(opt->dispzone.c_str());
         req->dispzoneid = systemConfig->getDizplayZoneIdbyFullName(req->dispzone);
-        req->winname    = strdup(opt->windowName.c_str());
+        req->winname    = strdup(opt->winname.c_str());
         req->surfaceid  = opt->surfaceid;
         req->id         = opt->surfaceid;;
+        req->animation  = strdup(opt->animation.c_str());
+        req->animationTime = opt->animationTime;
     }
     else if (resid == RESID_KIND_SOUND) {
-        req->soundzone   = strdup(opt->soundZone.c_str());
+        req->soundzone   = strdup(opt->soundzone.c_str());
         req->soundzoneid = systemConfig->getSoundZoneIdbyFullName(req->soundzone);
-        req->sooudname   = strdup(opt->soundName.c_str());
+        ICO_DBG("req->soundzoneid=%d", req->soundzoneid);
+        req->soundname   = strdup(opt->soundname.c_str());
         req->soundid     = opt->soundid;
         req->soundadjust = opt->adjust;
         req->id          = opt->soundid;
@@ -253,6 +776,7 @@ CicoSCResourceManager::newResourceRequest(int resid,
         req->id     = opt->input;
     }
 
+    ICO_DBG("CicoSCResourceManager::newResourceRequest Leave");
     return req;
 }
 
@@ -264,28 +788,17 @@ CicoSCResourceManager::delResourceRequest(resource_request_t *req)
     if (NULL != req->appid)     free(req->appid);
     if (NULL != req->dispzone)  free(req->dispzone);
     if (NULL != req->winname)   free(req->winname);
+    if (NULL != req->animation) free(req->animation);
     if (NULL != req->soundzone) free(req->soundzone);
-    if (NULL != req->sooudname) free(req->sooudname);
+    if (NULL != req->soundname) free(req->soundname);
     if (NULL != req->device)    free(req->device);
  
     free(req);
 }
 
 void
-CicoSCResourceManager::enforceDisplay(unsigned short state,
-                                      const char *appid,
-                                      unsigned int id,
-                                      void *user_data)
-{
-    ICO_DBG("CicoSCResourceManager::enforceDisplay Enter");
-//    ico_uxf_window_control(appid, id, ICO_UXF_APPSCTL_INVISIBLE,
-//            state == ICO_APF_RESOURCE_STATE_ACQUIRED ? 0 : 1);
-    ICO_DBG("CicoSCResourceManager::enforceDisplay Leave");
-}
-                       
-void
 CicoSCResourceManager::enforceSound(unsigned short state,
-                                    pid_t pid,
+                                    resource_request_t *req,
                                     void *user_data)
 {
     ICO_DBG("CicoSCResourceManager::enforceSound Enter");
@@ -293,40 +806,404 @@ CicoSCResourceManager::enforceSound(unsigned short state,
     ICO_DBG("CicoSCResourceManager::enforceSound Leave");
 }
             
+// receive changed state
 void
-CicoSCResourceManager::enforceInput(unsigned short state,
-                                    const char *appid,
-                                    const char *device,
-                                    void *user_data)
+CicoSCResourceManager::receiveChangedState(int state)
 {
-    ICO_DBG("CicoSCResourceManager::enforceInput Enter");
+    ICO_DBG("CicoSCResourceManager::receiveChangedState Enter"
+            "(state=%d)", state);
+
+    if ((STID_DRVREGULATION_ON == state)||
+        (STID_DRVREGULATION_OFF == state)) {
+
+        updateDisplayResourceRegulation(state);
+        updateSoundResourceRegulation(state);
+        updateInputResourceRegulation(state);
 #if 0
-    ico_apc_inputsw_t *czone;
-    int i;
+        bool curchg = false;
+        for (int i = 0; i < (int)m_curDispResReq.size(); ++i) {
+             if (NULL == m_curDispResReq[i]) {
+                continue;
+             }
+             int type = m_curDispResReq[i]->resid & RESID_TYPE_MASK;
+             bool active = m_policyMgr->acquireDisplayResource(type,
+                                                             m_curDispResReq[i]->dispzoneid,
+                                                             m_curDispResReq[i]->prio);
+            if (false == active) {
+                if (NULL != m_winCtrl) {
+                    // hide current window
+                    m_winCtrl->hide(m_curDispResReq[i]->surfaceid, NULL, 0);
+                }
+                // state change to waiting
+                m_curDispResReq[i]->state = RES_STATE_WAITING;
+                // enqueue request
+                ICO_DBG("Enqueue waiting display request queue "
+                        "zone=%d req=0x%08x", i, m_curDispResReq[i]);
+                m_dispReqQueue[i].push_front(m_curDispResReq[i]);
+                // initialize current zone request
+                m_curDispResReq[i] = NULL;
+                curchg = true;
+             }
+        }
 
-    for (i = 0; i < ninputsw; i++) {
-        if (strcasecmp(inputsw[i].inputsw->swname, device) == 0)  break;
+        if ((false == curchg) && (STID_DRVREGULATION_ON == state)) {
+            ICO_DBG("CicoSCResourceManager::receiveChangedState Leave");
+            return;
+        }
+
+        map<int, list<resource_request_t*> >::iterator itr;
+        itr = m_dispReqQueue.begin();
+        for (; itr != m_dispReqQueue.end(); ++itr) {
+            list<resource_request_t*>::iterator itr2;
+            itr2 = itr->second.begin();
+            for (; itr2 !=  itr->second.end(); ++itr2) {
+                if (NULL != m_curDispResReq[itr->first]) {
+                    continue;
+                }
+                int type = (*itr2)->resid & RESID_TYPE_MASK;
+                bool active = m_policyMgr->acquireDisplayResource(type,
+                                                             (*itr2)->dispzoneid,
+                                                             (*itr2)->prio);
+                if (true == active) {
+                    resource_request_t* req = *itr2;
+                    ICO_DBG("Dequeue waiting display request queue "
+                            "zone=%d req=0x%08x", itr->first, *itr2);
+                    itr->second.erase(itr2);
+                    updateDisplayResource(req);
+                    break;
+                }
+            }
+        }
+#endif
     }
 
-    if (i >= ninputsw) {
-        i = confsys->misc.default_inputswId;
+    ICO_DBG("CicoSCResourceManager::receiveChangedState Leave");
+}
+
+void
+CicoSCResourceManager::updateDisplayResource(resource_request_t *req)
+{
+    ICO_DBG("CicoSCResourceManager::updateDisplayResource Enter"
+            "(req=0x%08x)", req);
+    for (int i = 0; i < (int)m_curDispResReq.size(); ++i) {
+        ICO_DBG("zoneid=%d active=%d current=0x%08x",
+                i, m_policyMgr->getDispZoneState(i), m_curDispResReq[i]);
+
+        if (NULL == m_curDispResReq[i]) {
+            continue;
+        }
+
+        if ((i == req->dispzoneid) ||
+            (false == m_policyMgr->getDispZoneState(i))) {
+
+            if (NULL != m_winCtrl) {
+                // hide current window
+                m_winCtrl->hide(m_curDispResReq[i]->surfaceid, NULL, 0);
+            }
+            // state change to waiting
+            m_curDispResReq[i]->state = RES_STATE_WAITING;
+            // enqueue request
+            ICO_DBG("Enqueue waiting display request queue "
+                    "zone=%d req=0x%08x", i, m_curDispResReq[i]);
+            m_dispReqQueue[i].push_front(m_curDispResReq[i]);
+            // initialize current zone request
+            m_curDispResReq[i] = NULL;
+        }
     }
-    czone = &inputsw[i];
 
-    if (ico_uxf_input_control(state == ICO_APF_RESOURCE_STATE_ACQUIRED ? 1 : 0,
-                              appid, czone->inputdev->device,
-                              czone->inputsw->input) != ICO_UXF_EOK) {
-        ICO_WRN("failed to enforce input control");
+    if (req != m_curDispResReq[req->dispzoneid]) {
+        if (NULL != m_winCtrl) {
+            // show request window
+            m_winCtrl->show(req->surfaceid, req->animation,req->animationTime);
+        }
+        // state change to acquired
+        req->state = RES_STATE_ACQUIRED;
+        // update current zone request
+        m_curDispResReq[req->dispzoneid] = req;
     }
-#endif
-    ICO_DBG("CicoSCResourceManager::enforceInput Leave");
+    ICO_DBG("CicoSCResourceManager::updateDisplayResource Leave");
 }
 
-// receive changed state
 void
-CicoSCResourceManager::receiveChangedState(int state)
+CicoSCResourceManager::updateSoundResource(resource_request_t *req)
 {
-    ICO_DBG("CicoSCResourceManager::receiveChanagedState Enter");
-    ICO_DBG("CicoSCResourceManager::receiveChanagedState Leave");
+    ICO_DBG("CicoSCResourceManager::updateSoundResource Enter"
+            "(req=0x%08x)", req);
+    for (int i = 0; i < (int)m_curSoundResReq.size(); ++i) {
+        ICO_DBG("zoneid=%d active=%d current=0x%08x",
+                i, m_policyMgr->getSoundZoneState(i), m_curSoundResReq[i]);
+
+        if (NULL == m_curSoundResReq[i]) {
+            continue;
+        }
+
+        if ((i == req->soundzoneid) ||
+            (false == m_policyMgr->getSoundZoneState(i))) {
+
+            // state change to waiting
+            m_curSoundResReq[i]->state = RES_STATE_WAITING;
+            // enqueue request
+            ICO_DBG("Enqueue waiting sound request queue "
+                    "zone=%d req=0x%08x", i, m_curSoundResReq[i]);
+            m_soundReqQueue[i].push_front(m_curSoundResReq[i]);
+            // initialize current zone request
+            m_curSoundResReq[i] = NULL;
+        }
+    }
+
+    if (req != m_curSoundResReq[req->soundzoneid]) {
+        ico_syc_mrp_acquire_sound_resource(req);
+        ico_syc_mrp_active_app(req->appid);
+
+        // state change to acquired
+        req->state = RES_STATE_ACQUIRED;
+        // update current zone request
+        m_curSoundResReq[req->soundzoneid] = req;
+    }
+    ICO_DBG("CicoSCResourceManager::updateSoundResource Leave");
+}
+
+void
+CicoSCResourceManager::updateInputResource(resource_request_t *req)
+{
+    ICO_DBG("CicoSCResourceManager::updateInputResource Enter"
+            "(req=0x%08x)", req);
+    for (int i = 0; i < (int)m_curInputResReq.size(); ++i) {
+        ICO_DBG("input=%d active=%d current=0x%08x",
+                i, m_policyMgr->getInputState(i), m_curInputResReq[i]);
+
+        if (NULL == m_curInputResReq[i]) {
+            continue;
+        }
+
+        if ((i == req->input) ||
+            (false == m_policyMgr->getInputState(i))) {
+
+            if (NULL != m_inputCtrl) {
+                // add input control
+                m_inputCtrl->delInputApp(req->appid, req->device, req->input);
+            }
+
+            // state change to waiting
+            m_curInputResReq[i]->state = RES_STATE_WAITING;
+            // enqueue request
+            ICO_DBG("Enqueue waiting input request queue "
+                    "zone=%d req=0x%08x", i, m_curInputResReq[i]);
+            m_inputReqQueue[i].push_front(m_curInputResReq[i]);
+            // initialize current zone request
+            m_curInputResReq[i] = NULL;
+        }
+    }
+
+    if (req != m_curInputResReq[req->input]) {
+        // delete input control
+        m_inputCtrl->addInputApp(req->appid, req->device, req->input, 0, 0);
+        // state change to acquired
+        req->state = RES_STATE_ACQUIRED;
+        // update current zone request
+        m_curInputResReq[req->input] = req;
+    }
+    ICO_DBG("CicoSCResourceManager::updateInputResource Leave");
+}
+
+void
+CicoSCResourceManager::updateDisplayResourceRegulation(int state)
+{
+    ICO_DBG("CicoSCResourceManager::updateDisplayResourceRegulation Enter"
+            "(state=%d)", state);
+
+    bool curchg = false;
+    for (int i = 0; i < (int)m_curDispResReq.size(); ++i) {
+        resource_request_t *current = m_curDispResReq[i];
+        if (NULL == current) {
+            continue;
+        }
+
+        int type = current->resid & RESID_TYPE_MASK;
+        bool active = false;
+        active = m_policyMgr->acquireDisplayResource(type,
+                                                     current->dispzoneid,
+                                                     current->prio);
+        if (false == active) {
+            if (NULL != m_winCtrl) {
+                // hide current window
+                m_winCtrl->hide(current->surfaceid, NULL, 0);
+            }
+            // state change to waiting
+            current->state = RES_STATE_WAITING;
+            // enqueue request
+            ICO_DBG("Enqueue waiting display request queue "
+                    "zone=%d req=0x%08x", i, current);
+            m_dispReqQueue[i].push_front(current);
+            // initialize current zone request
+            m_curDispResReq[i] = NULL;
+            curchg = true;
+         }
+    }
+
+    if ((false == curchg) && (STID_DRVREGULATION_ON == state)) {
+        ICO_DBG("CicoSCResourceManager::updateDisplayResourceRegulation Leave");
+        return;
+    }
+
+    map<int, list<resource_request_t*> >::iterator itr;
+    itr = m_dispReqQueue.begin();
+    for (; itr != m_dispReqQueue.end(); ++itr) {
+        if (NULL != m_curDispResReq[itr->first]) {
+            continue;
+        }
+
+        list<resource_request_t*>::iterator itr2;
+        itr2 = itr->second.begin();
+        for (; itr2 !=  itr->second.end(); ++itr2) {
+            int type = (*itr2)->resid & RESID_TYPE_MASK;
+            bool active = false;
+            active = m_policyMgr->acquireDisplayResource(type,
+                                                         (*itr2)->dispzoneid,
+                                                         (*itr2)->prio);
+            if (true == active) {
+                resource_request_t* req = *itr2;
+                ICO_DBG("Dequeue waiting display request queue "
+                        "zone=%d req=0x%08x", itr->first, *itr2);
+                itr->second.erase(itr2);
+                updateDisplayResource(req);
+                break;
+            }
+        }
+    }
+
+    ICO_DBG("CicoSCResourceManager::updateDisplayResourceRegulation Leave");
+}
+
+void
+CicoSCResourceManager::updateSoundResourceRegulation(int state)
+{
+    ICO_DBG("CicoSCResourceManager::updateSoundResourceRegulation Enter"
+            "(state=%d)", state);
+
+    bool curchg = false;
+    for (int i = 0; i < (int)m_curSoundResReq.size(); ++i) {
+        resource_request_t *current = m_curSoundResReq[i];
+        if (NULL == current) {
+            continue;
+        }
+
+        int type = current->resid & RESID_TYPE_MASK;
+        bool active = false;
+        active = m_policyMgr->acquireSoundResource(type,
+                                                   current->soundzoneid,
+                                                   current->prio);
+        if (false == active) {
+            // state change to waiting
+            current->state = RES_STATE_WAITING;
+            // enqueue request
+            ICO_DBG("Enqueue waiting sound request queue "
+                    "zone=%d req=0x%08x", i, current);
+            m_soundReqQueue[i].push_front(current);
+            // initialize current zone request
+            m_curSoundResReq[i] = NULL;
+            curchg = true;
+         }
+    }
+
+    if ((false == curchg) && (STID_DRVREGULATION_ON == state)) {
+        ICO_DBG("CicoSCResourceManager::updateSoundResourceRegulation Leave");
+        return;
+    }
+
+    map<int, list<resource_request_t*> >::iterator itr;
+    itr = m_soundReqQueue.begin();
+    for (; itr != m_soundReqQueue.end(); ++itr) {
+        if (NULL != m_curSoundResReq[itr->first]) {
+            continue;
+        }
+
+        list<resource_request_t*>::iterator itr2;
+        itr2 = itr->second.begin();
+        for (; itr2 !=  itr->second.end(); ++itr2) {
+            int type = (*itr2)->resid & RESID_TYPE_MASK;
+            bool active = false;
+            active = m_policyMgr->acquireSoundResource(type,
+                                                       (*itr2)->soundzoneid,
+                                                       (*itr2)->prio);
+            if (true == active) {
+                resource_request_t* req = *itr2;
+                ICO_DBG("Dequeue waiting sound request queue "
+                        "zone=%d req=0x%08x", itr->first, *itr2);
+                itr->second.erase(itr2);
+                updateSoundResource(req);
+                break;
+            }
+        }
+    }
+
+    ICO_DBG("CicoSCResourceManager::updateSoundResourceRegulation Leave");
+}
+
+void
+CicoSCResourceManager::updateInputResourceRegulation(int state)
+{
+    ICO_DBG("CicoSCResourceManager::updateInputResourceRegulation Enter"
+            "(state=%d)", state);
+
+    bool curchg = false;
+    for (int i = 0; i < (int)m_curInputResReq.size(); ++i) {
+        resource_request_t *current = m_curInputResReq[i];
+        if (NULL == current) {
+            continue;
+        }
+
+        bool active = false;
+        active = m_policyMgr->acquireInputResource(current->input,
+                                                   current->prio);
+        if (false == active) {
+            if (NULL != m_inputCtrl) {
+                // hide current window
+                m_inputCtrl->delInputApp(current->appid,
+                                         current->device,
+                                         current->input);
+            }
+            // state change to waiting
+            current->state = RES_STATE_WAITING;
+            // enqueue request
+            ICO_DBG("Enqueue waiting input request queue "
+                    "zone=%d req=0x%08x", i, current);
+            m_inputReqQueue[i].push_front(current);
+            // initialize current zone request
+            m_curInputResReq[i] = NULL;
+            curchg = true;
+         }
+    }
+
+    if ((false == curchg) && (STID_DRVREGULATION_ON == state)) {
+        ICO_DBG("CicoSCResourceManager::updateInputResourceRegulation Leave");
+        return;
+    }
+
+    map<int, list<resource_request_t*> >::iterator itr;
+    itr = m_inputReqQueue.begin();
+    for (; itr != m_inputReqQueue.end(); ++itr) {
+        if (NULL != m_curInputResReq[itr->first]) {
+            continue;
+        }
+
+        list<resource_request_t*>::iterator itr2;
+        itr2 = itr->second.begin();
+        for (; itr2 !=  itr->second.end(); ++itr2) {
+            bool active = false;
+            active = m_policyMgr->acquireInputResource((*itr2)->input,
+                                                       (*itr2)->prio);
+            if (true == active) {
+                resource_request_t* req = *itr2;
+                ICO_DBG("Dequeue waiting input request queue "
+                        "zone=%d req=0x%08x", itr->first, *itr2);
+                itr->second.erase(itr2);
+                updateInputResource(req);
+                break;
+            }
+        }
+    }
+
+    ICO_DBG("CicoSCResourceManager::updateDisplayResourceRegulation Leave");
 }
 // vim:set expandtab ts=4 sw=4:
index 9b72106..92dbbee 100644 (file)
 /**
  *  @file   CicoSCResourceManager.h
  *
- *  @brief 
+ *  @brief  This file is definition of CicoSCResourceManager class
  */
 //==========================================================================
 #ifndef __CICO_SC_RESOURCE_MANAGER_H__
 #define __CICO_SC_RESOURCE_MANAGER_H__
 
 #include <list>
+#include <vector>
+#include <map>
 using namespace std;
 
 #include "ico_syc_mrp_resource_private.h"
 
+//==========================================================================
+//  Forward declaration
+//==========================================================================
 class CicoSCCommand;
 class CicoSCPolicyManager;
 class CicoSCWindowController;
 class CicoSCInputController;
 
+//==========================================================================
+/*
+ *  @brief  This class manages resources
+ */
+//==========================================================================
 class CicoSCResourceManager
 {
 public:
@@ -38,10 +48,10 @@ public:
 
     // initialize resource manager
     int initialize(void);
-  
+
     // terminate resource manager
     void terminate(void);
+
     // handling command
     void handleCommand(const CicoSCCommand &cmd, bool internal=false);
 
@@ -61,15 +71,15 @@ private:
     // copy constructor
     CicoSCResourceManager(const CicoSCResourceManager &object);
 
-    bool acquireDisplayResource(resource_request_t *req, int addprio);
-    bool releaseDisplayResource(resource_request_t *req);
+    bool acquireDisplayResource(resource_request_t *newreq,
+                                bool control = true);
+    void releaseDisplayResource(resource_request_t *newreq);
 
-    bool acquireSoundResource(resource_request_t *req, int addprio);
-    bool releaseSoundResource(resource_request_t *req);
-
-    bool acquireInputResource(resource_request_t *req, int addprio);
-    bool releaseInputResource(resource_request_t *req);
+    bool acquireSoundResource(resource_request_t *newreq);
+    void releaseSoundResource(resource_request_t *newreq);
 
+    bool acquireInputResource(resource_request_t *newreq);
+    void releaseInputResource(resource_request_t *newreq);
 
     resource_request_t* newResourceRequest(int resid,
                                            int reqtype,
@@ -77,28 +87,37 @@ private:
 
     void delResourceRequest(resource_request_t *req);
 
-    static void enforceDisplay(unsigned short state,
-                               const char *appid,
-                               unsigned int id,
-                               void *user_data);
-
     static void enforceSound(unsigned short state,
-                             pid_t pid,
+                             resource_request_t *req,
                              void *user_data);
 
-    static void enforceInput(unsigned short state,
-                             const char *appid,
-                             const char *device,
-                             void *user_data);
+    resource_request_t * popDispResReq(resource_request_t *req);
 
-private:
-    CicoSCPolicyManager    *m_policyMgr;
-    CicoSCWindowController *m_winCtrl;
-    CicoSCInputController  *m_inputCtrl;
+    resource_request_t * popSoundResReq(resource_request_t *req);
 
-    list<list<resource_request_t*> > m_dispReqQueue;
-    list<list<resource_request_t*> > m_soundReqQueue;
-    list<list<resource_request_t*> > m_inputReqQueue;
+    resource_request_t * popInputResReq(resource_request_t *req);
+
+    void updateDisplayResource(resource_request_t *req);
+    void updateSoundResource(resource_request_t *req);
+    void updateInputResource(resource_request_t *req);
+
+    void updateDisplayResourceRegulation(int state);
+    void updateSoundResourceRegulation(int state);
+    void updateInputResourceRegulation(int state);
+
+private:
+    CicoSCPolicyManager       *m_policyMgr;
+    CicoSCWindowController    *m_winCtrl;
+    CicoSCInputController     *m_inputCtrl;
+
+    // pair zoneid and request
+    map<int, resource_request_t*> m_curDispResReq;
+    map<int, resource_request_t*> m_curSoundResReq;
+    map<int, resource_request_t*> m_curInputResReq;
+
+    map<int, list<resource_request_t*> > m_dispReqQueue;
+    map<int, list<resource_request_t*> > m_soundReqQueue;
+    map<int, list<resource_request_t*> > m_inputReqQueue;
 };
 #endif  // __CICO_SC_RESOURCE_MANAGER_H__
 // vim:set expandtab ts=4 sw=4:
index 6252e56..2ecb395 100644 (file)
@@ -6,17 +6,20 @@
  * http://www.apache.org/licenses/LICENSE-2.0
  *
  */
+
+//==========================================================================
 /**
- * @brief   library to communicate with outer process
+ *  @file   CicoSCServer.cpp
  *
- * @date    Feb-15-2013
+ *  @brief  This file implementation of CicoSCServer class
  */
+//==========================================================================
 
 #include <sstream>
 using namespace std;
 
 #include "CicoSCServer.h"
-#include "CicoSCCommandParser.h"
+#include "CicoSCCommand.h"
 #include "CicoSCMessage.h"
 #include "CicoLog.h"
 #include "ico_syc_error.h"
@@ -27,59 +30,102 @@ using namespace std;
 #include "CicoSCUser.h"
 #include "CicoSCResourceManager.h"
 
-class CicoSCUwsHandle
+class CicoSCUwsHandler
 {
 public:
-    CicoSCUwsHandle()
+    CicoSCUwsHandler()
         : uwsContext(NULL), id(NULL), fd(-1), serviceFlag(false),
           ecoreFdHandler(NULL), appid("") {}
     void dump(void) const {
-        ICO_DBG("uwsContext=%08X fd=%d service=%s ecoreFdHandler=%08X appid=%s",
+        ICO_DBG("uwsContext=0x%08x fd=%d service=%s "
+                "ecoreFdHandler=0x%08x appid=%s",
                 uwsContext, fd, serviceFlag ? "true" : "false",
                 ecoreFdHandler, appid.c_str());
     }
     struct ico_uws_context *uwsContext;
-    void* id;
-    int fd;
-    bool serviceFlag;
+    void*  id;
+    int    fd;
+    bool   serviceFlag;
     Ecore_Fd_Handler *ecoreFdHandler;
     string appid;
 };
 
+//==========================================================================    
+//  private static variable
+//==========================================================================    
 CicoSCServer* CicoSCServer::ms_myInstance = NULL;
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
 CicoSCServer::CicoSCServer()
     : m_uwsContext(NULL), m_windowCtrl(NULL),
-      m_inputCtrl(NULL) , m_userMgr(NULL)
+      m_inputCtrl(NULL) , m_userMgr(NULL), m_resourceMgr(NULL)
 {
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
 CicoSCServer::~CicoSCServer()
 {
+    // TODO
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief   get CicoSCServer instance
+ *
+ *  @return CicoSCServer instance
+ */
+//--------------------------------------------------------------------------
 CicoSCServer*
 CicoSCServer::getInstance(void)
 {
-       if (NULL == ms_myInstance) {
-               ms_myInstance = new CicoSCServer();
-       }
+    if (NULL == ms_myInstance) {
+        ms_myInstance = new CicoSCServer();
+    }
 
-       return ms_myInstance;
+    return ms_myInstance;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief   set window controller instance
+ *
+ *  @param [in] windowCtrl  controller instance
+ */
+//--------------------------------------------------------------------------
 void
 CicoSCServer::setWindowCtrl(CicoSCWindowController *windowCtrl)
 {
     m_windowCtrl = windowCtrl;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief   set input controller instance
+ *
+ *  @param [in] inputCtrl   controller instance
+ */
+//--------------------------------------------------------------------------
 void
 CicoSCServer::setInputCtrl(CicoSCInputController *inputCtrl)
 {
     m_inputCtrl= inputCtrl;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief   set user manager
+ *
+ *  @param [in] userMgr     user manager instance
+ */
+//--------------------------------------------------------------------------
 void
 CicoSCServer::setUserMgr(CicoSCUserManager *userMgr)
 {
@@ -88,13 +134,9 @@ CicoSCServer::setUserMgr(CicoSCUserManager *userMgr)
 
 //--------------------------------------------------------------------------
 /**
- *  @brief   startup server
+ *  @brief   set resource manager instance
  *
- *  @param [IN] port        websocket port
- *  @param [IN] protocol    websocket protocol name
- *  @return result
- *  @retval ICO_SYC_EOK     success
- *  @retval ICO_SYC_ENOSYS  error(connection faile)
+ *  @param [in] resourceMgr resouce manager instance
  */
 //--------------------------------------------------------------------------
 void
@@ -107,11 +149,12 @@ CicoSCServer::setResourceMgr(CicoSCResourceManager *resourceMgr)
 /**
  *  @brief   startup server
  *
- *  @param [IN] port        websocket port
- *  @param [IN] protocol    websocket protocol name
- *  @return result
+ *  @param [in] port        websocket port
+ *  @param [in] protocol    websocket protocol name
+ *
+ *  @return ICO_SYC_EOK on success, other on error
  *  @retval ICO_SYC_EOK     success
- *  @retval ICO_SYC_ENOSYS  error(connection faile)
+ *  @retval ICO_SYC_ENOSYS  error(connection fail)
  */
 //--------------------------------------------------------------------------
 int
@@ -122,7 +165,7 @@ CicoSCServer::startup(int port, const char *protocol)
     uri << ":" << port;
 
     /* create context */
-    ICO_DBG("ico_uws_create_context(%s,%s) called.",
+    ICO_DBG("called: ico_uws_create_context(port=%s protocol=%s)",
             uri.str().c_str(), protocol);
     m_uwsContext = ico_uws_create_context(uri.str().c_str(), protocol);
     if (NULL == m_uwsContext) {
@@ -132,7 +175,8 @@ CicoSCServer::startup(int port, const char *protocol)
     ico_uws_service(m_uwsContext);
 
     /* set callback */
-    int ret = ico_uws_set_event_cb(m_uwsContext, uwsCallback, (void *)this);
+    int ret = ico_uws_set_event_cb(m_uwsContext, uwsReceiveEventCB,
+                                   (void *)this);
     if (ret != ICO_UWS_ERR_NONE) {
         ICO_ERR("ico_uws_set_event_cb() failed(%d).", ret);
         return ICO_SYC_ENOSYS;
@@ -142,157 +186,130 @@ CicoSCServer::startup(int port, const char *protocol)
     return ICO_SYC_EOK;
 }
 
-CicoSCUwsHandle*
-CicoSCServer::findUwsHandler(const struct ico_uws_context *context,
-                             const void *id)
-{
-       list<CicoSCUwsHandle*>::iterator itr;
-       itr = m_uwsHandlerList.begin();
-       for (; itr != m_uwsHandlerList.end(); ++itr) {
-        ICO_DBG("handle->context=%p handle->id=%p context=%p id=%p",
-                (*itr)->uwsContext, (*itr)->id, context, id);
-        if (((*itr)->uwsContext == context) &&
-            ((*itr)->id == id)) {
-            return *itr;
-               }
-    }
-    return NULL;
-}
-
-CicoSCUwsHandle*
-CicoSCServer::findUwsHandler(const Ecore_Fd_Handler *ecoreFdHandler)
-{
-       list<CicoSCUwsHandle*>::iterator itr;
-       itr = m_uwsHandlerList.begin();
-       for (; itr != m_uwsHandlerList.end(); ++itr) {
-        if ((*itr)->ecoreFdHandler == ecoreFdHandler) {
-            return *itr;
-               }
-    }
-    return NULL;
-}
-
-CicoSCUwsHandle*
-CicoSCServer::findUwsHandler(const string & appid)
-{
-       list<CicoSCUwsHandle*>::iterator itr;
-       itr = m_uwsHandlerList.begin();
-       for (; itr != m_uwsHandlerList.end(); ++itr) {
-        ICO_DBG("handle->id=%p handle->appid=%s appid=%s",
-                (*itr)->id, (*itr)->appid.c_str(), appid.c_str());
-        if ((*itr)->appid == appid) {
-            return *itr;
-               }
-    }
-    return NULL;
-}
-
+//--------------------------------------------------------------------------
+/**
+ *  @brief   add poll websocket file destructor
+ *
+ *  @param [in] handler  websocket handler
+ */
+//--------------------------------------------------------------------------
 void
-CicoSCServer::addPollFd(CicoSCUwsHandle *handle)
+CicoSCServer::addPollFd(CicoSCUwsHandler *handler)
 {
-    ICO_DBG("CicoSCServer::addPollFd Enter(fd=%d)", handle->fd);
-    Ecore_Fd_Handler_Flags flags = (Ecore_Fd_Handler_Flags)(ECORE_FD_READ | ECORE_FD_ERROR);
+    ICO_DBG("CicoSCServer::addPollFd Enter(fd=%d)", handler->fd);
+    Ecore_Fd_Handler_Flags flags;
+    flags = (Ecore_Fd_Handler_Flags)(ECORE_FD_READ | ECORE_FD_ERROR);
 
-    handle->ecoreFdHandler = ecore_main_fd_handler_add(handle->fd, flags,
+    handler->ecoreFdHandler = ecore_main_fd_handler_add(handler->fd, flags,
                                                        ecoreFdCallback,
                                                        this, NULL, NULL);
+
+    ICO_DBG("Enqueue uwsHandler(0x%08x)", handler);
+    m_uwsHandlerList.push_back(handler);
+
     ICO_DBG("CicoSCServer::addPollFd Leave");
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief   delete poll websocket file destructor
+ *
+ *  @param [in] handler  websocket handler
+ */
+//--------------------------------------------------------------------------
 void
-CicoSCServer::delPollFd(CicoSCUwsHandle *handle)
+CicoSCServer::delPollFd(CicoSCUwsHandler *handler)
 {
     ICO_DBG("CicoSCServer::delPollFd Enter");
-    ecore_main_fd_handler_del(handle->ecoreFdHandler);
-    handle->ecoreFdHandler = NULL;
-    ICO_DBG("CicoSCServer::delPollFd Enter");
-}
-
-Eina_Bool
-CicoSCServer::ecoreFdCallback(void *data, Ecore_Fd_Handler *handler)
-{
-    ICO_DBG("CicoSCServer::ecoreFdCallback Enter");
-
-    int fdFlags = 0;
-#if 0
-    Eina_Bool flag = ecore_main_fd_handler_active_get(handler, ECORE_FD_READ);
-    if (Eina_True == flag) {
-        fdFlags |= ECORE_FD_READ;
-    }
-
-    Eina_Bool flag = ecore_main_fd_handler_active_get(handler, ECORE_FD_ERROR);
-    if (Eina_True == flag) {
-        fdFlags |= ECORE_FD_ERROR;
-    }
 
-    Eina_Bool flag = ecore_main_fd_handler_active_get(handler, ECORE_FD_WRITE);
-    if (Eina_True == flag) {
-        fdFlags |= ECORE_FD_WRITE;
-    }
-#endif
+    ecore_main_fd_handler_del(handler->ecoreFdHandler);
+    handler->ecoreFdHandler = NULL;
 
-    CicoSCUwsHandle *handle = NULL;
-    handle =  static_cast<CicoSCServer*>(data)->findUwsHandler(handler);
-    if (NULL != handle) {
-        static_cast<CicoSCServer*>(data)->dispatch(handle, fdFlags);
+    list<CicoSCUwsHandler*>::iterator itr;
+    itr = m_uwsHandlerList.begin();
+    for (; itr != m_uwsHandlerList.end(); ++itr) {
+        if (*itr == handler) {
+            ICO_DBG("Dequeue uwsHandler(0x%08x)", *itr);
+            m_uwsHandlerList.erase(itr);
+            break;
+        }
     }
+    delete handler;
 
-    ICO_DBG("CicoSCServer::ecoreFdCallback Leave");
-    return ECORE_CALLBACK_RENEW;
+    ICO_DBG("CicoSCServer::delPollFd Enter");
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief   dispatch receive message process and send message process
+ *
+ *  @param [in] handler  websocket handler
+ *
+ *  @return websocket handler instance on find, NULL on not found
+ */
+//--------------------------------------------------------------------------
 void
-CicoSCServer::dispatch(const CicoSCUwsHandle *handle, int flags)
+CicoSCServer::dispatch(const CicoSCUwsHandler *handler)
 {
-    ICO_DBG("CicoSCServer::dispatch Enter");
+    ICO_DBG("CicoSCServer::dispatch Enter(handler=0x%08x)", handler);
 
-    if (NULL == handle) {
-        ICO_WRN("handle is null");
+    if (NULL == handler) {
+        ICO_WRN("handler is null");
         ICO_DBG("CicoSCServer::dispatch Leave");
         return;
     }
-    handle->dump(); //TODO
 
-    ico_uws_service(handle->uwsContext);
+    ico_uws_service(handler->uwsContext);
+
+    // There is a possibility that after calling ico_uws_service function,
+    // the file is deleted.  Check whether handler not the disabled.
+    if (false == isExistUwsHandler(handler)) {
+        ICO_DBG("CicoSCServer::dispatch Leave");
+        return;
+    }
 
     list<CicoSCCommand*>::iterator itr;
     itr = m_recvCmdQueue.begin();
     while(itr != m_recvCmdQueue.end()) {
-        ICO_DBG("Deque command(0x%08X)", (*itr)->cmdid);
+        ICO_DBG("Dequeue command(0x%08x)", (*itr)->cmdid);
         CicoSCCommand *cmd = *itr;
         itr = m_recvCmdQueue.erase(itr);
         switch (cmd->cmdid & MSG_CMD_TYPE_MASK) {
         case MSG_CMD_TYPE_WINCTRL:
-            ICO_DBG("command : MSG_CMD_TYPE_WINCTRL");
+            //ICO_DBG("command : MSG_CMD_TYPE_WINCTRL");
             m_windowCtrl->handleCommand(cmd);
             break;
         case MSG_CMD_TYPE_INPUTCTRL:
-            ICO_DBG("command : MSG_CMD_TYPE_INPUTCTRL");
+            //ICO_DBG("command : MSG_CMD_TYPE_INPUTCTRL");
             m_inputCtrl->handleCommand(cmd);
             break;
         case MSG_CMD_TYPE_USERMGR:
-            ICO_DBG("command : MSG_CMD_TYPE_USERMGR");
+            //ICO_DBG("command : MSG_CMD_TYPE_USERMGR");
             m_userMgr->handleCommand(cmd);
             break;
         case MSG_CMD_TYPE_RESOURCEMGR:
-            ICO_DBG("command : MSG_CMD_TYPE_RESOURCEMGR");
+            //ICO_DBG("command : MSG_CMD_TYPE_RESOURCEMGR");
             m_resourceMgr->handleCommand(*cmd);
             break;
+        case MSG_CMD_TYPE_INPUTDEVSETTING:
+            //ICO_DBG("command : MSG_CMD_TYPE_INPUTDEVSETTING");
+            m_inputCtrl->handleCommand(cmd);
+            break;
         default:
-            ICO_DBG("command : unknown");
+            ICO_WRN("command: Unknown type");
             break;
         }
         delete cmd;
     }
 
-    if (NULL == handle->ecoreFdHandler) {
+    if (NULL == handler->ecoreFdHandler) {
         ICO_ERR("ecoreFdHandler is null");
         ICO_DBG("CicoSCServer::dispatch Leave");
         return;
     }
 
-    Eina_Bool flag = ecore_main_fd_handler_active_get(handle->ecoreFdHandler,
-                                                                                                     ECORE_FD_WRITE);
+    Eina_Bool flag = ecore_main_fd_handler_active_get(handler->ecoreFdHandler,
+                                                      ECORE_FD_WRITE);
     if (EINA_TRUE == flag) {
         ICO_DBG("start send message");
         list<CicoSCMessage*>::iterator send_itr;
@@ -300,19 +317,19 @@ CicoSCServer::dispatch(const CicoSCUwsHandle *handle, int flags)
         while (send_itr != m_sendMsgQueue.end()) {
             ICO_DBG("m_sendMsgQueue.size=%d", m_sendMsgQueue.size());
             CicoSCMessage* msg = *send_itr;
-            CicoSCUwsHandle *sendHandle = findUwsHandler(msg->getSendToAppid());
-            if (handle != sendHandle) {
+            CicoSCUwsHandler *sendHandler = findUwsHandler(msg->getSendToAppid());
+            if (handler != sendHandler) {
                 ++send_itr;
                 continue;
             }
             send_itr = m_sendMsgQueue.erase(send_itr);
-            ICO_DBG("Deque Message(id=%d)", msg->getId());
-            if ((NULL != sendHandle) && (true == sendHandle->serviceFlag)) {
-                sendHandle->dump();
-                ICO_DBG("<<<SEND id=%08X msg=%s",
-                        sendHandle->id, msg->getData());
-                ICO_DBG("ico_usw_send called.");
-                ico_uws_send(sendHandle->uwsContext, sendHandle->id,
+            ICO_DBG("Dequeue Message(id=%d)", msg->getId());
+            if ((NULL != sendHandler) && (true == sendHandler->serviceFlag)) {
+                ICO_DBG("<<<SEND appid=%s id=0x%08x msg=%s",
+                        sendHandler->appid.c_str(), sendHandler->id, msg->getData());
+                ICO_DBG("called: ico_usw_send called(context=0x%08x id=0x%08x)",
+                        sendHandler->uwsContext, sendHandler->id);
+                ico_uws_send(sendHandler->uwsContext, sendHandler->id,
                              (unsigned char *)msg->getData(),
                              strlen(msg->getData()));
 
@@ -321,13 +338,26 @@ CicoSCServer::dispatch(const CicoSCUwsHandle *handle, int flags)
                 usleep(200);
             }
         }
-        ecore_main_fd_handler_active_set(handle->ecoreFdHandler,
-            (Ecore_Fd_Handler_Flags)(ECORE_FD_READ | ECORE_FD_ERROR));
+
+        Ecore_Fd_Handler_Flags flags;;
+        flags = (Ecore_Fd_Handler_Flags)(ECORE_FD_READ | ECORE_FD_ERROR);
+
+        ecore_main_fd_handler_active_set(handler->ecoreFdHandler, flags);
     }
 
     ICO_DBG("CicoSCServer::dispatch Leave");
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief   send message to application client
+ *
+ *  @param [in] appid   application id of destination
+ *  @param [in] msg     message
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ */
+//--------------------------------------------------------------------------
 int
 CicoSCServer::sendMessage(const string & appid, CicoSCMessage* msg)
 {
@@ -335,142 +365,282 @@ CicoSCServer::sendMessage(const string & appid, CicoSCMessage* msg)
             appid.c_str(), msg->getData());
 
     msg->setSendToAppid(appid);
-    ICO_DBG("Enque Message(id=%d)", msg->getId());
+    ICO_DBG("Enqueue Message(id=%d)", msg->getId());
     m_sendMsgQueue.push_back(msg);
 
-    CicoSCUwsHandle *handle = findUwsHandler(appid);
-    if (NULL != handle) {
-               ecore_main_fd_handler_active_set(handle->ecoreFdHandler,
-                       (Ecore_Fd_Handler_Flags)(ECORE_FD_READ |
-                                                                    ECORE_FD_WRITE |
-                                                                        ECORE_FD_ERROR));
-               dispatch(handle, 0);
+    CicoSCUwsHandler *handler = findUwsHandler(appid);
+    if (NULL != handler) {
+        Ecore_Fd_Handler_Flags flags;
+        flags = (Ecore_Fd_Handler_Flags)(ECORE_FD_READ  |
+                                         ECORE_FD_WRITE |
+                                         ECORE_FD_ERROR);
+
+        ecore_main_fd_handler_active_set(handler->ecoreFdHandler, flags);
+
+        dispatch(handler);
     }
 
     ICO_DBG("CicoSCServer::sendMessage Leave(EOK)");
     return ICO_SYC_EOK;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief   send message to homescreen
+ *
+ *  @param [in] msg     message
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ */
+//--------------------------------------------------------------------------
 int
 CicoSCServer::sendMessageToHomeScreen(CicoSCMessage* msg)
 {
     const CicoSCUser *loginUser = m_userMgr->getLoginUser();
     if (NULL == loginUser) {
-        ICO_WRN("homescree unknow");
+        ICO_WRN("homescreen unknown");
         return ICO_SYC_ENOENT;
     }
     return sendMessage(loginUser->homescreen, msg);
 }
 
+//--------------------------------------------------------------------------
+/*
+ *  @brief  websocket utility callback function
+ *
+ *  @param [in] context     context
+ *  @param [in] event       event kinds
+ *  @param [in] id          client id
+ *  @param [in] detail      event detail
+ *  @param [in] data        user data
+ */
+//--------------------------------------------------------------------------
 void
-CicoSCServer::uwsCallbackImpl(const struct ico_uws_context *context,
-                              const ico_uws_evt_e event,
-                              const void *id,
-                              const ico_uws_detail *detail,
-                              void *user_data)
+CicoSCServer::uwsReceiveEventCB(const struct ico_uws_context *context,
+                                const ico_uws_evt_e event,
+                                const void *id,
+                                const ico_uws_detail *detail,
+                                void *user_data)
 {
-    ICO_DBG("CicoSCServer::uwsCallbackImpl Enter");
-
-    // find hanle
-    CicoSCUwsHandle *handle = findUwsHandler(context, id);
-    // If not found handle, create new handle
-    if (NULL == handle) {
-        handle = new CicoSCUwsHandle();
-        m_uwsHandlerList.push_back(handle);
-        handle->uwsContext = (struct ico_uws_context*)context;
-        handle->id = (void*)(id);
-        handle->serviceFlag = false;
+    if (NULL == user_data) {
+        ICO_ERR("user_data is NULL");
+        return;
+    }
+
+    CicoSCServer* server = static_cast<CicoSCServer*>(user_data);
+    server->receiveEventCB(context, event, id, detail, user_data);
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   ecore file destructor callback fucntion
+ *
+ *  @param [in] data        user data
+ *  @param [in] handler     ecore file destructor handler
+ *
+ *  @return ECORE_CALLBACK_RENEW on retry , ECORE_CALLBACK_CANCEL on cancel
+ */
+//--------------------------------------------------------------------------
+Eina_Bool
+CicoSCServer::ecoreFdCallback(void *data, Ecore_Fd_Handler *ecoreFdhandler)
+{
+    ICO_DBG("CicoSCServer::ecoreFdCallback Enter");
+
+    CicoSCUwsHandler *handler = NULL;
+    handler =  static_cast<CicoSCServer*>(data)->findUwsHandler(ecoreFdhandler);
+    if (NULL != handler) {
+        static_cast<CicoSCServer*>(data)->dispatch(handler);
+    }
+
+    ICO_DBG("CicoSCServer::ecoreFdCallback Leave");
+    return ECORE_CALLBACK_RENEW;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   websocket callback function
+ *
+ *  @param [in] context     websocket context
+ *  @param [in] event       changed event
+ *  @param [in] id          source applicatin id
+ *  @param [in] detail      event detail information
+ *  @param [in] user_data   user data
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCServer::receiveEventCB(const struct ico_uws_context *context,
+                             const ico_uws_evt_e          event,
+                             const void                   *id,
+                             const ico_uws_detail         *detail,
+                             void                         *user_data)
+{
+    ICO_DBG("CicoSCServer::receiveEventCB Enter");
+
+    // find handler
+    CicoSCUwsHandler *handler = findUwsHandler(context, id);
+    // If not found handler, create new handler
+    if (NULL == handler) {
+        handler = new CicoSCUwsHandler();
+        handler->uwsContext = (struct ico_uws_context*)context;
+        handler->id = (void*)(id);
+        handler->serviceFlag = false;
     }
 
     switch (event) {
     case ICO_UWS_EVT_OPEN:
-    {
-        ICO_DBG(">>>RECV ICO_UWS_EVT_OPEN(id=%08x)", (int)id); 
+        ICO_DBG(">>>RECV ICO_UWS_EVT_OPEN(id=0x%08x)", (int)id); 
         break;
-    }
     case ICO_UWS_EVT_CLOSE:
-        ICO_DBG(">>>RECV ICO_UWS_EVT_CLOSE(id=%08x)", (int)id);
-        m_uwsContext = NULL;
+        ICO_DBG(">>>RECV ICO_UWS_EVT_CLOSE(id=0x%08x)", (int)id);
         break;
     case ICO_UWS_EVT_RECEIVE:
-       {
-        ICO_DBG(">>>RECV ICO_UWS_EVT_RECEIVE(id=%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);
 
         // convert message to command
         CicoSCCommand *cmd = new CicoSCCommand();
-        CicoSCCommandParser cmdParser;
-        cmdParser.parse((const char*)detail->_ico_uws_message.recv_data, *cmd);
+        cmd->parseMessage((const char*)detail->_ico_uws_message.recv_data);
 
-        // update handle appid
+        // update handler appid
         if (cmd->cmdid == MSG_CMD_SEND_APPID) {
             if (0 == cmd->appid.length()) {
                 ICO_WRN("command argument invalid appid null");
                 break;
             }
-            handle->appid = cmd->appid;
-            handle->serviceFlag = true;
-            ICO_DBG("handle.appid=%s", handle->appid.c_str());
-    ecore_main_fd_handler_active_set(handle->ecoreFdHandler,
-                                     (Ecore_Fd_Handler_Flags)(ECORE_FD_READ |
-                                     ECORE_FD_WRITE |
-                                     ECORE_FD_ERROR));
+            handler->appid = cmd->appid;
+            handler->serviceFlag = true;
+            ICO_DBG("handler.appid=%s", handler->appid.c_str());
+
+            Ecore_Fd_Handler_Flags flags;
+            flags = (Ecore_Fd_Handler_Flags)(ECORE_FD_READ  |
+                                             ECORE_FD_WRITE |
+                                             ECORE_FD_ERROR);
+
+            ecore_main_fd_handler_active_set(handler->ecoreFdHandler, flags);
 
             break;
         }
         
         // Enqueue command
-        ICO_DBG("Enque command(0x%08X)", cmd->cmdid);
+        ICO_DBG("Enqueue command(0x%08x)", cmd->cmdid);
         m_recvCmdQueue.push_back(cmd);
         break;
-       }
+    }
     case ICO_UWS_EVT_ERROR:
-        ICO_DBG(">>>RECV ICO_UWS_EVT_ERROR(id=%08x, err=%d)", 
+        ICO_DBG(">>>RECV ICO_UWS_EVT_ERROR(id=0x%08x, err=%d)", 
                 (int)id, detail->_ico_uws_error.code);
         break;
     case ICO_UWS_EVT_ADD_FD:
-        ICO_DBG(">>>RECV ICO_UWS_EVT_ADD_FD(id=%08x, fd=%d)",
+        ICO_DBG(">>>RECV ICO_UWS_EVT_ADD_FD(id=0x%08x, fd=%d)",
                     (int)id, detail->_ico_uws_fd.fd);
-        handle->fd = detail->_ico_uws_fd.fd;
-        addPollFd(handle);
-
+        handler->fd = detail->_ico_uws_fd.fd;
+        addPollFd(handler);
         break;
     case ICO_UWS_EVT_DEL_FD:
-        ICO_DBG(">>>RECV ICO_UWS_EVT_DEL_FD(id=%d, fd=%d)",
+        ICO_DBG(">>>RECV ICO_UWS_EVT_DEL_FD(id=0x%08x, fd=%d)",
                     (int)id, detail->_ico_uws_fd.fd);
-        delPollFd(handle);
-               delete handle;
+        delPollFd(handler);
         break;
     default:
         break;
     }
-    ICO_DBG("CicoSCServer::uwsCallbackImpl Leave");
+    ICO_DBG("CicoSCServer::receiveEventCB Leave");
 }
 
-/*--------------------------------------------------------------------------*/
-/*
- * @brief   callback_uws
- *          callback function from UWS
+//--------------------------------------------------------------------------
+/**
+ *  @brief   find websocket handler by context and id
+ *
+ *  @param [in] context     websocket context
+ *  @param [in] id          id
  *
- * @param[in]   context             context * @param[in]   event               event kinds
- * @param[in]   id                  client id
- * @param[in]   detail              event detail
- * @param[in]   data                user data
- * @return      none
+ *  @return websocket handler instance on find, NULL on not found
  */
-/*--------------------------------------------------------------------------*/
-void
-CicoSCServer::uwsCallback(const struct ico_uws_context *context,
-                           const ico_uws_evt_e event,
-                           const void *id,
-                           const ico_uws_detail *detail,
-                           void *user_data)
+//--------------------------------------------------------------------------
+CicoSCUwsHandler*
+CicoSCServer::findUwsHandler(const struct ico_uws_context *context,
+                             const void                   *id)
+{
+    list<CicoSCUwsHandler*>::iterator itr;
+    itr = m_uwsHandlerList.begin();
+    for (; itr != m_uwsHandlerList.end(); ++itr) {
+        ICO_DBG("handler->context=%p handler->id=%p context=%p id=%p",
+                (*itr)->uwsContext, (*itr)->id, context, id);
+        if (((*itr)->uwsContext == context) &&
+            ((*itr)->id == id)) {
+            return *itr;
+        }
+    }
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   find websocket handler by ecore file destructor handler
+ *
+ *  @param [in] ecoreFdHandler  ecore file destructor handler
+ *
+ *  @return websocket handler instance on find, NULL on not found
+ */
+//--------------------------------------------------------------------------
+CicoSCUwsHandler*
+CicoSCServer::findUwsHandler(const Ecore_Fd_Handler *ecoreFdHandler)
+{
+    list<CicoSCUwsHandler*>::iterator itr;
+    itr = m_uwsHandlerList.begin();
+    for (; itr != m_uwsHandlerList.end(); ++itr) {
+        if ((*itr)->ecoreFdHandler == ecoreFdHandler) {
+            return *itr;
+        }
+    }
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   find websocket handler by appid
+ *
+ *  @param [in] addid   application id
+ *
+ *  @return websocket handler instance on find, NULL on not found
+ */
+//--------------------------------------------------------------------------
+CicoSCUwsHandler*
+CicoSCServer::findUwsHandler(const string & appid)
 {
-    ICO_DBG("callback_uws: context=%08x id=%08x", (int)context, (int)id);
+    list<CicoSCUwsHandler*>::iterator itr;
+    itr = m_uwsHandlerList.begin();
+    for (; itr != m_uwsHandlerList.end(); ++itr) {
+        ICO_DBG("handler->id=%p handler->appid=%s appid=%s",
+                (*itr)->id, (*itr)->appid.c_str(), appid.c_str());
+        if ((*itr)->appid == appid) {
+            return *itr;
+        }
+    }
+    return NULL;
+}
 
-       CicoSCServer* server = static_cast<CicoSCServer*>(user_data);
-    server->uwsCallbackImpl(context, event, id, detail, user_data);
+//--------------------------------------------------------------------------
+/**
+ *  @brief   find websocket handler by appid
+ *
+ *  @param [in] handler     websocket handler instance
+ *
+ *  @return true on exist, false on not exist
+ */
+//--------------------------------------------------------------------------
+bool
+CicoSCServer::isExistUwsHandler(const CicoSCUwsHandler *handler)
+{   
+    list<CicoSCUwsHandler*>::iterator itr;
+    itr = m_uwsHandlerList.begin();
+    for (; itr != m_uwsHandlerList.end(); ++itr) {
+        if (*itr == handler) {
+            return true;
+        }
+    }
+    return false;
 }
 // vim:set expandtab ts=4 sw=4:
index cbbe2ca..729c74d 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCServer.h
  *
- *  @brief 
+ *  @brief  This file is definition of CicoSCServer class
  */
 //==========================================================================
 #ifndef __CICO_SC_SERVER_H__
@@ -39,7 +39,7 @@ using namespace std;
 //==========================================================================
 //  forward declaration
 //==========================================================================
-class CicoSCUwsHandle;
+class CicoSCUwsHandler;
 class CicoSCMessage;
 class CicoSCCommand;
 class CicoSCWindowController;
@@ -49,64 +49,102 @@ class CicoSCResourceManager;
 
 //==========================================================================
 /**
- *  @brief  communication server
+ *  @brief  This class has function of interprocess message server
  */
 //==========================================================================
 class CicoSCServer
 {
 public:
+    // get CicoSCServer instance
     static CicoSCServer* getInstance();
 
+    // set window controller instance
     void setWindowCtrl(CicoSCWindowController* windowCtrl);
+
+    // set input controller instance
     void setInputCtrl(CicoSCInputController* inputCtrl);
+
+    // set input controller instance
     void setUserMgr(CicoSCUserManager* userMgr);
+
+    // set resource manager instance
     void setResourceMgr(CicoSCResourceManager* resourceMgr);
 
-       int startup(int port, const char *protocol);
+    // startup server
+    int startup(int port, const char *protocol);
 
-    void addPollFd(CicoSCUwsHandle *handle);
-    void delPollFd(CicoSCUwsHandle *handle);
-    void dispatch(const CicoSCUwsHandle *handle, int flags);
+    // send message to application client
     int sendMessage(const string & appid, CicoSCMessage* msg);
-    int sendMessageToHomeScreen(CicoSCMessage* msg);
 
-    void uwsCallbackImpl(const struct ico_uws_context *context,
-                         const ico_uws_evt_e event,
-                         const void *id,
-                         const ico_uws_detail *detail,
-                         void *user_data);
+    // send message to homescreen
+    int sendMessageToHomeScreen(CicoSCMessage* msg);
 
+    // websocket callback function
+    void receiveEventCB(const struct ico_uws_context *context,
+                        const ico_uws_evt_e          event,
+                        const void                   *id,
+                        const ico_uws_detail         *detail,
+                        void                         *user_data);
 
 private:
+    // default constructor
     CicoSCServer();
+
+    // destructor
     ~CicoSCServer();
-    static void uwsCallback(const struct ico_uws_context *context,
-                            const ico_uws_evt_e event,
-                            const void *id,
-                            const ico_uws_detail *detail,
-                            void *user_data);
 
+    // assignment operator
+    CicoSCServer& operator=(const CicoSCServer &object);
+
+    // copy constructor
+    CicoSCServer(const CicoSCServer &object);
+
+    // websocket utility callback function
+    static void uwsReceiveEventCB(const struct ico_uws_context *context,
+                                  const ico_uws_evt_e event,
+                                  const void *id,
+                                  const ico_uws_detail *detail,
+                                  void *user_data);
+
+    // ecore file destructor callback fucntion
     static Eina_Bool ecoreFdCallback(void *data,
                                           Ecore_Fd_Handler *handler);
 
-    CicoSCUwsHandle* findUwsHandler(const struct ico_uws_context *context,
-                                    const void *id);
-    CicoSCUwsHandle* findUwsHandler(const Ecore_Fd_Handler *ecoreFdHandler);
-    CicoSCUwsHandle* findUwsHandler(const string & appid);
+    // add poll websocket file destructor
+    void addPollFd(CicoSCUwsHandler *handler);
+
+    // delete poll websocket file destructor
+    void delPollFd(CicoSCUwsHandler *handler);
+
+    // dispatch receive message process and send message process
+    void dispatch(const CicoSCUwsHandler *handler);
+
+    // find websocket handle by context and id
+    CicoSCUwsHandler* findUwsHandler(const struct ico_uws_context *context,
+                                     const void *id);
+
+    // find websocket handle by ecore file destructor handler
+    CicoSCUwsHandler* findUwsHandler(const Ecore_Fd_Handler *ecoreFdHandler);
+
+    // find websocket handle by appid
+    CicoSCUwsHandler* findUwsHandler(const string & appid);
+
+    // query whether the handler exists
+    bool isExistUwsHandler(const CicoSCUwsHandler *handler);
+
 private:
-    static CicoSCServer* ms_myInstance;
+    static CicoSCServer*    ms_myInstance;   ///< this class instance
 
-    struct ico_uws_context *m_uwsContext; // TODO init
+    struct ico_uws_context  *m_uwsContext;   ///< websocket utility context
 
-    CicoSCWindowController *m_windowCtrl;
-    CicoSCInputController  *m_inputCtrl;
-    CicoSCUserManager      *m_userMgr;
-    CicoSCResourceManager  *m_resourceMgr;
+    CicoSCWindowController  *m_windowCtrl;   ///< window controller instance
+    CicoSCInputController   *m_inputCtrl;    ///< input controller instance
+    CicoSCUserManager       *m_userMgr;      ///< user manager instance
+    CicoSCResourceManager   *m_resourceMgr;  ///< resource manager instance
 
-    list<CicoSCUwsHandle*> m_uwsHandlerList;
-    list<CicoSCMessage*>   m_sendMsgQueue;
-    list<CicoSCCommand*>   m_recvCmdQueue;
+    list<CicoSCUwsHandler*> m_uwsHandlerList;///< websocket handler list
+    list<CicoSCMessage*>    m_sendMsgQueue;  ///< send message queue
+    list<CicoSCCommand*>    m_recvCmdQueue;  ///< recieve message queue
 };
 #endif  // __CICO_SC_SERVER_H__
 // vim:set expandtab ts=4 sw=4:
index f9c8888..343c81c 100644 (file)
 /**
  *  @file   CicoSCSwitch.cpp
  *
- *  @brief  
+ *  @brief  This file implementation of CicoSCSwitch class
  */
 //==========================================================================
 
+#include <vector>
+#include <string>
+using namespace std;
+
 #include "CicoSCSwitch.h"
 #include "CicoLog.h"
 
-// default constructor
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
 CicoSCSwitch::CicoSCSwitch()
     : swname(""), input(-1), fix(false)
 {
 }
 
-// destructor
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
 CicoSCSwitch::~CicoSCSwitch()
 {
 }
 
-// dump log CicoSCSwitch member variables
+//--------------------------------------------------------------------------
+/**
+ *  @brief  dump log this class member variables
+ */
+//--------------------------------------------------------------------------
 void
 CicoSCSwitch::dump(void)
 {
index d0c9221..10ea08e 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCSwitch.h
  *
- *  @brief  
+ *  @brief  This file is definition of CicoSCSwitch class
  */
 //==========================================================================
 #ifndef __CICO_SC_SWITCH_H__
 
 #include <vector>
 #include <string>
-using namespace std;
 
 //==========================================================================
 /**
- *  @brief  input device switch information
+ *  @brief  This class hold input device switch information
  */
 //==========================================================================
 class CicoSCSwitch
@@ -46,14 +45,14 @@ private:
     CicoSCSwitch(const CicoSCSwitch &object);
 
 public:
-    static const int SWITCH_NOFIX = 0;
-    static const int SWITCH_FIX   = 1;
+    static const int          SWITCH_NOFIX    = 0;
+    static const int          SWITCH_FIX      = 1;
     static const unsigned int SWITCH_CODE_MAX = 8;
-    string swname;              //!< input switch name
-    int    input;               //!< input switch number
-    bool   fix;                 //!< fixed application switch
-    vector<int>    code;        //!< input switch code value
-    vector<string> codename;    //!< input switch code name
+    std::string swname; //!< input switch name
+    int         input;  //!< input switch number
+    bool        fix;    //!< fixed application switch
+    std::vector<int>    code;       //!< input switch code value
+    std::vector<string> codename;   //!< input switch code name
 };
-#endif // __CICO_SC_SWITCH_H__
+#endif  // __CICO_SC_SWITCH_H__
 // vim:set expandtab ts=4 sw=4:
index a7f6dce..17e02a1 100644 (file)
@@ -64,7 +64,7 @@ static Eina_Bool ico_SCResourceWatch(void *data)
 
 
 /**
- * @brief constractor
+ * @brief constructor
  */
 CicoSCSysResourceController::CicoSCSysResourceController()
 {
@@ -80,6 +80,10 @@ CicoSCSysResourceController::CicoSCSysResourceController()
             g_samplingWaitTimer = m_rConf->m_sampling;
         }
     }
+    if (false == m_rConf->m_bDoIt) {
+        ICO_TRA("end");
+        return ;
+    }
     // cpu,cpuacct cgroup init
     init_cgroup();  // cgroup 
     m_monitor = new CicoSCSysResourceMonitor();
@@ -197,9 +201,9 @@ bool CicoSCSysResourceController::watch()
     int cpu = m_monitor->getCPUuser(); // application cpu
     if (-1 != cpu) {
         cpu /= 100;
-        if (g_RC_LOG) ICO_TRA("cpu %d -> %d", m_cpu, cpu);
         CicoEvent ev(gEV1000, cpu);
-        m_stt->eventEntry(ev);
+        bool b = m_stt->eventEntry(ev);
+        if (g_RC_LOG) ICO_TRA("cpu %c, %d->%d", b? 't': 'f', m_cpu, cpu);
         m_cpu = cpu;
         r = true;
     }
@@ -221,8 +225,7 @@ bool CicoSCSysResourceController::watch()
  */
 void CicoSCSysResourceController::resourceControlCPUShares(bool bHight)
 {
-    ICO_TRA("start %s",
-            bHight? "true": "false");
+    ICO_TRA("start %s", bHight? "true": "false");
     if ((NULL == m_rConf) || (false == m_rConf->m_bDoIt)) {
         ICO_TRA("end");
         return;
@@ -322,7 +325,7 @@ void CicoSCSysResourceController::resourceControlMemLimit(bool bHight)
 
 
 /**
- * @breif
+ * @brief
  *
  */
 bool CicoSCSysResourceController::entryCgroupCPU(int pid, int grpNo)
@@ -362,7 +365,7 @@ bool CicoSCSysResourceController::entryCgroupCPU(int pid, int grpNo)
 }
 
 /**
- * @breif initialize cgroup 
+ * @brief initialize cgroup
  */
 void CicoSCSysResourceController::init_cgroup()
 {
@@ -374,12 +377,12 @@ void CicoSCSysResourceController::init_cgroup()
 }
 
 /**
- * @breif initialize cgroup cpu
+ * @brief initialize cgroup cpu
  */
 void CicoSCSysResourceController::init_cgroup_cpu()
 {
     ICO_TRA("start");
-    if (NULL == m_rConf) {
+    if ((NULL == m_rConf) || (false == m_rConf->m_bDoIt)) {
         ICO_TRA("end");
         return;
     }
@@ -423,12 +426,12 @@ void CicoSCSysResourceController::init_cgroup_cpu()
 }
 
 /**
- * @breif initialize cgroup memory
+ * @brief initialize cgroup memory
  */
 void CicoSCSysResourceController::init_cgroup_memory()
 {
     ICO_TRA("start");
-    if (NULL == m_rConf) {
+    if ((NULL == m_rConf) || (false == m_rConf->m_bDoIt)) {
         ICO_TRA("end error config class");
         return;
     }
@@ -438,7 +441,7 @@ void CicoSCSysResourceController::init_cgroup_memory()
 }
 
 /**
- * @breif make directory
+ * @brief make directory
  * @param d create directory target
  */
 void CicoSCSysResourceController::make_directorys(std::vector<std::string> dir)
@@ -471,6 +474,8 @@ CicoSRCCPU_LOW::CicoSRCCPU_LOW(CicoSCSysResourceController* obj):
     ICO_TRA("constructor");
     m_val = -1;      // cpu or memory usage value
     m_baseVal = -1;  // cpu or memory base usage value
+    m_cnt = 0;
+    m_rConf = CicoSCSystemConfig::getInstance()->getResourceConf();
 }
 
 /**
@@ -488,12 +493,15 @@ CicoSRCCPU_LOW::~CicoSRCCPU_LOW()
  * @param ev event data
  * @param stt state object
  */
-void CicoSRCCPU_LOW::onEnttry(const CicoEvent& ev, const CicoState* stt, int)
+void CicoSRCCPU_LOW::onEntry(const CicoEvent& ev, const CicoState* stt, int)
 {
-    ICO_TRA("start %s,%d,%d", stt->getName().c_str(),
-            ev.getEV(),ev.getGCVi());
-    m_baseVal = ev.getGCVi();
+    int v1 = ev.getEV();
+    int v2 = ev.getGCVi();
+    if (g_RC_LOG) ICO_TRA("start %s,%d,%d CicoSRCCPU_LOW::", stt->getName().c_str(), v1, v2);
+    m_baseVal = v2;
     m_val = m_baseVal;
+    m_cnt = m_rConf->m_retryCnt;
+    if (g_RC_LOG) ICO_TRA("end cnt(%d) CicoSRCCPU_LOW::", m_cnt);
 }
 
 /**
@@ -504,21 +512,37 @@ void CicoSRCCPU_LOW::onEnttry(const CicoEvent& ev, const CicoState* stt, int)
 void CicoSRCCPU_LOW::onDo(const CicoEvent& ev, const CicoState* stt, int)
 {
     int valN = ev.getGCVi();
-    ICO_TRA("start o(%d), n(%d)", m_val, valN);
-    if (valN >= m_val) {
+    if (g_RC_LOG) ICO_TRA("start o(%d), n(%d)CicoSRCCPU_LOW::", m_val, valN);
+#if 0
+    if (valN > m_val) {
         // When the value is greater than the previous
-        ICO_TRA("end n(%d) >= o(%d)", m_val, valN);
+        if (g_RC_LOG) ICO_TRA("end n(%d)->o(%d) CicoSRCCPU_LOW::", m_val, valN);
         return;
     }
     // When the value is less than the previous
     int t = ((double)valN / (double)m_baseVal)*100;
     if (50 <= t) {
         m_cntlr->resourceControlCPUShares(false);
-        ICO_DBG("BASE CHG %d->%d",m_baseVal, valN);
+        if (g_RC_LOG) ICO_DBG("CHG %d->%d CicoSRCCPU_LOW::",m_baseVal, valN);
         m_baseVal = valN;
     }
+#else
+    if (valN < m_rConf->m_lowLimitVal) {
+        m_cnt--;
+        if (0 >= m_cnt) {
+            m_cntlr->resourceControlCPUShares(false);
+            if (g_RC_LOG) ICO_DBG("CHG %d->%d CicoSRCCPU_LOW::",m_baseVal, valN);
+            m_cnt = m_rConf->m_retryCnt;
+            m_baseVal = valN;
+        }
+    }
+    else {
+        if (g_RC_LOG) ICO_DBG("cnt rst V(%d) CicoSRCCPU_LOW::", valN);
+        m_cnt = m_rConf->m_retryCnt;
+    }
+#endif
     m_val = valN;
-    ICO_TRA("end");
+    if (g_RC_LOG) ICO_TRA("end CicoSRCCPU_LOW::");
 }
 
 
@@ -529,10 +553,10 @@ void CicoSRCCPU_LOW::onDo(const CicoEvent& ev, const CicoState* stt, int)
  */
 void CicoSRCCPU_LOW::onExit(const CicoEvent&, const CicoState*, int)
 {
-    ICO_TRA("start");
+    if (g_RC_LOG) ICO_TRA("start CicoSRCCPU_LOW::");
     m_baseVal = -1;
     m_val = -1;
-    ICO_TRA("end");
+    if (g_RC_LOG) ICO_TRA("end CicoSRCCPU_LOW::");
 }
 
 /**
@@ -562,21 +586,38 @@ CicoSRCCPU_HIGH::~CicoSRCCPU_HIGH()
 void CicoSRCCPU_HIGH::onDo(const CicoEvent& ev, const CicoState* stt, int)
 {
     int valN = ev.getGCVi();
-    ICO_TRA("start o(%d), n(%d)", m_val, valN);
+    if (g_RC_LOG) ICO_TRA("start o(%d), n(%d) CicoSRCCPU_HIGH::", m_val, valN);
+#if 0
     if (valN <= m_val) {
         // When the value is less than the previous
-        ICO_TRA("end n(%d)<=o(%d)", valN, m_val);
+        if (g_RC_LOG) ICO_TRA("n(%d)<=o(%d) CicoSRCCPU_HIGH::", valN, m_val);
         return;
     }
     // When the value is greater than the previous
     int t = ((double)(100-valN) / (double)(100-m_baseVal))*100;
     if (50 <= t) {
         m_cntlr->resourceControlCPUShares(true);
-        ICO_DBG("BASE CHG %d -> %d", m_baseVal, valN);
+        if (g_RC_LOG) ICO_DBG("%d->%d CicoSRCCPU_HIGH::", m_baseVal, valN);
         m_baseVal = valN;
     }
+#else
+    if (valN > m_rConf->m_highLimitVal) {
+        m_cnt--;
+        if (g_RC_LOG) ICO_DBG("cnt(%d) CicoSRCCPU_HIGH::", m_cnt);
+        if (0 >= m_cnt) {
+            m_cntlr->resourceControlCPUShares(true);
+            if (g_RC_LOG) ICO_DBG("CicoSRCCPU_HIGH:: %d->%d",m_baseVal, valN);
+            m_cnt = m_rConf->m_retryCnt;
+            m_baseVal = valN;
+        }
+    }
+    else {
+        if (g_RC_LOG) ICO_DBG("CicoSRCCPU_HIGH:: (%d)", valN);
+        m_cnt = m_rConf->m_retryCnt;
+    }
+#endif
     m_val = valN;
-    ICO_TRA("end");
+    if (g_RC_LOG) ICO_TRA("end CicoSRCCPU_HIGH::");
 }
 
 /**
@@ -586,7 +627,7 @@ void CicoSRCCPU_HIGH::onDo(const CicoEvent& ev, const CicoState* stt, int)
 CicoSRCMEM_LOW::CicoSRCMEM_LOW(CicoSCSysResourceController* obj):
         CicoSRCCPU_LOW(obj)
 {
-    ICO_TRA("constructor");
+    ICO_TRA("constructor CicoSRCMEM_LOW::");
 }
 
 /**
@@ -595,7 +636,7 @@ CicoSRCMEM_LOW::CicoSRCMEM_LOW(CicoSCSysResourceController* obj):
  */
 CicoSRCMEM_LOW::~CicoSRCMEM_LOW()
 {
-    ICO_TRA("destructor");
+    ICO_TRA("destructor CicoSRCMEM_LOW::");
 }
 
 /**
@@ -606,21 +647,21 @@ CicoSRCMEM_LOW::~CicoSRCMEM_LOW()
 void CicoSRCMEM_LOW::onDo(const CicoEvent& ev, const CicoState* stt, int)
 {
     int valN = ev.getGCVi();
-    ICO_TRA("start o(%d), n(%d)", m_val, valN);
+    if (g_RC_LOG) ICO_TRA("start o(%d), n(%d)", m_val, valN);
     if (valN >= m_val) {
         // When the value is greater than the previous
-        ICO_TRA("n(%d)>=o(%d)", valN, m_val);
+        if (g_RC_LOG) ICO_TRA("n(%d)>=o(%d)", valN, m_val);
         return;
     }
     // When the value is less than the previous
     int t = ((double)valN / (double)m_baseVal)*100;
     if (50 <= t) {
         m_cntlr->resourceControlMemLimit(false);
-        ICO_TRA("BASE CHG %d->%d",m_baseVal, valN);
+        if (g_RC_LOG) ICO_TRA("BASE CHG %d->%d",m_baseVal, valN);
         m_baseVal = valN;
     }
     m_val = valN;
-    ICO_TRA("end");
+    if (g_RC_LOG) ICO_TRA("end");
 
 }
 
@@ -651,7 +692,7 @@ CicoSRCMEM_HIGH::~CicoSRCMEM_HIGH()
 void CicoSRCMEM_HIGH::onDo(const CicoEvent& ev, const CicoState* stt, int)
 {
     int valN = ev.getGCVi();
-    ICO_TRA("start o(%d), n(%d)", m_val, valN);
+    if (g_RC_LOG) ICO_TRA("start o(%d), n(%d)", m_val, valN);
     if (valN <= m_val) {
         // When the value is less than the previous
         ICO_TRA("end");
@@ -661,9 +702,9 @@ void CicoSRCMEM_HIGH::onDo(const CicoEvent& ev, const CicoState* stt, int)
     int t = ((double)(100-valN) / (double)(100-m_baseVal))*100;
     if (50 <= t) {
         m_cntlr->resourceControlMemLimit(true);
-        ICO_TRA("BASE CHG %d -> %d", m_baseVal, valN);
+        if (g_RC_LOG) ICO_TRA("BASE CHG %d -> %d", m_baseVal, valN);
         m_baseVal = valN;
     }
     m_val = valN;
-    ICO_TRA("end");
+    if (g_RC_LOG) ICO_TRA("end");
 }
index c4587a9..da6d828 100644 (file)
@@ -43,15 +43,16 @@ public: // member method
     CicoSRCCPU_LOW(CicoSCSysResourceController* obj);
     virtual ~CicoSRCCPU_LOW();
 
-    virtual void onEnttry(const CicoEvent& ev, const CicoState* stt,
-                          int addval);
+    virtual void onEntry(const CicoEvent& ev, const CicoState* stt, int addval);
     virtual void onDo(const CicoEvent& ev, const CicoState* stt, int addval);
     virtual void onExit(const CicoEvent& ev, const CicoState* stt,
                         int addval);
 protected: // member Variable
     int m_val;      // cpu or memory usage value
     int m_baseVal;  // cpu or memory base usage value
+    int m_cnt;
     CicoSCSysResourceController* m_cntlr;
+    const CicoSCResourceConf* m_rConf;
 };
 
 /**
index dac9148..d8c955d 100644 (file)
@@ -69,7 +69,7 @@ CicoSCSysResourceMonitor::~CicoSCSysResourceMonitor()
 }
 
 /**
- * @breif system usage
+ * @brief system usage
  * @param cpu core cpu position -1:all 0-n:cpu position
  * @return cpu usage(return value/100 = 0.00 - 100.00%)
  *         -1:get fail
@@ -126,7 +126,7 @@ int CicoSCSysResourceMonitor::getCPUtime(E_USAGETYPE e, int cpu) const
 }
 
 /**
- * @brief monitorring
+ * @brief monitoring
  */
 void CicoSCSysResourceMonitor::monitoring()
 {
@@ -197,7 +197,7 @@ int CicoSCSysResourceMonitor::createCurrentCPU()
     memset(tmp, 0, sizeof(tmp));
     cnt = readProcStatCPU(tmp, nDmyCpuCnt-1);
     if (0 == cnt) {
-        ICO_TRA("ret(0) cnt iz zero!");
+        ICO_TRA("ret(0) cnt is zero!");
         return 0;
     }
     size_t sz = cnt + 1;
@@ -216,7 +216,7 @@ void CicoSCSysResourceMonitor::readCurrentCPU()
 }
 
 /**
- * @brief read /proc/stat CPU infomation
+ * @brief read /proc/stat CPU information
  * @param sdtp destination read value
  * @param cpucnt CPU core count
  * @return read CPU count
@@ -303,7 +303,7 @@ bool CicoSCSysResourceMonitor::usageCalcCPU(const stat_data_t& old,
     double dguest_nice = current.guest_nice - old.guest_nice;
     ttl += dguest_nice;
     if (0 == ttl) { // must not be divided by ZERO
-        if (g_RC_LOG) ICO_TRA("end divid zero!?");
+        if (g_RC_LOG) ICO_TRA("end divide zero!?");
         return false;
     }
     calc.user = (int)(duser / ttl * dCarryUp);
index 2cd1107..0eaa139 100644 (file)
@@ -35,16 +35,9 @@ typedef struct t_stat_data {
     int irq;     // 6) Time servicing interrupts.
     int softirq; // 7) Time servicing softirqs.
     int steal;   // 8) Time stolen
-                 // 8) 盗まれた時間 (stolen time)。
-                 //  仮想化環境での動作時に他のオペレーティングシステム
-                 // により消費された時間である。
+                 // 8) stolen time
     int guest;   // 9) Time guest OS
-                 // 9) Linux カーネルの制御下のゲストオペレーティング
-                 // システムの仮想CPUの実行に消費された時間。
     int guest_nice; // 10) Time guest OS(nice)
-                    // 10) nice が適用されたゲスト
-                    // (Linuxカーネルの制御下のゲストオペレーティング
-                    // システムの仮想CPU)の実行に消費された時間。
 } stat_data_t;
 
 class CicoSCSysResourceMonitorP {
@@ -72,11 +65,6 @@ public: // member Variable
   34)sigcatch, 35)wchan, 36)nswap, 37)cnswap, 38)exit_signal, 39)processor
   40)rt_priority, 41)policy, 42)delayacct_blkio_ticks, 43)guest_time
   44)cguest_time
-
-    CPU使用率は、14)utimeと15)stimeより求めます。
-    実行時間 = utime + stime
-    CPU使用率=(今回の実行時間(tick単位)-前回の実行時間(tick単位))/USER_HZ/(今回の測定時刻(秒単位)-前回の計測時刻(秒単位))
-    メモリの使用サイズは、23)vsizeの仮想メモリのサイズを取得します。
 */
 };
 
index ae6e02f..c02d6aa 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCSystemConfig.cpp
  *
- *  @brief  
+ *  @brief  This file implementation of CicoSCSystemConfig class
  */
 /*========================================================================*/    
 
@@ -50,7 +50,7 @@ CicoSCSystemConfig::CicoSCSystemConfig()
 
     // 
     m_categoryTalbe[""]              = ICO_POLICY_ALWAYS;
-    m_categoryTalbe["alway"]         = ICO_POLICY_ALWAYS;
+    m_categoryTalbe["always"]        = ICO_POLICY_ALWAYS;
     m_categoryTalbe["run"]           = ICO_POLICY_RUNNING;
     m_categoryTalbe["park"]          = ICO_POLICY_PARKED;
     m_categoryTalbe["shift_park"]    = ICO_POLICY_SHIFT_PARKING;
@@ -69,6 +69,7 @@ CicoSCSystemConfig::CicoSCSystemConfig()
     m_privilegeTable["none"]           = ICO_PRIVILEGE_NONE;
     m_privilegeTable[""]               = ICO_PRIVILEGE_NONE;
     m_resourceConf = NULL;
+    m_userConf = NULL;
 }
 
 //--------------------------------------------------------------------------
@@ -101,7 +102,7 @@ CicoSCSystemConfig::getInstance(void)
 /**
  *  @brief  Get instance of CicoSCSystemConfig
  *
- *  @param  [IN]    confFile    config file name
+ *  @param  [in]    confFile    config file name
  *  @return 0 on success, other on error
  */
 //--------------------------------------------------------------------------
@@ -121,6 +122,7 @@ CicoSCSystemConfig::load(const string & confFile)
     createDefaultConf(root);
     createLogConf(root);
     createResourceConf(root);
+    createUserConf(root);
 
     return 0;   //TODO
 }
@@ -129,7 +131,20 @@ CicoSCSystemConfig::load(const string & confFile)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const vector<CicoSCNodeConf*>&
+CicoSCSystemConfig::getNodeConfList(void) const
+{
+    return m_nodeConfList;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const vector<CicoSCDisplayConf*>&
@@ -142,7 +157,59 @@ CicoSCSystemConfig::getDisplayConfList(void) const
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const vector<CicoSCSoundConf*>&
+CicoSCSystemConfig::getSoundConfList(void) const
+{
+    return m_soundConfList;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const vector<CicoSCInputDevConf*> &
+CicoSCSystemConfig::getInputDevConfList(void) const
+{
+    return m_inputDevConfList;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const vector<CicoSCCategoryConf*> &
+CicoSCSystemConfig::getCategoryConfList(void) const
+{
+    return m_categoryConfList;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const vector<CicoSCAppKindConf*> &
+CicoSCSystemConfig::getAppKindConfList(void) const
+{
+    return m_appKindConfList;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -200,7 +267,7 @@ CicoSCSystemConfig::createNodeConfList(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -299,7 +366,7 @@ CicoSCSystemConfig::createDisplayConfList(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -350,7 +417,7 @@ CicoSCSystemConfig::createLayerConf(const ptree::value_type & child,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -404,13 +471,13 @@ CicoSCSystemConfig::createDisplayZoneConf(const ptree::value_type & child,
         }
 
         CicoSCDisplayZoneConf* zoneConf = new CicoSCDisplayZoneConf();
-        zoneConf->id   = id.get();
-        zoneConf->name = name.get();
-        zoneConf->fullname = displayConf->name + "." + name.get();
-        zoneConf->x    = calcGeometryExpr(x.get(), displayConf);
-        zoneConf->y    = calcGeometryExpr(y.get(), displayConf);
-        zoneConf->w    = calcGeometryExpr(w.get(), displayConf);
-        zoneConf->h    = calcGeometryExpr(h.get(), displayConf);
+        zoneConf->id         = id.get();
+        zoneConf->name       = name.get();
+        zoneConf->fullname   = displayConf->name + "." + name.get();
+        zoneConf->x          = calcGeometryExpr(x.get(), displayConf);
+        zoneConf->y          = calcGeometryExpr(y.get(), displayConf);
+        zoneConf->w          = calcGeometryExpr(w.get(), displayConf);
+        zoneConf->h          = calcGeometryExpr(h.get(), displayConf);
         zoneConf->overlapStr = overlap.get();
         displayConf->zoneConfList.push_back(zoneConf);
 
@@ -422,7 +489,7 @@ CicoSCSystemConfig::createDisplayZoneConf(const ptree::value_type & child,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -467,7 +534,7 @@ CicoSCSystemConfig::createSoundConfList(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -490,14 +557,11 @@ CicoSCSystemConfig::createSoundZoneConf(const ptree::value_type & child,
         if (false == name.is_initialized()) {
             continue;
         }
-#if 0
-        cout << "id=" << id.get() << endl;
-        cout << "name=" << name.get() << endl;
-#endif
 
         CicoSCSoundZoneConf* zoneConf = new CicoSCSoundZoneConf();
-        zoneConf->id   = id.get();
-        zoneConf->name = name.get();
+        zoneConf->id       = id.get();
+        zoneConf->name     = name.get();
+        zoneConf->fullname = soundConf->name + "." + name.get();
         soundConf->zoneConfList.push_back(zoneConf);
 
         zoneConf->dumpConf();
@@ -508,7 +572,7 @@ CicoSCSystemConfig::createSoundZoneConf(const ptree::value_type & child,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -529,12 +593,6 @@ CicoSCSystemConfig::createPortConf(const ptree & root)
             continue;
         }
 
-#if 0
-        cout << "id=" << id.get() << endl;
-        cout << "name=" << name.get() << endl;
-        cout << "port=" << child.second.data() << endl;
-#endif
-
         switch (id.get()) {
         case 0:
             // TODO
@@ -553,7 +611,7 @@ CicoSCSystemConfig::createPortConf(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -603,16 +661,6 @@ CicoSCSystemConfig::createCategoryConf(const ptree & root)
         if (false == r_ctrl.is_initialized()) {
             continue;
         }
-#if 0
-        cout << "id=" << id.get() << endl;
-        cout << "name=" << name.get() << endl;
-        cout << "type=" << type.get() << endl;
-        cout << "view=" << view.get() << endl;
-        cout << "sound=" << sound.get() << endl;
-        cout << "input=" << input.get() << endl;
-        cout << "priority=" << priority.get() << endl;
-        cout << "r_ctrl=" << r_ctrl.get() << endl;
-#endif
 
         CicoSCCategoryConf* categoryConf = new CicoSCCategoryConf();
         categoryConf->id       = id.get();
@@ -632,7 +680,7 @@ CicoSCSystemConfig::createCategoryConf(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -666,13 +714,6 @@ CicoSCSystemConfig::createAppKindConf(const ptree & root)
             continue;
         }
 
-#if 0
-        cout << "id=" << id.get() << endl;
-        cout << "name=" << name.get() << endl;
-        cout << "privilege=" << privilege.get() << endl;
-        cout << "priority=" << priority.get() << endl;
-#endif
-
         CicoSCAppKindConf* appKindConf = new CicoSCAppKindConf();
         appKindConf->id        = id.get();
         appKindConf->name      = name.get();
@@ -687,7 +728,7 @@ CicoSCSystemConfig::createAppKindConf(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -708,10 +749,6 @@ CicoSCSystemConfig::createInputDevList(const ptree & root)
         if (false == name.is_initialized()) {
             continue;
         }
-#if 0
-        cout << "id=" << id.get() << endl;
-        cout << "name=" << name.get() << endl;
-#endif
                                                 
         CicoSCInputDevConf* inputDevConf = new CicoSCInputDevConf();
         inputDevConf->id   = id.get();
@@ -727,7 +764,7 @@ CicoSCSystemConfig::createInputDevList(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -755,12 +792,6 @@ CicoSCSystemConfig::createSwitchList(const ptree::value_type & child,
             continue;
         }
 
-#if 0
-        cout << "id=" << id.get() << endl;
-        cout << "name=" << name.get() << endl;
-        cout << "appid=" << appid.get() << endl;
-#endif
-
         CicoSCSwitchConf* switchConf = new CicoSCSwitchConf();
         switchConf->id    = id.get();
         switchConf->name  = name.get();
@@ -774,7 +805,7 @@ CicoSCSystemConfig::createSwitchList(const ptree::value_type & child,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -844,19 +875,6 @@ CicoSCSystemConfig::createDefaultConf(const ptree & root)
         ICO_WRN("default.inputdsw element not found");
     }
 
-#if 0
-    cout << "node=" << node.get() << endl;
-    cout << "appkind=" << appkind.get() << endl;
-    cout << "category=" << category.get() << endl;
-    cout << "display=" << display.get() << endl;
-    cout << "layer=" << layer.get() << endl;
-    cout << "displayzone=" << displayzone.get() << endl;
-    cout << "sound=" << sound.get() << endl;
-    cout << "soundzone=" << soundzone.get() << endl;
-    cout << "inputdev=" << inputdev.get() << endl;
-    cout << "inputsw=" << inputsw.get() << endl;
-#endif
-
     m_defaultConf = new CicoSCDefaultConf();
 
     m_defaultConf->node        = getNodeIdbyName(node.get());
@@ -904,7 +922,7 @@ CicoSCSystemConfig::createDefaultConf(const ptree & root)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void
@@ -916,11 +934,6 @@ CicoSCSystemConfig::createLogConf(const ptree & root)
     int loglevel  = logNode.get<int>("loglevel");
     bool logflush = logNode.get<bool>("logflush");
 
-#if 0
-    cout << "loglevel=" << loglevel << endl;
-    cout << "logflush=" << logflush << endl;
-#endif
-
     m_loglevel = loglevel;
     m_logflush = logflush;
 }
@@ -929,7 +942,7 @@ CicoSCSystemConfig::createLogConf(const ptree & root)
 /**
  *  @brief  resource config class object create
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void getArray(ptree& t, vector<int>& vec);
@@ -962,18 +975,10 @@ CicoSCSystemConfig::createResourceConf(const ptree & root)
     }
     m_resourceConf->m_cpuCGRPPath = dirnm;
 
-#if 0
-    optional<int> swt = optional<int>(-1);
-    swt = rc.get_optional<int>("sampling_wait");
-    if (false == swt.is_initialized()) {
-        m_resourceConf->m_sampling = swt.get();
-    }
-#else
     opts = rc.get_optional<string>("sampling_wait");
     if (true == opts.is_initialized()) {
         m_resourceConf->m_sampling = atoi(opts.get().c_str());
     }
-#endif
 
     opts = rc.get_optional<string>("log");
     if (true == opts.is_initialized()) {
@@ -982,7 +987,21 @@ CicoSCSystemConfig::createResourceConf(const ptree & root)
             m_resourceConf->m_bLog = true;
         }
     }
-    
+
+    opts = rc.get_optional<string>("retry_cnt");
+    if (true == opts.is_initialized()) {
+        m_resourceConf->m_retryCnt = atoi(opts.get().c_str());
+    }
+
+    opts = rc.get_optional<string>("low_limit_value");
+    if (true == opts.is_initialized()) {
+        m_resourceConf->m_lowLimitVal = atoi(opts.get().c_str());
+    }
+
+    opts = rc.get_optional<string>("high_limit_value");
+    if (true == opts.is_initialized()) {
+        m_resourceConf->m_highLimitVal = atoi(opts.get().c_str());
+    }
 
     BOOST_FOREACH(ptree::value_type& child, rc) {
         optional<int> id = optional<int>(-1);
@@ -1011,9 +1030,32 @@ CicoSCSystemConfig::createResourceConf(const ptree & root)
 
 //--------------------------------------------------------------------------
 /**
+ *  @brief  user config class object create
+ *
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+static const char* g_login_user_conf = "systemconfig.login_user";
+void
+CicoSCSystemConfig::createUserConf(const ptree & root)
+{
+    m_userConf = new CicoSCUserConf;
+    ptree rc = root.get_child(g_login_user_conf);
+    optional<string> opts = rc.get_optional<string>("parent_dir");
+    if (true == opts.is_initialized()) {
+        string v = opts.get();
+        if (v.empty()) {
+            m_userConf->m_parent_dir = v;
+        }
+    }
+    m_userConf->dumpConf();
+}
+
+//--------------------------------------------------------------------------
+/**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1101,7 +1143,7 @@ CicoSCSystemConfig::calcGeometryExpr(const string & expr,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCNodeConf*
@@ -1123,7 +1165,7 @@ CicoSCSystemConfig::findNodeConfbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCDisplayConf*
@@ -1146,7 +1188,7 @@ CicoSCSystemConfig::findDisplayConfbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCLayerConf*
@@ -1176,7 +1218,7 @@ CicoSCSystemConfig::findLayerConfbyName(const string & displayName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCDisplayZoneConf*
@@ -1201,7 +1243,7 @@ CicoSCSystemConfig::findDisplayZoneConfbyName(const string & displayName,
         conf = const_cast<CicoSCDisplayZoneConf*>(*itr);
         if (zoneName == conf->name) {
             ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Leave"
-                    "(0x%08X)", conf);
+                    "(0x%08x)", conf);
             return conf;
         }
     }
@@ -1214,7 +1256,7 @@ CicoSCSystemConfig::findDisplayZoneConfbyName(const string & displayName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCSoundConf*
@@ -1237,13 +1279,17 @@ CicoSCSystemConfig::findSoundConfbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCSoundZoneConf*
 CicoSCSystemConfig::findSoundZoneConfbyName(const string & soundName,
                                             const string & zoneName)
 {
+    ICO_DBG("CicoSCSystemConfig::findSoundZoneConfbyName Enter"
+            "(soundName=%s zoneNmae=%s)",
+            soundName.c_str(), zoneName.c_str());
+
     const CicoSCSoundConf* soundConf = NULL;
     soundConf = findSoundConfbyName(soundName);
     if (NULL == soundConf) {
@@ -1267,7 +1313,7 @@ CicoSCSystemConfig::findSoundZoneConfbyName(const string & soundName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCInputDevConf*
@@ -1290,7 +1336,7 @@ CicoSCSystemConfig::findInputDevConfbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCSwitchConf*
@@ -1323,7 +1369,7 @@ CicoSCSystemConfig::findSwitchConfbyName(const string & inputDevName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCAppKindConf*
@@ -1346,7 +1392,32 @@ CicoSCSystemConfig::findAppKindConfbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const CicoSCSoundZoneConf*
+CicoSCSystemConfig::findSoundZoneConfbyId(int id)
+{
+    vector<CicoSCSoundConf*>::iterator itr;
+    itr = m_soundConfList.begin();
+    for (; itr != m_soundConfList.end(); ++itr) {
+        vector<CicoSCSoundZoneConf*>::iterator itr2;
+        itr2 = (*itr)->zoneConfList.begin();
+        for (; itr2 != (*itr)->zoneConfList.end(); ++itr2) {
+            if (id == (*itr2)->id) {
+                return *itr2;
+            }
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCCategoryConf*
@@ -1370,7 +1441,7 @@ CicoSCSystemConfig::findCategoryConfbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCCategoryConf*
@@ -1393,7 +1464,28 @@ CicoSCSystemConfig::findCategoryConfbyId(int id)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+const CicoSCAppKindConf *
+CicoSCSystemConfig::findAppKindConfbyId(int id)
+{
+    vector<CicoSCAppKindConf*>::iterator itr;
+    itr = m_appKindConfList.begin();
+    for (; itr != m_appKindConfList.end(); ++itr) {
+        if (id == (*itr)->id) {
+            return *itr;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCDefaultConf*
@@ -1406,7 +1498,7 @@ CicoSCSystemConfig::getDefaultConf(void)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1425,7 +1517,7 @@ CicoSCSystemConfig::getNodeIdbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1444,7 +1536,7 @@ CicoSCSystemConfig::getDisplayIdbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1464,7 +1556,7 @@ CicoSCSystemConfig::getLayerIdfbyName(const string & displayName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1484,7 +1576,7 @@ CicoSCSystemConfig::getDizplayZoneIdbyName(const string & displayName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1510,7 +1602,7 @@ CicoSCSystemConfig::getDizplayZoneIdbyFullName(const string & zoneFullName)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1529,7 +1621,7 @@ CicoSCSystemConfig::getSoundIdbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1549,7 +1641,7 @@ CicoSCSystemConfig::getSoundZoneIdbyName(const string & soundName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1560,7 +1652,7 @@ CicoSCSystemConfig::getSoundZoneIdbyFullName(const string & zoneFullName)
         return -1;
     }
     string soundName = zoneFullName.substr(0, index);
-    string zoneName  = zoneFullName.substr(index);
+    string zoneName  = zoneFullName.substr(index+1);
 
     const CicoSCSoundZoneConf* conf = NULL;
     conf = findSoundZoneConfbyName(soundName, zoneName);
@@ -1575,7 +1667,7 @@ CicoSCSystemConfig::getSoundZoneIdbyFullName(const string & zoneFullName)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1594,7 +1686,7 @@ CicoSCSystemConfig::getInputDevIdbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1614,7 +1706,7 @@ CicoSCSystemConfig::getSwitchIdbyName(const string & inputDevName,
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1633,7 +1725,7 @@ CicoSCSystemConfig::getAppKindIdbyName(const string & name)
 /**
  *  @brief  
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 int
@@ -1652,7 +1744,7 @@ CicoSCSystemConfig::getCategoryIdbyName(const string & name)
 /**
  *  @brief  get category config object class
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 const CicoSCCategoryConf*
@@ -1678,7 +1770,7 @@ CicoSCSystemConfig::getCategoryObjbyCaategoryID(int id)
 /**
  *  @brief  array xml tree to vector<int>
  *
- *  @param  [IN]
+ *  @param  [in]
  */
 //--------------------------------------------------------------------------
 void getArray(ptree& t, vector<int>& vec)
@@ -1689,24 +1781,4 @@ void getArray(ptree& t, vector<int>& vec)
         vec.push_back(value);
     }
 }
-
-#if 0
-//--------------------------------------------------------------------------
-/**
- *  @brief  
- *
- *  @param  [IN]
- */
-//--------------------------------------------------------------------------
-int main(int argc, char* argv[]) {
-    if (argc < 2) {
-        cerr << "ptree_format filename" << endl;
-        exit(-1);
-    }
-    
-    CicoSCSystemConfig::getInstance()->load(argv[1]);
-
-    return 0;
-}
-#endif
 // vim:set expandtab ts=4 sw=4:
index bab05ea..d716412 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCSystemConfig.h
  *
- *  @brief  
+ *  @brief  This file is definition of CicoSCSystemConfig class
  */
 //==========================================================================
 #ifndef __CICO_SC_SYSTEM_CONFIG_H__
@@ -29,6 +29,9 @@ using namespace std;
 using namespace boost;
 using namespace boost::property_tree;
     
+//==========================================================================
+//  Forward declaration
+//==========================================================================
 #ifndef __CICO_SC_CONF_H__
 class CicoSCNodeConf;
 class CicoSCLayerConf;
@@ -42,8 +45,14 @@ class CicoSCSwitchConf;
 class CicoSCInputDevConf;
 class CicoSCDefaultConf;
 class CicoSCResourceConf;
+class CicoSCUserConf;
 #endif
 
+//==========================================================================
+/**
+ *  @brief  This class has function of access to system config information
+ */
+//==========================================================================
 class CicoSCSystemConfig 
 {
 public:
@@ -51,12 +60,12 @@ public:
 
     int load(const string & confFile);
 
-    //vector<CicoSCNodeConf*> m_nodeConfList;
-    const vector<CicoSCDisplayConf*>& getDisplayConfList(void) const;
-    //vector<CicoSCSoundConf*> m_soundConfList;
-    //vector<CicoSCInputDevConf*> m_inputDevConfList;
-    //vector<CicoSCCategoryConf*> m_categoryConfList;
-    //vector<CicoSCAppKindConf*> m_appKindConfList;
+    const vector<CicoSCNodeConf*> &    getNodeConfList(void) const;
+    const vector<CicoSCDisplayConf*> & getDisplayConfList(void) const;
+    const vector<CicoSCSoundConf*> &   getSoundConfList(void) const;
+    const vector<CicoSCInputDevConf*> &  getInputDevConfList(void) const;
+    const vector<CicoSCCategoryConf*> & getCategoryConfList(void) const;
+    const vector<CicoSCAppKindConf*> &  getAppKindConfList(void) const;
 
     const CicoSCNodeConf* findNodeConfbyName(const string & name);
     const CicoSCDisplayConf* findDisplayConfbyName(const string & name);
@@ -74,10 +83,13 @@ public:
     const CicoSCAppKindConf* findAppKindConfbyName(const string & name);
     const CicoSCCategoryConf* findCategoryConfbyName(const string & name);
 
+    const CicoSCSoundZoneConf* findSoundZoneConfbyId(int id);
     const CicoSCCategoryConf* findCategoryConfbyId(int id);
+    const CicoSCAppKindConf* findAppKindConfbyId(int id);
 
     const CicoSCDefaultConf* getDefaultConf(void);
 
+
     int getNodeIdbyName(const string & name);
     int getDisplayIdbyName(const string & name);
     int getLayerIdfbyName(const string & displayName,
@@ -86,7 +98,7 @@ public:
                                const string & zoneName);
     int getDizplayZoneIdbyFullName(const string & zoneFullName);
     int getSoundIdbyName(const string & name);
-    
+
     int getSoundZoneIdbyName(const string & soundName,
                              const string & zoneName);
     int getSoundZoneIdbyFullName(const string & zoneFullName);
@@ -101,6 +113,11 @@ public:
     };
     const CicoSCCategoryConf* getCategoryObjbyCaategoryID(int id);
 
+    const CicoSCUserConf* getUserConf() const 
+    {
+        return m_userConf;
+    };
+
 private:
     // default constructor
     CicoSCSystemConfig();
@@ -133,6 +150,7 @@ private:
     void createDefaultConf(const ptree & root);
     void createLogConf(const ptree & root);
     void createResourceConf(const ptree & root);
+    void createUserConf(const ptree & root);
 
     int calcGeometryExpr(const string & expr, CicoSCDisplayConf* conf);
 
@@ -155,6 +173,7 @@ private:
     bool  m_logflush;
     CicoSCDefaultConf *m_defaultConf;
     CicoSCResourceConf *m_resourceConf;
+    CicoSCUserConf *m_userConf;
 };
 #endif  // __CICO_SC_SYSTEM_CONFIG_H__
 // vim:set expandtab ts=4 sw=4:
index 6cbf343..f4295f6 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCUser.cpp
  *
- *  @brief  
+ *  @brief  This file implementation of CicoSCUser class
  */
 /*========================================================================*/
 
@@ -24,6 +24,7 @@
  */
 //--------------------------------------------------------------------------
 CicoSCUser::CicoSCUser()
+    : name(""), passwd(""), homescreen(""), autolaunch(true)
 {
 }
 
@@ -38,13 +39,14 @@ CicoSCUser::~CicoSCUser()
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  dump log CicoSCUser member variables
+ *  @brief  dump log this class member variables
  */
 //--------------------------------------------------------------------------
 void
 CicoSCUser::dump(void)
 {
-    ICO_DBG("user name=%s, pass=%s, homescreen=%s",
-            name.c_str(), passwd.c_str(), homescreen.c_str());
+    ICO_DBG("CicoSCUser: name=%s, pass=%s, homescreen=%s autolaunch=%s",
+            name.c_str(), passwd.c_str(), homescreen.c_str(),
+            autolaunch ? "true" : "false");
 }
 // vim:set expandtab ts=4 sw=4:
index 438f557..46cc217 100644 (file)
 /**
  *  @file   CicoSCUser.h
  *
- *  @brief  
+ *  @brief  This file is definition of CicoSCUser class
  */
 //==========================================================================
 #ifndef __CICO_SC_USER_H__
 #define __CICO_SC_USER_H__
 
 #include <string>
-using namespace std;
+#include <vector>
 
+//==========================================================================
+//  Forward declaration
+//==========================================================================
+class CicoSCLastInfo;
+
+//==========================================================================
+/**
+ *  @brief  This class hold user information
+ */
+//==========================================================================
 class CicoSCUser
 {
 public:
@@ -29,7 +39,7 @@ public:
     // destructor
     virtual ~CicoSCUser();
 
-    // dump log CicoSCUser member variables
+    // dump log this class member variables
     void dump(void);
 
 private:
@@ -40,9 +50,12 @@ private:
     CicoSCUser(const CicoSCUser &object);
 
 public:
-    string     name;        //!< user name
-    string     passwd;      //!< password
-    string     homescreen;  //!< application ID of user uses homescreen
+    std::string name;        ///< user name
+    std::string passwd;      ///< password
+    std::string homescreen;  ///< application ID of user uses homescreen
+    bool        autolaunch;  ///< homescreen autolaunch flag
+
+    std::vector<CicoSCLastInfo*> lastInfoList;   ///< list of last information
 };
-#endif // __CICO_SC_USER_H__
+#endif  // __CICO_SC_USER_H__
 // vim:set expandtab ts=4 sw=4:
index 274ca99..9db13b8 100644 (file)
@@ -7,30 +7,59 @@
  *
  */
 
-/*========================================================================*/    
+/*========================================================================*/
 /**
  *  @file   CicoSCUserManager.cpp
  *
- *  @brief  
+ *  @brief  This file implementation of CicoSCUserManager class
  */
-/*========================================================================*/    
+/*========================================================================*/
+
+#include <sys/stat.h>
+#include <dirent.h>
+
+#include <fstream>
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/xml_parser.hpp>
+#include <boost/foreach.hpp>
+#include <cstdio>
+using namespace boost;
+using namespace boost::property_tree;
 
 #include "ico_syc_error.h"
 #include "ico_syc_msg_cmd_def.h"
+#include "ico_syc_public.h"
 
 #include "CicoLog.h"
 
-#include "CicoSCCommandParser.h"
+#include "CicoSCCommand.h"
+#include "CicoSCLastInfo.h"
+#include "CicoSCAulItems.h"
 #include "CicoSCLifeCycleController.h"
 #include "CicoSCMessage.h"
 #include "CicoSCServer.h"
 #include "CicoSCUserManager.h"
+#include "CicoSCUser.h"
+#include "CicoSCConf.h"
+#include "CicoSCSystemConfig.h"
 
-//==========================================================================    
+
+//==========================================================================
+//
+//  definition
+//
+//==========================================================================
+#define ICO_SYC_DEFAULT_PATH    "/home/app/ico"
+#define ICO_SYC_APP_INFO        "runnningApp.info"
+#define ICO_SYC_APP_INFO_DEF    "defaultApps.info"
+#define ICO_SYC_LASTINFO_DIR    (char*)"/lastinfo/"
+#define ICO_SYC_LASTUSER_FILE   (char*)"/home/app/ico/lastuser.txt"
+
+//==========================================================================
 //
 //  private static variable
 //
-//==========================================================================    
+//==========================================================================
 CicoSCUserManager* CicoSCUserManager::ms_myInstance = NULL;
 
 //--------------------------------------------------------------------------
@@ -39,10 +68,20 @@ CicoSCUserManager* CicoSCUserManager::ms_myInstance = NULL;
  */
 //--------------------------------------------------------------------------
 CicoSCUserManager::CicoSCUserManager()
+    : m_login("")
 {
-    m_defaultUser = NULL;
-    m_lastUser = NULL;
-    m_loginUser = NULL;
+    m_uConfig = CicoSCSystemConfig::getInstance()->getUserConf();
+    if ((NULL == m_uConfig) || (true == m_uConfig->m_parent_dir.empty())) {
+        m_parentDir = ICO_SYC_DEFAULT_PATH;
+    }
+    else {
+        m_parentDir = m_uConfig->m_parent_dir;
+    }
+    int sz = m_parentDir.size();
+    const char* p = m_parentDir.c_str();
+    if ('/' != p[sz-1]) {
+        m_parentDir += "/";
+    }
 }
 
 //--------------------------------------------------------------------------
@@ -54,18 +93,27 @@ CicoSCUserManager::~CicoSCUserManager()
 {
     ICO_DBG("CicoSCUserManager::~CicoSCUserManager() Enter");
 
-    delete m_defaultUser;
-
+    // clear homescreen list
     m_homescreenList.clear();
 
+    // clear userlist
     vector<CicoSCUser*>::iterator itr;
     itr = m_userList.begin();
     for (; itr != m_userList.end(); ++itr) {
+        CicoSCUser *user = const_cast<CicoSCUser*>(*itr);
+        // clear list of last information
+        vector<CicoSCLastInfo*>::iterator info_itr;
+        info_itr = user->lastInfoList.begin();
+        for (; info_itr != user->lastInfoList.end(); ++info_itr) {
+            // free memory
+            delete *info_itr;
+        }
+        // free memory
         delete *itr;
     }
     m_userList.clear();
 
-    ICO_DBG("CicoSCUserManager::~CicoSCUserManager() Leave");
+    ICO_DBG("CicoSCUserManager::~CicoSCUserManager() Leave(EOK)");
 }
 
 //--------------------------------------------------------------------------
@@ -88,7 +136,7 @@ CicoSCUserManager::getInstance(void)
 /**
  *  @brief  Handle command
  *
- *  @param  [IN] cmd            control command
+ *  @param  [in] cmd            control command
  *  @return none
  */
 //--------------------------------------------------------------------------
@@ -108,19 +156,27 @@ CicoSCUserManager::handleCommand(const CicoSCCommand * cmd)
         // get userlist
         userlistCB(cmd->appid);
         break;
+    case MSG_CMD_GET_LASTINFO:
+        // get last information 
+        lastinfoCB(cmd->appid);
+        break;
+    case MSG_CMD_SET_LASTINFO:
+        // set application's last information
+        setLastInfo(cmd->appid, opt->lastinfo);
+        break;
     default:
-        ICO_WRN("Unknown Command(0x%08x)", cmd->cmdid);
+        ICO_WRN("Unknown Command(0x%08X)", cmd->cmdid);
         break;
     }
 
-    ICO_DBG("CicoSCUserManager::handleCommand Leave");
+    ICO_DBG("CicoSCUserManager::handleCommand Leave(EOK)");
 }
 
 //--------------------------------------------------------------------------
 /**
  *  @brief  Load configuration file
  *
- *  @param  [IN] confFile       configuration file path
+ *  @param  [in] confFile       configuration file path
  *  @return 0 on success, other on error
  */
 //--------------------------------------------------------------------------
@@ -136,10 +192,10 @@ CicoSCUserManager::load(const string & confFile)
     // create lists
     createUserList(root);
     createHomeScreenList(root);
-    // set default user
-    setDefaultUser(root);
+    // set login user name
+    setLoginUser(root);
 
-    ICO_DBG("CicoSCUserManager::load Leave");
+    ICO_DBG("CicoSCUserManager::load Leave(EOK)");
 
     // always success
     return ICO_SYC_EOK;
@@ -156,59 +212,46 @@ CicoSCUserManager::load(const string & confFile)
 int
 CicoSCUserManager::initialize(void)
 {
-// TODO
     ICO_DBG("CicoSCUserManager::initialize Enter");
 
-    const CicoSCUser *user = NULL;
-
-    if (NULL != m_lastUser) {
-        user = m_lastUser;
+    // get login user information
+    const CicoSCUser *user = findUserConfbyName(m_login);
+    if (NULL == user) {
+        ICO_ERR("CicoSCUserManager::initialize Leave(ENXIO)");
+        return ICO_SYC_ENXIO;
     }
-    else if (NULL != m_defaultUser) {
-        user = m_defaultUser;
+
+    // launch homescreen
+    if (true == user->autolaunch) {
+        launchHomescreenReq(user->name, user->homescreen);
     }
     else {
-        ICO_ERR("last user and default user are null");
-        return ICO_SYC_ENXIO;
+        ICO_DBG("launch homescreen skip");
     }
 
-    // update login user information
-    setLoginUser(user);
-
-    // launch homescreen
-    ICO_DBG("launch homescreen (user=%s, appid=%s)",
-            (user->name).c_str(), (user->homescreen).c_str());
-    CicoSCLifeCycleController::getInstance()->launch((user->homescreen).c_str());
+    // load last information
+    loadLastInfo();
 
-    ICO_DBG("CicoSCUserManager::initialize Leave");
+    // make root directory
+    string root_dir = m_uConfig->m_parent_dir;
+    struct stat st;
+    int ret = stat(root_dir.c_str(), &st);
+    if (0 != ret) {
+        mkdir(root_dir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
+    }
+    // make user's directory
+    string user_dir = m_parentDir + m_login + "/";
+    ret = stat(user_dir.c_str(), &st);
+    if (0 != ret) {
+        mkdir(user_dir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
+    }
 
-    return ICO_SYC_EOK;
-}
+    // save last user
+    saveLastUser();
 
-//--------------------------------------------------------------------------
-/**
- *  @brief  Get default user information
- *
- *  @return pointer of CicoSCUser
- */
-//--------------------------------------------------------------------------
-const CicoSCUser*
-CicoSCUserManager::getDefaultUser(void)
-{
-    return m_defaultUser;
-}
+    ICO_DBG("CicoSCUserManager::initialize Leave(EOK)");
 
-//--------------------------------------------------------------------------
-/**
- *  @brief  Get last user information
- *
- *  @return pointer of CicoSCUser
- */
-//--------------------------------------------------------------------------
-const CicoSCUser*
-CicoSCUserManager::getLastUser(void)
-{
-    return m_lastUser;
+    return ICO_SYC_EOK;
 }
 
 //--------------------------------------------------------------------------
@@ -221,7 +264,7 @@ CicoSCUserManager::getLastUser(void)
 const CicoSCUser*
 CicoSCUserManager::getLoginUser(void)
 {
-    return m_loginUser;
+    return findUserConfbyName(m_login);
 }
 
 //--------------------------------------------------------------------------
@@ -254,8 +297,8 @@ CicoSCUserManager::getHomeScreenList(void)
 /**
  *  @brief  Change login user
  *
- *  @param  [IN] name           user name
- *  @param  [IN] passwd         password
+ *  @param  [in] name           user name
+ *  @param  [in] passwd         password
  *  @return none
  */
 //--------------------------------------------------------------------------
@@ -265,31 +308,226 @@ CicoSCUserManager::changeUser(const string & name, const string & passwd)
     ICO_DBG("CicoSCUserManager::changeUser Enter"
             "(user=%s pass=%s)", name.c_str(), passwd.c_str());
 
+    ICO_DBG("change user \"%s\" -> \"%s\"", m_login.c_str(), name.c_str());
+
+    string oldUsr = m_login; /* get before login user */
     const CicoSCUser *conf = NULL;
 
     // get user config
     conf = findUserConfbyName(name);
     if (NULL == conf) {
-        ICO_WRN("user \"%s\" does not exist in the userlist", name.c_str());
+        ICO_ERR("CicoSCUserManager::changeUser Leave(ENXIO)");
         return;
     }
 
     // check password
     if (passwd != conf->passwd) {
-        ICO_ERR("user \"%s\" invalid password", name.c_str());
+        ICO_ERR("CicoSCUserManager::changeUser Leave(EINVAL)");
         return;
     }
 
+    // Imprinting to file, that file is application's running information 
+    string usr_dir_old;
+    getWorkingDir(oldUsr, usr_dir_old);
+    string outfilename = usr_dir_old + ICO_SYC_APP_INFO;
+    impritingLastApps(outfilename);
+
+    // killing running application and homeScreen
+    killingAppsAndHS(oldUsr);
+
+
+    // check wheather directory exists
+    vector<string> mk_dir_info;
+    mk_dir_info.push_back(m_uConfig->m_parent_dir);
+    string usr_dir;
+    getWorkingDir(conf->name, usr_dir);
+    mk_dir_info.push_back(usr_dir);
+    vector<string>::iterator it = mk_dir_info.begin();
+    for (; it != mk_dir_info.end(); it++) {
+        const char* dir = (*it).c_str();
+        struct stat st;
+        if (0 == stat(dir, &st)) {
+            continue; // continue of for
+        }
+        mkdir(dir, S_IRWXU | S_IRWXG | S_IRWXO);
+    }
+
     // change homescreen application
-    ICO_DBG("launch homescreen (user=%s, appid=%s)",
-            (conf->name).c_str(), (conf->homescreen).c_str());
-    CicoSCLifeCycleController::getInstance()->launch((conf->homescreen).c_str());
+    launchHomescreenReq(conf->name, conf->homescreen);
 
-    // set lastUser
-    m_lastUser = const_cast<CicoSCUser*>(conf);
-    ICO_DBG("last user changed (user=%s)", name.c_str());
+    // change login user
+    m_login = conf->name;
+    ICO_DBG("login user changed (user=%s)", m_login.c_str());
 
-    ICO_DBG("CicoSCUserManager::changeUser Leave");
+    ICO_DBG("CicoSCUserManager::changeUser Leave(EOK)");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  imprinting to file, that file is application's running information 
+ *  @param  usrnam target user name
+ *  @return bool
+ *  @retval true success
+ *  @retval false fail
+ */
+//--------------------------------------------------------------------------
+bool CicoSCUserManager::impritingLastApps(const string& ofnm)
+{
+    // <TODO></TODO>
+    // <TODO></TODO>
+    // <TODO></TODO>
+    vector<string> vs;
+#if 0
+
+    AAAAAAAAAA
+
+#else
+    CicoSCLifeCycleController* oCSCLCC;
+    oCSCLCC = CicoSCLifeCycleController::getInstance();
+    if ((NULL == oCSCLCC) || (0 == oCSCLCC)) {
+        ICO_ERR("CicoSCUserManager::impritingLastApps Leave(ENXIO)");
+        return false;
+    }
+    const vector<CicoSCAulItems>& aulList = oCSCLCC->getAulList();
+    for (int i=aulList.size() ; i != 1; i--) {
+        const CicoSCAulItems* pO = aulList[i-1].p();
+        if ((NULL == pO) || (0 == pO)) {
+            continue;
+        }
+        if (pO->m_appid == "org.tizen.ico.login") {
+            continue;
+        }
+        if (pO->m_appid == "org.tizen.ico.statusbar") {
+            continue;
+        }
+        if (pO->m_appid == "org.tizen.ico.homescreen") {
+            continue;
+        }
+        vs.push_back(pO->m_appid);
+    }
+#endif
+    if (0 == vs.size()) {
+        remove(ofnm.c_str());
+        ICO_ERR("CicoSCUserManager::impritingLastApps app none");
+        return true;
+    }
+    ofstream ofs;
+    ofs.open(ofnm.c_str(), ios::trunc);
+    vector<string>::iterator it = vs.begin();
+    for (; it != vs.end(); it++) {
+        ofs << *it << endl;
+    }
+    ofs.close();
+    ICO_ERR("CicoSCUserManager::impritingLastApps app = %d", vs.size());
+    return false;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  killing running applications and homeScreen
+ *  @param  usrnam target user name
+ *  @return bool
+ *  @retval true success
+ *  @retval false fail
+ */
+//--------------------------------------------------------------------------
+bool CicoSCUserManager::killingAppsAndHS(const string&)
+{
+/* TODO
+    const CicoSCUser *cnf = findUserConfbyName(usrnm);
+    if (NULL == cnf) {
+        ICO_ERR("CicoSCUserManager::killingAppsAndHS Leave(ENXIO)");
+        return false;
+    }
+*/
+    CicoSCLifeCycleController* oCSCLCC;
+    oCSCLCC = CicoSCLifeCycleController::getInstance();
+    if ((NULL == oCSCLCC) || (0 == oCSCLCC)) {
+        ICO_ERR("CicoSCUserManager::killingAppsAndHS Leave(ENXIO)");
+        return false;
+    }
+    bool r = false;
+    const vector<CicoSCAulItems>& aulList = oCSCLCC->getAulList();
+    vector<int> pids;
+    for (int i=aulList.size() ; i != 0; i--) {
+        const CicoSCAulItems* pObj = aulList[i-1].p();
+        if ((NULL == pObj) || (0 == pObj)) {
+            continue;
+        }
+        ICO_DBG("CicoSCUserManager::killingAppsAndHS Tgt:%d(%s)", pObj->m_pid,
+                pObj->m_appid.c_str());
+        pids.push_back(pObj->m_pid);
+        r = true;
+    }
+    int sz = pids.size();
+    for (int j=0; j < sz; j++) {
+        oCSCLCC->terminate(pids[j]);
+    }
+    ICO_DBG("CicoSCUserManager::killingAppsAndHS ret=%s", r? "true": "false");
+    return r;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  homescreen launch request
+ *  @param  usrnam target user name
+ *  @return bool
+ *  @retval true success
+ *  @retval false fail
+ */
+//--------------------------------------------------------------------------
+void CicoSCUserManager::getWorkingDir(const string& usr, string& dir)
+{
+    dir = m_parentDir;
+    dir += usr + "/";
+    return;
+}
+//--------------------------------------------------------------------------
+/**
+ *  @brief  homescreen launch request
+ *  @param  usrnam target user name
+ *  @return bool
+ *  @retval true success
+ *  @retval false fail
+ */
+//--------------------------------------------------------------------------
+bool CicoSCUserManager::launchHomescreenReq(const string& usr, 
+                                            const string& appid_hs)
+{
+    string usr_dir;
+    getWorkingDir(usr, usr_dir);
+    string prmfn = usr_dir + ICO_SYC_APP_INFO;
+
+    const char* filepath = prmfn.c_str();
+    struct stat st;
+    if (0 != stat(filepath, &st)) {
+        string dir = m_parentDir;
+        dir += string(ICO_SYC_APP_INFO_DEF);
+        prmfn = dir;
+    }
+
+    bundle *b;
+    b = bundle_create();
+    bundle_add(b, ICO_SYC_APP_BUNDLE_KEY1, usr.c_str());
+    bundle_add(b, ICO_SYC_APP_BUNDLE_KEY2, prmfn.c_str());
+
+    ICO_DBG("launch homescreen (user=%s, appid=%s, parm=%s)",
+            usr.c_str(), appid_hs.c_str(), prmfn.c_str());
+
+    CicoSCLifeCycleController* oCSCLCC;
+    oCSCLCC = CicoSCLifeCycleController::getInstance();
+    int r = oCSCLCC->launch(appid_hs.c_str(), b);
+
+// <TODO>
+// ???  bundle_free(b);
+// </TODO>
+
+    if (ICO_SYC_EOK != r) {
+        ICO_DBG("CicoSCUserManager::launchHomescreenReq false(%d)", r);
+        return false;
+    }
+    ICO_DBG("CicoSCUserManager::launchHomescreenReq true(ICO_SYC_EOK)");
+    return true;
 }
 
 //--------------------------------------------------------------------------
@@ -333,7 +571,7 @@ CicoSCUserManager::dumpHomeScreenList(void)
 /**
  *  @brief  Callback of "get userlist"
  *
- *  @param  [IN] appid          application id to send message
+ *  @param  [in] appid          application id to send message
  *
  *  @return none
  */
@@ -341,7 +579,7 @@ CicoSCUserManager::dumpHomeScreenList(void)
 void
 CicoSCUserManager::userlistCB(const string & appid)
 {
-    ICO_DBG("CicoSCUserManager::userlistCB Enter");
+    ICO_DBG("CicoSCUserManager::userlistCB Enter (%s)", appid.c_str());
 
     // send message
     CicoSCMessage *message = new CicoSCMessage();
@@ -359,135 +597,212 @@ CicoSCUserManager::userlistCB(const string & appid)
     message->addArgObject("user_list");
 
     // set login user name
-    if (NULL != m_loginUser) {
-        message->addArgObject("user_login", m_loginUser->name);
-    }
-    else {
-        message->addArgObject("user_login", m_defaultUser->name);
-    }
+    message->addArgObject("user_login", m_login);
 
     CicoSCServer::getInstance()->sendMessage(appid, message);
 
-    ICO_DBG("CicoSCUserManager::userlistCB Leave");
+    ICO_DBG("CicoSCUserManager::userlistCB Leave(EOK)");
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  Set default user information
+ *  @brief  Callback of "get application's last information"
+ *
+ *  @param  [in] appid          application id to send message
  *
- *  @param  [IN] root           pointer of ptree object
  *  @return none
  */
 //--------------------------------------------------------------------------
 void
-CicoSCUserManager::setDefaultUser(const ptree & root)
+CicoSCUserManager::lastinfoCB(const string & appid)
 {
-    ICO_DBG("CicoSCUserManager::setDefaultUser Enter");
+    ICO_DBG("CicoSCUserManager::lastinfoCB Enter (%s)", appid.c_str());
 
-    if (NULL == m_defaultUser) {
-        m_defaultUser = new CicoSCUser();
+    // send message
+    CicoSCMessage *message = new CicoSCMessage();
+    message->addRootObject("command", MSG_CMD_GET_LASTINFO);
+    message->addRootObject("appid", appid);
+
+    CicoSCUser* user = const_cast<CicoSCUser*>(findUserConfbyName(m_login));
+    // search application's last information
+    vector<CicoSCLastInfo*>::iterator itr;
+    itr = user->lastInfoList.begin();
+    for (; itr != user->lastInfoList.end(); ++itr) {
+        const CicoSCLastInfo *info = const_cast<CicoSCLastInfo*>(*itr);
+        if (appid == info->appid) {
+            // set last information
+            message->addArgObject("lastinfo", info->lastinfo);
+            break;
+        }
     }
 
-    ptree default_user = root.get_child("userconfig.default");
+    CicoSCServer::getInstance()->sendMessage(appid, message);
 
-    BOOST_FOREACH (const ptree::value_type& child, default_user) {
-        if (0 != strcmp(child.first.data(), "user")) {
-            ICO_ERR("unknown element (%s)", child.first.data());
-        }
+    ICO_DBG("CicoSCUserManager::lastinfoCB Leave(EOK)");
+}
 
-        optional<string> name;
-        name = child.second.get_optional<string>("name");
-        if (false == name.is_initialized()) {
-            ICO_ERR("user.name element not found");
-            continue;
-        }
-        m_defaultUser->name = name.get();
-    }
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Save last user name to last user file
+ *
+ *  @return none
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCUserManager::saveLastUser(void)
+{
+    ICO_DBG("CicoSCUserManager::saveLastUser Enter (name=%s)", m_login.c_str());
 
-    /* get homescreen and password info from m_userList */
-    int check_flag = 0;
-    vector<CicoSCUser*>::iterator itr;
-    itr = m_userList.begin();
-    for (; itr != m_userList.end(); ++itr) {
-        const CicoSCUser* conf = const_cast<CicoSCUser*>(*itr);
-        if (conf->name == m_defaultUser->name) {
-            m_defaultUser->passwd = conf->passwd;
-            m_defaultUser->homescreen = conf->homescreen;
-            check_flag++;
-            break;
-        }
-    }
+    // output last user name to file
+    std::ofstream stream;
+    string file = ICO_SYC_LASTUSER_FILE;
+    stream.open(file.c_str());
+    stream << m_login << std::endl;
+    stream.close();
 
-    /* default user name does not exist in the m_userList */
-    if (check_flag == 0) {
-        itr = m_userList.begin();
-        const CicoSCUser* conf = const_cast<CicoSCUser*>(*itr);
-        m_defaultUser->name = conf->name;
-        m_defaultUser->passwd = conf->passwd;
-        m_defaultUser->homescreen = conf->homescreen;
+    ICO_DBG("CicoSCUserManager::saveLastUser Leave(EOK)");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Load last user name from last user file
+ *
+ *  @return none
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCUserManager::loadLastUser(void)
+{
+    ICO_DBG("CicoSCUserManager::loadLastUser Enter");
+
+    // check weather file exists
+    struct stat st;
+    int ret = stat(ICO_SYC_LASTUSER_FILE, &st);
+    if (0 != ret) {
+        // last user file does not exist
+        ICO_DBG("CicoSCUserManager::loadLastUser Leave(ENXIO)");
+        return;
     }
 
-    // dump data
-    m_defaultUser->dump();
+    // load last user name
+    std::ifstream stream;
+    stream.open(ICO_SYC_LASTUSER_FILE);
+    stream >> m_login;
+    stream.close();
 
-    ICO_DBG("CicoSCUserManager::setDefaultUser Leave");
+    ICO_DBG("CicoSCUserManager::loadLastUser Leave(EOK)");
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  Set last user information
+ *  @brief  Load application's last information
  *
- *  @param  [IN] root           pointer of ptree object
  *  @return none
  */
 //--------------------------------------------------------------------------
 void
-CicoSCUserManager::setLastUser(const ptree & root)
+CicoSCUserManager::loadLastInfo()
 {
-// TODO
-    ICO_DBG("CicoSCUserManager::setLastUser Enter");
+    ICO_DBG("CicoSCUserManager::loadLastInfo Enter (name=%s)", m_login.c_str());
 
-    if (NULL == m_lastUser) {
-        m_lastUser = m_defaultUser;
+    if (m_login.empty()) {
+        ICO_ERR("CicoSCUserManager::loadLastInfo Leave(EINVAL)");
+        return;
     }
 
-    // dump data
-    //m_lastUser->dump();
+    // check weather file exists
+    struct stat st;
+    string dir = m_parentDir + m_login + ICO_SYC_LASTINFO_DIR;
+    int ret = stat(dir.c_str(), &st);
+    if (0 != ret) {
+        // lastinfo directory does not exist
+        ICO_DBG("CicoSCUserManager::loadLastInfo Leave(ENXIO)");
+        return;
+    }
+
+    // get file list
+    struct dirent **filelist;
+    int filenum = scandir(dir.c_str(), &filelist, NULL, NULL);
+    for (int i = 0; i < filenum; ++i) {
+        string filename = filelist[i]->d_name;
+        string::size_type index = filename.find(".txt");
+        if (string::npos != index) {
+            // load last information from file
+            string infofile = dir + filename;
+            string info;
+            std::ifstream stream;
+            stream.open(infofile.c_str());
+            stream >> info;
+            stream.close();
+
+            // get appid (erase ".txt" from filename)
+            filename.erase(index, filename.size());
+            // set last information
+            setLastInfo(filename, info);
+        }
+        free(filelist[i]);
+    }
+    free(filelist);
 
-    ICO_DBG("CicoSCUserManager::setLastUser Leave");
+    ICO_DBG("CicoSCUserManager::loadLastInfo Leave(EOK)");
 }
 
 //--------------------------------------------------------------------------
 /**
  *  @brief  Set login user information
  *
- *  @param  [IN] user           pointer of CicoSCUser
+ *  @param  [in] root           pointer of ptree object
  *  @return none
  */
 //--------------------------------------------------------------------------
 void
-CicoSCUserManager::setLoginUser(const CicoSCUser * user)
+CicoSCUserManager::setLoginUser(const ptree & root)
 {
-// TODO
     ICO_DBG("CicoSCUserManager::setLoginUser Enter");
 
-    if (NULL == user) {
-        m_loginUser = m_defaultUser;
-    }
-    else {
-        m_loginUser = const_cast<CicoSCUser*>(user);
+    // load last user name
+    loadLastUser();
+
+    if (m_login.empty()) {
+        // get user name from config file
+        ptree default_user = root.get_child("userconfig.default");
+
+        int check_flag = 0;
+        BOOST_FOREACH (const ptree::value_type& child, default_user) {
+            if (0 != strcmp(child.first.data(), "user")) {
+                ICO_ERR("unknown element (%s)", child.first.data());
+            }
+
+            optional<string> name;
+            name = child.second.get_optional<string>("name");
+            if (false == name.is_initialized()) {
+                ICO_ERR("user.name element not found");
+                continue;
+            }
+            m_login = name.get();
+            check_flag++;
+        }
+
+        // default user name does not exist in the m_userList
+        if (check_flag == 0) {
+            vector<CicoSCUser*>::iterator itr;
+            itr = m_userList.begin();
+            const CicoSCUser* conf = const_cast<CicoSCUser*>(*itr);
+            m_login = conf->name;
+        }
     }
+
     // dump data
-    m_loginUser->dump();
+    ICO_DBG("login user name: %s", m_login.c_str());
 
-    ICO_DBG("CicoSCUserManager::setLoginUser Leave");
+    ICO_DBG("CicoSCUserManager::setLoginUser Leave(EOK)");
 }
 
 //--------------------------------------------------------------------------
 /**
  *  @brief  Create userlist
  *
- *  @param  [IN] root           pointer of ptree object
+ *  @param  [in] root           pointer of ptree object
  *  @return none
  */
 //--------------------------------------------------------------------------
@@ -507,6 +822,7 @@ CicoSCUserManager::createUserList(const ptree & root)
         optional<string> name;
         optional<string> passwd;
         optional<string> homescreen;
+        optional<string> autolaunch;
 
         name = child.second.get_optional<string>("name");
         if (false == name.is_initialized()) {
@@ -518,16 +834,21 @@ CicoSCUserManager::createUserList(const ptree & root)
             ICO_ERR("user.passwd element not found");
             continue;
         }
+        autolaunch = child.second.get_optional<string>("hs.<xmlattr>.autolaunch");
+        if (false == autolaunch.is_initialized()) {
+            autolaunch = optional<string>("true");
+        }
         homescreen = child.second.get_optional<string>("hs");
         if (false == homescreen.is_initialized()) {
             ICO_ERR("user.hs element not found");
             continue;
         }
 
-        CicoSCUser* userConf    = new CicoSCUser;
-        userConf->name          = name.get();
-        userConf->passwd        = passwd.get();
-        userConf->homescreen    = homescreen.get();
+        CicoSCUser* userConf = new CicoSCUser;
+        userConf->name       = name.get();
+        userConf->passwd     = passwd.get();
+        userConf->homescreen = homescreen.get();
+        userConf->autolaunch = (autolaunch.get().compare("false") == 0) ? false : true;
         // dump data
         userConf->dump();
 
@@ -535,14 +856,14 @@ CicoSCUserManager::createUserList(const ptree & root)
         m_userList.push_back(userConf);
     }
 
-    ICO_DBG("CicoSCUserManager::createUserList Leave");
+    ICO_DBG("CicoSCUserManager::createUserList Leave(EOK)");
 }
 
 //--------------------------------------------------------------------------
 /**
  *  @brief  Create homescreen list
  *
- *  @param  [IN] root           pointer of ptree object
+ *  @param  [in] root           pointer of ptree object
  *  @return none
  */
 //--------------------------------------------------------------------------
@@ -570,14 +891,89 @@ CicoSCUserManager::createHomeScreenList(const ptree & root)
     // dump data
     dumpHomeScreenList();
 
-    ICO_DBG("CicoSCUserManager::createHomeScreenList Leave");
+    ICO_DBG("CicoSCUserManager::createHomeScreenList Leave(EOK)");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Set last user information
+ *
+ *  @param  [in] appid          application id
+ *  @param  [in] info           application's last information
+ *  @return none
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCUserManager::setLastInfo(const string & appid, const string & info)
+{
+    ICO_DBG("CicoSCUserManager::setLastInfo Enter(appid: %s, info: %s)",
+            appid.c_str(), info.c_str());
+
+    CicoSCUser* loginUser = NULL;
+    CicoSCLastInfo* lastInfo = NULL;
+
+    // get login user object
+    loginUser = const_cast<CicoSCUser*>(findUserConfbyName(m_login));
+    // check login user
+    if (NULL == loginUser) {
+        // login user does not exist in the user list
+        ICO_DBG("CicoSCUserManager::setLastInfo Leave(ENXIO)");
+        return;
+    }
+
+    // check whether lastinfo object exists
+    vector<CicoSCLastInfo*>::iterator info_itr;
+    info_itr = loginUser->lastInfoList.begin();
+    for (; info_itr != loginUser->lastInfoList.end(); ++info_itr) {
+        CicoSCLastInfo *linfo = const_cast<CicoSCLastInfo*>(*info_itr);
+        if (appid == linfo->appid) {
+            lastInfo = linfo;
+            break;
+        }
+    }
+
+    if (NULL == lastInfo) {
+        // create new object
+        lastInfo = new CicoSCLastInfo;
+        // set application's information
+        lastInfo->appid = appid;
+        lastInfo->lastinfo = info;
+        // add to list
+        loginUser->lastInfoList.push_back(lastInfo);
+    }
+    else {
+        // update application's last information
+        lastInfo->lastinfo = info;
+    }
+
+    // check wheather directory exists
+    string info_dir =  m_parentDir + m_login + ICO_SYC_LASTINFO_DIR;
+    struct stat st;
+    int ret = stat(info_dir.c_str(), &st);
+    if (0 != ret) {
+        // make directory
+        mkdir(info_dir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
+    }
+
+    // output application's last information to file
+    std::ofstream stream;
+    string file = info_dir + lastInfo->appid + ".txt";
+    stream.open(file.c_str());
+    stream << lastInfo->lastinfo << std::endl;
+    stream.close();
+
+    // dump data
+    ICO_DBG("login user=%s", (loginUser->name).c_str());
+    lastInfo->dumpLastInfo();
+
+    ICO_DBG("CicoSCUserManager::setLastInfo Leave(EOK)");
 }
 
 //--------------------------------------------------------------------------
 /**
  *  @brief  Find user configuration by user name
  *
- *  @param  [IN] name           user name
+ *  @param  [in] name           user name
  *  @return pointer of CicoSCUser data on success, NULL on error
  */
 //--------------------------------------------------------------------------
@@ -586,22 +982,17 @@ CicoSCUserManager::findUserConfbyName(const string & name)
 {
     ICO_DBG("CicoSCUserManager::findUserConfbyName Enter (%s)", name.c_str());
 
-    if (name == m_defaultUser->name) {
-        ICO_DBG("CicoSCUserManager::findUserConfbyName Leave (defaultUser)");
-        return m_defaultUser;
-    }
-
     vector<CicoSCUser*>::iterator itr;
     itr = m_userList.begin();
     for (; itr != m_userList.end(); ++itr) {
         const CicoSCUser* conf = const_cast<CicoSCUser*>(*itr);
         if (name == conf->name) {
-            ICO_DBG("CicoSCUserManager::findUserConfbyName Leave");
+            ICO_DBG("CicoSCUserManager::findUserConfbyName Leave(EOK)");
             return conf;
         }
     }
 
-    ICO_ERR("CicoSCUserManager::findUserConfbyName Leave (NOT find)");
+    ICO_ERR("CicoSCUserManager::findUserConfbyName Leave(ENXIO)");
     return NULL;
 }
 // vim:set expandtab ts=4 sw=4:
index 755165d..4e8f3f1 100644 (file)
@@ -7,28 +7,31 @@
  *
  */
 
+//==========================================================================
 /**
- * @brief   CicoSCUserManager.h
+ *  @file   CicoSCUserManager.h
  *
- * @date    Aug-21-2013
+ *  @brief  This file is definition of CicoSCUserManager class
  */
-
+//==========================================================================
 #ifndef __CICO_SC_USER_MANAGER_H__
 #define __CICO_SC_USER_MANAGER_H__
 
-#include <boost/property_tree/ptree.hpp>
-#include <boost/property_tree/xml_parser.hpp>
-#include <boost/foreach.hpp>
-
 #include <string.h>
 #include <vector>
-using namespace std;
-using namespace boost;
-using namespace boost::property_tree;
 
-#include    "CicoSCCommandParser.h"
-#include    "CicoSCUser.h"
+//==========================================================================
+//  Forward declaration
+//==========================================================================
+class CicoSCCommand;
+class CicoSCUser;
+class CicoSCUserConf;
 
+//==========================================================================
+/*
+ *  @brief  This class manages control of user and access to user information
+ */
+//==========================================================================
 class CicoSCUserManager
 {
 public:
@@ -39,19 +42,17 @@ public:
     void handleCommand(const CicoSCCommand * cmd);
 
     // load configuration file
-    int load(const string & confFile);
+    int load(const std::string & confFile);
     // initialize
     int initialize(void);
 
     // get information
-    const CicoSCUser* getDefaultUser(void);
-    const CicoSCUser* getLastUser(void);
     const CicoSCUser* getLoginUser(void);
     const vector<CicoSCUser*>& getUserList(void);
-    const vector<string>& getHomeScreenList(void);
+    const vector<std::string>& getHomeScreenList(void);
 
     // change user
-    void changeUser(const string & name, const string & passwd);
+    void changeUser(const std::string & name, const std::string & passwd);
 
     // dump log
     void dumpUserList(void);
@@ -67,31 +68,53 @@ private:
     // assignment operator
     CicoSCUserManager& operator=(const CicoSCUserManager &object);
 
-    // copy constoructor
+    // copy constructor
     CicoSCUserManager(const CicoSCUserManager &object);
 
     // callback
-    void userlistCB(const string & appid);
-
-    // set default user info from config file
-    void setDefaultUser(const ptree & root);
-    void setLastUser(const ptree & root);
-    void setLoginUser(const CicoSCUser * user);
+    void userlistCB(const std::string & appid);
+    void lastinfoCB(const std::string & appid);
+
+    // save last user name to file
+    void saveLastUser(void);
+    // load last user name from file
+    void loadLastUser(void);
+    // load last information from file
+    void loadLastInfo(void);
+
+    // set login user info from config file
+    void setLoginUser(const boost::property_tree::ptree & root);
     // create list from config file
-    void createUserList(const ptree & root);
-    void createHomeScreenList(const ptree & root);
+    void createUserList(const boost::property_tree::ptree & root);
+    void createHomeScreenList(const boost::property_tree::ptree & root);
+
+    // set application's last information
+    void setLastInfo(const std::string & appid, const std::string & info);
 
     // find user config by user name
-    const CicoSCUser* findUserConfbyName(const string & name);
+    const CicoSCUser* findUserConfbyName(const std::string & name);
+
+    // Imprinting to file, that file is application's running information 
+    bool impritingLastApps(const std::string& ofnm);
+
+    // Killing running application and homeScreen
+    bool killingAppsAndHS(const std::string& usrnm);
+
+    // working user directory make
+    void getWorkingDir(const std::string& usr, string& dir);
+
+    // launch homescreen request
+    bool launchHomescreenReq(const std::string& usr,
+                             const std::string& appid_hs);
 
 private:
-    static CicoSCUserManager*   ms_myInstance;  //!< CicoSCUserManager Object
+    static CicoSCUserManager*   ms_myInstance;  ///< CicoSCUserManager Object
 
-    CicoSCUser*                 m_defaultUser;      //!< Default User Info
-    CicoSCUser*                 m_lastUser;         //!< Last User Info
-    CicoSCUser*                 m_loginUser;        //!< Login User Info
-    vector<CicoSCUser*>         m_userList;         //!< User List
-    vector<string>              m_homescreenList;   //!< HomeScreen List
+    std::string                 m_login;           ///< Login User Name
+    std::vector<CicoSCUser*>    m_userList;        ///< User List
+    std::vector<std::string>    m_homescreenList;  ///< HomeScreen List
+    std::string                 m_parentDir;
+    const CicoSCUserConf*       m_uConfig;
 };
 #endif  // __CICO_SC_USER_MANAGER_H__
 // vim:set expandtab ts=4 sw=4:
index 0928285..771917c 100644 (file)
@@ -7,13 +7,13 @@
  *
  */
 
-/*========================================================================*/
+//==========================================================================    
 /**
  *  @file   CicoSCWayland.cpp
  *
- *  @brief  
+ *  @brief  This file implementation of CicoSCWayland class
  */
-/*========================================================================*/
+//==========================================================================    
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <signal.h>
 #include <errno.h>
-
-
 #include <sys/ioctl.h>
 #include <Ecore.h>
 
-#include <algorithm>
+#include <map>
+using namespace std;
+
+#include <wayland-client.h>
+#include <ico_window_mgr-client-protocol.h>
 
-#include "wayland-client.h"
-#include "ico_window_mgr-client-protocol.h"
 #include "CicoSCWayland.h"
 #include "CicoSCWlWinMgrIF.h"
 #include "CicoLog.h"
+#include "ico_syc_error.h"
 
+//==========================================================================    
+//  private static variable
+//==========================================================================    
 CicoSCWayland* CicoSCWayland::ms_myInstance = NULL;
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
 CicoSCWayland::CicoSCWayland()
     : m_wlDisplay(NULL),
-      m_wlOutput(NULL),
+      m_wlRegistry(NULL),
       m_wlFd(-1),
       m_ecoreFdHandler(NULL)
 {
+    // wayland callbacks
+    m_wlListener.global        = wlGlobalCB;
+    m_wlListener.global_remove = NULL;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
 CicoSCWayland::~CicoSCWayland()
 {
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get instance of CicoSCWayland
+ *
+ *  @return instance of CicoSCWayland
+ */
+//--------------------------------------------------------------------------
 CicoSCWayland*
 CicoSCWayland::getInstance(void)
 {
-       if (NULL == ms_myInstance) {
-               ms_myInstance = new CicoSCWayland();
-       }
+    if (NULL == ms_myInstance) {
+        ms_myInstance = new CicoSCWayland();
+    }
 
-       return ms_myInstance;
+    return ms_myInstance;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  initialize wayland connection
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ */
+//--------------------------------------------------------------------------
 int
 CicoSCWayland::intialize(void)
 {
-    ICO_DBG("CicoSCWayland::initialize: Enter");
-    // 
+    ICO_DBG("CicoSCWayland::initialize Enter");
     for (int i = 0; i < (5000/50); ++i)  {
         m_wlDisplay = wl_display_connect(NULL);
         if (NULL != m_wlDisplay) {
@@ -73,107 +103,165 @@ CicoSCWayland::intialize(void)
 
     if (NULL == m_wlDisplay) {
         ICO_ERR("wl_display_connect failed.");
-        return -1; /* TODO */
+        ICO_ERR("CicoSCWayland::initialize Leave(EIO)");
+        return ICO_SYC_EIO;
     }
 
+    ICO_DBG("called: wl_display_get_registry(wlDisplay=0x%08x)", m_wlDisplay);
     m_wlRegistry = wl_display_get_registry(m_wlDisplay);
     if (NULL == m_wlRegistry) {
         ICO_ERR("wl_display_get_registry failed.");
-        return -1; /* TODO */
+        ICO_ERR("CicoSCWayland::initialize Leave(EIO)");
+        return ICO_SYC_EIO;
     }
 
-    // wayland callbacks
-    struct wl_registry_listener wlListener = {
-        .global        = wlGlobalCB,
-        .global_remove = NULL
-    };
-
     // add wayland global callbacks
-    wl_registry_add_listener(m_wlRegistry, &wlListener, this);
+    ICO_DBG("called: wl_registry_add_listener");
+    wl_registry_add_listener(m_wlRegistry, &m_wlListener, this);
 
-    // 
     int initCount = 0;
+    int ifcount = m_wlInterfaceList.size();
     for (int i = 0; i < (500/20); ++i) {
         initCount = 0;
         map<string, CicoSCWaylandIF*>::iterator itr;
         itr = m_wlInterfaceList.begin();
-        int ifcount = m_wlInterfaceList.size();
         for (; itr != m_wlInterfaceList.end(); ++itr) {
             if(true == itr->second->isInitialized()) {
                 initCount++;
             }
         }
         if (ifcount == initCount) {
-            ICO_DBG("initializ all OK");
             break;
         }
-        ICO_DBG("call wl_display_dispatch(%08x)", (int)m_wlDisplay);
+        ICO_DBG("called: wl_display_dispatch"
+                "(wlDisplay=0x%08x)", (int)m_wlDisplay);
         wl_display_dispatch(m_wlDisplay);
         usleep(20*1000);
     }
 
+    if (ifcount != initCount) {
+        ICO_DBG("initialize interface time up NG");
+        ICO_ERR("CicoSCWayland::initialize Leave(EIO)");
+        return ICO_SYC_EIO;
+    }
+    else {
+        ICO_DBG("initialize interface all OK");
+    }
+
     // flush display 
+    ICO_DBG("called: wl_display_flush(wlDisplay=0x%08x)", (int)m_wlDisplay);
     wl_display_flush(m_wlDisplay);
 
-    // 
-    ICO_DBG("call wl_display_get_fd(%08x)", (int)m_wlDisplay);
+    ICO_DBG("called: wl_display_get_fd(wlDisplay=0x%08x)", (int)m_wlDisplay);
     m_wlFd = wl_display_get_fd(m_wlDisplay);
-    ICO_DBG("CicoSCWayland::initialize: Wayland/Weston fd(%d)", m_wlFd);
+    ICO_DBG("CicoSCWayland::initialize: Wayland/Weston fd=%d", m_wlFd);
 
     ICO_DBG("CicoSCWayland::initialize: Wayland/Weston connect OK");
 
-
-    ICO_DBG("CicoSCWayland::initialize: Leave");
-    return 0; // TODO
+    ICO_DBG("CicoSCWayland::initialize: Leave(EOK)");
+    return ICO_SYC_EOK;
 }
 
-void CicoSCWayland::flushDisplay(void)
+//--------------------------------------------------------------------------
+/**
+ *  @brief  flush display
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWayland::flushDisplay(void)
 {
     if (NULL == m_wlDisplay) {
+        ICO_ERR("wlDisplay == NULL");
         return;
     }
-    ICO_DBG("call wl_display_flush(%08x)", (int)m_wlDisplay);
+    ICO_DBG("called: wl_display_flush(0x%08x)", (int)m_wlDisplay);
     wl_display_flush(m_wlDisplay);
 }
 
-void CicoSCWayland::dispatchDisplay(void)
+//--------------------------------------------------------------------------
+/**
+ *  @brief  dispatch display
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWayland::dispatchDisplay(void)
 {
     if (NULL == m_wlDisplay) {
+        ICO_ERR("wlDisplay == NULL");
         return;
     }
-    ICO_DBG("call wl_display_dispatch(%08x)", (int)m_wlDisplay);
+    ICO_DBG("call wl_display_dispatch(0x%08x)", (int)m_wlDisplay);
     wl_display_dispatch(m_wlDisplay);
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get wayland file destructor
+ *
+ *  @return wayland file destructor
+ */
+//--------------------------------------------------------------------------
 int CicoSCWayland::getWlFd(void)
 {
     return m_wlFd;
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  add wayland file destructor handler to ecore main 
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ *  @retval ICO_SYC_EIO ecore_main_fd_handler_add failed
+ */
+//--------------------------------------------------------------------------
 int
 CicoSCWayland::addEcoreMainWlFdHandler(void)
 {
-    ICO_DBG("waylandFdHandler: Enter");
+    ICO_DBG("CicoSCWayland::addEcoreMainWlFdHandler Enter");
+    ICO_DBG("called: ecore_main_fd_handler_add(fd=%d)", m_wlFd);
     m_ecoreFdHandler = ecore_main_fd_handler_add(m_wlFd, 
                                                  ECORE_FD_READ,
                                                  &waylandFdHandler,
-                                                 NULL, /* data */
+                                                 NULL,
                                                  NULL,
                                                  NULL);
+    if (NULL == m_ecoreFdHandler) {
+        ICO_ERR("ecore_main_fd_handler_add failed.");
+        ICO_DBG("CicoSCWayland::addEcoreMainWlFdHandler Leave(EIO)");
+        return ICO_SYC_EIO;
+    }
     ecore_main_loop_iterate();
     waylandFdHandler(NULL, m_ecoreFdHandler);
-    ICO_DBG("waylandFdHandler: Leave");
-    return 0;
-}
 
+    ICO_DBG("CicoSCWayland::addEcoreMainWlFdHandler Leave");
+    return ICO_SYC_EOK;
+}
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief   add wayland interface
+ *
+ *  @param [in] name        interface name
+ *  @param [in] interface   interface instance
+ */
+//--------------------------------------------------------------------------
 void
 CicoSCWayland::addWaylandIF(const char *name, CicoSCWaylandIF* interface)
 {
     m_wlInterfaceList[name] = interface;
 }
 
-/* wayland standard callback functions      */
+//--------------------------------------------------------------------------
+/**
+ *  @brief   wayland global callback
+ *
+ *  @param [in] data        user data(unused)
+ *  @param [in] registry    wayland registry
+ *  @param [in] name        wayland display Id(unused)
+ *  @param [in] interface   wayland interface name
+ *  @param [in] version     wayland interface version number(unused)
+ */
+//--------------------------------------------------------------------------
 void
 CicoSCWayland::globalCB(void *data,
                         struct wl_registry *registry,
@@ -181,8 +269,6 @@ CicoSCWayland::globalCB(void *data,
                         const char *interface,
                         uint32_t version)
 {
-//    ICO_DBG("globalCB: Enter(Event=%s DispId=%08x)", interface, name);
-
     map<string, CicoSCWaylandIF*>::iterator itr;
     itr = m_wlInterfaceList.find(interface);
 
@@ -196,21 +282,19 @@ CicoSCWayland::globalCB(void *data,
 
     // flush display 
     wl_display_flush(m_wlDisplay);
-//    ICO_DBG("globalCB: Leave");
 }
 
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 /**
- * @brief   ico_uxf_wayland_globalcb: wayland global callback(static function)
+ *  @brief   wayland global callback
  *
- * @param[in]   data            user data(unused)
- * @param[in]   registry        wayland registry
- * @param[in]   name            wayland display Id(unused)
- * @param[in]   interface       wayland interface name
- * @param[in]   version         wayland interface version number(unused)
- * @return      none
+ *  @param [in] data        user data(unused)
+ *  @param [in] registry    wayland registry
+ *  @param [in] name        wayland display Id(unused)
+ *  @param [in] interface   wayland interface name
+ *  @param [in] version     wayland interface version number(unused)
  */
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
 void
 CicoSCWayland::wlGlobalCB(void       *data,
                           struct     wl_registry *registry,
@@ -218,97 +302,25 @@ CicoSCWayland::wlGlobalCB(void       *data,
                           const char *interface,
                           uint32_t   version)
 {
-//    ICO_DBG("wlGlobalCB: Enter(Event=%s DispId=%08x)", interface, name);
-
     if (NULL == data) {
-        ICO_DBG("data is null");
+        ICO_ERR("data == NULL");
         return;
     }
 
     static_cast<CicoSCWayland*>(data)->globalCB(data, registry, name,
                                                 interface, version);
-
-//    ICO_DBG("wlGlobalCB : Leave");
 }
 
-#if 0
-void
-CicoSCWayland::wlOutputGeometrycb(void *data,
-                                  struct wl_output *wl_output,
-                                  int32_t x,
-                                  int32_t y,
-                                  int32_t physical_width,
-                                  int32_t physical_height,
-                                  int32_t subpixel,
-                                  const char *make,
-                                  const char *model,
-                                  int32_t transform)
-{
-    ICO_DBG("ico_uxf_output_geometrycb: Enter(x/y=%d/%d, pwidth/height=%d/%d, trans=%d)",
-               x, y, physical_width, physical_height, transform);
-
-    vector<CicoSCDisplay*>::iterator itr = 
-    find_if(m_displayList.begin(), m_displayList.end(), FindDisplay(wl_output));
-
-    if (m_displayList.end() == itr) {
-        return;
-    }
-
-    CicoSCDisplay* scDisplay = *itr;
-
-    if (NULL != scDisplay) {
-        if ((transform == WL_OUTPUT_TRANSFORM_90)
-            || (transform == WL_OUTPUT_TRANSFORM_270)
-            || (transform == WL_OUTPUT_TRANSFORM_FLIPPED_90)
-            || (transform == WL_OUTPUT_TRANSFORM_FLIPPED_270))  {
-            scDisplay->m_pWidth      = physical_height;
-            scDisplay->m_pHeight     = physical_width;
-            scDisplay->m_orientation = ICO_UXF_ORIENTATION_VERTICAL;
-        }
-        else {
-            scDisplay->m_pWidth      = physical_width;
-            scDisplay->m_pHeight     = physical_height;
-            scDisplay->m_orientation = ICO_UXF_ORIENTATION_HORIZONTAL;
-        }
-    }
-    ICO_DBG("ico_uxf_output_geometrycb: Leave");
-}
-
-void
-CicoSCWayland::wlOutputModecb(void *data,
-                              struct wl_output *wl_output,
-                              uint32_t flags,
-                              int32_t width,
-                              int32_t height,
-                              int32_t refresh)
-{
-    ICO_DBG("ico_uxf_output_modecb: Enter(flg=%d, width=%d, height=%d, ref=%d)",
-               flags, width, height, refresh);
-
-    
-    vector<CicoSCDisplay*>::iterator itr = 
-    find_if(m_displayList.begin(), m_displayList.end(), FindDisplay(wl_output));
-
-    if (m_displayList.end() == itr) {
-        return;
-    }
-
-    CicoSCDisplay* scDisplay = *itr;
-
-    if ((NULL != scDisplay) && (flags & WL_OUTPUT_MODE_CURRENT)) {
-        if (scDisplay->m_orientation == ICO_UXF_ORIENTATION_VERTICAL) {
-            scDisplay->m_pWidth  = height;
-            scDisplay->m_pHeight = width;
-        }
-        else {
-            scDisplay->m_pWidth  = width;
-            scDisplay->m_pHeight = height;
-        }
-    }
-    ICO_DBG("ico_uxf_output_modecb: Leave");
-}
-#endif
-
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wayland global callback
+ *
+ *  @param [in] data        user data
+ *  @param [in] handler     ecore file destructor handler
+ *
+ *  @return ECORE_CALLBACK_RENEW on retry , ECORE_CALLBACK_CANCEL on cancel
+ */
+//--------------------------------------------------------------------------
 Eina_Bool
 CicoSCWayland::waylandFdHandler(void *data, Ecore_Fd_Handler *handler)
 {
@@ -316,22 +328,20 @@ CicoSCWayland::waylandFdHandler(void *data, Ecore_Fd_Handler *handler)
 
     int arg = 0;
 
-    CicoSCWayland* scWayland = CicoSCWayland::getInstance();
-    
-    scWayland->flushDisplay();
+    CicoSCWayland::getInstance()->flushDisplay();
 
-    if (ioctl(scWayland->getWlFd(), FIONREAD, &arg) < 0)   {
-        ICO_WRN("ico_uxf_main_loop_iterate: ioclt(FIONREAD,) Error %d", errno);
+    if (ioctl(CicoSCWayland::getInstance()->getWlFd(), FIONREAD, &arg) < 0) {
+        ICO_WRN("ico_uxf_main_loop_iterate: ioclt(FIONREAD) Error %d", errno);
         arg = 0;
     }
 
     ICO_DBG("waylandFdHandler: arg(%d))", arg);
     if (arg > 0)   {
-        scWayland->dispatchDisplay();
+        CicoSCWayland::getInstance()->dispatchDisplay();
     }
 
-    scWayland->flushDisplay();
-    ICO_DBG("waylandFdHandler: Leave)");
-    return EINA_TRUE;
+    CicoSCWayland::getInstance()->flushDisplay();
+    ICO_DBG("waylandFdHandler: Leave");
+    return ECORE_CALLBACK_RENEW ;
 }
-/* vim:set expandtab ts=4 sw=4: */
+// vim:set expandtab ts=4 sw=4:
index 47818c6..d174687 100644 (file)
 /**
  *  @file   CicoSCWayland.h
  *
- *  @brief  
+ *  @brief  This file is definition of CicoSCWayland class
  */
 //==========================================================================
 #ifndef __CICO_SC_WAYLAND_H__
 #define __CICO_SC_WAYLAND_H__
 
-#include <vector>
+#include <string>
 #include <map>
-using namespace std;
 
 #include <Ecore.h>
 
 #include <wayland-client.h>
-#include <ico_window_mgr-client-protocol.h>
-#include "CicoSCDisplay.h"
 
+//==========================================================================
+//  Forward declaration
+//==========================================================================
 class CicoSCWaylandIF;
 
+//==========================================================================
+/*
+ *  @brief  This class controls wayland
+ */
+//==========================================================================
 class CicoSCWayland {
 public:
+    // get instance of CicoSCWayland
     static CicoSCWayland* getInstance();
 
+    // initialize wayland connection
     int intialize(void);
 
+    // flush display
     void flushDisplay(void);
+
+    // dispatch display
     void dispatchDisplay(void);
+
+    // get wayland file descriptor
     int getWlFd(void);
+
+    // app ecore main wayland file descriptor handler
     int addEcoreMainWlFdHandler(void);
+
+    // add wayland interface
     void addWaylandIF(const char *name, CicoSCWaylandIF* interface);
 
+    // waylnad file descriptor handler
     static Eina_Bool waylandFdHandler(void *data, Ecore_Fd_Handler *handler);
 
-    /* wayland standard callback functions      */
+    // wayland global callback function
     void globalCB(void *data,
                   struct wl_registry *registry,
                   uint32_t name,
@@ -51,6 +68,7 @@ public:
                   uint32_t version);
 
 private:
+    // wayland standard callback function
     static void wlGlobalCB(void       *data,
                            struct     wl_registry *registry,
                            uint32_t   name,
@@ -71,23 +89,26 @@ private:
     CicoSCWayland(const CicoSCWayland &object);
 
 private:
-    /* my instance */
+    /// my instance
     static CicoSCWayland *ms_myInstance;
 
-    /* Wayland's display                */
+    /// wayland's display
     struct wl_display *m_wlDisplay;
 
+    /// wayland's registry
     struct wl_registry *m_wlRegistry;
 
-    /* Wayland's output describes       */
-    struct wl_output *m_wlOutput;
-
-    /* Wayland's file descriptor        */
+    /// wayland's file descriptor
     int m_wlFd;
 
-    Ecore_Fd_Handler         *m_ecoreFdHandler;
+    /// ecore file descriptor handler
+    Ecore_Fd_Handler *m_ecoreFdHandler;
+
+    /// interface list
+    std::map<std::string, CicoSCWaylandIF*> m_wlInterfaceList;
 
-    map<string, CicoSCWaylandIF*> m_wlInterfaceList;
+    // wayland common callbacks
+    struct wl_registry_listener m_wlListener;
 };
-#endif // __CICO_SC_WAYLAND_H__
+#endif  // __CICO_SC_WAYLAND_H__
 // vim:set expandtab ts=4 sw=4:
index 71687b3..dd1d90e 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCWaylandIF.cpp
  *
- *  @brief  
+ *  @brief  This file implementation of CicoSCWaylandIF class
  */
 //==========================================================================
 
@@ -24,17 +24,38 @@ const char * CicoSCWaylandIF::ICO_WL_INPUT_MGR_CTRL_IF = "ico_input_mgr_control"
 const char * CicoSCWaylandIF::ICO_WL_EXINPUT_IF        = "ico_exinput";
 const char * CicoSCWaylandIF::ICO_WL_INPUT_MGR_DEV_IF  = "ico_input_mgr_device";
 const char * CicoSCWaylandIF::ICO_WL_OUTPUT_IF         = "wl_output";
-const char * CicoSCWaylandIF::ICO_WL_SHM_IF            = "wl_shm";
 
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
 CicoSCWaylandIF::CicoSCWaylandIF()
       : m_initialized(false)
 {
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
 CicoSCWaylandIF::~CicoSCWaylandIF()
 {
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ *
+ *  @param [in] date        user data
+ *  @param [in] registry    wayland registry
+ *  @param [in] name        wayland display id
+ *  @parma [in] interface   wayland interface name
+ *  @parma [in] version     wayland interface version number
+ */
+//--------------------------------------------------------------------------
 void
 CicoSCWaylandIF::initInterface(void               *data,
                                struct wl_registry *registry,
@@ -45,6 +66,15 @@ CicoSCWaylandIF::initInterface(void               *data,
     ICO_WRN("CicoSCWaylandIF::initInterface called.");
 }
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  inquire whether initialized
+ *
+ *  @return true on initialized, false no not initialized
+ *  @retval true    initialized
+ *  @retval false   not initialized
+ */
+//--------------------------------------------------------------------------
 bool
 CicoSCWaylandIF::isInitialized(void)
 {
index 898ac79..649bcf6 100644 (file)
 /**
  *  @file   CicoSCWaylandIF.h
  *
- *  @brief  
+ *  @brief  This file is definition of CicoSCWaylandIF class
  */
 //==========================================================================
 #ifndef __CICO_SC_WAYLAND_IF_H__
 #define __CICO_SC_WAYLAND_IF_H__
 
-#include <string>
 #include <wayland-client.h>
 
-using namespace std;
-
+//==========================================================================
+/*
+ *  @brief  This class is abstract class of wayland interface
+ */
+//==========================================================================
 class CicoSCWaylandIF {
 public:
-    // intialize interface
+    // initialize interface
     virtual void initInterface(void               *data,
                                struct wl_registry *registry,
                                uint32_t           name,
                                const char         *interface,
                                uint32_t           version);
+
+    // inquire whether initialized
     bool isInitialized(void);
 
 protected:
@@ -46,15 +50,19 @@ protected:
     CicoSCWaylandIF(const CicoSCWaylandIF &object);
 
 protected:
+    /// interface name of wayland multi window manager
     static const char * ICO_WL_WIN_MGR_IF;
+    /// interface name of wayland input manager control
     static const char * ICO_WL_INPUT_MGR_CTRL_IF;
+    /// interface name of wayland exinput 
     static const char * ICO_WL_EXINPUT_IF;
+    /// interface name of wayland input manager device
     static const char * ICO_WL_INPUT_MGR_DEV_IF;
+    /// interface name of wayland output
     static const char * ICO_WL_OUTPUT_IF;
-    static const char * ICO_WL_SHM_IF;
 
     // initialized flag
     bool m_initialized;
 };
-#endif // __CICO_SC_WAYLAND_IF_H__
+#endif  // __CICO_SC_WAYLAND_IF_H__
 // vim:set expandtab ts=4 sw=4:
index 8d7730b..cb6b6d7 100644 (file)
 /**
  *  @file   CicoSCWindow.h
  *
- *  @brief  
+ *  @brief  This file is implementation of CicoSCWindow class
  */
 //==========================================================================
 
+#include <string>
+using namespace std;
+
 #include "CicoSCWindow.h"
 #include "CicoLog.h"
 
  */
 //--------------------------------------------------------------------------
 CicoSCWindow::CicoSCWindow()
-    // TODO initialize variables
-    : nodeid(-1), displayid(-1), layerid(-1),
-      zoneid(-1), subwindow(0), eventmask(0), 
-      x(-1), y(-1), width(-1), height(-1),
+    : surfaceid(-1),name(""), appid(""), pid(-1),
+      nodeid(-1), displayid(-1), layerid(-1), zoneid(-1), subwindow(0),
+      eventmask(0), x(-1), y(-1), width(-1), height(-1),
       visible(false), raise(false), active(false)
 
 {
-    ICO_DBG("CicoSCWindow::CicoSCWindow Entry");
+    ICO_DBG("CicoSCWindow::CicoSCWindow Enter");
     ICO_DBG("CicoSCWindow::CicoSCWindow Leave");
 }
 
@@ -42,19 +44,19 @@ CicoSCWindow::CicoSCWindow()
 //--------------------------------------------------------------------------
 CicoSCWindow::~CicoSCWindow()
 {
-    ICO_DBG("CicoSCWindow::~CicoSCWindow Entry");
+    ICO_DBG("CicoSCWindow::~CicoSCWindow Enter");
     ICO_DBG("CicoSCWindow::~CicoSCWindow Leave");
 }
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  dump log CicoSCWindow member variables
+ *  @brief  dump log this class member variables
  */
 //--------------------------------------------------------------------------
 void
 CicoSCWindow::dump(void)
 {
-    ICO_DBG("CicoSCWindow: surfaceid=%d name=%s appid=%s pid=%d "
+    ICO_DBG("CicoSCWindow: surfaceid=0x%08X name=%s appid=%s pid=%d "
             "nodeid=%d displayid=%d layerid=%d zoneid=%d "
             "subwindow=%d eventmask=%d x=%d y=%d width=%d height=%d "
             "visible=%s raise=%s active=%s",
index 1702a31..41ffa79 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCWindow.h
  *
- *  @brief  
+ *  @brief  This file is definition of CicoSCWindow class
  */
 //==========================================================================
 #ifndef __CICO_SC_WINDOW_H__
 
 #include <string>
 
-using namespace std;
-
-//==========================================================================
-//  Forward declaration
-//==========================================================================
-class CicoSCDisplay;
-class CicoSCLayer;
-class CicoSCApplication;
-
 //==========================================================================
 //  define macro
 //==========================================================================
 #define ICO_SURFACEID_2_HOSTID(surfid)      (((unsigned int)surfid) >> 24)
-#define ICO_SURFACEID_2_DISPLAYNO(surfid)   (((unsigned int)surfid) >> 16) 
+#define ICO_SURFACEID_2_DISPLAYNO(surfid)   (((unsigned int)surfid) >> 16)
 #define ICO_SURFACEID_2_NODEID(surfid)      (((unsigned int)surfid) >> 16)
 #define ICO_SURFACEID_BASE(nodeid)          (((unsigned int)nodeid) << 16)
 
 //--------------------------------------------------------------------------
 /**
- *  @brief window information class
+ *  @brief This class holds window information
  */
 //--------------------------------------------------------------------------
 class CicoSCWindow
@@ -61,32 +52,24 @@ private:
     CicoSCWindow(const CicoSCWindow &object);
 
 public:
-    CicoSCDisplay     *m_display;       //!< display local cache
-    CicoSCLayer       *m_layer;         //!< layer local cache
-    CicoSCApplication *m_application;   //!< process local cache
-    CicoSCWindow      *m_parent;        //!< parent window
-
-    short             state;            //!< Window status
-    unsigned char     request;          //!< Request
-
-    int               surfaceid;        //!< sruface id (window id)
-    string            name;             //!< wondow name
-    string            appid;            //!< application id
-    int               pid;              //!< process id
+    int               surfaceid;    ///< surface id (window id)
+    std::string       name;         ///< window name
+    std::string       appid;        ///< application id
+    int               pid;          ///< process id
 
-    int               nodeid;           //!< node id
-    int               displayid;        //!< display id
-    int               layerid;          //!< layer id
-    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;                //!< Upperleft 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
-    bool              raise;            //!< raise/lower
-    bool              active;           //!  active/inactive
+    int               nodeid;       ///< node id
+    int               displayid;    ///< display id
+    int               layerid;      ///< layer id
+    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
+    int               width;        ///< width of window
+    int               height;       ///< height of window
+    bool              visible;      ///< visibility
+    bool              raise;        ///< raise/lower
+    bool              active;       ///< active/inactive
 };
-#endif // __CICO_SC_WINDOW_H__
+#endif  // __CICO_SC_WINDOW_H__
 // vim:set expandtab ts=4 sw=4:
index 55c8032..2817a97 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCWindowController.cpp
  *
- *  @brief  
+ *  @brief  This file implementation of CicoSCWindowController class
  */
 //==========================================================================
 
@@ -38,7 +38,7 @@ using namespace std;
 #include "CicoSCLayer.h"
 #include "CicoSCDisplayZone.h"
 #include "ico_syc_error.h"
-#include "CicoSCCommandParser.h"
+#include "CicoSCCommand.h"
 #include "ico_syc_msg_cmd_def.h"
 #include "CicoSCServer.h"
 #include "CicoSCMessage.h"
@@ -56,7 +56,6 @@ CicoSCWindowController::CicoSCWindowController()
     CicoSCWayland* wayland = CicoSCWayland::getInstance();
     wayland->getInstance()->addWaylandIF(ICO_WL_WIN_MGR_IF, this);
     wayland->getInstance()->addWaylandIF(ICO_WL_OUTPUT_IF, this);
-    wayland->getInstance()->addWaylandIF(ICO_WL_SHM_IF, this);
     initDB();
 }
 
@@ -84,44 +83,39 @@ CicoSCWindowController::initDB(void)
     vector<CicoSCDisplayConf*>::const_iterator itr;
     itr = displayList.begin();
     for (; itr != displayList.end(); ++itr) {
-        const CicoSCDisplayConf *dconf = const_cast<CicoSCDisplayConf*>(*itr);
         CicoSCDisplay *display = new CicoSCDisplay();
-
-        display->displayid = dconf->id;
-        display->type      = dconf->type;
-        display->nodeid    = dconf->node;
-        display->displayno = dconf->no;
-        display->width     = dconf->width;
-        display->height    = dconf->height;
-        display->inch      = dconf->inch;
-        display->name      = dconf->name;
+        display->displayid = (*itr)->id;
+        display->type      = (*itr)->type;
+        display->nodeid    = (*itr)->node;
+        display->displayno = (*itr)->no;
+        display->width     = (*itr)->width;
+        display->height    = (*itr)->height;
+        display->inch      = (*itr)->inch;
+        display->name      = (*itr)->name;
 
         vector<CicoSCLayerConf*>::const_iterator itr2;
-        itr2 = dconf->layerConfList.begin();
-        for (; itr2 != dconf->layerConfList.end(); ++itr2) {
-            const CicoSCLayerConf *lconf = const_cast<CicoSCLayerConf*>(*itr2);
-
+        itr2 = (*itr)->layerConfList.begin();
+        for (; itr2 != (*itr)->layerConfList.end(); ++itr2) {
             CicoSCLayer *layer = new CicoSCLayer();
-            layer->layerid     = lconf->id;
-            layer->type        = lconf->type;
+            layer->layerid     = (*itr2)->id;
+            layer->type        = (*itr2)->type;
             layer->width       = display->width;
             layer->height      = display->height;
             layer->displayid   = display->displayid;
-            layer->menuoverlap = lconf->menuoverlap;
+            layer->menuoverlap = (*itr2)->menuoverlap;
             display->layerList.push_back(layer);
         }
 
         vector<CicoSCDisplayZoneConf*>::const_iterator itr3;
-        itr3 = dconf->zoneConfList.begin();
-        for (; itr3 != dconf->zoneConfList.end(); ++itr3) {
-//            const CicoSCDisplayZoneConf *dzconf = const_cast<CicoSCLayerConf*>(*itr2);
-
+        itr3 = (*itr)->zoneConfList.begin();
+        for (; itr3 != (*itr)->zoneConfList.end(); ++itr3) {
             CicoSCDisplayZone *zone = new CicoSCDisplayZone();
-            zone->zoneid = (*itr3)->id;
-            zone->x      = (*itr3)->x;
-            zone->y      = (*itr3)->y;
-            zone->width  = (*itr3)->w;
-            zone->height = (*itr3)->h;
+            zone->zoneid   = (*itr3)->id;
+            zone->x        = (*itr3)->x;
+            zone->y        = (*itr3)->y;
+            zone->width    = (*itr3)->w;
+            zone->height   = (*itr3)->h;
+            zone->fullname = (*itr3)->fullname;
             display->zoneList.push_back(zone);
         }
         display->dump();
@@ -168,10 +162,10 @@ CicoSCWindowController::show(int        surfaceid,
                              int        animationTime)
 {
     ICO_DBG("CicoSCWindowController::show Enter"
-            "(surfaceid=%08X animation=%s animationTime=%d)",
+            "(surfaceid=0x%08X animation=%s animationTime=%d)",
             surfaceid, animation, animationTime);
 
-    // find window infomation in window list
+    // find window information in window list
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
         ICO_WRN("CicoSCWindowController::show Leave(ENOENT)");
@@ -183,32 +177,26 @@ CicoSCWindowController::show(int        surfaceid,
 
     // set animation request to Multi Window Manager
     int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
-    int raiseFlag = ICO_WINDOW_MGR_RAISE_RAISE;
+    int raiseFlag = ICO_WINDOW_MGR_V_NOCHANGE;
     if ((NULL != animation) && (animation[0] != '\0')) {
-        ICO_DBG("ico_window_mgr_set_animation"
-                "(surface=0x%08X type=%d anima=%s time=%d)",
-                window->surfaceid,
-                ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW,
-                animation, animationTime);
-        ico_window_mgr_set_animation(m_winmgr,
-                                     window->surfaceid,
-                                     ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW,
-                                     animation,
-                                     animationTime);
+        // set animation request to Multi Window Manager
+        CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
+                                       ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW,
+                                       animation, animationTime);
         animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
-        raiseFlag = ICO_WINDOW_MGR_V_NOCHANGE;
+    }
+    else {
+        if (false == window->raise) {
+            raiseFlag = ICO_WINDOW_MGR_RAISE_RAISE;
+            // update visible raise
+            window->raise = true;
+        }
     }
 
-    // show request to Multi Window Manager
-    ICO_DBG("ico_window_mgr_set_visible called."
-            "(surfaceid=0x%08X visible=%d raise=%d anima=%d",
-            window->surfaceid, ICO_WINDOW_MGR_VISIBLE_SHOW,
-            raiseFlag, animaFlag);
-    ico_window_mgr_set_visible(m_winmgr,
-                               window->surfaceid,
-                               ICO_WINDOW_MGR_VISIBLE_SHOW,
-                               raiseFlag,
-                               animaFlag);
+    // set visible request to Multi Window Manager
+    CicoSCWlWinMgrIF::setVisible(window->surfaceid,
+                                 ICO_WINDOW_MGR_VISIBLE_SHOW,
+                                 raiseFlag, animaFlag);
 
     // flush display 
     CicoSCWayland::getInstance()->flushDisplay();
@@ -237,10 +225,10 @@ CicoSCWindowController::hide(int        surfaceid,
                              int        animationTime)
 {
     ICO_DBG("CicoSCWindowController::hide Enter"
-            "(surfaceid=%08X animation=%s animationTime=%d)",
+            "(surfaceid=0x%08X animation=%s animationTime=%d)",
             surfaceid, animation, animationTime);
 
-    // find window infomation in window list
+    // find window information in window list
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
         ICO_WRN("CicoSCWindowController::hide Leave(ENOENT)");
@@ -253,20 +241,16 @@ CicoSCWindowController::hide(int        surfaceid,
     // set animation request to Multi Window Manager
     int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
     if ((NULL != animation) && (animation[0] != '\0')) {
-        ico_window_mgr_set_animation(m_winmgr,
-                                     window->surfaceid,
-                                     ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE,
-                                     animation,
-                                     animationTime);
+        CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
+                                       ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE,
+                                       animation, animationTime);
         animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
     }
 
-    // show request to Multi Window Manager
-    ico_window_mgr_set_visible(m_winmgr,
-                               window->surfaceid,
-                               ICO_WINDOW_MGR_VISIBLE_HIDE,
-                               ICO_WINDOW_MGR_V_NOCHANGE,
-                               animaFlag);
+    // set visible request to Multi Window Manager
+    CicoSCWlWinMgrIF::setVisible(window->surfaceid,
+                                    ICO_WINDOW_MGR_VISIBLE_HIDE,
+                                    ICO_WINDOW_MGR_V_NOCHANGE, animaFlag);
 
     // flush display 
     CicoSCWayland::getInstance()->flushDisplay();
@@ -299,10 +283,10 @@ CicoSCWindowController::resize(int        surfaceid,
                                int        animationTime)
 {
     ICO_DBG("CicoSCWindowController::resize Enter"
-            "(surfaceid=%08X h=%d w=%d animation=%s animationTime=%d)",
+            "(surfaceid=0x%08X h=%d w=%d animation=%s animationTime=%d)",
             surfaceid, w, h, animation, animationTime);
 
-    // find window infomation in window list
+    // find window information in window list
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
         ICO_WRN("CicoSCWindowController::resize Leave(ENOENT)");
@@ -312,23 +296,17 @@ CicoSCWindowController::resize(int        surfaceid,
     // set animation request to Multi Window Manager
     int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
     if ((NULL != animation) && (animation[0] != '\0')) {
-        ico_window_mgr_set_animation(m_winmgr,
-                                     window->surfaceid,
-                                     ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE,
-                                     animation,
-                                     animationTime);
+        CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
+                                       ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE,
+                                       animation, animationTime);
         animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
     }
 
     // set visible request to Multi Window Manager
-    ico_window_mgr_set_positionsize(m_winmgr,
-                                    window->surfaceid,
-                                    0, //ICO_WINDOW_MGR_V_NOCHANGE,
-                                    ICO_WINDOW_MGR_V_NOCHANGE,
-                                    ICO_WINDOW_MGR_V_NOCHANGE,
-                                    w,
-                                    h,
-                                    animaFlag);
+    CicoSCWlWinMgrIF::setPositionsize(window->surfaceid, window->nodeid,
+                                      ICO_WINDOW_MGR_V_NOCHANGE,
+                                      ICO_WINDOW_MGR_V_NOCHANGE,
+                                      w, h, animaFlag);
 
     // flush display 
     CicoSCWayland::getInstance()->flushDisplay();
@@ -363,11 +341,11 @@ CicoSCWindowController::move(int        surfaceid,
                              int        animationTime)
 {
     ICO_DBG("CicoSCWindowController::move Enter"
-            "(surfaceid=%08X nodeid=%d x=%d y=%d "
+            "(surfaceid=0x%08X nodeid=%d x=%d y=%d "
             "animation=%s animationTime=%d)",
             surfaceid, nodeid, x, y, animation, animationTime);
 
-    // find window infomation in window list
+    // find window information in window list
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
         ICO_WRN("CicoSCWindowController::move Leave(ENOENT)");
@@ -377,28 +355,23 @@ CicoSCWindowController::move(int        surfaceid,
     // set animation request to Multi Window Manager
     int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
     if ((NULL != animation) && (animation[0] != '\0')) {
-        ico_window_mgr_set_animation(m_winmgr,
-                                     window->surfaceid,
-                                     ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE,
-                                     animation,
-                                     animationTime);
+        CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
+                                       ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE,
+                                       animation, animationTime);
         animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
     }
 
     int moveNodeId = ICO_WINDOW_MGR_V_NOCHANGE;
-    if (nodeid >= 0) {
+    if ((nodeid >= 0) && (nodeid != INT_MAX)) {
         moveNodeId = nodeid;
     }
 
     // set visible request to Multi Window Manager
-    ico_window_mgr_set_positionsize(m_winmgr,
-                                    window->surfaceid,
-                                    moveNodeId,
-                                    x,
-                                    y,
-                                    ICO_WINDOW_MGR_V_NOCHANGE,
-                                    ICO_WINDOW_MGR_V_NOCHANGE,
-                                    animaFlag);
+    CicoSCWlWinMgrIF::setPositionsize(window->surfaceid,
+                                      moveNodeId, x, y,
+                                      ICO_WINDOW_MGR_V_NOCHANGE,
+                                      ICO_WINDOW_MGR_V_NOCHANGE,
+                                      animaFlag);
 
     // flush display 
     CicoSCWayland::getInstance()->flushDisplay();
@@ -427,10 +400,10 @@ CicoSCWindowController::raise(int        surfaceid,
                               int        animationTime)
 {
     ICO_DBG("CicoSCWindowController::raise Enter"
-            "(surfaceid=%08X animation=%s animationTime=%d)",
+            "(surfaceid=0x%08X animation=%s animationTime=%d)",
             surfaceid, animation, animationTime);
 
-    // find window infomation in window list
+    // find window information in window list
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
         ICO_WRN("CicoSCWindowController::raise Leave(ENOENT)");
@@ -443,20 +416,16 @@ CicoSCWindowController::raise(int        surfaceid,
     // set animation request to Multi Window Manager
     int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
     if ((NULL != animation) && (animation[0] != '\0')) {
-        ico_window_mgr_set_animation(m_winmgr,
-                                     window->surfaceid,
-                                     ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW,
-                                     animation,
-                                     animationTime);
+        CicoSCWindowController::setAnimation(window->surfaceid,
+                                             ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW,
+                                             animation, animationTime);
         animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
     }
 
     // set visible request to Multi Window Manager
-    ico_window_mgr_set_visible(m_winmgr,
-                               window->surfaceid,
-                               ICO_WINDOW_MGR_V_NOCHANGE,
-                               ICO_WINDOW_MGR_RAISE_RAISE,
-                               animaFlag);
+    CicoSCWlWinMgrIF::setVisible(window->surfaceid,
+                                 ICO_WINDOW_MGR_V_NOCHANGE,
+                                 ICO_WINDOW_MGR_RAISE_RAISE, animaFlag);
 
     // flush display 
     CicoSCWayland::getInstance()->flushDisplay();
@@ -506,7 +475,7 @@ CicoSCWindowController::setGeometry(int        surfaceid,
             resizeAnimation, resizeAnimationTime,
             moveAnimation, moveAnimationTime);
 
-    // find window infomation in window list
+    // find window information in window list
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
         ICO_WRN("CicoSCWindowController::setGeometry Leave(ENOENT)");
@@ -514,27 +483,23 @@ CicoSCWindowController::setGeometry(int        surfaceid,
     }
 
     // set animation request to Multi Window Manager
-    int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
+    const char *animation = "";
     if (NULL != resizeAnimation) {
-        ico_window_mgr_set_animation(m_winmgr,
-                                     window->surfaceid,
-                                     ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE,
-                                     resizeAnimation,
-                                     resizeAnimationTime);
-        animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
+        animation = resizeAnimation;
     }
+    CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
+                                   ICO_WINDOW_MGR_ANIMATION_TYPE_RESIZE,
+                                   animation, resizeAnimationTime);
 
     if (NULL != moveAnimation) {
-        ico_window_mgr_set_animation(m_winmgr,
-                                     window->surfaceid,
-                                     ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE,
-                                     moveAnimation,
-                                     moveAnimationTime);
-        animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
+        animation = moveAnimation;
     }
+    CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
+                                   ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE,
+                                   animation, moveAnimationTime);
 
     int moveNodeId = ICO_WINDOW_MGR_V_NOCHANGE;
-    if (nodeid >= 0) {
+    if ((nodeid >= 0) && (nodeid != INT_MAX)) {
         moveNodeId = nodeid;
     }
     else {
@@ -542,17 +507,9 @@ CicoSCWindowController::setGeometry(int        surfaceid,
     }
 
     // set visible request to Multi Window Manager
-    ICO_DBG("ico_window_mgr_set_positionsize"
-            "(surfaceid=0x%08X nodeid=%d x=%d y=%d w=%d h=%d anima=%d)",
-            window->surfaceid, moveNodeId, x, y, w, h, animaFlag);
-    ico_window_mgr_set_positionsize(m_winmgr,
-                                    window->surfaceid,
-                                    moveNodeId,
-                                    x,
-                                    y,
-                                    w,
-                                    h,
-                                    animaFlag);
+    CicoSCWlWinMgrIF::setPositionsize(window->surfaceid, moveNodeId,
+                                      x, y, w, h,
+                                      ICO_WINDOW_MGR_FLAGS_ANIMATION);
 
     // flush display 
     CicoSCWayland::getInstance()->flushDisplay();
@@ -561,7 +518,6 @@ CicoSCWindowController::setGeometry(int        surfaceid,
     return ICO_SYC_EOK;
 }
 
-
 //--------------------------------------------------------------------------
 /**
  *  @brief  lower window(surface)
@@ -582,10 +538,10 @@ CicoSCWindowController::lower(int        surfaceid,
                               int        animationTime)
 {
     ICO_DBG("CicoSCWindowController::lower Enter"
-            "(surfaceid=%08X animation=%s animationTime=%d)",
+            "(surfaceid=0x%08X animation=%s animationTime=%d)",
             surfaceid, animation, animationTime);
 
-    // find window infomation in window list
+    // find window information in window list
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
         ICO_WRN("CicoSCWindowController::lower Leave(ENOENT)");
@@ -598,20 +554,15 @@ CicoSCWindowController::lower(int        surfaceid,
     // set animation request to Multi Window Manager
     int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
     if ((NULL != animation) && (animation[0] != '\0')) {
-        ico_window_mgr_set_animation(m_winmgr,
-                                     window->surfaceid,
-                                     ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE,
-                                     animation,
-                                     animationTime);
+        CicoSCWlWinMgrIF::setAnimation(window->surfaceid,
+                                       ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE,
+                                       animation, animationTime);
         animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
     }
 
     // set visible request to Multi Window Manager
-    ico_window_mgr_set_visible(m_winmgr,
-                               window->surfaceid,
-                               ICO_WINDOW_MGR_V_NOCHANGE,
-                               ICO_WINDOW_MGR_RAISE_LOWER,
-                               animaFlag);
+    CicoSCWlWinMgrIF::setVisible(window->surfaceid, ICO_WINDOW_MGR_V_NOCHANGE,
+                                 ICO_WINDOW_MGR_RAISE_LOWER, animaFlag);
 
     // flush display 
     CicoSCWayland::getInstance()->flushDisplay();
@@ -637,16 +588,16 @@ int
 CicoSCWindowController::setWindowLayer(int surfaceid, int layerid)
 {
     ICO_DBG("CicoSCWindowController::setWindowLayer Enter"
-            "(surfaceid=%08X layerid=%d)", surfaceid, layerid);
+            "(surfaceid=0x%08X layerid=%d)", surfaceid, layerid);
 
-    // find window infomation in window list
+    // find window information in window list
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
         ICO_WRN("CicoSCWindowController::setWindowLayer Leave(ENOENT)");
         return ICO_SYC_ENOENT;
     }
 
-    // find layer infomation in layer list
+    // find layer information in layer list
     CicoSCLayer* layer = findLayer(window->displayid, layerid);
     if (NULL == layer) {
         ICO_WRN("CicoSCWindowController::setWindowLayer Leave(ENOENT)");
@@ -657,12 +608,7 @@ CicoSCWindowController::setWindowLayer(int surfaceid, int layerid)
     window->layerid = layerid;
 
     // set window layer request to Multi Window Manager
-    ICO_DBG("ico_window_mgr_set_window_layer called."
-            "surfaceid=0x%08X layerid=%d",
-            window->surfaceid, window->layerid);
-    ico_window_mgr_set_window_layer(m_winmgr,
-                                    window->surfaceid,
-                                    window->layerid);
+    CicoSCWlWinMgrIF::setWindowLayer(window->surfaceid, window->layerid);
 
     // flush display 
     CicoSCWayland::getInstance()->flushDisplay();
@@ -688,16 +634,16 @@ int
 CicoSCWindowController::showLayer(int displayid, int layerid)
 {
     ICO_DBG("CicoSCWindowController::showLayer Enter"
-            "displayid=%d layerid=%d)", displayid, layerid);
+            "(displayid=%d layerid=%d)", displayid, layerid);
 
-    // find layer infomation in layer list
+    // find layer information in layer list
     CicoSCLayer* layer = findLayer(displayid, layerid);
     if (NULL == layer) {
         ICO_WRN("CicoSCWindowController::showLayer Leave(ENOENT)");
         return ICO_SYC_ENOENT;
     }
 
-    setLayerVisible(layerid, ICO_WINDOW_MGR_VISIBLE_SHOW);
+    CicoSCWlWinMgrIF::setLayerVisible(layerid, ICO_WINDOW_MGR_VISIBLE_SHOW);
 
     // flush display 
     CicoSCWayland::getInstance()->flushDisplay();
@@ -726,14 +672,14 @@ CicoSCWindowController::hideLayer(int displayid, int layerid)
             "displayid=%d layerid=%d)",
             displayid, layerid);
 
-    // find layer infomation in layer list
+    // find layer information in layer list
     CicoSCLayer* layer = findLayer(displayid, layerid);
     if (NULL == layer) {
         ICO_WRN("CicoSCWindowController::hideLayer Leave(ENOENT)");
         return ICO_SYC_ENOENT;
     }
 
-    setLayerVisible(layerid, ICO_WINDOW_MGR_VISIBLE_HIDE);
+    CicoSCWlWinMgrIF::setLayerVisible(layerid, ICO_WINDOW_MGR_VISIBLE_HIDE);
 
     // flush display 
     CicoSCWayland::getInstance()->flushDisplay();
@@ -744,25 +690,6 @@ CicoSCWindowController::hideLayer(int displayid, int layerid)
 
 //--------------------------------------------------------------------------
 /**
- *  @brief   control layer visibility
- *
- *  @param [in] layerid     layer id
- *  @param [in] visible     layer show
- *                          ICO_WINDOW_MGR_VISIBLE_SHOW
- *                          ICO_WINDOW_MGR_VISIBLE_HIDE
- */
-//--------------------------------------------------------------------------
-void
-CicoSCWindowController::setLayerVisible(int layerid, int visible)
-{
-    // set layer visible request to Multi Window Manager
-    ICO_DBG("ico_window_mgr_set_layer_visible(%d,%d) called.",
-            layerid, visible);
-    ico_window_mgr_set_layer_visible(m_winmgr, layerid, visible);
-}
-
-//--------------------------------------------------------------------------
-/**
  *  @brief   active window(surface)
  *
  *  @param [in] surfaceid   wayland surface id
@@ -785,9 +712,9 @@ CicoSCWindowController::active(int surfaceid, int target)
 #endif
 
     ICO_DBG("CicoSCWindowController::active Enter"
-            "(surfaceid=%08X, target=%08X)", surfaceid, target);
+            "(surfaceid=0x%08X, target=%08X)", surfaceid, target);
 
-    // find window infomation in window list
+    // find window information in window list
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
         ICO_WRN("CicoSCWindowController::active Leave(ENOENT)");
@@ -800,14 +727,22 @@ CicoSCWindowController::active(int surfaceid, int target)
                  ICO_WINDOW_MGR_ACTIVE_SELECTED;
     }
 
-    ICO_DBG("ico_window_mgr_set_active(0x%08X, %d) called.",
-            surfaceid, target);
     // set active request to Multi Window Manager
-    ico_window_mgr_set_active(m_winmgr, window->surfaceid, target);
+    CicoSCWlWinMgrIF::setActive(window->surfaceid, target);
+
+    // TODO
+    // set visible request to Multi Window Manager
+    CicoSCWlWinMgrIF::setVisible(window->surfaceid,
+                                 ICO_WINDOW_MGR_V_NOCHANGE,
+                                 ICO_WINDOW_MGR_RAISE_RAISE,
+                                 ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE);
 
     // flush display 
     CicoSCWayland::getInstance()->flushDisplay();
 
+    // update visible attr
+    window->raise = true;
+
     // update active window
     map<unsigned int, CicoSCWindow*>::iterator itr;
     itr = m_windowList.begin();
@@ -859,6 +794,7 @@ CicoSCWindowController::active(int surfaceid, int target)
  *  @brief   map surface
  *
  *  @param [in] surfaceid   wayland surface id
+ *  @param [in] framerate   surface change frame rate(frames par sec)
  *
  *  @return ICO_SYC_EOK on success, other on error
  *  @retval ICO_SYC_EOK     success
@@ -871,20 +807,19 @@ CicoSCWindowController::mapSurface(int surfaceid, int framerate)
 {
     ICO_WRN("CicoSCWindowController::mapSurface Enter");
 
-    // find window infomation in window list
+    // find window information in window list
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
         ICO_WRN("CicoSCWindowController::mapSurface Leave(ENOENT)");
         return ICO_SYC_ENOENT;
     }
 
-    if (framerate <= 0) {
-        framerate = 15;
+    if (framerate < 0) {
+        framerate = 0;
     }
 
-    ICO_DBG("ico_window_mgr_map_surface(%d, %d) called.",
-            surfaceid, framerate);
-    ico_window_mgr_map_surface(m_winmgr, surfaceid, framerate);
+    CicoSCWlWinMgrIF::mapSurface(surfaceid, framerate);
+
     ICO_DBG("CicoSCWindowController::mapSurface Leave(EOK)");
     return ICO_SYC_EOK;
 }
@@ -906,15 +841,14 @@ CicoSCWindowController::unmapSurface(int surfaceid)
 {
     ICO_DBG("CicoSCWindowController::unmapSurface Enter");
 
-    // find window infomation in window list
+    // find window information in window list
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
         ICO_WRN("CicoSCWindowController::unmapSurface Leave(ENOENT)");
         return ICO_SYC_ENOENT;
     }
 
-    ICO_DBG("ico_window_mgr_unmap_surface(%d) called.", surfaceid);
-    ico_window_mgr_unmap_surface(m_winmgr, surfaceid);
+    CicoSCWlWinMgrIF::unmapSurface(surfaceid);
 
     ICO_DBG("CicoSCWindowController::unmapSurface Leave(EOK)");
     return ICO_SYC_EOK;
@@ -941,7 +875,7 @@ CicoSCWindowController::createdCB(void                  *data,
                                   const char            *appid)
 {
     ICO_DBG("CicoSCWindowController::createdCB Enter"
-            "(surfaceid=%08X winname=%s pid=%d appid=%s)",
+            "(surfaceid=0x%08X winname=%s pid=%d appid=%s)",
             surfaceid, winname, pid, appid);
 
     CicoSCWindow* window = new CicoSCWindow();
@@ -963,27 +897,22 @@ CicoSCWindowController::createdCB(void                  *data,
             ailItem = appctrl->findAIL(window->appid.c_str());
         }
         else {
-            ICO_DBG("aulitem not found.");
+            ICO_DBG("application information not found.");
         }
     }
 
-    string fullZoneName;
     if (NULL != ailItem) {
         window->layerid = ailItem->m_layer;
         window->zoneid  = ailItem->m_displayZone;
         window->nodeid  = ailItem->m_nodeID;
         if ((window->displayid >= 0) && (window->zoneid >= 0)) {
-            // TODO at errer try catch
+            // TODO at error try catch
             CicoSCDisplay* display = m_displayList.at(window->displayid);
             CicoSCDisplayZone *zone = display->zoneList.at(window->zoneid);
             window->x       = zone->x;
             window->y       = zone->y;
             window->width   = zone->width;
             window->height  = zone->height;
-
-            //TODO
-            //fullZoneName = display->name + "." + zone->name;
-            fullZoneName = "Center.Full";
         }
     }
     else{
@@ -994,7 +923,7 @@ CicoSCWindowController::createdCB(void                  *data,
 
     appctrl->enterAUL(appid, pid, window);
 
-    // dump log window infomartion
+    // dump log window information
     window->dump();
 
     m_windowList[surfaceid] = window;
@@ -1007,25 +936,48 @@ CicoSCWindowController::createdCB(void                  *data,
     message->addArgObject("winname", window->name);
     CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
 
+#if 1
     if (NULL != m_resMgr) {
         CicoSCCommand cmd;
         CicoSCCmdResCtrlOpt *opt = new CicoSCCmdResCtrlOpt();
 
-        cmd.cmdid = MSG_CMD_ACQUIRE_RES;
+        cmd.cmdid = MSG_CMD_CREATE_RES;
         cmd.appid = window->appid;
         cmd.pid   = window->pid;
         cmd.opt = opt;
         
-        opt->displayres  = true;
-        opt->displayZone = fullZoneName;
-        opt->windowName  = window->name;
-        opt->surfaceid   = window->surfaceid;
+        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;
+        }
+
+#if 1   //TODO
+        opt->soundres  = true;
+        opt->soundname = window->appid;
+        opt->soundid   = 0;
+        CicoSCSystemConfig *sysconf = CicoSCSystemConfig::getInstance();
+        const CicoSCDefaultConf *defconf = sysconf->getDefaultConf();
+        if (NULL != defconf) {
+            const CicoSCSoundZoneConf *zoneconf = 
+                sysconf->findSoundZoneConfbyId(defconf->soundzone);
+            if (NULL != zoneconf) {
+                opt->soundzone = zoneconf->fullname;
+            }
+        }
+#endif
+
 
         m_resMgr->handleCommand((const CicoSCCommand&)cmd, true);
     }
     else {
-        //show(window->surfaceid, NULL, 0);
+        show(window->surfaceid, NULL, 0);
     }
+#endif
 
     ICO_DBG("CicoSCWindowController::createdCB Leave");
 }
@@ -1047,7 +999,7 @@ CicoSCWindowController::nameCB(void                  *data,
                                const char            *winname)
 {
     ICO_DBG("CicoSCWindowController::nameCB Enter"
-            "(surfaceid=%08X winname=%s)", surfaceid, winname);
+            "(surfaceid=0x%08X winname=%s)", surfaceid, winname);
 
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
@@ -1059,6 +1011,23 @@ CicoSCWindowController::nameCB(void                  *data,
             window->name.c_str(), winname);
     window->name = winname;
 
+    // send message
+    CicoSCMessage *message = new CicoSCMessage();
+    message->addRootObject("command", MSG_CMD_CHANGE_ATTR);
+    message->addRootObject("appid", window->appid);
+    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_DBG("CicoSCWindowController::nameCB Leave");
 }
 
@@ -1094,6 +1063,41 @@ CicoSCWindowController::destroyedCB(void                  *data,
 
     // 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;
+        CicoSCSystemConfig *sysconf = CicoSCSystemConfig::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);
@@ -1109,9 +1113,9 @@ CicoSCWindowController::destroyedCB(void                  *data,
  *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
  *  @param [in] surfaceid       ico_window_mgr surface Id
  *  @param [in] visible         surface visible
- *                              (1=visible/0=unvisible/other=nochange)
+ *                              (1=visible/0=invisible/other=no-change)
  *  @param [in] raise           surface raise
- *                              (1=raise/0=lower/other=nochange)
+ *                              (1=raise/0=lower/other=no change)
  *  @param [in] hint            client request
  *                              (1=client request(not changed)/0=changed)
  */
@@ -1125,7 +1129,7 @@ CicoSCWindowController::visibleCB(void                  *data,
                                   int32_t               hint)
 {
     ICO_DBG("CicoSCWindowController::visibleCB Enter"
-            "(surfaceid=%08X visible=%d raise=%d hint=%d)",
+            "(surfaceid=0x%08X visible=%d raise=%d hint=%d)",
             surfaceid, visible, raise, hint);
 
     CicoSCWindow *window = findWindow(surfaceid);
@@ -1178,8 +1182,8 @@ CicoSCWindowController::visibleCB(void                  *data,
  *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
  *  @param [in] surfaceid       ico_window_mgr surface Id
  *  @param [in] node            surface node Id
- *  @param [in] x               surface upper-left X coodinate
- *  @param [in] y               surface upper-left Y coodinate
+ *  @param [in] x               surface upper-left X coordinate
+ *  @param [in] y               surface upper-left Y coordinate
  *  @param [in] width           surface width
  *  @param [in] height          surface height
  *  @param [in] hint            client request
@@ -1199,7 +1203,7 @@ CicoSCWindowController::configureCB(void                  *data,
                                     int32_t               hint)
 {
     ICO_DBG("CicoSCWindowController::configureCB Enter"
-            "surfaceid=%08X node=%d layer=%d x=%d y=%d "
+            "surfaceid=0x%08X node=%d layer=%d x=%d y=%d "
             "width=%d height=%d hint=%d",
             surfaceid, node, layer, x, y, width, height, hint);
 
@@ -1261,7 +1265,7 @@ CicoSCWindowController::activeCB(void                  *data,
                                  int32_t               active)
 {
     ICO_DBG("CicoSCWindowController::activeCB Enter"
-            "(surfaceid=%08X active=%d)", surfaceid, active);
+            "(surfaceid=0x%08X active=%d)", surfaceid, active);
 
     CicoSCWindow *window = findWindow(surfaceid);
     if (NULL == window) {
@@ -1288,7 +1292,7 @@ CicoSCWindowController::activeCB(void                  *data,
  *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
  *  @param [in] layer           layer Id
  *  @param [in] visible         layer visible
- *                              (1=visible/0=unvisible/other=nochange)
+ *                              (1=visible/0=invisible/other=no change)
  */
 //--------------------------------------------------------------------------
 void
@@ -1313,12 +1317,12 @@ CicoSCWindowController::layerVisibleCB(void                  *data,
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  query applicationsurface callback
+ *  @brief  query application surface callback
  *
  *  @param [in] data            user data(unused)
  *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
  *  @param [in] appid           application Id
- *  @param [in] suface          surface Id array
+ *  @param [in] surface         surface Id array
  */
 //--------------------------------------------------------------------------
 void
@@ -1397,13 +1401,13 @@ CicoSCWindowController::mapSurfaceCB(void                  *data,
  *
  *  @param [in] data            user data(unused)
  *  @param [in] wl_output       wayland wl_output interface
- *  @param [in] x               display upper-left X coodinate
- *  @param [in] y               display upper-left Y coodinate
+ *  @param [in] x               display upper-left X coordinate
+ *  @param [in] y               display upper-left Y coordinate
  *  @param [in] physical_width  display physical width
  *  @param [in] physical_height display physical height
- *  @param [in] subpixel        display sub pixcel
+ *  @param [in] subpixel        display sub pixel
  *  @param [in] make            display maker
- *  @param [in] model           diaplay model
+ *  @param [in] model           display model
  *  @param [in] transform       transform
  */
 //--------------------------------------------------------------------------
@@ -1517,7 +1521,7 @@ CicoSCWindowController::findWindow(int surfaceid)
     map<unsigned int, CicoSCWindow*>::iterator itr;
     itr = m_windowList.find(surfaceid);
     if (m_windowList.end() == itr) {
-        ICO_WRN("not found window object. surfaceid=%d", surfaceid);
+        ICO_WRN("not found window object. surfaceid=0x%08X", surfaceid);
         return NULL;
     }
 
@@ -1553,9 +1557,33 @@ CicoSCWindowController::findLayer(int displayid, int layerid)
 
 //--------------------------------------------------------------------------
 /**
+ *  @brief  find display zone by id
+ */
+//--------------------------------------------------------------------------
+const CicoSCDisplayZone *
+CicoSCWindowController::findDisplayZone(int zoneid)
+{
+    vector<CicoSCDisplay*>::iterator itr;
+    itr = m_displayList.begin();
+    for (; itr != m_displayList.end(); ++itr) {
+        vector<CicoSCDisplayZone*>::iterator itr2;
+        itr2 = (*itr)->zoneList.begin();
+        for (; itr2 != (*itr)->zoneList.end(); ++itr2) {
+            if ((*itr2)->zoneid == zoneid) {
+                return *itr2;
+            }
+        }
+    }
+    return NULL;
+}
+
+
+
+//--------------------------------------------------------------------------
+/**
  *  @brief  handle command
  *
- *  @param [in] commnad     control commnad
+ *  @param [in] cmd     control command
  */
 //--------------------------------------------------------------------------
 void
@@ -1565,53 +1593,118 @@ CicoSCWindowController::handleCommand(const CicoSCCommand * cmd)
 
     CicoSCCmdWinCtrlOpt *opt = static_cast<CicoSCCmdWinCtrlOpt*>(cmd->opt);
 
-    int ret = 0;
     switch (cmd->cmdid) {
     case MSG_CMD_SHOW:
         ICO_DBG("command: MSG_CMD_SHOW");
-        ret = show(opt->surfaceid, opt->animation.c_str(), opt->animationTime);
+#if 1
+        (void)notifyResourceManager(opt->surfaceid,
+                                    opt->animation.c_str(),
+                                    opt->animationTime);
+#else
+        (void)show(opt->surfaceid, opt->animation.c_str(), opt->animationTime);
+#endif
         break;
     case MSG_CMD_HIDE:
         ICO_DBG("command: MSG_CMD_HIDE");
-        ret = hide(opt->surfaceid, opt->animation.c_str(), opt->animationTime);
+        (void)hide(opt->surfaceid, opt->animation.c_str(), opt->animationTime);
         break;
     case MSG_CMD_MOVE:
         ICO_DBG("command: MSG_CMD_MOVE");
-        ret = setGeometry(opt->surfaceid, opt->nodeid, opt->x, opt->y, 
+        (void)setGeometry(opt->surfaceid, opt->nodeid, opt->x, opt->y, 
                           opt->width, opt->height, 
                           opt->animation.c_str(), opt->animationTime,
                           opt->animation.c_str(), opt->animationTime);
         break;
     case MSG_CMD_CHANGE_ACTIVE:
         ICO_DBG("command: MSG_CMD_CHANGE_ACTIVE");
-        ret = active(opt->surfaceid, opt->active);
+        (void)active(opt->surfaceid, opt->active);
         break;
     case MSG_CMD_CHANGE_LAYER:
         ICO_DBG("command: MSG_CMD_CHANGE_LAYER");
-        ret = setWindowLayer(opt->surfaceid, opt->layerid);
+        (void)setWindowLayer(opt->surfaceid, opt->layerid);
         break;
-    case MSG_CMD_PREPARE_THUMB:
-        ICO_DBG("command: MSG_CMD_PREPARE_THUMB");
-        ret = mapSurface(opt->surfaceid, opt->framerate);
+    case MSG_CMD_MAP_THUMB:
+        ICO_DBG("command: MSG_CMD_MAP_THUMB");
+        (void)mapSurface(opt->surfaceid, opt->framerate);
         break;
     case MSG_CMD_UNMAP_THUMB:
         ICO_DBG("command: MSG_CMD_UNMAP_THUMB");
-        ret = unmapSurface(opt->surfaceid);
+        (void)unmapSurface(opt->surfaceid);
         break;
     case MSG_CMD_SHOW_LAYER:
         ICO_DBG("command: MSG_CMD_SHOW_LAYER");
-        ret = showLayer(opt->displayid, opt->layerid);
+        (void)showLayer(opt->displayid, opt->layerid);
         break;
     case MSG_CMD_HIDE_LAYER:
         ICO_DBG("command: MSG_CMD_HIDE_LAYER");
-        ret = hideLayer(opt->displayid, opt->layerid);
+        (void)hideLayer(opt->displayid, opt->layerid);
         break;
     default:
-        ICO_WRN("Unknown Commnad(0x%08X)", cmd->cmdid);
+        ICO_WRN("command: Unknown(0x%08X)", cmd->cmdid);
         break;
     }
-    ICO_DBG("commnd result(%d)", ret);
 
     ICO_DBG("CicoSCWindowController::handleCommand Leave");
 }
+
+int 
+CicoSCWindowController::notifyResourceManager(int        surfaceid,
+                                              const char *animation,
+                                              int        animationTime)
+{
+    ICO_DBG("CicoSCWindowController::notifyResourceManager Enter"
+            "(surfaceid=0x%08X animation=%s animationTime=%d)",
+            surfaceid, animation, animationTime);
+
+    // find window information in window list
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        ICO_WRN("CicoSCWindowController::notifyResourceManager Leave(ENOENT)");
+        return ICO_SYC_ENOENT;
+    }
+
+    CicoSCCommand cmd;
+    CicoSCCmdResCtrlOpt *opt = new CicoSCCmdResCtrlOpt();
+
+    cmd.cmdid = MSG_CMD_ACQUIRE_RES;
+    cmd.appid = window->appid;
+    cmd.pid   = window->pid;
+    cmd.opt   = opt;
+    
+    opt->dispres       = true;
+    opt->winname       = window->name;
+    opt->surfaceid     = window->surfaceid;
+    opt->animation     = animation;
+    opt->animationTime = animationTime;
+    string fullname;
+    const CicoSCDisplayZone* zone = findDisplayZone(window->zoneid);
+    if (NULL != zone) {
+        opt->dispzone = zone->fullname;
+    }
+    else {
+        ICO_WRN("CicoSCWindowController::notifyResourceManager Leave(ENOENT)");
+        return ICO_SYC_ENOENT;
+    }
+#if 1
+    opt->soundres  = true;
+    opt->soundname = window->appid;
+    opt->soundid   = 0;
+    CicoSCSystemConfig *sysconf = CicoSCSystemConfig::getInstance();
+    const CicoSCDefaultConf *defconf = sysconf->getDefaultConf();
+    if (NULL != defconf) {
+        const CicoSCSoundZoneConf *zoneconf = 
+            sysconf->findSoundZoneConfbyId(defconf->soundzone);
+        if (NULL != zoneconf) {
+            opt->soundzone = zoneconf->fullname;
+        }
+    }
+#endif
+
+    m_resMgr->handleCommand((const CicoSCCommand&)cmd, true);
+
+    ICO_DBG("CicoSCWindowController::notifyResourceManager Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
 // vim:set expandtab ts=4 sw=4:
index 8443292..c62f7fc 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCWindowController.h
  *
- *  @brief  
+ *  @brief  This file is definition of CicoSCWindowController class
  */
 //==========================================================================
 #ifndef __CICO_SC_WINDOW_CONTROLLER_H__
@@ -30,12 +30,13 @@ using namespace std;
 class CicoSCCommand;
 class CicoSCDisplay;
 class CicoSCLayer;
+class CicoSCDisplayZone;
 class CicoSCWindow;
 class CicoSCResourceManager;
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  window controller
+ *  @brief  This class is controller of window
  */
 //--------------------------------------------------------------------------
 class CicoSCWindowController : public CicoSCWlWinMgrIF
@@ -98,8 +99,6 @@ public:
 
     int hideLayer(int displayid, int layerid);
 
-    void setLayerVisible(int layerid, int visible);
-
     int active(int surfaceid, int target);
 
     int mapSurface(int surfaceid, int framerate);
@@ -190,21 +189,28 @@ private:
     // copy constructor
     CicoSCWindowController(const CicoSCWindowController &object);
 
-    // find window obeject by surface id
+    // find window object by surface id
     CicoSCWindow* findWindow(int surfaceid);
 
-    // find layer obeject by display id and layer id
+    // find layer object by display id and layer id
     CicoSCLayer* findLayer(int displayid, int layerid);
 
+    // fine display zone by id
+    const CicoSCDisplayZone * findDisplayZone(int zoneid);
+
+    int notifyResourceManager(int        surfaceid,
+                              const char *animation,
+                              int        animationTime);
+
 private:
     CicoSCResourceManager *m_resMgr;
 
-    // window obejct list
+    // window object list
     map<unsigned int, CicoSCWindow*> m_windowList;
 
-    // display objet list
+    // display object list
     vector<CicoSCDisplay*>   m_displayList;
 
 };
-#endif // __CICO_SC_WINDOW_CONTROLLER_H__
+#endif  // __CICO_SC_WINDOW_CONTROLLER_H__
 // vim:set expandtab ts=4 sw=4:
index 7805cc6..c95a34f 100644 (file)
 /**
  *  @file   CicoSCWlInputMgrIF.cpp
  *
- *  @brief  
+ *  @brief  This file implementation of CicoSCInputDev class
  */
 //==========================================================================
 
 #include <cstring>
-#include "CicoSCWlInputMgrIF.h"
-#include "CicoLog.h"
 
-//==========================================================================
-//  static variables
-//==========================================================================
+#include <string>
+using namespace std;
 
-// ico_exinput listener
-struct ico_exinput_listener CicoSCWlInputMgrIF::ms_exInputListener = {
-    .capabilities = CicoSCWlInputMgrIF::wlCapabilitiesCB,
-    .code         = CicoSCWlInputMgrIF::wlCodeCB,
-    .input        = CicoSCWlInputMgrIF::wlInputCB
-};
-
-// ico_input_mgr_device listener
-struct ico_input_mgr_device_listener CicoSCWlInputMgrIF::ms_devListener = {
-    .input_region = CicoSCWlInputMgrIF::wlRegionCB
-};
+#include "CicoSCWlInputMgrIF.h"
+#include "CicoLog.h"
 
 //--------------------------------------------------------------------------
 /**
@@ -43,6 +31,13 @@ struct ico_input_mgr_device_listener CicoSCWlInputMgrIF::ms_devListener = {
 CicoSCWlInputMgrIF::CicoSCWlInputMgrIF()
     : m_inputmgr(NULL), m_exinput(NULL), m_inputmgrdev(NULL)
 {
+    // ico_exinput listener
+    m_exInputListener.capabilities = wlCapabilitiesCB;
+    m_exInputListener.code         = wlCodeCB;
+    m_exInputListener.input        = wlInputCB;
+
+    // ico_input_mgr_device listener
+    m_devListener.input_regions    = wlRegionCB;
 }
 
 //--------------------------------------------------------------------------
@@ -58,11 +53,11 @@ CicoSCWlInputMgrIF::~CicoSCWlInputMgrIF()
 /**
  *  @brief  initialize ico_input_mgr interfaces
  *
- *  @param [IN] data        user data
- *  @param [IN] registry    wayland registry
- *  @param [IN] name        wayland display id
- *  @parma [IN] interface   wayland interface name
- *  @parma [IN] version     wayland interface version number
+ *  @param [in] data        user data
+ *  @param [in] registry    wayland registry
+ *  @param [in] name        wayland display id
+ *  @parma [in] interface   wayland interface name
+ *  @parma [in] version     wayland interface version number
  */
 //--------------------------------------------------------------------------
 void
@@ -84,7 +79,7 @@ CicoSCWlInputMgrIF::initInterface(void               *data,
         if (NULL == wlProxy) {
             ICO_WRN("initInterface : interface(%s) wl_registry_bind failed.",
                     interface);
-            ICO_WRN("initInterface : Leave(binding failed");
+            ICO_WRN("initInterface : Leave(binding failed)");
             return;
         }
 
@@ -99,17 +94,14 @@ CicoSCWlInputMgrIF::initInterface(void               *data,
         if (NULL == wlProxy) {
             ICO_WRN("initInterface : interface(%s) wl_registry_bind failed.",
                     interface);
-            ICO_WRN("initInterface : Leave(binding failed");
+            ICO_WRN("initInterface : Leave(binding failed)");
             return;
         }
 
         m_exinput = (struct ico_exinput*)wlProxy;
         ico_exinput_add_listener(m_exinput,
-                                 &ms_exInputListener,
+                                 &m_exInputListener,
                                  this);
-#if 0
-        ico_exinput_set_user_data(m_exinput, NULL/*user data*/);
-#endif
     }
     else if (0 == strcmp(interface, ICO_WL_INPUT_MGR_DEV_IF)) {
         // get interface instance
@@ -120,17 +112,14 @@ CicoSCWlInputMgrIF::initInterface(void               *data,
         if (NULL == wlProxy) {
             ICO_WRN("initInterface : interface(%s) wl_registry_bind failed.",
                     interface);
-            ICO_WRN("initInterface : Leave(binding failed");
+            ICO_WRN("initInterface : Leave(binding failed)");
             return;
         }
 
         m_inputmgrdev = (struct ico_input_mgr_device*)wlProxy;
         ico_input_mgr_device_add_listener(m_inputmgrdev,
-                                          &ms_devListener,
+                                          &m_devListener,
                                           this);
-#if 0
-        ico_input_mgr_device_set_user_data(m_inputmgrdev, NULL/*user data*/);
-#endif
     }
 
     if ((NULL != m_inputmgrdev) &&
@@ -143,16 +132,156 @@ CicoSCWlInputMgrIF::initInterface(void               *data,
 
 //--------------------------------------------------------------------------
 /**
+ *  @brief  wrapper function ico_input_mgr_control_add_input_app
+ *
+ *  @param [in] appid   application id
+ *  @param [in] device  input device name
+ *  @param [in] input   input number
+ *  @parma [in] fix     fixed assign flag
+ *  @parma [in] keycode assigned keycode value
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlInputMgrIF::addInputApp(const string &appid,
+                                const string &device,
+                                int          input,
+                                int          fix,
+                                int          keycode)
+{
+    ICO_DBG("called: ico_input_mgr_control_add_input_app"
+            "(appid=%s device=%s input=%d fix=%d keycode=%d)",
+            appid.c_str(), device.c_str(), input, fix, keycode);
+    ico_input_mgr_control_add_input_app(m_inputmgr,appid.c_str(),
+                                        device.c_str(), input, fix, keycode);
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wrapper function ico_input_mgr_control_del_input_app
+ *
+ *  @param [in] appid   application id
+ *  @param [in] device  input device name
+ *  @param [in] input   input number
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlInputMgrIF::delInputApp(const string &appid,
+                                const string &device,
+                                int          input)
+{
+    ICO_DBG("called: ico_input_mgr_control_del_input_app"
+            "(appid=%s device=%s input=%d)",
+            appid.c_str(), device.c_str(), input);
+    ico_input_mgr_control_del_input_app(m_inputmgr, appid.c_str(),
+                                        device.c_str(), input);
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wrapper function ico_input_mgr_control_send_input_event
+ *
+ *  @param [in] appid     application id
+ *  @param [in] surfaceid surface id
+ *  @param [in] type      //TODO
+ *  @param [in] deviceno  input device number
+ *  @param [in] code      //TODO
+ *  @param [in] value     //TODO
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlInputMgrIF::sendInputEvent(const string &appid,
+                                   int          surfaceid,
+                                   int          type,
+                                   int          deviceno,
+                                   int          code,
+                                   int          value)
+{
+    ICO_DBG("called: ico_input_mgr_control_send_input_event"
+            "(appid=%s surfaceid=0x%08X type=%d deviceno=%d code=%d value=%d)",
+            appid.c_str(), surfaceid, type, deviceno, code, value);
+    ico_input_mgr_control_send_input_event(m_inputmgr, appid.c_str(), surfaceid,
+                                           type, deviceno, code, value);
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wrapper function ico_exinput_set_input_region
+ *
+ *  @param [in] target    target window name(winname@appid)
+ *  @param [in] x         region x positon
+ *  @param [in] y         region y positon
+ *  @param [in] width     region width
+ *  @param [in] height    region height
+ *  @param [in] hotspot_x hotspot x position
+ *  @param [in] hotspot_y hotspot y position
+ *  @param [in] cursor_x  cursor x position
+ *  @param [in] cursor_y  cursor y position
+ *  @param [in] cursor_width  cursor width
+ *  @param [in] cursor_height cursor height
+ *  @param [in] attr      region attribute
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlInputMgrIF::setInputRegion(const string &target,
+                                   int x,
+                                   int y,
+                                   int width,
+                                   int height,
+                                   int hotspot_x,
+                                   int hotspot_y,
+                                   int cursor_x,
+                                   int cursor_y,
+                                   int cursor_width,
+                                   int cursor_height,
+                                   int attr)
+{
+    ICO_DBG("called: ico_exinput_set_input_region"
+            "(target=%s x/y=%d/%d w/h=%d/%d hot=%d/%d "
+            "cursor=%d/%d-%d/%d attr=%d)",
+            target.c_str(), x, y, width, height, hotspot_x, hotspot_y,
+            cursor_x, cursor_y, cursor_width, cursor_height, attr);
+    ico_exinput_set_input_region(m_exinput, target.c_str(), x, y,
+                                 width, height, hotspot_x, hotspot_y, cursor_x,
+                                 cursor_y, cursor_width, cursor_height,attr);
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wrapper function ico_exinput_unset_input_region
+ *
+ *  @param [in] target    target window name(winname@appid)
+ *  @param [in] x         region x positon
+ *  @param [in] y         region y positon
+ *  @param [in] width     region width
+ *  @param [in] height    region height
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlInputMgrIF::unsetInputRegion(const string &target,
+                                     int x,
+                                     int y,
+                                     int width,
+                                     int height)
+{
+    ICO_DBG("called: ico_exinput_unset_input_region"
+            "(target=%s x=%d y=%d width=%d height=%d",
+            target.c_str(), x, y, width, height);
+    ico_exinput_unset_input_region(m_exinput, target.c_str(),
+                                   x, y, width, height);
+}
+
+//--------------------------------------------------------------------------
+/**
  *  @brief  callback to application for input switch information
  *
- *  @param [IN] data        user data
- *  @param [IN] ico_exinput wayland ico_exinput interface
- *  @param [IN] device      input device name
- *  @param [IN] type        input device type (as enum type)
- *  @param [IN] swname      input switch name
- *  @param [IN] input       input switch number
- *  @param [IN] codename    input code name
- *  @param [IN] code        input code number
+ *  @param [in] data        user data
+ *  @param [in] ico_exinput wayland ico_exinput interface
+ *  @param [in] device      input device name
+ *  @param [in] type        input device type (as enum type)
+ *  @param [in] swname      input switch name
+ *  @param [in] input       input switch number
+ *  @param [in] codename    input code name
+ *  @param [in] code        input code number
  */
 //--------------------------------------------------------------------------
 void
@@ -172,12 +301,12 @@ CicoSCWlInputMgrIF::capabilitiesCB(void               *data,
 /**
  *  @brief  callback to application for input code information
  *  
- *  @param [IN] data        user data
- *  @param [IN] ico_exinput wayland ico_exinput interface
- *  @param [IN] device      input device name
- *  @param [IN] input       input switch number
- *  @param [IN] codename    input code name
- *  @param [IN] code        input code number
+ *  @param [in] data        user data
+ *  @param [in] ico_exinput wayland ico_exinput interface
+ *  @param [in] device      input device name
+ *  @param [in] input       input switch number
+ *  @param [in] codename    input code name
+ *  @param [in] code        input code number
  */
 //--------------------------------------------------------------------------
 void
@@ -195,13 +324,13 @@ CicoSCWlInputMgrIF::codeCB(void               *data,
 /**
  *  @brief  callback to application for switch input 
  *
- *  @param [IN] data        user data
- *  @param [IN] ico_exinput wayland ico_exinput interface
- *  @param [IN] time        input time of miri-sec
- *  @param [IN] device      input device name
- *  @param [IN] input       input switch number
- *  @param [IN] code        input switch code
- *  @param [IN] state       Of/Off status
+ *  @param [in] data        user data
+ *  @param [in] ico_exinput wayland ico_exinput interface
+ *  @param [in] time        input time of millisecond
+ *  @param [in] device      input device name
+ *  @param [in] input       input switch number
+ *  @param [in] code        input switch code
+ *  @param [in] state       Of/Off status
  */
 //--------------------------------------------------------------------------
 void
@@ -220,9 +349,9 @@ CicoSCWlInputMgrIF::inputCB(void               *data,
 /**
  *  @brief  callback to application for change input region
  *
- *  @param [IN] data                user data
- *  @param [IN] ico_input_mgr_dev   wayland ico_exinput interface
- *  @param [IN] region              input regions
+ *  @param [in] data                user data
+ *  @param [in] ico_input_mgr_dev   wayland ico_exinput interface
+ *  @param [in] region              input regions
  */
 //--------------------------------------------------------------------------
 void
@@ -241,14 +370,14 @@ CicoSCWlInputMgrIF::regionCB(void                        *data,
 /**
  *  @brief  callback to application for input switch information
  *
- *  @param [IN] data        user data
- *  @param [IN] ico_exinput wayland ico_exinput interface
- *  @param [IN] device      input device name
- *  @param [IN] type        input device type (as enum type)
- *  @param [IN] swname      input switch name
- *  @param [IN] input       input switch number
- *  @param [IN] codename    input code name
- *  @param [IN] code        input code number
+ *  @param [in] data        user data
+ *  @param [in] ico_exinput wayland ico_exinput interface
+ *  @param [in] device      input device name
+ *  @param [in] type        input device type (as enum type)
+ *  @param [in] swname      input switch name
+ *  @param [in] input       input switch number
+ *  @param [in] codename    input code name
+ *  @param [in] code        input code number
  */
 //--------------------------------------------------------------------------
 void
@@ -278,12 +407,12 @@ CicoSCWlInputMgrIF::wlCapabilitiesCB(void               *data,
 /**
  *  @brief  callback to application for input code information
  *  
- *  @param [IN] data        user data
- *  @param [IN] ico_exinput wayland ico_exinput interface
- *  @param [IN] device      input device name
- *  @param [IN] input       input switch number
- *  @param [IN] codename    input code name
- *  @param [IN] code        input code number
+ *  @param [in] data        user data
+ *  @param [in] ico_exinput wayland ico_exinput interface
+ *  @param [in] device      input device name
+ *  @param [in] input       input switch number
+ *  @param [in] codename    input code name
+ *  @param [in] code        input code number
  */
 //--------------------------------------------------------------------------
 void
@@ -311,13 +440,13 @@ CicoSCWlInputMgrIF::wlCodeCB(void               *data,
 /**
  *  @brief  callback to application for switch input 
  *
- *  @param [IN] data        user data
- *  @param [IN] ico_exinput wayland ico_exinput interface
- *  @param [IN] time        input time of miri-sec
- *  @param [IN] device      input device name
- *  @param [IN] input       input switch number
- *  @param [IN] code        input switch code
- *  @param [IN] state       Of/Off status
+ *  @param [in] data        user data
+ *  @param [in] ico_exinput wayland ico_exinput interface
+ *  @param [in] time        input time of millisecond
+ *  @param [in] device      input device name
+ *  @param [in] input       input switch number
+ *  @param [in] code        input switch code
+ *  @param [in] state       Of/Off status
  */
 //--------------------------------------------------------------------------
 void
@@ -346,9 +475,9 @@ CicoSCWlInputMgrIF::wlInputCB(void               *data,
 /**
  *  @brief  callback to application for change input region
  *
- *  @param [IN] data                user data
- *  @param [IN] ico_input_mgr_dev   wayland ico_exinput interface
- *  @param [IN] region              input regions
+ *  @param [in] data                user data
+ *  @param [in] ico_input_mgr_dev   wayland ico_exinput interface
+ *  @param [in] region              input regions
  */
 //--------------------------------------------------------------------------
 void
index d578022..1fcbde8 100644 (file)
 /**
  *  @file   CicoSCWlInputMgrIF.cpp
  *
- *  @brief  
+ *  @brief  This file is definition of CicoSCInputDevConf class
  */
 //==========================================================================
 #ifndef __CICO_SC_WL_INPUT_MGR_IF_H__
 #define __CICO_SC_WL_INPUT_MGR_IF_H__
 
+#include <string>
 #include <ico_input_mgr-client-protocol.h>
 #include "CicoSCWaylandIF.h"
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  This class is wayland interface of multi input manager
+ */
+//--------------------------------------------------------------------------
 class CicoSCWlInputMgrIF : public CicoSCWaylandIF
 {
 public:
+    // initialize interface
     void initInterface(void               *data,
                        struct wl_registry *registry,
                        uint32_t           name,
                        const char         *interface,
                        uint32_t           version);
 
+    // capabilities callback function
     void capabilitiesCB(void               *data,
                         struct ico_exinput *ico_exinput,
                         const char         *device,
@@ -38,6 +46,7 @@ public:
                         const char          *codename,
                         int32_t            code);
 
+    // code callback function
     void codeCB(void               *data,
                 struct ico_exinput *ico_exinput,
                 const char         *device,
@@ -45,6 +54,7 @@ public:
                 const char         *codename,
                 int32_t            code);
 
+    // input callback function
     void inputCB(void               *data,
                  struct ico_exinput *ico_exinput,
                  uint32_t           time,
@@ -53,6 +63,7 @@ public:
                  int32_t            code,
                  int32_t            state);
 
+    // region callback function
     void regionCB(void                        *data,
                   struct ico_input_mgr_device *ico_input_mgr_device,
                   struct wl_array             *region);
@@ -70,8 +81,51 @@ protected:
     // copy constructor
     CicoSCWlInputMgrIF(const CicoSCWlInputMgrIF &object);
 
+    // wrapper function ico_input_mgr_control_add_input_app
+    void addInputApp(const std::string &appid,
+                     const std::string &device,
+                     int               input,
+                     int               fix,
+                     int               keycode);
+
+    // wrapper function ico_input_mgr_control_del_input_app
+    void delInputApp(const std::string &appid,
+                     const std::string &device,
+                     int               input);
+
+    // wrapper function ico_input_mgr_control_send_input_event
+    void sendInputEvent(const std::string &appid,
+                        int               surfaceid,
+                        int               type,
+                        int               deviceno,
+                        int               code,
+                        int               value);
+
+    // wrapper function ico_exinput_set_input_region
+    void setInputRegion(const std::string &target,
+                        int x,
+                        int y,
+                        int width,
+                        int height,
+                        int hotspot_x,
+                        int hotspot_y,
+                        int cursor_x,
+                        int cursor_y,
+                        int cursor_width,
+                        int cursor_height,
+                        int attr);
+
+    // wrapper function ico_exinput_unset_input_region
+    void unsetInputRegion(const std::string &target,
+                          int x,
+                          int y,
+                          int width,
+                          int height);
+
 private:
-    /* ico_input_mgr(Multi Input Manager) callback functions    */
+    // ico_input_mgr(Multi Input Manager) callback functions
+
+    // wayland capabilities callback function
     static void wlCapabilitiesCB(void               *data,
                                  struct ico_exinput *ico_exinput,
                                  const char         *device,
@@ -81,6 +135,7 @@ private:
                                  const char         *codename,
                                  int32_t            code);
 
+    // wayland code callback function
     static void wlCodeCB(void               *data,
                          struct ico_exinput *ico_exinput,
                          const char         *device,
@@ -88,6 +143,7 @@ private:
                          const char         *codename,
                          int32_t            code);
 
+    // wayland input callback function
     static void wlInputCB(void               *data,
                           struct ico_exinput *ico_exinput,
                           uint32_t           time,
@@ -96,27 +152,28 @@ private:
                           int32_t            code,
                           int32_t            state);
 
+    // wayland region callback function
     static void wlRegionCB(void                        *data,
                            struct ico_input_mgr_device *ico_input_mgr_device,
                            struct wl_array             *region);
 
 protected:
-    // Input Manager PulgIn interface
+    // input manager interface
     struct ico_input_mgr_control *m_inputmgr;
+
     // extra input event interface
     struct ico_exinput *m_exinput;
 
-    // Input Manage Device interface
+    // input manage device interface
     struct ico_input_mgr_device *m_inputmgrdev;
 
 private:
-    // ico_exinput listener
-    static struct ico_exinput_listener ms_exInputListener;
+    // exinput listener
+    struct ico_exinput_listener m_exInputListener;
 
-    // ico_input_mgr_device listener
-    static struct ico_input_mgr_device_listener ms_devListener;
+    // input manager device listener
+    struct ico_input_mgr_device_listener m_devListener;
 
 };
-#endif // __CICO_SC_WL_INPUT_MGR_IF_H__
+#endif  // __CICO_SC_WL_INPUT_MGR_IF_H__
 // vim:set expandtab ts=4 sw=4:
index d75b980..9766203 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCWlWinMgrIF.cpp
  *
- *  @brief  
+ *  @brief  This file implementation of CicoSCWlInputMgrIF class
  */
 //==========================================================================
 
 //  static variables
 //==========================================================================
 
-// ico_window_mgr listener
-struct ico_window_mgr_listener CicoSCWlWinMgrIF::ms_listener = {
-    .window_created   = CicoSCWlWinMgrIF::wlCreatedCB,
-    .window_name      = CicoSCWlWinMgrIF::wlNameCB,
-    .window_destroyed = CicoSCWlWinMgrIF::wlDestroyedCB,
-    .window_visible   = CicoSCWlWinMgrIF::wlVisibleCB,
-    .window_configure = CicoSCWlWinMgrIF::wlConfigureCB,
-    .window_active    = CicoSCWlWinMgrIF::wlActiveCB,
-    .layer_visible    = CicoSCWlWinMgrIF::wlLayerVisibleCB,
-    .app_surfaces     = CicoSCWlWinMgrIF::wlAppSurfacesCB,
-    .map_surface      = CicoSCWlWinMgrIF::wlMapSurfaceCB 
-};
-
-// wayland output listener
-struct wl_output_listener CicoSCWlWinMgrIF::ms_wlOutputListener = {
-    .geometry = CicoSCWlWinMgrIF::wlOutputGeometryCB,
-    .mode     = CicoSCWlWinMgrIF::wlOutputModeCB
-};
-
 //--------------------------------------------------------------------------
 /**
  *  @brief  default constructor
  */
 //--------------------------------------------------------------------------
 CicoSCWlWinMgrIF::CicoSCWlWinMgrIF()
-    : m_winmgr(NULL), m_wloutput(NULL), m_wlshm(NULL)
+    : m_winmgr(NULL), m_wloutput(NULL)
 {
-       strcpy(m_shmName, "/tmp/ico/thumbnail-shm-XXXXXX");
+    // ico_window_mgr listener
+    m_listener.window_created   = wlCreatedCB;
+    m_listener.window_name      = wlNameCB;
+    m_listener.window_destroyed = wlDestroyedCB;
+    m_listener.window_visible   = wlVisibleCB;
+    m_listener.window_configure = wlConfigureCB;
+    m_listener.window_active    = wlActiveCB;
+    m_listener.layer_visible    = wlLayerVisibleCB;
+    m_listener.app_surfaces     = wlAppSurfacesCB;
+    m_listener.map_surface      = wlMapSurfaceCB;
+
+    // wayland output listener
+    m_wlOutputListener.geometry = wlOutputGeometryCB;
+    m_wlOutputListener.mode     = wlOutputModeCB;
 }
 
 //--------------------------------------------------------------------------
@@ -71,11 +65,11 @@ CicoSCWlWinMgrIF::~CicoSCWlWinMgrIF()
 /**
  *  @brief  initialize ico_window_mgr interfaces
  *
- *  @param [IN] data        user data
- *  @param [IN] registry    wayland registry
- *  @param [IN] name        wayland display id
- *  @parma [IN] interface   wayland interface name
- *  @parma [IN] version     wayland interface version number
+ *  @param [in] data        user data
+ *  @param [in] registry    wayland registry
+ *  @param [in] name        wayland display id
+ *  @parma [in] interface   wayland interface name
+ *  @parma [in] version     wayland interface version number
  */
 //--------------------------------------------------------------------------
 void
@@ -104,7 +98,7 @@ CicoSCWlWinMgrIF::initInterface(void               *data,
 
         m_winmgr = (struct ico_window_mgr *)wlProxy;
         ico_window_mgr_add_listener(m_winmgr, 
-                                    &ms_listener,
+                                    &m_listener,
                                     this);
 #if 0
         ico_window_mgr_set_user_data(m_winmgr, NULL/*TODO*/);
@@ -130,49 +124,18 @@ CicoSCWlWinMgrIF::initInterface(void               *data,
 
         m_wloutput = (struct wl_output*)wlProxy;
         wl_output_add_listener(m_wloutput, 
-                               &ms_wlOutputListener,
+                               &m_wlOutputListener,
                                this);
 #if 0
         wl_output_set_user_data(m_wloutput, NULL/*TODO*/);
 #endif
     }
-    else if (0 == strcmp(interface, ICO_WL_SHM_IF)) {
-        // get interface instance
-        void *wlProxy = wl_registry_bind(registry,
-                                         name,
-                                         &wl_shm_interface,
-                                         1);
-               m_wlshm = (struct wl_shm*)wlProxy;
-        if (NULL == wlProxy) {
-            ICO_WRN("initInterface : interface(%s) wl_registry_bind failed.",
-                    interface);
-            ICO_WRN("CicoSCWlWinMgrIF::initInterface : Leave(binding failed)");
-            return;
-        }
-        // TODO mkdir
-        int fd = mkostemp(m_shmName, O_CLOEXEC);
-        if (fd < 0) {
-            ICO_ERR("CicoSCWlWinMgrIF::initInterface : Leave(mkostemp failed)");
-            return;
-        }
-        if (ftruncate(fd, ICO_WL_SHM_SIZE) < 0) {
-            ICO_ERR("CicoSCWlWinMgrIF::initInterface : Leave(ftruncate failed)");
-            close(fd);
-            return;
-        }
-        m_wlshmpool = wl_shm_create_pool(m_wlshm, fd, ICO_WL_SHM_SIZE);
-        close(fd);
-        if (NULL == m_wlshmpool) {
-            ICO_ERR("CicoSCWlWinMgrIF::initInterface : Leave(wl_shm_create_pool failed)");
-            return;
-        }
-    }
     else {
         ICO_WRN("initInterface : Leave(unmatch interface)");
         return;
     }
 
-    if((NULL != m_winmgr) && (NULL != m_wloutput) && (NULL != m_wlshm)) {
+    if((NULL != m_winmgr) && (NULL != m_wloutput)) {
         m_initialized = true;
     }
 
@@ -181,14 +144,230 @@ CicoSCWlWinMgrIF::initInterface(void               *data,
 
 //--------------------------------------------------------------------------
 /** 
+ *  @brief   wrapper function of ico_window_mgr_declare_manager
+ *  
+ *  @param [in] manager type of manager
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::declareManager(int32_t manager)
+{
+    // declare manager request to Multi Window Manager
+    ICO_DBG("called: ico_window_mgr_declare_manager(manager=%d)", manager);
+    ico_window_mgr_declare_manager(m_winmgr, manager);
+}
+
+//--------------------------------------------------------------------------
+/** 
+ *  @brief   wrapper function of ico_window_mgr_set_window_layer
+ *  
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] layer           number of layer
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::setWindowLayer(uint32_t surfaceid, uint32_t layer)
+{
+    // set window layer request to Multi Window Manager
+    ICO_DBG("called: ico_window_mgr_set_window_layer"
+            "(surfaceid=0x%08X layer=%d)", surfaceid, layer);
+    ico_window_mgr_set_window_layer(m_winmgr, surfaceid, layer);
+}
+
+//--------------------------------------------------------------------------
+/** 
+ *  @brief   wrapper function of ico_window_mgr_set_positionsize
+ *  
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] layer           number of layer
+ *  @param [in] x
+ *  @param [in] y
+ *  @param [in] width
+ *  @param [in] height
+ *  @param [in] flags
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::setPositionsize(uint32_t surfaceid, uint32_t node,
+                                  int32_t x, int32_t y, int32_t width,
+                                  int32_t height, int32_t flags)
+{
+    // set position size request to Multi Window Manager
+    ICO_DBG("called: ico_window_mgr_set_positionsize"
+            "(surfaceid=0x%08X node=%d x=%d y=%d w=%d h=%d flags=%d)",
+            surfaceid, node, x, y, width, height, flags);
+    ico_window_mgr_set_positionsize(m_winmgr, surfaceid, node,
+                                    x, y, width, height, flags);
+}
+
+//--------------------------------------------------------------------------
+/** 
+ *  @brief   wrapper function of ico_window_mgr_set_visible
+ *  
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] visible         visible state
+ *  @param [in] raise           raise state
+ *  @param [in] flags           option on change visible
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::setVisible(uint32_t surfaceid, int32_t visible,
+                             int32_t raise, int32_t flags)
+{
+    // set visible request to Multi Window Manager
+    ICO_DBG("called: ico_window_mgr_set_visible"
+            "(surfaceid=0x%08X visible=%d raise=%d anima=%d)",
+            surfaceid, visible, raise, flags);
+    ico_window_mgr_set_visible(m_winmgr, surfaceid, visible, raise, flags);
+}
+
+//--------------------------------------------------------------------------
+/** 
+ *  @brief   wrapper function of ico_window_mgr_visible_animation
+ *  
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] visible         visible state
+ *  @param [in] raise           raise state
+ *  @param [in] flags           option on change visible
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::visibleAnimation(uint32_t surfaceid, int32_t visible,
+                                   int32_t x, int32_t y,
+                                   int32_t width, int32_t height)
+{
+    // visible animation request to Multi Window Manager
+    ICO_DBG("called: ico_window_mgr_visible_animation"
+            "(surfaceid=0x%08X visible=%d x=%d y=%d w=%d h=%d)",
+            surfaceid, visible, x, y, width, height);
+    ico_window_mgr_visible_animation(m_winmgr, surfaceid, visible,
+                                     x, y, width, height);
+}
+
+//--------------------------------------------------------------------------
+/** 
+ *  @brief   wrapper function of ico_window_mgr_set_animation
+ *  
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] type            transition type
+ *  @param [in] animation       name of animation
+ *  @param [in] time            time of animation
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::setAnimation(uint32_t surfaceid, int32_t type,
+                               const char *animation, int32_t time)
+{
+    ICO_DBG("called: ico_window_mgr_set_animation"
+            "(surfaceid=0x%08X type=%d anima=%s time=%d)",
+            surfaceid, type, animation, time);
+    ico_window_mgr_set_animation(m_winmgr, surfaceid, type, animation, time);
+}
+
+//--------------------------------------------------------------------------
+/** 
+ *  @brief   wrapper function of ico_window_mgr_set_attributes
+ *  
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] attributes      attributes of surface
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::setAttributes(uint32_t surfaceid, uint32_t attributes)
+{
+    ICO_DBG("called: ico_window_mgr_set_attributes"
+            "(surfaceid=0x%08X attributes=%d)", surfaceid, attributes);
+    ico_window_mgr_set_attributes(m_winmgr, surfaceid, attributes);
+}
+
+//--------------------------------------------------------------------------
+/** 
+ *  @brief   wrapper function of ico_window_mgr_set_active
+ *  
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] active          flags od active device
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::setActive(uint32_t surfaceid, int32_t active)
+{
+    ICO_DBG("called: ico_window_mgr_set_active"
+            "(surfaceid=0x%08X active=%d)", surfaceid, active);
+    ico_window_mgr_set_active(m_winmgr, surfaceid, active);
+}
+
+//--------------------------------------------------------------------------
+/** 
+ *  @brief   wrapper function of ico_window_mgr_set_layer_visible
+ *  
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] layer           id of layer
+ *  @param [in] visible         visible state
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::setLayerVisible(uint32_t layer, int32_t visible)
+{
+    ICO_DBG("called: ico_window_mgr_set_layer_visible"
+            "(layer=%d visible=%d)", layer, visible);
+    ico_window_mgr_set_layer_visible(m_winmgr, layer, visible);
+}
+
+//--------------------------------------------------------------------------
+/** 
+ *  @brief   wrapper function of ico_window_mgr_get_surfaces
+ *  
+ *  @param [in] appid           id of application
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::getSurfaces(const char *appid)
+{
+    ICO_DBG("called: ico_window_mgr_get_surfaces(appid=%d)", appid);
+    ico_window_mgr_get_surfaces(m_winmgr, appid);
+}
+
+//--------------------------------------------------------------------------
+/** 
+ *  @brief   wrapper function of ico_window_mgr_map_surface
+ *  
+ *  @param [in] surface     id of wayland surface
+ *  @param [in] framerate   interval of changed notify[frame per second]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::mapSurface(uint32_t surfaceid, int32_t framerate)
+{
+    ICO_DBG("called: ico_window_mgr_map_surface"
+            "(surfaceid=0x%08X framerate=%d)", surfaceid, framerate);
+    ico_window_mgr_map_surface(m_winmgr, surfaceid, framerate);
+}
+
+//--------------------------------------------------------------------------
+/** 
+ *  @brief   wrapper function of ico_window_mgr_unmap_surface
+ *  
+ *  @param [in] surface     id of wayland surface
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::unmapSurface(uint32_t surfaceid)
+{
+    ICO_DBG("called: ico_window_mgr_unmap_surface"
+            "(surfaceid=0x%08X)", surfaceid);
+    ico_window_mgr_unmap_surface(m_winmgr, surfaceid);
+}
+
+//--------------------------------------------------------------------------
+/** 
  *  @brief   wayland surface create 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
- *  @param [IN] winname         surface window name(title)
- *  @param [IN] pid             wayland client process Id
- *  @param [IN] appid           wayland client application Id
+ *  @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
+ *  @param [in] winname         surface window name(title)
+ *  @param [in] pid             wayland client process Id
+ *  @param [in] appid           wayland client application Id
  */
 //--------------------------------------------------------------------------
 void
@@ -206,10 +385,10 @@ CicoSCWlWinMgrIF::createdCB(void                  *data,
 /**
  *  @brief  wayland change surface name 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
- * @param [IN] winname         surface window name(title)
+ * @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
+ * @param [in] winname         surface window name(title)
  */
 //--------------------------------------------------------------------------
 void
@@ -225,9 +404,9 @@ CicoSCWlWinMgrIF::nameCB(void                  *data,
 /**
  *  @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
+ *  @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
@@ -240,15 +419,15 @@ CicoSCWlWinMgrIF::destroyedCB(void                  *data,
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland surface visible callback(static fu *
- *  @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
- *  @param [IN] visible         surface visible
- *                              (1=visible/0=unvisible/other=nochange)
- *  @param [IN] raise           surface raise
- *                              (1=raise/0=lower/other=nochange)
- *  @param [IN] hint            client request
+ *  @brief  wayland surface visible 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
+ *  @param [in] visible         surface visible
+ *                              (1=visible/0=invisible/other=no change)
+ *  @param [in] raise           surface raise
+ *                              (1=raise/0=lower/other=no change)
+ *  @param [in] hint            client request
  *                              (1=client request(not changed)/0=changed)
  */
 //--------------------------------------------------------------------------
@@ -267,15 +446,15 @@ CicoSCWlWinMgrIF::visibleCB(void                  *data,
 /**
  *  @brief  wayland surface configure 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
- *  @param [IN] node            surface node Id
- *  @param [IN] x               surface upper-left X coodinate
- *  @param [IN] y               surface upper-left Y coodinate
- *  @param [IN] width           surface width
- *  @param [IN] height          surface height
- *  @param [IN] hint            client request
+ *  @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
+ *  @param [in] node            surface node Id
+ *  @param [in] x               surface upper-left X coordinate
+ *  @param [in] y               surface upper-left Y coordinate
+ *  @param [in] width           surface width
+ *  @param [in] height          surface height
+ *  @param [in] hint            client request
  *                              (1=client request(not changed)/0=changed)
  */
 //--------------------------------------------------------------------------
@@ -296,12 +475,12 @@ CicoSCWlWinMgrIF::configureCB(void                  *data,
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland surface active callback(static func
+ *  @brief  wayland surface active 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
- *  @param [IN] active          surface active
+ *  @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
+ *  @param [in] active          surface active
  *                              (1=active/0=not active)
  */
 //--------------------------------------------------------------------------
@@ -316,13 +495,13 @@ CicoSCWlWinMgrIF::activeCB(void                  *data,
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland layer visible callback(stati
+ *  @brief  wayland layer visible callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] layer           layer Id
- *  @param [IN] visible         layer visible
- *                              (1=visible/0=unvisible/other=nochange)
+ *  @param [in] data            user data(unused)
+ *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [in] layer           layer Id
+ *  @param [in] visible         layer visible
+ *                              (1=visible/0=invisible/other=no change)
  */
 //--------------------------------------------------------------------------
 void
@@ -336,12 +515,12 @@ CicoSCWlWinMgrIF::layerVisibleCB(void                  *data,
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  query applicationsurface callback
+ *  @brief  query application surface callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] appid           application Id
- *  @param [IN] suface          surface Id array
+ *  @param [in] data            user data(unused)
+ *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [in] appid           application Id
+ *  @param [in] surface         surface Id array
  */
 //--------------------------------------------------------------------------
 void
@@ -357,14 +536,14 @@ CicoSCWlWinMgrIF::appSurfacesCB(void                  *data,
 /**
  *  @brief   surface map event callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] event           event
- *  @param [IN] surfaceid       surface Id
- *  @param [IN] width           surface width
- *  @param [IN] height          surface height
- *  @param [IN] stride          surface buffer(frame buffer) stride
- *  @param [IN] format          surface buffer format
+ *  @param [in] data            user data(unused)
+ *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [in] event           event
+ *  @param [in] surfaceid       surface Id
+ *  @param [in] width           surface width
+ *  @param [in] height          surface height
+ *  @param [in] stride          surface buffer(frame buffer) stride
+ *  @param [in] format          surface buffer format
  */
 //--------------------------------------------------------------------------
 void
@@ -386,16 +565,16 @@ CicoSCWlWinMgrIF::mapSurfaceCB(void                  *data,
 /**
  *  @brief   wayland display attribute callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] wl_output       wayland wl_output interface
- *  @param [IN] x               display upper-left X coodinate
- *  @param [IN] y               display upper-left Y coodinate
- *  @param [IN] physical_width  display physical width
- *  @param [IN] physical_height display physical height
- *  @param [IN] subpixel        display sub pixcel
- *  @param [IN] make            display maker
- *  @param [IN] model           diaplay model
- *  @param [IN] transform       transform
+ *  @param [in] data            user data(unused)
+ *  @param [in] wl_output       wayland wl_output interface
+ *  @param [in] x               display upper-left X coordinate
+ *  @param [in] y               display upper-left Y coordinate
+ *  @param [in] physical_width  display physical width
+ *  @param [in] physical_height display physical height
+ *  @param [in] subpixel        display sub pixel
+ *  @param [in] make            display maker
+ *  @param [in] model           display model
+ *  @param [in] transform       transform
  */
 //--------------------------------------------------------------------------
 void
@@ -417,12 +596,12 @@ CicoSCWlWinMgrIF::outputGeometryCB(void             *data,
 /**
  *  @brief  wayland display mode callback
  *
- *  @param [IN] data        user data(unused)
- *  @param [IN] wl_output   wayland wl_output interface
- *  @param [IN] flags       flags
- *  @param [IN] width       display width
- *  @param [IN] height      display height
- *  @param [IN] refresh     display refresh rate
+ *  @param [in] data        user data(unused)
+ *  @param [in] wl_output   wayland wl_output interface
+ *  @param [in] flags       flags
+ *  @param [in] width       display width
+ *  @param [in] height      display height
+ *  @param [in] refresh     display refresh rate
  */
 //--------------------------------------------------------------------------
 void
@@ -444,12 +623,12 @@ CicoSCWlWinMgrIF::outputModeCB(void             *data,
 /** 
  *  @brief   wayland surface create 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
- *  @param [IN] winname         surface window name(title)
- *  @param [IN] pid             wayland client process Id
- *  @param [IN] appid           wayland client application Id
+ *  @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
+ *  @param [in] winname         surface window name(title)
+ *  @param [in] pid             wayland client process Id
+ *  @param [in] appid           wayland client application Id
  */
 //--------------------------------------------------------------------------
 void
@@ -475,10 +654,10 @@ CicoSCWlWinMgrIF::wlCreatedCB(void                  *data,
 /**
  *  @brief  wayland change surface name 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
- * @param [IN] winname         surface window name(title)
+ * @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
+ * @param [in] winname         surface window name(title)
  */
 //--------------------------------------------------------------------------
 void
@@ -502,9 +681,9 @@ CicoSCWlWinMgrIF::wlNameCB(void                  *data,
 /**
  *  @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
+ *  @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
@@ -527,14 +706,14 @@ CicoSCWlWinMgrIF::wlDestroyedCB(void                  *data,
 /**
  *  @brief  wayland surface visible 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
- *  @param [IN] visible         surface visible
- *                              (1=visible/0=unvisible/other=nochange)
- *  @param [IN] raise           surface raise
- *                              (1=raise/0=lower/other=nochange)
- *  @param [IN] hint            client request
+ *  @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
+ *  @param [in] visible         surface visible
+ *                              (1=visible/0=invisible/other=no change)
+ *  @param [in] raise           surface raise
+ *                              (1=raise/0=lower/other=no change)
+ *  @param [in] hint            client request
  *                              (1=client request(not changed)/0=changed)
  */
 //--------------------------------------------------------------------------
@@ -562,15 +741,15 @@ CicoSCWlWinMgrIF::wlVisibleCB(void                  *data,
 /**
  *  @brief  wayland surface configure 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
- *  @param [IN] node            surface node Id
- *  @param [IN] x               surface upper-left X coodinate
- *  @param [IN] y               surface upper-left Y coodinate
- *  @param [IN] width           surface width
- *  @param [IN] height          surface height
- *  @param [IN] hint            client request
+ *  @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
+ *  @param [in] node            surface node Id
+ *  @param [in] x               surface upper-left X coordinate
+ *  @param [in] y               surface upper-left Y coordinate
+ *  @param [in] width           surface width
+ *  @param [in] height          surface height
+ *  @param [in] hint            client request
  *                              (1=client request(not changed)/0=changed)
  */
 //--------------------------------------------------------------------------
@@ -600,12 +779,12 @@ CicoSCWlWinMgrIF::wlConfigureCB(void                  *data,
 }
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland surface active callback(static func
+ *  @brief  wayland surface active 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
- *  @param [IN] active          surface active
+ *  @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
+ *  @param [in] active          surface active
  *                              (1=active/0=not active)
  */
 //--------------------------------------------------------------------------
@@ -628,13 +807,13 @@ CicoSCWlWinMgrIF::wlActiveCB(void                  *data,
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  wayland layer visible callback(stati
+ *  @brief  wayland layer visible callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] layer           layer Id
- *  @param [IN] visible         layer visible
- *                              (1=visible/0=unvisible/other=nochange)
+ *  @param [in] data            user data(unused)
+ *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [in] layer           layer Id
+ *  @param [in] visible         layer visible
+ *                              (1=visible/0=invisible/other=no change)
  */
 //--------------------------------------------------------------------------
 void
@@ -656,12 +835,12 @@ CicoSCWlWinMgrIF::wlLayerVisibleCB(void                  *data,
 
 //--------------------------------------------------------------------------
 /**
- *  @brief  query applicationsurface callback
+ *  @brief  query application surface callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] appid           application Id
- *  @param [IN] suface          surface Id array
+ *  @param [in] data            user data(unused)
+ *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [in] appid           application Id
+ *  @param [in] surface         surface Id array
  */
 //--------------------------------------------------------------------------
 void
@@ -685,14 +864,16 @@ CicoSCWlWinMgrIF::wlAppSurfacesCB(void                  *data,
 /**
  *  @brief   surface map event callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
- *  @param [IN] event           event
- *  @param [IN] surfaceid       surface Id
- *  @param [IN] width           surface width
- *  @param [IN] height          surface height
- *  @param [IN] stride          surface buffer(frame buffer) stride
- *  @param [IN] format          surface buffer format
+ *  @param [in] data            user data
+ *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [in] event           event
+ *  @param [in] surfaceid       surface Id
+ *  @param [IN] type            buffer type(fixed ICO_WINDOW_MGR_MAP_TYPE_EGL)
+ *  @param [IN] target          EGL buffer name
+ *  @param [in] width           surface width
+ *  @param [in] height          surface height
+ *  @param [in] stride          surface buffer(frame buffer) stride
+ *  @param [in] format          surface buffer format
  */
 //--------------------------------------------------------------------------
 void
@@ -725,16 +906,16 @@ CicoSCWlWinMgrIF::wlMapSurfaceCB(void                  *data,
 /**
  *  @brief   wayland display attribute callback
  *
- *  @param [IN] data            user data(unused)
- *  @param [IN] wl_output       wayland wl_output interface
- *  @param [IN] x               display upper-left X coodinate
- *  @param [IN] y               display upper-left Y coodinate
- *  @param [IN] physical_width  display physical width
- *  @param [IN] physical_height display physical height
- *  @param [IN] subpixel        display sub pixcel
- *  @param [IN] make            display maker
- *  @param [IN] model           diaplay model
- *  @param [IN] transform       transform
+ *  @param [in] data            user data(unused)
+ *  @param [in] wl_output       wayland wl_output interface
+ *  @param [in] x               display upper-left X coordinate
+ *  @param [in] y               display upper-left Y coordinate
+ *  @param [in] physical_width  display physical width
+ *  @param [in] physical_height display physical height
+ *  @param [in] subpixel        display sub pixel
+ *  @param [in] make            display maker
+ *  @param [in] model           display model
+ *  @param [in] transform       transform
  */
 //--------------------------------------------------------------------------
 void
@@ -770,12 +951,12 @@ CicoSCWlWinMgrIF::wlOutputGeometryCB(void             *data,
 /**
  *  @brief  wayland display mode callback
  *
- *  @param [IN] data        user data(unused)
- *  @param [IN] wl_output   wayland wl_output interface
- *  @param [IN] flags       flags
- *  @param [IN] width       display width
- *  @param [IN] height      display height
- *  @param [IN] refresh     display refresh rate
+ *  @param [in] data        user data(unused)
+ *  @param [in] wl_output   wayland wl_output interface
+ *  @param [in] flags       flags
+ *  @param [in] width       display width
+ *  @param [in] height      display height
+ *  @param [in] refresh     display refresh rate
  */
 //--------------------------------------------------------------------------
 void
index 8abec0f..cffde14 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   CicoSCWlWinMgrIF.h
  *
- *  @brief  
+ *  @brief  This file is definition of CicoSCWlWinMgrIF class
  */
 //==========================================================================
 #ifndef __CICO_SC_WL_WINMGR_IF_H__
 
 #include "CicoSCWaylandIF.h"
 
+//--------------------------------------------------------------------------
+/**
+ *  @brief  This class is wayland interface of multi window manager
+ */
+//--------------------------------------------------------------------------
 class CicoSCWlWinMgrIF : public CicoSCWaylandIF {
 public:
     virtual void initInterface(void               *data,
@@ -30,7 +35,6 @@ public:
                                const char         *interface,
                                uint32_t           version);
 
-
     virtual void createdCB(void *data,
                            struct ico_window_mgr *ico_window_mgr,
                            uint32_t surfaceid,
@@ -123,6 +127,48 @@ protected:
     // copy constructor
     CicoSCWlWinMgrIF(const CicoSCWlWinMgrIF &object);
 
+    // wrapper function ico_window_mgr_declare_manager
+    void declareManager(int32_t manager);
+
+    // wrapper function ico_window_mgr_set_window_layer
+    void setWindowLayer(uint32_t surfaceid, uint32_t layer);
+
+    // 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);
+
+    // wrapper function ico_window_mgr_set_visible
+    void setVisible(uint32_t surfaceid, int32_t  visible,
+                    int32_t  raise, int32_t  flags);
+
+    // wrapper function ico_window_mgr_visible_animation
+    void visibleAnimation(uint32_t surfaceid, int32_t visible,
+                          int32_t x, int32_t y,
+                          int32_t width, int32_t height);
+
+    // wrapper function of ico_window_mgr_set_animation
+    void setAnimation(uint32_t surfaceid, int32_t type,
+                      const char *animation, int32_t time);
+
+    // wrapper function of ico_window_mgr_set_attributes
+    void setAttributes(uint32_t surfaceid, uint32_t attributes);
+
+    // wrapper function of ico_window_mgr_set_active
+    void setActive(uint32_t surfaceid, int32_t active);
+
+    // wrapper function of ico_window_mgr_set_layer_visible
+    void setLayerVisible(uint32_t layer, int32_t visible);
+
+    // wrapper function of ico_window_mgr_get_surfaces
+    void getSurfaces(const char *appid);
+
+    // wrapper function of ico_window_mgr_map_surface
+    void mapSurface(uint32_t surfaceid, int32_t framerate);
+
+    // wrapper function of ico_window_mgr_unmap_surface
+    void unmapSurface(uint32_t surfaceid);
+
 private:
     // ico_window_mgr(Multi Window Manager) callback functions
     static void wlCreatedCB(void                  *data,
@@ -206,10 +252,10 @@ private:
 
 protected:
     // ico_window_mgr listener 
-    static struct ico_window_mgr_listener ms_listener;
+    struct ico_window_mgr_listener m_listener;
 
     // wayland output listener
-    static struct wl_output_listener ms_wlOutputListener;
+    struct wl_output_listener m_wlOutputListener;
 
     // Wayland's Window Manager PlugIn instance
     struct ico_window_mgr *m_winmgr;
@@ -217,18 +263,6 @@ protected:
     // wayland output instance
     struct wl_output *m_wloutput;
 
-    // wayland shm instance
-    struct wl_shm *m_wlshm;
-
-    // shared memory temp file name
-    char m_shmName[256];
-
-    // shared memory temp file name
-    static const int ICO_WL_SHM_SIZE = 16 * 1024 * 1024;
-    
-    // wayland shared memory  pool
-    struct wl_shm_pool *m_wlshmpool;
-
 };
-#endif // __CICO_SC_WL_WINMGR_IF_H__
+#endif  // __CICO_SC_WL_WINMGR_IF_H__
 // vim:set expandtab ts=4 sw=4:
index 432ad3d..84c0952 100644 (file)
@@ -10,7 +10,6 @@ libico_system_controller_la_SOURCES = \
        CicoSCAilItems.cpp                                      \
        CicoSCAulItems.cpp                                      \
        CicoSCLifeCycleController.cpp           \
-       ico_log.c                                                       \
        CicoSCSystemConfig.cpp                          \
        CicoSCWaylandIF.cpp                                     \
        CicoSCWayland.cpp                                       \
@@ -25,7 +24,7 @@ libico_system_controller_la_SOURCES = \
        CicoSCSwitch.cpp                                        \
        CicoSCInputController.cpp                       \
        CicoSCServer.cpp                                        \
-       CicoSCCommandParser.cpp                         \
+       CicoSCCommand.cpp                                       \
        CicoSCMessage.cpp                               \
        CicoSCUser.cpp                                          \
        CicoSCUserManager.cpp                           \
@@ -35,7 +34,7 @@ libico_system_controller_la_SOURCES = \
        ico_syc_mrp_resource.c                          \
        CicoSCPolicyManager.cpp
 
-libico_system_controller_la_CPPFLAGS =         \
+libico_system_controller_la_CPPFLAGS = \
        $(GCC_CXXFLAGS)                                         \
        @ECORE_CFLAGS@                                          \
        @EINA_CFLAGS@                                           \
@@ -51,9 +50,9 @@ libico_system_controller_la_CPPFLAGS =        \
        @MURPHYDOMAINCONTROLLER_CFLAGS@         \
        @MURPHYECORE_CFLAGS@                            \
        @MURPHYRESOURCE_CFLAGS@                         \
+       $(UWS_CFLAGS)                                           \
+       $(WESTONPLUGIN_CFLAGS)                          \
        -I../../include                                         \
-       -I/usr/include/ico-util                         \
-       -I/usr/include/ico-uxf-weston-plugin \
        -I../misc/state-machine
 
 libico_system_controller_la_LIBADD =   \
@@ -71,10 +70,11 @@ libico_system_controller_la_LIBADD =        \
        @MURPHYDOMAINCONTROLLER_LIBS@           \
        @MURPHYECORE_LIBS@                                      \
        @MURPHYRESOURCE_LIBS@                           \
-       -L/usr/lib                                                      \
-       -lico-uxf-weston-plugin                         \
-       -lico-util-com
+       $(UWS_LIBS)                                                     \
+       $(WESTONPLUGIN_LIBS)
 
 AM_LDFLAGS = -module -avoid-version -rpath $(libdir)
 
 .FORCE :
+
+# vim:set ts=4 sw=4:
diff --git a/lib/system-controller/ico_log.c b/lib/system-controller/ico_log.c
deleted file mode 100644 (file)
index fad8324..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-
-/*------------------------------------------------------------------------*/
-/**
- *  @file   ico_log.c
- *
- *  @brief  
- */
-/*------------------------------------------------------------------------*/
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <time.h>
-#include "ico_log.h"
-
-/*========================================================================*/
-/**
- *  static variable
- */
-/*========================================================================*/
-
-int  time_zone    = 99*60*60;   /*!< local time difference(sec)           */
-int  log_level    = 0x7FFFFFFF; /*!< output level debug log               */
-bool flush_mode   = true;       /*!< flush mode flag                      */  
-bool initialized  = false;      /*!< initialized flag                     */
-FILE *log_fd      = NULL;       /*!< file descriptor of output debug log  */
-int  log_lines    = 0;          /*!< output lines                         */
-char log_prog[32] = {0,};       /*!< name of output source module         */
-
-                                                                            
-/*------------------------------------------------------------------------*/
-/**
- *  @brief  printout log message
- *
- *  @param [in] level   log output level
- *  @param [in] fmt     message format(same as printf)
- *  @param [in] ...     arguments if need
- */
-/*------------------------------------------------------------------------*/
-void
-ico_log_print(int level, const char *fmt, ...)
-{
-    if (log_level < level) {
-        return;
-    }
-    va_list     list;
-
-    if (NULL == log_fd) {
-        ico_log_open(NULL);
-    }
-#if ICO_APF_LOG_STDOUT == 0
-    else if (log_lines >= (ICO_LOG_MAXLINES-2)) {
-        if (log_lines >= ICO_LOG_MAXLINES)  {
-            ico_log_close();
-            ico_log_open(log_prog);
-        }
-        else    {
-            fflush(log_fd);
-        }
-    }
-#endif /*ICO_APF_LOG_STDOUT*/
-    if (NULL != log_fd) {
-        va_start(list, fmt);
-        vfprintf(log_fd, fmt, list);
-        va_end(list);
-        if (flush_mode)  {
-            fflush(log_fd);
-        }
-    }
-    if (log_fd != stdout)   {
-        log_lines ++;
-    }
-}
-
-/*------------------------------------------------------------------------*/
-/**
- *  @brief  open log file
- *
- *  @param [in] prog    program name
- */
-/*------------------------------------------------------------------------*/
-void
-ico_log_open(const char *prog)
-{
-#if ICO_LOG_STDOUT == 0
-    int     idx;
-    char    sPath[128];
-    char    sPath2[128];
-#endif /*ICO_LOG_STDOUT*/
-
-    if (NULL != log_fd) {
-        fflush(log_fd);
-        if (log_fd != stdout)   {
-            fclose(log_fd);
-        }
-    }
-
-    log_lines = 0;
-
-    if ((! prog) || (*prog == 0)) {
-        log_fd = stdout;
-        log_prog[0] = 0;
-        return;
-    }
-    else {
-        strncpy(log_prog, prog, sizeof(log_prog)-1);
-        log_prog[sizeof(log_prog)-1] = 0;
-    }
-#if ICO_LOG_STDOUT > 0
-    log_fd = stdout;
-#else  /*ICO_LOG_STDOUT*/
-    snprintf(sPath, sizeof(sPath)-1, "%s/%s.log%d",
-             ICO_LOG_DIR, log_prog, ICO_LOG_MAXFILES-1);
-    (void)remove(sPath);
-
-    for (idx = (ICO_LOG_MAXFILES-1); idx > 0; idx--) {
-        strcpy(sPath2, sPath);
-        if (idx > 1)    {
-            snprintf(sPath, sizeof(sPath)-1, "%s/%s.log%d",
-                     ICO_LOG_DIR, log_prog, idx-1);
-        }
-        else    {
-            snprintf(sPath, sizeof(sPath)-1, "%s/%s.log",
-                     ICO_LOG_DIR, log_prog);
-        }
-        (void)rename(sPath, sPath2);
-    }
-
-    log_fd = fopen(sPath, "w");
-    if (NULL == log_fd) {
-        log_fd = stdout;
-    }
-    else if ((initialized == false) &&
-             (log_fd != stdout) && (log_fd != stderr)) {
-        initialized = true;
-        fflush(stdout);
-        fflush(stderr);
-        stdout = log_fd;
-        stderr = log_fd;
-    }
-#endif /*ICO_LOG_STDOUT*/
-}
-
-/*------------------------------------------------------------------------*/
-/**
- *  @brief  close log file
- */
-/*------------------------------------------------------------------------*/
-void
-ico_log_close(void)
-{
-#if ICO_LOG_STDOUT == 0
-    if (NULL != log_fd) {
-        fflush(log_fd);
-        if (log_fd != stdout) {
-            fclose(log_fd);
-        }
-        log_fd = (FILE *)NULL;
-    }
-#endif /*ICO_LOG_STDOUT*/
-}
-
-/*------------------------------------------------------------------------*/
-/**
- *  @brief  flush log file
- */
-/*------------------------------------------------------------------------*/
-void
-ico_log_flush(void)
-{
-    if ((NULL != log_fd) && (false == flush_mode)) {
-        fflush(log_fd);
-    }
-}
-
-/*------------------------------------------------------------------------*/
-/**
- *  @brief   get current time string
- *
- *  @param [in] level   log level string(header of log message)
- *  @return current time string
- */
-/*------------------------------------------------------------------------*/
-char *
-ico_get_str_cur_time(const char *level)
-{
-    struct timeval  NowTime;
-    extern long     timezone;
-    static char     sBuf[28];
-
-    gettimeofday(&NowTime, (struct timezone *)0);
-    if (time_zone > (24*60*60)) {
-        tzset();
-        time_zone = timezone;
-    }
-    NowTime.tv_sec -= time_zone;
-
-    sprintf(sBuf, "%02d:%02d:%02d.%03d[%s]@%d",
-            (int)((NowTime.tv_sec/3600) % 24),
-            (int)((NowTime.tv_sec/60) % 60),
-            (int)(NowTime.tv_sec % 60),
-            (int)NowTime.tv_usec/1000, level, getpid());
-
-    return sBuf;
-}
-
-/*------------------------------------------------------------------------*/
-/**
- *  @brief  set log output level
- *
- *  @param [in] level   log output level
- */
-/*------------------------------------------------------------------------*/
-void
-ico_log_set_level(int level)
-{
-    log_level = level & (~(ICO_LOG_FLUSH|ICO_LOG_NOFLUSH));
-
-    if (log_level & (ICO_LOG_FLUSH|ICO_LOG_NOFLUSH)) {
-        if (log_level & ICO_LOG_FLUSH) {
-            flush_mode = true;
-        }
-        else    {
-            flush_mode = false;
-        }
-    }
-}
-/* vim:set expandtab ts=4 sw=4: */
diff --git a/lib/system-controller/ico_log.h b/lib/system-controller/ico_log.h
deleted file mode 100644 (file)
index 3b5e224..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-
-/*========================================================================*/    
-/**
- *  @file   ico_log.h
- *
- *  @brief  debug log function
- */
-/*========================================================================*/    
-#ifndef __ICO_LOG_H__
-#define __ICO_LOG_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef ICO_LOG_STDOUT
-#define ICO_LOG_STDOUT      0
-                            /**!< Log output to stdout(=1) or file(=0) */
-#endif /*ICO_APF_LOG_STDOUT*/
-
-#define ICO_LOG_DIR         "/var/log/ico"
-                           /**!< Directory name of Log destination */
-
-/* Maximum lines/files */
-#define ICO_LOG_MAXLINES    10000
-                            /**!< Maximum output lines of log file  */
-#define ICO_LOG_MAXFILES    6
-                            /**!< Maximum number of the log file    */
-
-/* Log output level */
-#define ICO_LOG_DEBUG       0x0080  /**!< Debug write */
-#define ICO_LOG_INFO        0x0040  /**!< Information */
-#define ICO_LOG_WARNING     0x0010  /**!< Warning     */
-#define ICO_LOG_CRITICAL    0x0008  /**!< Critical    */
-#define ICO_LOG_ERROR       0x0004  /**!< Error       */
-
-/* Log output flush */
-#define ICO_LOG_FLUSH       0x4000  /**!< Log outout with log flush     */
-#define ICO_LOG_NOFLUSH     0x2000  /**!< Log output without log flush  */
-
-#define ICO_TRA(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_DEBUG,                \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("DBG"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-#define ICO_DBG(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_DEBUG,                \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("DBG"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-#define ICO_INF(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_INFO,                 \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("INF"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-#define ICO_WRN(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_WARNING,              \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("WRN"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-#define ICO_CRI(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_CRITICAL,             \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("CRI"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-#define ICO_ERR(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_ERROR,                \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("ERR"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-
-void ico_log_print(int level, const char *fmt, ...);
-void ico_log_open(const char *prog);
-void ico_log_close(void);
-void ico_log_flush(void);
-char * ico_get_str_cur_time(const char *level);
-void ico_log_set_level(int level);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // __ICO__LOG_H__
-/* vim:set expandtab ts=4 sw=4: */
diff --git a/lib/system-controller/ico_syc_error.h b/lib/system-controller/ico_syc_error.h
deleted file mode 100644 (file)
index 7c7a47d..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-
-/*========================================================================*/
-/**
- *  @file   ico_syc_error.h
- *
- *  @brief  
- */
-/*========================================================================*/
-
-#ifndef __ICO_SYC_ERROR_H__
-#define __ICO_SYC_ERROR_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ICO_SYC_EOK              0  /* OK                           */
-#define ICO_SYC_EPERM           -1  /* Operation not permitted      */
-#define ICO_SYC_ENOENT          -2  /* No such object               */
-#define ICO_SYC_ESRCH           -3  /* Not initialized              */
-#define ICO_SYC_EIO             -5  /* I/O(send/receive) error      */
-#define ICO_SYC_ENXIO           -6  /* Not exist                    */
-#define ICO_SYC_E2BIG           -7  /* Buffer size too smale        */
-#define ICO_SYC_EBADF           -9  /* Illegal data type            */
-#define ICO_SYC_EAGAIN          -11 /* Try again                    */
-#define ICO_SYC_ENOMEM          -12 /* Out of memory                */
-#define ICO_SYC_EFAULT          -14 /* Bad address                  */
-#define ICO_SYC_EBUSY           -16 /* Not available now            */
-#define ICO_SYC_EEXIST          -17 /* Multiple define              */
-#define ICO_SYC_EINVAL          -22 /* Invalid argument             */
-#define ICO_SYC_ENOSYS          -38 /* System error                 */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* __ICO_SYC_ERROR_H__ */
-/* vim:set expandtab ts=4 sw=4: */
index 5883a66..4429242 100644 (file)
@@ -19,7 +19,7 @@
 #include <murphy/common/ecore-glue.h>
 #include <murphy/domain-control/client.h>
 
-#include "ico_log.h"
+#include <ico_log.h>
 #include "ico_syc_error.h"
 #include "ico_syc_mrp_resource_private.h"
 
@@ -41,11 +41,13 @@ static void ico_syc_mrp_data_notify(mrp_domctl_t *dc,
                                     int ntable, void *user_data);
 
 static mrp_res_queue_item_t *
-ico_syc_mrp_create_queue_item(resource_request_t *req, int prio);
+ico_syc_mrp_create_queue_item(resource_request_t *req);
 static resource_request_t *
 ico_syc_mrp_find_request(int req_id, char *appid);
+#if 0
 static void ico_syc_mrp_process_input_queue(void);
 static void ico_syc_mrp_process_display_queue(void);
+#endif
 static void ico_syc_mrp_process_sound_queue(void);
             
 /* Murphy resource library */ 
@@ -54,9 +56,7 @@ static mrp_res_context_t        *mrp_ctx = NULL;
 static mrp_mainloop_t           *mrp_ml = NULL; 
 static mrp_domctl_t             *mrp_dc = NULL; 
  
-static mrp_list_hook_t          mrp_disp_wait_queue; 
 static mrp_list_hook_t          mrp_sound_wait_queue; 
-static mrp_list_hook_t          mrp_input_wait_queue; 
  
 static mrp_list_hook_t          mrp_reqs; 
 
@@ -86,37 +86,29 @@ mrp_domctl_watch_t ico_watches[] = {
                      DISPLAY_OWNER_WHERE, 0),
 };
 
-static ico_syc_mrp_enforce_display_t ico_syc_mrp_enforce_displayCB = NULL;
-static ico_syc_mrp_enforce_sound_t   ico_syc_mrp_enforce_soundCB   = NULL;
-static ico_syc_mrp_enforce_input_t   ico_syc_mrp_enforce_inputCB   = NULL;
+static ico_syc_mrp_enforce_sound_t ico_syc_mrp_enforce_soundCB = NULL;
 static void *cb_user_data = NULL;
 
 
 /*-------------------------------------------------------------------------*/
 /*
- *  pablic functions
+ *  public functions
  */
 /*-------------------------------------------------------------------------*/
-int ico_syc_mrp_init(ico_syc_mrp_enforce_display_t dispcb,
-                     ico_syc_mrp_enforce_sound_t   soundcb,
-                     ico_syc_mrp_enforce_input_t   inputcb,
-                     void *user_data)
+int ico_syc_mrp_init(ico_syc_mrp_enforce_sound_t soundcb, void *user_data)
 
 {
 
     ICO_DBG("ico_syc_mrp_init: Enter");
 
-    ico_syc_mrp_enforce_displayCB = dispcb;
-    ico_syc_mrp_enforce_soundCB   = soundcb;
-    ico_syc_mrp_enforce_inputCB   = inputcb;
+    ico_syc_mrp_enforce_soundCB = soundcb;
     cb_user_data = user_data;
 
-    mrp_list_init(&mrp_disp_wait_queue);
     mrp_list_init(&mrp_sound_wait_queue);
-    mrp_list_init(&mrp_input_wait_queue);
 
     mrp_list_init(&mrp_reqs);
 
+    ICO_DBG("mrp_mainloop_ecore_get() called.");
     mrp_ml = mrp_mainloop_ecore_get();
 
     ICO_DBG("mrp_res_connecte() called.");
@@ -124,7 +116,7 @@ int ico_syc_mrp_init(ico_syc_mrp_enforce_display_t dispcb,
 
     if (!mrp_ctx) {
         ICO_ERR("ico_syc_mrp_init: Leave(mrp_res_create Error)");
-        return ICO_SYC_ENOSYS;
+        return ICO_SYC_EIO;
     }
 
     ICO_DBG("mrp_domctl_create() called.");
@@ -136,190 +128,131 @@ int ico_syc_mrp_init(ico_syc_mrp_enforce_display_t dispcb,
 
     if (mrp_dc == NULL) {
         ICO_ERR("ico_syc_mrp_init: Leave(mrp_domctl_create Error)");
-        return ICO_SYC_ENOSYS;
+        return ICO_SYC_EIO;
     } 
 
     ICO_DBG("mrp_domctl_connect() called.");
     if (!mrp_domctl_connect(mrp_dc, MRP_DEFAULT_DOMCTL_ADDRESS, 0)) {
         ICO_ERR("ico_syc_mrp_init: Leave(mrp_domctl_connect Error)");
-        return ICO_SYC_ENOSYS;
+        return ICO_SYC_EIO;
     } 
+
     return ICO_SYC_EOK;
 }
 
-bool
-ico_syc_mrp_acquire_display_resource(resource_request_t *req, int addprio)
+void
+ico_syc_mrp_add_request(resource_request_t *req)
 {
-    mrp_res_resource_set_t *rs;
-
-    ICO_DBG("ico_syc_mrp_acquire_display_resource: Enter");
-
-    if (NULL == mrp_ctx) {
-        ICO_DBG("ico_syc_mrp_acquire_display_resource: Leave(false)");
-        return false;
-    }
-
-    if (false == mrp_res_connected) {
-        mrp_res_queue_item_t *item;
-
-        ICO_ERR("murphy: resource context is not connected yet, queueing");
-
-        item = ico_syc_mrp_create_queue_item(req, addprio);
-        mrp_list_append(&mrp_disp_wait_queue, &item->hook);
-
-        ICO_DBG("ico_syc_mrp_acquire_display_resource: Leave(true)");
-        return true;
-    }
-    else {
-        /* store the request for Murphy */
-        mrp_list_init(&req->hook);
-        mrp_list_append(&mrp_reqs, &req->hook);
-    }
-
-    if (!req->rset) {
-        const char *resource_class = (addprio == ICO_UXF_PRIO_ONSCREEN) ? "emergency" : "basic";
-        mrp_res_resource_t   *res;
-        mrp_res_attribute_t  *attr;
-        mrp_res_queue_item_t *item;
-
-        ICO_DBG("murphy: going to create new resource set for screen");
-
-        item = ico_syc_mrp_create_queue_item(req, addprio);
-
-        if (NULL == item) {
-            return false;
-        }
-
-        rs = mrp_res_create_resource_set(mrp_ctx,
-                                         resource_class,
-                                         ico_syc_mrp_resource_cb,
-                                         item);
-
-        if (NULL == rs) {
-            ICO_ERR("murphy: could not create resource set for screen");
-            return false;
-        }
-
-        if (!mrp_res_set_autorelease(mrp_ctx, FALSE, rs)) {
-            ICO_ERR("murphy: failed to set autorelease mode");
-            return false;
-        }
-
-        res = mrp_res_create_resource(mrp_ctx, rs, "screen", TRUE, FALSE);
-
-        if (!res) {
-            ICO_ERR("murphy: could not create resource for screen");
-            return false;
-        }
-
-        attr = mrp_res_get_attribute_by_name(mrp_ctx, res, "pid");
-        ICO_DBG("murphy: attr=%x", attr);
-        if (attr) {
-            char numbuf[16];
-            unsigned int ret;
+    /* store the request for Murphy */
+    ICO_DBG("ico_syc_mrp_add_request: "
+            "add request %p to mrp_reqs list", req);
+    mrp_list_init(&req->hook);
+    mrp_list_append(&mrp_reqs, &req->hook);
 
-            ret = snprintf(numbuf, sizeof(numbuf), "%d", req->pid);
-
-            if (ret > 0 && ret < sizeof(numbuf)) {
-                mrp_res_set_attribute_string(mrp_ctx, attr, numbuf);
-            }      
-        }
-
-        attr = mrp_res_get_attribute_by_name(mrp_ctx, res, "category");
-        ICO_DBG("murphy: attr=%x", attr);
-        if (attr && attr->type == mrp_int32) {
-            mrp_res_set_attribute_int(mrp_ctx, attr, req->category);
-        }
-
-        attr = mrp_res_get_attribute_by_name(mrp_ctx, res, "appid");
-        ICO_DBG("murphy: attr=%x", attr);
-        if (attr && attr->type == mrp_string) {
-            mrp_res_set_attribute_string(mrp_ctx, attr, req->appid);
-        }
-
-        attr = mrp_res_get_attribute_by_name(mrp_ctx, res, "priority");
-        ICO_DBG("murphy: attr=%x", attr);
-        if (attr && attr->type == mrp_int32) {
-            mrp_res_set_attribute_int(mrp_ctx, attr, addprio);
-        }
-
-        req->rset = rs;
-        req->released = 0;
-    }
-
-    ICO_DBG("murphy: acquiring the resource set");
-    mrp_res_acquire_resource_set(mrp_ctx, req->rset);
-
-    ICO_DBG("ico_syc_mrp_acquire_display_resource: Leave(true)");
-    return true;
 }
 
-bool
-ico_syc_mrp_release_display_resource(resource_request_t *req)
+void
+ico_syc_mrp_del_request(resource_request_t *req)
 {
-    ICO_DBG("murphy: removed request %p from mrp_reqs list", req);
+    if (NULL == req) {
+        return;
+    }
+
+    ICO_DBG("ico_syc_mrp_del_request: "
+            "del request %p to mrp_reqs list", req);
     mrp_list_delete(&req->hook);
 
     if (mrp_ctx && req->rset) {
         mrp_res_release_resource_set(mrp_ctx, req->rset);
         mrp_res_delete_resource_set(mrp_ctx, req->rset);
-        mrp_free(req->res_data);
         req->rset = NULL;
     }
-
-    return true;
 }
 
 bool
-ico_syc_mrp_acquire_sound_resource(resource_request_t *req, int addprio)
+ico_syc_mrp_acquire_sound_resource(resource_request_t *newreq)
 {
     mrp_res_resource_set_t      *rs;
 
+    ICO_DBG("ico_syc_mrp_acquire_sound_resource: Enter");
+
+    resource_request_t *req = ico_syc_mrp_find_request(newreq->id,
+                                                       newreq->appid);
+    if (NULL == req) {
+        ico_syc_mrp_add_request(newreq);
+        req = newreq;
+    }
+
     if (mrp_ctx) {
         if (!mrp_res_connected) {
             mrp_res_queue_item_t *item;
 
-            ICO_DBG("murphy: resource context is not connected yet, queueing");
+            ICO_DBG("ico_syc_mrp_acquire_sound_resource: "
+                    "resource context is not connected yet, queueing");
 
-            item = ico_syc_mrp_create_queue_item(req, addprio);
+            item = ico_syc_mrp_create_queue_item(req);
             mrp_list_append(&mrp_sound_wait_queue, &item->hook);
 
-            return TRUE;
+            ICO_DBG("ico_syc_mrp_acquire_sound_resource: Leave(true)");
+            return true;
         }
 
         if (!req->rset) {
-            const char *resource_class = "basic";
+            int addprio = req->resid & RESID_TYPE_MASK;
+            const char *resource_class =
+                (addprio == RESID_TYPE_BASIC) ? "basic" : "emergency";
             mrp_res_resource_t *res;
-            ICO_DBG("murphy: going to create new resource set for input");
             mrp_res_attribute_t *attr;
 
-            ICO_DBG("murphy: going to create new resource set for input");
+            ICO_DBG("ico_syc_mrp_acquire_sound_resource: "
+                    "could not create resource for sound");
 
+            ICO_DBG("mrp_res_create_resource_set called.");
             rs = mrp_res_create_resource_set(mrp_ctx,
                                              resource_class,
                                              ico_syc_mrp_resource_cb,
                                              req);
 
             if (!rs) {
-                ICO_DBG("murphy: could not create resource set for input");
-                return FALSE;
+                ICO_ERR("ico_syc_mrp_acquire_sound_resource: "
+                        "could not create resource set for audio");
+                return false;
             }
 
+            ICO_DBG("mrp_res_set_autorelease called.");
             if (!mrp_res_set_autorelease(mrp_ctx, FALSE, rs)) {
-                ICO_DBG("murphy: failed to set autorelease mode");
-                return FALSE;
+                ICO_ERR("ico_syc_mrp_acquire_sound_resource: "
+                        "failed to set auto release mode");
+                ICO_DBG("ico_syc_mrp_acquire_sound_resource: Leave(false)");
+                return false;
             }
 
-            res = mrp_res_create_resource(mrp_ctx, rs, "input", TRUE, FALSE);
+            ICO_DBG("mrp_res_create_resource called.");
+            res = mrp_res_create_resource(mrp_ctx, rs, "audio_playback", TRUE, FALSE);
 
             if (!res) {
-                ICO_DBG("murphy: could not create resource for input");
-                return FALSE;
+                ICO_ERR("ico_syc_mrp_acquire_sound_resource: "
+                        "could not create resource for audio");
+                ICO_DBG("ico_syc_mrp_acquire_sound_resource: Leave(false)");
+                return false;
             }
 
+            ICO_DBG("pid=%d category=%d appid=%s priority=%d",
+                    req->pid, req->category, req->appid, req->prio);
+            attr = mrp_res_get_attribute_by_name(mrp_ctx, res, "pid");
+            if (attr && attr->type == mrp_string) {
+                char numbuf[16];
+                int ret;
+
+                ret = snprintf(numbuf, sizeof(numbuf), "%d", req->pid);
+
+                if (ret > 0 && (size_t)ret < sizeof(numbuf)) {
+                    mrp_res_set_attribute_string(mrp_ctx, attr, numbuf);
+                }
+            }
             attr = mrp_res_get_attribute_by_name(mrp_ctx, res, "category");
             if (attr && attr->type == mrp_int32) {
-               mrp_res_set_attribute_int(mrp_ctx, attr, req->category);
+                mrp_res_set_attribute_int(mrp_ctx, attr, req->category);
             }
 
             attr = mrp_res_get_attribute_by_name(mrp_ctx, res, "appid");
@@ -329,23 +262,28 @@ ico_syc_mrp_acquire_sound_resource(resource_request_t *req, int addprio)
 
             attr = mrp_res_get_attribute_by_name(mrp_ctx, res, "priority");
             if (attr && attr->type == mrp_int32) {
-               mrp_res_set_attribute_int(mrp_ctx, attr, addprio);
+               mrp_res_set_attribute_int(mrp_ctx, attr, 0/*req->prio*/);
             }
 
             req->rset = rs;
             req->released = 0;
         }
 
-        ICO_DBG("murphy: acquiring the resource set");
+        ICO_DBG("mrp_res_acquire_resource_set called.");
         mrp_res_acquire_resource_set(mrp_ctx, req->rset);
     }
 
-    return TRUE;
+    ICO_DBG("ico_syc_mrp_acquire_sound_resource: Leave(true)");
+    return true;
 }
 
 bool
 ico_syc_mrp_release_sound_resource(resource_request_t *req)
 {
+    ICO_DBG("ico_syc_mrp_release_sound_resource: Enter");
+
+    ico_syc_mrp_del_request(req);
+#if 0
     if (mrp_ctx && req->rset) {
         if (REQTYPE_APP == req->reqtype) {
             mrp_res_release_resource_set(mrp_ctx, req->rset);
@@ -357,95 +295,8 @@ ico_syc_mrp_release_sound_resource(resource_request_t *req)
             req->rset = NULL;
         }
     }
-
-    return true;
-}
-
-bool
-ico_syc_mrp_acquire_input_resource(resource_request_t *req, int addprio)
-{
-    mrp_res_resource_set_t      *rs;
-    //Ico_Uxf_conf_application    *conf = (Ico_Uxf_conf_application *)get_appconf(req->appid);
-
-    if (mrp_ctx) {
-
-        if (!mrp_res_connected) {
-            mrp_res_queue_item_t *item;
-
-            ICO_ERR("murphy: resource context is not connected yet, queueing");
-
-            item = ico_syc_mrp_create_queue_item(req, addprio);
-            mrp_list_append(&mrp_input_wait_queue, &item->hook);
-
-            return TRUE;
-        }
-
-        if (!req->rset) {
-            const char *resource_class = "basic";
-            mrp_res_resource_t *res;
-            ICO_DBG("murphy: going to create new resource set for input");
-            mrp_res_attribute_t *attr;
-
-            ICO_DBG("murphy: going to create new resource set for input");
-
-
-            rs = mrp_res_create_resource_set(mrp_ctx,
-                                             resource_class,
-                                             ico_syc_mrp_resource_cb,
-                                             req);
-
-            if (!rs) {
-                ICO_DBG("murphy: could not create resource set for input");
-                return FALSE;
-            }
-
-            if (!mrp_res_set_autorelease(mrp_ctx, FALSE, rs)) {
-                ICO_DBG("murphy: failed to set autorelease mode");
-                return FALSE;
-            }
-
-            res = mrp_res_create_resource(mrp_ctx, rs, "input", TRUE, FALSE);
-
-            if (!res) {
-                ICO_DBG("murphy: could not create resource for input");
-                return FALSE;
-            }
-
-            attr = mrp_res_get_attribute_by_name(mrp_ctx, res, "category");
-            if (attr && attr->type == mrp_int32) {
-               mrp_res_set_attribute_int(mrp_ctx, attr, req->category);
-            }
-
-            attr = mrp_res_get_attribute_by_name(mrp_ctx, res, "appid");
-            if (attr && attr->type == mrp_string) {
-                mrp_res_set_attribute_string(mrp_ctx, attr, req->appid);
-            }
-
-            attr = mrp_res_get_attribute_by_name(mrp_ctx, res, "priority");
-            if (attr && attr->type == mrp_int32) {
-               mrp_res_set_attribute_int(mrp_ctx, attr, addprio);
-            }
-
-            req->rset = rs;
-            req->released = 0;
-        }
-
-        ICO_DBG("murphy: acquiring the resource set");
-        mrp_res_acquire_resource_set(mrp_ctx, req->rset);
-    }
-
-    return false;
-}
-
-bool
-ico_syc_mrp_release_input_resource(resource_request_t *req)
-{
-    if (mrp_ctx && req->rset) {
-        mrp_res_release_resource_set(mrp_ctx, req->rset);
-        mrp_res_delete_resource_set(mrp_ctx, req->rset);
-        req->rset = NULL;
-    }
-
+#endif
+    ICO_DBG("ico_syc_mrp_release_sound_resource: Leave(true)");
     return true;
 }
 
@@ -455,42 +306,40 @@ ico_syc_mrp_release_input_resource(resource_request_t *req)
  */
 /*-------------------------------------------------------------------------*/
 static mrp_res_queue_item_t *
-ico_syc_mrp_create_queue_item(resource_request_t *req, int prio)
+ico_syc_mrp_create_queue_item(resource_request_t *req)
 {
     mrp_res_queue_item_t *item = mrp_allocz(sizeof(mrp_res_queue_item_t));
-    int ret;
+    int ret = 0;
+
+    ICO_DBG("ico_syc_mrp_create_queue_item: Enter");
 
     if (NULL == item) {
-        ICO_ERR("mrp_allocz failaed.");
+        ICO_ERR("mrp_allocz failed.");
         return NULL;
     }
 
     mrp_list_init(&item->hook);
 
-    if (req->resid | RESID_KIND_DISPLAY) {
-        item->req_id   = req->surfaceid;
-        item->zone_idx = req->dispzoneid;
-    }
-    else if (req->resid | RESID_KIND_SOUND) {
+    if (req->resid | RESID_KIND_SOUND) {
         item->req_id   = req->soundid;
         item->zone_idx = req->soundzoneid;
     }
-    else if (req->resid | RESID_KIND_INPUT) {
-        item->req_id = req->input;
-    }
-    item->prio     = prio;
+
+    item->prio     = req->prio;
     item->res_type = req->resid;
 
     ret = snprintf(item->appid, MURPHY_APPID_MAXIMUM_LENGTH, "%s", req->appid);
 
     if (ret < 0 || ret >= MURPHY_APPID_MAXIMUM_LENGTH) {
         mrp_free(item);
+        ICO_DBG("ico_syc_mrp_create_queue_item: Leave(NULL)");
         return NULL;
     }
 
     ICO_DBG("murphy: created queue item (id: %d, zone: %d, prio: %d, type: %d)",
             item->req_id, item->zone_idx, item->prio, item->res_type);
 
+    ICO_DBG("ico_syc_mrp_create_queue_item: Leave(0x%08x)", item);
     return item;
 }
 
@@ -500,6 +349,8 @@ ico_syc_mrp_find_request(int req_id, char *appid)
     mrp_list_hook_t *p, *n;
     resource_request_t *req;
 
+    ICO_DBG("ico_syc_mrp_find_request: Enter");
+
     /* go through all mrp_res_queue_item_t structs in the list */
 
     mrp_list_foreach(&mrp_reqs, p, n) {
@@ -508,86 +359,33 @@ ico_syc_mrp_find_request(int req_id, char *appid)
         ICO_DBG("ico_syc_mrp_find_request: req(id=%d appid=%s)",
                 req->id, req->appid);
         if (req->id == req_id && strcmp(req->appid, appid) == 0) {
+            ICO_DBG("ico_syc_mrp_find_request: Leave(0x%08x)", req);
             return req;
         }
     }
 
+    ICO_DBG("ico_syc_mrp_find_request: Leave(NULL)");
     return NULL;
 }
 
-       
-static void
-ico_syc_mrp_process_display_queue(void)
-{
-    mrp_list_hook_t *p, *n;
-    mrp_res_queue_item_t *item;
-
-    /* go through all mrp_res_queue_item_t structs in the list */
-
-    mrp_list_foreach(&mrp_disp_wait_queue, p, n) {
-        resource_request_t *req;
-        item = mrp_list_entry(p, typeof(*item), hook);
-
-        req = ico_syc_mrp_find_request(item->req_id, item->appid);
-
-        if (req) {
-            ico_syc_mrp_acquire_display_resource(req, item->prio);
-        }
-        else  {
-            ICO_WRN("murphy: application (appid: %s, id: %d, zone: %d)"
-                    " went away before resource handling",
-                    item->appid, item->req_id, item->zone_idx);
-        }
-
-        mrp_list_delete(&item->hook);
-        mrp_free(item);
-    }
-}
-        
 static void
 ico_syc_mrp_process_sound_queue(void)
 {
     mrp_list_hook_t *p, *n;
     mrp_res_queue_item_t *item;
 
-    /* go through all mrp_res_queue_item_t structs in the list */
-
-    mrp_list_foreach(&mrp_sound_wait_queue, p, n) {
-        resource_request_t *req;
-        item = mrp_list_entry(p, typeof(*item), hook);
-
-        req = ico_syc_mrp_find_request(item->req_id, item->appid);
-
-        if (req) {
-            ico_syc_mrp_acquire_sound_resource(req, item->prio);
-        }
-        else  {
-            ICO_WRN("murphy: application (appid: %s, id: %d, zone: %d)"
-                    " went away before resource handling",
-                    item->appid, item->req_id, item->zone_idx);
-        }
-
-        mrp_list_delete(&item->hook);
-        mrp_free(item);
-    }
-}
-                       
-static void
-ico_syc_mrp_process_input_queue(void)
-{
-    mrp_list_hook_t *p, *n;
-    mrp_res_queue_item_t *item;
+    ICO_DBG("ico_syc_mrp_process_sound_queue: Enter");
 
     /* go through all mrp_res_queue_item_t structs in the list */
 
-    mrp_list_foreach(&mrp_input_wait_queue, p, n) {
+    mrp_list_foreach(&mrp_sound_wait_queue, p, n) {
         resource_request_t *req;
         item = mrp_list_entry(p, typeof(*item), hook);
 
         req = ico_syc_mrp_find_request(item->req_id, item->appid);
 
         if (req) {
-            ico_syc_mrp_acquire_input_resource(req, item->prio);
+            ico_syc_mrp_acquire_sound_resource(req);
         }
         else  {
             ICO_WRN("murphy: application (appid: %s, id: %d, zone: %d)"
@@ -599,8 +397,9 @@ ico_syc_mrp_process_input_queue(void)
         mrp_free(item);
     }
 
+    ICO_DBG("ico_syc_mrp_process_sound_queue: Leave");
 }
-           
+                       
 static void
 ico_syc_mrp_resource_cb(mrp_res_context_t *ctx,
                         const mrp_res_resource_set_t *rs,
@@ -608,29 +407,25 @@ ico_syc_mrp_resource_cb(mrp_res_context_t *ctx,
 {
     resource_request_t *req = NULL;
 
-    mrp_res_queue_item_t *item = userdata;
+    //mrp_res_queue_item_t *item = userdata;
+    resource_request_t *item = userdata;
 
-    unsigned short state = ICO_APF_RESOURCE_STATE_ACQUIRED;
+    unsigned short state = RES_STATE_ACQUIRED;
 
     ICO_DBG("ico_syc_mrp_resource_cb: Enter"
-            "(req_id=%d appid=%s)", item->req_id, item->appid);
+            "(req_id=%d appid=%s)", item->id, item->appid);
+            //"(req_id=%d appid=%s)", item->req_id, item->appid);
 
     if (NULL == item) {
         return;
     }
 
-    if (item->res_type | RESID_KIND_DISPLAY) {
-        req = ico_syc_mrp_find_request(item->req_id, item->appid);
-        ICO_DBG("RESID_KIND_DISPLAY req=0x%08x", req);
-    }
-    else if (item->res_type | RESID_KIND_SOUND) {
-        req = ico_syc_mrp_find_request(item->req_id, item->appid);
+    //if (item->res_type | RESID_KIND_SOUND) {
+    if (item->resid & RESID_KIND_SOUND) {
+        //req = ico_syc_mrp_find_request(item->req_id, item->appid);
+        req = ico_syc_mrp_find_request(item->id, item->appid);
         ICO_DBG("RESID_KIND_SOUND req=0x%08x", req);
     }
-    else if (item->res_type | RESID_KIND_INPUT) {
-        req = ico_syc_mrp_find_request(item->req_id, item->appid);
-        ICO_DBG("RESID_KIND_INPUT req=0x%08x", req);
-    }
 
     if (NULL == req) {
         ICO_ERR("murphy: the request wasn't found!");
@@ -645,35 +440,36 @@ ico_syc_mrp_resource_cb(mrp_res_context_t *ctx,
     }
 
     /* delete the previous set */
+    ICO_DBG("called: mrp_res_delete_resource");
     mrp_res_delete_resource_set(ctx, req->rset);
 
     /* copy the new set into place */
+    ICO_DBG("called: mrp_res_copy_resource_set");
     req->rset = mrp_res_copy_resource_set(ctx, rs);
 
     switch(req->rset->state) {
     case MRP_RES_RESOURCE_ACQUIRED:
         ICO_DBG("ico_syc_mrp_resource_cb: state=MRP_RES_RESOURCE_ACQUIRED");
-        state = ICO_APF_RESOURCE_STATE_ACQUIRED;
+        state = RES_STATE_ACQUIRED;
         break;
     case MRP_RES_RESOURCE_LOST:
         ICO_DBG("ico_syc_mrp_resource_cb: state=MRP_RES_RESOURCE_LOST");
     case MRP_RES_RESOURCE_AVAILABLE:
         ICO_DBG("ico_syc_mrp_resource_cb: state=MRP_RES_RESOURCE_AVAILABLE");
         if (req->released) {
-            state = ICO_APF_RESOURCE_STATE_RELEASED;
+            state = RES_STATE_RELEASED;
         }
         else {
-            state = ICO_APF_RESOURCE_STATE_WAITTING;
+            state = RES_STATE_WAITING;
         }
         break;
     default:
         ICO_WRN("ico_syc_mrp_resource_cb: state=UNKNOWN");
-        state = ICO_APF_RESOURCE_STATE_RELEASED;
+        state = RES_STATE_RELEASED;
         break;
     }
 
     /* send decision to client, if needed */
-
     if (req->reqtype == REQTYPE_APP) {
         if (req->state != state) {
 // TODO CicoSCServer::sendMessage();
@@ -688,22 +484,9 @@ ico_syc_mrp_resource_cb(mrp_res_context_t *ctx,
     }
 
     /* do the enforcing */
-
-    if (req->resid | RESID_KIND_DISPLAY) {
-        if (NULL != ico_syc_mrp_enforce_displayCB) {
-            ico_syc_mrp_enforce_displayCB(state, req->appid,
-                                          req->id, cb_user_data);
-        }
-    }
-    else if (req->resid | RESID_KIND_SOUND) {
+    if (req->resid & RESID_KIND_SOUND) {
         if (NULL != ico_syc_mrp_enforce_soundCB) {
-            ico_syc_mrp_enforce_soundCB(state, req->pid, cb_user_data);
-        }
-    }
-    else if (req->resid | RESID_KIND_INPUT) {
-        if (NULL != ico_syc_mrp_enforce_inputCB) {
-            ico_syc_mrp_enforce_inputCB(state, req->appid,
-                                        req->device, cb_user_data);
+            ico_syc_mrp_enforce_soundCB(state, req, cb_user_data);
         }
     }
     else {
@@ -718,24 +501,23 @@ ico_syc_mrp_state_cb(mrp_res_context_t *ctx,
                      mrp_res_error_t err,
                      void *userdata)
 {
+    ICO_DBG("ico_syc_mrp_state_cb: Enter");
     if (err != MRP_RES_ERROR_NONE) {
-        ICO_DBG("murphy: state callback error");
+        ICO_DBG("ico_syc_mrp_state_cb: state callback error(%d)", err);
         return;
     }
 
     switch (ctx->state)
     {
         case MRP_RES_CONNECTED:
-            ICO_DBG("murphy: connected to murphyd");
+            ICO_DBG("ico_syc_mrp_state_cb: connected to murphyd");
             mrp_res_connected = TRUE;
 
             /* process the queued resources */
-            ico_syc_mrp_process_display_queue();
             ico_syc_mrp_process_sound_queue();
-            ico_syc_mrp_process_input_queue();
             break;
         case MRP_RES_DISCONNECTED:
-            ICO_DBG("murphy: disconnected from murphyd");
+            ICO_DBG("ico_syc_mrp_state_cb: disconnected from murphyd");
             if (ctx) {
                 mrp_res_destroy(ctx);
                 mrp_ctx = NULL;
@@ -743,9 +525,11 @@ ico_syc_mrp_state_cb(mrp_res_context_t *ctx,
             mrp_res_connected = FALSE;
             break;
         default:
-            ICO_DBG("murphy: state error");
+            ICO_ERR("ico_syc_mrp_state_cb: state error");
             break;
     }
+
+    ICO_DBG("ico_syc_mrp_state_cb: Leave");
 }
 
 static void
@@ -753,6 +537,8 @@ ico_syc_mrp_connect_notify(mrp_domctl_t *dc,int connected,
                            int errcode, const char *errmsg,
                            void *user_data)
 {
+    ICO_DBG("ico_syc_mrp_connect_notify: Enter");
+    ICO_DBG("ico_syc_mrp_connect_notify: Leave");
 }
 
 static void
@@ -760,5 +546,51 @@ ico_syc_mrp_data_notify(mrp_domctl_t *dc,
                         mrp_domctl_data_t *tables,
                         int ntable, void *user_data)
 {
+    ICO_DBG("ico_syc_mrp_data_notify: Enter");
+    ICO_DBG("ico_syc_mrp_data_notify: Leave");
+}
+
+static void
+ico_sys_mrp_export_notify(mrp_domctl_t *dc, int errcode,
+                          const char *errmsg, void *user_data)
+{
+    MRP_UNUSED(dc);
+    MRP_UNUSED(user_data);
+
+    if (errcode != 0) {
+        ICO_ERR("murphy: exporting data to Murphy failed "
+                "(%d: %s).", errcode, errmsg);
+    }
+}
+
+void
+ico_syc_mrp_active_app(const char *appid)
+{
+    mrp_domctl_data_t tables[1];
+    mrp_domctl_value_t values[2];
+
+    ICO_DBG("ico_syc_mrp_active_app: active app '%s'", appid);
+
+    memset(tables, 0, sizeof(tables));
+    memset(values, 0, sizeof(values));
+
+    tables[0].id = 0;
+    tables[0].ncolumn = 2;
+    tables[0].nrow = 1;
+    tables[0].rows = mrp_allocz(sizeof(*tables[0].rows));
+    tables[0].rows[0] = values;
+
+    values[0].type = MRP_DOMCTL_STRING;
+    values[0].str = "driver";
+    values[1].type = MRP_DOMCTL_STRING;
+    values[1].str = appid;
+
+    if (!mrp_domctl_set_data(mrp_dc, tables, 1,
+                             ico_sys_mrp_export_notify, NULL)) {
+        ICO_DBG("ico_syc_mrp_active_app: "
+                "failed to export active app data to Murphy");
+    }
+
+    mrp_free(tables[0].rows);
 }
 /* vim:set expandtab ts=4 sw=4: */
index 752d740..68eac67 100644 (file)
@@ -11,7 +11,7 @@
 /**
  *  @file   ico_syc_mrp_resource_private.h
  *
- *  @brief 
+ *  @brief  This file is definition of murpy ressource control
  */
 //==========================================================================
 
@@ -25,7 +25,7 @@ extern "C" {
 
 
 #define ICO_APC_REQTYPE_REQUEST 0               /* Request from application         */
-#define ICO_APC_REQTYPE_CREATE  1               /* Request automaticaly             */
+#define ICO_APC_REQTYPE_CREATE  1               /* Request automatically             */
 
 // TODO 
 #define REQTYPE_APP             0
@@ -44,48 +44,10 @@ extern "C" {
 #define RESID_CMD_ACQUIRE       0x00001000
 #define RESID_CMD_RELEASE       0x00002000
 
-/*
- *  id of resource
- */
-typedef enum _resid {
-    ICO_APF_RESID_BASIC_SCREEN  = 1, /* basic screen */
-    ICO_APF_RESID_INT_SCREEN    = 2, /* interrupt screen */
-    ICO_APF_RESID_ON_SCREEN     = 3, /* onscreeen */
-    ICO_APF_RESID_BASIC_SOUND   = 4, /* basic sound */
-    ICO_APF_RESID_INT_SOUND     = 5, /* interrupt sound */
-    ICO_APF_RESID_INPUT_DEV     = 6, /* input device */
-} ico_apf_resid_e;
-#define ICO_APF_RESOURCE_RESID_MIN      ((int)(ICO_APF_RESID_BASIC_SCREEN))
-#define ICO_APF_RESOURCE_RESID_MAX      ((int)(ICO_APF_RESID_INPUT_DEV))
-
-/*
- *  state of resource
- */
-typedef enum _resource_state {
-    ICO_APF_RESOURCE_STATE_ACQUIRED     = 1,    /* acquired         */
-    ICO_APF_RESOURCE_STATE_DEPRIVED     = 2,    /* deprived         */
-    ICO_APF_RESOURCE_STATE_WAITTING     = 3,    /* waitting         */
-    ICO_APF_RESOURCE_STATE_RELEASED     = 4,    /* released         */
-
-    ICO_APF_RESOURCE_COMMAND_GET        = 5,    /* get command      */
-    ICO_APF_RESOURCE_COMMAND_RELEASE    = 6,    /* release command  */
-    ICO_APF_RESOURCE_COMMAND_ADD        = 7,    /* add command      */
-    ICO_APF_RESOURCE_COMMAND_CHANGE     = 8,    /* change command   */
-    ICO_APF_RESOURCE_COMMAND_DELETE     = 9,    /* delete command   */
-
-    ICO_APF_RESOURCE_REPLY_OK           = 10,   /* OK reply         */
-    ICO_APF_RESOURCE_REPLY_NG           = 11,   /* NG reply         */
-    ICO_APF_RESOURCE_STATE_CONNECTED    = 12,   /* connected        */
-    ICO_APF_RESOURCE_STATE_DISCONNECTED = 13,   /* disconnected     */
-} ico_apf_resource_state_e;
-
-/* Priority of resource                             */
-#define ICO_UXF_PRIO_INTSCREEN   0x00000080 /* interrupt screen on basic screen     */
-#define ICO_UXF_PRIO_CATEGORY    0x00000100 /* application category                 */
-#define ICO_UXF_PRIO_ACTIVEAPP   0x0fff0000 /* active application count             */
-#define ICO_UXF_PRIO_ACTIVECOUNT 0x00010000 /* active application                   */
-#define ICO_UXF_PRIO_ONSCREEN    0x10000000 /* interrupt screen/sound               */
-#define ICO_UXF_PRIO_REGULATION  0x40000000 /* no regulation controlled             */
+#define RES_STATE_ACQUIRED      1
+#define RES_STATE_DEPRIVED      2
+#define RES_STATE_WAITING       3
+#define RES_STATE_RELEASED      4
 
 #define MURPHY_APPID_MAXIMUM_LENGTH 128
 
@@ -98,38 +60,19 @@ typedef struct {
     mrp_list_hook_t hook;
 } mrp_res_queue_item_t;
 
-
-
 #define ICO_UXF_MAX_PROCESS_NAME 255
 #define ICO_UXF_MAX_DEVICE_NAME  255
 
 /* request information                          */
 typedef struct  _resource_request    {
-//    struct _ico_apc_request     *next;          /* requestt list link               */
-//    char                        appid[ICO_UXF_MAX_PROCESS_NAME+1];
-                                                /* application id                   */
-    //ico_apf_resid_e             resid;          /* resource id                      */
-//    int resid;          /* resource id                      */
-//    char                        device[ICO_UXF_MAX_DEVICE_NAME+1];
-                                                /* request device                   */
     int                         id;             /* request object                   */
-//    int                         bid;            /* request base object              */
-//    int                         pid;            /* request client pid               */
     int                         prio;           /* request priority                 */
-//    unsigned short              zoneidx;        /* request target zone index        */
-//    unsigned short              timer;          /* Reply wait timer                 */
-//    unsigned short              state;          /* status                           */
     unsigned short              reqtype;        /* Request type                     */
     unsigned short              category;        /* Request category */
-#ifndef NO_MURPHY
-//    mrp_res_resource_set_t      *rset;          /* Murphy resource set              */
-//    mrp_res_queue_item_t        *res_data;      /* identifier for the request       */
-//    mrp_list_hook_t             hook;           /* keep track of requests           */
-#endif
-    //int                         released;       /* Did the application release?     */
 
     int  resid;           /* resource id      */
     char *appid;          /* application id */
+    int  appkind;         /* id of application kind */
     int  pid;             /* process id     */
     int  state;           /* request state */
 
@@ -137,10 +80,12 @@ typedef struct  _resource_request    {
     int  dispzoneid;      /* area of showing application window */
     char *winname;        /* window's surface name */
     int  surfaceid;       /* window id */
+    char *animation;      /* name of animation */
+    int  animationTime;   /* time of animation[ms] */
 
     char *soundzone;      /* area of playing sound */
     int  soundzoneid;     /* area of playing sound */
-    char *sooudname;      /* sound stream name */
+    char *soundname;      /* sound stream name */
     int  soundid;         /* sound id */
     int  soundadjust;     /* adjust action */
 
@@ -154,34 +99,17 @@ typedef struct  _resource_request    {
 
 } resource_request_t;
 
-typedef void (*ico_syc_mrp_enforce_display_t)(unsigned short state,
-                                              const char *appid,
-                                              unsigned int id,
-                                              void *user_data);
-
 typedef void (*ico_syc_mrp_enforce_sound_t)(unsigned short state,
-                                            pid_t pid,
+                                            resource_request_t *req,
                                             void *user_data);
 
-typedef void (*ico_syc_mrp_enforce_input_t)(unsigned short state,
-                                            const char *appid,
-                                            const char *device,
-                                            void *user_data);
-
-int ico_syc_mrp_init(ico_syc_mrp_enforce_display_t dispcb,
-                     ico_syc_mrp_enforce_sound_t   soundcb,
-                     ico_syc_mrp_enforce_input_t   inputcb,
-                     void                          *user_data);
 
-bool ico_syc_mrp_acquire_display_resource(resource_request_t *req, int addprio);
-bool ico_syc_mrp_release_display_resource(resource_request_t *req);
+int ico_syc_mrp_init(ico_syc_mrp_enforce_sound_t soundcb,
+                     void *user_data);
 
-bool ico_syc_mrp_acquire_sound_resource(resource_request_t *req, int addprio);
+bool ico_syc_mrp_acquire_sound_resource(resource_request_t *req);
 bool ico_syc_mrp_release_sound_resource(resource_request_t *req);
-
-bool ico_syc_mrp_acquire_input_resource(resource_request_t *req, int addprio);
-bool ico_syc_mrp_release_input_resource(resource_request_t *req);
+void ico_syc_mrp_active_app(const char *appid);
 
 #ifdef __cplusplus
 }
index 1cbc258..b331c35 100644 (file)
@@ -1,3 +1,10 @@
+* Thu Sep 19 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> accepted/tizen/20130911.211140@65dbd1c
+- 0.9.03 release.
+-- Additional functions of policy and resource management.
+-- Additional functions of homescreen night mode.
+-- When the regulation, to change the behavior of the menu screen and menu icons.
+-- Internal bug fix.
+
 * Fri Sep 06 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> submit/tizen/20130828.211623@2f884d6
 - 0.9.02 release
 -- Fix system controller startup.
index fcc7642..1e9fc24 100644 (file)
@@ -1,6 +1,6 @@
 Name:       ico-uxf-homescreen
 Summary:    Sample homescreen and system controller
-Version:    0.9.02
+Version:    0.9.03
 Release:    1.1
 Group:         Graphics & UI Framework/Automotive UI
 License:    Apache-2.0
@@ -8,7 +8,7 @@ URL:        ""
 Source0:    %{name}-%{version}.tar.bz2
 
 BuildRequires: pkgconfig(wayland-client) >= 1.2
-BuildRequires: ico-uxf-weston-plugin-devel >= 0.7.01
+BuildRequires: ico-uxf-weston-plugin-devel >= 0.9.04
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(ecore)
 BuildRequires: pkgconfig(ecore-wayland)
@@ -30,13 +30,13 @@ BuildRequires: pkgconfig(murphy-domain-controller)
 BuildRequires: pkgconfig(murphy-ecore)
 BuildRequires: pkgconfig(murphy-resource)
 BuildRequires: boost-devel
-BuildRequires: ico-uxf-utilities-devel >= 0.2.01
+BuildRequires: ico-uxf-utilities-devel >= 0.2.04
 Requires: weston >= 1.2
-Requires: ico-uxf-weston-plugin >= 0.7.01
-Requires: ico-uxf-utilities >= 0.2.01
+Requires: ico-uxf-weston-plugin >= 0.9.04
+Requires: ico-uxf-utilities >= 0.2.04
 
 %description
-sample homescreen & system controller.
+Sample homescreen application and system controller daemon
 
 %package system-controller-devel
 Summary:  Development files for %{name}
@@ -67,64 +67,24 @@ rm -rf %{buildroot}
 
 %make_install
 
-HOMESCREENDIR="%{buildroot}/usr/apps/org.tizen.ico.homescreen"
-IMGDIR="res/org.tizen.ico.homescreen/res/images"
-mkdir -p ${HOMESCREENDIR}/bin
-mkdir -p ${HOMESCREENDIR}/var
-mkdir -p ${HOMESCREENDIR}/res/images
-mkdir -p ${HOMESCREENDIR}/res/edj
-mkdir -p ${HOMESCREENDIR}/res/config
-mkdir -p %{buildroot}/bin
-mkdir -p %{buildroot}/usr/share/applications
-mkdir -p %{buildroot}/usr/share/packages
-cp -fr res/org.tizen.ico.homescreen/res/config ${HOMESCREENDIR}/res
-cp -fr data/apps/org.tizen.ico.homescreen %{buildroot}/usr/apps/
-cp src/homescreen/HomeScreen ${HOMESCREENDIR}/bin
-cp src/homescreen/home_screen_bg.edj ${HOMESCREENDIR}/res/edj
-cp src/homescreen/home_screen_touch.edj ${HOMESCREENDIR}/res/edj
-chmod 666 ${HOMESCREENDIR}/res/edj/home_screen_*
-cp ${IMGDIR}/bg.png ${HOMESCREENDIR}/res/images
-cp ${IMGDIR}/ctrl.png ${HOMESCREENDIR}/res/images
-cp ${IMGDIR}/applist_off.png ${HOMESCREENDIR}/res/images
-cp ${IMGDIR}/api_all_off.png ${HOMESCREENDIR}/res/images
-cp ${IMGDIR}/api_all_on.png ${HOMESCREENDIR}/res/images
-cp ${IMGDIR}/pagePointer_n.png ${HOMESCREENDIR}/res/images
-cp ${IMGDIR}/pagePointer_p.png ${HOMESCREENDIR}/res/images
-cp ${IMGDIR}/button_really.png ${HOMESCREENDIR}/res/images
-cp ${IMGDIR}/button_no.png ${HOMESCREENDIR}/res/images
-cp ${IMGDIR}/button_yes.png ${HOMESCREENDIR}/res/images
-cp ${IMGDIR}/termIcon.png ${HOMESCREENDIR}/res/images
-cp ${IMGDIR}/tizen_32.png ${HOMESCREENDIR}/res/images
-chmod 666 ${HOMESCREENDIR}/res/images/api_all_*
-cp data/share/packages/org.tizen.ico.homescreen.xml %{buildroot}/usr/share/packages
-cp res/org.tizen.ico.homescreen/res/apps/org.tizen.ico.homescreen/* ${HOMESCREENDIR}/res/config
-
 STATUSBARDIR="%{buildroot}/usr/apps/org.tizen.ico.statusbar"
 mkdir -p ${STATUSBARDIR}/res/images
 mkdir -p ${STATUSBARDIR}/res/edj
 mkdir -p ${STATUSBARDIR}/res/config
 mkdir -p ${STATUSBARDIR}/bin
 cp -rf data/apps/org.tizen.ico.statusbar %{buildroot}/usr/apps/
-cp src/homescreen/StatusBar ${STATUSBARDIR}/bin/
-cp res/org.tizen.ico.homescreen/res/images/time*.png ${STATUSBARDIR}/res/images
-cp res/org.tizen.ico.homescreen/res/images/applist_*.png ${STATUSBARDIR}/res/images
-cp res/org.tizen.ico.homescreen/res/images/home*.png ${STATUSBARDIR}/res/images
-chmod 666 ${STATUSBARDIR}/res/images/time*.png
-cp data/share/packages/org.tizen.ico.statusbar.xml %{buildroot}/usr/share/packages
+install -m 0755 src/homescreen/StatusBar ${STATUSBARDIR}/bin/
+install -m 0644 res/org.tizen.ico.homescreen/res/images/time*.png ${STATUSBARDIR}/res/images
+install -m 0644 data/share/packages/org.tizen.ico.statusbar.xml %{buildroot}/usr/share/packages
 cp res/org.tizen.ico.homescreen/res/apps/org.tizen.ico.statusbar/* ${STATUSBARDIR}/res/config
-#make install prefix=%{buildroot}/usr
 
 %post
 /sbin/ldconfig
-mkdir -p %{_localstatedir}/log/ico/
-chmod 0777 %{_localstatedir}/log/ico/
 
 # Update the app database.
 %{_bindir}/pkg_initdb
 %{_bindir}/ail_initdb
 
-%preun
-
 %postun
 /sbin/ldconfig
 rm -f /usr/share/applications/org.tizen.ico.homescreen.desktop
@@ -149,6 +109,9 @@ rm -f /home/app/layout.txt
 /usr/lib/systemd/user/ico-system-controller.service
 /usr/lib/systemd/user/ico-uxf-wait-launchpad-ready.path
 /usr/lib/systemd/user/weston.target.wants/ico-uxf-wait-launchpad-ready.path
+%attr(755,app,app) /home/app/ico
+%attr(644,app,app) /home/app/ico/defaultApps.info
+/home/app/ico/defaultApps.info
 
 %files system-controller-devel
 %defattr(-,root,root,-)
@@ -172,5 +135,3 @@ rm -f /home/app/layout.txt
 %{_includedir}/ico-state-machine/CicoStateCore.h
 %{_includedir}/ico-state-machine/CicoStateMachine.h
 %{_includedir}/ico-state-machine/CicoStateMachineCreator.h
-%{_libdir}/libico-appfw.*
-%{_libdir}/libico-state-machine.*
diff --git a/res/org.tizen.ico.homescreen/res/images/applist_off_2.png b/res/org.tizen.ico.homescreen/res/images/applist_off_2.png
new file mode 100644 (file)
index 0000000..b96b0a4
Binary files /dev/null and b/res/org.tizen.ico.homescreen/res/images/applist_off_2.png differ
index c2b6210..942aae4 100755 (executable)
Binary files a/res/org.tizen.ico.homescreen/res/images/applist_on.png and b/res/org.tizen.ico.homescreen/res/images/applist_on.png differ
diff --git a/res/org.tizen.ico.homescreen/res/images/applist_on_2.png b/res/org.tizen.ico.homescreen/res/images/applist_on_2.png
new file mode 100644 (file)
index 0000000..2354121
Binary files /dev/null and b/res/org.tizen.ico.homescreen/res/images/applist_on_2.png differ
index 6e4c97c..a1d5db3 100644 (file)
@@ -1,14 +1,20 @@
-## OpenPF System Configurations
-##  /usr/apps/org.tizen.ico.homescreen/res/config/app_attr.conf
-##     May-15-2013
-
+# OpenPF System Configurations
+#  /usr/apps/org.tizen.ico.homescreen/res/config/app_attr.conf
+#  Jul-26-2013
 #
-## default attributes for each application
+
 [app-attributes]
+# attributes of HomeScreen
+org.tizen.ico.homescreen=Menu;kind=HomeScreen;run=Center;noauto;type=menu
+org.tizen.ico.onscreen=Menu;kind=HomeScreen;run=Center;noauto;type=menu
+org.tizen.ico.statusbar=Menu;kind=HomeScreen;run=Center;noauto;type=menu
+org.tizen.ico.app-samplenavi=Map
+
 # attrinutes of native applictions
-org.tizen.soft-keyboard=Menu;SysApp;dispzone=SysApp;layer=SoftKeyboard
+org.tizen.soft-keyboard=Menu;kind=SysApp;dispzone=SysApp;layer=SoftKeyboard
 org.tizen.setting=CarSetting;kind=SysApp.audio
 org.tizen.music-player=Map
+
 # attributes of web applications
 DemoMeterApp=Map
 GhostCluster=Map
@@ -16,5 +22,4 @@ WinkerLeft=Camera.Left;kind=Maker;dispzone=SysApp.Left;layer=InterruptApp
 WinkerLeft.1=NoDisplay;auto;Animation=Slide.toRight;invisiblecpu=no;noconfigure
 WinkerRight=Camera.Right;kind=Maker;dispzone=SysApp.Right;layer=InterruptApp
 WinkerRight.1=NoDisplay;auto;Animation=Slide.toLeft;invisiblecpu=no;noconfigure
-#
 
index 1c8ee69..832c3dc 100644 (file)
@@ -1,19 +1,19 @@
 "stateMachine":{
   "name":"Policy",
   "value":1,
-  "initial":[1001,2001,3001,9100,10100,12100,14100,16100,18100,20100,22100,24100,30100,32100],
+  "initial":[1001,2001,3001,3101,4001,5001,9001,10001,11001,12003,13009,14999,15999,16999,17999,20999,22999,30001,30101],
   "state":{
     "name":"Driving",
     "value":1000,
     "state":{
       "name":"Stopping",
       "value":1001,
-      "event":{ "name":"EV1000","value":1000, "transition":1002, "guardCondition":[{"operator":">","value":0 }]}
+      "event":{"name":"EV1000","value":1000, "transition":1002, "guardCondition":[{"operator":">","value":0 }]}
     },
     "state":{
       "name":"Running",
       "value":1002,
-      "event":{ "name":"EV1000","value":1000, "transition":1001, "guardCondition":[{"operator":"=","value":0 }]}
+      "event":{"name":"EV1000","value":1000, "transition":1001, "guardCondition":[{"operator":"=","value":0 }]}
     }
   },
 
     "state":{
       "name":"Parking",
       "value":2001,
-      "event":{ "name":"EV2000","value":2000, "transition":2002, "guardCondition":[{"operator":"=","value":2 }]},
-      "event":{ "name":"EV2000","value":2000, "transition":2003, "guardCondition":[{             "operator":"!=","value":1},
-                                                                                   {"join":"and","operator":"!=","value":2}]}
+      "event":{"name":"EV2000","value":2000, "transition":2002, "guardCondition":[{"operator":"=","value":255}]},
+      "event":{"name":"EV2000","value":2000, "transition":2003, "guardCondition":[{              "operator":"!=","value":255},
+                                                                                   {"join":"and","operator":"!=","value":128}]}
     },
     "state":{
       "name":"Reverse",
       "value":2002,
-      "event":{ "name":"EV2000","value":2000, "transition":2001, "guardCondition":[{"operator":"=","value":1 }]},
-      "event":{ "name":"EV2000","value":2000, "transition":2003, "guardCondition":[{             "operator":"!=","value":1},
-                                                                                   {"join":"and","operator":"!=","value":2}]}
+      "event":{"name":"EV2000","value":2000, "transition":2001, "guardCondition":[{"operator":"=","value":128}]},
+      "event":{"name":"EV2000","value":2000, "transition":2003, "guardCondition":[{              "operator":"!=","value":255},
+                                                                                   {"join":"and","operator":"!=","value":128}]}
     },
     "state":{
       "name":"OtherShiftPos",
       "value":2003,
-      "event":{ "name":"EV2000","value":2000, "transition":2001, "guardCondition":[{"operator":"=","value":1 }]},
-      "event":{ "name":"EV2000","value":2000, "transition":2002, "guardCondition":[{"operator":"=","value":2 }]}
+      "event":{"name":"EV2000","value":2000, "transition":2001, "guardCondition":[{"operator":"=","value":255}]},
+      "event":{"name":"EV2000","value":2000, "transition":2002, "guardCondition":[{"operator":"=","value":128}]}
     }
   },
 
   "state":{
-    "name":"Winker",
+    "name":"TurnLeft",
     "value":3000,
     "state":{
-      "name":"WinkerOff",
+      "name":"TurnLeftOff",
       "value":3001,
-      "event":{ "name":"EV3000","value":3000, "transition":3002, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV3000","value":3000, "transition":3003, "guardCondition":[{"operator":"=","value":2}]}
+      "event":{"name":"EV3001","value":3001, "transition":3002}
     },
     "state":{
-      "name":"RightWinker",
+      "name":"TurnLeftOn",
       "value":3002,
-      "event":{ "name":"EV3000","value":3000, "transition":3001, "guardCondition":[{"operator":"=","value":0}]},
-      "event":{ "name":"EV3000","value":3000, "transition":3003, "guardCondition":[{"operator":"=","value":2}]}
+      "event":{"name":"EV3000","value":3000, "transition":3001}
+    }
+  },
+
+  "state":{
+    "name":"TurnRight",
+    "value":3100,
+    "state":{
+      "name":"TurnRightOff",
+      "value":3101,
+      "event":{"name":"EV3101","value":3101, "transition":3102}
     },
     "state":{
-      "name":"LeftWinker",
-      "value":3003,
-      "event":{ "name":"EV3000","value":3000, "transition":3001, "guardCondition":[{"operator":"=","value":0}]},
-      "event":{ "name":"EV3000","value":3000, "transition":3002, "guardCondition":[{"operator":"=","value":1}]}
+      "name":"TurnRightOn",
+      "value":3102,
+      "event":{"name":"EV3100","value":3100, "transition":3101}
+    }
+  },
+
+  "state":{
+    "name":"Camera",
+    "value":4000,
+    "state":{
+      "name":"CameraOff",
+      "value":4001,
+      "event":{"name":"EV4000","value":4000, "transition":4002, "guardCondition":[{"operator":"in","value":"Reverse"}]},
+      "event":{"name":"EV4000","value":4000, "transition":4003, "guardCondition":[{"operator":"in","value":"TurnLeftOn"}]},
+      "event":{"name":"EV4000","value":4000, "transition":4004, "guardCondition":[{"operator":"in","value":"TurnRightOn"}]}
+    },
+       "state":{
+      "name":"CameraBack",
+      "value":4002,
+      "event":{"name":"EV4000","value":4000, "transition":4001, "guardCondition":[{             "operator":"not","value":"Reverse"},
+                                                                                  {"join":"and","operator":"in","value":"TurnLeftOff"},
+                                                                                  {"join":"and","operator":"in","value":"TurnRightOff"}]},
+      "event":{"name":"EV4000","value":4000, "transition":4003, "guardCondition":[{             "operator":"not","value":"Reverse"},
+                                                                                  {"join":"and","operator":"in","value":"WinkerLeft"}]},
+      "event":{"name":"EV4000","value":4000, "transition":4004, "guardCondition":[{             "operator":"not","value":"Reverse"},
+                                                                                  {"join":"and","operator":"in","value":"WinkerRight"}]}
+    },
+       "state":{
+      "name":"CameraLeft",
+      "value":4003,
+      "event":{"name":"EV4000","value":4000, "transition":4001, "guardCondition":[{             "operator":"not","value":"Reverse"},
+                                                                                  {"join":"and","operator":"in","value":"TurnLeftOff"},
+                                                                                  {"join":"and","operator":"in","value":"TurnRightOff"}]},
+      "event":{"name":"EV4000","value":4000, "transition":4002, "guardCondition":[{"operator":"in","value":"Reverse"}]},
+      "event":{"name":"EV4000","value":4000, "transition":4004, "guardCondition":[{             "operator":"not","value":"Reverse"},
+                                                                                  {"join":"and","operator":"in","value":"WinkerRight"}]}
+    },
+       "state":{
+      "name":"CameraRight",
+      "value":4004,
+      "event":{"name":"EV4000","value":4000, "transition":4001, "guardCondition":[{"operator":"not","value":"WinkerRight"}]},
+      "event":{"name":"EV4000","value":4000, "transition":4002, "guardCondition":[{"operator":"in","value":"Reverse"}]},
+      "event":{"name":"EV4000","value":4000, "transition":4003, "guardCondition":[{             "operator":"not","value":"Reverse"},
+                                                                                  {"join":"and","operator":"in","value":"WinkerLeft"}]}
+    }
+  },
+
+  "state":{
+    "name":"NightMode",
+    "value":5000,
+    "state":{
+      "name":"NightModeOff",
+      "value":5001,
+      "event":{"name":"EV5000","value":5000, "transition":5002, "guardCondition":[{"operator":"=","value":1}]}
+    },
+    "state":{
+      "name":"NightModeOn",
+      "value":5002,
+      "event":{"name":"EV5000","value":5000, "transition":5001, "guardCondition":[{"operator":"=","value":0}]}
     }
   },
 
     "value":9000,
     "state":{
       "name":"NotRegulating",
-      "value":9100,
-      "event":{ "name":"EV9000","value":9000, "transition":9200, "guardCondition":[{"operator":"in","value":"Running"}]}
+      "value":9001,
+      "event":{"name":"EV9000","value":9000, "transition":9002, "guardCondition":[{"operator":"in","value":"Running"}]}
     },
     "state":{
       "name":"Regulating",
-      "value":9200,
-      "event":{ "name":"EV9000","value":9000, "transition":9100, "guardCondition":[{"operator":"in","value":"Stopping"}]}
+      "value":9002,
+      "event":{"name":"EV9000","value":9000, "transition":9001, "guardCondition":[{"operator":"in","value":"Stopping"}]}
     }
   },
 
   "state":{
-    "name":"Zone1",
+    "name":"Display0Zone",
     "value":10000,
     "state":{
-      "name":"Zone1_Invisible",
-      "value":10100,
-      "event":{ "name":"EV10000","value":10000, "transition":10200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10601, "guardCondition":[{"operator":"in","value":"Reverse"}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10602, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                      {"join":"and","operator":"in","value":"LeftWinker"}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10603, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                      {"join":"and","operator":"in","value":"RightWinker"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":11001, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":11002, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"Regulating"}]}
+      "name":"Display0Zone1",
+      "value":10001,
+      "event":{ "name":"EV10000","value":10000, "transition":10001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV10000","value":10000, "transition":10002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV10000","value":10000, "transition":10003, "guardCondition":[{"operator":"=","value":3}]}
     },
-
     "state":{
-      "name":"Zone1_Menu",
-      "value":10200,
-      "event":{ "name":"EV10001","value":10001, "transition":10100},
-      "event":{ "name":"EV10000","value":10000, "transition":10300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10601, "guardCondition":[{"operator":"in","value":"Reverse"}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10602, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                      {"join":"and","operator":"in","value":"LeftWinker"}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10603, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                      {"join":"and","operator":"in","value":"RightWinker"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":11001, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":11002, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"Regulating"}]}
+      "name":"Display0Zone2",
+      "value":10002,
+      "event":{ "name":"EV10000","value":10000, "transition":10001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV10000","value":10000, "transition":10002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV10000","value":10000, "transition":10003, "guardCondition":[{"operator":"=","value":3}]}
     },
+    "state":{
+      "name":"Display0Zone3",
+      "value":10003,
+      "event":{ "name":"EV10000","value":10000, "transition":10001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV10000","value":10000, "transition":10002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV10000","value":10000, "transition":10003, "guardCondition":[{"operator":"=","value":3}]}
+    }
+  },
 
+  "state":{
+    "name":"Display1Zone",
+    "value":11000,
     "state":{
-      "name":"Zone1_Message",
-      "value":10300,
-      "event":{ "name":"EV10001","value":10001, "transition":10100},
-      "event":{ "name":"EV10000","value":10000, "transition":10200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10601, "guardCondition":[{"operator":"in","value":"Reverse"}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10602, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                      {"join":"and","operator":"in","value":"LeftWinker"}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10603, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                      {"join":"and","operator":"in","value":"RightWinker"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":11001, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":11002, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"Regulating"}]}
+      "name":"Display1Zone1",
+      "value":11001,
+      "event":{ "name":"EV10000","value":11000, "transition":11001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV10000","value":11000, "transition":11002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV10000","value":11000, "transition":11003, "guardCondition":[{"operator":"=","value":3}]}
     },
-
     "state":{
-      "name":"Zone1_Map",
-      "value":10400,
-      "event":{ "name":"EV10001","value":10001, "transition":10100},
-      "event":{ "name":"EV10000","value":10000, "transition":10200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10601, "guardCondition":[{"operator":"in","value":"Reverse"}]},
-      "event":{ "name":"EV10860","value":10600, "transition":10602, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                      {"join":"and","operator":"in","value":"LeftWinker"}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10603, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                      {"join":"and","operator":"in","value":"RightWinker"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":11001, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":11002, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"Regulating"}]}
+      "name":"Display1Zone2",
+      "value":11002,
+      "event":{ "name":"EV10000","value":11000, "transition":11001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV10000","value":11000, "transition":11002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV10000","value":11000, "transition":11003, "guardCondition":[{"operator":"=","value":3}]}
     },
+    "state":{
+      "name":"Display1Zone3",
+      "value":11003,
+      "event":{ "name":"EV10000","value":11000, "transition":11001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV10000","value":11000, "transition":11002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV10000","value":11000, "transition":11003, "guardCondition":[{"operator":"=","value":3}]}
+    }
+  },
 
+  "state":{
+    "name":"Display0Category",
+    "value":12000,
     "state":{
-      "name":"Zone1_Driving",
-      "value":10500,
-      "event":{ "name":"EV10001","value":10001, "transition":10100},
-      "event":{ "name":"EV10200","value":10000, "transition":10200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV10300","value":10000, "transition":10300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV10400","value":10000, "transition":10400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10601, "guardCondition":[{"operator":"in","value":"Reverse"}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10602, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                      {"join":"and","operator":"in","value":"LeftWinker"}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10603, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                      {"join":"and","operator":"in","value":"RightWinker"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":11001, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":11002, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"Regulating"}]}
+      "name":"Display0Category1", /* Menu */
+      "value":12001,
+      "event":{ "name":"EV12000","value":12000, "transition":12001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12010, "guardCondition":[{             "operator":"=","value":10},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12011, "guardCondition":[{"operator":"=","value":11}]}
     },
-
     "state":{
-      "name":"Zone1_Camera",
-      "value":10600,
-      "state":{
-        "name":"Zone1_BackCamera",
-        "value":10601,
-        "event":{ "name":"EV10600","value":10600, "transition":10100, "guardCondition":[{"operator":"not","value":"Reverse"},
-                                                                                        {"join":"and","operator":"in","value":"NoWinker"}]},
-        "event":{ "name":"EV10600","value":10600, "transition":10602, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                        {"join":"and","operator":"in","value":"LeftWinker"}]},
-        "event":{ "name":"EV10600","value":10600, "transition":10603, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                        {"join":"and","operator":"in","value":"RightWinker"}]}
-      },
-      "state":{
-        "name":"Zone1_LeftCamera",
-        "value":10602,
-        "event":{ "name":"EV10600","value":10600, "transition":10100, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                        {"join":"and","operator":"in","value":"NoWinker"}]},
-        "event":{ "name":"EV10600","value":10600, "transition":10601, "guardCondition":[{"operator":"in","value":"Reverse"}]},
-        "event":{ "name":"EV10600","value":10600, "transition":10603, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                        {"join":"and","operator":"in","value":"RightWinker"}]}
-      },
-      "state":{
-        "name":"Zone1_RightCamera",
-        "value":10603,
-        "event":{ "name":"EV10600","value":10600, "transition":10100, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                        {"join":"and","operator":"in","value":"NoWinker"}]},
-        "event":{ "name":"EV10600","value":10600, "transition":10601, "guardCondition":[{"operator":"in","value":"Reverse"}]},
-        "event":{ "name":"EV10600","value":10600, "transition":10602, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                        {"join":"and","operator":"in","value":"LeftWinker"}]}
-      }
+      "name":"Display0Category2", /* Message */
+      "value":12002,
+      "event":{ "name":"EV12000","value":12000, "transition":12001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12010, "guardCondition":[{             "operator":"=","value":10},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12011, "guardCondition":[{"operator":"=","value":11}]}
     },
-
     "state":{
-      "name":"Zone1_Entertainment",
-      "value":10900,
-      "event":{ "name":"EV10001","value":10001, "transition":10100},
-      "event":{ "name":"EV10000","value":10900, "transition":10100, "guardCondition":[{"operator":"in","value":"Regulating"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV10000","value":10000, "transition":10500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10601, "guardCondition":[{"operator":"in","value":"Reverse"}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10602, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                      {"join":"and","operator":"in","value":"LeftWinker"}]},
-      "event":{ "name":"EV10600","value":10600, "transition":10603, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                      {"join":"and","operator":"in","value":"RightWinker"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":11001, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV10000","value":10000, "transition":11002, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"Regulating"}]}
+      "name":"Display0Category3", /* Map */
+      "value":12003,
+      "event":{ "name":"EV12000","value":12000, "transition":12001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12010, "guardCondition":[{             "operator":"=","value":10},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12011, "guardCondition":[{"operator":"=","value":11}]}
+    },
+    "state":{
+      "name":"Display0Category4", /* Driving */
+      "value":12004,
+      "event":{ "name":"EV12000","value":12000, "transition":12001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12010, "guardCondition":[{             "operator":"=","value":10},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12011, "guardCondition":[{"operator":"=","value":11}]}
+    },
+    "state":{
+      "name":"Display0Category5", /* CarSetting */
+      "value":12005,
+      "event":{ "name":"EV12000","value":12000, "transition":12001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12010, "guardCondition":[{             "operator":"=","value":10},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12011, "guardCondition":[{"operator":"=","value":11}]}
+    },
+    "state":{
+      "name":"Display0Category6", /* Camera.Back */
+      "value":12006,
+      "event":{ "name":"EV12000","value":12000, "transition":12001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12010, "guardCondition":[{             "operator":"=","value":10},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12011, "guardCondition":[{"operator":"=","value":11}]}
+    },
+    "state":{
+      "name":"Display0Category7", /* Camera.Left */
+      "value":12007,
+      "event":{ "name":"EV12000","value":12000, "transition":12001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12010, "guardCondition":[{             "operator":"=","value":10},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12011, "guardCondition":[{"operator":"=","value":11}]}
+    },
+    "state":{
+      "name":"Display0Category8", /* Camera.Right */
+      "value":12008,
+      "event":{ "name":"EV12000","value":12000, "transition":12001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12010, "guardCondition":[{             "operator":"=","value":10},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12011, "guardCondition":[{"operator":"=","value":11}]}
+    },
+    "state":{
+      "name":"Display0Category9", /* Entertainment */
+      "value":12009,
+      "event":{ "name":"EV12000","value":12000, "transition":12001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12010, "guardCondition":[{             "operator":"=","value":10},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12011, "guardCondition":[{"operator":"=","value":11}]}
     },
-
     "state":{
-      "name":"Zone1_Entertainment2",
-      "value":11000,
-      "state":{
-        "name":"Zone1_Entertainment2_Visible",
-        "value":11001,
-        "event":{ "name":"EV10000","value":10001, "transition":10100},
-        "event":{ "name":"EV10000","value":10000, "transition":10200, "guardCondition":[{"operator":"=","value":1}]},
-        "event":{ "name":"EV10000","value":10000, "transition":10300, "guardCondition":[{"operator":"=","value":2}]},
-        "event":{ "name":"EV10000","value":10000, "transition":10400, "guardCondition":[{"operator":"=","value":3}]},
-        "event":{ "name":"EV10000","value":10000, "transition":10500, "guardCondition":[{"operator":"=","value":4}]},
-        "event":{ "name":"EV10600","value":10600, "transition":10601, "guardCondition":[{"operator":"in","value":"Reverse"}]},
-        "event":{ "name":"EV10600","value":10600, "transition":10602, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                        {"join":"and","operator":"in","value":"LeftWinker"}]},
-        "event":{ "name":"EV10600","value":10600, "transition":10603, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                        {"join":"and","operator":"in","value":"RightWinker"}]},
-        "event":{ "name":"EV10000","value":10000, "transition":10900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                        {"join":"and", "operator":"in","value":"NotRegulating"}]},
-        "event":{ "name":"EV10000","value":10000, "transition":11002, "guardCondition":[{              "operator":"=","value":9},
-                                                                                        {"join":"and", "operator":"in","value":"Regulating"}]}
-      },
-      "state":{
-        "name":"Zone1_Entertainment2_GrayScale",
-        "value":11002,
-        "event":{ "name":"EV10000","value":10001, "transition":10100},
-        "event":{ "name":"EV10000","value":10000, "transition":10200, "guardCondition":[{"operator":"=","value":1}]},
-        "event":{ "name":"EV10000","value":10000, "transition":10300, "guardCondition":[{"operator":"=","value":2}]},
-        "event":{ "name":"EV10000","value":10000, "transition":10400, "guardCondition":[{"operator":"=","value":3}]},
-        "event":{ "name":"EV10000","value":10000, "transition":10500, "guardCondition":[{"operator":"=","value":4}]},
-        "event":{ "name":"EV10600","value":10600, "transition":10601, "guardCondition":[{"operator":"in","value":"Reverse"}]},
-        "event":{ "name":"EV10600","value":10600, "transition":10602, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                        {"join":"and","operator":"in","value":"LeftWinker"}]},
-        "event":{ "name":"EV10600","value":10600, "transition":10603, "guardCondition":[{             "operator":"not","value":"Reverse"},
-                                                                                        {"join":"and","operator":"in","value":"RightWinker"}]},
-        "event":{ "name":"EV10000","value":10000, "transition":10900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                        {"join":"and", "operator":"in","value":"NotRegulating"}]},
-        "event":{ "name":"EV10000","value":10000, "transition":11001, "guardCondition":[{              "operator":"=","value":9},
-                                                                                        {"join":"and", "operator":"in","value":"NotRegulating"}]}
-      }
+      "name":"Display0Category10", /* Entertainment.audio */
+      "value":12010,
+      "event":{ "name":"EV12000","value":12000, "transition":12001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12010, "guardCondition":[{             "operator":"=","value":10},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12011, "guardCondition":[{"operator":"=","value":11}]}
+    },
+    "state":{
+      "name":"Display0Category11", /* Entertainment.visiual */
+      "value":12011,
+      "event":{ "name":"EV12000","value":12000, "transition":12001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12010, "guardCondition":[{             "operator":"=","value":10},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV12000","value":12000, "transition":12011, "guardCondition":[{"operator":"=","value":11}]}
     }
   },
 
   "state":{
-    "name":"Screen2",
-    "value":12000,
-
+    "name":"Display1Category",
+    "value":13000,
     "state":{
-      "name":"Screen2_Invisible",
-      "value":12100,
-      "event":{ "name":"EV12000","value":12000, "transition":12200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV12000","value":12000, "transition":13001, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV12000","value":12000, "transition":13002, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"Regulating"}]}
+      "name":"Display1Category1",
+      "value":13001,
+      "event":{ "name":"EV13000","value":13000, "transition":13001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13009, "guardCondition":[{"operator":"=","value":9}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13010, "guardCondition":[{"operator":"=","value":10}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13011, "guardCondition":[{"operator":"=","value":11}]}
     },
-
     "state":{
-      "name":"Screen2_Menu",
-      "value":12200,
-      "event":{ "name":"EV12001","value":12001, "transition":12100},
-      "event":{ "name":"EV12000","value":12000, "transition":12300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV12000","value":12000, "transition":13001, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV12000","value":12000, "transition":13002, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"Regulating"}]}
+      "name":"Display1Category2",
+      "value":13002,
+      "event":{ "name":"EV13000","value":13000, "transition":13001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13009, "guardCondition":[{"operator":"=","value":9}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13010, "guardCondition":[{"operator":"=","value":10}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13011, "guardCondition":[{"operator":"=","value":11}]}
     },
-
     "state":{
-      "name":"Screen2_Message",
-      "value":12300,
-      "event":{ "name":"EV12001","value":12001, "transition":12100},
-      "event":{ "name":"EV12000","value":12000, "transition":12200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV12000","value":12000, "transition":13001, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV12000","value":12000, "transition":13002, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"Regulating"}]}
+      "name":"Display1Category3",
+      "value":13003,
+      "event":{ "name":"EV13000","value":13000, "transition":13001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13009, "guardCondition":[{"operator":"=","value":9}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13010, "guardCondition":[{"operator":"=","value":10}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13011, "guardCondition":[{"operator":"=","value":11}]}
     },
-
     "state":{
-      "name":"Screen2_Map",
-      "value":12400,
-      "event":{ "name":"EV12001","value":12001, "transition":12100},
-      "event":{ "name":"EV12000","value":12000, "transition":12200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV12000","value":12000, "transition":13001, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV12000","value":12000, "transition":13002, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"Regulating"}]}
+      "name":"Display1Category4",
+      "value":13004,
+      "event":{ "name":"EV13000","value":13000, "transition":13001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13009, "guardCondition":[{"operator":"=","value":9}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13010, "guardCondition":[{"operator":"=","value":10}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13011, "guardCondition":[{"operator":"=","value":11}]}
     },
-
     "state":{
-      "name":"Screen2_Driving",
-      "value":12500,
-      "event":{ "name":"EV12001","value":12001, "transition":12100},
-      "event":{ "name":"EV12200","value":12000, "transition":12200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV12300","value":12000, "transition":12300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV12400","value":12000, "transition":12400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV12000","value":12000, "transition":13001, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV12000","value":12000, "transition":13002, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"Regulating"}]}
+      "name":"Display1Category5",
+      "value":13005,
+      "event":{ "name":"EV13000","value":13000, "transition":13001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13009, "guardCondition":[{"operator":"=","value":9}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13010, "guardCondition":[{"operator":"=","value":10}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13011, "guardCondition":[{"operator":"=","value":11}]}
     },
-
     "state":{
-      "name":"Screen2_Entertainment",
-      "value":12900,
-      "event":{ "name":"EV12001","value":12001, "transition":12100},
-      "event":{ "name":"EV12000","value":12900, "transition":12100, "guardCondition":[{"operator":"in","value":"Regulating"}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV12000","value":12000, "transition":12500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV12000","value":12000, "transition":13001, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV12000","value":12000, "transition":13002, "guardCondition":[{              "operator":"=","value":9},
-                                                                                      {"join":"and", "operator":"in","value":"Regulating"}]}
+      "name":"Display1Category6",
+      "value":13006,
+      "event":{ "name":"EV13000","value":13000, "transition":13001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13009, "guardCondition":[{"operator":"=","value":9}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13010, "guardCondition":[{"operator":"=","value":10}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13011, "guardCondition":[{"operator":"=","value":11}]}
+    },
+    "state":{
+      "name":"Display1Category7",
+      "value":13007,
+      "event":{ "name":"EV13000","value":13000, "transition":13001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13009, "guardCondition":[{"operator":"=","value":9}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13010, "guardCondition":[{"operator":"=","value":10}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13011, "guardCondition":[{"operator":"=","value":11}]}
+    },
+    "state":{
+      "name":"Display1Category8",
+      "value":13008,
+      "event":{ "name":"EV13000","value":13000, "transition":13001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13009, "guardCondition":[{"operator":"=","value":9}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13010, "guardCondition":[{"operator":"=","value":10}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13011, "guardCondition":[{"operator":"=","value":11}]}
+    },
+    "state":{
+      "name":"Display1Category9",
+      "value":13009,
+      "event":{ "name":"EV13000","value":13000, "transition":13001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13009, "guardCondition":[{"operator":"=","value":9}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13010, "guardCondition":[{"operator":"=","value":10}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13011, "guardCondition":[{"operator":"=","value":11}]}
     },
-
     "state":{
-      "name":"Screen2_Entertainment2",
-      "value":13000,
-      "state":{
-        "name":"Screen2_Entertainment2_Visible",
-        "value":13001,
-        "event":{ "name":"EV12000","value":12001, "transition":12100},
-        "event":{ "name":"EV12000","value":12000, "transition":12200, "guardCondition":[{"operator":"=","value":1}]},
-        "event":{ "name":"EV12000","value":12000, "transition":12300, "guardCondition":[{"operator":"=","value":2}]},
-        "event":{ "name":"EV12000","value":12000, "transition":12400, "guardCondition":[{"operator":"=","value":3}]},
-        "event":{ "name":"EV12000","value":12000, "transition":12500, "guardCondition":[{"operator":"=","value":4}]},
-        "event":{ "name":"EV12000","value":12000, "transition":12900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                        {"join":"and", "operator":"in","value":"NotRegulating"}]},
-        "event":{ "name":"EV12000","value":12000, "transition":13002, "guardCondition":[{              "operator":"=","value":9},
-                                                                                        {"join":"and", "operator":"in","value":"Regulating"}]}
-      },
-      "state":{
-        "name":"Screen2_Entertainment2_GrayScale",
-        "value":13002,
-        "event":{ "name":"EV12000","value":12001, "transition":12100},
-        "event":{ "name":"EV12000","value":12000, "transition":12200, "guardCondition":[{"operator":"=","value":1}]},
-        "event":{ "name":"EV12000","value":12000, "transition":12300, "guardCondition":[{"operator":"=","value":2}]},
-        "event":{ "name":"EV12000","value":12000, "transition":12400, "guardCondition":[{"operator":"=","value":3}]},
-        "event":{ "name":"EV12000","value":12000, "transition":12500, "guardCondition":[{"operator":"=","value":4}]},
-        "event":{ "name":"EV12000","value":12000, "transition":12900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                        {"join":"and", "operator":"in","value":"NotRegulating"}]},
-        "event":{ "name":"EV12000","value":12000, "transition":13001, "guardCondition":[{              "operator":"=","value":9},
-                                                                                        {"join":"and", "operator":"in","value":"NotRegulating"}]}
-      }
+      "name":"Display1Category10",
+      "value":13010,
+      "event":{ "name":"EV13000","value":13000, "transition":13001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13009, "guardCondition":[{"operator":"=","value":9}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13010, "guardCondition":[{"operator":"=","value":10}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13011, "guardCondition":[{"operator":"=","value":11}]}
+    },
+    "state":{
+      "name":"Display1Category11",
+      "value":13011,
+      "event":{ "name":"EV13000","value":13000, "transition":13001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13009, "guardCondition":[{"operator":"=","value":9}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13010, "guardCondition":[{"operator":"=","value":10}]},
+      "event":{ "name":"EV13000","value":13000, "transition":13011, "guardCondition":[{"operator":"=","value":11}]}
     }
   },
 
     "value":14000,
     "state":{
       "name":"OnScreen_Invisible",
-      "value":14100,
-      "event":{ "name":"EV14000","value":14000, "transition":14200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV14000","value":14000, "transition":14300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV14000","value":14000, "transition":14400, "guardCondition":[{"operator":"=","value":3}]}
+      "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}]}
     },
     "state":{
       "name":"OnScreen_Warning",
-      "value":14200,
-      "event":{ "name":"EV14001","value":14001, "transition":14100}
+      "value":14001,
+      "event":{ "name":"EV14001","value":14001, "transition":14999}
     },
     "state":{
       "name":"OnScreen_Attention",
-      "value":14300,
-      "event":{ "name":"EV14001","value":14001, "transition":14100},
-      "event":{ "name":"EV14000","value":14000, "transition":14200, "guardCondition":[{"operator":"=","value":1}]}
+      "value":14002,
+      "event":{ "name":"EV14001","value":14001, "transition":14999},
+      "event":{ "name":"EV14000","value":14000, "transition":14001, "guardCondition":[{"operator":"=","value":1}]}
     },
     "state":{
       "name":"OnScreen_Message",
-      "value":14400,
-      "event":{ "name":"EV14001","value":14001, "transition":14100},
-      "event":{ "name":"EV14000","value":14000, "transition":14200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV14000","value":14000, "transition":14300, "guardCondition":[{"operator":"=","value":2}]}
+      "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}]}
+    }
+  },
+
+  "state":{
+    "name":"IntterputDisplay0Zone1",
+    "value":15000,
+    "state":{
+      "name":"IntterputDisplay0Zone1_Invisible",
+      "value":15999,
+      "event":{ "name":"EV15000","value":15000, "transition":15001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV15000","value":15000, "transition":15002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV15000","value":15000, "transition":15003, "guardCondition":[{"operator":"=","value":3}]}
+    },
+    "state":{
+      "name":"IntterputDisplay0Zone1_Priority1",
+      "value":15001,
+      "event":{ "name":"EV15000","value":15001, "transition":15999}
+    },
+    "state":{
+      "name":"IntterputDisplay0Zone1_Priority2",
+      "value":15002,
+      "event":{ "name":"EV15000","value":15001, "transition":15999},
+      "event":{ "name":"EV15000","value":15000, "transition":15001, "guardCondition":[{"operator":"=","value":1}]}
+    },
+    "state":{
+      "name":"IntterputDisplay0Zone1_Priority3",
+      "value":15003,
+      "event":{ "name":"EV15000","value":15001, "transition":15999},
+      "event":{ "name":"EV15000","value":15000, "transition":15001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV15000","value":15000, "transition":15002, "guardCondition":[{"operator":"=","value":2}]}
     }
   },
 
   "state":{
-    "name":"IntZone1",
+    "name":"IntterputDisplay0Zone2",
     "value":16000,
     "state":{
-      "name":"IntZone1_Invisible",
-      "value":16100,
-      "event":{ "name":"EV16000","value":16000, "transition":16200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV16000","value":16000, "transition":16300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV16000","value":16000, "transition":16400, "guardCondition":[{"operator":"=","value":3}]}
+      "name":"IntterputDisplay0Zone2_Invisible",
+      "value":16999,
+      "event":{ "name":"EV16000","value":16000, "transition":16001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV16000","value":16000, "transition":16002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV16000","value":16000, "transition":16003, "guardCondition":[{"operator":"=","value":3}]}
     },
     "state":{
-      "name":"IntZone1_Priority1",
-      "value":16200,
-      "event":{ "name":"EV16000","value":16001, "transition":16100}
+      "name":"IntterputDisplay0Zone2_Priority1",
+      "value":16001,
+      "event":{ "name":"EV16000","value":16001, "transition":16999}
     },
     "state":{
-      "name":"IntZone1_Priority2",
-      "value":16300,
-      "event":{ "name":"EV16000","value":16001, "transition":16100},
-      "event":{ "name":"EV16000","value":16000, "transition":16200, "guardCondition":[{"operator":"=","value":1}]}
+      "name":"IntterputDisplay0Zone2_Priority2",
+      "value":16002,
+      "event":{ "name":"EV16000","value":16001, "transition":16999},
+      "event":{ "name":"EV16000","value":16000, "transition":16001, "guardCondition":[{"operator":"=","value":1}]}
     },
     "state":{
-      "name":"IntZone1_Priority3",
-      "value":16400,
-      "event":{ "name":"EV16000","value":16001, "transition":16100},
-      "event":{ "name":"EV16000","value":16000, "transition":16200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV16000","value":16000, "transition":16300, "guardCondition":[{"operator":"=","value":2}]}
+      "name":"IntterputDisplay0Zone2_Priority3",
+      "value":16003,
+      "event":{ "name":"EV16000","value":16001, "transition":16999},
+      "event":{ "name":"EV16000","value":16000, "transition":16001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV16000","value":16000, "transition":16002, "guardCondition":[{"operator":"=","value":2}]}
     }
   },
+
   "state":{
-    "name":"IntScreen2",
-    "value":18000,
+    "name":"IntterputDisplay0Zone3",
+    "value":17000,
     "state":{
-      "name":"IntScreen2_Invisible",
-      "value":18100,
-      "event":{ "name":"EV18000","value":18000, "transition":18200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV18000","value":18000, "transition":18300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV18000","value":18000, "transition":18400, "guardCondition":[{"operator":"=","value":3}]}
+      "name":"IntterputDisplay0Zone3_Invisible",
+      "value":17999,
+      "event":{ "name":"EV17000","value":17000, "transition":17001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV17000","value":17000, "transition":17002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV17000","value":17000, "transition":17003, "guardCondition":[{"operator":"=","value":3}]}
     },
     "state":{
-      "name":"IntScreen2_Priority1",
-      "value":18200,
-      "event":{ "name":"EV18000","value":18001, "transition":18100}
+      "name":"IntterputDisplay0Zone3_Priority1",
+      "value":17001,
+      "event":{ "name":"EV17000","value":17001, "transition":17999}
     },
     "state":{
-      "name":"IntScreen2_Priority2",
-      "value":18300,
-      "event":{ "name":"EV18000","value":18001, "transition":18100},
-      "event":{ "name":"EV18000","value":18000, "transition":18200, "guardCondition":[{"operator":"=","value":1}]}
+      "name":"IntterputDisplay0Zone3_Priority2",
+      "value":17002,
+      "event":{ "name":"EV17000","value":17001, "transition":17999},
+      "event":{ "name":"EV17000","value":17000, "transition":17001, "guardCondition":[{"operator":"=","value":1}]}
     },
     "state":{
-      "name":"IntScreen2_Priority3",
-      "value":18400,
-      "event":{ "name":"EV18000","value":18001, "transition":18100},
-      "event":{ "name":"EV18000","value":18000, "transition":18200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV18000","value":18000, "transition":18300, "guardCondition":[{"operator":"=","value":2}]}
+      "name":"IntterputDisplay0Zone3_Priority3",
+      "value":17003,
+      "event":{ "name":"EV17000","value":17001, "transition":17999},
+      "event":{ "name":"EV17000","value":17000, "transition":17001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV17000","value":17000, "transition":17002, "guardCondition":[{"operator":"=","value":2}]}
     }
   },
+
   "state":{
-    "name":"AllSpeaker",
+    "name":"SoundZone",
     "value":20000,
     "state":{
-      "name":"AllSpeaker_NoOutput",
-      "value":20100,
-      "event":{ "name":"EV20000","value":20000, "transition":20200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20600, "guardCondition":[{"operator":"=","value":5}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20700, "guardCondition":[{"operator":"=","value":6}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20800, "guardCondition":[{"operator":"=","value":7}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV20000","value":20000, "transition":21000, "guardCondition":[{"operator":"=","value":9}]}
-    },
-    "state":{
-      "name":"AllSpeaker_Menu",
-      "value":20200,
-      "event":{ "name":"EV20001","value":20001, "transition":20100},
-      "event":{ "name":"EV20000","value":20000, "transition":20300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20600, "guardCondition":[{"operator":"=","value":5}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20700, "guardCondition":[{"operator":"=","value":6}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20800, "guardCondition":[{"operator":"=","value":7}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV20000","value":20000, "transition":21000, "guardCondition":[{"operator":"=","value":9}]}
-    },
-    "state":{
-      "name":"AllSpeaker_Message",
-      "value":20300,
-      "event":{ "name":"EV20001","value":20001, "transition":20100},
-      "event":{ "name":"EV20000","value":20000, "transition":20200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20600, "guardCondition":[{"operator":"=","value":5}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20700, "guardCondition":[{"operator":"=","value":6}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20800, "guardCondition":[{"operator":"=","value":7}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV20000","value":20000, "transition":21000, "guardCondition":[{"operator":"=","value":9}]}
-    },
-    "state":{
-      "name":"AllSpeaker_Map",
-      "value":20400,
-      "event":{ "name":"EV20001","value":20001, "transition":20100},
-      "event":{ "name":"EV20000","value":20000, "transition":20200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20600, "guardCondition":[{"operator":"=","value":5}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20700, "guardCondition":[{"operator":"=","value":6}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20800, "guardCondition":[{"operator":"=","value":7}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV20000","value":20000, "transition":21000, "guardCondition":[{"operator":"=","value":9}]}
-    },
-    "state":{
-      "name":"AllSpeaker_Driving",
-      "value":20500,
-      "event":{ "name":"EV20001","value":20001, "transition":20100},
-      "event":{ "name":"EV20000","value":20000, "transition":20200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20600, "guardCondition":[{"operator":"=","value":5}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20700, "guardCondition":[{"operator":"=","value":6}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20800, "guardCondition":[{"operator":"=","value":7}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV20000","value":20000, "transition":21000, "guardCondition":[{"operator":"=","value":9}]}
-    },
-    "state":{
-      "name":"AllSpeaker_BackCamera",
-      "value":20600,
-      "event":{ "name":"EV20000","value":20001, "transition":20100},
-      "event":{ "name":"EV20000","value":20000, "transition":20200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20700, "guardCondition":[{"operator":"=","value":6}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20800, "guardCondition":[{"operator":"=","value":7}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV20000","value":20000, "transition":21000, "guardCondition":[{"operator":"=","value":9}]}
-    },
-    "state":{
-      "name":"AllSpeaker_LeftCamera",
-      "value":20700,
-      "event":{ "name":"EV20000","value":20001, "transition":20100},
-      "event":{ "name":"EV20000","value":20000, "transition":20200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20600, "guardCondition":[{"operator":"=","value":5}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20800, "guardCondition":[{"operator":"=","value":7}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV20000","value":20000, "transition":21000, "guardCondition":[{"operator":"=","value":9}]}
-    },
-    "state":{
-      "name":"AllSpeaker_RightCamera",
-      "value":20800,
-      "event":{ "name":"EV20000","value":20001, "transition":20100},
-      "event":{ "name":"EV20000","value":20000, "transition":20200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20600, "guardCondition":[{"operator":"=","value":5}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20700, "guardCondition":[{"operator":"=","value":6}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]},
-      "event":{ "name":"EV20000","value":20000, "transition":21000, "guardCondition":[{"operator":"=","value":9}]}
-    },
-    "state":{
-      "name":"AllSpeaker_Entertainment",
-      "value":20900,
-      "event":{ "name":"EV20001","value":20001, "transition":20100},
-      "event":{ "name":"EV20000","value":20000, "transition":20200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20600, "guardCondition":[{"operator":"=","value":5}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20700, "guardCondition":[{"operator":"=","value":6}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20800, "guardCondition":[{"operator":"=","value":7}]},
-      "event":{ "name":"EV20000","value":20000, "transition":21000, "guardCondition":[{"operator":"=","value":9}]}
-    },
-    "state":{
-      "name":"AllSpeaker_Entertainment2",
-      "value":21000,
-      "event":{ "name":"EV20000","value":20001, "transition":20100},
-      "event":{ "name":"EV20000","value":20000, "transition":20200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20400, "guardCondition":[{"operator":"=","value":3}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20500, "guardCondition":[{"operator":"=","value":4}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20600, "guardCondition":[{"operator":"=","value":5}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20700, "guardCondition":[{"operator":"=","value":6}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20800, "guardCondition":[{"operator":"=","value":7}]},
-      "event":{ "name":"EV20000","value":20000, "transition":20900, "guardCondition":[{              "operator":"=","value":8},
-                                                                                      {"join":"and", "operator":"in","value":"NotRegulating"}]}
+      "name":"SoundZone_NoUse",        /* No Use */
+      "value":20999,
+      "event":{ "name":"EV20000","value":20000, "transition":20001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV20000","value":20000, "transition":20002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV20000","value":20000, "transition":20003, "guardCondition":[{"operator":"=","value":3}]}
+    },
+    "state":{
+      "name":"SoundZone1",     /* Full */
+      "value":20001,
+      "event":{ "name":"EV20999","value":20999, "transition":20999 },
+      "event":{ "name":"EV20000","value":20000, "transition":20001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV20000","value":20000, "transition":20002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV20000","value":20000, "transition":20003, "guardCondition":[{"operator":"=","value":3}]}
+    },
+    "state":{
+      "name":"SoundZone2",     /* Driver */
+      "value":20002,
+      "event":{ "name":"EV20999","value":20999, "transition":20999 },
+      "event":{ "name":"EV20000","value":20000, "transition":20001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV20000","value":20000, "transition":20002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV20000","value":20000, "transition":20003, "guardCondition":[{"operator":"=","value":3}]}
+    },
+    "state":{
+      "name":"SoundZone3",     /* Passenger */
+      "value":20003,
+      "event":{ "name":"EV20999","value":20999, "transition":20999 },
+      "event":{ "name":"EV20000","value":20000, "transition":20001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV20000","value":20000, "transition":20002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV20000","value":20000, "transition":20003, "guardCondition":[{"operator":"=","value":3}]}
     }
   },
+
   "state":{
-    "name":"IntRightSpeaker",
+    "name":"SoundCategory",
     "value":22000,
     "state":{
-      "name":"IntRightSpeaker_NoOutput",
-      "value":22100,
-      "event":{ "name":"EV22000","value":22000, "transition":22200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV22000","value":22000, "transition":22300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV22000","value":22000, "transition":22400, "guardCondition":[{"operator":"=","value":3}]}
+      "name":"SoundCategory_Unknown", /* unknown */
+      "value":22999,
+      "event":{ "name":"EV22000","value":22000, "transition":22001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22010, "guardCondition":[{             "operator":"=","value":10}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22011, "guardCondition":[{"operator":"=","value":11},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]}
+    },
+    "state":{
+      "name":"SoundCategory1", /* Menu */
+      "value":22001,
+      "event":{ "name":"EV22999","value":22999, "transition":22999 },
+      "event":{ "name":"EV22000","value":22000, "transition":22001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22010, "guardCondition":[{             "operator":"=","value":10}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22011, "guardCondition":[{"operator":"=","value":11},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]}
     },
     "state":{
-      "name":"IntRightSpeaker_Priority1",
-      "value":22200,
-      "event":{ "name":"EV22001","value":22001, "transition":22100}
+      "name":"SoundCategory2", /* Message */
+      "value":22002,
+      "event":{ "name":"EV22999","value":22999, "transition":22999 },
+      "event":{ "name":"EV22000","value":22000, "transition":22001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22010, "guardCondition":[{             "operator":"=","value":10}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22011, "guardCondition":[{"operator":"=","value":11},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]}
     },
     "state":{
-      "name":"IntRightSpeaker_Priority2",
-      "value":22300,
-      "event":{ "name":"EV22001","value":22001, "transition":22100},
-      "event":{ "name":"EV22000","value":22000, "transition":22200, "guardCondition":[{"operator":"=","value":1}]}
+      "name":"SoundCategory3", /* Map */
+      "value":22003,
+      "event":{ "name":"EV22999","value":22999, "transition":22999 },
+      "event":{ "name":"EV22000","value":22000, "transition":22001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22010, "guardCondition":[{             "operator":"=","value":10}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22011, "guardCondition":[{"operator":"=","value":11},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]}
     },
     "state":{
-      "name":"IntRightSpeaker_Priority3",
-      "value":22400,
-      "event":{ "name":"EV22001","value":22001, "transition":22100},
-      "event":{ "name":"EV22000","value":22000, "transition":22200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV22000","value":22000, "transition":22300, "guardCondition":[{"operator":"=","value":2}]}
+      "name":"SoundCategory4", /* Driving */
+      "value":22004,
+      "event":{ "name":"EV22999","value":22999, "transition":22999 },
+      "event":{ "name":"EV22000","value":22000, "transition":22001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22010, "guardCondition":[{             "operator":"=","value":10}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22011, "guardCondition":[{"operator":"=","value":11},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]}
+    },
+    "state":{
+      "name":"SoundCategory5", /* CarSetting */
+      "value":22005,
+      "event":{ "name":"EV22999","value":22999, "transition":22999 },
+      "event":{ "name":"EV22000","value":22000, "transition":22001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22010, "guardCondition":[{             "operator":"=","value":10}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22011, "guardCondition":[{"operator":"=","value":11},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]}
+    },
+    "state":{
+      "name":"SoundCategory6", /* Camera.Back */
+      "value":22006,
+      "event":{ "name":"EV22999","value":22999, "transition":22999 },
+      "event":{ "name":"EV22000","value":22000, "transition":22001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22010, "guardCondition":[{             "operator":"=","value":10}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22011, "guardCondition":[{"operator":"=","value":11},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]}
+    },
+    "state":{
+      "name":"SoundCategory7", /* Camera.Left */
+      "value":22007,
+      "event":{ "name":"EV22999","value":22999, "transition":22999 },
+      "event":{ "name":"EV22000","value":22000, "transition":22001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22010, "guardCondition":[{             "operator":"=","value":10}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22011, "guardCondition":[{"operator":"=","value":11},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]}
+    },
+    "state":{
+      "name":"SoundCategory8", /* Camera.Right */
+      "value":22008,
+      "event":{ "name":"EV22999","value":22999, "transition":22999 },
+      "event":{ "name":"EV22000","value":22000, "transition":22001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22010, "guardCondition":[{             "operator":"=","value":10}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22011, "guardCondition":[{"operator":"=","value":11},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]}
+    },
+    "state":{
+      "name":"SoundCategory9", /* Entertainment */
+      "value":22009,
+      "event":{ "name":"EV22999","value":22999, "transition":22999 },
+      "event":{ "name":"EV22000","value":22000, "transition":22001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22010, "guardCondition":[{             "operator":"=","value":10}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22011, "guardCondition":[{"operator":"=","value":11},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]}
+    },
+    "state":{
+      "name":"SoundCategory10", /* Entertainment.audio */
+      "value":22010,
+      "event":{ "name":"EV22999","value":22999, "transition":22999 },
+      "event":{ "name":"EV22000","value":22000, "transition":22001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22010, "guardCondition":[{             "operator":"=","value":10}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22011, "guardCondition":[{"operator":"=","value":11},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]}
+    },
+    "state":{
+      "name":"SoundCategory11", /* Entertainment.visiual */
+      "value":22011,
+      "event":{ "name":"EV22999","value":22999, "transition":22999 },
+      "event":{ "name":"EV22000","value":22000, "transition":22001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22003, "guardCondition":[{"operator":"=","value":3}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22004, "guardCondition":[{"operator":"=","value":4}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22005, "guardCondition":[{"operator":"=","value":5}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22006, "guardCondition":[{"operator":"=","value":6}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22007, "guardCondition":[{"operator":"=","value":7}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22008, "guardCondition":[{"operator":"=","value":8}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22009, "guardCondition":[{             "operator":"=","value":9},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22010, "guardCondition":[{             "operator":"=","value":10}]},
+      "event":{ "name":"EV22000","value":22000, "transition":22011, "guardCondition":[{"operator":"=","value":11},
+                                                                                      {"join":"and","operator":"not","value":"Regulating"}]}
+    }
+  },
+
+  "state":{
+    "name":"IntterputSoundZone1",
+    "value":25000,
+    "state":{
+      "name":"IntterputSoundZone1_NoOutput",
+      "value":25999,
+      "event":{ "name":"EV25000","value":25000, "transition":25001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV25000","value":25000, "transition":25002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV25000","value":25000, "transition":25003, "guardCondition":[{"operator":"=","value":3}]}
+    },
+    "state":{
+      "name":"IntterputSoundZone1_Priority1",
+      "value":25001,
+      "event":{ "name":"EV25999","value":25999, "transition":25999}
+    },
+    "state":{
+      "name":"IntterputSoundZone1_Priority2",
+      "value":25002,
+      "event":{ "name":"EV25999","value":25999, "transition":25999},
+      "event":{ "name":"EV25000","value":25000, "transition":25001, "guardCondition":[{"operator":"=","value":1}]}
+    },
+    "state":{
+      "name":"IntterputSoundZone1_Priority3",
+      "value":25003,
+      "event":{ "name":"EV25999","value":25999, "transition":25999},
+      "event":{ "name":"EV25000","value":25000, "transition":25001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV25000","value":25000, "transition":25002, "guardCondition":[{"operator":"=","value":2}]}
     }
   },
+
+  "state":{
+    "name":"IntterputSoundZone2",
+    "value":26000,
+    "state":{
+      "name":"IntterputSoundZone2_NoOutput",
+      "value":26999,
+      "event":{ "name":"EV26000","value":26000, "transition":26001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV26000","value":26000, "transition":26002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV26000","value":26000, "transition":26003, "guardCondition":[{"operator":"=","value":3}]}
+    },
+    "state":{
+      "name":"IntterputSoundZone2_Priority1",
+      "value":26001,
+      "event":{ "name":"EV26999","value":26999, "transition":26999}
+    },
+    "state":{
+      "name":"IntterputSoundZone2_Priority2",
+      "value":26002,
+      "event":{ "name":"EV26999","value":26999, "transition":26999},
+      "event":{ "name":"EV26000","value":26000, "transition":26001, "guardCondition":[{"operator":"=","value":1}]}
+    },
+    "state":{
+      "name":"IntterputSoundZone2_Priority3",
+      "value":26003,
+      "event":{ "name":"EV26999","value":26999, "transition":26999},
+      "event":{ "name":"EV26000","value":26000, "transition":26001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV26000","value":26000, "transition":26002, "guardCondition":[{"operator":"=","value":2}]}
+    }
+  },
+
   "state":{
-    "name":"IntLeftSpeaker",
-    "value":24000,
+    "name":"IntterputSoundZone3",
+    "value":27000,
     "state":{
-      "name":"IntLeftSpeaker_NoOutput",
-      "value":24100,
-      "event":{ "name":"EV24000","value":24000, "transition":24200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV24000","value":24000, "transition":24300, "guardCondition":[{"operator":"=","value":2}]},
-      "event":{ "name":"EV24000","value":24000, "transition":24400, "guardCondition":[{"operator":"=","value":3}]}
+      "name":"IntterputSoundZone3_NoOutput",
+      "value":27999,
+      "event":{ "name":"EV27000","value":27000, "transition":27001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV27000","value":27000, "transition":27002, "guardCondition":[{"operator":"=","value":2}]},
+      "event":{ "name":"EV27000","value":27000, "transition":27003, "guardCondition":[{"operator":"=","value":3}]}
     },
     "state":{
-      "name":"IntLeftSpeaker_Priority1",
-      "value":24200,
-      "event":{ "name":"EV24001","value":24001, "transition":24100}
+      "name":"IntterputSoundZone3_Priority1",
+      "value":27001,
+      "event":{ "name":"EV27999","value":27999, "transition":27999}
     },
     "state":{
-      "name":"IntLeftSpeaker_Priority2",
-      "value":24300,
-      "event":{ "name":"EV24001","value":24001, "transition":24100},
-      "event":{ "name":"EV24000","value":24000, "transition":24200, "guardCondition":[{"operator":"=","value":1}]}
+      "name":"IntterputSoundZone3_Priority2",
+      "value":27002,
+      "event":{ "name":"EV27999","value":27999, "transition":27999},
+      "event":{ "name":"EV27000","value":27000, "transition":27001, "guardCondition":[{"operator":"=","value":1}]}
     },
     "state":{
-      "name":"IntLeftSpeaker_Priority3",
-      "value":24400,
-      "event":{ "name":"EV24001","value":24001, "transition":24100},
-      "event":{ "name":"EV24000","value":24000, "transition":24200, "guardCondition":[{"operator":"=","value":1}]},
-      "event":{ "name":"EV24000","value":24000, "transition":24300, "guardCondition":[{"operator":"=","value":2}]}
+      "name":"IntterputSoundZone3_Priority3",
+      "value":27003,
+      "event":{ "name":"EV27999","value":27999, "transition":27999},
+      "event":{ "name":"EV27000","value":27000, "transition":27001, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV27000","value":27000, "transition":27002, "guardCondition":[{"operator":"=","value":2}]}
     }
   },
 
   "state":{
-    "name":"STSW",
+    "name":"Input1",
     "value":30000,
     "state":{
-      "name":"STSW_NotUsing",
-      "value":30100,
-      "event":{ "name":"EV30000","value":30000, "transition":30200}
+      "name":"Input1_NotUsing",
+      "value":30001,
+      "event":{ "name":"EV30000","value":30000, "transition":30002}
     },
     "state":{
-      "name":"STSW_Using",
-      "value":30200,
-      "event":{ "name":"EV30000","value":30001, "transition":30100}
+      "name":"Input1_Using",
+      "value":30002,
+      "event":{ "name":"EV30000","value":30000, "transition":30002},
+      "event":{ "name":"EV30001","value":30000, "transition":30001}
     }
   },
 
   "state":{
-    "name":"ESW",
-    "value":32000,
+    "name":"Input2",
+    "value":30100,
     "state":{
-      "name":"ESW_NotUsing",
-      "value":32100,
-      "event":{ "name":"EV30000","value":32000, "transition":32200}
+      "name":"Input2_NotUsing",
+      "value":30101,
+      "event":{ "name":"EV30100","value":30100, "transition":30102}
     },
     "state":{
-      "name":"ESW_Using",
-      "value":32200,
-      "event":{ "name":"EV30000","value":32001, "transition":32100}
+      "name":"Input2_Using",
+      "value":30102,
+      "event":{ "name":"EV30100","value":30100, "transition":30102},
+      "event":{ "name":"EV30101","value":30100, "transition":30101}
     }
   },
 
index fd35bea..f922de3 100644 (file)
             <zone id="0" name="Base"/>
             <zone id="1" name="Full"/>
             <zone id="2" name="Driver"/>
+            <zone id="3" name="Passenger"/>
         </zones>
     </sound>
 </sounds>
 
 <!-- Application Category name -->
 <categorys>
-    <category id="0" name="Menu">
+    <category id="1" name="Menu">
         <type>system</type>
         <view>always</view>
         <sound>always</sound>
         <priority>4</priority>
         <r_ctrl>2</r_ctrl>
     </category>
-    <category id="1" name="Message">
+    <category id="2" name="Message">
         <type>message</type>
         <view>always</view>
         <sound>always</sound>
         <priority>5</priority>
         <r_ctrl>2</r_ctrl>
     </category>
-    <category id="2" name="Map">
+    <category id="3" name="Map">
         <type>map</type>
         <view>always</view>
         <sound>always</sound>
         <priority>3</priority>
         <r_ctrl>0</r_ctrl>
     </category>
-    <category id="3" name="Driving">
+    <category id="4" name="Driving">
         <type>maker</type>
         <view>run</view>
         <sound>run</sound>
         <priority>2</priority>
         <r_ctrl>0</r_ctrl>
     </category>
-    <category id="4" name="CarSetting">
+    <category id="5" name="CarSetting">
         <type>maker</type>
         <view>parked</view>
         <sound>parked</sound>
         <priority>2</priority>
         <r_ctrl>0</r_ctrl>
     </category>
-    <category id="5" name="Camera.Back">
+    <category id="6" name="Camera.Back">
         <type>maker</type>
         <view>shift_back</view>
         <sound>shift_back</sound>
         <priority>6</priority>
         <r_ctrl>1</r_ctrl>
     </category>
-    <category id="6" name="Camera.Left">
+    <category id="7" name="Camera.Left">
         <type>maker</type>
         <view>blinker_left</view>
         <sound>blinker_left</sound>
         <priority>6</priority>
         <r_ctrl>1</r_ctrl>
     </category>
-    <category id="7" name="Camera.Right">
+    <category id="8" name="Camera.Right">
         <type>maker</type>
         <view>blinker_right</view>
         <sound>blinker_right</sound>
         <priority>6</priority>
         <r_ctrl>1</r_ctrl>
     </category>
-    <category id="8" name="Entertainment">
+    <category id="9" name="Entertainment">
         <type>unknown</type>
         <view>parked</view>
         <sound>parked</sound>
         <priority>0</priority>
         <r_ctrl>2</r_ctrl>
     </category>
-    <category id="9" name="Entertainment.audio">
+    <category id="10" name="Entertainment.audio">
         <type>unknown</type>
         <view>parked</view>
         <sound>always</sound>
         <priority>0</priority>
         <r_ctrl>1</r_ctrl>
     </category>
-    <category id="10" name="Entertainment.visiual">
+    <category id="11" name="Entertainment.visiual">
         <type>unknown</type>
         <view>always</view>
         <sound>parked</sound>
     <do_it>yes</do_it>
     <ctrl_dir_path>/sys/fs/cgroup/cpu,cpuacct/SCprivate</ctrl_dir_path>
     <sampling_wait>300</sampling_wait>
+    <retry_cnt>6</retry_cnt>
+    <low_limit_value>30</low_limit_value>
+    <high_limit_value>92</high_limit_value>
     <sector id="0" name="groupA">
         <hight_array>
             <item>500</item>
 <default>
     <node>Center</node>
     <appkind>UnKnown</appkind>
-    <category>Entertainment.audio</category>
+    <category>Entertainment</category>
     <display>Center</display>
     <layer>Application</layer>
     <displayzone>Full</displayzone>
     <loglevel>128</loglevel>
     <logflush>false</logflush>
 </log>
+
+<login_user>
+    <parent_dir>/home/app/ico</parent_dir>
+</login_user>
+
 </systemconfig>
 <!-- vim:set expandtab ts=4 sw=4: -->
diff --git a/res/org.tizen.ico.system-controller/res/ico/defaultApps.info b/res/org.tizen.ico.system-controller/res/ico/defaultApps.info
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/homescreen/CicoHSAppHistory.cpp b/src/homescreen/CicoHSAppHistory.cpp
new file mode 100644 (file)
index 0000000..7bad292
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   Homescreen application history sequence manager
+ *
+ * @date    Sep-16-2013
+ */
+#include <string>
+#include <list>
+#include "CicoHSAppHistory.h"
+#include "CicoLog.h"
+
+using namespace std;
+
+/**
+ * @brief constructor
+ */
+CicoHSAppHistory::CicoHSAppHistory()
+{
+    m_user.clear();
+    m_path.clear();
+}
+
+/**
+ * @brief constructor
+ * @param user login user name
+ * @param path application list
+ */
+CicoHSAppHistory::CicoHSAppHistory(const char* user, const char* path)
+    :m_user(user), m_path(path)
+{
+}
+
+/**
+ * @brief destructor
+ *
+ */
+CicoHSAppHistory::~CicoHSAppHistory()
+{
+    m_user.clear();
+    m_path.clear();
+}
+
+/**
+ * @brief added application id to list
+ * @param app target application id
+ */
+void CicoHSAppHistory::addAppHistory(const string& app)
+{
+    ICO_TRA("CicoHSAppHistory::addAppHistory(%s) start(%d)", app.c_str(),
+            (int)m_appHistoryList.size());
+    delAppHistory(app);
+    if (0 == m_appHistoryList.size()) {
+        m_appHistoryList.push_back(app);
+    }
+    else {
+        list<string>::iterator p = m_appHistoryList.begin();
+        m_appHistoryList.insert(p, 1, app);
+    }
+    ICO_TRA("CicoHSAppHistory::addAppHistory() end()",
+            (int)m_appHistoryList.size());
+}
+
+/**
+ * @brief delete application id to list
+ * @param app target application id
+ */
+void CicoHSAppHistory::delAppHistory(const string& app)
+{
+    ICO_TRA("CicoHSAppHistory::delAppHistory(%s) start(%d)", app.c_str(),
+            (int)m_appHistoryList.size());
+    m_appHistoryList.remove(app);
+    ICO_TRA("CicoHSAppHistory::delAppHistory() end(%d)",
+            (int)m_appHistoryList.size());
+}
+
+/**
+ * @brief priority change list
+ * @param app target application id
+ */
+void CicoHSAppHistory::moveHistoryHead(const string& app)
+{
+    ICO_TRA("CicoHSAppHistory::moveHistoryHead(%s) start(%d)", app.c_str(),
+            (int)m_appHistoryList.size());
+//    delAppHistory(app);
+    bool b = false;
+    list<string>::iterator p = m_appHistoryList.begin();
+    for (; p != m_appHistoryList.end(); ++p) {
+        if (app == *p) {
+            b = true; // app is exist
+            break; // break of for p
+        }
+    }
+    if (true == b) { // application exist ?
+        addAppHistory(app);
+    }
+    ICO_TRA("CicoHSAppHistory::moveHistoryHead() end");
+}
+
diff --git a/src/homescreen/CicoHSAppHistory.h b/src/homescreen/CicoHSAppHistory.h
new file mode 100644 (file)
index 0000000..19c0ef5
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   Homescreen application history sequence manager
+ *
+ * @date    Sep-16-2013
+ */
+#ifndef CICOHSAPPHISTORY_H
+#define CICOHSAPPHISTORY_H
+
+#include <string>
+#include <list>
+
+class CicoHSAppHistory
+{
+public:
+    CicoHSAppHistory();
+    CicoHSAppHistory(const char* user, const char* path);
+    ~CicoHSAppHistory();
+
+    // get
+    const std::string& getUser() const;
+    const std::string& getPath() const;
+    const std::list<std::string>& getAppHistory() const;
+
+    // operate
+    void addAppHistory(const std::string& app);
+    void delAppHistory(const std::string& app);
+    void moveHistoryHead(const std::string& app);
+
+protected:
+    std::string         m_user;
+    std::string         m_path;
+    std::list<std::string>   m_appHistoryList;
+};
+
+/**
+ * @brief get user name
+ * @ret user name
+ */
+inline const std::string& CicoHSAppHistory::getUser() const
+{
+    return m_user;
+}
+
+/**
+ * @breif get file path
+ * @ret file path
+ */
+inline const std::string& CicoHSAppHistory::getPath() const
+{
+    return m_path;
+}
+
+
+/**
+ * @brief get history appid list
+ * @ret list<string> 
+ */
+inline const std::list<std::string>& CicoHSAppHistory::getAppHistory() const
+{
+    return m_appHistoryList;
+}
+#endif // CICOHSAPPHISTORY_H
+
index 638486c..969ae48 100644 (file)
@@ -14,6 +14,7 @@
 #include "CicoHSControlBarWindow.h"
 #include "CicoHSControlBarTouch.h"
 #include "CicoHomeScreen.h"
+#include "CicoHSSystemState.h"
 
 /*============================================================================*/
 /* functions                                                                  */
@@ -82,42 +83,28 @@ CicoHSControlBarWindow::CreateControlBarWindow(int pos_x,int pos_y,int width,int
     }
 
     /*control bar back*/
-    /* image file name*/
-    snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,ICO_HS_IMAGE_FILE_CONTROL_BAR_BASE);
-    /* set object*/
-    canvas = evas_object_image_filled_add(evas);
-    int err = evas_object_image_load_error_get(canvas);
-    if (err != EVAS_LOAD_ERROR_NONE) {
-        ICO_DBG("CicoHSControlBarWindow::CreateControlBarWindow: backgound image is not exist");
-
-        evas_object_del(canvas);
-        FreeWindow();
-        return ICO_ERROR;
-    }
-    
-    evas_object_image_file_set(canvas, img_path, NULL);
-    evas_object_move(canvas, 0, 0);
-    evas_object_resize(canvas, width,height);
-    evas_object_show(canvas);
-
+       background = evas_object_rectangle_add(evas);
+    evas_object_color_set(background,128,128,128,255);
+    evas_object_move(background, 0, 0);
+    evas_object_resize(background, width,height);
+    evas_object_show(background);
 
     /*home button*/
     /* image file name*/
-    snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON);
+    snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_DAY);
 
     /* set object*/
-    home_button = evas_object_image_filled_add(evas);
-    evas_object_image_file_set(home_button, img_path, NULL);
-    evas_object_move(home_button, (width/2) - (ICO_HS_CONTROL_BAR_HOME_BUTTON_WIDTH /2),
-                      ICO_HS_CONTROL_BAR_HOME_BUTTON_START_POS_Y);
-    evas_object_resize(home_button, ICO_HS_CONTROL_BAR_HOME_BUTTON_WIDTH, 
-                       ICO_HS_CONTROL_BAR_HOME_BUTTON_HEIGHT);;
-    evas_object_event_callback_add(home_button, EVAS_CALLBACK_MOUSE_DOWN,
+    menu_btn = evas_object_image_filled_add(evas);
+    evas_object_image_file_set(menu_btn, img_path, NULL);
+    evas_object_move(menu_btn, (width/2) - (ICO_HS_CONTROL_BAR_MENU_BTN_WIDTH /2),
+                      ICO_HS_CONTROL_BAR_MENU_BTN_START_POS_Y);
+    evas_object_resize(menu_btn, ICO_HS_CONTROL_BAR_MENU_BTN_WIDTH, 
+                       ICO_HS_CONTROL_BAR_MENU_BTN_HEIGHT);;
+    evas_object_event_callback_add(menu_btn, EVAS_CALLBACK_MOUSE_DOWN,
                                    CicoHSControlBarTouch::TouchDownControlBar,NULL);
-    evas_object_event_callback_add(home_button, EVAS_CALLBACK_MOUSE_UP,
+    evas_object_event_callback_add(menu_btn, EVAS_CALLBACK_MOUSE_UP,
                                    CicoHSControlBarTouch::TouchUpControlBar,NULL);
-    evas_object_show(home_button);    
+    evas_object_show(menu_btn);    
  
     return ICO_OK;
 }
@@ -134,8 +121,8 @@ CicoHSControlBarWindow::CreateControlBarWindow(int pos_x,int pos_y,int width,int
 void
 CicoHSControlBarWindow::FreeControlBarWindow(void)
 {
-    evas_object_del(home_button);
-    evas_object_del(canvas);
+    evas_object_del(background);
+    evas_object_del(menu_btn);
     FreeWindow();
 }
 
@@ -153,3 +140,128 @@ CicoHSControlBarWindow::TouchHome(void)
 {
     CicoHomeScreen::ChangeMode(ICO_HS_SHOW_HIDE_PATTERN_SLIDE);
 }
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSControlBarWindow::SetNightMode
+ *          set night mode color theme chagne
+ *
+ * @param   none
+ * @return  none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSControlBarWindow::SetNightMode(void)
+{
+    ICO_DBG("CicoHSControlBarWindow::SetNightMode Enter");
+
+    bool state = CicoHSSystemState::getInstance()->getNightMode();
+
+    char img_path[ICO_HS_MAX_PATH_BUFF_LEN];
+    if (true == state) {
+        ICO_DBG("ICO_SYC_STATE_ON");
+        evas_object_color_set(background,0,0,0,255);
+        evas_object_show(background);    
+        if (true == CicoHSSystemState::getInstance()->getRegulation()) {
+            ICO_DBG("Regulation=ON");
+            snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,
+                     ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_NIHGT2);
+        }
+        else {
+            ICO_DBG("Regulation=OFF");
+            snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,
+                     ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_NIHGT);
+        }
+        evas_object_image_file_set(menu_btn, img_path, NULL);
+        evas_object_show(menu_btn);    
+    }
+    else {
+        ICO_DBG("ICO_SYC_STATE_OFF");
+        evas_object_color_set(background,128,128,128,255);
+        evas_object_show(background);    
+        if (true == CicoHSSystemState::getInstance()->getRegulation()) {
+            ICO_DBG("Regulation=ON");
+            snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,
+                     ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_DAY2);
+        }
+        else {
+            ICO_DBG("Regulation=OFF");
+            snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,
+                     ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_DAY);
+        }
+        evas_object_image_file_set(menu_btn, img_path, NULL);
+        evas_object_show(menu_btn);    
+    }
+    evas_render(evas);
+    ico_syc_hide(appid, surface, NULL);
+    ico_syc_show(appid, surface, NULL);
+
+    ICO_DBG("CicoHSControlBarWindow::SetNightMode Leave");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSControlBarWindow::SetRegulation
+ *          set regulation color theme chagne
+ *
+ * @param   none
+ * @return  none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSControlBarWindow::SetRegulation(void)
+{
+    ICO_DBG("CicoHSControlBarWindow::SetRegulation Enter");
+
+    char img_path[ICO_HS_MAX_PATH_BUFF_LEN];
+    if (true == CicoHSSystemState::getInstance()->getNightMode()) {
+        ICO_DBG("NightMode=ON");
+        if (true == CicoHSSystemState::getInstance()->getRegulation()) {
+            ICO_DBG("Regulation=ON");
+            snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,
+                     ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_NIHGT2);
+        }
+        else {
+            ICO_DBG("Regulation=OFF");
+            snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,
+                     ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_NIHGT);
+        }
+    }
+    else {
+        ICO_DBG("NightMode=OFF");
+        if (true == CicoHSSystemState::getInstance()->getRegulation()) {
+            ICO_DBG("Regulation=ON");
+            snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,
+                     ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_DAY2);
+        }
+        else {
+            ICO_DBG("Regulation=OFF");
+            snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,
+                     ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_DAY);
+        }
+    }
+    evas_object_image_file_set(menu_btn, img_path, NULL);
+    evas_object_show(menu_btn);    
+    evas_render(evas);
+    ico_syc_hide(appid, surface, NULL);
+    ico_syc_show(appid, surface, NULL);
+
+    ICO_DBG("CicoHSControlBarWindow::SetRegulation Leave");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSControlBarWindow::SetMenuWindowID
+ *          set appid and surface
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSControlBarWindow::SetWindowID(const char *appid,int surface)
+{
+    strncpy(this->appid,appid,ICO_HS_MAX_PROCESS_NAME);
+    this->surface = surface;
+}
+// vim: set expandtab ts=4 sw=4:
index 467c896..11b1396 100644 (file)
@@ -29,9 +29,9 @@
 #include "CicoHomeScreenConfig.h"
 #include "CicoHSWindow.h"
 
-#define ICO_HS_CONTROL_BAR_HOME_BUTTON_START_POS_Y 10
-#define ICO_HS_CONTROL_BAR_HOME_BUTTON_WIDTH 108
-#define ICO_HS_CONTROL_BAR_HOME_BUTTON_HEIGHT 108
+#define ICO_HS_CONTROL_BAR_MENU_BTN_START_POS_Y 10
+#define ICO_HS_CONTROL_BAR_MENU_BTN_WIDTH 108
+#define ICO_HS_CONTROL_BAR_MENU_BTN_HEIGHT 108
 
 class CicoHSControlBarWindow :public CicoHSWindow
 {
@@ -45,15 +45,24 @@ class CicoHSControlBarWindow :public CicoHSWindow
     
     void TouchHome(void);
 
+    void SetWindowID(const char *appid,int surface);
+
+    void SetNightMode(void);
+    void SetRegulation(void);
+
   private:
+    /* for window control */
+    char appid[ICO_HS_MAX_PROCESS_NAME];
+    int surface;
+
     char img_dir_path[ICO_HS_MAX_PATH_BUFF_LEN];
     Evas *evas;         /* evas object */
-    Evas_Object *canvas;
-    Evas_Object *home_button;
+    Evas_Object *background;
+    Evas_Object *menu_btn;
 
   protected:
     CicoHSControlBarWindow operator=(const CicoHSControlBarWindow&);
     CicoHSControlBarWindow(const CicoHSControlBarWindow&);
 };
 #endif
-
+// vim: set expandtab ts=4 sw=4:
index f166fd1..1edf5bf 100644 (file)
@@ -410,7 +410,7 @@ CicoHSMenuTile::ValidThumbnail(int surface)
         ico_syc_unmap_thumb(thumb_surface);
         thumbnail = NULL;
     }
-    ico_syc_prepare_thumb(surface,0);
+    ico_syc_map_thumb(surface, 5);
     thumb_surface = surface;
 
     ICO_DBG("CicoHSMenuTile::ValidThumbnail: prepare thumbnail 0x%d",surface);
@@ -429,17 +429,12 @@ void
 CicoHSMenuTile::SetThumbnail(int surface)
 {
     if(thumb_surface != surface){
+        ICO_DBG("CicoHSMenuTile::SetThumbnail: unmap thumbnail %d", thumb_surface);
         ico_syc_unmap_thumb(thumb_surface);
         thumbnail = NULL;
     }
-    thumbnail = ico_syc_map_thumb(surface);
-    if(thumbnail == NULL){
-        ICO_ERR("CicoHSMenuTile::SetThumbnail: failed get thumbnail 0x%x",thumbnail);
-        return;
-    }
   
-    ICO_DBG("CicoHSMenuTile::SetThumbnail: get thumbnail 0x%x",thumbnail->data);
-
-    evas_object_image_data_set(tile,thumbnail->data);
-
+    ICO_DBG("CicoHSMenuTile::SetThumbnail: create thumbnail image %d", thumb_surface);
+    // create EFL not support image composit,/ so composit myself.
+    // evas_object_image_data_set(tile,thumbnail->data);
 }
index 82e3f47..cabb7c4 100644 (file)
@@ -116,7 +116,7 @@ class CicoHSMenuTile
     Evas_Object *tile;
     Evas_Object *term_icon;
     int                   thumb_surface;
-    ico_syc_thumb_data_t *thumbnail;
+    ico_syc_thumb_info_t *thumbnail;
 
   protected:
     CicoHSMenuTile operator=(const CicoHSMenuTile&);
index 809c169..59762e4 100644 (file)
@@ -14,6 +14,7 @@
 #include "CicoHSMenuWindow.h"
 #include "CicoHSMenuTouch.h"
 #include "CicoHomeScreen.h"
+#include "CicoHSSystemState.h"
 #include <stdio.h>
 
 /*============================================================================*/
@@ -61,6 +62,8 @@ CicoHSMenuWindow::CicoHSMenuWindow(void)
 
     CicoHomeScreenResourceConfig::GetImagePath(img_dir_path,
                                                ICO_HS_MAX_PATH_BUFF_LEN);
+
+       m_showState = false;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -96,7 +99,12 @@ CicoHSMenuWindow::SetMenuBack(void)
 
     /* set object*/ 
     rectangle = evas_object_rectangle_add(evas);
-    evas_object_color_set(rectangle,0,0,0,178); 
+    if (true == CicoHSSystemState::getInstance()->getNightMode()) {
+               evas_object_color_set(rectangle,0,0,0,178); 
+       }
+       else {
+               evas_object_color_set(rectangle,120,120,120,178); 
+       }
     evas_object_move(rectangle, 0, 0);
     evas_object_resize(rectangle, width,height);
     evas_object_show(rectangle);
@@ -792,6 +800,11 @@ CicoHSMenuWindow::SetMenuWindowID(const char *appid,int surface)
 void
 CicoHSMenuWindow::Show(ico_syc_animation_t *animation)
 {
+       // if regulation == true, forbid show window.
+    if (true == CicoHSSystemState::getInstance()->getRegulation()) {
+               return;
+       }
+       m_showState = true;
     ico_syc_show(appid,surface,animation);
 }
 
@@ -810,6 +823,7 @@ CicoHSMenuWindow::Hide(ico_syc_animation_t *animation)
     if(terminate_mode == true){
         ChangeNormalMode();
     }
+       m_showState = false;
     ico_syc_hide(appid,surface,animation);
 }
 /*--------------------------------------------------------------------------*/
@@ -971,5 +985,30 @@ CicoHSMenuWindow::SetThumbnail(const char *appid,int surface)
     }
 }
 
-
-
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::SetNightMode
+ *          set night mode color theme chagne
+ *
+ * @param   none
+ * @return  none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::SetNightMode(void)
+{
+    ICO_DBG("CicoHSControlBarWindow::SetNightMode Enter");
+    if (true == CicoHSSystemState::getInstance()->getNightMode()) {
+               evas_object_color_set(rectangle,0,0,0,178); 
+       }
+       else {
+               evas_object_color_set(rectangle,120,120,120,178); 
+       }
+
+       // redraw
+       if (true == m_showState) {
+               Hide(NULL);
+               Show(NULL);
+       }
+    ICO_DBG("CicoHSControlBarWindow::SetNightMode Leave");
+}
index 16a06a0..78dee0c 100644 (file)
@@ -89,6 +89,8 @@ class CicoHSMenuWindow :public CicoHSWindow
     static Eina_Bool MoveDownAnimation(void *data,double pos);
     static Eina_Bool MoveUpAnimation(void *data,double pos);
     
+       void SetNightMode(void);
+
   private:
     int SetMenuBack(void);
     void FreeMenuBack(void);
@@ -129,6 +131,7 @@ class CicoHSMenuWindow :public CicoHSWindow
     CicoSCLifeCycleController *life_cycle_controller;
     /* my instance (for callback) */
     static CicoHSMenuWindow *menu_window_instance;
+       bool m_showState;
 
   protected:
     CicoHSMenuWindow operator=(const CicoHSMenuWindow&);
diff --git a/src/homescreen/CicoHSSystemState.cpp b/src/homescreen/CicoHSSystemState.cpp
new file mode 100644 (file)
index 0000000..b9d2ff1
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+/*========================================================================*/
+/**
+ *  @file   CicoHSSystemState.cpp
+ *
+ *  @brief  This file implementation of CicoHSSystemState class
+ */
+/*========================================================================*/
+
+#include <cstdio>
+
+#include "CicoHSSystemState.h"
+
+CicoHSSystemState* CicoHSSystemState::ms_myInstance = NULL;
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
+CicoHSSystemState::CicoHSSystemState()
+    : m_regulation(false), m_nightmode(false)
+{
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
+CicoHSSystemState::~CicoHSSystemState()
+{
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get this class instance
+ */
+//--------------------------------------------------------------------------
+CicoHSSystemState*
+CicoHSSystemState::getInstance(void)
+{
+    if (NULL == ms_myInstance) {
+        ms_myInstance = new CicoHSSystemState();
+    }
+
+    return ms_myInstance;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get regulation state
+ *
+ *  @return regulation state
+ *  @retval true    regulation on
+ *  @retval false   regulation off
+ */
+//--------------------------------------------------------------------------
+bool
+CicoHSSystemState::getRegulation(void)
+{
+    return m_regulation;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  set regulation state
+ *
+ *  @param  state   regulation state(true:on/false:off)
+ */
+//--------------------------------------------------------------------------
+void
+CicoHSSystemState::setRegulation(bool state)
+{
+    m_regulation = state;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get regulation state
+ *
+ *  @return night mode state
+ *  @retval true    night mode on
+ *  @retval false   night mode off
+ */
+//--------------------------------------------------------------------------
+bool
+CicoHSSystemState::getNightMode(void)
+{
+    return m_nightmode;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  set regulation state
+ *
+ *  @param  state   regulation state(true:on/false:off)
+ */
+//--------------------------------------------------------------------------
+void
+CicoHSSystemState::setNightMode(bool state)
+{
+    m_nightmode = state;
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/src/homescreen/CicoHSSystemState.h b/src/homescreen/CicoHSSystemState.h
new file mode 100644 (file)
index 0000000..11007a4
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+//==========================================================================
+/**
+ *  @file   CicoHSSystemState.h
+ *
+ *  @brief  This file is definition of CicoHSSystemState class
+ */
+//==========================================================================
+#ifndef __CICO_HS_SYSTEM_STATE_H__
+#define __CICO_HS_SYSTEM_STATE_H__
+
+//==========================================================================
+/**
+ *  @brief  This class hold system state
+ */
+//==========================================================================
+class CicoHSSystemState
+{
+public:
+    // get this class instance
+    static CicoHSSystemState* getInstance(void);
+
+    // get regulation state
+    bool getRegulation(void);
+
+    // set regulation state
+    void setRegulation(bool state);
+
+    // get night mode state
+    bool getNightMode(void);
+
+    // set night mode state
+    void setNightMode(bool state);
+
+private:
+    // default constructor
+    CicoHSSystemState();
+
+    // destructor
+    ~CicoHSSystemState();
+
+    /// assignment operator
+    CicoHSSystemState& operator=(const CicoHSSystemState &object);
+
+    /// copy constructor
+    CicoHSSystemState(const CicoHSSystemState &object);
+
+public:
+    static CicoHSSystemState* ms_myInstance;   ///< this class instance
+
+    bool m_regulation;  ///< regulation state
+    bool m_nightmode;   ///< night mode state
+};
+#endif  // __CICO_HS_SYSTEM_STATE_H__
+// vim:set expandtab ts=4 sw=4:
index 7ce8768..de17e7f 100644 (file)
@@ -12,6 +12,7 @@
  * @date    Aug-08-2013
  */
 #include "CicoHomeScreen.h"
+#include "CicoHSSystemState.h"
 
 /*============================================================================*/
 /* static members                                                             */
@@ -58,6 +59,7 @@ CicoHomeScreen::CicoHomeScreen(void)
     mode = ICO_HS_MODE_APPLICATION;
     config = NULL;
     hs_instance = NULL;
+
 }
 
 /*--------------------------------------------------------------------------*/
@@ -290,7 +292,7 @@ CicoHomeScreen::ExecuteApp_i(const char *appid)
  *
  * @param[in]   appid    application id
  * @return      none
- *
+ */
 /*--------------------------------------------------------------------------*/
 void
 CicoHomeScreen::TerminateApp_i(const char *appid)
@@ -535,6 +537,11 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event,
                 hs_instance->menu_window->SetMenuWindowID(win_attr->appid,
                     win_attr->surface);
             }
+            else if(strncmp(win_attr->name,ICO_HS_CONTROL_BAR_WINDOW_TITLE,
+                            ICO_MAX_TITLE_NAME_LEN) == 0){
+                hs_instance->ctl_bar_window->SetWindowID(win_attr->appid,
+                                                         win_attr->surface);
+            }
             ico_hs_window_info * l_win_info = 
                      hs_instance->GetWindowInfo(hs_instance->hs_app_info,
                                                 win_attr->name);
@@ -592,20 +599,12 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event,
             hs_instance->hs_app_info->SetShowed(l_win_info,true);
         }
     }
-    else if(event == ICO_SYC_EV_THUMB_PREPARE){
-        ico_syc_thumb_info_t *thumb_info = 
-            reinterpret_cast<ico_syc_thumb_info_t*>(const_cast<void*>(detail));
-        CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(thumb_info->appid);
-        if(appinfo == NULL){
-            return;
-        }
-        //show icon
-        hs_instance->menu_window->SetThumbnail(thumb_info->appid,thumb_info->surface);
-    }
     else if(event == ICO_SYC_EV_THUMB_CHANGE){
         ico_syc_thumb_info_t *thumb_info = 
             reinterpret_cast<ico_syc_thumb_info_t*>(const_cast<void*>(detail));
         CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(thumb_info->appid);
+        ICO_DBG("CicoHomeScreen::EventCallBack : ICO_SYC_EV_THUMB_CHANGE %s",
+                thumb_info->appid);
         if(appinfo == NULL){
             return;
         }
@@ -642,6 +641,33 @@ CicoHomeScreen::EventCallBack(const ico_syc_ev_e event,
     else if(event == ICO_SYC_EV_INPUT_UNSET){
    
     }
+    else if(event == ICO_SYC_EV_STATE_CHANGE) {
+        ico_syc_state_info_t *state_info = 
+            reinterpret_cast<ico_syc_state_info_t*>(const_cast<void*>(detail));
+
+        ICO_DBG("RECV: ICO_SYC_EV_STATE_CHANGE(id=%d state=%d)",
+                state_info->id, state_info->state);
+        if (ICO_SYC_STATE_REGULATION == state_info->id) {
+            // set regulation state
+            CicoHSSystemState::getInstance()->setRegulation(
+                (state_info->state == ICO_SYC_STATE_ON) ? true : false);
+            // regulation action
+            ico_syc_animation_t animation;
+            animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_SLIDE;
+            animation.time = ICO_HS_MENU_ANIMATION_DURATION;
+            hs_instance->menu_window->Hide(&animation);
+            hs_instance->ctl_bar_window->SetRegulation();
+        }
+        else if (ICO_SYC_STATE_NIGHTMODE == state_info->id) {
+            // set night mode state
+            CicoHSSystemState::getInstance()->setNightMode(
+                (state_info->state == ICO_SYC_STATE_ON) ? true : false);
+            // night mode action
+            hs_instance->ctl_bar_window->SetNightMode();
+            hs_instance->menu_window->SetNightMode();
+        }
+    }
+
     ICO_DBG("CicoHomeScreen::EventCallBack: end");
 }
 
@@ -1028,9 +1054,9 @@ CicoHomeScreen::ChangeMode(int pattern)
     if(hs_instance->GetMode() == ICO_HS_MODE_MENU){
         ico_syc_animation_t animation;
         if(pattern == ICO_HS_SHOW_HIDE_PATTERN_SLIDE){
-            animation.name = ICO_HS_MENU_HIDE_ANIMATION_SLIDE;
+            animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_SLIDE;
         }else{
-            animation.name = ICO_HS_MENU_HIDE_ANIMATION_FADE;
+            animation.name = (char*)ICO_HS_MENU_HIDE_ANIMATION_FADE;
         }
         animation.time = ICO_HS_MENU_ANIMATION_DURATION;
         hs_instance->menu_window->Hide(&animation);
@@ -1038,9 +1064,9 @@ CicoHomeScreen::ChangeMode(int pattern)
     }else if(hs_instance->GetMode() ==ICO_HS_MODE_APPLICATION){
         ico_syc_animation_t animation;
         if(pattern == ICO_HS_SHOW_HIDE_PATTERN_SLIDE){
-            animation.name = ICO_HS_MENU_SHOW_ANIMATION_SLIDE;
+            animation.name = (char*)ICO_HS_MENU_SHOW_ANIMATION_SLIDE;
         }else{
-            animation.name = ICO_HS_MENU_SHOW_ANIMATION_FADE;
+            animation.name = (char*)ICO_HS_MENU_SHOW_ANIMATION_FADE;
         }
         animation.time = ICO_HS_MENU_ANIMATION_DURATION;
         hs_instance->menu_window->Show(&animation);
@@ -1075,5 +1101,4 @@ CicoHomeScreen::TerminateApp(const char*appid)
 {
     hs_instance->TerminateApp_i(appid);
 }
-
-
+// vim: set expandtab ts=4 sw=4:
index f8f9aaa..4962888 100644 (file)
 #define ICO_HS_IMAGE_FILE_MENU_TERMINATE_NO "button_no.png"
 
 #define ICO_HS_IMAGE_FILE_CONTROL_BAR_BASE "ctrl.png"
-#define ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON "applist_off.png"
+#define ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_DAY    "applist_off.png"
+#define ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_DAY2   "applist_off_2.png"
+#define ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_NIHGT  "applist_on.png"
+#define ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON_NIHGT2 "applist_on_2.png"
 
 #define ICO_HS_LIFECYCLE_CONTROLLER_SETTING_PATH  "/usr/apps/org.tizen.ico.system-controller/res/config/system.xml"
 
index e93b991..bd04cf0 100644 (file)
@@ -9,7 +9,7 @@
 
 /*========================================================================*/    
 /**
- *  @file   ico_log.h
+ *  @file   CicoLog.h
  *
  *  @brief  debug log function
  */
@@ -17,7 +17,7 @@
 #ifndef __CICO_LOG_H__
 #define __CICO_LOG_H__
 
-#include "ico_log.h"
+#include <ico_log.h>
 
 #endif  // __CICO__LOG_H__
 /* vim:set expandtab ts=4 sw=4: */
index b35709f..c8c08cc 100644 (file)
@@ -200,7 +200,7 @@ CicoOnScreenAppList::SetAppIcons(Evas_Object* part,const char *partname)
         ICO_DBG("CicoOnScreenAppList::SetAppIcons: idx=%d appidx=%d",
                    idx, appidx);
         if ((appidx < 0) || (appidx > appconf->applicationNum)) {
-           control_window->EvasObjectDel(img);
+        control_window->EvasObjectDel(img);
             return;
         }
 
index 78cde86..d942ab7 100644 (file)
@@ -178,22 +178,27 @@ void CicoSCAilItems::setup(const char* pkg, const char* icon,
 {
     ICO_TRA("start");
     m_appid.assign(pkg);
+    ICO_DBG("package name=%s", pkg? pkg: "(NULL)");
 
     m_noIcon = ndisp;
     if (NULL != icon) {
         m_icon.assign(icon);
+        ICO_DBG("icon path=%s", icon? icon: "(NULL)");
     }
 
     if (NULL != nam) {
         m_name.assign(nam);
+        ICO_DBG("name=%s", nam? nam: "(NULL)");
     }
 
     if (NULL != exe) {
         m_execPath.assign(exe);
+        ICO_DBG("exec path=%s", exe? exe: "(NULL)");
     }
 
     if (NULL != typ) {
         m_type.assign(typ);
+        ICO_DBG("type=%s", typ? typ: "(NULL)");
     }
 
     categoryParse(categorys);
@@ -249,6 +254,8 @@ void CicoSCAilItems::categoryParse(const std::string categorys)
     inputDevName.clear();
     switchName.clear();
 
+    CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
+
     ICO_DBG("category def size = %d", x.size());
     for (it = x.begin(); it != x.end(); it++) {
 
@@ -391,6 +398,16 @@ void CicoSCAilItems::categoryParse(const std::string categorys)
                 continue;
             }
         }
+
+        int categoryID = CSCSC->getCategoryIdbyName(*it);
+        const char* ttt = it->c_str()? it->c_str(): "(NULL)";
+        ICO_DBG("Category %s->%d", ttt, categoryID);
+        if (-1 != categoryID) {
+            ICO_DBG("Category %d -> %d(%s)", m_categoryID, categoryID, ttt);
+            m_categoryID = categoryID;
+            continue;
+        }
+
         ICO_DBG("Parse UNKOWN %s", it->c_str());
     }
     categoryGetDisplay(displayName, layerName, dispZoneName);
index 1c58ab6..8b5a969 100644 (file)
@@ -338,5 +338,29 @@ public:
     int inputdev;
     int inputsw;
 };
+
+//==========================================================================
+/**
+ *  @brief  This class holds user information of system config
+ */
+//==========================================================================
+class CicoSCUserConf
+{
+public:
+    /// default constructor
+    CicoSCUserConf() :m_parent_dir("/home/app/ico") {}
+    /// destructor
+    virtual ~CicoSCUserConf() {}
+
+    /// dump log this class member variables
+    void dumpConf(void)
+    {
+        ICO_DBG("parent dir:%s", m_parent_dir.c_str());
+    }
+
+public:
+    std::string m_parent_dir;  ///< parent dir
+};
+
 #endif  // __CICO_SC_CONF_H__
 // vim:set expandtab ts=4 sw=4:
index 6b9e326..c607699 100644 (file)
@@ -132,10 +132,10 @@ CicoSCLifeCycleController::~CicoSCLifeCycleController()
 CicoSCLifeCycleController*
 CicoSCLifeCycleController::getInstance(void)
 {
-       if (NULL == ms_myInstance) {
-               ms_myInstance = new CicoSCLifeCycleController();
-       }
-       return ms_myInstance;
+    if (NULL == ms_myInstance) {
+        ms_myInstance = new CicoSCLifeCycleController();
+    }
+    return ms_myInstance;
 }
 
 /**
@@ -659,8 +659,8 @@ bool CicoSCLifeCycleController::createAilItems()
         m_gconf = g_key_file_new();
         GString* gsfp = g_string_new("xx");
         CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
-               g_string_printf(gsfp, "%s/%s", CSCSC->getDefaultConf()->confdir.c_str(),
-                                               ICO_SYC_CONFIG_APPATTR);
+        g_string_printf(gsfp, "%s/%s", CSCSC->getDefaultConf()->confdir.c_str(),
+                        ICO_SYC_CONFIG_APPATTR);
         GError  *gerr = NULL;
         int flg;
         flg = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS;
@@ -668,8 +668,8 @@ bool CicoSCLifeCycleController::createAilItems()
             ICO_ERR("load error conf:%s %s", (char*)gsfp->str, gerr->message);
             g_key_file_free(m_gconf);
             m_gconf = NULL;
-                       g_string_free(gsfp, TRUE);
-                       return false;
+            g_string_free(gsfp, TRUE);
+            return false;
         }
         g_string_free(gsfp, TRUE);
     }
index b6d7790..3f4adfc 100644 (file)
@@ -28,7 +28,7 @@ public:
     CicoSCLifeCycleController();
     ~CicoSCLifeCycleController();
 
-       static CicoSCLifeCycleController* getInstance(void);
+    static CicoSCLifeCycleController* getInstance(void);
 
     // Starting application
     int launch(const char* appid);
@@ -86,7 +86,7 @@ protected:
                 bool bndsp);
     bool removeAUL(int pid);
 private:
-       static CicoSCLifeCycleController* ms_myInstance;
+    static CicoSCLifeCycleController* ms_myInstance;
 
 protected:
     std::vector<CicoSCAilItems> m_ail;
index 94a9367..33ccd06 100644 (file)
@@ -68,6 +68,9 @@ CicoSCSystemConfig::CicoSCSystemConfig()
     m_privilegeTable["certificate"]    = ICO_PRIVILEGE_CERTIFICATE;
     m_privilegeTable["none"]           = ICO_PRIVILEGE_NONE;
     m_privilegeTable[""]               = ICO_PRIVILEGE_NONE;
+
+    m_userConf = NULL;
+
 }
 
 //--------------------------------------------------------------------------
@@ -120,6 +123,8 @@ CicoSCSystemConfig::load(const string & confFile)
     createDefaultConf(root);
     createLogConf(root);
 
+    createUserConf(root);
+
     return 0;   //TODO
 }
 
@@ -1490,4 +1495,28 @@ int main(int argc, char* argv[]) {
     return 0;
 }
 #endif
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  user config class object create
+ *
+ *  @param  [in]
+ */
+//--------------------------------------------------------------------------
+static const char* g_login_user_conf = "systemconfig.login_user";
+void
+CicoSCSystemConfig::createUserConf(const ptree & root)
+{
+    m_userConf = new CicoSCUserConf;
+    ptree rc = root.get_child(g_login_user_conf);
+    optional<string> opts = rc.get_optional<string>("parent_dir");
+    if (true == opts.is_initialized()) {
+        string v = opts.get();
+        if (v.empty()) {
+            m_userConf->m_parent_dir = v;
+        }
+    }
+    m_userConf->dumpConf();
+}
+
 // vim:set expandtab ts=4 sw=4:
index 870e402..2b4a3dd 100644 (file)
@@ -39,6 +39,7 @@ class CicoSCAppKindConf;
 class CicoSCSwitchConf;
 class CicoSCInputDevConf;
 class CicoSCDefaultConf;
+class CicoSCUserConf;
 
 class CicoSCSystemConfig 
 {
@@ -88,6 +89,10 @@ public:
     int getAppKindIdbyName(const string & name);
     int getCategoryIdbyName(const string & name);
 
+    const CicoSCUserConf* getUserConf() const 
+    {
+        return m_userConf;
+    };
 
 private:
     // default constructor
@@ -123,6 +128,8 @@ private:
 
     int calcGeometryExpr(const string & expr, CicoSCDisplayConf* conf);
 
+    void createUserConf(const ptree & root);
+
 private:
     static CicoSCSystemConfig* ms_myInstance;
     string m_confFile;
@@ -141,6 +148,7 @@ private:
     int m_loglevel;
     bool  m_logflush;
     CicoSCDefaultConf *m_defaultConf;
+    CicoSCUserConf *m_userConf;
 };
 #endif  // __CICO_SC_SYSTEM_CONFIG_H__
 // vim:set expandtab ts=4 sw=4:
index 15a2700..b864e2d 100644 (file)
@@ -9,26 +9,28 @@ noinst_PROGRAMS   = \
        StatusBar               
 
 HomeScreen_SOURCES = \
-       home_screen_main.cpp        \
-       ico_log.c        \
-       CicoSCAilItems.cpp        \
-       CicoSCAulItems.cpp        \
-       CicoSCSystemConfig.cpp        \
-       CicoSCLifeCycleController.cpp        \
-       CicoHSWindow.cpp        \
-       CicoHSWindowController.cpp        \
-       CicoHSMenuTouch.cpp        \
-       CicoHomeScreen.cpp        \
-    CicoHSMenuTile.cpp  \
-       CicoHSBackWindow.cpp \
-       CicoHSControlBarWindow.cpp \
-       CicoHSControlBarTouch.cpp \
-       CicoHSMenuWindow.cpp \
-       CicoHSAppInfo.cpp \
-       CicoHomeScreenConfig.cpp      \
+       home_screen_main.cpp    \
+       CicoSCAilItems.cpp      \
+       CicoSCAulItems.cpp      \
+       CicoSCSystemConfig.cpp  \
+       CicoSCLifeCycleController.cpp   \
+       CicoHSWindow.cpp        \
+       CicoHSWindowController.cpp      \
+       CicoHSMenuTouch.cpp     \
+       CicoHomeScreen.cpp      \
+       CicoHSMenuTile.cpp      \
+       CicoHSBackWindow.cpp    \
+       CicoHSControlBarWindow.cpp      \
+       CicoHSControlBarTouch.cpp       \
+       CicoHSMenuWindow.cpp    \
+       CicoHSAppInfo.cpp       \
+       CicoHomeScreenConfig.cpp        \
        CicoHomeScreenResourceConfig.cpp        \
        CicoHomeScreenSound.cpp \
-    CicoHomeScreenSoundConfig.cpp
+       CicoHomeScreenSoundConfig.cpp   \
+       CicoHSAppHistory.cpp \
+    CicoHSSystemState.cpp
+
 HomeScreen_CFLAGS= \
     $(EFL_CFLAGS) \
     $(OPT_CFLAGS) \
@@ -58,7 +60,7 @@ HomeScreen_LDADD = \
     $(UWS_LIBS) \
     $(AUL_LIBS) \
     $(AIL_LIBS) \
-    -lico-util-com \
+    -lico-util \
     -lico-uxf-weston-plugin \
     /usr/lib/libpkgmgr-client.so \
        ../../lib/apps-framework/.libs/libico-appfw.so
@@ -78,7 +80,6 @@ HomeScreen_LDADD = \
 
 StatusBar_SOURCES = \
        status_bar.cpp  \
-           ico_log.c        \
         CicoStatusBarControlWindow.cpp \
         CicoStatusBarTime.cpp \
        CicoHomeScreenConfig.cpp        \
@@ -117,3 +118,36 @@ BUILT_SOURCES = \
        edje_cc $< -id ../../res/org.tizen.ico.homescreen/res/images -fd ../../res/org.tizen.ico.homescreen/res/images -sd ../../res/org.tizen.ico.homescreen/res/sounds -o $@
 
 CLEANFILES = $(BUILT_SOURCES)
+
+install-exec-hook:
+       mkdir -p $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/bin
+       mkdir -p $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/var
+       mkdir -p $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/config
+       mkdir -p $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       mkdir -p $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/edj
+       mkdir -p $(INSTALL_ROOT)/usr/share/packages
+       install -m 0755 HomeScreen $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/bin
+       install -m 0644 home_screen_bg.edj $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/edj
+       install -m 0644 home_screen_touch.edj $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/edj
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/bg.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/ctrl.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/applist_off.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/applist_off_2.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/applist_on.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/applist_on_2.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/api_all_off.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/api_all_on.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/pagePointer_n.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/pagePointer_p.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/button_really.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/button_no.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/button_yes.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/termIcon.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/images/tizen_32.png $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/images
+       install -m 0644 $(top_srcdir)/data/share/packages/org.tizen.ico.homescreen.xml $(INSTALL_ROOT)/usr/share/packages
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.homescreen/res/config/* $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen/res/config
+       cp -r $(top_srcdir)/data/apps/org.tizen.ico.homescreen $(INSTALL_ROOT)/usr/apps/
+
+uninstall:
+       rm -rf $(INSTALL_ROOT)/usr/apps/org.tizen.ico.homescreen
+       rm -f $(INSTALL_ROOT)/usr/share/packages/org.tizen.ico.homescreen
index 4225ca5..d5113dd 100644 (file)
  * @date    Feb-15-2013
  */
 
-
+#include <fstream>
+#include <string>
+#include <iostream>
+#include <cstdio>
+#include <bundle.h>
+#include <aul/aul.h>
 #include <home_screen_main.h>
+#include <cerrno>
 #include "CicoHomeScreenConfig.h"
+#include "ico_syc_public.h"
+#include "CicoSCConf.h"
+#include "CicoSCSystemConfig.h"
+
+using namespace std;
+
+string g_login_user_name;
+
+bool launchApps(const string& filepath);
 
 /*--------------------------------------------------------------------------*/
 /**
@@ -38,11 +53,34 @@ main(int argc, char *argv[])
 
     ico_log_open("HomeScreen");
 
+
     /* init configuration */
     ICO_DBG("main: config initialize start");
     CicoHomeScreenConfig *config = new CicoHomeScreenConfig();
     config->Initialize(ICO_HOMESCREEN_CONFIG_FILE);
     ICO_DBG("main: config initialize end");
+
+    /* PARAM GET LOGIN USER */
+    bundle *b = bundle_import_from_argv(argc, argv); // import from argc+argv
+    const char* valusr = bundle_get_val(b, ICO_SYC_APP_BUNDLE_KEY1);
+    const char* valpath = bundle_get_val(b, ICO_SYC_APP_BUNDLE_KEY2);
+    if ((NULL != valusr) && (0 != valusr)) {
+        g_login_user_name = valusr;
+    }
+    else {
+        g_login_user_name.clear();
+    }
+    string user_start_apps_path;
+    if ((NULL != valpath) && (0 != valpath)) {
+        user_start_apps_path = valpath;
+    }
+    else {
+        user_start_apps_path.clear();
+    }
+    ICO_DBG("PARAM=\"%s\", \"%s\"", g_login_user_name.c_str(),
+            user_start_apps_path.c_str());
+    bundle_free(b);
+    valusr = valpath = NULL;
     
     /* init home screen soud */
     ICO_DBG("main: sound initialize start");
@@ -66,7 +104,7 @@ main(int argc, char *argv[])
     ICO_DBG("main: homescreen initialize end");
 
     ICO_DBG("main: create homescreen ");
-    
+    launchApps(user_start_apps_path);
     /*home screen start and go into main loop*/
     home_screen->StartHomeScreen();
   
@@ -85,3 +123,40 @@ main(int argc, char *argv[])
 
     return 0;
 }
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   launch applications
+ *
+ * @param   filepath  start applications list file path
+ * @return  bool
+ * @retval  true  success
+ * @retval  false fail
+ */
+/*--------------------------------------------------------------------------*/
+bool launchApps(const string& filepath)
+{
+    ICO_DBG("launcApps start = %s", filepath.c_str());
+    struct stat stat_buf;
+    if (0 != stat(filepath.c_str(), &stat_buf)) {
+        ICO_DBG("launcApps end false(%d, %s)", errno, filepath.c_str());
+        return false;
+    }
+    int i = 0;
+    bool rb = false;
+    string tagApp;
+    ifstream ifs(filepath.c_str());
+    while(ifs >> tagApp) {
+        i++;
+        if (true == tagApp.empty()) {
+            continue;
+        }
+        int r = aul_launch_app(tagApp.c_str(), NULL);
+        ICO_DBG("aul_launch_app %d:appid(%s), r(%d)", i, tagApp.c_str(), r);
+        if (AUL_R_OK == r) {
+            rb = true;
+        }
+    }
+    ICO_DBG("launcApps end %s", rb? "true": "false");
+    return rb;
+}
diff --git a/src/homescreen/ico_log.c b/src/homescreen/ico_log.c
deleted file mode 100644 (file)
index fad8324..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-
-/*------------------------------------------------------------------------*/
-/**
- *  @file   ico_log.c
- *
- *  @brief  
- */
-/*------------------------------------------------------------------------*/
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <time.h>
-#include "ico_log.h"
-
-/*========================================================================*/
-/**
- *  static variable
- */
-/*========================================================================*/
-
-int  time_zone    = 99*60*60;   /*!< local time difference(sec)           */
-int  log_level    = 0x7FFFFFFF; /*!< output level debug log               */
-bool flush_mode   = true;       /*!< flush mode flag                      */  
-bool initialized  = false;      /*!< initialized flag                     */
-FILE *log_fd      = NULL;       /*!< file descriptor of output debug log  */
-int  log_lines    = 0;          /*!< output lines                         */
-char log_prog[32] = {0,};       /*!< name of output source module         */
-
-                                                                            
-/*------------------------------------------------------------------------*/
-/**
- *  @brief  printout log message
- *
- *  @param [in] level   log output level
- *  @param [in] fmt     message format(same as printf)
- *  @param [in] ...     arguments if need
- */
-/*------------------------------------------------------------------------*/
-void
-ico_log_print(int level, const char *fmt, ...)
-{
-    if (log_level < level) {
-        return;
-    }
-    va_list     list;
-
-    if (NULL == log_fd) {
-        ico_log_open(NULL);
-    }
-#if ICO_APF_LOG_STDOUT == 0
-    else if (log_lines >= (ICO_LOG_MAXLINES-2)) {
-        if (log_lines >= ICO_LOG_MAXLINES)  {
-            ico_log_close();
-            ico_log_open(log_prog);
-        }
-        else    {
-            fflush(log_fd);
-        }
-    }
-#endif /*ICO_APF_LOG_STDOUT*/
-    if (NULL != log_fd) {
-        va_start(list, fmt);
-        vfprintf(log_fd, fmt, list);
-        va_end(list);
-        if (flush_mode)  {
-            fflush(log_fd);
-        }
-    }
-    if (log_fd != stdout)   {
-        log_lines ++;
-    }
-}
-
-/*------------------------------------------------------------------------*/
-/**
- *  @brief  open log file
- *
- *  @param [in] prog    program name
- */
-/*------------------------------------------------------------------------*/
-void
-ico_log_open(const char *prog)
-{
-#if ICO_LOG_STDOUT == 0
-    int     idx;
-    char    sPath[128];
-    char    sPath2[128];
-#endif /*ICO_LOG_STDOUT*/
-
-    if (NULL != log_fd) {
-        fflush(log_fd);
-        if (log_fd != stdout)   {
-            fclose(log_fd);
-        }
-    }
-
-    log_lines = 0;
-
-    if ((! prog) || (*prog == 0)) {
-        log_fd = stdout;
-        log_prog[0] = 0;
-        return;
-    }
-    else {
-        strncpy(log_prog, prog, sizeof(log_prog)-1);
-        log_prog[sizeof(log_prog)-1] = 0;
-    }
-#if ICO_LOG_STDOUT > 0
-    log_fd = stdout;
-#else  /*ICO_LOG_STDOUT*/
-    snprintf(sPath, sizeof(sPath)-1, "%s/%s.log%d",
-             ICO_LOG_DIR, log_prog, ICO_LOG_MAXFILES-1);
-    (void)remove(sPath);
-
-    for (idx = (ICO_LOG_MAXFILES-1); idx > 0; idx--) {
-        strcpy(sPath2, sPath);
-        if (idx > 1)    {
-            snprintf(sPath, sizeof(sPath)-1, "%s/%s.log%d",
-                     ICO_LOG_DIR, log_prog, idx-1);
-        }
-        else    {
-            snprintf(sPath, sizeof(sPath)-1, "%s/%s.log",
-                     ICO_LOG_DIR, log_prog);
-        }
-        (void)rename(sPath, sPath2);
-    }
-
-    log_fd = fopen(sPath, "w");
-    if (NULL == log_fd) {
-        log_fd = stdout;
-    }
-    else if ((initialized == false) &&
-             (log_fd != stdout) && (log_fd != stderr)) {
-        initialized = true;
-        fflush(stdout);
-        fflush(stderr);
-        stdout = log_fd;
-        stderr = log_fd;
-    }
-#endif /*ICO_LOG_STDOUT*/
-}
-
-/*------------------------------------------------------------------------*/
-/**
- *  @brief  close log file
- */
-/*------------------------------------------------------------------------*/
-void
-ico_log_close(void)
-{
-#if ICO_LOG_STDOUT == 0
-    if (NULL != log_fd) {
-        fflush(log_fd);
-        if (log_fd != stdout) {
-            fclose(log_fd);
-        }
-        log_fd = (FILE *)NULL;
-    }
-#endif /*ICO_LOG_STDOUT*/
-}
-
-/*------------------------------------------------------------------------*/
-/**
- *  @brief  flush log file
- */
-/*------------------------------------------------------------------------*/
-void
-ico_log_flush(void)
-{
-    if ((NULL != log_fd) && (false == flush_mode)) {
-        fflush(log_fd);
-    }
-}
-
-/*------------------------------------------------------------------------*/
-/**
- *  @brief   get current time string
- *
- *  @param [in] level   log level string(header of log message)
- *  @return current time string
- */
-/*------------------------------------------------------------------------*/
-char *
-ico_get_str_cur_time(const char *level)
-{
-    struct timeval  NowTime;
-    extern long     timezone;
-    static char     sBuf[28];
-
-    gettimeofday(&NowTime, (struct timezone *)0);
-    if (time_zone > (24*60*60)) {
-        tzset();
-        time_zone = timezone;
-    }
-    NowTime.tv_sec -= time_zone;
-
-    sprintf(sBuf, "%02d:%02d:%02d.%03d[%s]@%d",
-            (int)((NowTime.tv_sec/3600) % 24),
-            (int)((NowTime.tv_sec/60) % 60),
-            (int)(NowTime.tv_sec % 60),
-            (int)NowTime.tv_usec/1000, level, getpid());
-
-    return sBuf;
-}
-
-/*------------------------------------------------------------------------*/
-/**
- *  @brief  set log output level
- *
- *  @param [in] level   log output level
- */
-/*------------------------------------------------------------------------*/
-void
-ico_log_set_level(int level)
-{
-    log_level = level & (~(ICO_LOG_FLUSH|ICO_LOG_NOFLUSH));
-
-    if (log_level & (ICO_LOG_FLUSH|ICO_LOG_NOFLUSH)) {
-        if (log_level & ICO_LOG_FLUSH) {
-            flush_mode = true;
-        }
-        else    {
-            flush_mode = false;
-        }
-    }
-}
-/* vim:set expandtab ts=4 sw=4: */
diff --git a/src/homescreen/ico_log.h b/src/homescreen/ico_log.h
deleted file mode 100644 (file)
index 3b5e224..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-
-/*========================================================================*/    
-/**
- *  @file   ico_log.h
- *
- *  @brief  debug log function
- */
-/*========================================================================*/    
-#ifndef __ICO_LOG_H__
-#define __ICO_LOG_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef ICO_LOG_STDOUT
-#define ICO_LOG_STDOUT      0
-                            /**!< Log output to stdout(=1) or file(=0) */
-#endif /*ICO_APF_LOG_STDOUT*/
-
-#define ICO_LOG_DIR         "/var/log/ico"
-                           /**!< Directory name of Log destination */
-
-/* Maximum lines/files */
-#define ICO_LOG_MAXLINES    10000
-                            /**!< Maximum output lines of log file  */
-#define ICO_LOG_MAXFILES    6
-                            /**!< Maximum number of the log file    */
-
-/* Log output level */
-#define ICO_LOG_DEBUG       0x0080  /**!< Debug write */
-#define ICO_LOG_INFO        0x0040  /**!< Information */
-#define ICO_LOG_WARNING     0x0010  /**!< Warning     */
-#define ICO_LOG_CRITICAL    0x0008  /**!< Critical    */
-#define ICO_LOG_ERROR       0x0004  /**!< Error       */
-
-/* Log output flush */
-#define ICO_LOG_FLUSH       0x4000  /**!< Log outout with log flush     */
-#define ICO_LOG_NOFLUSH     0x2000  /**!< Log output without log flush  */
-
-#define ICO_TRA(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_DEBUG,                \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("DBG"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-#define ICO_DBG(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_DEBUG,                \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("DBG"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-#define ICO_INF(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_INFO,                 \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("INF"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-#define ICO_WRN(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_WARNING,              \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("WRN"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-#define ICO_CRI(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_CRITICAL,             \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("CRI"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-#define ICO_ERR(fmt,...)                        \
-{                                               \
-    ico_log_print(ICO_LOG_ERROR,                \
-                  "%s> " fmt " (%s,%s:%d)\n",   \
-                  ico_get_str_cur_time("ERR"),  \
-                  ##__VA_ARGS__,                \
-                  __func__,                     \
-                  __FILE__,                     \
-                  __LINE__);                    \
-}
-
-
-void ico_log_print(int level, const char *fmt, ...);
-void ico_log_open(const char *prog);
-void ico_log_close(void);
-void ico_log_flush(void);
-char * ico_get_str_cur_time(const char *level);
-void ico_log_set_level(int level);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // __ICO__LOG_H__
-/* vim:set expandtab ts=4 sw=4: */
index b3802a5..7b43b2f 100644 (file)
@@ -62,8 +62,10 @@ CicoSysConDaemon::onCreate(void *user_data)
             CicoSCLifeCycleController::getInstance();
         CicoSCWindowController *winctrl     = new CicoSCWindowController();
         CicoSCInputController  *inputctrl   = new CicoSCInputController();
-        CicoSCResourceManager  *resourcemgr = new CicoSCResourceManager();
 
+        CicoSCResourceManager  *resourcemgr = new CicoSCResourceManager();
+        resourcemgr->setWindowController(winctrl);
+        resourcemgr->setInputController(inputctrl);
         ret = resourcemgr->initialize();
         if (ICO_SYC_EOK != ret) {
             return false;
index ded2be7..c532725 100644 (file)
@@ -26,31 +26,34 @@ IcoSysconDaemon_CPPFLAGS =  \
        @MURPHYDOMAINCONTROLLER_CFLAGS@         \
        @MURPHYECORE_CFLAGS@                            \
        @MURPHYRESOURCE_CFLAGS@                         \
-       -I/usr/include/ico-util                         \
-       -I/usr/include/ico-uxf-weston-plugin \
+       $(UWS_CFLAGS)                                           \
+       $(WESTONPLUGIN_CFLAGS)                          \
+       -I../../include                                         \
     -I../../lib/system-controller
 
-IcoSysconDaemon_LDADD =                        \
+
+IcoSysconDaemon_LDADD = \
        ../../lib/system-controller/.libs/libico-system-controller.a    \
-       ../../lib/misc/state-machine/.libs/libico-state-machine.so      \
-       @ECORE_LIBS@                            \
-       @EINA_LIBS@                                     \
-       @GLIB_LIBS@                                     \
-       @AIL_LIBS@                                      \
-       @BUNDLE_LIBS@                           \
-       @AUL_LIBS@                                      \
-       @PKGMGR_LIBS@                           \
-       @WAYLANDCLIENT_LIBS@            \
-       @CAPIAPPFWAPPLICATION_LIBS@ \
-       @JSONGLIB_LIBS@                         \
-       @MURPHYCOMMON_LIBS@                     \
-       @MURPHYDOMAINCONTROLLER_LIBS@           \
-       @MURPHYECORE_LIBS@                                      \
-       @MURPHYRESOURCE_LIBS@                           \
-       -L/usr/lib                                      \
-       -lmurphy-resolver                       \
-       -lico-uxf-weston-plugin         \
-       -lico-util-com                          
+       ../../lib/misc/state-machine/.libs/libico-state-machine.a               \
+       @ECORE_LIBS@                                    \
+       @EINA_LIBS@                                             \
+       @GLIB_LIBS@                                             \
+       @AIL_LIBS@                                              \
+       @BUNDLE_LIBS@                                   \
+       @AUL_LIBS@                                              \
+       @PKGMGR_LIBS@                                   \
+       @WAYLANDCLIENT_LIBS@                    \
+       @CAPIAPPFWAPPLICATION_LIBS@     \
+       @JSONGLIB_LIBS@                                 \
+       @MURPHYCOMMON_LIBS@                             \
+       @MURPHYDOMAINCONTROLLER_LIBS@   \
+       @MURPHYECORE_LIBS@                              \
+       @MURPHYRESOURCE_LIBS@                   \
+       $(UWS_LIBS)                                             \
+       $(WESTONPLUGIN_LIBS)                    \
+       ../../lib/misc/state-machine/.libs/libico-state-machine.so
+
+#      -lmurphy-resolver
 
 CLEANFILES = $(BUILT_SOURCES)
 
@@ -60,16 +63,19 @@ install-exec-hook:
        mkdir -p $(INSTALL_ROOT)/usr/share/packages
        mkdir -p $(INSTALL_ROOT)/usr/lib/systemd/user
        mkdir -p $(INSTALL_ROOT)/usr/lib/systemd/user/weston.target.wants
+       mkdir -p $(INSTALL_ROOT)/home/app/ico
        install -m 0755 IcoSysconDaemon $(INSTALL_ROOT)/usr/apps/org.tizen.ico.system-controller/bin
        install -m 0644 ../../data/share/packages/org.tizen.ico.system-controller.xml $(INSTALL_ROOT)/usr/share/packages
-
        install -m 0644 $(top_srcdir)/res/org.tizen.ico.system-controller/res/config/* $(INSTALL_ROOT)/usr/apps/org.tizen.ico.system-controller/res/config
+       install -d -m 0744 app $(INSTALL_ROOT)/home/app/ico
+       install -m 0644 $(top_srcdir)/res/org.tizen.ico.system-controller/res/ico/* $(INSTALL_ROOT)/home/app/ico
+       chown -fHR app $(INSTALL_ROOT)/home/app; set $?=0
+       chgrp -fHR app $(INSTALL_ROOT)/home/app; set $?=0
        install -m 0644 $(top_srcdir)/data/lib/systemd/user/ico-uxf-wait-launchpad-ready.path $(INSTALL_ROOT)/usr/lib/systemd/user
        install -m 0644 $(top_srcdir)/data/lib/systemd/user/ico-system-controller.service $(INSTALL_ROOT)/usr/lib/systemd/user
        ln -sf ../ico-uxf-wait-launchpad-ready.path $(INSTALL_ROOT)/usr/lib/systemd/user/weston.target.wants
 
-
-
 uninstall:
        rm -rf $(INSTALL_ROOT)/usr/apps/org.tizen.ico.system-controller
        rm -f $(INSTALL_ROOT)/usr/share/packages/org.tizen.ico.system-controller.xml
+       rm -rf $(INSTALL_ROOT)/home/app/ico
index 356d3e1..a0ab72a 100644 (file)
@@ -1,3 +1,2 @@
 SUBDIRS=\
-   apps-framework   \
-   test-dummy-hs
+   apps-framework
index 4a86a3e..d9e1156 100755 (executable)
@@ -23,18 +23,18 @@ app_dir="/opt/usr/apps/test.ico.res.app"
 # Initialize
 #
 ########################
+cd ../../../
+curpath=`pwd`;
+export LD_LIBRARY_PATH=$curpath/lib/apps-framework/.libs:$LD_LIBRARY_PATH
+#/usr/bin/launchpad_preloading_preinitializing_daemon &
+cd ./tests/system-controller/apps-framework/
+
 # set library path & reboot launchpad
 pids=(`ps -ef | grep launchpad | grep -v grep | awk '{ print $2 }'`)
 for pid in ${pids[*]}
 do
        kill -9 ${pid}
 done
-cd ../../
-curpath=`pwd`;
-export LD_LIBRARY_PATH=$curpath/src/apps-framework/.libs:$LD_LIBRARY_PATH
-/usr/bin/launchpad_preloading_preinitializing_daemon &
-
-cd ./test/apps-framework/
 
 # setting for appresctl test
 cp ./data/* /opt/share/applications
index bf0c43f..1d93cf1 100644 (file)
@@ -104,13 +104,21 @@ static void
 _check_input_region(const char *ev_name, ico_syc_input_region_t *region)
 {
     printf("--- %s\n", ev_name);
-    printf("\t(surface[%d], (x,y)[%d, %d], width[%d], height[%d])\n",
-           region->surface, region->pos_x, region->pos_y,
-           region->width, region->height);
-
-    if (region->surface == TST_SURFACE
+    printf("\t(winname[%s], (x,y)[%d, %d], width[%d], height[%d], hot[%d,%d], "
+           "cursor[%d.%d-%d,%d], attr[%d])\n",
+           region->winname, region->pos_x, region->pos_y,
+           region->width, region->height, region->hotspot_x, region->hotspot_y,
+           region->cursor_x, region->cursor_y, region->cursor_width,
+           region->cursor_height, region->attr);
+
+    if ((strcmp(region->winname, TST_WIN_NAME) == 0)
         && region->pos_x == TST_POS_X && region->pos_y == TST_POS_Y
-        && region->width == TST_REG_WIDTH && region->height == TST_REG_HEIGHT) {
+        && region->width == TST_REG_WIDTH && region->height == TST_REG_HEIGHT
+        && region->hotspot_x == TST_REG_HOT_X && region->hotspot_y == TST_REG_HOT_Y
+        && region->cursor_x == TST_REG_CUR_X && region->cursor_y == TST_REG_CUR_Y
+        && region->cursor_width == TST_REG_CUR_WIDTH
+        && region->cursor_height == TST_REG_CUR_HEIGHT
+        && region->attr == TST_REG_ATTR)    {
         print_ok("callback (%s)", ev_name);
     }
     else {
@@ -257,11 +265,18 @@ Eina_Bool ico_syc_appresctl_test(void *data)
     input.name          = "input C";
     input.event         = 100;
     /* set input region info */
-    region.surface      = 123;
+    strcpy(region.winname, TST_WIN_NAME);
     region.pos_x        = 10;
     region.pos_y        = 10;
     region.width        = 200;
     region.height       = 100;
+    region.hotspot_x    = 28;
+    region.hotspot_y    = 16;
+    region.cursor_x     = 35;
+    region.cursor_y     = 25;
+    region.cursor_width = 150;
+    region.cursor_height= 80;
+    region.attr         = 98765432;
 
     /* acquire window/sound/input */
     tst_acquire_res((const ico_syc_res_window_t *)&window,
index c6ee7f9..0f6e4bb 100644 (file)
@@ -66,11 +66,20 @@ extern "C" {
 #define TST_RES_TYPE    0
 #define TST_REG_WIDTH   200
 #define TST_REG_HEIGHT  100
+#define TST_REG_HOT_X   120
+#define TST_REG_HOT_Y   80
+#define TST_REG_CUR_X   40
+#define TST_REG_CUR_Y   30
+#define TST_REG_CUR_WIDTH  160
+#define TST_REG_CUR_HEIGHT 100
+#define TST_REG_ATTR    12345678
 
 #define TST_USER_A      (char *)"user A"
 #define TST_USER_B      (char *)"User B"
 #define TST_USER_C      (char *)"user c"
 
+#define TST_LASTINFO    (char *)"{\"page\": \"last page\", \"time\": 5}"
+
 #ifdef __cplusplus
 }
 #endif
index 2f85f4c..2ffc767 100644 (file)
@@ -334,6 +334,7 @@ _create_userctl_msg(int cmd)
     json_object_set_array_member(argobj, MSG_PRMKEY_USER_LIST, array);
 
     json_object_set_string_member(argobj, MSG_PRMKEY_USER_LOGIN, TST_USER_A);
+    json_object_set_string_member(argobj, MSG_PRMKEY_LASTINFO, TST_LASTINFO);
 
     json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
 
@@ -431,6 +432,13 @@ _create_resctl_region_msg(int cmd)
     json_object_set_int_member(resobj, MSG_PRMKEY_RES_POS_Y, TST_POS_Y);
     json_object_set_int_member(resobj, MSG_PRMKEY_RES_WIDTH, TST_REG_WIDTH);
     json_object_set_int_member(resobj, MSG_PRMKEY_RES_HEIGHT, TST_REG_HEIGHT);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_HOT_X, TST_REG_HOT_X);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_HOT_Y, TST_REG_HOT_Y);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_CUR_X, TST_REG_CUR_X);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_CUR_Y, TST_REG_CUR_Y);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_CUR_WIDTH, TST_REG_CUR_WIDTH);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_CUR_HEIGHT, TST_REG_CUR_HEIGHT);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_ATTR, TST_REG_ATTR);
 
     /* set object */
     json_object_set_object_member(obj, MSG_PRMKEY_REGION, resobj);
@@ -476,7 +484,6 @@ _create_msg(const void *data, size_t len)
     case MSG_CMD_CHANGE_LAYER:
         gen = _create_winctl_attr_msg(MSG_CMD_CHANGE_ATTR, "change layer");
         break;
-    case MSG_CMD_PREPARE_THUMB:
     case MSG_CMD_MAP_THUMB:
     case MSG_CMD_UNMAP_THUMB:
         gen = _create_winctl_msg(cmd);
index d7cb237..9d33767 100644 (file)
@@ -9,7 +9,7 @@
 /**
  * @brief   test suite for User Control API
  *
- * @date    Aug-6-2013
+ * @date    Sep-5-2013
  */
 
 #include <stdio.h>
@@ -37,6 +37,8 @@ static void _syc_callback(const ico_syc_ev_e event,
                           const void *detail, void *user_data);
 static void tst_change_user(void);
 static void tst_get_userlist(void);
+static void tst_get_lastinfo(void);
+static void tst_set_lastinfo(void);
 static Eina_Bool  ico_syc_userctl_test(void *data);
 
 /* ----------------------------------------------- */
@@ -94,6 +96,15 @@ _syc_callback(const ico_syc_ev_e event,
             print_ng("callback (ICO_SYC_EV_AUTH_FAIL)");
         }
         break;
+    case ICO_SYC_EV_LASTINFO:
+        printf("--- lastinfo: %s\n", (char *)detail);
+        if (strcmp((char *)detail, TST_LASTINFO) == 0) {
+            print_ok("callback (ICO_SYC_EV_LASTINFO)");
+        }
+        else {
+            print_ng("callback (ICO_SYC_EV_LASTINFO)");
+        }
+        break;
     default:
         break;
     }
@@ -121,20 +132,45 @@ tst_get_userlist(void)
     return;
 }
 
+/* test get lastinfo */
+static void
+tst_get_lastinfo(void)
+{
+    (void)ico_syc_get_lastinfo();
+    print_ok("(void)ico_syc_get_lastinfo");
+
+    return;
+}
+
+/* test set lastinfo */
+static void
+tst_set_lastinfo(void)
+{
+    (void)ico_syc_set_lastinfo(TST_LASTINFO);
+    print_ok("(void)ico_syc_set_lastinfo");
+
+    return;
+}
+
 /* test main */
 static Eina_Bool 
 ico_syc_userctl_test(void *data)
 {
-    printf("##### ico_syc_userctl API Test Start #####\n");
     printf("\n");
+    printf("##### ico_syc_userctl API Test Start #####\n");
 
     tst_change_user();
+    usleep(5000);
     tst_get_userlist();
+    usleep(5000);
+    tst_set_lastinfo();
+    usleep(5000);
+    tst_get_lastinfo();
 
     printf("##### ico_syc_userctl API Test End #####\n");
     printf("\n");
 
-    return 1;
+    return ECORE_CALLBACK_CANCEL;
 }
 
 /* ------------------------ */
index 6cf8c5b..1bf05f3 100644 (file)
@@ -51,8 +51,7 @@ static void tst_move(const char *appid, int surface,
 static void tst_change_active(const char *appid, int surface);
 static void tst_change_layer(const char *appid, int surface, int layer);
 /* thumbnail */
-static void tst_prepare_thumb(int surface, int framerate);
-static void tst_map_thumb(int surface);
+static void tst_map_thumb(int surface, int framerate);
 static void tst_unmap_thumb(int surface);
 /* layer */
 static void tst_show_layer(int layer);
@@ -181,8 +180,8 @@ _syc_callback(const ico_syc_ev_e event,
         _check_win_attr("ICO_SYC_EV_WIN_ATTR_CHANGE",
                         (ico_syc_win_attr_t *)detail);
         break;
-    case ICO_SYC_EV_THUMB_PREPARE:
-        _check_thumb_info("ICO_SYC_EV_THUMB_PREPARE",
+    case ICO_SYC_EV_THUMB_ERROR:
+        _check_thumb_info("ICO_SYC_EV_THUMB_ERROR",
                           (ico_syc_thumb_info_t *)detail);
         break;
     case ICO_SYC_EV_THUMB_CHANGE:
@@ -291,14 +290,14 @@ tst_change_layer(const char *appid, int surface, int layer)
     return;
 }
 
-/* test prepare thumbnail */
+/* test map thumbnail */
 static void
-tst_prepare_thumb(int surface, int framerate)
+tst_map_thumb(int surface, int framerate)
 {
     int ret;
-    char *func = "ico_syc_prepare_thumb";
+    char *func = "ico_syc_map_thumb";
 
-    ret = ico_syc_prepare_thumb(surface, framerate);
+    ret = ico_syc_map_thumb(surface, framerate);
     if (ret != 0) {
         print_ng("%s (ret: %d)", func, ret);
         return;
@@ -308,24 +307,6 @@ tst_prepare_thumb(int surface, int framerate)
     return;
 }
 
-/* test map thumbnail */
-static void
-tst_map_thumb(int surface)
-{
-    ico_syc_thumb_data_t *ret = NULL;
-    char *func = "ico_syc_map_thumb";
-
-    ret = ico_syc_map_thumb(surface);
-    if (ret == NULL) {
-        print_ng("%s (return is NULL)", func);
-        return;
-    } 
-    print_ok("%s", func);
-    free(ret);
-
-    return;
-}
-
 /* test unmap thumbnail */
 static void
 tst_unmap_thumb(int surface)
@@ -423,9 +404,7 @@ ico_syc_winctl_test(void *data)
     sleep(1);
 
     /* thumbnail */
-    tst_prepare_thumb(surface, 200);
-    usleep(5000);
-    tst_map_thumb(surface);
+    tst_map_thumb(surface, 200);
     usleep(5000);
     tst_unmap_thumb(surface);
 
index 4e51269..458d64d 100644 (file)
@@ -143,10 +143,10 @@ CicoLog::openLog(const char *prog)
     else if ((m_initialized == false) &&
              (m_sDbgFd != stdout) && (m_sDbgFd != stderr))  {
         m_initialized = true;
-        fflush(stdout);
-        fflush(stderr);
-        stdout = m_sDbgFd;
-        stderr = m_sDbgFd;
+        //fflush(stdout);
+        //fflush(stderr);
+        //stdout = m_sDbgFd;
+        //stderr = m_sDbgFd;
     }
 #endif /*ICO_LOG_STDOUT*/
 }
index ecc2aa7..62cae57 100644 (file)
@@ -19,6 +19,9 @@
 #include <iostream>
 #include <string>
 
+#include <stdlib.h>
+#include <stdio.h>
+
 #include "CicoUISample.h"
 #include "CicoBaseWin.h"
 #include "CicoGeometry.h"
@@ -31,6 +34,7 @@
 
 CicoBackground* _background = NULL;
 CicoBackground* _controlbar = NULL;
+bool backgroundShow = false;
 extern "C" {
 static void
 _syc_callback(const ico_syc_ev_e event,
@@ -45,25 +49,30 @@ _syc_callback(const ico_syc_ev_e event,
                ((ico_syc_win_info_t *)detail)->name,
                ((ico_syc_win_info_t *)detail)->surface);
 
-               ico_syc_win_info_t *info = (ico_syc_win_info_t *)detail;
-               if (0 == strcmp(info->name, "HSBackground")) {
-                       ico_syc_change_layer(info->appid, info->surface, 0);
-                       ico_syc_show(info->appid, info->surface, NULL);
-                       ico_syc_win_move_t win_move = {NULL, 0, 64, 1080, 1920-64-128};
-               ico_syc_move(info->appid, info->surface, &win_move, NULL);
-
-            ico_syc_prepare_thumb(info->surface, 0);
-               }
-               if (0 == strcmp(info->name, "HSControllBar")) {
-                       ico_syc_change_layer(info->appid, info->surface, 1);
-                       ico_syc_show(info->appid, info->surface, NULL);
-                       ico_syc_win_move_t win_move = {NULL, 0, 1920-128, 1080, 128};
-               ico_syc_move(info->appid, info->surface, &win_move, NULL);
-
-                       ico_syc_change_layer(info->appid, info->surface, 0);
-                       ico_syc_win_move_t win_move2 = {NULL, 0, 128, 1080, 512};
-               ico_syc_move(info->appid, info->surface, &win_move2, NULL);
-               }
+        ico_syc_win_info_t *info = (ico_syc_win_info_t *)detail;
+        if (0 == strcmp(info->name, "HSBackground")) {
+            if (backgroundShow == true) {
+                break;
+            }
+            ico_syc_change_layer(info->appid, info->surface, 0);
+            ico_syc_animation_t animation = {"fade", 500};
+            ico_syc_win_move_t win_move = {NULL, 0, 64, 300, 300};
+            ico_syc_move(info->appid, info->surface, &win_move, &animation);
+            ico_syc_show(info->appid, info->surface, &animation);
+
+            ico_syc_map_thumb(info->surface, 0);
+            backgroundShow = true;
+        }
+        if (0 == strcmp(info->name, "HSControllBar")) {
+            ico_syc_change_layer(info->appid, info->surface, 1);
+            ico_syc_show(info->appid, info->surface, NULL);
+            ico_syc_win_move_t win_move = {NULL, 0, 1920-128, 1080, 128};
+            ico_syc_move(info->appid, info->surface, &win_move, NULL);
+
+            ico_syc_change_layer(info->appid, info->surface, 0);
+            ico_syc_win_move_t win_move2 = {NULL, 0, 128, 1080, 512};
+            ico_syc_move(info->appid, info->surface, &win_move2, NULL);
+        }
 
         break;
     }
@@ -82,6 +91,7 @@ _syc_callback(const ico_syc_ev_e event,
                ((ico_syc_win_info_t *)detail)->surface);
         break;
     case ICO_SYC_EV_WIN_ATTR_CHANGE:
+    {
         ICO_DBG("--- ICO_SYC_EV_WIN_ATTR_CHANGE"
                 "(appid[%s], name[%s], surface[%d], node[%d], layer[%d], "
                 "(x,y)[%d, %d], width[%d], height[%d], raise[%d], visible[%d], active[%d])",
@@ -97,23 +107,37 @@ _syc_callback(const ico_syc_ev_e event,
                ((ico_syc_win_attr_t *)detail)->raise,
                ((ico_syc_win_attr_t *)detail)->visible,
                ((ico_syc_win_attr_t *)detail)->active);
+
+        ico_syc_win_attr_t *info = (ico_syc_win_attr_t *)detail;
+        if (0 == strcmp(info->name, "HSBackground")) {
+            if (backgroundShow == true) {
+                break;
+            }
+            ico_syc_change_layer(info->appid, info->surface, 1);
+            ico_syc_show_layer(1);
+            ico_syc_animation_t animation = {"fade", 500};
+            ico_syc_show(info->appid, info->surface, &animation);
+            ico_syc_win_move_t win_move = {NULL, 100, 64, 300, 300};
+            ico_syc_move(info->appid, info->surface, &win_move, &animation);
+            ico_syc_hide(info->appid, info->surface, &animation);
+            ico_syc_show(info->appid, info->surface, &animation);
+            backgroundShow = true;
+        }
         break;
-    case ICO_SYC_EV_THUMB_PREPARE:
-        printf("--- ICO_SYC_EV_THUMB_PREPARE\n");
-        printf("\t(appid[%s], surface[%d], width[%d], height[%d], ",
+    }
+    case ICO_SYC_EV_THUMB_ERROR:
+        printf("--- ICO_SYC_EV_THUMB_ERROR\n");
+        printf("\t(appid[%s], surface[%d], error[%d]",
                ((ico_syc_thumb_info_t *)detail)->appid,
                ((ico_syc_thumb_info_t *)detail)->surface,
-               ((ico_syc_thumb_info_t *)detail)->width,
-               ((ico_syc_thumb_info_t *)detail)->height);
-        printf("stride[%d], format[%d])\n",
-               ((ico_syc_thumb_info_t *)detail)->stride,
-               ((ico_syc_thumb_info_t *)detail)->format);
+               ((ico_syc_thumb_info_t *)detail)->target);
         break;
     case ICO_SYC_EV_THUMB_CHANGE:
         printf("--- ICO_SYC_EV_THUMB_CHANGE\n");
-        printf("\t(appid[%s], surface[%d], width[%d], height[%d], ",
+        printf("\t(appid[%s], surface[%d], name[%d], width[%d], height[%d], ",
                ((ico_syc_thumb_info_t *)detail)->appid,
                ((ico_syc_thumb_info_t *)detail)->surface,
+               ((ico_syc_thumb_info_t *)detail)->name,
                ((ico_syc_thumb_info_t *)detail)->width,
                ((ico_syc_thumb_info_t *)detail)->height);
         printf("stride[%d], format[%d])\n",
@@ -122,9 +146,10 @@ _syc_callback(const ico_syc_ev_e event,
         break;
     case ICO_SYC_EV_THUMB_UNMAP:
         printf("--- ICO_SYC_EV_THUMB_UNMAP\n");
-        printf("\t(appid[%s], surface[%d], width[%d], height[%d], ",
+        printf("\t(appid[%s], surface[%d], name[%d], width[%d], height[%d], ",
                ((ico_syc_thumb_info_t *)detail)->appid,
                ((ico_syc_thumb_info_t *)detail)->surface,
+               ((ico_syc_thumb_info_t *)detail)->name,
                ((ico_syc_thumb_info_t *)detail)->width,
                ((ico_syc_thumb_info_t *)detail)->height);
         printf("stride[%d], format[%d])\n",
@@ -173,19 +198,17 @@ CicoUISample::onCreate(void *user_data)
         ico_syc_connect(_syc_callback, NULL);
 
         ecore_evas_init();
-        int w = 600;
-        int h = 800;
         CicoBaseWin* _bgwin = new CicoBaseWin("HSBackground",
-                                                                                     CicoGeometry(0, 0, 1080, 1920-64-128));
+                                              CicoGeometry(0, 64, 300, 300));
         _background = new CicoBackground(_bgwin->getEvas(),
-                                         CicoGeometry(0, 0, 1080, 1920-64-128),
-                                         CicoColor(0, 0, 128, 255));
-
-        CicoBaseWin* _ctlwin = new CicoBaseWin("HSControllBar",
-                                               CicoGeometry(0, 0, 1080, 128));
-        _controlbar = new CicoBackground(_ctlwin->getEvas(),
-                                         CicoGeometry(0, 0, 1080, 128),
-                                         CicoColor(128, 128, 128, 255));
+                                         CicoGeometry(0, 0, 300, 300),
+                                         CicoColor(128, 0, 128, 255));
+
+//        CicoBaseWin* _ctlwin = new CicoBaseWin("HSControllBar",
+//                                               CicoGeometry(0, 0, 1080, 128));
+//        _controlbar = new CicoBackground(_ctlwin->getEvas(),
+//                                         CicoGeometry(0, 0, 1080, 128),
+//                                         CicoColor(128, 128, 128, 255));
  
     }
     catch (const std::exception& e) {
index 478d5cc..592d9cc 100644 (file)
@@ -47,7 +47,22 @@ DummyHomeScreen_LDADD =              \
        @CAPIAPPFWAPPLICATION_LIBS@ \
        -L/usr/lib                              \
     -lico-uxf-weston-plugin \
-       -lico-util-com                  \
-       ../../../lib/apps-framework/libico-appfw.la
+       -lico-util                              \
+       ../../../lib/apps-framework/.libs/libico-appfw.so \
+       -lreadline
+
 
 CLEANFILES = $(BUILT_SOURCES)
+
+#install-exec-hook:
+#      mkdir -p $(INSTALL_ROOT)/usr/apps/org.tizen.ico.dummy-homescreen/bin
+#      mkdir -p $(INSTALL_ROOT)/usr/share/packages
+#      install -m 0755 DummyHomeScreen $(INSTALL_ROOT)/usr/apps/org.tizen.ico.dummy-homescreen/bin
+#      install -m 0644 org.tizen.ico.dummy-homescreen.xml $(INSTALL_ROOT)/usr/share/packages
+#
+#uninstall:
+#      rm -rf $(INSTALL_ROOT)/usr/apps/org.tizen.ico.dummy-homescreen
+#      rm -f $(INSTALL_ROOT)/usr/share/packages/org.tizen.ico.dummy-homescreen.xml
+#      rm -f $(INSTALL_ROOT)/usr/share/applications/org.tizen.ico.dummy-homescreen.desktop
+
+# vim:set ts=4 sw=4:
index 4811537..47b6753 100644 (file)
 
 #include "CicoUISample.h"
 #include "CicoLog.h"
+#include <Ecore.h>
 #include <Eina.h>
+#include <Ecore_Evas.h>
+
+#include <pthread.h>
+pthread_t thread;
+
+void *
+uiMain(void *args)
+{
+    CicoUISample uiSample;
+    uiSample.start(0, NULL);
+
+    return NULL;
+}
+
+#include <readline/readline.h>
+#include <readline/history.h>
+#define MAX_HISTORY_NO 3
+void
+consoleMain(void)
+{
+    char *prompt = (char*)"ico >";
+    char *line   = NULL;
+    int history_no = 0;
+    HIST_ENTRY *history = NULL;
+
+    printf("consolMain Enter\n");
+    while (1) {
+        line = readline(prompt);
+
+        if (strcmp(line, "exit") == 0) {
+            break;
+        }
+
+        add_history(line);
+        if (++history_no > MAX_HISTORY_NO) {
+            history = remove_history(0);
+            free(history);
+        }
+
+        free(line);
+    }
+
+    clear_history();
+}
 
 int
 main(int argc, char **argv)
 {
-    eina_init();
-    eina_log_level_set(EINA_LOG_LEVEL_DBG);
+    //eina_init();
+    //eina_log_level_set(EINA_LOG_LEVEL_DBG);
 
     try {
         CicoLog::getInstance()->openLog("DummyHomeScreen"/*TOOD*/);
 
-        int ret = 0;
-        CicoUISample uiSample;
+#if 1
+        /* pthread start */
+        int ret = pthread_create(&thread, NULL, uiMain, (void *)NULL);
+        if (-1 == ret) {
+            ICO_ERR("pthread_create failed(%d:%s)",
+                 errno, strerror(errno));
+            return -1;
+        }
+#endif
+        consoleMain();
 
-        ret = uiSample.start(argc, argv);
+        ecore_main_loop_quit();
+        ecore_evas_shutdown();
+        pthread_join(thread, NULL);
 
-        ICO_DBG("ret = %d error=%s\n", ret, uiSample.app_error_to_string(ret));
     }
     catch (const std::exception& e) {
         std::cerr << e.what() << std::endl;
index 44feb3b..1ebab11 100755 (executable)
@@ -22,8 +22,10 @@ killall -9 dialer 2> /dev/null
 killall -9 calculator 2> /dev/null
 killall -9 memo 2> /dev/null
 killall -9 smartsearch 2> /dev/null
+killall -9 ico-app-soundsample 2> /dev/null
 killall -9 GV3ySIINq7.GhostCluster 2> /dev/null
 killall -9 t8j6HTRpuz.MediaPlayer 2> /dev/null
+killall -9 WJT8vAfaMa.DemoAudioApp 2> /dev/null
 killall -9 WebProcess 2> /dev/null
 killall -9 WebProcess 2> /dev/null
 killall -9 ico-app-login 2> /dev/null
diff --git a/tool/rm_autogen-file.sh b/tool/rm_autogen-file.sh
new file mode 100755 (executable)
index 0000000..76cdb55
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+rm -rf \
+Makefile \
+Makefile.am~ \
+Makefile.in \
+aclocal.m4 \
+autom4te.cache \
+config.guess \
+config.h \
+config.h.in \
+config.h.in~ \
+config.log \
+config.status \
+config.sub \
+configure \
+depcomp \
+install-sh \
+libtool \
+ltmain.sh \
+missing \
+stamp-h1 \
+./lib/Makefile \
+./lib/Makefile.in \
+./lib/system-controller/.deps \
+./lib/system-controller/Makefile \
+./lib/system-controller/Makefile.in \
+./lib/apps-framework/.deps \
+./lib/apps-framework/Makefile \
+./lib/apps-framework/Makefile.in \
+./lib/misc/Makefile \
+./lib/misc/Makefile.in \
+./lib/misc/state-machine/.deps \
+./lib/misc/state-machine/Makefile \
+./lib/misc/state-machine/Makefile.in \
+./lib/misc/log/.deps \
+./lib/misc/log/Makefile \
+./lib/misc/log/Makefile.in \
+./src/Makefile \
+./src/Makefile.in \
+./src/system-controller/.deps \
+./src/homescreen/.deps \
+./src/homescreen/Makefile \
+./src/homescreen/Makefile.in \
+./src/syscond/.deps \
+./src/syscond/Makefile \
+./src/syscond/Makefile.in \
+./tests/Makefile \
+./tests/Makefile.in \
+./tests/system-controller/Makefile \
+./tests/system-controller/Makefile.in \
+./tests/system-controller/apps-framework/result \
+./tests/system-controller/apps-framework/.deps \
+./tests/system-controller/apps-framework/Makefile \
+./tests/system-controller/apps-framework/Makefile.in \
+./tests/system-controller/system-controller/.deps \
+./tests/system-controller/system-controller/Makefile \
+./tests/system-controller/system-controller/Makefile.in \
+./tests/system-controller/test-dummy-hs/.deps \
+./tests/system-controller/test-dummy-hs/Makefile \
+./tests/system-controller/test-dummy-hs/Makefile.in
index cb88dce..2d0626e 100755 (executable)
 /usr/bin/ico_ictl-touch_egalax
 sleep 0.3
 
+# 4 start some daemons
+## if pulseaudio dose not start ... kick pulseaudio
+/bin/ps ax | /bin/grep pulseaudio | /bin/grep -v grep > /dev/null
+if [ "$?" = "1" ] ; then
+       /usr/bin/pulseaudio --log-level=4 --log-target=file:/var/log/ico/pulse.log --system -D
+       sleep 0.5
+fi
+
 # 3. Start Weston
 /bin/ps ax | /bin/grep weston | /bin/grep -v grep > /dev/null
 if [ "$?" = "1" ] ; then
+       #/usr/bin/weston-launch --user app -- -i0 --backend=fbdev-backend.so --log=/var/log/ico/weston.log &
        /usr/bin/weston-launch --user app -- -i0 --log=/var/log/ico/weston.log &
        sync;sync
 fi