Refactoring homescreen. 08/9008/1
authorNakamura Hayato <hayato.nakamura@mail.toyota-td.jp>
Fri, 30 Aug 2013 11:42:49 +0000 (20:42 +0900)
committerNakamura Hayato <hayato.nakamura@mail.toyota-td.jp>
Fri, 30 Aug 2013 11:44:29 +0000 (20:44 +0900)
Change-Id: I9e6fda06d2b63a8f52cc60a5bf16c6dfbab4733c
Signed-off-by: Nakamura Hayato <hayato.nakamura@mail.toyota-td.jp>
452 files changed:
LICENSE-2.0 [deleted file]
Makefile.am
apps_controller/Makefile.am [deleted file]
apps_controller/ico_syc_apc_control.c [deleted file]
apps_controller/ico_syc_apc_private.h [deleted file]
apps_controller/ico_syc_apc_regulation.c [deleted file]
apps_controller/test/Makefile.am [deleted file]
apps_controller/test/apc_test.c [deleted file]
apps_controller/test/goapc_test.sh [deleted file]
configure.ac
data/lib/systemd/user/ico-system-controller.service [new file with mode: 0644]
data/share/applications/org.tizen.ico.homescreen.desktop
data/share/applications/org.tizen.ico.homescreen.desktop_bk [new file with mode: 0644]
data/share/applications/org.tizen.ico.onscreen.desktop
data/share/applications/org.tizen.ico.sample.alignment.desktop [new file with mode: 0644]
data/share/applications/org.tizen.ico.sample.browser.desktop [new file with mode: 0644]
data/share/applications/org.tizen.ico.sample.enginestatus.desktop [new file with mode: 0644]
data/share/applications/org.tizen.ico.sample.mail.desktop [new file with mode: 0644]
data/share/applications/org.tizen.ico.sample.meter.desktop [new file with mode: 0644]
data/share/applications/org.tizen.ico.sample.music.desktop [new file with mode: 0644]
data/share/applications/org.tizen.ico.sample.seatarrange.desktop [new file with mode: 0644]
data/share/applications/org.tizen.ico.sample.setup.desktop [new file with mode: 0644]
data/share/applications/org.tizen.ico.sample.weather.desktop [new file with mode: 0644]
data/share/applications/org.tizen.ico.statusbar.desktop
data/share/packages/org.tizen.ico.homescreen.xml
data/share/packages/org.tizen.ico.onscreen.xml [deleted file]
data/share/packages/org.tizen.ico.statusbar.xml
data/share/packages/org.tizen.ico.system-controller.xml [new file with mode: 0644]
ico-app-framework/Makefile.am [deleted file]
ico-app-framework/ico_apf_apimacro.h [deleted file]
ico-app-framework/ico_apf_appmgr.c [deleted file]
ico-app-framework/ico_apf_communication.c [deleted file]
ico-app-framework/ico_apf_ecore.c [deleted file]
ico-app-framework/ico_apf_log.c [deleted file]
ico-app-framework/ico_apf_private.h [deleted file]
ico-app-framework/ico_apf_resource_control.c [deleted file]
ico-app-framework/ico_uxf_conf_app.c [deleted file]
ico-app-framework/ico_uxf_conf_common.c [deleted file]
ico-app-framework/ico_uxf_conf_ecore.c [deleted file]
ico-app-framework/ico_uxf_conf_sys.c [deleted file]
ico-app-framework/ico_uxf_init.c [deleted file]
ico-app-framework/ico_uxf_inputdev.c [deleted file]
ico-app-framework/ico_uxf_launcher.c [deleted file]
ico-app-framework/ico_uxf_private.h [deleted file]
ico-app-framework/ico_uxf_window.c [deleted file]
ico-app-framework/test/Makefile.am [deleted file]
ico-app-framework/test/gotest_client.sh [deleted file]
ico-app-framework/test/gotest_server.sh [deleted file]
ico-app-framework/test/test_client.c [deleted file]
ico-app-framework/test/test_server.c [deleted file]
include/home_screen.h [deleted file]
include/home_screen_conf.h [deleted file]
include/home_screen_lib.h [deleted file]
include/home_screen_parser.h [deleted file]
include/ico_apf.h [deleted file]
include/ico_apf_ecore.h [deleted file]
include/ico_apf_error.h [deleted file]
include/ico_apf_log.h [deleted file]
include/ico_apf_resource_control.h [deleted file]
include/ico_syc_apc.h [deleted file]
include/ico_syc_application.h [new file with mode: 0644]
include/ico_syc_appresctl.h [new file with mode: 0644]
include/ico_syc_common.h [new file with mode: 0644]
include/ico_syc_def.h [deleted file]
include/ico_syc_error.h [new file with mode: 0644]
include/ico_syc_inputctl.h [new file with mode: 0644]
include/ico_syc_msg.h [new file with mode: 0644]
include/ico_syc_msg_cmd_def.h [new file with mode: 0644]
include/ico_syc_private.h [new file with mode: 0644]
include/ico_syc_privilege.h [new file with mode: 0644]
include/ico_syc_type.h [new file with mode: 0644]
include/ico_syc_userctl.h [new file with mode: 0644]
include/ico_syc_winctl.h [new file with mode: 0644]
include/ico_uxf.h [deleted file]
include/ico_uxf_conf.h [deleted file]
include/ico_uxf_conf_common.h [deleted file]
include/ico_uxf_conf_def.h [deleted file]
include/ico_uxf_conf_ecore.h [deleted file]
include/ico_uxf_def.h [deleted file]
include/ico_uxf_proto.h [deleted file]
include/ico_uxf_sysdef.h [deleted file]
include/ico_uxf_typedef.h [deleted file]
install-appcore.sh [deleted file]
lib/Makefile.am [new file with mode: 0644]
lib/apps-framework/Makefile.am [new file with mode: 0644]
lib/apps-framework/ico_syc_appresctl.c [new file with mode: 0644]
lib/apps-framework/ico_syc_common.c [new file with mode: 0644]
lib/apps-framework/ico_syc_inputctl.c [new file with mode: 0644]
lib/apps-framework/ico_syc_msg.c [new file with mode: 0644]
lib/apps-framework/ico_syc_userctl.c [new file with mode: 0644]
lib/apps-framework/ico_syc_winctl.c [new file with mode: 0644]
lib/misc/Makefile.am [new file with mode: 0644]
lib/misc/state-machine/CicoBlockParser.cpp [new file with mode: 0644]
lib/misc/state-machine/CicoBlockParser.h [new file with mode: 0644]
lib/misc/state-machine/CicoEvent.cpp [new file with mode: 0644]
lib/misc/state-machine/CicoEvent.h [new file with mode: 0644]
lib/misc/state-machine/CicoEventInfo.cpp [new file with mode: 0644]
lib/misc/state-machine/CicoEventInfo.h [new file with mode: 0644]
lib/misc/state-machine/CicoFinalState.cpp [new file with mode: 0644]
lib/misc/state-machine/CicoFinalState.h [new file with mode: 0644]
lib/misc/state-machine/CicoHistoryState.cpp [new file with mode: 0644]
lib/misc/state-machine/CicoHistoryState.h [new file with mode: 0644]
lib/misc/state-machine/CicoState.cpp [new file with mode: 0644]
lib/misc/state-machine/CicoState.h [new file with mode: 0644]
lib/misc/state-machine/CicoStateAction.cpp [new file with mode: 0644]
lib/misc/state-machine/CicoStateAction.h [new file with mode: 0644]
lib/misc/state-machine/CicoStateCore.cpp [new file with mode: 0644]
lib/misc/state-machine/CicoStateCore.h [new file with mode: 0644]
lib/misc/state-machine/CicoStateInternal.h [new file with mode: 0644]
lib/misc/state-machine/CicoStateMachine.cpp [new file with mode: 0644]
lib/misc/state-machine/CicoStateMachine.h [new file with mode: 0644]
lib/misc/state-machine/CicoStateMachineCreator.cpp [new file with mode: 0644]
lib/misc/state-machine/CicoStateMachineCreator.h [new file with mode: 0644]
lib/misc/state-machine/Makefile.am [new file with mode: 0644]
lib/misc/state-machine/ico_StateMachine_CWrapper.cpp [new file with mode: 0644]
lib/misc/state-machine/ico_StateMachine_CWrapper.h [new file with mode: 0644]
lib/misc/state-machine/ico_log.c [new file with mode: 0644]
lib/misc/state-machine/ico_log.h [new file with mode: 0644]
lib/misc/state-machine/picojson.h [new file with mode: 0644]
lib/system-controller/CicoLog.h [new file with mode: 0644]
lib/system-controller/CicoSCAilItems.cpp [new file with mode: 0644]
lib/system-controller/CicoSCAilItems.h [new file with mode: 0644]
lib/system-controller/CicoSCAulItems.cpp [new file with mode: 0644]
lib/system-controller/CicoSCAulItems.h [new file with mode: 0644]
lib/system-controller/CicoSCCommandParser.cpp [new file with mode: 0644]
lib/system-controller/CicoSCCommandParser.h [new file with mode: 0644]
lib/system-controller/CicoSCConf.h [new file with mode: 0644]
lib/system-controller/CicoSCDisplay.cpp [new file with mode: 0644]
lib/system-controller/CicoSCDisplay.h [new file with mode: 0644]
lib/system-controller/CicoSCDisplayZone.cpp [new file with mode: 0644]
lib/system-controller/CicoSCDisplayZone.h [new file with mode: 0644]
lib/system-controller/CicoSCInputController.cpp [new file with mode: 0644]
lib/system-controller/CicoSCInputController.h [new file with mode: 0644]
lib/system-controller/CicoSCInputDev.cpp [new file with mode: 0644]
lib/system-controller/CicoSCInputDev.h [new file with mode: 0644]
lib/system-controller/CicoSCLayer.cpp [new file with mode: 0644]
lib/system-controller/CicoSCLayer.h [new file with mode: 0644]
lib/system-controller/CicoSCLifeCycleController.cpp [new file with mode: 0644]
lib/system-controller/CicoSCLifeCycleController.h [new file with mode: 0644]
lib/system-controller/CicoSCMessage.cpp [new file with mode: 0644]
lib/system-controller/CicoSCMessage.h [new file with mode: 0644]
lib/system-controller/CicoSCPolicyManager.cpp [new file with mode: 0644]
lib/system-controller/CicoSCPolicyManager.h [new file with mode: 0644]
lib/system-controller/CicoSCResourceManager.cpp [new file with mode: 0644]
lib/system-controller/CicoSCResourceManager.h [new file with mode: 0644]
lib/system-controller/CicoSCServer.cpp [new file with mode: 0644]
lib/system-controller/CicoSCServer.h [new file with mode: 0644]
lib/system-controller/CicoSCSwitch.cpp [new file with mode: 0644]
lib/system-controller/CicoSCSwitch.h [new file with mode: 0644]
lib/system-controller/CicoSCSysResourceController.cpp [new file with mode: 0644]
lib/system-controller/CicoSCSysResourceController.h [new file with mode: 0644]
lib/system-controller/CicoSCSysResourceMonitor.cpp [new file with mode: 0644]
lib/system-controller/CicoSCSysResourceMonitor.h [new file with mode: 0644]
lib/system-controller/CicoSCSystemConfig.cpp [new file with mode: 0644]
lib/system-controller/CicoSCSystemConfig.h [new file with mode: 0644]
lib/system-controller/CicoSCUser.cpp [new file with mode: 0644]
lib/system-controller/CicoSCUser.h [new file with mode: 0644]
lib/system-controller/CicoSCUserManager.cpp [new file with mode: 0644]
lib/system-controller/CicoSCUserManager.h [new file with mode: 0644]
lib/system-controller/CicoSCWayland.cpp [new file with mode: 0644]
lib/system-controller/CicoSCWayland.h [new file with mode: 0644]
lib/system-controller/CicoSCWaylandIF.cpp [new file with mode: 0644]
lib/system-controller/CicoSCWaylandIF.h [new file with mode: 0644]
lib/system-controller/CicoSCWindow.cpp [new file with mode: 0644]
lib/system-controller/CicoSCWindow.h [new file with mode: 0644]
lib/system-controller/CicoSCWindowController.cpp [new file with mode: 0644]
lib/system-controller/CicoSCWindowController.h [new file with mode: 0644]
lib/system-controller/CicoSCWlInputMgrIF.cpp [new file with mode: 0644]
lib/system-controller/CicoSCWlInputMgrIF.h [new file with mode: 0644]
lib/system-controller/CicoSCWlWinMgrIF.cpp [new file with mode: 0644]
lib/system-controller/CicoSCWlWinMgrIF.h [new file with mode: 0644]
lib/system-controller/Makefile.am [new file with mode: 0644]
lib/system-controller/ico_log.c [new file with mode: 0644]
lib/system-controller/ico_log.h [new file with mode: 0644]
lib/system-controller/ico_syc_error.h [new file with mode: 0644]
lib/system-controller/ico_syc_mrp_resource.c [new file with mode: 0644]
lib/system-controller/ico_syc_mrp_resource_private.h [new file with mode: 0644]
packaging/ico-uxf-homescreen.changes
packaging/ico-uxf-homescreen.spec
reload_appcore.sh [deleted file]
res/apps/org.tizen.ico.homescreen/homescreen.conf.VERTICAL [deleted file]
res/config/system.conf [deleted file]
res/images/applist_off.png [deleted file]
res/org.tizen.ico.homescreen/res/apps/org.tizen.ico.homescreen/homescreen.conf [moved from res/apps/org.tizen.ico.homescreen/homescreen.conf with 91% similarity]
res/org.tizen.ico.homescreen/res/apps/org.tizen.ico.onscreen/onscreen.conf [moved from res/apps/org.tizen.ico.onscreen/onscreen.conf with 73% similarity]
res/org.tizen.ico.homescreen/res/apps/org.tizen.ico.statusbar/statusbar.conf [moved from res/apps/org.tizen.ico.statusbar/statusbar.conf with 74% similarity]
res/org.tizen.ico.homescreen/res/config/app_attr.conf [new file with mode: 0644]
res/org.tizen.ico.homescreen/res/config/system.conf [moved from res/config/system.conf.VERTICAL with 96% similarity]
res/org.tizen.ico.homescreen/res/images/DejaVuSans.ttf [moved from res/images/DejaVuSans.ttf with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_all_off.png [moved from res/images/api_all_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_all_on.png [moved from res/images/api_all_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_back.png [moved from res/images/api_back.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_l_01_off.png [moved from res/images/api_l_01_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_l_01_on.png [moved from res/images/api_l_01_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_l_02_off.png [moved from res/images/api_l_02_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_l_02_on.png [moved from res/images/api_l_02_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_l_03_off.png [moved from res/images/api_l_03_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_l_03_on.png [moved from res/images/api_l_03_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_l_04_off.png [moved from res/images/api_l_04_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_l_04_on.png [moved from res/images/api_l_04_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_l_05_off.png [moved from res/images/api_l_05_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_l_05_on.png [moved from res/images/api_l_05_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_l_06_off.png [moved from res/images/api_l_06_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_l_06_on.png [moved from res/images/api_l_06_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_l_12_off.png [moved from res/images/api_l_12_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_l_12_on.png [moved from res/images/api_l_12_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_01_off.png [moved from res/images/api_s_01_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_01_on.png [moved from res/images/api_s_01_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_02_off.png [moved from res/images/api_s_02_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_02_on.png [moved from res/images/api_s_02_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_03_off.png [moved from res/images/api_s_03_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_03_on.png [moved from res/images/api_s_03_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_04_off.png [moved from res/images/api_s_04_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_04_on.png [moved from res/images/api_s_04_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_05_off.png [moved from res/images/api_s_05_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_05_on.png [moved from res/images/api_s_05_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_06_off.png [moved from res/images/api_s_06_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_06_on.png [moved from res/images/api_s_06_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_07_off.png [moved from res/images/api_s_07_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_07_on.png [moved from res/images/api_s_07_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_08_off.png [moved from res/images/api_s_08_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_08_on.png [moved from res/images/api_s_08_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_09_off.png [moved from res/images/api_s_09_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_09_on.png [moved from res/images/api_s_09_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_10_off.png [moved from res/images/api_s_10_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_10_on.png [moved from res/images/api_s_10_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_11_off.png [moved from res/images/api_s_11_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_11_on.png [moved from res/images/api_s_11_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_12_off.png [moved from res/images/api_s_12_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_12_on.png [moved from res/images/api_s_12_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_13_off.png [moved from res/images/api_s_13_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_13_on.png [moved from res/images/api_s_13_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_14_off.png [moved from res/images/api_s_14_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_14_on.png [moved from res/images/api_s_14_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_15_off.png [moved from res/images/api_s_15_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/api_s_15_on.png [moved from res/images/api_s_15_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/applist_off.png [new file with mode: 0755]
res/org.tizen.ico.homescreen/res/images/applist_on.png [moved from res/images/applist_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/back_b_01.png [moved from res/images/back_b_01.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/back_b_02.png [moved from res/images/back_b_02.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/bg.png [new file with mode: 0644]
res/org.tizen.ico.homescreen/res/images/bg_bk.png [new file with mode: 0644]
res/org.tizen.ico.homescreen/res/images/button_no.png [new file with mode: 0644]
res/org.tizen.ico.homescreen/res/images/button_really.png [new file with mode: 0644]
res/org.tizen.ico.homescreen/res/images/button_yes.png [new file with mode: 0644]
res/org.tizen.ico.homescreen/res/images/cancel_bt_off.png [moved from res/images/cancel_bt_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/cancel_bt_on.png [moved from res/images/cancel_bt_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/ctrl.png [new file with mode: 0644]
res/org.tizen.ico.homescreen/res/images/end_bt.png [moved from res/images/end_bt.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/home_off.png [moved from res/images/home_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/home_on.png [moved from res/images/home_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/na_bt1_off.png [moved from res/images/na_bt1_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/na_bt1_on.png [moved from res/images/na_bt1_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/na_bt2_off.png [moved from res/images/na_bt2_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/na_bt2_on.png [moved from res/images/na_bt2_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/na_bt3_off.png [moved from res/images/na_bt3_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/na_bt3_on.png [moved from res/images/na_bt3_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/na_goal_text.png [moved from res/images/na_goal_text.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/na_pa_01.png [moved from res/images/na_pa_01.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/na_pa_02.png [moved from res/images/na_pa_02.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/na_pa_03.png [moved from res/images/na_pa_03.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/na_pa_04.png [moved from res/images/na_pa_04.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/nai_01_off.png [moved from res/images/nai_01_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/nai_01_on.png [moved from res/images/nai_01_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/nai_02_off.png [moved from res/images/nai_02_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/nai_03_off.png [moved from res/images/nai_03_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/nai_04_off.png [moved from res/images/nai_04_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/nai_05_off.png [moved from res/images/nai_05_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/nai_06_off.png [moved from res/images/nai_06_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/nai_07_off.png [moved from res/images/nai_07_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/nai_08_off.png [moved from res/images/nai_08_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/nai_09_off.png [moved from res/images/nai_09_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/nai_10_off.png [moved from res/images/nai_10_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/nai_11_off.png [moved from res/images/nai_11_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/nai_12_off.png [moved from res/images/nai_12_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/nai_12_on.png [moved from res/images/nai_12_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/next_bt_off.png [moved from res/images/next_bt_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/next_bt_on.png [moved from res/images/next_bt_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/ok_bt_off.png [moved from res/images/ok_bt_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/ok_bt_on.png [moved from res/images/ok_bt_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/pagePointer_n.png [new file with mode: 0644]
res/org.tizen.ico.homescreen/res/images/pagePointer_p.png [new file with mode: 0644]
res/org.tizen.ico.homescreen/res/images/smi_01.png [moved from res/images/smi_01.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/smi_02.png [moved from res/images/smi_02.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/smi_03.png [moved from res/images/smi_03.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/smi_04.png [moved from res/images/smi_04.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/st_logo_off.png [moved from res/images/st_logo_off.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/st_logo_on.png [moved from res/images/st_logo_on.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/termIcon.png [new file with mode: 0644]
res/org.tizen.ico.homescreen/res/images/time_0.png [moved from res/images/time_0.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/time_1.png [moved from res/images/time_1.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/time_2.png [moved from res/images/time_2.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/time_3.png [moved from res/images/time_3.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/time_4.png [moved from res/images/time_4.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/time_5.png [moved from res/images/time_5.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/time_6.png [moved from res/images/time_6.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/time_7.png [moved from res/images/time_7.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/time_8.png [moved from res/images/time_8.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/time_9.png [moved from res/images/time_9.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/time_am.png [moved from res/images/time_am.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/time_pm.png [moved from res/images/time_pm.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/time_ten.png [moved from res/images/time_ten.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/tizen_32.png [moved from res/images/tizen_32.png with 100% similarity]
res/org.tizen.ico.homescreen/res/images/ttf-japanese-gothic.ttf [moved from res/images/ttf-japanese-gothic.ttf with 100% similarity]
res/org.tizen.ico.system-controller/res/config/CicoSCSysResourceSM.json [new file with mode: 0644]
res/org.tizen.ico.system-controller/res/config/app_attr.conf [moved from res/config/app_attr.conf with 67% similarity]
res/org.tizen.ico.system-controller/res/config/policy.json [new file with mode: 0644]
res/org.tizen.ico.system-controller/res/config/system.xml [new file with mode: 0644]
res/org.tizen.ico.system-controller/res/config/user.xml [new file with mode: 0644]
settings/ico_homescreen.service [deleted file]
settings/ico_homescreen.sh [deleted file]
settings/mediation_table.txt [deleted file]
src/Makefile.am
src/home_screen_lib.c [deleted file]
src/home_screen_main.c [deleted file]
src/home_screen_parser.c [deleted file]
src/home_screen_sound.c [deleted file]
src/homescreen/CicoHSAppInfo.cpp [new file with mode: 0644]
src/homescreen/CicoHSAppInfo.h [new file with mode: 0644]
src/homescreen/CicoHSBackWindow.cpp [new file with mode: 0644]
src/homescreen/CicoHSBackWindow.h [new file with mode: 0644]
src/homescreen/CicoHSControlBarTouch.cpp [new file with mode: 0644]
src/homescreen/CicoHSControlBarTouch.h [new file with mode: 0644]
src/homescreen/CicoHSControlBarWindow.cpp [new file with mode: 0644]
src/homescreen/CicoHSControlBarWindow.h [new file with mode: 0644]
src/homescreen/CicoHSMenuTile.cpp [new file with mode: 0644]
src/homescreen/CicoHSMenuTile.h [new file with mode: 0644]
src/homescreen/CicoHSMenuTouch.cpp [new file with mode: 0644]
src/homescreen/CicoHSMenuTouch.h [new file with mode: 0644]
src/homescreen/CicoHSMenuWindow.cpp [new file with mode: 0644]
src/homescreen/CicoHSMenuWindow.h [new file with mode: 0644]
src/homescreen/CicoHSWindow.cpp [new file with mode: 0644]
src/homescreen/CicoHSWindow.h [new file with mode: 0644]
src/homescreen/CicoHSWindowController.cpp [new file with mode: 0644]
src/homescreen/CicoHSWindowController.h [new file with mode: 0644]
src/homescreen/CicoHomeScreen.cpp [new file with mode: 0644]
src/homescreen/CicoHomeScreen.h [new file with mode: 0644]
src/homescreen/CicoHomeScreenCommon.h [new file with mode: 0644]
src/homescreen/CicoHomeScreenConfig.cpp [moved from src/home_screen_conf.c with 61% similarity]
src/homescreen/CicoHomeScreenConfig.h [new file with mode: 0644]
src/homescreen/CicoHomeScreenResourceConfig.cpp [moved from src/resource_conf.c with 80% similarity]
src/homescreen/CicoHomeScreenResourceConfig.h [new file with mode: 0644]
src/homescreen/CicoHomeScreenSound.cpp [new file with mode: 0644]
src/homescreen/CicoHomeScreenSound.h [new file with mode: 0644]
src/homescreen/CicoHomeScreenSoundConfig.cpp [new file with mode: 0644]
src/homescreen/CicoHomeScreenSoundConfig.h [new file with mode: 0644]
src/homescreen/CicoLog.cpp [new file with mode: 0644]
src/homescreen/CicoLog.h [new file with mode: 0644]
src/homescreen/CicoOnScreenAction.cpp [new file with mode: 0644]
src/homescreen/CicoOnScreenAction.h [new file with mode: 0644]
src/homescreen/CicoOnScreenAppList.cpp [new file with mode: 0644]
src/homescreen/CicoOnScreenAppList.h [new file with mode: 0644]
src/homescreen/CicoOnScreenContext.cpp [new file with mode: 0644]
src/homescreen/CicoOnScreenContext.h [new file with mode: 0644]
src/homescreen/CicoOnScreenControlWindow.cpp [new file with mode: 0644]
src/homescreen/CicoOnScreenControlWindow.h [new file with mode: 0644]
src/homescreen/CicoSCAilItems.cpp [new file with mode: 0644]
src/homescreen/CicoSCAilItems.h [new file with mode: 0644]
src/homescreen/CicoSCAulItems.cpp [new file with mode: 0644]
src/homescreen/CicoSCAulItems.h [new file with mode: 0644]
src/homescreen/CicoSCConf.h [new file with mode: 0644]
src/homescreen/CicoSCLifeCycleController.cpp [new file with mode: 0644]
src/homescreen/CicoSCLifeCycleController.h [new file with mode: 0644]
src/homescreen/CicoSCSystemConfig.cpp [new file with mode: 0644]
src/homescreen/CicoSCSystemConfig.h [new file with mode: 0644]
src/homescreen/CicoStatusBarControlWindow.cpp [new file with mode: 0644]
src/homescreen/CicoStatusBarControlWindow.h [new file with mode: 0644]
src/homescreen/CicoStatusBarTime.cpp [new file with mode: 0644]
src/homescreen/CicoStatusBarTime.h [new file with mode: 0644]
src/homescreen/Makefile.am [new file with mode: 0644]
src/homescreen/appli_kill.edc [moved from src/appli_kill.edc with 100% similarity]
src/homescreen/appli_list.edc [moved from src/appli_list.edc with 100% similarity]
src/homescreen/home_screen_bg.edc [moved from src/home_screen_bg.edc with 100% similarity]
src/homescreen/home_screen_main.cpp [new file with mode: 0644]
src/homescreen/home_screen_main.h [new file with mode: 0644]
src/homescreen/home_screen_res.h [moved from include/home_screen_res.h with 100% similarity]
src/homescreen/home_screen_touch.edc [moved from src/home_screen_touch.edc with 100% similarity]
src/homescreen/ico_log.c [new file with mode: 0644]
src/homescreen/ico_log.h [new file with mode: 0644]
src/homescreen/on_screen.cpp [new file with mode: 0644]
src/homescreen/on_screen.h [new file with mode: 0644]
src/homescreen/status_bar.cpp [new file with mode: 0644]
src/homescreen/status_bar.h [new file with mode: 0644]
src/homescreen/translucent_bg.edc [moved from src/translucent_bg.edc with 100% similarity]
src/on_screen.c [deleted file]
src/status_bar.c [deleted file]
src/syscond/CicoEFLApp.cpp [new file with mode: 0644]
src/syscond/CicoEFLApp.h [new file with mode: 0644]
src/syscond/CicoSysConDaemon.cpp [new file with mode: 0644]
src/syscond/CicoSysConDaemon.h [new file with mode: 0644]
src/syscond/Makefile.am [new file with mode: 0644]
src/syscond/main.cpp [new file with mode: 0644]
start_homescreen [deleted file]
test/start_hsfork [deleted file]
test/start_hsonly [deleted file]
test/start_weston [deleted file]
test/testdata/gui-test.dat [deleted file]
tests/Makefile.am [new file with mode: 0644]
tests/homescreen/Makefile.am [moved from test/Makefile.am with 84% similarity]
tests/homescreen/homescreen-test-makedat.sh [moved from test/homescreen-test-makedat.sh with 100% similarity]
tests/homescreen/homescreen-test-startall.sh [moved from test/homescreen-test-startall.sh with 100% similarity]
tests/homescreen/homescreen-test.sh [moved from test/homescreen-test.sh with 100% similarity]
tests/homescreen/ico_send_hscommand.c [moved from test/ico_send_hscommand.c with 100% similarity]
tests/homescreen/ico_send_inputevent.c [moved from test/ico_send_inputevent.c with 100% similarity]
tests/homescreen/ico_set_vehicleinfo.c [moved from test/ico_set_vehicleinfo.c with 51% similarity]
tests/homescreen/json/exec-app1.json [moved from test/json/exec-app1.json with 100% similarity]
tests/homescreen/json/geom-app1-1.json [moved from test/json/geom-app1-1.json with 100% similarity]
tests/homescreen/json/geom-app1-2.json [moved from test/json/geom-app1-2.json with 100% similarity]
tests/homescreen/json/geom-app1-3.json [moved from test/json/geom-app1-3.json with 100% similarity]
tests/homescreen/json/hide-tile.json [moved from test/json/hide-tile.json with 100% similarity]
tests/homescreen/json/show-app1.json [moved from test/json/show-app1.json with 100% similarity]
tests/homescreen/json/show-tile.json [moved from test/json/show-tile.json with 100% similarity]
tests/homescreen/json/term-app1.json [moved from test/json/term-app1.json with 100% similarity]
tests/homescreen/testdata/gui-test-FHD-next.dat [moved from test/testdata/gui-test-FHD-next.dat with 100% similarity]
tests/homescreen/testdata/gui-test-FHD.dat [moved from test/testdata/gui-test-FHD.dat with 100% similarity]
tests/homescreen/testdata/gui-test-XGA-next.dat [moved from test/testdata/gui-test-XGA-next.dat with 100% similarity]
tests/homescreen/testdata/gui-test-XGA.dat [moved from test/testdata/gui-test-XGA.dat with 100% similarity]
tests/homescreen/testdata/gui-test-launch-template.dat [moved from test/testdata/gui-test-launch-template.dat with 100% similarity]
tests/system-controller/Makefile.am [new file with mode: 0644]
tests/system-controller/apps-framework/Makefile.am [new file with mode: 0644]
tests/system-controller/apps-framework/data/test.ico.res.app.desktop [new file with mode: 0644]
tests/system-controller/apps-framework/run_test.sh [new file with mode: 0755]
tests/system-controller/apps-framework/tst_appresctl.c [new file with mode: 0644]
tests/system-controller/apps-framework/tst_appresctl_main.c [new file with mode: 0644]
tests/system-controller/apps-framework/tst_common.c [new file with mode: 0644]
tests/system-controller/apps-framework/tst_common.h [new file with mode: 0644]
tests/system-controller/apps-framework/tst_inputctl.c [new file with mode: 0644]
tests/system-controller/apps-framework/tst_server.c [new file with mode: 0644]
tests/system-controller/apps-framework/tst_userctl.c [new file with mode: 0644]
tests/system-controller/apps-framework/tst_winctl.c [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoBackground.cpp [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoBackground.h [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoBaseWin.cpp [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoBaseWin.h [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoColor.cpp [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoColor.h [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoEFLApp.cpp [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoEFLApp.h [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoEvasObject.cpp [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoEvasObject.h [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoGeometry.cpp [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoGeometry.h [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoLog.cpp [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoLog.h [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoUISample.cpp [new file with mode: 0644]
tests/system-controller/test-dummy-hs/CicoUISample.h [new file with mode: 0644]
tests/system-controller/test-dummy-hs/Makefile.am [new file with mode: 0644]
tests/system-controller/test-dummy-hs/main.cpp [new file with mode: 0644]
tests/system-controller/test-dummy-hs/org.tizen.ico.dummy-homescreen.xml [new file with mode: 0644]
tool/kill_syscond.sh [moved from kill_homescreen with 77% similarity]
tool/start_syscond.sh [new file with mode: 0755]
update-exec.sh [deleted file]

diff --git a/LICENSE-2.0 b/LICENSE-2.0
deleted file mode 100644 (file)
index 3eee9bf..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-Apache License 
-Version 2.0, January 2004 
-http://www.apache.org/licenses/ 
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 
-
-1. Definitions. 
-
-"License" shall mean the terms and conditions for use, reproduction, 
-and distribution as defined by Sections 1 through 9 of this document. 
-
-"Licensor" shall mean the copyright owner or entity authorized by 
-the copyright owner that is granting the License. 
-
-"Legal Entity" shall mean the union of the acting entity and all 
-other entities that control, are controlled by, or are under common 
-control with that entity. For the purposes of this definition, 
-"control" means (i) the power, direct or indirect, to cause the 
-direction or management of such entity, whether by contract or 
-otherwise, or (ii) ownership of fifty percent (50%) or more of the 
-outstanding shares, or (iii) beneficial ownership of such entity. 
-
-"You" (or "Your") shall mean an individual or Legal Entity 
-exercising permissions granted by this License. 
-
-"Source" form shall mean the preferred form for making modifications, 
-including but not limited to software source code, documentation 
-source, and configuration files. 
-
-"Object" form shall mean any form resulting from mechanical 
-transformation or translation of a Source form, including but 
-not limited to compiled object code, generated documentation, 
-and conversions to other media types. 
-
-"Work" shall mean the work of authorship, whether in Source or 
-Object form, made available under the License, as indicated by a 
-copyright notice that is included in or attached to the work 
-(an example is provided in the Appendix below). 
-
-"Derivative Works" shall mean any work, whether in Source or Object 
-form, that is based on (or derived from) the Work and for which the 
-editorial revisions, annotations, elaborations, or other modifications 
-represent, as a whole, an original work of authorship. For the purposes 
-of this License, Derivative Works shall not include works that remain 
-separable from, or merely link (or bind by name) to the interfaces of, 
-the Work and Derivative Works thereof. 
-
-"Contribution" shall mean any work of authorship, including 
-the original version of the Work and any modifications or additions 
-to that Work or Derivative Works thereof, that is intentionally 
-submitted to Licensor for inclusion in the Work by the copyright owner 
-or by an individual or Legal Entity authorized to submit on behalf of 
-the copyright owner. For the purposes of this definition, "submitted" 
-means any form of electronic, verbal, or written communication sent 
-to the Licensor or its representatives, including but not limited to 
-communication on electronic mailing lists, source code control systems, 
-and issue tracking systems that are managed by, or on behalf of, the 
-Licensor for the purpose of discussing and improving the Work, but 
-excluding communication that is conspicuously marked or otherwise 
-designated in writing by the copyright owner as "Not a Contribution." 
-
-"Contributor" shall mean Licensor and any individual or Legal Entity 
-on behalf of whom a Contribution has been received by Licensor and 
-subsequently incorporated within the Work. 
-
-2. Grant of Copyright License. Subject to the terms and conditions of 
-this License, each Contributor hereby grants to You a perpetual, 
-worldwide, non-exclusive, no-charge, royalty-free, irrevocable 
-copyright license to reproduce, prepare Derivative Works of, 
-publicly display, publicly perform, sublicense, and distribute the 
-Work and such Derivative Works in Source or Object form. 
-
-3. Grant of Patent License. Subject to the terms and conditions of 
-this License, each Contributor hereby grants to You a perpetual, 
-worldwide, non-exclusive, no-charge, royalty-free, irrevocable 
-(except as stated in this section) patent license to make, have made, 
-use, offer to sell, sell, import, and otherwise transfer the Work, 
-where such license applies only to those patent claims licensable 
-by such Contributor that are necessarily infringed by their 
-Contribution(s) alone or by combination of their Contribution(s) 
-with the Work to which such Contribution(s) was submitted. If You 
-institute patent litigation against any entity (including a 
-cross-claim or counterclaim in a lawsuit) alleging that the Work 
-or a Contribution incorporated within the Work constitutes direct 
-or contributory patent infringement, then any patent licenses 
-granted to You under this License for that Work shall terminate 
-as of the date such litigation is filed. 
-
-4. Redistribution. You may reproduce and distribute copies of the 
-Work or Derivative Works thereof in any medium, with or without 
-modifications, and in Source or Object form, provided that You 
-meet the following conditions: 
-
-(a) You must give any other recipients of the Work or 
-Derivative Works a copy of this License; and 
-
-(b) You must cause any modified files to carry prominent notices 
-stating that You changed the files; and 
-
-(c) You must retain, in the Source form of any Derivative Works 
-that You distribute, all copyright, patent, trademark, and 
-attribution notices from the Source form of the Work, 
-excluding those notices that do not pertain to any part of 
-the Derivative Works; and 
-
-(d) If the Work includes a "NOTICE" text file as part of its 
-distribution, then any Derivative Works that You distribute must 
-include a readable copy of the attribution notices contained 
-within such NOTICE file, excluding those notices that do not 
-pertain to any part of the Derivative Works, in at least one 
-of the following places: within a NOTICE text file distributed 
-as part of the Derivative Works; within the Source form or 
-documentation, if provided along with the Derivative Works; or, 
-within a display generated by the Derivative Works, if and 
-wherever such third-party notices normally appear. The contents 
-of the NOTICE file are for informational purposes only and 
-do not modify the License. You may add Your own attribution 
-notices within Derivative Works that You distribute, alongside 
-or as an addendum to the NOTICE text from the Work, provided 
-that such additional attribution notices cannot be construed 
-as modifying the License. 
-
-You may add Your own copyright statement to Your modifications and 
-may provide additional or different license terms and conditions 
-for use, reproduction, or distribution of Your modifications, or 
-for any such Derivative Works as a whole, provided Your use, 
-reproduction, and distribution of the Work otherwise complies with 
-the conditions stated in this License. 
-
-5. Submission of Contributions. Unless You explicitly state otherwise, 
-any Contribution intentionally submitted for inclusion in the Work 
-by You to the Licensor shall be under the terms and conditions of 
-this License, without any additional terms or conditions. 
-Notwithstanding the above, nothing herein shall supersede or modify 
-the terms of any separate license agreement you may have executed 
-with Licensor regarding such Contributions. 
-
-6. Trademarks. This License does not grant permission to use the trade 
-names, trademarks, service marks, or product names of the Licensor, 
-except as required for reasonable and customary use in describing the 
-origin of the Work and reproducing the content of the NOTICE file. 
-
-7. Disclaimer of Warranty. Unless required by applicable law or 
-agreed to in writing, Licensor provides the Work (and each 
-Contributor provides its Contributions) on an "AS IS" BASIS, 
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
-implied, including, without limitation, any warranties or conditions 
-of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 
-PARTICULAR PURPOSE. You are solely responsible for determining the 
-appropriateness of using or redistributing the Work and assume any 
-risks associated with Your exercise of permissions under this License. 
-
-8. Limitation of Liability. In no event and under no legal theory, 
-whether in tort (including negligence), contract, or otherwise, 
-unless required by applicable law (such as deliberate and grossly 
-negligent acts) or agreed to in writing, shall any Contributor be 
-liable to You for damages, including any direct, indirect, special, 
-incidental, or consequential damages of any character arising as a 
-result of this License or out of the use or inability to use the 
-Work (including but not limited to damages for loss of goodwill, 
-work stoppage, computer failure or malfunction, or any and all 
-other commercial damages or losses), even if such Contributor 
-has been advised of the possibility of such damages. 
-
-9. Accepting Warranty or Additional Liability. While redistributing 
-the Work or Derivative Works thereof, You may choose to offer, 
-and charge a fee for, acceptance of support, warranty, indemnity, 
-or other liability obligations and/or rights consistent with this 
-License. However, in accepting such obligations, You may act only 
-on Your own behalf and on Your sole responsibility, not on behalf 
-of any other Contributor, and only if You agree to indemnify, 
-defend, and hold each Contributor harmless for any liability 
-incurred by, or claims asserted against, such Contributor by reason 
-of your accepting any such warranty or additional liability. 
-
-END OF TERMS AND CONDITIONS 
-
-APPENDIX: How to apply the Apache License to your work. 
-
-To apply the Apache License to your work, attach the following 
-boilerplate notice, with the fields enclosed by brackets "[]" 
-replaced with your own identifying information. (Don't include 
-the brackets!) The text should be enclosed in the appropriate 
-comment syntax for the file format. We also recommend that a 
-file or class name and description of purpose be included on the 
-same "printed page" as the copyright notice for easier 
-identification within third-party archives. 
-
-Copyright [yyyy] [name of copyright owner] 
-
-Licensed under the Apache License, Version 2.0 (the "License"); 
-you may not use this file except in compliance with the License. 
-You may obtain a copy of the License at 
-
-http://www.apache.org/licenses/LICENSE-2.0 
-
-Unless required by applicable law or agreed to in writing, software 
-distributed under the License is distributed on an "AS IS" BASIS, 
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-See the License for the specific language governing permissions and 
-limitations under the License.
index c6e80c0..9176cad 100644 (file)
@@ -1 +1,4 @@
-SUBDIRS=ico-app-framework apps_controller src test
+SUBDIRS=       \
+       lib     \
+       src     \
+       tests
diff --git a/apps_controller/Makefile.am b/apps_controller/Makefile.am
deleted file mode 100644 (file)
index a10c2b1..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-noinst_LIBRARIES = libico_syc-apc.a
-
-includedir = /usr/include/ico-uxf-weston-plugin
-
-libico_syc_apc_a_CFLAGS = -I/usr/include/ico-uxf-weston-plugin -I../include $(EFL_CFLAGS) @DBUS_CFLAGS@ @GLIB_CFLAGS@
-libico_syc_apc_a_SOURCES =          \
-       ico_syc_apc_control.c           \
-       ico_syc_apc_regulation.c
-
-AM_CFLAGS = $(GCC_CFLAGS)
-AM_CPPFLAGS = $(GCC_CFLAGS)    \
-       -DDATADIR='"$(datadir)"'                \
-       -DMODULEDIR='"$(moduledir)"'            \
-       -DLIBEXECDIR='"$(libexecdir)"'
-
-AM_LDFLAGS = -module -avoid-version -rpath $(libdir) -lwayland-egl -lEGL -lGLESv2
-
-.FORCE :
-
diff --git a/apps_controller/ico_syc_apc_control.c b/apps_controller/ico_syc_apc_control.c
deleted file mode 100644 (file)
index 4a1d9f9..0000000
+++ /dev/null
@@ -1,2911 +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   Initialize/Terminate and Control for Apps Controller of System Controller
- *
- * @date    Feb-28-2013
- */
-
-#include    <stdio.h>
-#include    <stdlib.h>
-#include    <unistd.h>
-#include    <stdbool.h>
-#include    <string.h>
-#include    <errno.h>
-#include    <pthread.h>
-#include    <sys/ioctl.h>
-#include    <sys/time.h>
-#include    <sys/resource.h>
-#include    <fcntl.h>
-
-#include    <wayland-client.h>
-#include    <ico_window_mgr-client-protocol.h>
-#include    <dbus/dbus.h>
-#include    <Ecore.h>
-#include    "ico_apf.h"
-#include    "ico_uxf.h"
-#include    "ico_apf_ecore.h"
-#include    "ico_syc_apc.h"
-#include    "ico_syc_apc_private.h"
-
-/*==============================================================================*/
-/* static tables                                                                */
-/*==============================================================================*/
-/* flag for initiailze                  */
-static int  ico_apps_controller_init = 0;
-
-/* zone management table                */
-static ico_apc_dispzone_t       *dispzone = NULL;
-static int                      ndispzone = 0;
-static ico_apc_soundzone_t      *soundzone = NULL;
-static int                      nsoundzone = 0;
-static ico_apc_inputsw_t        *inputsw = NULL;
-static int                      ninputsw = 0;
-
-/* free request save table              */
-static ico_apc_request_t        *free_request = NULL;
-
-/* user(HomeScreen) control functions   */
-static ico_apc_resource_control_t   displaycontrol = NULL;
-static ico_apc_resource_control_t   soundcontrol = NULL;
-static ico_apc_resource_control_t   inputcontrol = NULL;
-
-/* Ecore timer                          */
-static int  timer_count = 0;
-static Ecore_Timer *ecore_timer = NULL;
-
-/* configuration                        */
-static Ico_Uxf_Sys_Config       *confsys = NULL;
-static Ico_Uxf_App_Config       *confapp = NULL;
-
-/*==============================================================================*/
-/* define static function prototype                                             */
-/*==============================================================================*/
-static void resource_reqcb(ico_apf_resource_notify_info_t* info, void *user_data);
-static void app_getdisplay(ico_apc_request_t *req, const int addprio);
-static void app_freedisplay(ico_apc_request_t *req, const int send);
-static void change_disprequest(ico_apc_request_t *req, const int active);
-static void recalc_dispzone(const int idx);
-static void app_getsound(ico_apc_request_t *req, const int addprio);
-static void app_freesound(ico_apc_request_t *req, const int send);
-static void change_soundrequest(ico_apc_request_t *req, const int active);
-static void recalc_soundzone(const int idx);
-static void app_getinput(ico_apc_request_t *req, const int addprio);
-static void app_freeinput(ico_apc_request_t *req, const int send);
-static void change_inputrequest(ico_apc_request_t *req, const int active);
-static void recalc_inputsw(const int idx);
-static void regulation_listener(const int appcategory,
-                                const ico_apc_reguration_control_t control,
-                                void *user_data);
-static Eina_Bool request_timer(void *user_data);
-static void app_display_hook(const char *appid, const int surface, const int object);
-static ico_apc_request_t *get_freereq(void);
-static ico_apc_request_t *search_disprequest(const Ico_Uxf_conf_application *conf,
-                                             const int resid, const int id);
-static ico_apc_request_t *search_soundrequest(const Ico_Uxf_conf_application *conf,
-                                              const int resid, const int id,
-                                              ico_apc_request_t **first_req);
-
-/*==============================================================================*/
-/* define fixed value                                                           */
-/*==============================================================================*/
-/* initiale allocate request blocks     */
-#define INIT_REQCB  50
-
-/* maximum number of request blocks     */
-#if ICO_UXF_DISPLAY_ZONE_MAX > ICO_UXF_SOUND_ZONE_MAX
-  #if ICO_UXF_INPUT_SW_MAX > ICO_UXF_DISPLAY_ZONE_MAX
-    #define MAXREQ  ICO_UXF_INPUT_SW_MAX
-  #else
-    #define MAXREQ  ICO_UXF_DISPLAY_ZONE_MAX
-  #endif
-#else
-  #if ICO_UXF_INPUT_SW_MAX > ICO_UXF_SOUND_ZONE_MAX
-    #define MAXREQ  ICO_UXF_INPUT_SW_MAX
-  #else
-    #define MAXREQ  ICO_UXF_SOUND_ZONE_MAX
-  #endif
-#endif
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   get_appconf: application configure(static function)
- *
- * @param       appid           application id
- * @return      result
- * @retval      != NULL         success(request block address)
- * @retval      == NULL         error(out of memory)
- */
-/*--------------------------------------------------------------------------*/
-static Ico_Uxf_conf_application *
-get_appconf(const char *appid)
-{
-    Ico_Uxf_conf_application *appconf = NULL;
-
-    appconf = (Ico_Uxf_conf_application *)ico_uxf_getAppByAppid(appid);
-    if (! appconf)  {
-        /* application id dose not exist, search application name   */
-        appconf = (Ico_Uxf_conf_application *)ico_uxf_getAppByName(appid);
-    }
-
-    return appconf;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   get_freereq: get free request block(static function)
- *
- * @param       none
- * @return      result
- * @retval      != NULL         success(request block address)
- * @retval      == NULL         error(out of memory)
- */
-/*--------------------------------------------------------------------------*/
-static ico_apc_request_t *
-get_freereq(void)
-{
-    ico_apc_request_t   *req;
-    int     i;
-
-    if (! free_request)   {
-        free_request = malloc(sizeof(ico_apc_request_t)*ICO_UXF_MNG_BLOCK_ALLOCS);
-        if (! free_request)  {
-            apfw_error("get_freereq: No Memory");
-            return NULL;
-        }
-        req = free_request;
-        for (i = 0; i < ICO_UXF_MNG_BLOCK_ALLOCS; i++, req++)   {
-            if (i < (ICO_UXF_MNG_BLOCK_ALLOCS-1))   {
-                req->next = (req+1);
-            }
-            else    {
-                req->next = NULL;
-            }
-        }
-    }
-    req = free_request;
-    memset(req, 0, sizeof(ico_apc_request_t));
-    free_request = free_request->next;
-
-    return req;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   search_disprequest: search client display request(static function)
- *
- * @param[in]   conf            application configuration
- * @param[in]   resid           resource type
- * @param[in]   id              resource id requested from client
- * @return      result
- * @retval      != NULL         success(request block)
- * @retval      == NULL         error(request was not found)
- */
-/*--------------------------------------------------------------------------*/
-static ico_apc_request_t *
-search_disprequest(const Ico_Uxf_conf_application *conf, const int resid, const int id)
-{
-    int                 i;
-    ico_apc_request_t   *p;
-    ico_apc_request_t   *sameres = NULL;
-
-    for (i = 0; i < ndispzone; i++) {
-        p = dispzone[i].req;
-        while (p)   {
-            if ((strcmp(p->appid, conf->appid) == 0) &&
-                ((int)p->resid == resid))    {
-                if ((id < 0) || (p->id == id))  {
-                    return p;
-                }
-                if (! sameres)  sameres = p;
-            }
-            p = p->next;
-        }
-    }
-    return sameres;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   search_soundrequest: search client sound request(static function)
- *
- * @param[in]   conf            application configuration
- * @param[in]   resid           resource type
- * @param[in]   id              resource id requested from client
- * @param[out]  first_req       request of top on same sound zone
- * @return      result
- * @retval      != NULL         success(request block)
- * @retval      == NULL         error(request was not found)
- */
-/*--------------------------------------------------------------------------*/
-static ico_apc_request_t *
-search_soundrequest(const Ico_Uxf_conf_application *conf, const int resid,
-                    const int id, ico_apc_request_t **first_req)
-{
-    int                 i;
-    ico_apc_request_t   *p;
-    ico_apc_request_t   *sameres = NULL;
-
-    for (i = 0; i < nsoundzone; i++) {
-        p = soundzone[i].req;
-        while (p)   {
-            if ((strcmp(p->appid, conf->appid) == 0) &&
-                ((int)p->resid == resid))    {
-                if ((id < 0) || (p->id == id))  {
-                    if (first_req)  {
-                        *first_req = soundzone[i].req;
-                    }
-                    return p;
-                }
-                if (! sameres)  sameres = p;
-            }
-            p = p->next;
-        }
-    }
-    return sameres;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   resource_reqcb: resource request callback(static function)
- *
- * @param[in]   info            request information
- * @param[in]   user_data       user data(unused)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-resource_reqcb(ico_apf_resource_notify_info_t* info, void *user_data)
-{
-    Ico_Uxf_conf_application    *appconf;
-    ico_apc_request_t           *req;
-    ico_apc_request_t           *p;
-    ico_apc_request_t           *freq;
-    int                         i;
-    int                         count;
-    ico_apc_request_t           *reqsave[MAXREQ];
-
-    apfw_trace("resource_reqcb: Entry(cmd=%d res=%d id=%d bid=%d app=%s[%d])",
-               info->state, info->resid, info->id, info->bid, info->appid, info->pid);
-
-    if (info->state == ICO_APF_RESOURCE_STATE_CONNECTED)    {
-        apfw_trace("resource_reqcb: Leave(application connected)");
-        return;
-    }
-
-    if (info->state >= ICO_APF_SOUND_COMMAND_MIN)   {
-        /* Multi Sound Manager, data check          */
-        if ((int)info->state == (int)ICO_APF_SOUND_REPLY_LIST)  {
-            apfw_trace("resource_reqcb: Leave(Sound Reply, no need)");
-            return;
-        }
-        if (info->appid[0] == 0)    {
-            apfw_warn("resource_reqcb: Leave(Sound Event, but no appid)");
-            return;
-        }
-        if ((int)info->state == (int)ICO_APF_SOUND_EVENT_FREE)  {
-            apfw_trace("resource_reqcb: Leave(Sound Free, no need)");
-            return;
-        }
-    }
-
-    /* check and search application id      */
-    appconf = (Ico_Uxf_conf_application *)ico_uxf_getAppByAppid(info->appid);
-    if (! appconf)  {
-        /* application id dose not exist, search application name   */
-        appconf = (Ico_Uxf_conf_application *)ico_uxf_getAppByName(info->appid);
-        if (! appconf)  {
-            apfw_error("resource_reqcb: Leave(appid[%s] dose not exist)", info->appid);
-            return;
-        }
-    }
-    if ((info->state >= ICO_APF_SOUND_COMMAND_MIN) &&
-        ((confsys->kind[appconf->kindId].priv == ICO_UXF_PRIVILEGE_ALMIGHTY) ||
-         (confsys->kind[appconf->kindId].priv == ICO_UXF_PRIVILEGE_SYSTEM) ||
-         (confsys->kind[appconf->kindId].priv == ICO_UXF_PRIVILEGE_SYSTEM_AUDIO)))  {
-        /* System Program(ex. HomeScreen) no need resource control  */
-        apfw_trace("resource_reqcb: Leave(appid[%s] is system program)", info->appid);
-        return;
-    }
-
-    if (info->state == ICO_APF_RESOURCE_STATE_DISCONNECTED) {
-        apfw_trace("resource_reqcb: DISCONNECTED[%s]", info->appid);
-
-        /* free all screen request from this application    */
-        count = 0;
-        for (i = 0; i < ndispzone; i++) {
-            p = dispzone[i].req;
-            while (p)   {
-                if (strcmp(p->appid, appconf->appid) == 0) {
-                    reqsave[count++] = p;
-                }
-                p = p->next;
-            }
-        }
-        for (i = 0; i < count; i++) {
-            app_freedisplay(reqsave[i], 0);
-        }
-        /* free all sound request from this application     */
-        count = 0;
-        for (i = 0; i < nsoundzone; i++)    {
-            p = soundzone[i].req;
-            while (p)   {
-                if (strcmp(p->appid, appconf->appid) == 0) {
-                    reqsave[count++] = p;
-                }
-                p = p->next;
-            }
-        }
-        for (i = 0; i < count; i++) {
-            app_freesound(reqsave[i], 0);
-        }
-        /* free all input switch request from this application*/
-        count = 0;
-        for (i = 0; i < ninputsw; i++)  {
-            p = inputsw[i].req;
-            while (p)   {
-                if (strcmp(p->appid, appconf->appid) == 0) {
-                    reqsave[count++] = p;
-                }
-                p = p->next;
-            }
-        }
-        for (i = 0; i < count; i++) {
-            app_freeinput(reqsave[i], 0);
-        }
-        apfw_trace("resource_reqcb: Leave");
-        return;
-    }
-
-    req = get_freereq();
-    if (! req)  {
-        return;
-    }
-    strncpy(req->appid, appconf->appid, ICO_UXF_MAX_PROCESS_NAME);
-    req->resid = info->resid;
-    if (info->device[0])    {
-        strcpy(req->device, info->device);
-    }
-    else    {
-        strcpy(req->device, "UnKnown");
-    }
-    req->id = info->id;
-    req->bid = info->bid;
-    req->pid = info->pid;
-    req->reqtype = ICO_APC_REQTYPE_REQUEST;
-
-    switch (info->resid)    {
-    case ICO_APF_RESID_BASIC_SCREEN:                /* basic screen             */
-        switch (info->state)    {
-        case ICO_APF_RESOURCE_COMMAND_GET:          /* get resource             */
-            apfw_trace("resource_reqcb: app(%s) get BasicScreen(%d)",
-                       info->appid, info->id);
-            app_getdisplay(req, 0);
-            req = NULL;
-            break;
-        case ICO_APF_RESOURCE_COMMAND_RELEASE:      /* release resource         */
-            apfw_trace("resource_reqcb: app(%s) release BasicScreen(%d)",
-                       info->appid, info->id);
-            app_freedisplay(req, 1);
-            req = NULL;
-            break;
-        case ICO_APF_RESOURCE_REPLY_OK:             /* ack reply                */
-        case ICO_APF_RESOURCE_REPLY_NG:             /* nak reply                */
-            apfw_trace("resource_reqcb: app(%s) BasicScreen(%d) reply(%s)", info->appid,
-                       info->id, info->state == ICO_APF_RESOURCE_REPLY_OK ? "OK" : "NG");
-            p = search_disprequest(appconf, ICO_APF_RESID_BASIC_SCREEN, info->id);
-            if (p)  {
-                if (p->state & ICO_APC_REQSTATE_REPLYACTIVE)    {
-                    ico_uxf_window_control(appconf->appid, p->id,
-                                           ICO_UXF_APPSCTL_INVISIBLE, 0);
-                    if (displaycontrol) {
-                        (*displaycontrol)(appconf, 1);
-                    }
-                }
-                else    {
-                    apfw_trace("resource_reqcb: request state not ReplyActive(%x)", p->state);
-                }
-                p->state &= ~(ICO_APC_REQSTATE_REPLYACTIVE|ICO_APC_REQSTATE_REPLYQUIET);
-                p->timer = 0;
-            }
-            else    {
-                apfw_warn("resource_reqcb: app(%s) resource(%d) dose not exist",
-                          info->appid, info->id);
-            }
-            break;
-        default:
-            apfw_error("resource_reqcb: illegal command(%d)", info->state);
-            break;
-        }
-        break;
-    case ICO_APF_RESID_INT_SCREEN:                  /* interrupt screen         */
-        switch (info->state)    {
-        case ICO_APF_RESOURCE_COMMAND_GET:          /* get resource             */
-            apfw_trace("resource_reqcb: app(%s) get IntScreen(%d) on basic screen(%d)",
-                       info->appid, info->id, info->bid);
-            app_getdisplay(req, ICO_UXF_PRIO_INTSCREEN);
-            req = NULL;
-            break;
-        case ICO_APF_RESOURCE_COMMAND_RELEASE:      /* release resource         */
-            apfw_trace("resource_reqcb: app(%s) release IntScreen(%d)",
-                       info->appid, info->id);
-            app_freedisplay(req, 1);
-            req = NULL;
-            break;
-        case ICO_APF_RESOURCE_REPLY_OK:             /* ack reply                */
-        case ICO_APF_RESOURCE_REPLY_NG:             /* nak reply                */
-            apfw_trace("resource_reqcb: app(%s) IntScreen(%d) reply(%s)", info->appid,
-                       info->id, info->state == ICO_APF_RESOURCE_REPLY_OK ? "OK" : "NG");
-            p = search_disprequest(appconf, ICO_APF_RESID_INT_SCREEN, info->id);
-            if (p)  {
-                if (p->state & ICO_APC_REQSTATE_REPLYACTIVE)    {
-                    ico_uxf_window_control(appconf->appid, p->id,
-                                           ICO_UXF_APPSCTL_INVISIBLE, 0);
-                    if (displaycontrol) {
-                        (*displaycontrol)(appconf, 1);
-                    }
-                }
-                p->state &= ~(ICO_APC_REQSTATE_REPLYACTIVE|ICO_APC_REQSTATE_REPLYQUIET);
-                p->timer = 0;
-            }
-            break;
-        default:
-            apfw_error("resource_reqcb: illegal command(%d)", info->state);
-            break;
-        }
-        break;
-    case ICO_APF_RESID_ON_SCREEN:                   /* on screen                */
-        switch (info->state)    {
-        case ICO_APF_RESOURCE_COMMAND_GET:          /* get resource             */
-            apfw_trace("resource_reqcb: app(%s) get OnScreen(%d)",
-                       info->appid, info->id);
-            app_getdisplay(req, ICO_UXF_PRIO_ONSCREEN);
-            req = NULL;
-            break;
-        case ICO_APF_RESOURCE_COMMAND_RELEASE:      /* release resource         */
-            apfw_trace("resource_reqcb: app(%s) release OnScreen(%d)",
-                       info->appid, info->id);
-            app_freedisplay(req, 1);
-            req = NULL;
-            break;
-        case ICO_APF_RESOURCE_REPLY_OK:             /* ack reply                */
-        case ICO_APF_RESOURCE_REPLY_NG:             /* nak reply                */
-            apfw_trace("resource_reqcb: app(%s) OnScreen(%d) reply(%s)", info->appid,
-                       info->id, info->state == ICO_APF_RESOURCE_REPLY_OK ? "OK" : "NG");
-            p = search_disprequest(appconf, ICO_APF_RESID_ON_SCREEN, info->id);
-            if (p)  {
-                if (p->state & ICO_APC_REQSTATE_REPLYACTIVE)    {
-                    ico_uxf_window_control(appconf->appid, p->id,
-                                           ICO_UXF_APPSCTL_INVISIBLE, 0);
-                    if (displaycontrol) {
-                        (*displaycontrol)(appconf, 1);
-                    }
-                }
-                p->state &= ~(ICO_APC_REQSTATE_REPLYACTIVE|ICO_APC_REQSTATE_REPLYQUIET);
-                p->timer = 0;
-            }
-            break;
-        default:
-            apfw_error("resource_reqcb: illegal command(%d)", info->state);
-            break;
-        }
-        break;
-    case ICO_APF_RESID_BASIC_SOUND:                 /* basic sound              */
-        switch ((int)info->state)    {
-        case ICO_APF_RESOURCE_COMMAND_GET:          /* get resource             */
-            apfw_trace("resource_reqcb: app(%s) get BasicSound(%d)",
-                       info->appid, info->id);
-            app_getsound(req, 0);
-            req = NULL;
-            break;
-        case ICO_APF_RESOURCE_COMMAND_RELEASE:      /* release resource         */
-            apfw_trace("resource_reqcb: app(%s) release BasicSound(%d)",
-                       info->appid, info->id);
-            app_freesound(req, 1);
-            req = NULL;
-            break;
-        case ICO_APF_RESOURCE_REPLY_OK:             /* ack reply                */
-        case ICO_APF_RESOURCE_REPLY_NG:             /* nak reply                */
-            apfw_trace("resource_reqcb: app(%s) BasicSound(%d) reply(%s)", info->appid,
-                       info->id, info->state == ICO_APF_RESOURCE_REPLY_OK ? "OK" : "NG");
-            p = search_soundrequest(appconf, ICO_APF_RESID_BASIC_SOUND, info->id, NULL);
-            if (p)  {
-                if (p->state & ICO_APC_REQSTATE_REPLYACTIVE)    {
-                    if (ico_apf_resource_send_to_soundctl(ICO_APF_SOUND_COMMAND_MUTEOFF,
-                                                          p->pid)
-                            != ICO_APF_RESOURCE_E_NONE) {
-                        apfw_warn("resource_reqcb: send MSM Error");
-                    }
-                    if (soundcontrol) {
-                        (*soundcontrol)(get_appconf(req->appid), 1);
-                    }
-                }
-                p->state &= ~(ICO_APC_REQSTATE_REPLYACTIVE|ICO_APC_REQSTATE_REPLYQUIET);
-                p->timer = 0;
-            }
-            break;
-        case ICO_APF_SOUND_EVENT_NEW:               /* create new sound stream  */
-            apfw_trace("resource_reqcb: app(%s) create BasicSound", info->appid);
-            p = search_soundrequest(appconf, ICO_APF_RESID_BASIC_SOUND, -1, &freq);
-            if (p)  {
-                apfw_trace("resource_reqcb: app(%s,state=%x,prio=%08x,pid=%d=>%d) "
-                           "requested sound, Nop", p->appid, p->state, p->prio,
-                           p->pid, info->pid);
-                p->pid = info->pid;
-                if (p->state & ICO_APC_REQSTATE_WAITREQ)    {
-                    if (ico_apf_resource_send_to_soundctl(ICO_APF_SOUND_COMMAND_MUTEON,
-                                                          p->pid)
-                            != ICO_APF_RESOURCE_E_NONE) {
-                        apfw_warn("resource_reqcb: send MSM Error");
-                    }
-                    if (soundcontrol) {
-                        (*soundcontrol)(get_appconf(p->appid), 0);
-                    }
-                    if ((freq->state & ICO_APC_REQSTATE_WAITREQ) == 0)  {
-                        if (ico_apf_resource_send_to_soundctl(ICO_APF_SOUND_COMMAND_MUTEOFF,
-                                                              freq->pid)
-                                    != ICO_APF_RESOURCE_E_NONE) {
-                            apfw_warn("resource_reqcb: send MSM Error");
-                        }
-                        if (soundcontrol) {
-                            (*soundcontrol)(get_appconf(freq->appid), 1);
-                        }
-                    }
-                }
-            }
-            else    {
-                apfw_trace("resource_reqcb: app(%s) not requested sound", info->appid);
-                req->resid = ICO_APF_RESID_BASIC_SOUND;
-                req->reqtype = ICO_APC_REQTYPE_CREATE;
-                strcpy(req->device,
-                       confsys->sound[confsys->misc.default_soundId].
-                            zone[confsys->misc.default_soundId].name);
-                app_getsound(req, 0);
-                req = NULL;
-            }
-            break;
-        default:
-            apfw_error("resource_reqcb: illegal command(%d)", info->state);
-            break;
-        }
-        break;
-    case ICO_APF_RESID_INT_SOUND:                   /* interrupt sound          */
-        switch (info->state)    {
-        case ICO_APF_RESOURCE_COMMAND_GET:          /* get resource             */
-            apfw_trace("resource_reqcb: app(%s) get IntSound(%d)",
-                       info->appid, info->id);
-            app_getsound(req, ICO_UXF_PRIO_ONSCREEN);
-            req = NULL;
-            break;
-        case ICO_APF_RESOURCE_COMMAND_RELEASE:      /* release resource         */
-            apfw_trace("resource_reqcb: app(%s) release IntSound(%d)",
-                       info->appid, info->id);
-            app_freesound(req, 1);
-            req = NULL;
-            break;
-        case ICO_APF_RESOURCE_REPLY_OK:             /* ack reply                */
-        case ICO_APF_RESOURCE_REPLY_NG:             /* nak reply                */
-            apfw_trace("resource_reqcb: app(%s) IntSound(%d) reply(%s)", info->appid,
-                       info->id, info->state == ICO_APF_RESOURCE_REPLY_OK ? "OK" : "NG");
-            p = search_soundrequest(appconf, ICO_APF_RESID_INT_SOUND, info->id, NULL);
-            if (p)  {
-                if (p->state & ICO_APC_REQSTATE_REPLYACTIVE)    {
-                    if (ico_apf_resource_send_to_soundctl(ICO_APF_SOUND_COMMAND_MUTEOFF,
-                                                          p->pid)
-                            != ICO_APF_RESOURCE_E_NONE) {
-                        apfw_warn("resource_reqcb: send MSM Error");
-                    }
-                    if (soundcontrol) {
-                        (*soundcontrol)(get_appconf(p->appid), 1);
-                    }
-                }
-                p->state &= ~(ICO_APC_REQSTATE_REPLYACTIVE|ICO_APC_REQSTATE_REPLYQUIET);
-                p->timer = 0;
-            }
-            break;
-        default:
-            apfw_error("resource_reqcb: illegal command(%d)", info->state);
-            break;
-        }
-        break;
-    case ICO_APF_RESID_INPUT_DEV:                   /* input switch             */
-        if ((info->id < 0) || (info->id >= appconf->inputdevNum))   {
-            apfw_error("resource_reqcb: app(%s) cmd=%d InputSW(%d) but no exist",
-                       info->appid, info->state, info->id);
-        }
-        else    {
-            switch (info->state)    {
-            case ICO_APF_RESOURCE_COMMAND_ADD:      /* get switch               */
-                apfw_trace("resource_reqcb: app(%s) get InputSW(%d)",
-                           info->appid, info->id);
-                app_getinput(req, 0);
-                req = NULL;
-                break;
-            case ICO_APF_RESOURCE_COMMAND_CHANGE:   /* change switch            */
-                apfw_trace("resource_reqcb: app(%s) change InputSW(%d)",
-                           info->appid, info->id);
-                app_getinput(req, 0);
-                req = NULL;
-                break;
-            case ICO_APF_RESOURCE_COMMAND_DELETE:   /* delete switch            */
-                apfw_trace("resource_reqcb: app(%s) delete InputSW(%d)",
-                           info->appid, info->id);
-                app_freeinput(req, 1);
-                req = NULL;
-                break;
-            default:
-                apfw_error("resource_reqcb: illegal command(%d)", info->state);
-                break;
-            }
-        }
-        break;
-    default:
-        apfw_error("resource_reqcb: illegal resource(%d)", info->resid);
-        break;
-    }
-    if (req)    {
-        req->next = free_request;
-        free_request = req;
-    }
-    apfw_trace("resource_reqcb: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   app_getdisplay: get display zone resource(static function)
- *
- * @param[in]   req             request block
- * @param[in]   addprio         a priority to add to the priority of the request
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-app_getdisplay(ico_apc_request_t *req, const int addprio)
-{
-    int     prio;
-    int     i, j;
-    Ico_Uxf_conf_application    *conf = (Ico_Uxf_conf_application *)get_appconf(req->appid);
-    ico_apc_dispzone_t          *czone;
-    ico_apc_request_t           *p;
-    ico_apc_request_t           *bp;
-    ico_apc_request_t           *defp;
-
-    /* priority     */
-    prio = getpriority(PRIO_PROCESS, req->pid);
-    if (prio > 19)          prio = 19;
-    else if (prio < -20)    prio = -20;
-    prio = confsys->category[conf->categoryId].priority * ICO_UXF_PRIO_CATEGORY + 19 - prio;
-    prio += addprio;
-    if (ico_syc_apc_regulation_app_visible(conf->categoryId))   {
-        prio |= ICO_UXF_PRIO_REGULATION;
-    }
-    if (ico_uxf_process_is_active(conf->appid)) {
-        for (i = 0; i < ndispzone; i++) {
-            p = dispzone[i].req;
-            while (p)   {
-                if (p->prio & ICO_UXF_PRIO_ACTIVEAPP)  {
-                    p->prio -= ICO_UXF_PRIO_ACTIVECOUNT;
-                }
-                p = p->next;
-            }
-        }
-        prio |= ICO_UXF_PRIO_ACTIVEAPP;
-    }
-
-    /* get display zone from device name        */
-    for (i = 0; i < ndispzone; i++) {
-        if (strcasecmp(dispzone[i].conf->name, req->device) == 0)  break;
-    }
-    if (i >= ndispzone) {
-        i = confsys->misc.default_dispzoneId;
-        apfw_trace("app_getdisplay: Entry(app=%s zone=%s(%s none) res=%d prio=%x(+%x))",
-                   conf->appid, dispzone[i].conf->name, req->resid, req->device,
-                   prio, addprio);
-    }
-    else    {
-        apfw_trace("app_getdisplay: Entry(app=%s zone=%s res=%d prio=%x(+%x))",
-                   conf->appid, dispzone[i].conf->name, req->resid, prio, addprio);
-    }
-    req->zoneidx = i;
-
-    czone = &dispzone[i];
-
-    /* search same request          */
-    p = czone->req;
-    bp = NULL;
-    defp = NULL;
-    for (i = 0; i < ndispzone; i++) {
-        p = dispzone[i].req;
-        while (p)   {
-            if ((strcmp(p->appid, req->appid) == 0) && (p->resid == req->resid))    {
-                if (p->zoneidx == req->zoneidx) break;
-                if ((req->reqtype == ICO_APC_REQTYPE_REQUEST) &&
-                    (defp == NULL) && (p->reqtype != ICO_APC_REQTYPE_REQUEST))  {
-                    apfw_trace("app_getdisplay: Found default request");
-                    defp = p;
-                }
-            }
-            bp = p;
-            p = p->next;
-        }
-        if (p)  break;
-    }
-    if ((p == NULL) && (defp != NULL))  {
-        apfw_trace("app_getdisplay: change zone %s=>%s",
-                   dispzone[defp->zoneidx].conf->name, dispzone[req->zoneidx].conf->name);
-        app_freedisplay(defp, 0);
-    }
-    if (p)  {
-        if (req->reqtype != ICO_APC_REQTYPE_REQUEST)  {
-            apfw_trace("app_getdisplay: Leave(found same request)");
-            return;
-        }
-
-        if (p->prio > prio) {
-            prio = p->prio;
-        }
-        apfw_trace("app_getdisplay: found same request(app=%s zone=%s res=%d prio=%d)",
-                   conf->appid, dispzone[i].conf->name, req->resid, prio);
-        if (bp) {
-            bp->next = p->next;
-        }
-        else    {
-            czone->req = p->next;
-        }
-        p->next = free_request;
-        free_request = p;
-    }
-
-    /* link request to zone table   */
-    req->prio = prio;
-    p = czone->req;
-    bp = NULL;
-    while (p)   {
-        if (p->prio <= prio)    break;
-        bp = p;
-        p = p->next;
-    }
-    if (bp) {
-        req->next = bp->next;
-        bp->next = req;
-        apfw_trace("app_getdisplay: app(%s) set after(%s) of zone(%s)",
-                   conf->appid, bp->appid, req->device);
-    }
-    else    {
-        req->next = czone->req;
-        czone->req = req;
-        apfw_trace("app_getdisplay: app(%s) set top of zone(%s) next %s",
-                   conf->appid, req->device, req->next ? req->next->appid : "(NULL)");
-    }
-
-    /* check if maximum priority    */
-    if (! bp)   {
-        j = -1;
-        for (i = 0; i < czone->noverlap; i++)    {
-            if (((czone->overlap[i])->req != NULL) &&
-                ((czone->overlap[i])->req->prio > prio))    {
-                j = i;
-                prio = czone->overlap[i]->req->prio;
-            }
-        }
-    }
-    else    {
-        j = 9999;
-    }
-    if ((j >= 0) || ((req->prio & ICO_UXF_PRIO_REGULATION) == 0))   {
-        /* lower priority, waitting this application.           */
-        /* insert application to zone application list and      */
-        /* change zone priority, if request application is top priority */
-        req->state |= ICO_APC_REQSTATE_WAITREQ;
-        if (j >= 0) {
-            /* lower priority       */
-            apfw_trace("app_getdisplay: priority low, waitting %s", conf->appid);
-            ico_uxf_window_control(conf->appid, req->id, ICO_UXF_APPSCTL_INVISIBLE, 1);
-            if (displaycontrol) {
-                (*displaycontrol)(conf, 0);
-            }
-        }
-        if ((req->prio & ICO_UXF_PRIO_REGULATION) == 0) {
-            /* regulation control   */
-            apfw_trace("app_getdisplay: regulation, waitting %s", conf->appid);
-            ico_uxf_window_control(conf->appid, req->id, ICO_UXF_APPSCTL_REGULATION, 1);
-            if ((j < 0) && (displaycontrol)) {
-                (*displaycontrol)(conf, 0);
-            }
-        }
-        if (req->reqtype == ICO_APC_REQTYPE_REQUEST)    {
-            if (ico_apf_resource_send_to_client(
-                    conf->appid, ICO_APF_RESOURCE_STATE_WAITTING,
-                    req->resid, req->device, req->id) != ICO_APF_RESOURCE_E_NONE)   {
-                apfw_warn("app_getdisplay: Leave(send(%s) Error)", conf->appid);
-            }
-            else    {
-                req->state &= ~ICO_APC_REQSTATE_REPLYACTIVE;
-                req->state |= ICO_APC_REQSTATE_REPLYQUIET;
-                req->timer = ICO_APC_REQREPLY_MAXTIME;
-                timer_count ++;
-            }
-        }
-    }
-    else    {
-        /* maximum priority, ok             */
-        apfw_trace("app_getdisplay: priority heigh");
-        if (req->reqtype == ICO_APC_REQTYPE_REQUEST)    {
-            if (ico_apf_resource_send_to_client(
-                        conf->appid, ICO_APF_RESOURCE_STATE_ACQUIRED,
-                        req->resid, req->device, req->id) != ICO_APF_RESOURCE_E_NONE) {
-                apfw_warn("app_getdisplay: Leave(send(%s) Error)", conf->appid);
-                ico_uxf_window_control(conf->appid, req->id, ICO_UXF_APPSCTL_INVISIBLE, 0);
-                if (displaycontrol) {
-                    (*displaycontrol)(conf, 1);
-                }
-            }
-            else    {
-                req->state &= ~ICO_APC_REQSTATE_REPLYQUIET;
-                req->state |= ICO_APC_REQSTATE_REPLYACTIVE;
-                req->timer = ICO_APC_REQREPLY_MAXTIME;
-                timer_count ++;
-            }
-        }
-        else    {
-            ico_uxf_window_control(conf->appid, req->id, ICO_UXF_APPSCTL_INVISIBLE, 0);
-            if (displaycontrol) {
-                (*displaycontrol)(conf, 1);
-            }
-        }
-        /* send change event to invisible application   */
-        apfw_trace("app_getdisplay: next=%08x %s next_state=%x",
-                   req->next, req->next ? req->next->appid : " ",
-                   req->next ? req->next->state : 0x9999);
-        if ((req->next) && ((req->next->state & ICO_APC_REQSTATE_WAITREQ) == 0))  {
-            p = req->next;
-        }
-        else    {
-            p = NULL;
-        }
-        /* send all waitting applications   */
-        i = 0;
-        while (1)   {
-            if (p != NULL)  {
-                if ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0)   {
-                    p->state |= ICO_APC_REQSTATE_WAITREQ;
-                    apfw_trace("app_getdisplay: overlaped(%s), waitting", p->appid);
-                    if (p->reqtype == ICO_APC_REQTYPE_REQUEST)  {
-                        if (ico_apf_resource_send_to_client(
-                                p->appid, ICO_APF_RESOURCE_STATE_DEPRIVED,
-                                p->resid, p->device, p->id) != ICO_APF_RESOURCE_E_NONE) {
-                            apfw_warn("app_getdisplay: send(%s) Error)", p->appid);
-                        }
-                        else    {
-                            req->state &= ~ICO_APC_REQSTATE_REPLYACTIVE;
-                            p->state |= ICO_APC_REQSTATE_REPLYQUIET;
-                            p->timer = ICO_APC_REQREPLY_MAXTIME;
-                            timer_count ++;
-                        }
-                    }
-                    ico_uxf_window_control(p->appid, -1, ICO_UXF_APPSCTL_INVISIBLE, 1);
-                    if (displaycontrol) {
-                        (*displaycontrol)(get_appconf(p->appid), 0);
-                    }
-                }
-            }
-            if (i >= czone->noverlap)   break;
-            p = czone->overlap[i]->req;
-            i ++;
-        }
-    }
-    apfw_trace("app_getdisplay: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   app_freedisplay: free display zone resource(static function)
- *
- * @param[in]   req             request block
- * @param[in]   send            send release event to client(1=send/0=no send)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-app_freedisplay(ico_apc_request_t *req, const int send)
-{
-    int     idx;
-    Ico_Uxf_conf_application    *conf = get_appconf(req->appid);
-    ico_apc_dispzone_t          *czone;
-    ico_apc_request_t           *p;
-    ico_apc_request_t           *bp;
-
-    apfw_trace("app_freedisplay: Entry(app=%s)", req->appid);
-
-    czone = &dispzone[req->zoneidx];
-    idx = czone->conf->display->id;
-
-    ico_uxf_window_control(conf->appid, req->id, ICO_UXF_APPSCTL_INVISIBLE, 0);
-    if (displaycontrol) {
-        (*displaycontrol)(conf, 0);
-    }
-    if ((send !=0) && (req->reqtype == ICO_APC_REQTYPE_REQUEST))   {
-        (void) ico_apf_resource_send_to_client(
-                                req->appid, ICO_APF_RESOURCE_STATE_RELEASED,
-                                req->resid, req->device, req->id);
-    }
-
-    /* find request                     */
-    p = czone->req;
-    bp = NULL;
-    while (p)   {
-        if (p == req)   break;
-        bp = p;
-        p = p->next;
-    }
-    if (! p)    {
-        apfw_warn("app_freedisplay: Leave(request dose not exist)");
-        return;
-    }
-
-    /* release request table from zone table    */
-    if (bp) {
-        bp->next = p->next;
-
-        /* request is waitted, no need other control*/
-        p->next = free_request;
-        free_request = p;
-        apfw_trace("app_freedisplay: Leave(request waited)");
-        return;
-    }
-    czone->req = p->next;
-    p->next = free_request;
-    free_request = p;
-
-    /* recalculate visible zone         */
-    recalc_dispzone(idx);
-
-    apfw_trace("app_freedisplay: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   change_disprequest: change display zone resource(static function)
- *
- * @param[in]   req             request block
- * @param[in]   active          active(1) or inactive(0)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-change_disprequest(ico_apc_request_t *req, const int active)
-{
-    apfw_trace("change_disprequest: %s change to %s(%s)", active ? "active" : "inactive",
-               dispzone[req->zoneidx].conf->name, req->appid);
-
-    req->state &= ~(ICO_APC_REQSTATE_REPLYACTIVE|ICO_APC_REQSTATE_REPLYQUIET);
-
-    if (req->reqtype == ICO_APC_REQTYPE_REQUEST)   {
-        if (ico_apf_resource_send_to_client(
-                        req->appid,
-                        active ? ICO_APF_RESOURCE_STATE_ACQUIRED :
-                                 ICO_APF_RESOURCE_STATE_DEPRIVED,
-                        req->resid, req->device, req->id) != ICO_APF_RESOURCE_E_NONE) {
-            apfw_warn("change_disprequest: send(%s) Error", req->appid);
-        }
-        else    {
-            req->state |= (active ? ICO_APC_REQSTATE_REPLYACTIVE :
-                                    ICO_APC_REQSTATE_REPLYQUIET);
-            req->timer = ICO_APC_REQREPLY_MAXTIME;
-            timer_count ++;
-        }
-    }
-    if ((req->state & ICO_APC_REQSTATE_REPLYACTIVE) == 0)   {
-        ico_uxf_window_control(req->appid, req->id, ICO_UXF_APPSCTL_INVISIBLE,
-                               active ? 0 : 1);
-        if (displaycontrol) {
-            (*displaycontrol)(get_appconf(req->appid), active);
-        }
-    }
-    if (active)   {
-        req->state &= ~ICO_APC_REQSTATE_WAITREQ;
-    }
-    else    {
-        req->state |= ICO_APC_REQSTATE_WAITREQ;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   recalc_dispzone: calculate all display zone request priority(static function)
- *
- * @param[in]   idx         display index number
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-recalc_dispzone(const int idx)
-{
-    int     i;
-    int     prio;
-    ico_apc_dispzone_t  *czone;
-    ico_apc_dispzone_t  *czone2;
-    ico_apc_request_t   *p;
-    Ico_Uxf_conf_display *disp = &confsys->display[idx];
-
-    apfw_trace("recalc_dispzone: Enter(disp=%s)", disp->name);
-
-    /* get top of priority of this display  */
-    prio = -1;
-    czone2 = NULL;
-    for (i = 0; i < disp->zoneNum; i++)    {
-        czone = &dispzone[disp->zone[i].zoneidx];
-        p = czone->req;
-        if (! p)    continue;
-        p->state |= ICO_APC_REQSTATE_WAITPROC;
-        if (p->prio > prio)    {
-            czone2 = czone;
-            prio = p->prio;
-        }
-    }
-    if (czone2 == NULL) {
-        /* no visible zone, end         */
-        apfw_trace("recalc_dispzone: Leave(no request)");
-        return;
-    }
-    if ((czone2->req->state & ICO_APC_REQSTATE_WAITREQ) == 0)   {
-        /* not unvisible zone           */
-        for (i = 0; i < disp->zoneNum; i++)    {
-            czone = &dispzone[disp->zone[i].zoneidx];
-            p = czone->req;
-            if (! p)    continue;
-            p->state &= ~ICO_APC_REQSTATE_WAITPROC;
-        }
-        apfw_trace("recalc_dispzone: Leave(%s no need visible control)",
-                   czone2->req->appid);
-        return;
-    }
-
-    /* change to show for top priority  */
-    p = czone2->req;
-    p->state &= ~ICO_APC_REQSTATE_WAITPROC;
-    change_disprequest(p, 1);
-
-    /* hide overlap zone                */
-    for (i = 0; i < czone2->noverlap; i++)  {
-        p = czone2->overlap[i]->req;
-        if (p)    {
-            if ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0) {
-                change_disprequest(p, 0);
-            }
-            p->state &= ~ICO_APC_REQSTATE_WAITPROC;
-        }
-    }
-
-    /* show not overlap zone            */
-    for (i = 0; i < disp->zoneNum; i++)    {
-        czone = &dispzone[disp->zone[i].zoneidx];
-        p = czone->req;
-        if ((p == NULL) || ((p->state & ICO_APC_REQSTATE_WAITPROC) == 0))   continue;
-        p->state &= ~ICO_APC_REQSTATE_WAITPROC;
-        change_disprequest(p, 1);
-    }
-    apfw_trace("recalc_dispzone: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   app_getsound: get sound zone resource(static function)
- *
- * @param[in]   req             request block
- * @param[in]   addprio         a priority to add to the priority of the request
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-app_getsound(ico_apc_request_t *req, const int addprio)
-{
-    int     prio;
-    int     i, j;
-    Ico_Uxf_conf_application    *conf = get_appconf(req->appid);
-    ico_apc_soundzone_t         *czone;
-    ico_apc_request_t           *p;
-    ico_apc_request_t           *bp;
-
-    /* priority     */
-    prio = getpriority(PRIO_PROCESS, req->pid);
-    if (prio > 19)          prio = 19;
-    else if (prio < -20)    prio = -20;
-    prio = (confsys->category[conf->categoryId].priority * ICO_UXF_PRIO_CATEGORY) + 19 - prio;
-    prio += addprio;
-    if (ico_syc_apc_regulation_app_sound(conf->categoryId)) {
-        prio |= ICO_UXF_PRIO_REGULATION;
-    }
-    if (ico_uxf_process_is_active(conf->appid)) {
-        for (i = 0; i < nsoundzone; i++) {
-            p = soundzone[i].req;
-            while (p)   {
-                if (p->prio & ICO_UXF_PRIO_ACTIVEAPP)  {
-                    p->prio -= ICO_UXF_PRIO_ACTIVECOUNT;
-                }
-                p = p->next;
-            }
-        }
-        prio |= ICO_UXF_PRIO_ACTIVEAPP;
-    }
-
-    /* get sound zone from device name      */
-    for (i = 0; i < nsoundzone; i++) {
-        if (strcasecmp(soundzone[i].conf->name, req->device) == 0)  break;
-    }
-    if (i >= nsoundzone) {
-        i = confsys->misc.default_soundzoneId;
-        apfw_trace("app_getsound: Entry(app=%s zone=%s(%s none) prio=%x(+%x) pid=%d)",
-                   conf->appid, soundzone[i].conf->name, req->device, prio, addprio,
-                   req->pid);
-    }
-    else    {
-        apfw_trace("app_getsound: Entry(app=%s zone=%s prio=%x(+%x) pid=%d)",
-                   conf->appid, soundzone[i].conf->name, prio, addprio, req->pid);
-    }
-    req->zoneidx = i;
-
-    czone = &soundzone[i];
-
-    /* search same request          */
-    p = czone->req;
-    bp = NULL;
-    while (p)   {
-        if ((strcmp(p->appid, req->appid) == 0) && (p->resid == req->resid) &&
-            (p->zoneidx == req->zoneidx))   {
-            break;
-        }
-        bp = p;
-        p = p->next;
-    }
-    if (p)  {
-        if (req->reqtype != ICO_APC_REQTYPE_REQUEST)  {
-            apfw_trace("app_getsound: Leave(found same request)");
-            return;
-        }
-
-        if (p->prio > prio) {
-            prio = p->prio;
-        }
-        apfw_trace("app_getsound: found same request(app=%s zone=%s res=%d prio=%d)",
-                   conf->appid, soundzone[i].conf->name, req->resid, prio);
-        if (bp) {
-            bp->next = p->next;
-        }
-        else    {
-            czone->req = p->next;
-        }
-        p->next = free_request;
-        free_request = p;
-    }
-
-    /* link request to zone table   */
-    req->prio = prio;
-    p = czone->req;
-    bp = NULL;
-    while (p)   {
-        if (p->prio <= prio)    break;
-        bp = p;
-        p = p->next;
-    }
-    if (bp) {
-        req->next = bp->next;
-        bp->next = req;
-    }
-    else    {
-        req->next = czone->req;
-        czone->req = req;
-    }
-
-    /* check if maximum priority    */
-    if (! bp)   {
-        j = -1;
-        for (i =0; i < czone->noverlap; i++)    {
-            if (((czone->overlap[i])->req != NULL) &&
-                ((czone->overlap[i])->req->prio > prio))    {
-                j = i;
-                prio = czone->overlap[i]->req->prio;
-            }
-        }
-    }
-    else    {
-        j = 9999;
-    }
-    if ((j >= 0) || ((req->prio & ICO_UXF_PRIO_REGULATION) == 0))   {
-        /* lower priority, waitting this application.           */
-        /* insert application to zone application list and      */
-        /* change zone priority, if request application is top priority */
-        req->state |= ICO_APC_REQSTATE_WAITREQ;
-        if (ico_apf_resource_send_to_soundctl(ICO_APF_SOUND_COMMAND_MUTEON, req->pid)
-                != ICO_APF_RESOURCE_E_NONE) {
-            apfw_warn("app_getsound: send MSM Error");
-        }
-        if (soundcontrol) {
-            (*soundcontrol)(conf, 0);
-        }
-        apfw_trace("app_getsound: priority low, waitting %s", conf->appid);
-        if (req->reqtype == ICO_APC_REQTYPE_REQUEST)    {
-            if (ico_apf_resource_send_to_client(
-                    conf->appid, ICO_APF_RESOURCE_STATE_WAITTING,
-                    req->resid, req->device, req->id) != ICO_APF_RESOURCE_E_NONE)   {
-                apfw_warn("app_getsound: Leave(send(%s) Error)", conf->appid);
-            }
-            else    {
-                req->state |= ICO_APC_REQSTATE_REPLYQUIET;
-                req->timer = ICO_APC_REQREPLY_MAXTIME;
-                timer_count ++;
-            }
-        }
-    }
-    else    {
-        /* maximum priority, ok             */
-        apfw_trace("app_getsound: priority heigh(%08x)", req->prio);
-        if (req->reqtype == ICO_APC_REQTYPE_REQUEST)    {
-            if (ico_apf_resource_send_to_client(
-                        conf->appid, ICO_APF_RESOURCE_STATE_ACQUIRED,
-                        req->resid, req->device, req->id) != ICO_APF_RESOURCE_E_NONE) {
-                apfw_warn("app_getsound: Leave(send(%s) Error)", conf->appid);
-            }
-        }
-        /* send change event to mute application    */
-        apfw_trace("app_getsound: next=%08x %s next_state=%x",
-                   req->next, req->next ? req->next->appid : " ",
-                   req->next ? req->next->state : 0x9999);
-        if ((req->next) && ((req->next->state & ICO_APC_REQSTATE_WAITREQ) == 0))  {
-            p = req->next;
-        }
-        else    {
-            p = NULL;
-        }
-        /* send all waitting applications   */
-        i = 0;
-        while (1)   {
-            if (p != NULL)  {
-                if ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0)   {
-                    p->state |= ICO_APC_REQSTATE_WAITREQ;
-                    apfw_trace("app_getsound: overlaped(%s), waitting", p->appid);
-                    if (p->reqtype == ICO_APC_REQTYPE_REQUEST)  {
-                        if (ico_apf_resource_send_to_client(
-                                p->appid, ICO_APF_RESOURCE_STATE_DEPRIVED,
-                                p->resid, p->device, p->id) != ICO_APF_RESOURCE_E_NONE) {
-                            apfw_warn("app_getsound: send(%s) Error)", p->appid);
-                        }
-                        else    {
-                            p->state |= ICO_APC_REQSTATE_REPLYQUIET;
-                            p->timer = ICO_APC_REQREPLY_MAXTIME;
-                            timer_count ++;
-                        }
-                    }
-                }
-                if (ico_apf_resource_send_to_soundctl(ICO_APF_SOUND_COMMAND_MUTEON, p->pid)
-                        != ICO_APF_RESOURCE_E_NONE) {
-                    apfw_warn("app_getsound: send MSM Error");
-                }
-                if (soundcontrol) {
-                    (*soundcontrol)(get_appconf(p->appid), 0);
-                }
-            }
-            if (i >= czone->noverlap)   break;
-            p = czone->overlap[i]->req;
-            i ++;
-        }
-    }
-    apfw_trace("app_getsound: Leave(req=%08x,state=%x,prio=%08x)",
-               (int)req, req->state, req->prio);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   app_freesound: free sound zone resource(static function)
- *
- * @param[in]   req             request block
- * @param[in]   send            send release event to client(1=send/0=no send)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-app_freesound(ico_apc_request_t *req, const int send)
-{
-    int     idx;
-    Ico_Uxf_conf_application    *conf = get_appconf(req->appid);
-    ico_apc_soundzone_t         *czone;
-    ico_apc_request_t           *p;
-    ico_apc_request_t           *bp;
-
-    apfw_trace("app_freesound: Entry(app=%s)", req->appid);
-
-    czone = &soundzone[req->zoneidx];
-    idx = czone->conf->sound->id;
-
-    if (ico_apf_resource_send_to_soundctl(ICO_APF_SOUND_COMMAND_MUTEON, req->pid)
-                != ICO_APF_RESOURCE_E_NONE) {
-        apfw_warn("app_freesound: send MSM Error");
-    }
-    if (soundcontrol) {
-        (*soundcontrol)(conf, 0);
-    }
-    if ((send !=0) && (req->reqtype == ICO_APC_REQTYPE_REQUEST))   {
-        (void) ico_apf_resource_send_to_client(
-                                req->appid, ICO_APF_RESOURCE_STATE_RELEASED,
-                                req->resid, req->device, req->id);
-    }
-
-    /* find request                     */
-    p = czone->req;
-    bp = NULL;
-    while (p)   {
-        if (p == req)   break;
-        bp = p;
-        p = p->next;
-    }
-    if (! p)    {
-        apfw_warn("app_freesound: Leave(request dose not exist)");
-        return;
-    }
-
-    /* release request table from zone table    */
-    if (bp) {
-        bp->next = p->next;
-
-        /* request is waitted, no need other control*/
-        p->next = free_request;
-        free_request = p;
-        apfw_trace("app_freesound: Leave(request waited)");
-        return;
-    }
-    czone->req = p->next;
-    p->next = free_request;
-    free_request = p;
-
-    /* recalculate visible zone         */
-    recalc_soundzone(idx);
-
-    apfw_trace("app_freesound: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   change_soundrequest: change sound zone resource(static function)
- *
- * @param[in]   req             request block
- * @param[in]   active          active(1) or quiet(0)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-change_soundrequest(ico_apc_request_t *req, const int active)
-{
-    apfw_trace("change_soundrequest: change to %s(%s)", active ? "active" : "quiet",
-               req->appid);
-
-    req->state &= ~(ICO_APC_REQSTATE_REPLYACTIVE|ICO_APC_REQSTATE_REPLYQUIET);
-
-    if (req->reqtype == ICO_APC_REQTYPE_REQUEST)   {
-        if (ico_apf_resource_send_to_client(
-                        req->appid,
-                        active ? ICO_APF_RESOURCE_STATE_ACQUIRED :
-                                 ICO_APF_RESOURCE_STATE_DEPRIVED,
-                        req->resid, req->device, req->id) != ICO_APF_RESOURCE_E_NONE) {
-            apfw_warn("change_soundrequest: send(%s) Error", req->appid);
-        }
-        else    {
-            req->state |= (active ? ICO_APC_REQSTATE_REPLYACTIVE :
-                                    ICO_APC_REQSTATE_REPLYQUIET);
-            req->timer = ICO_APC_REQREPLY_MAXTIME;
-            timer_count ++;
-        }
-    }
-    if ((req->state & ICO_APC_REQSTATE_REPLYACTIVE) == 0)   {
-        if (ico_apf_resource_send_to_soundctl(
-                    active ? ICO_APF_SOUND_COMMAND_MUTEOFF : ICO_APF_SOUND_COMMAND_MUTEON,
-                    req->pid) != ICO_APF_RESOURCE_E_NONE)   {
-            apfw_warn("change_soundrequest: send MSM Error");
-        }
-        if (soundcontrol) {
-            (*soundcontrol)(get_appconf(req->appid), active);
-        }
-    }
-    if (active)   {
-        req->state &= ~ICO_APC_REQSTATE_WAITREQ;
-    }
-    else    {
-        req->state |= ICO_APC_REQSTATE_WAITREQ;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   recalc_soundzone: calculate all sound zone request priority(static function)
- *
- * @param[in]   idx         sound index number
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-recalc_soundzone(const int idx)
-{
-    int     i;
-    int     prio;
-    ico_apc_soundzone_t *czone;
-    ico_apc_soundzone_t *czone2;
-    ico_apc_request_t   *p;
-    Ico_Uxf_conf_sound  *sound = &confsys->sound[idx];
-
-    apfw_trace("recalc_soundzone: Enter(sound=%s)", sound->name);
-
-    /* get top of priority of this sound  */
-    prio = -1;
-    czone2 = NULL;
-    for (i = 0; i < sound->zoneNum; i++)    {
-        czone = &soundzone[sound->zone[i].zoneidx];
-        p = czone->req;
-        if (! p)    continue;
-        p->state |= ICO_APC_REQSTATE_WAITPROC;
-        if (p->prio > prio)    {
-            czone2 = czone;
-            prio = p->prio;
-        }
-    }
-    if (czone2 == NULL) {
-        /* no active zone, end          */
-        apfw_trace("recalc_soundzone: Leave(no request)");
-        return;
-    }
-    if ((czone2->req->state & ICO_APC_REQSTATE_WAITREQ) == 0)   {
-        /* not quiet zone               */
-        for (i = 0; i < sound->zoneNum; i++)    {
-            czone = &soundzone[sound->zone[i].zoneidx];
-            p = czone->req;
-            if (! p)    continue;
-            p->state &= ~ICO_APC_REQSTATE_WAITPROC;
-        }
-        apfw_trace("recalc_soundzone: Leave(%s no need sound control)",
-                   czone2->req->appid);
-        return;
-    }
-
-    /* change to active for top priority*/
-    p = czone2->req;
-    p->state &= ~ICO_APC_REQSTATE_WAITPROC;
-    if (p->prio & ICO_UXF_PRIO_REGULATION)  {
-        apfw_trace("recalc_soundzone: Start %s(prio=%08x and no regulation)",
-                   p->appid, p->prio);
-        change_soundrequest(p, 1);
-    }
-
-    /* mute overlap zone                */
-    for (i = 0; i < czone2->noverlap; i++)  {
-        p = czone2->overlap[i]->req;
-        if (p)    {
-            if ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0) {
-                if (p->prio & ICO_UXF_PRIO_REGULATION)  {
-                    apfw_trace("recalc_soundzone: Overlap Stop %s(top and no regulation)",
-                               p->appid);
-                    change_soundrequest(p, 0);
-                }
-                else    {
-                    p->state |= ICO_APC_REQSTATE_WAITREQ;
-                }
-            }
-            p->state &= ~ICO_APC_REQSTATE_WAITPROC;
-        }
-    }
-
-    /* reset mute not overlap zone      */
-    for (i = 0; i < sound->zoneNum; i++)    {
-        czone = &soundzone[sound->zone[i].zoneidx];
-        p = czone->req;
-        if ((p == NULL) || ((p->state & ICO_APC_REQSTATE_WAITPROC) == 0))   continue;
-        p->state &= ~ICO_APC_REQSTATE_WAITPROC;
-        if (p->state & ICO_APC_REQSTATE_WAITREQ)    {
-            if (p->prio & ICO_UXF_PRIO_REGULATION)  {
-                apfw_trace("recalc_soundzone: Overlap Start %s(top and no regulation)",
-                           p->appid);
-                change_soundrequest(p, 1);
-            }
-        }
-    }
-    apfw_trace("recalc_soundzone: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   app_getinput: get input switch resource(static function)
- *
- * @param[in]   req             request block
- * @param[in]   addprio         a priority to add to the priority of the request
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-app_getinput(ico_apc_request_t *req, const int addprio)
-{
-    int     prio;
-    int     i;
-    Ico_Uxf_conf_application    *conf = get_appconf(req->appid);
-    ico_apc_inputsw_t           *czone;
-    ico_apc_request_t           *p;
-    ico_apc_request_t           *bp;
-
-    /* priority     */
-    prio = getpriority(PRIO_PROCESS, req->pid);
-    if (prio > 19)          prio = 19;
-    else if (prio < -20)    prio = -20;
-    prio = (confsys->category[conf->categoryId].priority * ICO_UXF_PRIO_CATEGORY) + 19 - prio;
-    prio += addprio;
-    if (ico_syc_apc_regulation_app_input(conf->categoryId)) {
-        prio |= ICO_UXF_PRIO_REGULATION;
-    }
-    if (ico_uxf_process_is_active(conf->appid)) {
-        for (i = 0; i < ninputsw; i++) {
-            p = inputsw[i].req;
-            while (p)   {
-                if (p->prio & ICO_UXF_PRIO_ACTIVEAPP)  {
-                    p->prio -= ICO_UXF_PRIO_ACTIVECOUNT;
-                }
-                p = p->next;
-            }
-        }
-        prio |= ICO_UXF_PRIO_ACTIVEAPP;
-    }
-
-    /* get input switch from device name    */
-    for (i = 0; i < ninputsw; i++) {
-        if (strcasecmp(inputsw[i].inputsw->swname, req->device) == 0)  break;
-    }
-    if (i >= ninputsw) {
-        i = confsys->misc.default_inputswId;
-        apfw_trace("app_getinput: Entry(app=%s inputsw=%s(%s none) prio=%x(+%x) pid=%d)",
-                   conf->appid, inputsw[i].inputsw->swname, req->device, prio, addprio,
-                   req->pid);
-    }
-    else    {
-        apfw_trace("app_getinput: Entry(app=%s zone=%s prio=%x(+%x) pid=%d)",
-                   conf->appid, inputsw[i].inputsw->swname, prio, addprio, req->pid);
-    }
-    req->zoneidx = i;
-
-    czone = &inputsw[i];
-
-    /* search same request          */
-    p = czone->req;
-    bp = NULL;
-    while (p)   {
-        if ((strcmp(p->appid, req->appid) == 0) && (p->resid == req->resid) &&
-            (p->zoneidx == req->zoneidx))   {
-            break;
-        }
-        bp = p;
-        p = p->next;
-    }
-    if (p)  {
-        if (p->reqtype != ICO_APC_REQTYPE_REQUEST)  {
-            apfw_trace("app_getinput: Leave(found same request)");
-            return;
-        }
-
-        if (p->prio > prio) {
-            prio = p->prio;
-        }
-        apfw_trace("app_getinput: found same request(app=%s sw=%s res=%d prio=%d)",
-                   conf->appid, inputsw[i].inputsw->swname, req->resid, prio);
-        if (bp) {
-            bp->next = p->next;
-        }
-        else    {
-            czone->req = p->next;
-        }
-        p->next = free_request;
-        free_request = p;
-    }
-
-    /* link request to zone table   */
-    req->prio = prio;
-    p = czone->req;
-    bp = NULL;
-    while (p)   {
-        if (p->prio <= prio)    break;
-        bp = p;
-        p = p->next;
-    }
-    if (bp) {
-        req->next = bp->next;
-        bp->next = req;
-    }
-    else    {
-        req->next = czone->req;
-        czone->req = req;
-    }
-
-    if ((req->prio & ICO_UXF_PRIO_REGULATION) == 0) {
-        /* lower priority, waitting this application.           */
-        /* insert application to zone application list and      */
-        /* change zone priority, if request application is top priority */
-        req->state |= ICO_APC_REQSTATE_WAITREQ;
-        if (ico_uxf_input_control(0, req->appid, czone->inputdev->device,
-                                  czone->inputsw->input, 0) != ICO_UXF_EOK)    {
-            apfw_warn("app_getinput: send MIM Error");
-        }
-        if (inputcontrol) {
-            (*inputcontrol)(conf, 0);
-        }
-        apfw_trace("app_getinput: priority low, waitting %s", conf->appid);
-        if (req->reqtype == ICO_APC_REQTYPE_REQUEST)    {
-            if (ico_apf_resource_send_to_client(
-                    conf->appid, ICO_APF_RESOURCE_STATE_WAITTING,
-                    req->resid, req->device, req->id) != ICO_APF_RESOURCE_E_NONE)   {
-                apfw_warn("app_getinput: Leave(send(%s) Error)", conf->appid);
-            }
-            else    {
-                req->state |= ICO_APC_REQSTATE_REPLYQUIET;
-                req->timer = ICO_APC_REQREPLY_MAXTIME;
-                timer_count ++;
-            }
-        }
-    }
-    else    {
-        /* maximum priority, ok             */
-        apfw_trace("app_getinput: priority heigh(%08x)", req->prio);
-        if (req->reqtype == ICO_APC_REQTYPE_REQUEST)    {
-            if (ico_apf_resource_send_to_client(
-                        conf->appid, ICO_APF_RESOURCE_STATE_ACQUIRED,
-                        req->resid, req->device, req->id) != ICO_APF_RESOURCE_E_NONE) {
-                apfw_warn("app_getinput: Leave(send(%s) Error)", conf->appid);
-            }
-            else    {
-                req->state |= ICO_APC_REQSTATE_REPLYACTIVE;
-                req->timer = ICO_APC_REQREPLY_MAXTIME;
-                timer_count ++;
-            }
-        }
-        if (ico_uxf_input_control(1, req->appid, czone->inputdev->device,
-                                  czone->inputsw->input, 0) != ICO_UXF_EOK)    {
-            apfw_warn("app_getinput: send MIM Error");
-        }
-        /* change lower priority stateus            */
-        if ((req->next) && ((req->next->state & ICO_APC_REQSTATE_WAITREQ) == 0))  {
-            p = req->next;
-            p->state |= ICO_APC_REQSTATE_WAITREQ;
-            apfw_trace("app_getinput: lower priority(%s), waitting", p->appid);
-            if (p->reqtype == ICO_APC_REQTYPE_REQUEST)  {
-                if (ico_apf_resource_send_to_client(
-                            p->appid, ICO_APF_RESOURCE_STATE_DEPRIVED,
-                            p->resid, p->device, p->id) != ICO_APF_RESOURCE_E_NONE) {
-                    apfw_warn("app_getinput: send(%s) Error)", p->appid);
-                }
-                else    {
-                    p->state |= ICO_APC_REQSTATE_REPLYQUIET;
-                    p->timer = ICO_APC_REQREPLY_MAXTIME;
-                    timer_count ++;
-                }
-            }
-        }
-    }
-    apfw_trace("app_getinput: Leave(req=%08x,state=%x,prio=%08x)",
-               (int)req, req->state, req->prio);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   app_freeinput: free input switch resource(static function)
- *
- * @param[in]   req             request block
- * @param[in]   send            send release event to client(1=send/0=no send)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-app_freeinput(ico_apc_request_t *req, const int send)
-{
-    Ico_Uxf_conf_application    *conf = get_appconf(req->appid);
-    ico_apc_inputsw_t           *czone;
-    ico_apc_request_t           *p;
-    ico_apc_request_t           *bp;
-
-    apfw_trace("app_freeinput: Entry(app=%s)", req->appid);
-
-    czone = &inputsw[req->zoneidx];
-
-    if (ico_uxf_input_control(0, conf->appid, czone->inputdev->device,
-                              czone->inputsw->input, 0) != ICO_UXF_EOK)    {
-        apfw_warn("app_freeinput: send MIM Error");
-    }
-    if (inputcontrol) {
-        (*inputcontrol)(conf, 0);
-    }
-    if ((send !=0) && (req->reqtype == ICO_APC_REQTYPE_REQUEST))   {
-        (void) ico_apf_resource_send_to_client(
-                                req->appid, ICO_APF_RESOURCE_STATE_RELEASED,
-                                req->resid, req->device, req->id);
-    }
-
-    /* find request                     */
-    p = czone->req;
-    bp = NULL;
-    while (p)   {
-        if (p == req)   break;
-        bp = p;
-        p = p->next;
-    }
-    if (! p)    {
-        apfw_warn("app_freeinput: Leave(request dose not exist)");
-        return;
-    }
-
-    /* release request table from zone table    */
-    if (bp) {
-        bp->next = p->next;
-
-        /* request is waitted, no need other control*/
-        p->next = free_request;
-        free_request = p;
-        apfw_trace("app_freeinput: Leave(request waited)");
-        return;
-    }
-    czone->req = p->next;
-    p->next = free_request;
-    free_request = p;
-
-    /* recalculate visible zone         */
-    recalc_inputsw(czone->inputsw->input);
-
-    apfw_trace("app_freeinput: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   change_inputrequest: change input switch resource(static function)
- *
- * @param[in]   req             request block
- * @param[in]   active          use(1) or unuse(0)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-change_inputrequest(ico_apc_request_t *req, const int active)
-{
-    ico_apc_inputsw_t       *czone;
-
-    apfw_trace("change_inputrequest: change to %s(%s)", active ? "use" : "unuse",
-               req->appid);
-
-    czone = &inputsw[req->zoneidx];
-
-    if (req->reqtype == ICO_APC_REQTYPE_REQUEST)   {
-        if (ico_apf_resource_send_to_client(
-                        req->appid,
-                        active ? ICO_APF_RESOURCE_STATE_ACQUIRED :
-                                 ICO_APF_RESOURCE_STATE_DEPRIVED,
-                        req->resid, req->device, req->id) != ICO_APF_RESOURCE_E_NONE) {
-            apfw_warn("change_inputrequest: send(%s) Error", req->appid);
-        }
-        else    {
-            req->state |= (active ? ICO_APC_REQSTATE_REPLYACTIVE :
-                                    ICO_APC_REQSTATE_REPLYQUIET);
-            req->timer = ICO_APC_REQREPLY_MAXTIME;
-            timer_count ++;
-        }
-    }
-    if (ico_uxf_input_control(active, req->appid, czone->inputdev->device,
-                              czone->inputsw->input, 0) != ICO_UXF_EOK)    {
-        apfw_warn("app_getinput: send MIM Error");
-    }
-    if (inputcontrol) {
-        (*inputcontrol)(get_appconf(req->appid), active);
-    }
-    if (active)   {
-        req->state &= ~ICO_APC_REQSTATE_WAITREQ;
-        req->state |= ICO_APC_REQSTATE_REPLYACTIVE;
-    }
-    else    {
-        req->state |= (ICO_APC_REQSTATE_WAITREQ | ICO_APC_REQSTATE_REPLYQUIET);
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   recalc_inputsw: calculate all input switch request priority(static function)
- *
- * @param[in]   idx         input switch index number
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-recalc_inputsw(const int idx)
-{
-    ico_apc_inputsw_t   *czone = &inputsw[idx];
-    ico_apc_request_t   *p;
-
-    apfw_trace("recalc_inputsw: Enter(input=%s)", czone->inputsw->swname);
-
-    /* get top of priority of this input    */
-    p = czone->req;
-    if (p == NULL) {
-        /* no active request, end           */
-        apfw_trace("recalc_inputsw: Leave(no request)");
-        return;
-    }
-    if ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0)   {
-        /* not wait request                 */
-        apfw_trace("recalc_inputsw: Leave(%s no need input control)", p->appid);
-        return;
-    }
-
-    /* change to active for top priority*/
-    p->state &= ~ICO_APC_REQSTATE_WAITPROC;
-    if (p->prio & ICO_UXF_PRIO_REGULATION)  {
-        apfw_trace("recalc_inputsw: Start %s(prio=%08x and no regulation)",
-                   p->appid, p->prio);
-        change_inputrequest(p, 1);
-    }
-
-    apfw_trace("recalc_inputsw: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   regulation_listener: change regulation callback(static function)
- *
- * @param[in]   appcategory     category Id
- * @param[in]   control         control(display/sound/input active/inactive)
- * @param[in]   user_data       user data(unused)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-regulation_listener(const int appcategory,
-                    const ico_apc_reguration_control_t control, void *user_data)
-{
-    int     i, j, k;
-    int     flag;
-    int     disp, sound, input;
-    ico_apc_request_t   *p;
-    ico_apc_request_t   *bp;
-    ico_apc_request_t   *p2;
-    ico_apc_request_t   *bp2;
-    unsigned short  reqdisp[MAXREQ];
-    unsigned short  reqsound[MAXREQ];
-    unsigned short  reqinput[MAXREQ];
-
-    disp = 0;
-    sound = 0;
-    input = 0;
-
-    confapp = (Ico_Uxf_App_Config *)ico_uxf_getAppConfig();
-
-    if (control.display != ICO_SYC_APC_REGULATION_NOCHANGE) {
-        /* display regulation control       */
-        apfw_trace("regulation_listener: disp category=%d display=%d",
-                   appcategory, control.display);
-        for (i = 0; i < confapp->applicationNum; i++)   {
-            if (confapp->application[i].categoryId != appcategory)  continue;
-            for (k = 0; k < ndispzone; k++) {
-                p = dispzone[k].req;
-                if (!p) continue;
-                bp = NULL;
-                while (p)   {
-                    if (strcmp(p->appid, confapp->application[i].appid) == 0)    {
-                        flag = 0;
-                        if (control.display == ICO_SYC_APC_REGULATION_REGULATION)   {
-                            if (p->prio & ICO_UXF_PRIO_REGULATION)  {
-                                p->prio &= ~ICO_UXF_PRIO_REGULATION;
-                                flag ++;
-                                ico_uxf_window_control(p->appid, p->id,
-                                                       ICO_UXF_APPSCTL_REGULATION, 1);
-                            }
-                        }
-                        else    {
-                            if ((p->prio & ICO_UXF_PRIO_REGULATION) == 0)   {
-                                p->prio |= ICO_UXF_PRIO_REGULATION;
-                                flag ++;
-                                ico_uxf_window_control(p->appid, p->id,
-                                                       ICO_UXF_APPSCTL_REGULATION, 0);
-                            }
-                        }
-                        if (flag)   {
-                            for (j = 0; j < disp; j++)  {
-                                if (dispzone[k].conf->display->id == reqdisp[j])    break;
-                            }
-                            if (j >= disp)  {
-                                reqdisp[disp++] = dispzone[k].conf->display->id;
-                            }
-                            apfw_trace("regulation_listener: disp %s %08x",
-                                       p->appid, p->prio);
-                            if (bp) {
-                                bp->next = p->next;
-                            }
-                            else    {
-                                dispzone[k].req = p->next;
-                            }
-                            p2 = dispzone[k].req;
-                            bp2 = NULL;
-                            while (p2)  {
-                                if (p2->prio < p->prio) {
-                                    if (bp2)    {
-                                        bp2->next = p;
-                                        p->next = p2;
-                                        if ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0) {
-                                            change_disprequest(p, 0);
-                                        }
-                                    }
-                                    else    {
-                                        p->next = dispzone[k].req;
-                                        dispzone[k].req = p;
-                                        if ((p->next != NULL) &&
-                                            ((p->next->state & ICO_APC_REQSTATE_WAITREQ)
-                                                == 0)) {
-                                            change_disprequest(p->next, 0);
-                                        }
-                                    }
-                                    break;
-                                }
-                                bp2 = p2;
-                                p2 = p2->next;
-                            }
-                            if (! p2)   {
-                                if (bp2)    {
-                                    bp2->next = p;
-                                    if ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0) {
-                                        change_disprequest(p, 0);
-                                    }
-                                }
-                                else    {
-                                    dispzone[k].req = p;
-                                }
-                                p->next = NULL;
-                            }
-                            break;
-                        }
-                    }
-                    bp = p;
-                    p = p->next;
-                }
-            }
-        }
-    }
-
-    if (control.sound != ICO_SYC_APC_REGULATION_NOCHANGE) {
-        /* sound regulation control         */
-        apfw_trace("regulation_listener: sound category=%d sound=%d",
-                   appcategory, control.sound);
-        for (i = 0; i < confapp->applicationNum; i++)   {
-            if (confapp->application[i].categoryId != appcategory)  continue;
-            for (k = 0; k < nsoundzone; k++)    {
-                p = soundzone[k].req;
-                if (!p) continue;
-                bp = NULL;
-                while (p)   {
-                    if (strcmp(p->appid, confapp->application[i].appid) == 0)    {
-                        flag = 0;
-                        if (control.sound == ICO_SYC_APC_REGULATION_REGULATION) {
-                            if (p->prio & ICO_UXF_PRIO_REGULATION)  {
-                                p->prio &= ~ICO_UXF_PRIO_REGULATION;
-                                flag ++;
-                                if ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0) {
-                                    change_soundrequest(p, 0);
-                                }
-                            }
-                        }
-                        else    {
-                            if ((p->prio & ICO_UXF_PRIO_REGULATION) == 0)   {
-                                p->prio |= ICO_UXF_PRIO_REGULATION;
-                                flag ++;
-                            }
-                        }
-                        if (flag)   {
-                            apfw_trace("regulation_listener: sound change category=%d "
-                                       "app(%s) sound=%d prio=%08x",
-                                       appcategory, p->appid, control.sound, p->prio);
-                            for (j = 0; j < sound; j++)  {
-                                if (soundzone[k].conf->sound->id == reqsound[j])    break;
-                            }
-                            if (j >= sound)  {
-                                reqsound[sound++] = soundzone[k].conf->sound->id;
-                            }
-                            apfw_trace("regulation_listener: sound %s %08x %08x",
-                                       p->appid, p->prio, (int)bp);
-                            if (bp) {
-                                bp->next = p->next;
-                            }
-                            else    {
-                                soundzone[k].req = p->next;
-                            }
-                            p2 = soundzone[k].req;
-                            bp2 = NULL;
-                            while (p2)  {
-                                if (p2->prio < p->prio) {
-                                    if (bp2)    {
-                                        bp2->next = p;
-                                        p->next = p2;
-                                        if ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0) {
-                                            change_soundrequest(p, 0);
-                                        }
-                                    }
-                                    else    {
-                                        p->next = soundzone[k].req;
-                                        soundzone[k].req = p;
-                                        if ((p->next != NULL) &&
-                                            ((p->next->state & ICO_APC_REQSTATE_WAITREQ)
-                                                == 0)) {
-                                            change_soundrequest(p->next, 0);
-                                        }
-                                    }
-                                    break;
-                                }
-                                bp2 = p2;
-                                p2 = p2->next;
-                            }
-                            if (! p2)   {
-                                if (bp2)    {
-                                    bp2->next = p;
-                                    if ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0) {
-                                        change_soundrequest(p, 0);
-                                    }
-                                }
-                                else    {
-                                    soundzone[k].req = p;
-                                }
-                                p->next = NULL;
-                            }
-                            break;
-                        }
-                    }
-                    bp = p;
-                    p = p->next;
-                }
-            }
-        }
-    }
-
-    if (control.input != ICO_SYC_APC_REGULATION_NOCHANGE)   {
-        /* input reguration control     */
-        apfw_trace("regulation_listener: input category=%d input=%d",
-                   appcategory, control.input);
-        for (i = 0; i < confapp->applicationNum; i++)   {
-            if (confapp->application[i].categoryId != appcategory)  continue;
-            for (k = 0; k < ninputsw; k++)    {
-                p = inputsw[k].req;
-                if (!p) continue;
-                bp = NULL;
-                while (p)   {
-                    if (strcmp(p->appid, confapp->application[i].appid) == 0)    {
-                        flag = 0;
-                        if (control.input == ICO_SYC_APC_REGULATION_REGULATION) {
-                            if (p->prio & ICO_UXF_PRIO_REGULATION)  {
-                                p->prio &= ~ICO_UXF_PRIO_REGULATION;
-                                flag ++;
-                                if ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0) {
-                                    change_inputrequest(p, 0);
-                                }
-                            }
-                        }
-                        else    {
-                            if ((p->prio & ICO_UXF_PRIO_REGULATION) == 0)   {
-                                p->prio |= ICO_UXF_PRIO_REGULATION;
-                                flag ++;
-                            }
-                        }
-                        if (flag)   {
-                            apfw_trace("regulation_listener: input change category=%d "
-                                       "app(%s) input=%d prio=%08x",
-                                       appcategory, p->appid, control.input, p->prio);
-                            for (j = 0; j < sound; j++)  {
-                                if (inputsw[k].inputsw->input == reqinput[j])    break;
-                            }
-                            if (j >= input)  {
-                                reqinput[input++] = inputsw[k].inputsw->input;
-                            }
-                            apfw_trace("regulation_listener: input %s %08x %08x",
-                                       p->appid, p->prio, (int)bp);
-                            if (bp) {
-                                bp->next = p->next;
-                            }
-                            else    {
-                                inputsw[k].req = p->next;
-                            }
-                            p2 = inputsw[k].req;
-                            bp2 = NULL;
-                            while (p2)  {
-                                if (p2->prio < p->prio) {
-                                    if (bp2)    {
-                                        bp2->next = p;
-                                        p->next = p2;
-                                        if ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0) {
-                                            change_inputrequest(p, 0);
-                                        }
-                                    }
-                                    else    {
-                                        p->next = inputsw[k].req;
-                                        inputsw[k].req = p;
-                                    }
-                                    break;
-                                }
-                                bp2 = p2;
-                                p2 = p2->next;
-                            }
-                            if (! p2)   {
-                                if (bp2)    {
-                                    bp2->next = p;
-                                    if ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0) {
-                                        change_inputrequest(p, 0);
-                                    }
-                                }
-                                else    {
-                                    inputsw[k].req = p;
-                                }
-                                p->next = NULL;
-                            }
-                            break;
-                        }
-                    }
-                    bp = p;
-                    p = p->next;
-                }
-            }
-        }
-    }
-
-    /* re-calculate display zone, sound zone and inout switch priority  */
-    for (i = 0; i < disp; i++)  {
-        recalc_dispzone(reqdisp[i]);
-    }
-    for (i = 0; i < sound; i++) {
-        recalc_soundzone(reqsound[i]);
-    }
-    for (i = 0; i < input; i++) {
-        recalc_inputsw(reqinput[i]);
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   request_timer: request timedout timer(static function)
- *
- * @param[in]   user_data       user data(unused)
- * @return      always ECORE_CALLBACK_RENEW(periodic timer)
- */
-/*--------------------------------------------------------------------------*/
-static Eina_Bool
-request_timer(void *user_data)
-{
-    int                 i;
-    ico_apc_request_t   *p;
-
-    if (timer_count <= 0)   {
-        /* no need timedout check   */
-        return ECORE_CALLBACK_RENEW;
-    }
-    apfw_trace("request_timer: start(%d)", timer_count);
-    timer_count = 0;
-
-    /* check display request timedout   */
-    for (i = 0; i < ndispzone; i++) {
-        p = dispzone[i].req;
-        while (p)   {
-            if (p->timer > 0)   {
-                if (p->timer > ICO_APC_REQREPLY_INTERVAL)
-                    p->timer -= ICO_APC_REQREPLY_INTERVAL;
-                else
-                    p->timer = 0;
-                apfw_trace("request_timer: dispzone[%d] timer(%d)", i, p->timer);
-                if (p->timer == 0)  {
-                    apfw_trace("request_timer: display timedout(%s %d %d prio=%08x)",
-                               p->appid, p->resid, p->id, p->prio);
-                    if ((p->state & ICO_APC_REQSTATE_REPLYACTIVE) &&
-                        ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0))  {
-                        ico_uxf_window_control(p->appid, p->id,
-                                               ICO_UXF_APPSCTL_INVISIBLE, 0);
-                        if (displaycontrol) {
-                            (*displaycontrol)(get_appconf(p->appid), 1);
-                        }
-                    }
-                    p->state &= ~(ICO_APC_REQSTATE_REPLYACTIVE|ICO_APC_REQSTATE_REPLYQUIET);
-                }
-                else    {
-                    timer_count ++;
-                }
-            }
-            p = p->next;
-        }
-    }
-
-    /* check sound request timedout */
-    for (i = 0; i < nsoundzone; i++) {
-        p = soundzone[i].req;
-        while (p)   {
-            if (p->timer > 0)   {
-                if (p->timer > ICO_APC_REQREPLY_INTERVAL)
-                    p->timer -= ICO_APC_REQREPLY_INTERVAL;
-                else
-                    p->timer = 0;
-                apfw_trace("request_timer: soundzone[%d] timer(%d)", i, p->timer);
-                if (p->timer == 0)  {
-                    apfw_trace("request_timer: sound timedout(%s %d %d prio=%08x)",
-                               p->appid, p->resid, p->id, p->prio);
-                    if ((p->state & ICO_APC_REQSTATE_REPLYACTIVE) &&
-                        ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0))  {
-                        if (ico_apf_resource_send_to_soundctl(ICO_APF_SOUND_COMMAND_MUTEOFF,
-                                                              p->pid)
-                                != ICO_APF_RESOURCE_E_NONE) {
-                            apfw_warn("request_timer: send MSM Error");
-                        }
-                        if (soundcontrol) {
-                            (*soundcontrol)(get_appconf(p->appid), 1);
-                        }
-                    }
-                    p->state &= ~(ICO_APC_REQSTATE_REPLYACTIVE|ICO_APC_REQSTATE_REPLYQUIET);
-                }
-                else    {
-                    timer_count ++;
-                }
-            }
-            p = p->next;
-        }
-    }
-    apfw_trace("request_timer: end(%d)", timer_count);
-    return ECORE_CALLBACK_RENEW;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_syc_apc_is_waitshow: check if application is waiting show
- *
- * @param[in]   appid           application Id
- * @return      answer
- * @retval      =1              waiting show
- * @retval      =0              not wait
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_syc_apc_is_waitshow(const char *appid)
-{
-    int                 i;
-    ico_apc_request_t   *p;
-
-    /* check display request list   */
-    for (i = 0; i < ndispzone; i++) {
-        p = dispzone[i].req;
-        while (p)   {
-            if (p->timer > 0)   {
-                /* waiting show         */
-                if (strcmp(p->appid, appid) == 0)   {
-                    /* found application    */
-                    uifw_trace("ico_syc_apc_is_waitshow: %s is waiting", appid);
-                    return 1;
-                }
-            }
-            p = p->next;
-        }
-    }
-    uifw_trace("ico_syc_apc_is_waitshow: %s is not wait", appid);
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_syc_apc_active: application change to active
- *
- * @param[in]   appid           application Id
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-ico_syc_apc_active(const char *appid)
-{
-    int     i, j;
-    int     disp, sound, input;
-    int     flag;
-    Ico_Uxf_conf_application    *appconf;
-    char    *child_appid;
-    ico_apc_request_t   *p;
-    ico_apc_request_t   *bp;
-    ico_apc_request_t   *p2;
-    ico_apc_request_t   *bp2;
-    unsigned short  reqdisp[MAXREQ];
-    unsigned short  reqsound[MAXREQ];
-    unsigned short  reqinput[MAXREQ];
-
-    apfw_trace("ico_syc_apc_active: Enter(%s)", appid ? appid : "(NULL)");
-
-    if ((appid != NULL) && (*appid != 0))   {
-        /* get active application           */
-        appconf = (Ico_Uxf_conf_application *)ico_uxf_getAppByAppid(appid);
-        if (! appconf)  {
-            apfw_trace("ico_syc_apc_active: appid(%s) dose not exist", appid);
-        }
-    }
-    else    {
-        /* chane to no active application   */
-        appconf = NULL;
-    }
-
-    if (appconf)    {
-        /* save child process if exist          */
-        child_appid = ico_uxf_getchild_appid(appconf->appid);
-        /* set last active process for child process    */
-        ico_uxf_set_lastapp(appconf->appid);
-    }
-    else    {
-        /* reset last active process for child process  */
-        ico_uxf_set_lastapp(NULL);
-        child_appid = NULL;
-    }
-
-    /* change all screen request (active counter down)  */
-    for (i = 0; i < ndispzone; i++) {
-        p = dispzone[i].req;
-        while (p)   {
-            if (p->prio & ICO_UXF_PRIO_ACTIVEAPP)  {
-                p->prio -= ICO_UXF_PRIO_ACTIVECOUNT;
-            }
-            p = p->next;
-        }
-    }
-
-    /* change all screen request from this application  */
-    disp = 0;
-    for (i = 0; i < ndispzone; i++) {
-        p = dispzone[i].req;
-        flag = 0;
-        bp = NULL;
-        while (p)   {
-            if (appconf && (strcmp(p->appid, appconf->appid) == 0)) {
-                apfw_trace("ico_syc_apc_active: %08x disp %s prio=%08x is %s",
-                           (int)p, p->appid, p->prio, bp ? "not top" : "top");
-                if ((p->prio & ICO_UXF_PRIO_ACTIVEAPP) != ICO_UXF_PRIO_ACTIVEAPP)   {
-                    p->prio |= ICO_UXF_PRIO_ACTIVEAPP;
-                    apfw_trace("ico_syc_apc_active: %08x cgange active %s prio to %08x",
-                               (int)p, p->appid, p->prio);
-                    flag ++;
-
-                    if (bp) {
-                        bp->next = p->next;
-                        p2 = dispzone[i].req;
-                        bp2 = NULL;
-                        while (p2)  {
-                            if (p2->prio <= p->prio)    {
-                                p->next = p2;
-                                if (bp2) {
-                                    apfw_trace("ico_syc_apc_active: %08x %s is not top=%s(%08x)",
-                                               (int)p, p->appid, dispzone[i].req->appid,
-                                               dispzone[i].req->prio);
-                                    bp2->next = p;
-                                }
-                                else    {
-                                    if (appconf && (strcmp(p2->appid, appconf->appid) != 0) &&
-                                        ((p2->state & ICO_APC_REQSTATE_WAITREQ) == 0))  {
-                                        change_disprequest(p2, 0);
-                                    }
-                                    dispzone[i].req = p;
-                                }
-                                break;
-                            }
-                            bp2 = p2;
-                            p2 = p2->next;
-                        }
-                        if (! p2)   {
-                            apfw_trace("ico_syc_apc_active: %08x %s is not top=%s(%08x)",
-                                       (int)p, p->appid, dispzone[i].req->appid,
-                                       dispzone[i].req->prio);
-                            if (bp2)    {
-                                bp2->next = p;
-                            }
-                            else    {
-                                dispzone[i].req = p;
-                            }
-                            p->next = NULL;
-                        }
-                    }
-                    else    {
-                        apfw_trace("ico_syc_apc_active: %08x app %s is top", (int)p, p->appid);
-                    }
-                }
-            }
-            else if (p->prio & ICO_UXF_PRIO_ACTIVEAPP)  {
-                p->prio -= ICO_UXF_PRIO_ACTIVECOUNT;
-            }
-            bp = p;
-            p = p->next;
-        }
-        if (flag)   {
-            for (j = 0; j < disp; j++)  {
-                if (dispzone[i].conf->display->id == reqdisp[j])    break;
-            }
-            if (j >= disp)  {
-                reqdisp[disp++] = dispzone[i].conf->display->id;
-            }
-        }
-    }
-
-    /* change all sound request from this application   */
-    sound = 0;
-    for (i = 0; i < nsoundzone; i++) {
-        p = soundzone[i].req;
-        flag = 0;
-        bp = NULL;
-        while (p)   {
-            if (appconf && (strcmp(p->appid, appconf->appid) == 0)) {
-                apfw_trace("ico_syc_apc_active: sound %s prio=%08x is %s",
-                           p->appid, p->prio, bp ? "not top" : "top");
-                if ((p->prio & ICO_UXF_PRIO_ACTIVEAPP) != ICO_UXF_PRIO_ACTIVEAPP)   {
-                    p->prio |= ICO_UXF_PRIO_ACTIVEAPP;
-                    apfw_trace("ico_syc_apc_active: cgange active %s prio to %08x",
-                               p->appid, p->prio);
-                    flag ++;
-
-                    if (bp) {
-                        bp->next = p->next;
-                        p2 = soundzone[i].req;
-                        bp2 = NULL;
-                        while (p2)  {
-                            if (p2->prio <= p->prio)    {
-                                p->next = p2;
-                                if (bp2) {
-                                    apfw_trace("ico_syc_apc_active: %s is not top=%s(%08x)",
-                                               p->appid, soundzone[i].req->appid,
-                                               soundzone[i].req->prio);
-                                    bp2->next = p;
-                                }
-                                else    {
-                                    if (appconf && (strcmp(p2->appid, appconf->appid) != 0) &&
-                                        ((p2->state & ICO_APC_REQSTATE_WAITREQ) == 0))  {
-                                        change_soundrequest(p2, 0);
-                                    }
-                                    soundzone[i].req = p;
-                                }
-                                break;
-                            }
-                            bp2 = p2;
-                            p2 = p2->next;
-                        }
-                        if (! p2)   {
-                            apfw_trace("ico_syc_apc_active: %s is not top=%s(%08x)",
-                                       p->appid, soundzone[i].req->appid,
-                                       soundzone[i].req->prio);
-                            if (bp2)    {
-                                bp2->next = p;
-                            }
-                            else    {
-                                soundzone[i].req = p;
-                            }
-                            p->next = NULL;
-                        }
-                    }
-                    else    {
-                        apfw_trace("ico_syc_apc_active: app %s is top", p->appid);
-                    }
-                }
-            }
-            else if (p->prio & ICO_UXF_PRIO_ACTIVEAPP)  {
-                p->prio -= ICO_UXF_PRIO_ACTIVECOUNT;
-            }
-            bp = p;
-            p = p->next;
-        }
-        if (flag)   {
-            for (j = 0; j < sound; j++) {
-                if (soundzone[i].conf->sound->id == reqsound[j])    break;
-            }
-            if (j >= sound) {
-                reqsound[sound++] = soundzone[i].conf->sound->id;
-            }
-        }
-    }
-
-    /* change all inputsw request from this application */
-    input = 0;
-    for (i = 0; i < ninputsw; i++) {
-        p = inputsw[i].req;
-        flag = 0;
-        bp = NULL;
-        while (p)   {
-            if (appconf && (strcmp(p->appid, appconf->appid) == 0)) {
-                if ((p->prio & ICO_UXF_PRIO_ACTIVEAPP) != ICO_UXF_PRIO_ACTIVEAPP)   {
-                    p->prio |= ICO_UXF_PRIO_ACTIVEAPP;
-                    apfw_trace("ico_syc_apc_active: cgange active %s prio to %08x",
-                               p->appid, p->prio);
-                    flag ++;
-
-                    if (bp) {
-                        bp->next = p->next;
-                        p2 = inputsw[i].req;
-                        bp2 = NULL;
-                        while (p2)  {
-                            if (p2->prio <= p->prio)    {
-                                p->next = p2;
-                                if (bp2) {
-                                    apfw_trace("ico_syc_apc_active: %s is not top=%s(%08x)",
-                                               p->appid, inputsw[i].req->appid,
-                                               inputsw[i].req->prio);
-                                    bp2->next = p;
-                                }
-                                else    {
-                                    if (appconf && (strcmp(p2->appid, appconf->appid) != 0) &&
-                                        ((p2->state & ICO_APC_REQSTATE_WAITREQ) == 0))  {
-                                        change_inputrequest(p2, 0);
-                                    }
-                                    inputsw[i].req = p;
-                                }
-                                break;
-                            }
-                            bp2 = p2;
-                            p2 = p2->next;
-                        }
-                        if (! p2)   {
-                            apfw_trace("ico_syc_apc_active: %s is not top=%s(%08x)",
-                                       p->appid, inputsw[i].req->appid,
-                                       inputsw[i].req->prio);
-                            if (bp2)    {
-                                bp2->next = p;
-                            }
-                            else    {
-                                inputsw[i].req = p;
-                            }
-                            p->next = NULL;
-                        }
-                    }
-                    else    {
-                        apfw_trace("ico_syc_apc_active: app %s is top", p->appid);
-                    }
-                }
-            }
-            else if (p->prio & ICO_UXF_PRIO_ACTIVEAPP)  {
-                p->prio -= ICO_UXF_PRIO_ACTIVECOUNT;
-            }
-            bp = p;
-            p = p->next;
-        }
-        if (flag)   {
-            for (j = 0; j < input; j++) {
-                if (inputsw[i].inputsw->input == reqinput[j])   break;
-            }
-            if (j >= input) {
-                reqinput[input++] = inputsw[i].inputsw->input;
-            }
-        }
-    }
-
-    /* re-calculate display zone, sound zone and inout switch priority  */
-    for (i = 0; i < disp; i++)  {
-        recalc_dispzone(reqdisp[i]);
-    }
-    for (i = 0; i < sound; i++) {
-        recalc_soundzone(reqsound[i]);
-    }
-    for (i = 0; i < input; i++) {
-        recalc_inputsw(reqinput[i]);
-    }
-    if (child_appid)    {
-        apfw_trace("ico_syc_apc_active: active child app(%s)", child_appid);
-        ico_syc_apc_active(child_appid);
-    }
-    apfw_trace("ico_syc_apc_active: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   app_display_hook: hook function for surface create/destroy(static function)
- *
- * @param[in]   appid           application Id
- * @param[in]   surface         surface Id
- * @param[in]   object          target surface type and operation
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-app_display_hook(const char *appid, const int surface, const int object)
-{
-    int     i;
-    int     count;
-    ico_apc_request_t           *reqsave[MAXREQ];
-    Ico_Uxf_conf_application    *appconf;
-    ico_apc_request_t           *req;
-
-    apfw_trace("app_display_hook: Enter(%s,%08x,%x)", appid, surface, object);
-
-    appconf = (Ico_Uxf_conf_application *)ico_uxf_getAppByAppid(appid);
-    if (! appconf)  {
-        apfw_warn("app_display_hook: Leave(appid[%s] dose not exist)", appid);
-        return;
-    }
-    if ((confsys->kind[appconf->kindId].priv == ICO_UXF_PRIVILEGE_ALMIGHTY) ||
-        (confsys->kind[appconf->kindId].priv == ICO_UXF_PRIVILEGE_SYSTEM) ||
-        (confsys->kind[appconf->kindId].priv == ICO_UXF_PRIVILEGE_SYSTEM_VISIBLE))  {
-        /* System Program(ex. HomeScreen) no need resource control  */
-        apfw_trace("app_display_hook: Leave(appid[%s] is system program)", appid);
-        return;
-    }
-
-    switch (object) {
-    case ICO_UXF_HOOK_WINDOW_CREATE_MAIN:   /* created application main window  */
-        /* search display request   */
-        for (i = 0; i < ndispzone; i++) {
-            req = dispzone[i].req;
-            while (req)   {
-                if ((strcmp(req->appid, appconf->appid) == 0) &&
-                    ((req->resid == ICO_APF_RESID_BASIC_SCREEN) ||
-                     (req->resid == ICO_APF_RESID_ON_SCREEN)))  break;
-                req = req->next;
-            }
-            if (req)    break;
-        }
-        if (i < ndispzone)  {
-            apfw_trace("app_display_hook: app(%s) requested display, Nop", appid);
-        }
-        else    {
-            apfw_trace("app_display_hook: app(%s) not requested display, set default[%s]",
-                       appid,
-                       confsys->display[appconf->display[0].displayId].
-                           zone[appconf->display[0].zoneId].name);
-            req = get_freereq();
-            if (req)    {
-                strncpy(req->appid, appconf->appid, ICO_UXF_MAX_PROCESS_NAME);
-                req->resid = ICO_APF_RESID_BASIC_SCREEN;
-                req->reqtype = ICO_APC_REQTYPE_CREATE;
-                strcpy(req->device,
-                       confsys->display[appconf->display[0].displayId].
-                           zone[appconf->display[0].zoneId].name);
-                app_getdisplay(req, 0);
-            }
-        }
-        break;
-    case ICO_UXF_HOOK_WINDOW_DESTORY_MAIN:  /* destoryed application main window*/
-        /* delete all request from this application */
-        count = 0;
-        for (i = 0; i < ndispzone; i++) {
-            req = dispzone[i].req;
-            while (req)   {
-                if (strcmp(req->appid, appconf->appid) == 0) {
-                    reqsave[count++] = req;
-                }
-                req = req->next;
-            }
-        }
-        if (count > 0)  {
-            apfw_trace("app_display_hook: free app(%s) all display request", appid);
-            for (i = 0; i < count; i++) {
-                app_freedisplay(reqsave[i], 0);
-            }
-        }
-        break;
-    default:                                /* other, Nop   */
-        break;
-    }
-
-    apfw_trace("app_display_hook: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_syc_apc_init: initialize application controller
- *
- * @param[in]   display     callback function for display control
- * @param[in]   sound       callback function for sound control
- * @param[in]   input       callback function for input control
- * @return      result
- * @retval      ICO_SYC_EOK     success
- * @retval      ICO_SYC_ENOSYS  error(system error)
- * @retval      ICO_SYC_ENOMEM  error(out of memory)
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_syc_apc_init(ico_apc_resource_control_t display, ico_apc_resource_control_t sound,
-                 ico_apc_resource_control_t input)
-{
-    int     count;
-    int     base_count;
-    int     i, j, k;
-    int     ret;
-    Ico_Uxf_InputDev    *pdev;
-    Ico_Uxf_InputSw     *psw;
-
-    apfw_trace("ico_syc_apc_init: Enter");
-
-    if (ico_apps_controller_init)   {
-        apfw_trace("ico_syc_apc_init: Leave(OK, initialized)");
-        return ICO_SYC_EOK;
-    }
-
-    /* set callback functions for HomeScreen        */
-    displaycontrol = display;
-    soundcontrol = sound;
-    inputcontrol = input;
-
-    ico_apps_controller_init = 1;
-
-    /* get configurations                           */
-    confsys = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
-    confapp = (Ico_Uxf_App_Config *)ico_uxf_getAppConfig();
-
-    if ((! confsys) || (! confapp)) {
-        ico_apps_controller_init = 0;
-        apfw_error("ico_syc_apc_init: Leave(can not read configuration)");
-        return ICO_SYC_ENOSYS;
-    }
-
-    /* initialize internal tables                   */
-    /* display zone table                           */
-    ndispzone = 0;
-    for (i = 0; i < confsys->displayNum; i++)   {
-        ndispzone += confsys->display[i].zoneNum;
-    }
-    dispzone = malloc(sizeof(ico_apc_dispzone_t) * ndispzone);
-    if (! dispzone) {
-        ico_apps_controller_init = 0;
-        apfw_error("ico_syc_apc_init: Leave(No Memory)");
-        return ICO_SYC_ENOMEM;
-    }
-    memset(dispzone, 0, sizeof(ico_apc_dispzone_t) * ndispzone);
-    count = 0;
-    for (i = 0; i < confsys->displayNum; i++)   {
-        base_count = count;
-        for (j = 0; j < confsys->display[i].zoneNum; j++)   {
-            dispzone[count].conf = &confsys->display[i].zone[j];
-            dispzone[count].noverlap = confsys->display[i].zone[j].overlapNum;
-            for (k = 0; k < dispzone[count].noverlap; k++)  {
-                dispzone[count].overlap[k] =
-                    &dispzone[base_count + confsys->display[i].zone[j].overlap[k]];
-            }
-            count ++;
-        }
-    }
-
-    /* sound zone table                         */
-    nsoundzone = 0;
-    for (i = 0; i < confsys->soundNum; i++) {
-        nsoundzone += confsys->sound[i].zoneNum;
-    }
-    soundzone = malloc(sizeof(ico_apc_soundzone_t) * nsoundzone);
-    if (! soundzone)    {
-        ico_apps_controller_init = 0;
-        apfw_error("ico_syc_apc_init: Leave(No Memory)");
-        return ICO_SYC_ENOMEM;
-    }
-    memset(soundzone, 0, sizeof(ico_apc_soundzone_t) * nsoundzone);
-    count = 0;
-    for (i = 0; i < confsys->soundNum; i++) {
-        base_count = count;
-        for (j = 0; j < confsys->sound[i].zoneNum; j++) {
-            soundzone[count].conf = &confsys->sound[i].zone[j];
-            soundzone[count].noverlap = confsys->sound[i].zone[j].overlapNum;
-            for (k = 0; k < soundzone[count].noverlap; j++) {
-                soundzone[count].overlap[k] =
-                    &soundzone[base_count + confsys->sound[i].zone[j].overlap[k]];
-            }
-            count ++;
-        }
-    }
-    /* input sw table                           */
-    ninputsw = 0;
-    for (i = 0; ; i++)  {
-        pdev = ico_uxf_inputdev_attribute_get(i);
-        if (pdev == NULL)   break;
-        apfw_trace("ico_syc_apc_init: input device.%d %s has %d switchs",
-                   i, pdev->device, pdev->numInputSw);
-        for (j = 0; j < pdev->numInputSw; j++)  {
-            psw = ico_uxf_inputsw_attribute_get(pdev, j);
-            if (psw == NULL)    break;
-            if (psw->fix == 0)  {
-                ninputsw ++;
-            }
-        }
-    }
-    if (ninputsw > 0)   {
-        inputsw = malloc(sizeof(ico_apc_inputsw_t) * ninputsw);
-        if (! inputsw)  {
-            ico_apps_controller_init = 0;
-            apfw_error("ico_syc_apc_init: Leave(No Memory)");
-            return ICO_SYC_ENOMEM;
-        }
-        memset(inputsw, 0, sizeof(ico_apc_inputsw_t) * ninputsw);
-        count = 0;
-        for (i = 0; ; i++)  {
-            pdev = ico_uxf_inputdev_attribute_get(i);
-            if (pdev == NULL)   break;
-            for (j = 0; j < pdev->numInputSw; j++)  {
-                psw = ico_uxf_inputsw_attribute_get(pdev, j);
-                if (psw == NULL)    break;
-                if (psw->fix)       continue;
-                inputsw[count].inputdev = pdev;
-                inputsw[count].inputsw = psw;
-                count ++;
-            }
-        }
-    }
-
-    /* initialize request table                     */
-    ico_apc_request_t *req = malloc(sizeof(ico_apc_request_t) * INIT_REQCB);
-    ico_apc_request_t *breq;
-    if (! req)  {
-        ico_apps_controller_init = 0;
-        apfw_error("ico_syc_apc_init: Leave(No Memory)");
-        return ICO_SYC_ENOMEM;
-    }
-    memset(req, 0, sizeof(ico_apc_request_t) * INIT_REQCB);
-    free_request = req;
-    for (count = 1; count < INIT_REQCB; count++)    {
-        breq = req;
-        req ++;
-        breq->next = req;
-    }
-
-    /* initialzie application framework library     */
-    ret = ico_apf_ecore_init_server(NULL);
-    if (ret != ICO_APF_E_NONE)  {
-        ico_apps_controller_init = 0;
-        apfw_error("ico_syc_apc_init: Leave(ico_apf_ecore_init_server Error<%d>)", ret);
-    }
-
-    /* regist callback for application resource request */
-    ret = ico_apf_resource_set_event_cb(resource_reqcb, NULL);
-    if (ret != ICO_APF_RESOURCE_E_NONE) {
-        ico_apps_controller_init = 0;
-        apfw_error("ico_syc_apc_init: Leave(ico_apf_resource_set_event_cb Error<%d>)",
-                   ret);
-        ico_apf_resource_term_server();
-    }
-
-    /* initialize regulation controller    */
-    ret = ico_syc_apc_regulation_init();
-    if (ret != ICO_SYC_EOK) {
-        ico_apps_controller_init = 0;
-        apfw_error("ico_syc_apc_init: Leave(ico_syc_apc_regulation_init Error<%d>)",
-                   ret);
-        ico_apf_resource_term_server();
-    }
-
-    ico_syc_apc_regulation_listener(regulation_listener, NULL);
-
-    /* set hook for window create/destory   */
-    (void) ico_uxf_window_hook(app_display_hook);
-
-    /* create timer     */
-    ecore_timer = ecore_timer_add(((double)ICO_APC_REQREPLY_INTERVAL)/1000.0,
-                                  request_timer, NULL);
-    timer_count = 1;
-
-    /* send sound stream list request to Multi Sound manager    */
-    ret = ico_apf_resource_send_to_soundctl(ICO_APF_SOUND_COMMAND_GETLIST, 0);
-    if (ret != ICO_APF_RESOURCE_E_NONE) {
-        apfw_error("ico_syc_apc_init: Leave(ico_apf_resource_send_to_soundctl Error<%d>)",
-                   ret);
-    }
-
-    apfw_trace("ico_syc_apc_init: Leave(EOK)");
-    return ICO_SYC_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_syc_apc_term: terminate application controller
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-ico_syc_apc_term(void)
-{
-    apfw_trace("ico_syc_apc_term: Enter");
-    if (ico_apps_controller_init == 0)  {
-        apfw_trace("ico_syc_apc_term: Leave(not initialized)");
-        return;
-    }
-    if (ecore_timer)    {
-        ecore_timer_del(ecore_timer);
-        ecore_timer = NULL;
-    }
-
-    ico_syc_apc_regulation_term();
-    ico_apf_resource_term_server();
-    ico_apps_controller_init = 0;
-
-    apfw_trace("ico_syc_apc_term: Leave");
-}
-
diff --git a/apps_controller/ico_syc_apc_private.h b/apps_controller/ico_syc_apc_private.h
deleted file mode 100644 (file)
index 3f41bca..0000000
+++ /dev/null
@@ -1,99 +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   header file of Apprications Controller internal(private)
- *
- * @date    Feb-28-2013
- */
-
-#ifndef _ICO_SYC_APC_PRIVATE_H_
-#define _ICO_SYC_APC_PRIVATE_H_
-
-#include    <aul/aul.h>
-#include    <ico_input_mgr-client-protocol.h>
-#include    "ico_apf_log.h"
-#include    "ico_uxf_sysdef.h"
-#include    "ico_uxf_conf.h"
-#include    "ico_apf_resource_control.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* D-Bus target                                 */
-#define DBUS_SERVICE   "org.automotive.message.broker"
-#define DBUS_INTERFACE "org.freedesktop.DBus.Properties"
-#define DBUS_METHOD    "Get"
-
-/* define struct                                */
-/* request information                          */
-typedef struct  _ico_apc_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                      */
-    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                     */
-} ico_apc_request_t;
-
-#define ICO_APC_REQTYPE_REQUEST 0               /* Request from application         */
-#define ICO_APC_REQTYPE_CREATE  1               /* Request automaticaly             */
-
-#define ICO_APC_REQREPLY_INTERVAL    100        /* Request timer interval (ms)      */
-#define ICO_APC_REQREPLY_MAXTIME     500        /* Maximum reply wait (ms)          */
-#define ICO_APC_REQSTATE_WAITREQ     0x01       /* Waitting resource                */
-#define ICO_APC_REQSTATE_WAITPROC    0x08       /* Priotiry process work flag       */
-#define ICO_APC_REQSTATE_MASK        0x0f       /* State mask                       */
-#define ICO_APC_REQSTATE_REPLYACTIVE 0x20       /* Wait reply for active            */
-#define ICO_APC_REQSTATE_REPLYQUIET  0x10       /* Wait reply for hide              */
-
-/* application request table                    */
-typedef struct  _ico_apc_apprequest {
-} ico_apc_apprequest_t;
-
-/* display zone                                 */
-typedef struct  _ico_apc_dispzone   {
-    ico_apc_request_t   *req;                   /* request list link                */
-    Ico_Uxf_conf_display_zone   *conf;          /* configuration                    */
-    short               res;                    /* (unused)                         */
-    short               noverlap;               /* number of overlap zone           */
-                                                /* overlap zone                     */
-    struct _ico_apc_dispzone    *overlap[ICO_UXF_DISPLAY_ZONE_MAX];
-} ico_apc_dispzone_t;
-
-/* sound zone                                   */
-typedef struct  _ico_apc_soundzone  {
-    ico_apc_request_t   *req;                   /* request list link                */
-    Ico_Uxf_conf_sound_zone     *conf;          /* configuration                    */
-    short               res;                    /* (unused)                         */
-    short               noverlap;               /* number of overlap zone           */
-                                                /* overlap zone                     */
-    struct _ico_apc_soundzone   *overlap[ICO_UXF_SOUND_ZONE_MAX];
-} ico_apc_soundzone_t;
-
-/* input sw                                     */
-typedef struct  _ico_apc_inputsw    {
-    ico_apc_request_t   *req;                   /* request list link                */
-    Ico_Uxf_InputDev    *inputdev;              /* input device attribute           */
-    Ico_Uxf_InputSw     *inputsw;               /* input switch attribute           */
-} ico_apc_inputsw_t;
-
-#ifdef __cplusplus
-}
-#endif
-#endif  /* _ICO_SYC_APC_PRIVATE_H_ */
-
diff --git a/apps_controller/ico_syc_apc_regulation.c b/apps_controller/ico_syc_apc_regulation.c
deleted file mode 100644 (file)
index 24d67aa..0000000
+++ /dev/null
@@ -1,722 +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   Regulation controller
- *
- * @date    Feb-28-2013
- */
-
-#include    <stdio.h>
-#include    <stdlib.h>
-#include    <unistd.h>
-#include    <stdbool.h>
-#include    <string.h>
-#include    <errno.h>
-#include    <pthread.h>
-#include    <sys/ioctl.h>
-#include    <sys/time.h>
-#include    <fcntl.h>
-
-#include    <wayland-client.h>
-#include    <ico_window_mgr-client-protocol.h>
-#include    <dbus/dbus.h>
-#include    <Ecore.h>
-#include    "ico_apf.h"
-#include    "ico_uxf.h"
-#include    "ico_syc_apc.h"
-#include    "ico_syc_apc_private.h"
-
-/*==============================================================================*/
-/* static tables                                                                */
-/*==============================================================================*/
-/* callback function            */
-static int  nregulation_cb = 0;
-static ico_apc_regulation_cb_t  regulation_cb[ICO_SYC_APC_REGULATION_LISTENERS];
-static void                     *regulation_cb_user_data[ICO_SYC_APC_REGULATION_LISTENERS];
-
-/* Ecore/D-Bus static valiables */
-static Ecore_Timer *vehicle_timer = NULL;
-static DBusConnection *dbus_connection = NULL;
-static ico_apc_reguration_control_t control[ICO_UXF_CATEGORY_MAX];
-
-/* vehicle information          */
-static const struct _vehicle_info_property {
-    int     key;                        /* Vehicle Information key                  */
-    char    *property;                  /* D-Bus property name                      */
-    char    *path;                      /* D-Bus path name                          */
-    char    *interface;                 /* D-Bus interface name                     */
-}                   vehicle_info[] = {
-    { ICO_SYC_VEHICLEINFO_VEHICLE_SPEED, "VehicleSpeed",
-      "/org/automotive/runningstatus/vehicleSpeed", "org.automotive.vehicleSpeed" },
-    { ICO_SYC_VEHICLEINFO_SHIFT_POSITION, "ShiftPosition",
-      "/org/automotive/runningstatus/transmission", "org.automotive.transmission" },
-#if 0   /* 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" },
-#else   /* use LightStatus, because AMB not support access of TurnSignal by D-Bus   */
-    { ICO_SYC_VEHICLEINFO_LIGHT_LEFT, "LeftTurn",
-      "/org/automotive/runningstatus/lightStatus", "org.automotive.lightStatus" },
-    { ICO_SYC_VEHICLEINFO_LIGHT_RIGHT, "RightTurn",
-      "/org/automotive/runningstatus/lightStatus", "org.automotive.lightStatus" },
-#endif  /* use LightStatus, because AMB not support access of TurnSignal by D-Bus   */
-    { 0, "\0", "\0", "\0" }
-};
-
-/* Vehicle information data     */
-static struct _vehicle_info_data    {
-    int             key;                /* Vehicle Information key                  */
-    DBusPendingCall *pending;
-    int             request;
-    int             errcount;
-    double          val;
-}                   vehicle_data[ICO_UXF_REGULATION_VIC_MAX];
-
-/* system configuration         */
-static Ico_Uxf_Sys_Config       *confsys = NULL;
-static int      ncategory;
-static Ico_Uxf_conf_category    *category;
-
-/*==============================================================================*/
-/* define static function prototype                                             */
-/*==============================================================================*/
-static int request_vehicle_info(void);
-static int get_vehicle_info(void);
-static Eina_Bool rule_engine_wake(void *user_data);
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   request_vehicle_info: request to AMB(static function)
- *
- * @param       none
- * @return      result
- * @retval      ICO_SYC_EOK     success
- * @retval      ICO_SYC_EIO     error(D-Bus send error)
- */
-/*--------------------------------------------------------------------------*/
-static int
-request_vehicle_info(void)
-{
-    DBusMessage *dbus_message = NULL;
-    int     idx;
-    int     ret = ICO_SYC_EOK;
-
-    for (idx = 0; vehicle_info[idx].key; idx++) {
-
-        /* set vehicle info key     */
-        vehicle_data[idx].key = vehicle_info[idx].key;
-
-        if (vehicle_data[idx].pending)  {
-            continue;
-        }
-
-        if (vehicle_info[idx].path[0] == 0) {
-            /* currently not support this vehicle information   */
-            continue;
-        }
-
-        /* Create send message      */
-        dbus_message = dbus_message_new_method_call(DBUS_SERVICE, vehicle_info[idx].path,
-                                                    DBUS_INTERFACE, DBUS_METHOD);
-        if (! dbus_message) {
-            apfw_warn("request_vehicle_info: ERROR dbus_message_new_method_call" );
-            ret = ICO_SYC_EIO;
-        }
-        /* Set parameters into message  */
-        else if (! dbus_message_append_args(
-                            dbus_message,
-                            DBUS_TYPE_STRING, &vehicle_info[idx].interface,
-                            DBUS_TYPE_STRING, &vehicle_info[idx].property,
-                            DBUS_TYPE_INVALID)) {
-            apfw_warn("request_vehicle_info: ERROR dbus_message_append_args" );
-            ret = ICO_SYC_EIO;
-        }
-        /* Set destination              */
-        else if (! dbus_message_set_destination(dbus_message, DBUS_SERVICE))    {
-            apfw_warn("request_vehicle_info: ERROR dbus_message_set_destination" );
-            ret = ICO_SYC_EIO;
-        }
-        /* Send message                 */
-        else if (! dbus_connection_send_with_reply(
-                            dbus_connection, dbus_message,
-                            &vehicle_data[idx].pending, 200))    {
-            apfw_warn("request_vehicle_info: ERROR dbus_connection_send" );
-            vehicle_data[idx].pending = NULL;
-            ret = ICO_SYC_EIO;
-        }
-        if (dbus_message)   {
-            /* Release message                  */
-            dbus_message_unref(dbus_message);
-        }
-    }
-
-    /* dispatch if data queue exist         */
-    do  {
-        dbus_connection_read_write_dispatch(dbus_connection, 0);
-    } while (dbus_connection_get_dispatch_status(dbus_connection)
-             == DBUS_DISPATCH_DATA_REMAINS);
-
-    return(ret);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   get_vehicle_info: get vercle information from AMB(static function)
- *
- * @param       none
- * @return      always ICO_SYC_EOK(success)
- */
-/*--------------------------------------------------------------------------*/
-static int
-get_vehicle_info(void)
-{
-    DBusMessage *dbus_message = NULL;
-    DBusMessageIter iter_head;
-    DBusMessageIter iter;
-    int         idx;
-    char        type;
-    int32_t     i32;
-    int16_t     i16;
-    uint32_t    u32;
-    uint16_t    u16;
-    dbus_bool_t b;
-    uint8_t     u8;
-    double      d64;
-
-    /* dispatch if data queue exist         */
-    do {
-        dbus_connection_read_write_dispatch(dbus_connection, 0);
-    } while (dbus_connection_get_dispatch_status(dbus_connection)
-             == DBUS_DISPATCH_DATA_REMAINS);
-
-    /* analize reply datas                  */
-    for (idx = 0; vehicle_info[idx].key; idx++) {
-        if (! vehicle_data[idx].pending)    {
-            continue;
-        }
-        if (! dbus_pending_call_get_completed(vehicle_data[idx].pending))   {
-            continue;
-        }
-
-        dbus_message = dbus_pending_call_steal_reply(vehicle_data[idx].pending);
-        if (! dbus_message) {
-            apfw_trace("get_vehicle_info: (%s) NO reply", vehicle_info[idx].property);
-            continue;
-        }
-
-        if (dbus_message_get_type(dbus_message) == DBUS_MESSAGE_TYPE_ERROR) {
-            dbus_message_unref(dbus_message);
-            dbus_pending_call_unref(vehicle_data[idx].pending);
-            vehicle_data[idx].pending = NULL;
-            vehicle_data[idx].errcount ++;
-            if (vehicle_data[idx].errcount <= 5)    {
-                apfw_trace("get_vehicle_info: (%s) reply error", vehicle_info[idx].property);
-            }
-            continue;
-        }
-
-        dbus_message_iter_init(dbus_message, &iter_head);
-        dbus_message_iter_recurse(&iter_head, &iter);
-
-        type = dbus_message_iter_get_arg_type(&iter);
-        switch (type)   {
-        case DBUS_TYPE_INT32:
-            dbus_message_iter_get_basic(&iter, &i32);
-            vehicle_data[idx].val = (double)i32;
-            break;
-        case DBUS_TYPE_INT16:
-            dbus_message_iter_get_basic(&iter, &i16);
-            vehicle_data[idx].val = (double)i16;
-            break;
-        case DBUS_TYPE_UINT32:
-            dbus_message_iter_get_basic(&iter, &u32);
-            vehicle_data[idx].val = (double)u32;
-            break;
-        case DBUS_TYPE_UINT16:
-            dbus_message_iter_get_basic(&iter, &u16);
-            vehicle_data[idx].val = (double)u16;
-            break;
-        case DBUS_TYPE_BOOLEAN:
-            dbus_message_iter_get_basic(&iter, &b);
-            if (b)      vehicle_data[idx].val = (double)1.0;
-            else        vehicle_data[idx].val = (double)0.0;
-            break;
-        case DBUS_TYPE_BYTE:
-            dbus_message_iter_get_basic(&iter, &u8);
-            vehicle_data[idx].val = (double)u8;
-            break;
-        case DBUS_TYPE_DOUBLE:
-            dbus_message_iter_get_basic(&iter, &d64);
-            vehicle_data[idx].val = (double)d64;
-            break;
-        default:
-            apfw_warn("get_vehicle_info: (%s) illegal data type(0x%02x)",
-                      vehicle_info[idx].property, ((int)type) & 0x0ff);
-            break;
-        }
-#if 0   /* too many logout, change to comment   */
-        apfw_trace("get_vehicle_info: %s = %d",
-                   vehicle_info[idx].property, (int)vehicle_data[idx].val);
-#endif  /* too many logout, change to comment   */
-
-        /* free message and pending     */
-        dbus_message_unref(dbus_message);
-        dbus_pending_call_unref(vehicle_data[idx].pending);
-        vehicle_data[idx].pending = NULL;
-    };
-    return ICO_SYC_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   rule_engine_wake: judge a run regulation state(static function)
- *
- * @param[in]   user_data       user data(unused)
- * @return      always ECORE_CALLBACK_RENEW(periodic timer)
- */
-/*--------------------------------------------------------------------------*/
-static Eina_Bool
-rule_engine_wake(void *user_data)
-{
-    int     idx;
-    int     i;
-    ico_apc_reguration_control_t    wkcontrol[ICO_UXF_CATEGORY_MAX];
-    ico_apc_reguration_control_t    change;
-    double  VehicleSpeed = 0.0;
-    int     ShiftPosition = ICO_SYC_APC_REGULATION_SHIFT_NEUTRALS;
-    int     Blinker = ICO_SYC_APC_REGULATION_BLINKER_NONE;
-
-    /* call UX-FW timer     */
-    ico_uxf_timer_wake(100);
-
-    memset(wkcontrol, 0, sizeof(ico_apc_reguration_control_t) * ncategory);
-
-    /* get reply (vehicle ifno) */
-    get_vehicle_info();
-
-    /* get vehicle info values  */
-    for (idx = 0; vehicle_data[idx].key; idx++)   {
-        if (vehicle_data[idx].key == ICO_SYC_VEHICLEINFO_VEHICLE_SPEED)   {
-            VehicleSpeed = (double)vehicle_data[idx].val;
-        }
-        else if (vehicle_data[idx].key == ICO_SYC_VEHICLEINFO_SHIFT_POSITION) {
-            ShiftPosition = (int)vehicle_data[idx].val;
-        }
-#if 0   /* use LightStatus, because AMB not support access of TurnSignal by D-Bus   */
-        else if (vehicle_data[idx].key == ICO_SYC_VEHICLEINFO_TURN_SIGNAL) {
-            Blinker = (int)vehicle_data[idx].val;
-        }
-#else   /* use LightStatus, because AMB not support access of TurnSignal by D-Bus   */
-        else if (vehicle_data[idx].key == ICO_SYC_VEHICLEINFO_LIGHT_LEFT) {
-            if (vehicle_data[idx].val == 0.0)   {
-                if (Blinker == ICO_SYC_APC_REGULATION_BLINKER_LEFT) {
-                    Blinker = ICO_SYC_APC_REGULATION_BLINKER_NONE;
-                }
-            }
-            else    {
-                Blinker = ICO_SYC_APC_REGULATION_BLINKER_LEFT;
-            }
-        }
-        else if (vehicle_data[idx].key == ICO_SYC_VEHICLEINFO_LIGHT_RIGHT) {
-            if (vehicle_data[idx].val == 0.0)   {
-                if (Blinker == ICO_SYC_APC_REGULATION_BLINKER_RIGHT)    {
-                    Blinker = ICO_SYC_APC_REGULATION_BLINKER_NONE;
-                }
-            }
-            else    {
-                Blinker = ICO_SYC_APC_REGULATION_BLINKER_RIGHT;
-            }
-        }
-#endif  /* use LightStatus, because AMB not support access of TurnSignal by D-Bus   */
-    }
-
-    /* Make control code            */
-    memcpy(wkcontrol, control, sizeof(ico_apc_reguration_control_t) * ncategory);
-
-    /* Check Vehicle Speed          */
-    for (idx = 0; idx < ncategory; idx++)   {
-        switch (category[idx].view) {
-        case ICO_UXF_POLICY_ALWAYS:
-            wkcontrol[idx].display = ICO_SYC_APC_REGULATION_NOREGULATION;
-            break;
-        case ICO_UXF_POLICY_RUNNING:
-            if (VehicleSpeed >= ICO_SYC_APC_REGULATION_SPEED_RUNNING)
-                wkcontrol[idx].display = ICO_SYC_APC_REGULATION_NOREGULATION;
-            else
-                wkcontrol[idx].display = ICO_SYC_APC_REGULATION_REGULATION;
-            break;
-        case ICO_UXF_POLICY_PARKED:
-            if (VehicleSpeed >= ICO_SYC_APC_REGULATION_SPEED_RUNNING)
-                wkcontrol[idx].display = ICO_SYC_APC_REGULATION_REGULATION;
-            else
-                wkcontrol[idx].display = ICO_SYC_APC_REGULATION_NOREGULATION;
-            break;
-        case ICO_UXF_POLICY_SHIFT_PARKING:
-            if ((VehicleSpeed < ICO_SYC_APC_REGULATION_SPEED_RUNNING) &&
-                ((ShiftPosition == ICO_SYC_APC_REGULATION_SHIFT_PARKING) ||
-                 (ShiftPosition == ICO_SYC_APC_REGULATION_SHIFT_NEUTRALS)))
-                wkcontrol[idx].display = ICO_SYC_APC_REGULATION_NOREGULATION;
-            else
-                wkcontrol[idx].display = ICO_SYC_APC_REGULATION_REGULATION;
-            break;
-        case ICO_UXF_POLICY_SHIFT_REVERSES:
-            if (ShiftPosition == ICO_SYC_APC_REGULATION_SHIFT_REVERSES)
-                wkcontrol[idx].display = ICO_SYC_APC_REGULATION_NOREGULATION;
-            else
-                wkcontrol[idx].display = ICO_SYC_APC_REGULATION_REGULATION;
-            break;
-        case ICO_UXF_POLICY_BLINKER_LEFT:
-            if ((Blinker != ICO_SYC_APC_REGULATION_BLINKER_LEFT) ||
-                (ShiftPosition == ICO_SYC_APC_REGULATION_SHIFT_REVERSES))
-                wkcontrol[idx].display = ICO_SYC_APC_REGULATION_REGULATION;
-            else
-                wkcontrol[idx].display = ICO_SYC_APC_REGULATION_NOREGULATION;
-            break;
-        case ICO_UXF_POLICY_BLINKER_RIGHT:
-            if ((Blinker != ICO_SYC_APC_REGULATION_BLINKER_RIGHT) ||
-                (ShiftPosition == ICO_SYC_APC_REGULATION_SHIFT_REVERSES))
-                wkcontrol[idx].display = ICO_SYC_APC_REGULATION_REGULATION;
-            else
-                wkcontrol[idx].display = ICO_SYC_APC_REGULATION_NOREGULATION;
-            break;
-        default:
-            apfw_trace("rule_engine_wake: category(%d) has unknown view(%d)",
-                       idx, category[idx].view);
-            break;
-        }
-
-        switch (category[idx].sound)    {
-        case ICO_UXF_POLICY_ALWAYS:
-            wkcontrol[idx].sound = ICO_SYC_APC_REGULATION_NOREGULATION;
-            break;
-        case ICO_UXF_POLICY_RUNNING:
-            if (VehicleSpeed >= ICO_SYC_APC_REGULATION_SPEED_RUNNING)
-                wkcontrol[idx].sound = ICO_SYC_APC_REGULATION_NOREGULATION;
-            else
-                wkcontrol[idx].sound = ICO_SYC_APC_REGULATION_REGULATION;
-            break;
-        case ICO_UXF_POLICY_PARKED:
-            if (VehicleSpeed >= ICO_SYC_APC_REGULATION_SPEED_RUNNING)
-                wkcontrol[idx].sound = ICO_SYC_APC_REGULATION_REGULATION;
-            else
-                wkcontrol[idx].sound = ICO_SYC_APC_REGULATION_NOREGULATION;
-            break;
-        case ICO_UXF_POLICY_SHIFT_PARKING:
-            if ((VehicleSpeed < ICO_SYC_APC_REGULATION_SPEED_RUNNING) &&
-                ((ShiftPosition == ICO_SYC_APC_REGULATION_SHIFT_PARKING) ||
-                 (ShiftPosition == ICO_SYC_APC_REGULATION_SHIFT_NEUTRALS)))
-                wkcontrol[idx].sound = ICO_SYC_APC_REGULATION_NOREGULATION;
-            else
-                wkcontrol[idx].sound = ICO_SYC_APC_REGULATION_REGULATION;
-            break;
-        case ICO_UXF_POLICY_SHIFT_REVERSES:
-            if (ShiftPosition == ICO_SYC_APC_REGULATION_SHIFT_REVERSES)
-                wkcontrol[idx].sound = ICO_SYC_APC_REGULATION_NOREGULATION;
-            else
-                wkcontrol[idx].sound = ICO_SYC_APC_REGULATION_REGULATION;
-            break;
-        case ICO_UXF_POLICY_BLINKER_LEFT:
-            if ((Blinker != ICO_SYC_APC_REGULATION_BLINKER_LEFT) ||
-                (ShiftPosition == ICO_SYC_APC_REGULATION_SHIFT_REVERSES))
-                wkcontrol[idx].sound = ICO_SYC_APC_REGULATION_REGULATION;
-            else
-                wkcontrol[idx].sound = ICO_SYC_APC_REGULATION_NOREGULATION;
-            break;
-        case ICO_UXF_POLICY_BLINKER_RIGHT:
-            if ((Blinker != ICO_SYC_APC_REGULATION_BLINKER_RIGHT) ||
-                (ShiftPosition == ICO_SYC_APC_REGULATION_SHIFT_REVERSES))
-                wkcontrol[idx].sound = ICO_SYC_APC_REGULATION_REGULATION;
-            else
-                wkcontrol[idx].sound = ICO_SYC_APC_REGULATION_NOREGULATION;
-            break;
-        default:
-            apfw_trace("rule_engine_wake: category(%d) has unknown sound(%d)",
-                       idx, category[idx].sound);
-            break;
-        }
-
-        switch (category[idx].input)    {
-        case ICO_UXF_POLICY_ALWAYS:
-            wkcontrol[idx].input = ICO_SYC_APC_REGULATION_NOREGULATION;
-            break;
-        case ICO_UXF_POLICY_RUNNING:
-            if (VehicleSpeed >= ICO_SYC_APC_REGULATION_SPEED_RUNNING)
-                wkcontrol[idx].input = ICO_SYC_APC_REGULATION_NOREGULATION;
-            else
-                wkcontrol[idx].input = ICO_SYC_APC_REGULATION_REGULATION;
-            break;
-        case ICO_UXF_POLICY_PARKED:
-            if (VehicleSpeed >= ICO_SYC_APC_REGULATION_SPEED_RUNNING)
-                wkcontrol[idx].input = ICO_SYC_APC_REGULATION_REGULATION;
-            else
-                wkcontrol[idx].input = ICO_SYC_APC_REGULATION_NOREGULATION;
-            break;
-        case ICO_UXF_POLICY_SHIFT_PARKING:
-            if ((VehicleSpeed < ICO_SYC_APC_REGULATION_SPEED_RUNNING) &&
-                ((ShiftPosition == ICO_SYC_APC_REGULATION_SHIFT_PARKING) ||
-                 (ShiftPosition == ICO_SYC_APC_REGULATION_SHIFT_NEUTRALS)))
-                wkcontrol[idx].input = ICO_SYC_APC_REGULATION_NOREGULATION;
-            else
-                wkcontrol[idx].input = ICO_SYC_APC_REGULATION_REGULATION;
-            break;
-        case ICO_UXF_POLICY_SHIFT_REVERSES:
-            if (ShiftPosition == ICO_SYC_APC_REGULATION_SHIFT_REVERSES)
-                wkcontrol[idx].input = ICO_SYC_APC_REGULATION_NOREGULATION;
-            else
-                wkcontrol[idx].input = ICO_SYC_APC_REGULATION_REGULATION;
-            break;
-        case ICO_UXF_POLICY_BLINKER_LEFT:
-            if ((Blinker != ICO_SYC_APC_REGULATION_BLINKER_LEFT) ||
-                (ShiftPosition == ICO_SYC_APC_REGULATION_SHIFT_REVERSES))
-                wkcontrol[idx].input = ICO_SYC_APC_REGULATION_REGULATION;
-            else
-                wkcontrol[idx].input = ICO_SYC_APC_REGULATION_NOREGULATION;
-            break;
-        case ICO_UXF_POLICY_BLINKER_RIGHT:
-            if ((Blinker != ICO_SYC_APC_REGULATION_BLINKER_RIGHT) ||
-                (ShiftPosition == ICO_SYC_APC_REGULATION_SHIFT_REVERSES))
-                wkcontrol[idx].input = ICO_SYC_APC_REGULATION_REGULATION;
-            else
-                wkcontrol[idx].input = ICO_SYC_APC_REGULATION_NOREGULATION;
-            break;
-        default:
-            apfw_trace("rule_engine_wake: category(%d) has unknown input(%d)",
-                       idx, category[idx].input);
-            break;
-        }
-    }
-
-    for (idx = 0; idx < ncategory; idx++) {
-        if ((control[idx].display != wkcontrol[idx].display) ||
-            (control[idx].sound != wkcontrol[idx].sound) ||
-            (control[idx].input != wkcontrol[idx].input))   {
-            apfw_trace("rule_engine_wake: Category.%d view.%d>%d sound.%d>%d inp.%d>%d",
-                       idx, control[idx].display, wkcontrol[idx].display,
-                       control[idx].sound, wkcontrol[idx].sound,
-                       control[idx].input, wkcontrol[idx].input);
-
-            if (nregulation_cb > 0)  {
-                if (control[idx].display != wkcontrol[idx].display)
-                    change.display = wkcontrol[idx].display;
-                else
-                    change.display = ICO_SYC_APC_REGULATION_NOCHANGE;
-                if (control[idx].sound != wkcontrol[idx].sound)
-                    change.sound = wkcontrol[idx].sound;
-                else
-                    change.sound = ICO_SYC_APC_REGULATION_NOCHANGE;
-                if (control[idx].input != wkcontrol[idx].input)
-                    change.input = wkcontrol[idx].input;
-                else
-                    change.input = ICO_SYC_APC_REGULATION_NOCHANGE;
-
-                for (i = 0; i < nregulation_cb; i++)    {
-                    (*regulation_cb[i])(idx, change, regulation_cb_user_data[i]);
-                }
-            }
-            control[idx].display = wkcontrol[idx].display;
-            control[idx].sound = wkcontrol[idx].sound;
-            control[idx].input = wkcontrol[idx].input;
-        }
-    }
-    /* send request to AMB                  */
-    request_vehicle_info();
-
-    return ECORE_CALLBACK_RENEW;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_syc_apc_regulation_init: initialize regulation control
- *
- * @param       none
- * @return      result
- * @retval      ICO_SYC_EOK     success
- * @retval      ICO_SYC_EIO     error(D-Bus initialize error)
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_syc_apc_regulation_init(void)
-{
-    int     i;
-    DBusError dbus_error;
-
-    apfw_trace("ico_syc_apc_regulation_init: Enter");
-
-    /* get configurations                           */
-    confsys = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
-
-    if (! confsys) {
-        apfw_trace("ico_syc_apc_regulation_init: Leave(can not read configuration)");
-        return ICO_SYC_EIO;
-    }
-    ncategory = confsys->categoryNum;
-    category = confsys->category;
-
-    memset(vehicle_data, 0, sizeof(vehicle_data));
-    memset(control, 0, sizeof(control));
-    for (i = 0; i <ncategory; i++)  {
-        control[i].display = ICO_SYC_APC_REGULATION_NOREGULATION;
-        control[i].sound = ICO_SYC_APC_REGULATION_NOREGULATION;
-        control[i].input = ICO_SYC_APC_REGULATION_NOREGULATION;
-    }
-
-    /* Reset D-Bus error        */
-    dbus_error_init(&dbus_error);
-
-    /* Get D-Bus connection     */
-    dbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &dbus_error);
-    if (! dbus_connection){
-        apfw_warn("ico_syc_apc_regulation_init: Leave(ERROR dbus_bus_get)" );
-        return ICO_SYC_EIO;
-    }
-
-    /* send request to AMB                  */
-    request_vehicle_info();
-
-    vehicle_timer = ecore_timer_add(0.1, rule_engine_wake, NULL);
-    if (! vehicle_timer)    {
-        apfw_error("ico_syc_apc_regulation_init: Leave(Can not create Ecore timer)");
-    }
-
-    apfw_trace("ico_syc_apc_regulation_init: Leave(EOK)");
-
-    return ICO_SYC_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_syc_apc_regulation_term: terminate regulation control
- *
- * @param       none
- * @return      always ICO_SYC_EOK(success)
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_syc_apc_regulation_term(void)
-{
-    apfw_trace("ico_syc_apc_regulation_term: Enter");
-
-    if (! confsys) {
-        apfw_trace("ico_syc_apc_regulation_term: Leave(not initialized)");
-        return ICO_SYC_EOK;
-    }
-    ecore_timer_del(vehicle_timer);
-
-    confsys = NULL;
-
-    apfw_trace("ico_syc_apc_regulation_term: Leave(EOK)");
-    return ICO_SYC_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_syc_apc_regulation_listener: set regulation control listener
- *
- * @param[in]   func            listener function
- * @param[in]   user_data       user data
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-ico_syc_apc_regulation_listener(ico_apc_regulation_cb_t func, void *user_data)
-{
-    int     idx;
-
-    if (func == NULL)   {
-        nregulation_cb = 0;
-        return;
-    }
-
-    for (idx = 0; idx < nregulation_cb; idx++)  {
-        if (regulation_cb[idx] == func) break;
-    }
-    if (idx >= nregulation_cb)  {
-        if (nregulation_cb >= ICO_SYC_APC_REGULATION_LISTENERS) {
-            apfw_error("ico_syc_apc_regulation_listener: Too many listeners");
-            return;
-        }
-        idx = nregulation_cb;
-        nregulation_cb ++;
-    }
-    regulation_cb[idx] = func;
-    regulation_cb_user_data[idx] = user_data;
-
-    for (idx = 0; idx < ncategory; idx++) {
-        (*func)(idx, control[idx], user_data);
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_syc_apc_regulation_app_visible: get display regulation status
- *
- * @param[in]   category    category Id
- * @return      result
- * @retval      TRUE        The application of this category can use the display
- * @retval      FALSE       The application of this category can not use the display
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_syc_apc_regulation_app_visible(const int category)
-{
-    if ((category < 0) || (category >= ICO_UXF_CATEGORY_MAX))    {
-        apfw_warn("ico_syc_apc_regulation_app_visible: Illegal category(%d)", category);
-        return TRUE;
-    }
-    if (control[category].display == ICO_SYC_APC_REGULATION_NOREGULATION)   {
-        return TRUE;
-    }
-    return FALSE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_syc_apc_regulation_app_sound: get sound reguration status
- *
- * @param[in]   category    category Id
- * @return      result
- * @retval      TRUE        The application of this category can use the sound output
- * @retval      FALSE       The application of this category can not use the sound output
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_syc_apc_regulation_app_sound(const int category)
-{
-    if ((category < 0) || (category >= ICO_UXF_CATEGORY_MAX))    {
-        apfw_warn("ico_syc_apc_regulation_app_sound: Illegal category(%d)", category);
-        return TRUE;
-    }
-    if (control[category].sound == ICO_SYC_APC_REGULATION_NOREGULATION) {
-        return TRUE;
-    }
-    return FALSE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_syc_apc_regulation_app_input: get input switch reguration status
- *
- * @param[in]   category    category Id
- * @return      result
- * @retval      TRUE        The application of this category is available with an input
- * @retval      FALSE       The application of this category is not available with an input
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_syc_apc_regulation_app_input(const int category)
-{
-    if ((category < 0) || (category >= ICO_UXF_CATEGORY_MAX))    {
-        apfw_warn("ico_syc_apc_regulation_app_input: Illegal category(%d)", category);
-        return TRUE;
-    }
-    if (control[category].input == ICO_SYC_APC_REGULATION_NOREGULATION) {
-        return TRUE;
-    }
-    return FALSE;
-}
-
diff --git a/apps_controller/test/Makefile.am b/apps_controller/test/Makefile.am
deleted file mode 100644 (file)
index ac4950a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-noinst_LIBRARIES = libico_syc-apc.a
-
-noinst_PROGRAMS =       \
-    apc_test
-
-includedir = /usr/include/ico-uxf-weston-plugin
-
-libico_syc_apc_a_CFLAGS = -I/usr/include/ico-uxf-weston-plugin -I../include $(EFL_CFLAGS) @DBUS_CFLAGS@ @GLIB_CFLAGS@
-libico_syc_apc_a_SOURCES =          \
-       ico_syc_apc_control.c           \
-       ico_syc_apc_regulation.c
-
-AM_CFLAGS = $(GCC_CFLAGS)
-AM_CPPFLAGS = $(GCC_CFLAGS)    \
-       -DDATADIR='"$(datadir)"'                \
-       -DMODULEDIR='"$(moduledir)"'            \
-       -DLIBEXECDIR='"$(libexecdir)"'
-
-check_PROGRAMS = apc_test
-
-AM_LDFLAGS = -module -avoid-version -rpath $(libdir) -lwayland-egl -lEGL -lGLESv2
-
-apc_test_lib = libico_syc-apc.a ../ico-app-framework/.libs/libico-app-fw-efl.so ../ico-app-framework/.libs/libico-app-fw.so  -lico-uxf-weston-plugin -lwebsockets $(AUL_LIBS)
-apc_test_dbus = -ldbus-1
-
-apc_test_SOURCE = apc_test.c
-apc_test_CFLAGS = -I/usr/include/ico-uxf-weston-plugin -I../include $(EFL_CFLAGS) @DBUS_CFLAGS@ @GLIB_CFLAGS@
-apc_test_LDADD = $(apc_test_lib) $(apc_test_dbus) -lrt -lm
-
-.FORCE :
-
diff --git a/apps_controller/test/apc_test.c b/apps_controller/test/apc_test.c
deleted file mode 100644 (file)
index 106922b..0000000
+++ /dev/null
@@ -1,119 +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   Applocation Controller Policy library test
- *
- * @date    Feb-15-2013
- */
-
-#include    <stdio.h>
-#include    <stdlib.h>
-#include    <unistd.h>
-#include    <stdbool.h>
-#include    <string.h>
-#include    <errno.h>
-#include    <pthread.h>
-#include    <sys/ioctl.h>
-#include    <sys/time.h>
-#include    <fcntl.h>
-#include    <Ecore.h>
-
-#include    "ico_syc_apc.h"
-#include    "ico_syc_apc_private.h"
-
-static Ecore_Task_Cb ecore_timer = NULL;
-static void *ecore_user_data = NULL;
-static int  time_ms = 100;
-
-/* Ecore dummy routine  */
-Ecore_Fd_Handler *
-ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func,
-                          const void *data, Ecore_Fd_Cb buf_func, const void *buf_data)
-{
-    apfw_trace("TEST: dummyy ecore_main_fd_handler_add(%d,%d,%08x,%08x,%08x,%08x)",
-               fd, (int)flags, (int)func, (int)data, (int)buf_func, (int)buf_data);
-    return (Ecore_Fd_Handler *)0x12345678;
-}
-
-Eina_Bool
-ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler,
-                                 Ecore_Fd_Handler_Flags flags)
-{
-    apfw_trace("TEST: dummyy ecore_main_fd_handler_active_get(%08x,%d)",
-               (int)fd_handler, (int)flags);
-    return EINA_FALSE;
-}
-
-void
-ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler,
-                                 Ecore_Fd_Handler_Flags flags)
-{
-    apfw_trace("TEST: dummyy ecore_main_fd_handler_active_set(%08x,%d)",
-               (int)fd_handler, (int)flags);
-}
-
-void *
-ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
-{
-    apfw_trace("TEST: dummyy ecore_main_fd_handler_del(%08x)", (int)fd_handler);
-    return NULL;
-}
-
-Ecore_Timer *
-ecore_timer_add(double dtime, Ecore_Task_Cb func, const void *user_data)
-{
-    ecore_timer = func;
-    ecore_user_data = (void *)user_data;
-    time_ms = (int)(dtime * 1000);
-    if (time_ms < 10)       time_ms = 10;
-    if (time_ms >= 1000)    time_ms = 990;
-
-    return (Ecore_Timer *)ecore_timer;
-}
-
-static void displaycontrol(const Ico_Uxf_conf_application *conf, const int control)
-{
-    apfw_trace("TEST: displaycontrol(%s, %d)", conf->appid, control);
-}
-
-static void soundcontrol(const Ico_Uxf_conf_application *conf, const int control)
-{
-    apfw_trace("TEST: soundcontrol(%s, %d)", conf->appid, control);
-}
-
-static void inputcontrol(const Ico_Uxf_conf_application *conf, const int control)
-{
-    apfw_trace("TEST: inputcontrol(%s, %d)", conf->appid, control);
-}
-
-int main(int argc, char *argv[])
-{
-    int         ret;
-    Eina_Bool   bret;
-
-    ret = ico_syc_apc_init(displaycontrol, soundcontrol, inputcontrol);
-    apfw_trace("TEST: ico_syc_apc_init() = %d", ret);
-
-    while (1)   {
-        usleep(time_ms * 1000);
-
-        if (ecore_timer)    {
-            apfw_trace("TEST: call ecore_timer");
-            bret = (*ecore_timer)(ecore_user_data);
-            apfw_trace("TEST: ret  ecore_timer(%d)", (int)bret);
-        }
-        else    {
-            apfw_trace("TEST: NO  ecore_timer");
-            break;
-        }
-    }
-
-    exit(0);
-}
-
diff --git a/apps_controller/test/goapc_test.sh b/apps_controller/test/goapc_test.sh
deleted file mode 100755 (executable)
index d252e11..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-export LD_LIBRARY_PATH=../ico-app-framework/.libs:$LD_LIBRARY_PATH
-gdb ./apc_test
-
index 9092a04..6b3267c 100644 (file)
@@ -2,17 +2,24 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.68])
-AC_INIT([org.tizen.ico.homescreen], [0.7.03], [])
-AM_INIT_AUTOMAKE([foreign 1.11])
+AC_INIT([org.tizen.ico.homescreen], [0.0.1], [])
+AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
 AC_CONFIG_SRCDIR([configure.ac])
 AC_CONFIG_HEADERS([config.h])
 
+AM_SILENT_RULES([yes])
+
 # Checks for programs.
+AC_PROG_AWK
+AC_PROG_CXX
 AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_LIBTOOL
 
 # Initialize libtool
 LT_PREREQ([2.2])
-LT_INIT([disable-static])
+#LT_INIT([disable-static])
+LT_INIT([static])
 
 # Checks for libraries.
 PKG_PROG_PKG_CONFIG()
@@ -20,29 +27,46 @@ PKG_PROG_PKG_CONFIG()
 AC_CHECK_LIB([aul], [aul_app_get_appid_bypid], AUL_LIBS="-laul")
 AC_SUBST(AUL_LIBS)
 
+# libraries for common.
 PKG_CHECK_MODULES([EINA], [eina])
 PKG_CHECK_MODULES([EVAS], [evas])
 PKG_CHECK_MODULES([ECORE], [ecore])
+PKG_CHECK_MODULES([GLIB], [glib-2.0])
+PKG_CHECK_MODULES([JSONGLIB], [json-glib-1.0])
+PKG_CHECK_MODULES([AIL], [ail])
+PKG_CHECK_MODULES([BUNDLE], [bundle])
+PKG_CHECK_MODULES([AUL], [aul])
+PKG_CHECK_MODULES([PKGMGR], [pkgmgr])
+PKG_CHECK_MODULES([WAYLANDCLIENT], [wayland-client])
+
+# libraries for homescreen.
 PKG_CHECK_MODULES([EDJE], [edje])
 PKG_CHECK_MODULES([ELEM], [elementary])
 PKG_CHECK_MODULES([ECOREWAYLAND], [ecore-wayland])
 PKG_CHECK_MODULES([ECOREX], [ecore-x])
+PKG_CHECK_MODULES([WAYLANDCURSOR], [wayland-cursor])
+
+# libraries for system-controller.
+PKG_CHECK_MODULES([DLOG], [dlog])
+PKG_CHECK_MODULES([CAPIAPPFWAPPLICATION], [capi-appfw-application])
+PKG_CHECK_MODULES([MURPHYCOMMON], [murphy-common]);
+PKG_CHECK_MODULES([MURPHYDOMAINCONTROLLER], [murphy-domain-controller]);
+PKG_CHECK_MODULES([MURPHYECORE], [murphy-ecore]);
+PKG_CHECK_MODULES([MURPHYRESOURCE], [murphy-resource]);
+PKG_CHECK_MODULES([LIBWEBSOCKETS], [libwebsockets]);
+PKG_CHECK_MODULES([ECOREEVAS], [ecore-evas])
+
+# Set flags
 EFL_CFLAGS="$EINA_CFLAGS $EVAS_CFLAGS $ECORE_CFLAGS $EDJE_CFLAGS $ELEM_CFLAGS $ECOREWAYLAND_CFLAGS"
 EFL_LIBS="$EINA_LIBS $EVAS_LIBS $ECORE_LIBS $EDJE_LIBS $ELEM_LIBS $ECOREWAYLAND_LIBS $ECOREX_LIBS"
 AC_SUBST(EFL_CFLAGS)
 AC_SUBST(EFL_LIBS)
 
-PKG_CHECK_MODULES([GLIB], [glib-2.0])
-PKG_CHECK_MODULES([DBUS], [dbus-1])
-PKG_CHECK_MODULES([JSONGLIB], [json-glib-1.0])
-OPT_CFLAGS="$GLIB_CFLAGS $JSONGLIB_CFLAGS"
-OPT_LIBS="$GLIB_LIBS $JSONGLIB_LIBS"
+OPT_CFLAGS="$DLOG_CFLAGS $GLIB_CFLAGS $JSONGLIB_CFLAGS"
+OPT_LIBS="$DLOG_LIBS $GLIB_LIBS $JSONGLIB_LIBS"
 AC_SUBST(OPT_CFLAGS)
 AC_SUBST(OPT_LIBS)
 
-PKG_CHECK_MODULES([AUL], [aul])
-PKG_CHECK_MODULES([BUNDLE], [bundle])
-PKG_CHECK_MODULES([AIL], [ail])
 AUL_CFLAGS="$AUL_CFLAGS $AIL_CFLAGS $BUNDLE_CFLAGS"
 AUL_LIBS="$AUL_LIBS $AIL_LIBS $BUNDLE_LIBS"
 AC_SUBST(AUL_CFLAGS)
@@ -53,14 +77,11 @@ UWS_LIBS="-lico-util-com"
 AC_SUBST(UWS_CFLAGS)
 AC_SUBST(UWS_LIBS)
 
-PKG_CHECK_MODULES([SLPPKGMGR], [pkgmgr])
 SLPPKGMGR_CFLAGS="$SLPPKGMGR_CFLAGS"
 SLPPKGMGR_LIBS="$SLPPKGMGR_LIBS"
 AC_SUBST(SLPPKGMGR_CFLAGS)
 AC_SUBST(SLPPKGMGR_LIBS)
 
-PKG_CHECK_MODULES([WAYLANDCLIENT], [wayland-client])
-PKG_CHECK_MODULES([WAYLANDCURSOR], [wayland-cursor])
 WL_CFLAGS="$WAYLANDCLIENT_CFLAGS $WAYLANDCURSOR_CFLAGS"
 WL_LIBS="$WAYLANDCLIENT_LIBS $WAYLANDCURSOR_LIBS"
 AC_SUBST(WL_CFLAGS)
@@ -71,7 +92,8 @@ if test "x$GCC" = "xyes"; then
         -Wno-missing-field-initializers -g -fvisibility=hidden"
     GCC_CFLAGS="$my_common_gcc_flags \
         -Wstrict-prototypes -Wmissing-prototypes"
-    GCC_CXXFLAGS="$my_common_gcc_flags"
+       GCC_CXXFLAGS="-Wall -Wextra -Wno-unused-parameter \
+               -Wno-missing-field-initializers -g"
 fi
 AC_SUBST(GCC_CFLAGS)
 AC_SUBST(GCC_CXXFLAGS)
@@ -80,18 +102,30 @@ AC_SUBST(GCC_CXXFLAGS)
 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h strings.h sys/file.h sys/ioctl.h sys/time.h unistd.h])
 
 # Checks for typedefs, structures, and compiler characteristics.
-AC_TYPE_INT32_T
+AC_HEADER_STDBOOL
+AC_C_INLINE
 AC_TYPE_SIZE_T
+AC_TYPE_INT32_T
 AC_TYPE_UINT32_T
 
 # Checks for library functions.
+AC_FUNC_FORK
 AC_FUNC_MALLOC
-AC_CHECK_FUNCS([gethostname gettimeofday memset setenv strcasecmp strdup strncasecmp strtol tzset])
+AC_FUNC_STRTOD
+AC_CHECK_FUNCS([gethostname gettimeofday memset setenv strcasecmp strdup strerror strncasecmp strtol strtoul tzset])
 
 AC_CONFIG_FILES([Makefile
-                                ico-app-framework/Makefile
+                 lib/Makefile
+                 lib/apps-framework/Makefile
+                 lib/misc/Makefile
+                 lib/misc/state-machine/Makefile
+                 lib/system-controller/Makefile
                  src/Makefile
-                 apps_controller/Makefile
-                 test/Makefile])
+                 src/syscond/Makefile
+                 src/homescreen/Makefile
+                                 tests/Makefile
+                 tests/system-controller/Makefile
+                 tests/system-controller/apps-framework/Makefile
+                 tests/system-controller/test-dummy-hs/Makefile])
 AC_PROG_RANLIB([ranlib])
 AC_OUTPUT
diff --git a/data/lib/systemd/user/ico-system-controller.service b/data/lib/systemd/user/ico-system-controller.service
new file mode 100644 (file)
index 0000000..6e1f5ae
--- /dev/null
@@ -0,0 +1,12 @@
+[Unit]
+Description=ico system controller
+
+[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
+ExecStart=/usr/bin/launch_app org.tizen.ico.system-controller
+
+[Install]
+WantedBy=weston.target
index 2c9b459..dcae004 100644 (file)
@@ -1,9 +1,13 @@
 [Desktop Entry]
 Name=HomeScreen
-Type=menu
-Exec=/usr/apps/org.tizen.ico.homescreen/bin/HomeScreen
+Name[en_GB]=HomeScreen
+Name[en_US]=HomeScreen
+Type=Application
+Exec=/opt/apps/org.tizen.ico.homescreen/bin/HomeScreen
 Icon=org.tizen.ico.homescreen.png
 NoDisplay=false
-Version=0.7.0
+Version=0.1.0
 Comment=home screen app
-Categories=Menu;HomeScreen;run=Center;noauto
+Hw-Acceleration=use-system-setting
+X-TIZEN-Removable=False
+X-TIZEN-PkgID=org.tizen.ico.homescreen
diff --git a/data/share/applications/org.tizen.ico.homescreen.desktop_bk b/data/share/applications/org.tizen.ico.homescreen.desktop_bk
new file mode 100644 (file)
index 0000000..2c79d9c
--- /dev/null
@@ -0,0 +1,8 @@
+Name=HomeScreen
+Type=menu
+Exec=/opt/apps/org.tizen.ico.homescreen/bin/HomeScreen
+Icon=org.tizen.ico.homescreen.png
+NoDisplay=false
+Version=0.1.0
+Comment=home screen app
+Categories=Menu;HomeScreen;run=Center;noauto
index be9d18b..30700d6 100644 (file)
@@ -1,9 +1,8 @@
-[Desktop Entry]
 Name=OnScreen
 Type=menu
-Exec=/usr/apps/org.tizen.ico.onscreen/bin/OnScreen
+Exec=/opt/apps/org.tizen.ico.onscreen/bin/OnScreen
 Icon=org.tizen.ico.onscreen.png
 NoDisplay=false
-Version=0.7.0
+Version=0.1.0
 Comment=onscreen app
 Categories=Menu;HomeScreen;run=Center;auto
diff --git a/data/share/applications/org.tizen.ico.sample.alignment.desktop b/data/share/applications/org.tizen.ico.sample.alignment.desktop
new file mode 100644 (file)
index 0000000..0de8cae
--- /dev/null
@@ -0,0 +1,7 @@
+Name=sampleAlignment
+Type=Application
+Exec=/opt/apps/org.tizen.ico.sample.alignment/bin/DummyApp -number=6
+Icon=org.tizen.ico.sample.alignment.png
+NoDisplay=false
+Version=0.1.0
+Comment=Dummy 
diff --git a/data/share/applications/org.tizen.ico.sample.browser.desktop b/data/share/applications/org.tizen.ico.sample.browser.desktop
new file mode 100644 (file)
index 0000000..6e68535
--- /dev/null
@@ -0,0 +1,7 @@
+Name=sampleBrowser
+Type=Application
+Exec=/opt/apps/org.tizen.ico.sample.browser/bin/DummyApp -number=4
+Icon=org.tizen.ico.sample.browser.png
+NoDisplay=false
+Version=0.1.0
+Comment=Dummy
diff --git a/data/share/applications/org.tizen.ico.sample.enginestatus.desktop b/data/share/applications/org.tizen.ico.sample.enginestatus.desktop
new file mode 100644 (file)
index 0000000..cccc03f
--- /dev/null
@@ -0,0 +1,7 @@
+Name=sampleEnginestatus
+Type=Application
+Exec=/opt/apps/org.tizen.ico.sample.enginestatus/bin/DummyApp -number=19
+Icon=org.tizen.ico.sample.enginestatus.png
+NoDisplay=false
+Version=0.1.0
+Comment=Dummy
diff --git a/data/share/applications/org.tizen.ico.sample.mail.desktop b/data/share/applications/org.tizen.ico.sample.mail.desktop
new file mode 100644 (file)
index 0000000..fac2b17
--- /dev/null
@@ -0,0 +1,7 @@
+Name=sampleMail
+Type=Application
+Exec=/opt/apps/org.tizen.ico.sample.mail/bin/DummyApp -number=2
+Icon=org.tizen.ico.sample.mail.png
+NoDisplay=false
+Version=0.1.0
+Comment=Dummy
diff --git a/data/share/applications/org.tizen.ico.sample.meter.desktop b/data/share/applications/org.tizen.ico.sample.meter.desktop
new file mode 100644 (file)
index 0000000..69ec312
--- /dev/null
@@ -0,0 +1,7 @@
+Name=sampleMeter
+Type=Application
+Exec=/opt/apps/org.tizen.ico.sample.meter/bin/DummyApp -number=17
+Icon=org.tizen.ico.sample.meter.png
+NoDisplay=false
+Version=0.1.0
+Comment=Dummy
diff --git a/data/share/applications/org.tizen.ico.sample.music.desktop b/data/share/applications/org.tizen.ico.sample.music.desktop
new file mode 100644 (file)
index 0000000..f96b681
--- /dev/null
@@ -0,0 +1,7 @@
+Name=sampleMusic
+Type=Application
+Exec=/opt/apps/org.tizen.ico.sample.music/bin/DummyApp -number=1
+Icon=org.tizen.ico.sample.music.png
+NoDisplay=false
+Version=0.1.0
+Comment=Dummy
diff --git a/data/share/applications/org.tizen.ico.sample.seatarrange.desktop b/data/share/applications/org.tizen.ico.sample.seatarrange.desktop
new file mode 100644 (file)
index 0000000..1aa0cca
--- /dev/null
@@ -0,0 +1,7 @@
+Name=sampleSeatarrange
+Type=Application
+Exec=/opt/apps/org.tizen.ico.sample.seatarrange/bin/DummyApp -number=5
+Icon=org.tizen.ico.sample.seatarrange.png
+NoDisplay=false
+Version=0.1.0
+Comment=Dummy
diff --git a/data/share/applications/org.tizen.ico.sample.setup.desktop b/data/share/applications/org.tizen.ico.sample.setup.desktop
new file mode 100644 (file)
index 0000000..e8d8651
--- /dev/null
@@ -0,0 +1,7 @@
+Name=sampleSetup
+Type=Application
+Exec=/opt/apps/org.tizen.ico.sample.setup/bin/DummyApp -number=12
+Icon=org.tizen.ico.sample.setup.png
+Version=0.1.0
+NoDisplay=false
+Comment=Dummy
diff --git a/data/share/applications/org.tizen.ico.sample.weather.desktop b/data/share/applications/org.tizen.ico.sample.weather.desktop
new file mode 100644 (file)
index 0000000..2d95066
--- /dev/null
@@ -0,0 +1,7 @@
+Name=sampleWeather
+Type=Application
+Exec=/opt/apps/org.tizen.ico.sample.weather/bin/DummyApp -number=3
+Icon=org.tizen.ico.sample.weather.png
+NoDisplay=false
+Version=0.1.0
+Comment=Dummy
index 45f7449..b137456 100644 (file)
@@ -1,9 +1,8 @@
-[Desktop Entry]
 Name=StatusBar
 Type=menu
-Exec=/usr/apps/org.tizen.ico.statusbar/bin/StatusBar
+Exec=/opt/apps/org.tizen.ico.statusbar/bin/StatusBar
 Icon=org.tizen.ico.statusbar.png
 NoDisplay=false
-Version=0.7.0
+Version=0.1.0
 Comment=status bar app
 Categories=Menu;HomeScreen;run=Center;auto
index 42afcc0..f78d34e 100644 (file)
@@ -2,7 +2,7 @@
 <manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.homescreen" version="0.7.0" install-location="internal-only">
        <label>HomeScreen</label>
        <description>IVI HomeScreen Application</description>
-       <ui-application appid="org.tizen.ico.homescreen" exec="/usr/apps/org.tizen.ico.homescreen/bin/HomeScreen" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+       <ui-application appid="org.tizen.ico.homescreen" exec="/usr/apps/org.tizen.ico.homescreen/bin/HomeScreen" nodisplay="true" multiple="false" type="capp" taskmanage="true">
                <icon>org.tizen.ico.homescreen.png</icon>
                <label>HomeScreen</label>
                <label xml:lang="en-gb">HomeScreen</label>
diff --git a/data/share/packages/org.tizen.ico.onscreen.xml b/data/share/packages/org.tizen.ico.onscreen.xml
deleted file mode 100644 (file)
index 1e7629e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.onscreen" version="0.7.0" install-location="internal-only">
-       <label>OnScreen</label>
-       <description>IVI OnScreen Application</description>
-       <ui-application appid="org.tizen.ico.onscreen" exec="/usr/apps/org.tizen.ico.onscreen/bin/OnScreen" nodisplay="false" multiple="false" type="capp" taskmanage="true">
-               <icon>org.tizen.ico.onscreen.png</icon>
-               <label>OnScreen</label>
-               <label xml:lang="en-gb">OnScreen</label>
-               <label xml:lang="en-us">OnScreen</label>
-       </ui-application>
-</manifest>
index 3626e51..0fddce6 100644 (file)
@@ -2,7 +2,7 @@
 <manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.statusbar" version="0.7.0" install-location="internal-only">
        <label>StatusBar</label>
        <description>IVI StatusBar Application</description>
-       <ui-application appid="org.tizen.ico.statusbar" exec="/usr/apps/org.tizen.ico.statusbar/bin/StatusBar" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+       <ui-application appid="org.tizen.ico.statusbar" exec="/usr/apps/org.tizen.ico.statusbar/bin/StatusBar" nodisplay="true" multiple="false" type="capp" taskmanage="true">
                <icon>org.tizen.ico.statusbar.png</icon>
                <label>StatusBar</label>
                <label xml:lang="en-gb">StatusBar</label>
diff --git a/data/share/packages/org.tizen.ico.system-controller.xml b/data/share/packages/org.tizen.ico.system-controller.xml
new file mode 100644 (file)
index 0000000..acb4364
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.system-controller" version="0.1.0-0" install-location="internal-only">
+       <label>system-controller</label>
+       <author email="" href=""> </author>
+       <description>ico system-controller</description>
+       <ui-application appid="org.tizen.ico.system-controller" exec="/usr/apps/org.tizen.ico.system-controller/bin/IcoSysconDaemon" nodisplay="true" multiple="false" type="capp" taskmanage="false">
+               <label>system-controller</label>
+               <icon> </icon>
+       </ui-application>
+</manifest>
diff --git a/ico-app-framework/Makefile.am b/ico-app-framework/Makefile.am
deleted file mode 100644 (file)
index bbd53a2..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-lib_LTLIBRARIES = libico-app-fw.la     \
-                               libico-app-fw-efl.la
-
-libico_app_fw_la_CFLAGS = -I../include -I/usr/include/ico-uxf-weston-plugin -I/usr/include/ico-util $(AUL_CFLAGS) $(SLPPKGMGR_CFLAGS) @GLIB_CFLAGS@
-libico_app_fw_la_LIBADD = $(WL_LIBS) $(AUL_LIBS) $(SLPPKGMGR_LIBS) @GLIB_LIBS@
-libico_app_fw_la_LDFLAGS = -version-info 0:7:0 
-libico_app_fw_la_SOURCES =          \
-       ico_uxf_conf_common.c           \
-       ico_uxf_conf_sys.c                      \
-       ico_uxf_conf_app.c                      \
-       ico_uxf_init.c                          \
-       ico_uxf_launcher.c                      \
-       ico_uxf_window.c                        \
-       ico_uxf_inputdev.c                      \
-       ico_apf_log.c                           \
-       ico_apf_communication.c         \
-       ico_apf_resource_control.c      \
-       ico_apf_appmgr.c
-
-libico_app_fw_efl_la_CFLAGS = -I../include -I/usr/include/ico-uxf-weston-plugin $(EFL_CFLAGS) @GLIB_CFLAGS@
-libico_app_fw_efl_la_LIBADD = $(WL_LIBS) $(EFL_LIBS) @GLIB_LIBS@
-libico_app_fw_efl_la_LDFLAGS = -version-info 0:7:0
-libico_app_fw_efl_la_SOURCES =          \
-       ico_apf_ecore.c             \
-       ico_uxf_conf_ecore.c
-
-AM_CFLAGS = $(GCC_CFLAGS)
-AM_CPPFLAGS = $(GCC_CFLAGS)    \
-       -DDATADIR='"$(datadir)"'                \
-       -DMODULEDIR='"$(moduledir)"'            \
-       -DLIBEXECDIR='"$(libexecdir)"'
-AM_LDFLAGS = -module -avoid-version -rpath $(libdir) -lwayland-egl -lEGL -lGLESv2 
-
-.FORCE :
-
diff --git a/ico-app-framework/ico_apf_apimacro.h b/ico-app-framework/ico_apf_apimacro.h
deleted file mode 100644 (file)
index d2fc6f4..0000000
+++ /dev/null
@@ -1,33 +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   header file of AppsController interface(API) macros
- *
- * @date    Feb-28-2013
- */
-
-#ifndef __ICO_APF_APIMACRO_H__
-#define __ICO_APF_APIMACRO_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Macros                                       */
-#if defined(__GNUC__) && __GNUC__ >= 4
-#define ICO_APF_API __attribute__ ((visibility("default")))
-#else
-#define ICO_APF_API
-#endif
-
-#ifdef  __cplusplus
-}
-#endif
-#endif /*__ICO_APF_APIMACRO_H__*/
-
diff --git a/ico-app-framework/ico_apf_appmgr.c b/ico-app-framework/ico_apf_appmgr.c
deleted file mode 100644 (file)
index ab5b121..0000000
+++ /dev/null
@@ -1,99 +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   header file of Apprication Framework (Application Manager)
- *
- * @date    Feb-28-2013
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <aul/aul.h>
-
-#include "ico_apf_private.h"
-#include "ico_uxf_conf.h"
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_get_app_id: Get application id(in AppCore) from application process id
- *
- * @param[in]   pid                 application process id
- * @param[out]  appid               application id
- * @return      result
- * @retval      ICO_APP_CTL_E_NONE              success
- * @retval      ICO_APP_CTL_E_INVALID_PARAM     error(pid dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_get_app_id(const int pid, char *appid)
-{
-    int     fd;
-    int     ppid = pid;
-    int     i, j;
-    int     size;
-    char    procpath[240];
-
-    memset(appid, 0, ICO_UXF_MAX_PROCESS_NAME+1);
-
-    if (ppid == 0)   {
-        ppid = getpid();
-    }
-
-    /* Get applicationId from AppCore(AUL)  */
-    if (aul_app_get_appid_bypid(ppid, appid, ICO_UXF_MAX_PROCESS_NAME)
-                    != AUL_R_OK)    {
-        snprintf(procpath, sizeof(procpath)-1, "/proc/%d/cmdline", ppid);
-        fd = open(procpath, O_RDONLY);
-        if (fd >= 0)    {
-            size = read(fd, procpath, sizeof(procpath));
-            for (; size > 0; size--)    {
-                if (procpath[size-1])   break;
-            }
-            if (size > 0)   {
-                /* Get program base name    */
-                i = 0;
-                for (j = 0; j < size; j++)  {
-                    if (procpath[j] == 0)   break;
-                    if (procpath[j] == '/') i = j + 1;
-                }
-                j = 0;
-                for (; i < size; i++)   {
-                    appid[j] = procpath[i];
-                    if ((appid[j] == 0) ||
-                        (j >= ICO_UXF_MAX_PROCESS_NAME))    break;
-                    j++;
-                }
-                /* Search application number    */
-                if ((appid[j] == 0) && (j < (ICO_UXF_MAX_PROCESS_NAME-1))) {
-                    for (; i < size; i++)   {
-                        if ((procpath[i] == 0) &&
-                            (procpath[i+1] == '@')) {
-                            strncpy(&appid[j], &procpath[i+1],
-                                    ICO_UXF_MAX_PROCESS_NAME - j - 1);
-                        }
-                    }
-                }
-            }
-            close(fd);
-        }
-        if (appid[0] == 0)  {
-            apfw_trace("ico_apf_get_app_id: LEAVE(pid=%d dose not exist)", ppid);
-            sprintf(appid, "?%d?", ppid);
-            return ICO_APP_CTL_E_INVALID_PARAM;
-        }
-    }
-    return ICO_APP_CTL_E_NONE;
-}
-
diff --git a/ico-app-framework/ico_apf_communication.c b/ico-app-framework/ico_apf_communication.c
deleted file mode 100644 (file)
index 1523a6e..0000000
+++ /dev/null
@@ -1,1536 +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   client library for communicate to AppsController in HomeScreen
- *
- * @date    Feb-28-2013
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <string.h>
-#include <poll.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <ico_uws.h>
-#include "ico_apf_private.h"
-#include "ico_uxf_conf.h"
-
-/*==============================================================================*/
-/* define static function prototype                                             */
-/*==============================================================================*/
-static ico_apf_com_handle_t *ico_apf_alloc_handle(void);
-static int ico_apf_com_connect(ico_apf_com_handle_t *handle);
-static int ico_apf_com_realsend(ico_apf_com_handle_t *handle,
-                                ico_apf_com_buffer_t *msg);
-static void ico_apf_callback_uws(const struct ico_uws_context *context,
-                                 const ico_uws_evt_e reason, const void *id,
-                                 const ico_uws_detail *detail, void *user_data);
-static void ico_apf_put_recvmsg(const int cmd, const int res, const int pid,
-                                const char *appid, char *msg, const int len,
-                                ico_apf_com_handle_t *handle);
-static int ico_apf_poll_fd_add(const int fd, const int flag);
-static void ico_apf_poll_fd_del(const int fd);
-static void ico_apf_poll_write_event(ico_apf_com_handle_t *handle, const int write);
-
-/*==============================================================================*/
-/* variable & table                                                             */
-/*==============================================================================*/
-/* variable that control program name in Linux  */
-extern const char *program_invocation_name;
-
-/* application framework control handle */
-static struct ico_uws_context  *global_uwscontext = NULL;
-static ico_apf_com_handle_t *handles = NULL;
-static ico_apf_com_handle_t *freehandles = NULL;
-
-/* file descriptor controll table       */
-static ico_apf_com_poll_t       *com_polls = NULL;
-static ico_apf_com_poll_t       *freecom_polls = NULL;
-static ico_apf_com_pollfd_cb   ico_apf_pollfd_func = NULL;
-
-/* global user listener                 */
-static ico_apf_com_eventlistener    global_listener = NULL;
-static void                         *global_user_data = NULL;
-
-/* flag for callback from comminucation */
-static int      uws_callbacked = 0;
-
-/* command/event string                 */
-const char  *ico_apf_cmd_table[] = {
-    ICO_APF_SRESOURCE_STATE_ACQUIRED,       /* acquired         */
-    ICO_APF_SRESOURCE_STATE_DEPRIVED,       /* deprived         */
-    ICO_APF_SRESOURCE_STATE_WAITTING,       /* waitting         */
-    ICO_APF_SRESOURCE_STATE_RELEASED,       /* released         */
-
-    ICO_APF_SRESOURCE_COMMAND_GET,          /* get command      */
-    ICO_APF_SRESOURCE_COMMAND_RELEASE,      /* release command  */
-    ICO_APF_SRESOURCE_COMMAND_ADD,          /* add command      */
-    ICO_APF_SRESOURCE_COMMAND_CHANGE,       /* change command   */
-    ICO_APF_SRESOURCE_COMMAND_DELETE,       /* delete command   */
-
-    ICO_APF_SRESOURCE_REPLY_OK,             /* OK reply         */
-    ICO_APF_SRESOURCE_REPLY_NG,             /* NG reply         */
-    ICO_APF_SRESOURCE_STATE_CONNECTED,      /* connected        */
-    ICO_APF_SRESOURCE_STATE_DISCONNECTED    /* disconnected     */
-};
-const char  *ico_apf_res_table[] = {
-    ICO_APF_SRESID_BASIC_SCREEN,            /* basic screen     */
-    ICO_APF_SRESID_INT_SCREEN,              /* interrupt screen */
-    ICO_APF_SRESID_ON_SCREEN,               /* onscreeen        */
-    ICO_APF_SRESID_BASIC_SOUND,             /* basic sound      */
-    ICO_APF_SRESID_INT_SOUND,               /* interrupt sound  */
-    ICO_APF_SRESID_INPUT_DEV                /* input device     */
-};
-const char  *ico_apf_sound_table[] = {
-    ICO_APF_SSOUND_COMMAND_MUTEON,          /* mute on          */
-    ICO_APF_SSOUND_COMMAND_MUTEOFF,         /* mute off         */
-    ICO_APF_SSOUND_COMMAND_CANCEL,          /* cancel           */
-    ICO_APF_SSOUND_COMMAND_GETLIST,         /* get stream list  */
-    ICO_APF_SSOUND_COMMAND_FRESH,           /* fresh            */
-    ICO_APF_SSOUND_COMMAND_ALLMUTEON,       /* mute set all stream*/
-    ICO_APF_SSOUND_COMMAND_ALLMUTEOFF,      /* mute reset all stream*/
-    ICO_APF_SSOUND_EVENT_NEW,               /* created new stream*/
-    ICO_APF_SSOUND_EVENT_FREE,              /* destoryed stream */
-    ICO_APF_SSOUND_REPLY_LIST               /* reply of stream list*/
-};
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_com_init_client
- *          This function connects to AppsController in HomeScreen.
- *          If you use AppsController's function, you must call this function.
- *
- * @param[in]   uri                 connection URI, NULL is host myself
- * @param[in]   type                connection type
- * @return      handle address
- * @retval      handle address      success
- * @retval      NULL                error(failed connect AppsController)
- */
-/*--------------------------------------------------------------------------*/
-ico_apf_com_handle_t *
-ico_apf_com_init_client(const char *uri, const int type)
-{
-    int i;
-    int ret;
-    int port;
-    char* address;
-    ico_apf_com_poll_t *p;
-    ico_apf_com_handle_t *handle;
-    Ico_Uxf_Sys_Config *sysconf;
-    Ico_Uxf_Sys_Config *ifsysconf = (Ico_Uxf_Sys_Config *)0xffffffff;
-    char *port_env;
-    char *host_env;
-
-    apfw_trace("ico_apf_com_init_client: Enter(%s,%d)",
-                uri ? uri : "(NULL)", type);
-
-    ifsysconf = (Ico_Uxf_Sys_Config *)ico_uxf_ifGetSysConfig();
-
-    if (ifsysconf)  {
-        /* Another module already reads config file                             */
-        /* In this case, you don't release sysconf at finished this function.   */
-        sysconf = (Ico_Uxf_Sys_Config *)ifsysconf;
-    }
-    else    {
-        /* never read a system config                   */
-        sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
-    }
-    if (!sysconf)   {
-        apfw_error("ico_apf_com_init_client: Leave(can not read configuration files)");
-        return NULL;
-    }
-
-    /* If URI is host name, find address from config.   */
-    /* If node is a null character string, it regards NULL. */
-    Ico_Uxf_conf_host *phost =
-        (Ico_Uxf_conf_host *) ico_uxf_getSysHostById(ico_uxf_getSysHostByName(uri));
-    if (phost)  {
-        address = phost->address;
-    }
-    else    {
-        /* If don't find host name from config, regards ipaddress is set as node.*/
-        address = (char *)uri;
-    }
-
-    /* environment variable for port & host */
-    if (type == ICO_APF_COM_TYPE_APPSCTL)   {
-        port = sysconf->misc.appscontrollerport;
-        port_env = getenv("ICO_APF_APPSCTL_PORT");
-        host_env = getenv("ICO_APF_APPSCTL_HOST");
-    }
-    else    {
-        port = sysconf->misc.soundpluginport;
-        port_env = getenv("ICO_APF_SOUNDMGR_PORT");
-        host_env = getenv("ICO_APF_SOUNDMGR_HOST");
-    }
-    if (port_env) {
-        i = atoi(port_env);
-        if (i > 0)  port = i;
-    }
-    if (host_env)   {
-        address = host_env;
-    }
-
-    /* get a port number from system configuration(system/system.conf)  */
-    apfw_trace("ico_apf_com_init_client: connect Host=%s Port=%d", address, port);
-
-    handle = handles;
-    while (handle)  {
-        if ((strcmp(handle->ip, address) == 0) &&
-            (handle->port == port) && (handle->type == type))   {
-            break;
-        }
-        handle = handle->next;
-    }
-
-    if (handle) {
-        apfw_trace("ico_apf_com_init_client: Leave(Connected)");
-        return handle;
-    }
-
-    handle = ico_apf_alloc_handle();
-    if (! handle)   {
-        apfw_trace("ico_apf_com_init_client: Leave(No Memory)");
-        return NULL;
-    }
-
-    handle->type = type;
-    handle->port = port;
-    strncpy(handle->ip, address, ICO_APF_RESOURCE_IP_LEN-1);
-    handle->ip[ICO_APF_RESOURCE_IP_LEN-1] = 0;
-
-    /* connect to AppsController            */
-    ret = ico_apf_com_connect(handle);
-
-    if (! ifsysconf)    {
-        ico_uxf_closeSysConfig();
-    }
-
-    if (ret != ICO_APF_RESOURCE_E_NONE) {
-        apfw_error("ico_apf_com_init_client: Leave(RESOURCE_E_INIT_COM_FAILD)");
-        (void) ico_apf_com_term_client(handle);
-        return NULL;
-    }
-
-    /* Try to connection        */
-    ico_apf_com_dispatch(handle);
-
-    /* add poll callback if fd is exist */
-    if (handle->fd > 0) {
-        handle->service_on = 1;
-        (void)ico_apf_poll_fd_add(handle->fd, POLLIN);
-    }
-
-    p = com_polls;
-    while (p)   {
-        if (p->fd == handle->fd)    {
-            p->apf_fd_control = (void *)handle;
-            handle->poll = p;
-        }
-        p = p->next;
-    }
-    apfw_trace("ico_apf_com_init_client: Leave(OK,fd=%d)", handle->fd);
-    return handle;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_com_init_server
- *          This function connects to aplicationto in AppsController.
- *
- * @param[in]   uri                 my URI, NULL is host myself
- * @param[in]   type                connection type
- * @return      handle address
- * @retval      handle address      success
- * @retval      NULL                error(failed connect AppsController)
- */
-/*--------------------------------------------------------------------------*/
-ico_apf_com_handle_t *
-ico_apf_com_init_server(const char *uri, const int type)
-{
-    int i;
-    int ret;
-    int port;
-    int svrtype;
-    char* address;
-    ico_apf_com_handle_t *handle;
-    Ico_Uxf_Sys_Config *sysconf;
-    Ico_Uxf_Sys_Config *ifsysconf = (Ico_Uxf_Sys_Config *)0xffffffff;
-    char *port_env;
-    char uri_name[32];
-
-    apfw_trace("ico_apf_com_init_server: Enter(%s,%d)",
-               uri ? uri : "(NULL)", type);
-
-    ifsysconf = (Ico_Uxf_Sys_Config *)ico_uxf_ifGetSysConfig();
-
-    if (ifsysconf)  {
-        /* Another module already reads config file                             */
-        /* In this case, you don't release sysconf at finished this function.   */
-        sysconf = (Ico_Uxf_Sys_Config *)ifsysconf;
-    }
-    else    {
-        /* never read a system config                   */
-        sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
-    }
-    if (!sysconf)   {
-        apfw_error("ico_apf_com_init_server: Leave(can not read configuration files)");
-        return NULL;
-    }
-
-    /* currently server support only Application Controler  */
-    svrtype = ICO_APF_COM_TYPE_SVR_APPSCTL;
-
-    /* If URI is host name, find address from config.   */
-    /* If node is a null character string, it regards NULL. */
-    Ico_Uxf_conf_host *phost =
-        (Ico_Uxf_conf_host *) ico_uxf_getSysHostById(ico_uxf_getSysHostByName(uri));
-    if (phost)  {
-        address = phost->address;
-    }
-    else    {
-        /* If don't find host name from config, regards ipaddress is set as node.*/
-        address = (char *)uri;
-    }
-
-    /* get a port number from system configuration(system/system.conf)  */
-    port = sysconf->misc.appscontrollerport;
-    apfw_trace("ico_apf_com_init_server: Config, Host=%s Port=%d", address, port);
-
-    /* environment variable for port        */
-    port = sysconf->misc.appscontrollerport;
-    port_env = getenv("ICO_APF_APPSCTL_PORT");
-    if (port_env) {
-        i = atoi(port_env);
-        if (i > 0)  port = i;
-    }
-
-    handle = handles;
-    while (handle)  {
-        if ((strcmp(address, handle->ip) == 0) &&
-            (handle->port == port) && (handle->type == svrtype))    break;
-        handle = handle->next;
-    }
-
-    if (handle) {
-        apfw_trace("ico_apf_com_init_server: Leave(Created)");
-        return handle;
-    }
-
-    handle = ico_apf_alloc_handle();
-    if (! handle)   {
-        apfw_error("ico_apf_com_init_server: Leave(No Memory)");
-        return NULL;
-    }
-
-    handle->type = svrtype;
-    handle->port = port;
-    strncpy(handle->ip, address, ICO_APF_RESOURCE_IP_LEN-1);
-    handle->ip[ICO_APF_RESOURCE_IP_LEN-1] = 0;
-
-    /* connect to AppsController            */
-    snprintf(uri_name, sizeof(uri_name), ":%d", port);
-    handle->uws_context = ico_uws_create_context(uri_name, ICO_PROTOCOL_APPSCONTROLLER);
-
-    if (! handle->uws_context)  {
-        apfw_error("ico_apf_com_init_server: Leave(ico_uws_create_context create Error)");
-        (void) ico_apf_com_term_server(handle);
-        return NULL;
-    }
-    apfw_trace("ico_apf_com_init_server: create server context 0x%08x",
-               (int)handle->uws_context);
-
-    ret = ico_uws_set_event_cb(handle->uws_context, ico_apf_callback_uws, (void *)handle);
-    if (ret != ICO_UWS_ERR_NONE)    {
-        apfw_error("co_apf_com_init_server: ico_uws_set_event_cb Error(%d)", ret);
-        apfw_trace("ico_apf_com_init_server: Leave(ERR)");
-        return NULL;
-    }
-
-    global_uwscontext = handle->uws_context;
-
-    ico_apf_com_dispatch(handle);
-
-    apfw_trace("ico_apf_com_init_server: Leave(OK)");
-    return handle;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_alloc_handle
- *          Allocate ccommunication handle.
- *
- * @param       none
- * @return      handle address
- * @retval      addres      success, return handle address
- * @retval      NULL        error(no memory)
- */
-/*--------------------------------------------------------------------------*/
-static ico_apf_com_handle_t *
-ico_apf_alloc_handle(void)
-{
-    ico_apf_com_handle_t *handle;
-    int     i;
-
-    if (! freehandles)  {
-
-        handle = malloc(sizeof(ico_apf_com_handle_t));
-        if (! handle)   {
-            return NULL;
-        }
-        memset(handle, 0, sizeof(ico_apf_com_handle_t));
-
-        /* Queue buffers initialize.                */
-        for (i = 0; i < ICO_APF_RESOURCE_WSOCK_BUFR; i++)   {
-            handle->rbuf[i] = calloc(sizeof(ico_apf_com_buffer_t), 1);
-            if (! handle->rbuf[i])  {
-                return NULL;
-            }
-        }
-        for (i = 0; i < ICO_APF_RESOURCE_WSOCK_BUFS; i++)   {
-            handle->sbuf[i] = calloc(sizeof(ico_apf_com_buffer_t), 1);
-            if (! handle->sbuf[i])  {
-                return NULL;
-            }
-        }
-    }
-    else    {
-        handle = freehandles;
-        freehandles = freehandles->next;
-        handle->next = NULL;
-        handle->fd = 0;
-        handle->pid = 0;
-        handle->uws_context = NULL;
-        handle->uws_id = NULL;
-        handle->service_on = 0;
-        handle->retry = 0;
-        handle->shead = 0;
-        handle->stail = 0;
-        handle->rhead = 0;
-        handle->rtail = 0;
-        handle->listener = NULL;
-        handle->user_data = NULL;
-        handle->type = 0;
-    }
-
-    if (handles)    {
-        handle->next = handles;
-    }
-    handles = handle;
-
-    return handle;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_com_connect
- *          This function connects to AppsController.
- *
- * @param[in]   handle          Communication handle
- * @return      result status
- * @retval      ICO_APF_RESOURCE_E_NONE             success
- * @retval      ICO_APF_RESOURCE_E_INIT_COM_FAILD   error(connect failed)
- */
-/*--------------------------------------------------------------------------*/
-static int
-ico_apf_com_connect(ico_apf_com_handle_t *handle)
-{
-    int     ret;
-    char    *protocol;
-    char    uri_name[64];
-
-    apfw_trace("ico_apf_com_connect: Enter(type=%d)", handle->type);
-
-    snprintf(uri_name, sizeof(uri_name), "ws://%s:%d", handle->ip, handle->port);
-    if ((handle->type & ICO_APF_COM_TYPE_CONNECTION) == ICO_APF_COM_TYPE_SOUNDMGR)
-        protocol = ICO_PROTOCOL_MULTISOUNDMANAGER;
-    else
-        protocol = ICO_PROTOCOL_APPSCONTROLLER;
-    handle->uws_context = ico_uws_create_context(uri_name, protocol);
-
-    if (handle->uws_context == NULL) {
-        apfw_error("ico_apf_com_connect: ico_uws_create_context Error(%s,%s)",
-                   uri_name, protocol);
-        apfw_trace("ico_apf_com_connect: Leave(RESOURCE_E_INIT_COM_FAILD)");
-        return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
-    }
-    apfw_trace("ico_apf_com_connect: create client context 0x%08x",
-               (int)handle->uws_context);
-
-    ret = ico_uws_set_event_cb(handle->uws_context, ico_apf_callback_uws, (void *)handle);
-    if (ret != ICO_UWS_ERR_NONE)    {
-        apfw_error("ico_apf_com_connect: ico_uws_set_event_cb Error(%d)", ret);
-        apfw_trace("ico_apf_com_connect: Leave(RESOURCE_E_INIT_COM_FAILD)");
-        return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
-    }
-
-    /* dispatch for connection  */
-    ico_apf_com_dispatch(handle);
-
-    if (handle->fd > 0) {
-        (void)ico_apf_poll_fd_add(handle->fd, POLLIN|POLLOUT);
-    }
-
-    apfw_trace("ico_apf_com_connect: Leave(OK, fd=%d)", handle->fd);
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_com_isconnected
- *          return a connection status with AppsController
- *
- * @param[in]   handle      AppsController's handle
- * @return      connection status
- * @retval      1           connect
- * @retval      0           not connetc
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_apf_com_isconnected(ico_apf_com_handle_t *handle)
-{
-    return((handle != NULL) && (handle->service_on != 0));
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_com_dispatch
- *          The accumulated transmitted and received data is processed.
- *          Connecting AppsController program must call this function.
- *
- * @param[in]   handle      connect handle, if NULL target is all connect
- * @return      non
- */
-/*--------------------------------------------------------------------------*/
-void
-ico_apf_com_dispatch(ico_apf_com_handle_t *handle)
-{
-    int rh;
-    int n;
-    ico_apf_com_handle_t *p;
-
-    if (! handles)  {
-        /* If program has not connected, nothing is done.   */
-        apfw_warn("ico_apf_com_dispatch: handle dose not exist");
-        return;
-    }
-
-    if (handle) {
-        p = handle;
-    }
-    else    {
-        p = handles;
-    }
-
-    while (p)   {
-        ico_uws_service(p->uws_context);
-
-        /* If received data is suspended, it processes.     */
-        while (p->rtail != p->rhead)    {
-            rh = p->rhead;
-            if (p->rhead >= (ICO_APF_RESOURCE_WSOCK_BUFR-1))    {
-                p->rhead = 0;
-            }
-            else    {
-                p->rhead ++;
-            }
-            n = p->rtail - p->rhead;
-            if (n < 0) {
-                n = ICO_APF_RESOURCE_WSOCK_BUFR + n;
-            }
-
-            if (p->listener != NULL) {
-                handle->listener(p, p->rbuf[rh]->cmd, p->rbuf[rh]->res, p->rbuf[rh]->pid,
-                                 p->rbuf[rh]->appid, p->rbuf[rh]->msg, p->user_data);
-                ico_uws_service(p->uws_context);
-            }
-            else if (global_listener != NULL) {
-                global_listener(p, p->rbuf[rh]->cmd, p->rbuf[rh]->res, p->rbuf[rh]->pid,
-                                p->rbuf[rh]->appid, p->rbuf[rh]->msg, global_user_data);
-                ico_uws_service(p->uws_context);
-            }
-        }
-        if (handle) break;
-        p = p->next;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_com_term_client
- *          finish to connect to AppsController
- *          It recommends call this function before end of program
- *          that used AppsController.
- *
- * @param[in]   handle      AppsController's handle
- * @return      result
- * @retval      ICO_APF_RESOURCE_E_NONE             success
- * @retval      ICO_APF_RESOURCE_E_NOT_INITIALIZED  error(already finished)
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_apf_com_term_client(ico_apf_com_handle_t *handle)
-{
-    ico_apf_com_handle_t    *p;
-
-    apfw_trace("ico_apf_com_term_client: Enter");
-
-    if ((handle == NULL) || (handles == NULL))  {
-        apfw_trace("ico_apf_com_term_client: Leave(RESOURCE_E_NOT_INITIALIZED)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-    handle->service_on = 0;
-
-    if (handle == handles)  {
-        handles = handles->next;
-    }
-    else    {
-        p = handles;
-        while (p)   {
-            if (p->next == handle)  break;
-            p = p->next;
-        }
-        if (! p)    {
-            apfw_trace("ico_apf_com_term_client: Leave(RESOURCE_E_NOT_INITIALIZED)");
-            return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-        }
-        p->next = handle->next;
-    }
-
-    if (handle->uws_context)    {
-        ico_uws_unset_event_cb(handle->uws_context);
-        ico_uws_close(handle->uws_context);
-    }
-    handle->next = freehandles;
-    freehandles = handle;
-
-    apfw_trace("ico_apf_com_term_client: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_com_term_server
- *          finish to connect to application
- *
- * @param[in]   handle      AppsController's handle
- * @return      result
- * @retval      ICO_APF_RESOURCE_E_NONE             success
- * @retval      ICO_APF_RESOURCE_E_NOT_INITIALIZED  error(already finished)
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_apf_com_term_server(ico_apf_com_handle_t *handle)
-{
-    ico_apf_com_handle_t    *p;
-
-    apfw_trace("ico_apf_com_term_server: Enter");
-
-    if ((handle == NULL) || (handles == NULL))  {
-        apfw_trace("ico_apf_com_term_server: Leave(RESOURCE_E_NOT_INITIALIZED)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-    handle->service_on = 0;
-
-    if (handle == handles)  {
-        handles = handles->next;
-    }
-    else    {
-        p = handles;
-        while (p)   {
-            if (p->next == handle)  break;
-            p = p->next;
-        }
-        if (! p)    {
-            apfw_trace("ico_apf_com_term_server: Leave(RESOURCE_E_NOT_INITIALIZED)");
-            return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-        }
-        p->next = handle->next;
-    }
-
-    if (handle->uws_context)    {
-        ico_uws_unset_event_cb(handle->uws_context);
-        ico_uws_close(handle->uws_context);
-    }
-    handle->next = freehandles;
-    freehandles = handle;
-
-    apfw_trace("ico_apf_com_term_server: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_com_send
- *          Accumulates the data send to AppsController/application.
- *
- * @param[in]   handle      AppsController's handle
- * @param[in]   cmd         command
- * @param[in]   res         resource
- * @param[in]   appid       application id
- * @param[in]   msg         send message
- * @return      result
- * @retval      ICO_APF_RESOURCE_E_NONE             success
- * @retval      ICO_APF_RESOURCE_E_NOT_INITIALIZED  error(not connect)
- * @retval      ICO_APF_RESOURCE_E_COMMUNICATION    error(cannot send)
- * @retval      ICO_APF_RESOURCE_E_INVAL            error(invalid parameter)
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_apf_com_send(ico_apf_com_handle_t *handle,
-                 const int cmd, const int res, const char *appid, char *msg)
-{
-    int     st;
-    int     cur;
-    int     len;
-
-    apfw_trace("ico_apf_com_send: Enter(%08x, %d, %d) callback=%d",
-               (int)handle, cmd, res, uws_callbacked);
-
-    if ((handle == NULL) || (! ico_apf_com_isconnected(handle)))    {
-        apfw_warn("ico_apf_com_send: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-    if ((handle->type & ICO_APF_COM_TYPE_CONNECTION) != ICO_APF_COM_TYPE_SOUNDMGR)  {
-        /* send to AppsController               */
-        if ((cmd < ICO_APF_RESOURCE_COMMAND_MIN) ||
-            (cmd > ICO_APF_RESOURCE_COMMAND_MAX) ||
-            (res < ICO_APF_RESOURCE_RESID_MIN) ||
-            (res > ICO_APF_RESOURCE_RESID_MAX))   {
-            apfw_warn("ico_apf_com_send: Leave(invalid command for resource)");
-            return ICO_APF_RESOURCE_E_INVAL;
-        }
-    }
-    else    {
-        /* send to Multi Sound Manager          */
-        if ((cmd < ICO_APF_SOUND_COMMAND_MIN) ||
-            (cmd > ICO_APF_SOUND_COMMAND_CMD))  {
-            apfw_warn("ico_apf_com_send: Leave(invalid command for sound control)");
-            return ICO_APF_RESOURCE_E_INVAL;
-        }
-    }
-
-    if (msg)    {
-        len = strlen(msg);
-        if (len >= ICO_APF_RESOURCE_MSG_LEN)    {
-            apfw_warn("ico_apf_com_send: Leave(invalid message length)");
-            return ICO_APF_RESOURCE_E_INVAL;
-        }
-    }
-    else    {
-        len = 0;
-        msg = "(NULL)";
-    }
-
-    st = handle->stail;
-    cur = st;
-
-    if (st >= (ICO_APF_RESOURCE_WSOCK_BUFS-1))  {
-        st = 0;
-    }
-    else    {
-        st ++;
-    }
-    if (st == handle->shead)    {
-        /* send buffer is full                  */
-        ico_apf_poll_write_event(handle, 3);
-
-        apfw_error("ico_apf_com_send: Leave(send buffer overflow)");
-        ico_apf_poll_fd_del(handle->fd);
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-    handle->stail = st;
-
-    /* accumulate send buffer                   */
-    if ((! appid) || (*appid == 0)) {
-        handle->sbuf[cur]->pid = getpid();
-        handle->sbuf[cur]->appid[0] = 0;
-    }
-    else    {
-        handle->sbuf[cur]->pid = 0;
-        strncpy(handle->sbuf[cur]->appid, appid, ICO_UXF_MAX_PROCESS_NAME);
-        handle->sbuf[cur]->appid[ICO_UXF_MAX_PROCESS_NAME] = 0;
-    }
-    apfw_trace("ico_apf_com_send: Send.%d:%d %d %d(%s) <%s>",
-               handle->stail, cmd, res, handle->sbuf[cur]->pid,
-               handle->sbuf[cur]->appid, msg);
-    handle->sbuf[cur]->cmd = cmd;
-    handle->sbuf[cur]->res = res;
-    memcpy(handle->sbuf[cur]->msg, msg, len);
-    handle->sbuf[cur]->msg[len] = 0;
-
-    if (uws_callbacked) {
-        /* send call from communication callback, delayed send  */
-        ico_apf_poll_write_event(handle, 1);
-    }
-    else    {
-        /* not call from callback, direct send                  */
-        apfw_trace("ico_apf_com_send: direct send(context=%08x id=%08x)",
-                   (int)handle->uws_context, (int)handle->uws_id);
-        if ((handle->uws_context != NULL) &&
-            (handle->uws_id != NULL))   {
-            st = handle->shead;
-            if (handle->shead >= (ICO_APF_RESOURCE_WSOCK_BUFS-1))  {
-                handle->shead = 0;
-            }
-            else    {
-                handle->shead ++;
-            }
-            if (ico_apf_com_realsend(handle, handle->sbuf[st])
-                        != ICO_APF_RESOURCE_E_NONE) {
-                apfw_warn("ico_apf_com_send: ico_apf_com_realsend Error");
-                handle->shead = st;
-            }
-        }
-        ico_apf_com_dispatch(handle);           /* try to service           */
-    }
-    apfw_trace("ico_apf_com_send: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_com_realsend
- *          send messege to AppsController
- *
- * @param[in]   handle      AppsController's handle
- * @param[in]   msg         Send message
- * @return      result
- * @retval      ICO_APF_RESOURCE_E_NONE             success
- * @retval      ICO_APF_RESOURCE_E_NOT_INITIALIZED  error(not connect)
- * @retval      ICO_APF_RESOURCE_E_COMMUNICATION    error(cannot send)
- * @retval      ICO_APF_RESOURCE_E_INVAL            error(invalid parameter)
- */
-/*--------------------------------------------------------------------------*/
-static int
-ico_apf_com_realsend(ico_apf_com_handle_t *handle, ico_apf_com_buffer_t *msg)
-{
-    char    buf[256];
-
-    apfw_trace("ico_apf_com_realsend: Enter");
-    if ((handle == NULL) || (! ico_apf_com_isconnected(handle)))    {
-        apfw_warn("ico_apf_com_realsend: Leave(Not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    if ((handle->type & ICO_APF_COM_TYPE_CONNECTION) == ICO_APF_COM_TYPE_SOUNDMGR)  {
-        /* send to Multi Sound Manager          */
-        if (msg->res)   {
-            snprintf(buf, sizeof(buf), "%s %d",
-                    ico_apf_sound_table[msg->cmd-ICO_APF_SOUND_COMMAND_MIN], msg->res);
-        }
-        else    {
-            strcpy(buf, ico_apf_sound_table[msg->cmd-ICO_APF_SOUND_COMMAND_MIN]);
-        }
-    }
-    else    {
-        /* send tp AppsController               */
-        if (msg->appid[0])  {
-            snprintf(buf, sizeof(buf), "%s %s %s %s",
-                     ico_apf_cmd_table[msg->cmd-ICO_APF_RESOURCE_COMMAND_MIN],
-                     ico_apf_res_table[msg->res-ICO_APF_RESOURCE_RESID_MIN],
-                     msg->appid, msg->msg);
-        }
-        else    {
-            snprintf(buf, sizeof(buf), "%s %s %d %s",
-                     ico_apf_cmd_table[msg->cmd-ICO_APF_RESOURCE_COMMAND_MIN],
-                     ico_apf_res_table[msg->res-ICO_APF_RESOURCE_RESID_MIN],
-                     msg->pid, msg->msg);
-        }
-    }
-
-    apfw_trace("ico_apf_com_realsend: ico_uws_send[%s]", buf);
-    ico_uws_send(handle->uws_context, handle->uws_id, (unsigned char *)buf, strlen(buf));
-
-    apfw_trace("ico_apf_com_realsend: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_com_addeventlistener
- *          register a callback function called receive message from AppsController
- *
- * @param[in]   handle      AppsComtroller's handle
- * @param[in]   listener    callback function
- * @param[in]   user_data   Arbitrary data
- * @return      result
- * @retval      ICO_APF_RESOURCE_E_NONE             success
- * @retval      ICO_APF_RESOURCE_E_NOT_INITIALIZED  error(not connect)
- * @retval      ICO_APF_RESOURCE_E_INVAL            error(already registed)
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_apf_com_addeventlistener(ico_apf_com_handle_t *handle,
-                             ico_apf_com_eventlistener listener, void* user_data)
-{
-    if (handle == NULL) {
-        if (global_listener)    {
-            return ICO_APF_RESOURCE_E_INVAL;
-        }
-        global_listener = listener;
-        global_user_data = user_data;
-        return ICO_APF_RESOURCE_E_NONE;
-    }
-
-    if (handle->listener)   {
-        return ICO_APF_RESOURCE_E_INVAL;
-    }
-    handle->user_data = user_data;
-    handle->listener = listener;
-
-    if (! global_listener)  {
-        /* save listener        */
-        global_listener = listener;
-    }
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_com_removeeventlistener
- *          unregister a callback function called receive message
- *
- * @param[in]   handle      AppsComtroller's handle
- * @return      result
- * @retval      ICO_APF_RESOURCE_E_NONE             success
- * @retval      ICO_APF_RESOURCE_E_NOT_INITIALIZED  error(not connect)
- * @retval      ICO_APF_RESOURCE_E_INVAL            error(do not registed)
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_apf_com_removeeventlistener(ico_apf_com_handle_t *handle)
-{
-    if (handle == NULL) {
-        if (! global_listener)  {
-            return ICO_APF_RESOURCE_E_INVAL;
-        }
-        global_listener = NULL;
-        global_user_data = NULL;
-        return ICO_APF_RESOURCE_E_NONE;
-    }
-
-    if (! handle->listener) {
-        return ICO_APF_RESOURCE_E_INVAL;
-    }
-    handle->listener = NULL;
-    handle->user_data = NULL;
-
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_callback_uws
- *          this callback function notified from communication.
- *
- * @param[in]   context     communication context
- * @param[in]   reason      event type
- * @param[in]   id          communication management table
- * @param[in]   detail      event detail information
- * @param[in]   user_data   communication handle
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_apf_callback_uws(const struct ico_uws_context *context,
-                     const ico_uws_evt_e reason, const void *id,
-                     const ico_uws_detail *detail, void *user_data)
-{
-    int     st;
-    int     cmd;
-    int     res;
-    int     pid;
-    int     i;
-    int     strlen;
-    char    *msg;
-    int     len;
-    ico_apf_com_handle_t *handle;
-    ico_apf_com_handle_t *handle2;
-    char    appid[ICO_UXF_MAX_PROCESS_NAME+1];
-    char    strname[ICO_UXF_MAX_STREAM_NAME+1];
-    int     nparam;
-    struct  {
-        short   start;
-        short   end;
-    }       param[10];
-
-    handle = (ico_apf_com_handle_t *)user_data;
-    uws_callbacked ++;
-
-    if (handle->type == ICO_APF_COM_TYPE_SVR_APPSCTL)   {
-        /* search client handle for server  */
-        handle2 = handles;
-        while (handle2)  {
-            if (handle2->uws_id == id)    break;
-            handle2 = handle2->next;
-        }
-        if (handle2)   {
-            handle = handle2;
-        }
-        else    {
-            apfw_trace("ico_apf_callback_uws: new server side client");
-
-            handle = ico_apf_alloc_handle();
-            if (! handle)   {
-                uws_callbacked --;
-                apfw_error("ico_apf_callback_uws: No Memory");
-                return;
-            }
-            apfw_trace("ico_apf_callback_uws: create new handle(%08x)", (int)handle);
-            handle->type = ICO_APF_COM_TYPE_APPSCTL;
-            handle->uws_context = (struct ico_uws_context *)context;
-            handle->uws_id = (void *)id;
-            handle->service_on = 0;
-
-            strncpy(handle->ip, ico_uws_get_uri(handle->uws_context),
-                    ICO_APF_RESOURCE_IP_LEN-1);
-        }
-    }
-
-    switch (reason) {
-    case ICO_UWS_EVT_OPEN:
-        apfw_trace("ico_apf_callback_uws: ICO_UWS_EVT_OPEN");
-        handle->uws_id = (void *)id;
-        handle->service_on = 1;
-
-        /* save receive message to receive buffer       */
-        ico_apf_put_recvmsg(ICO_APF_RESOURCE_STATE_CONNECTED, 0,
-                            handle->pid, "\0", NULL, 0, handle);
-        break;
-
-    case ICO_UWS_EVT_ADD_FD:                /* add connection socket            */
-        apfw_trace("ico_apf_callback_uws: ICO_UWS_EVT_ADD_FD(%d)", detail->_ico_uws_fd.fd);
-        handle->fd = detail->_ico_uws_fd.fd;
-        (void)ico_apf_poll_fd_add(detail->_ico_uws_fd.fd, POLLIN|POLLOUT);
-        break;
-
-    case ICO_UWS_EVT_DEL_FD:                /* delete connection socket         */
-        apfw_trace("ico_apf_callback_uws: ICO_UWS_EVT_DEL_FD(%d)", detail->_ico_uws_fd.fd);
-        handle->fd = 0;
-        ico_apf_poll_fd_del(detail->_ico_uws_fd.fd);
-        break;
-
-    case ICO_UWS_EVT_CLOSE:
-        apfw_trace("ico_apf_callback_uws: ICO_UWS_EVT_CLOSE pid=%d", handle->pid);
-        handle->service_on = 0;
-        handle->uws_id = NULL;
-        pid = handle->pid;
-        handle->pid = 0;
-
-        /* save receive message to receive buffer       */
-        ico_apf_put_recvmsg(ICO_APF_RESOURCE_STATE_DISCONNECTED, 0,
-                            pid, "\0", NULL, 0, handle);
-        break;
-
-    case ICO_UWS_EVT_RECEIVE:
-        msg = (char *)detail->_ico_uws_message.recv_data;
-        len = (int)detail->_ico_uws_message.recv_len;
-        if ((len <= 9) || (len >= (ICO_APF_RESOURCE_MSG_LEN+9)))    {
-            uws_callbacked --;
-            apfw_warn("ico_apf_callback_uws: Receive Length Error, Len=%d", len);
-            return;
-        }
-        msg[len] = 0;
-        apfw_trace("ico_apf_callback_uws: ICO_UWS_EVT_RECEIVE[%s]", msg);
-
-        /* analize event code               */
-        if ((handle->type & ICO_APF_COM_TYPE_CONNECTION) == ICO_APF_COM_TYPE_SOUNDMGR)  {
-            /* Multi Sound Manager          */
-            i = 0;
-            for (nparam = 0; nparam < 10; nparam++) {
-                for (; msg[i]; i++) {
-                    if (msg[i] != ' ')  break;
-                }
-                if (msg[i] == 0)    break;
-                param[nparam].start = i;
-                for (; msg[i]; i++) {
-                    if (msg[i] == ' ')  break;
-                }
-                param[nparam].end = i;
-            }
-            if (nparam <= 0)    {
-                uws_callbacked --;
-                apfw_warn("ico_apf_callback_uws: Illegal Message Format(no param)");
-                return;
-            }
-            for (cmd = ICO_APF_SOUND_COMMAND_CMD+1;
-                 cmd <= ICO_APF_SOUND_COMMAND_MAX; cmd++)    {
-                if (memcmp(&msg[param[0].start],
-                           ico_apf_sound_table[cmd-ICO_APF_SOUND_COMMAND_MIN],
-                           param[0].end - param[0].start) == 0) break;
-            }
-            if (cmd > ICO_APF_SOUND_COMMAND_MAX)    {
-                uws_callbacked --;
-                apfw_warn("ico_apf_callback_uws: Receive Event Nop(cmd=%d)", cmd);
-                return;
-            }
-            res = ICO_APF_RESID_BASIC_SOUND;
-            pid = 0;
-            appid[0] = 0;
-            strname[0] = 0;
-            strlen = 0;
-            for (i = 1; i < nparam; i++)    {
-                if (memcmp(&msg[param[i].start],
-                           "#pid#", param[i].end - param[i].start) == 0)    {
-                    i ++;
-                    if (i < nparam) {
-                        pid = strtol(&msg[param[i].start], (char **)0, 0);
-                        if (ico_apf_get_app_id(pid, appid) != ICO_APP_CTL_E_NONE)   {
-                            uws_callbacked --;
-                            apfw_trace("ico_apf_callback_uws: Unknown pid=%d", pid);
-                            return;
-                        }
-                    }
-                }
-                else if (memcmp(&msg[param[i].start],
-                                "#stream_name#", param[i].end - param[i].start) == 0) {
-                    i ++;
-                    /* no need stream name      */
-                }
-                else if (memcmp(&msg[param[i].start],
-                                "#app_name#", param[i].end - param[i].start) == 0) {
-                    i ++;
-                    if (i < nparam) {
-                        strlen = param[i].end - param[i].start;
-                        if (strlen >= ((int)sizeof(strname)))
-                            strlen = sizeof(strname) - 1;
-                        strncpy(strname, &msg[param[i].start], strlen);
-                        strname[strlen] = 0;
-                    }
-                }
-                else if (memcmp(&msg[param[i].start],
-                                "#stream_state#", param[i].end - param[i].start) == 0) {
-                    i ++;
-                    /* no need stream_state     */
-                }
-            }
-            if (pid > 0)    {
-                handle->pid = pid;
-            }
-            apfw_trace("ico_apf_callback_uws: SoundMgr evt=%d res=%d(%s.%d) str=%s",
-                       cmd, res, appid, pid, strname);
-            /* save receive message to receive buffer       */
-            ico_apf_put_recvmsg(cmd, res, pid, appid, strname, strlen, handle);
-        }
-        else    {
-            /* AppsController               */
-            for (cmd = ICO_APF_RESOURCE_COMMAND_MIN;
-                 cmd <= ICO_APF_RESOURCE_COMMAND_MAX; cmd++)    {
-                if (memcmp(msg, ico_apf_cmd_table[cmd-ICO_APF_RESOURCE_COMMAND_MIN], 3) == 0)
-                    break;
-            }
-            if (cmd > ICO_APF_RESOURCE_COMMAND_MAX) {
-                uws_callbacked --;
-                apfw_warn("ico_apf_callback_appsctl: Receive Event Error(cmd=%d)",
-                          cmd);
-                return;
-            }
-            for (res = ICO_APF_RESOURCE_RESID_MIN;
-                 res <= ICO_APF_RESOURCE_RESID_MAX; res++)  {
-                if (memcmp(&msg[4],
-                    ico_apf_res_table[res-ICO_APF_RESOURCE_RESID_MIN], 4) == 0) break;
-            }
-            if (res > ICO_APF_RESOURCE_RESID_MAX)   {
-                uws_callbacked --;
-                apfw_warn("ico_apf_callback_uws: Receive Resource Error(resid=%d)",
-                          res);
-                return;
-            }
-
-            pid = 0;
-            for (st = 9; msg[st]; st++) {
-                if (msg[st] == ' ') break;
-                if (pid >= 0)   {
-                    if ((msg[st] >= '0') && (msg[st] <= '9'))   {
-                        pid = pid * 10 + msg[st] - '0';
-                    }
-                    else    {
-                        pid = -1;
-                    }
-                }
-            }
-            if (pid >= 0)   {
-                appid[0] = 0;
-            }
-            else    {
-                pid = st - 9;
-                if (pid > ICO_UXF_MAX_PROCESS_NAME )
-                    pid = ICO_UXF_MAX_PROCESS_NAME;
-                strncpy(appid, &msg[9], pid);
-                appid[pid] = 0;
-                pid = 0;
-            }
-            if (msg[st] == ' ') st++;
-            if (pid > 0)    {
-                handle->pid = pid;
-            }
-            apfw_trace("ico_apf_callback_uws: AppsCtl evt=%d res=%d pid=%d(%s) msg=%s",
-                       cmd, res, pid, appid, &msg[st]);
-            /* save receive message to receive buffer       */
-            ico_apf_put_recvmsg(cmd, res, pid, appid, &msg[st], len-st, handle);
-        }
-        break;
-    default:
-        apfw_trace("ico_apf_callback_uws: UnKnown reason=%d", reason);
-        break;
-    }
-    uws_callbacked --;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_put_recvmsg
- *          put receive message into receive buffer
- *
- * @param[in]   cmd         receive commnad or event
- * @param[in]   res         receive resource
- * @param[in]   pid         request pid
- * @param[in]   appid       application id (for Web Application)
- * @param[in]   msg         receive message
- * @param[in]   len         receive message length
- * @param[out]  handle      connection handle
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_apf_put_recvmsg(const int cmd, const int res, const int pid, const char *appid,
-                    char *msg, const int len, ico_apf_com_handle_t *handle)
-{
-    int     i;
-    int     nexttail;
-
-    /* check receive buffer overflow        */
-    if (handle->rtail >= (ICO_APF_RESOURCE_WSOCK_BUFR-1))  {
-        nexttail = 0;
-    }
-    else    {
-        nexttail = handle->rtail + 1;
-    }
-    if (handle->rhead == nexttail)  {
-        /* receive buffer overflow, drops all message   */
-        apfw_warn("ico_apf_put_recvmsg: receive buffer overflow");
-        handle->rhead = 0;
-        handle->rtail = 0;
-        nexttail = 1;
-    }
-
-    /* receive message is put into queue.     */
-    handle->rbuf[handle->rtail]->cmd = cmd;
-    handle->rbuf[handle->rtail]->res = res;
-    handle->rbuf[handle->rtail]->pid = pid;
-    strncpy(handle->rbuf[handle->rtail]->appid, appid, ICO_UXF_MAX_PROCESS_NAME);
-    handle->rbuf[handle->rtail]->appid[ICO_UXF_MAX_PROCESS_NAME] = 0;
-    if (msg)    {
-        memcpy(handle->rbuf[handle->rtail]->msg, msg, len);
-        handle->rbuf[handle->rtail]->msg[len] = 0;
-    }
-    else    {
-        handle->rbuf[handle->rtail]->msg[0] = 0;
-    }
-    handle->rtail = nexttail;
-    i = handle->rtail - handle->rhead;
-    if (i <= 0)    {
-        i = ICO_APF_RESOURCE_WSOCK_BUFR + i;
-    }
-
-    ico_apf_poll_write_event(handle, 1);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   apf_com_poll_fd_add: add file descriptor for poll
- *
- * @param[in]   fd          file descriptor
- * @param[in]   flag        POLL flag(POLLIN,POLLOUT)
- *                          negative means reset
- * @return      result
- * @retval      ICO_APF_RESOURCE_E_NONE             success
- * @retval      ICO_APF_RESOURCE_E_INVAL            error(out of memory)
- */
-/*--------------------------------------------------------------------------*/
-static int
-ico_apf_poll_fd_add(const int fd, const int flag)
-{
-    ico_apf_com_poll_t      *p;
-    ico_apf_com_poll_t      *fds[1];
-    ico_apf_com_handle_t    *handle;
-
-    p = com_polls;
-    while (p)   {
-        if (p->fd == fd)    {
-            break;
-        }
-        p = p->next;
-    }
-
-    if (! p)    {
-        /* new file descriptor              */
-        if (freecom_polls)   {
-            p = freecom_polls;
-            freecom_polls = p->next;
-            p->apf_fd_control = NULL;
-            p->user_data = NULL;
-        }
-        else    {
-            p = calloc(sizeof(ico_apf_com_poll_t), 1);
-            if (! p)    {
-                /* out of memory            */
-                apfw_error("ico_apf_poll_fd_add: can not allocate fd control table"
-                           "(No Memory)");
-                return ICO_APF_RESOURCE_E_INVAL;
-            }
-        }
-
-        p->fd = fd;
-        p->next = com_polls;
-        com_polls = p;
-    }
-    p->flags |= ICO_APF_COM_POLL_ERROR;
-    if (flag >= 0)  {
-        if (flag & (POLLIN|POLLPRI))    {
-            p->flags |= ICO_APF_COM_POLL_READ;
-        }
-        if (flag & POLLOUT) {
-            p->flags |= ICO_APF_COM_POLL_WRITE;
-        }
-    }
-    else    {
-        if ((-flag) & (POLLIN|POLLPRI)) {
-            p->flags &= ~ICO_APF_COM_POLL_READ;
-        }
-        if ((-flag) & POLLOUT)  {
-            p->flags &= ~ICO_APF_COM_POLL_WRITE;
-        }
-    }
-
-    handle = handles;
-    while (handle)  {
-        if (handle->fd == fd)   break;
-        handle = handle->next;
-    }
-    if (handle) {
-        p->apf_fd_control = (void *)handle;
-        handle->poll = p;
-    }
-    else    {
-        apfw_trace("ico_apf_poll_fd_add: fd=%d dose not exist in handles", fd);
-        p->apf_fd_control = NULL;
-    }
-
-    /* regist callback function */
-    if (ico_apf_pollfd_func)    {
-        fds[0] = p;
-
-        (*ico_apf_pollfd_func)(fds, 1);
-    }
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   apf_com_poll_fd_del: delete file descriptor for poll
- *
- * @param[in]   fd          file descriptor
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_apf_poll_fd_del(const int fd)
-{
-    ico_apf_com_poll_t      *p;
-    ico_apf_com_poll_t      *bp;
-    ico_apf_com_poll_t      *fds[1];
-
-    /* search file descriptor       */
-    p = com_polls;
-    bp = NULL;
-    while (p)   {
-        if (p->fd == fd)    {
-            if (bp) {
-                bp->next = p->next;
-            }
-            else    {
-                com_polls = p->next;
-            }
-
-            if (p->apf_fd_control)  {
-                ((ico_apf_com_handle_t *)(p->apf_fd_control))->poll = NULL;
-            }
-
-            /* call callback function       */
-            if (ico_apf_pollfd_func)    {
-                p->flags = 0;
-                fds[0] = p;
-
-                (*ico_apf_pollfd_func)(fds, 1);
-            }
-            p->next = freecom_polls;
-            freecom_polls = p;
-            break;
-        }
-        p = p->next;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_com_poll_fd_control: Set or Unset callback of file descriptors
- *
- * @param[in]   poll_fd_cb      The callback function.
- * @return      result
- * @retval      ICO_APF_RESOURCE_E_NONE             success
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_com_poll_fd_control(ico_apf_com_pollfd_cb poll_fd_cb)
-{
-    ico_apf_com_poll_t *p;
-    ico_apf_com_poll_t **fds;
-    int     nfds;
-    int     count;
-
-    /* regist callback function     */
-    ico_apf_pollfd_func = poll_fd_cb;
-
-    if (ico_apf_pollfd_func)    {
-        /* if regist, call callback for all file descriptors    */
-
-        /* count number of file descriptors */
-        p = com_polls;
-        count = 0;
-        while (p)   {
-            count ++;
-            p = p->next;
-        }
-        if (count > 0)  {
-            fds = malloc(sizeof(ico_apf_com_poll_t *) * count);
-        }
-        else    {
-            fds = NULL;
-        }
-
-        p = com_polls;
-        nfds = 0;
-        while (fds && p)   {
-            fds[nfds++] = p;
-            p = p->next;
-        }
-
-        if (nfds > 0)   {
-            apfw_trace("ico_apf_com_poll_fd_control: nfds=%d:%d[%x]",
-                       nfds, fds[0]->fd, fds[0]->flags);
-            (*ico_apf_pollfd_func)(fds, nfds);
-        }
-        if (fds)    free(fds);
-    }
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_com_poll_fd_event: Notify the changes of file descriptor's state
- *
- * @param[in]   fd_ctl      The structure of file descriptor's controller
- * @param[in]   flags       The user data to be passed to the callback function
- * @return      result
- * @retval      ICO_APF_RESOURCE_E_NONE             success
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_com_poll_fd_event(ico_apf_com_poll_t *fd_ctl, int flags)
-{
-    int     st;
-    ico_apf_com_handle_t    *handle = (ico_apf_com_handle_t *)fd_ctl->apf_fd_control;
-
-    uifw_trace("ico_apf_com_poll_fd_event: handle=%08x fd=%d flags=%x",
-               (int)handle, handle ? handle->fd : 0, flags);
-    if (handle) {
-        ico_apf_com_dispatch(handle);           /* try to service           */
-    }
-    else    {
-        ico_apf_com_dispatch(NULL);             /* try to service for server*/
-    }
-
-    if (handle) {
-        /* send if send data exist      */
-        if ((handle->stail != handle->shead) &&
-            (handle->uws_context != NULL) &&
-            (handle->uws_id != NULL))   {
-            st = handle->shead;
-            if (handle->shead >= (ICO_APF_RESOURCE_WSOCK_BUFS-1))  {
-                handle->shead = 0;
-            }
-            else    {
-                handle->shead ++;
-            }
-            if (ico_apf_com_realsend(handle, handle->sbuf[st])
-                        != ICO_APF_RESOURCE_E_NONE) {
-                apfw_warn("ico_apf_com_poll_fd_event: ico_apf_com_realsend Error");
-                handle->shead = st;
-                ico_apf_com_dispatch(handle);   /* try to service       */
-            }
-        }
-
-        /* start/stop writable event        */
-        if ((handle->stail == handle->shead) ||
-            (handle->uws_context == NULL) ||
-            (handle->uws_id == NULL))   {
-            ico_apf_poll_write_event(handle, 0);
-        }
-        else    {
-            ico_apf_poll_write_event(handle, 1);
-        }
-    }
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_poll_write_event: Write event control for poll
- *
- * @param[in]   handle          AppsController's handle
- * @param[in]   write           set/reset write event
- *                              = 0 : reset if not reset
- *                              = 1 : set if not set
- *                              = 2 : force reset
- *                              = 3 : force set
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_apf_poll_write_event(ico_apf_com_handle_t *handle, const int write)
-{
-    ico_apf_com_poll_t  *fds[1];
-
-    if (handle->poll)   {
-        if ((write == 3) || (write == 1)) {
-            /* set write poll           */
-            handle->poll->flags |= ICO_APF_COM_POLL_WRITE;
-            if (ico_apf_pollfd_func)    {
-                fds[0] = handle->poll;
-                (*ico_apf_pollfd_func)(fds, 1);
-            }
-        }
-        else if ((write == 2) || (write == 0)) {
-            /* reset write poll         */
-            handle->poll->flags &= ~ICO_APF_COM_POLL_WRITE;
-            if (ico_apf_pollfd_func)    {
-                fds[0] = handle->poll;
-                (*ico_apf_pollfd_func)(fds, 1);
-            }
-        }
-    }
-}
-
diff --git a/ico-app-framework/ico_apf_ecore.c b/ico-app-framework/ico_apf_ecore.c
deleted file mode 100644 (file)
index dc5565b..0000000
+++ /dev/null
@@ -1,201 +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   client library for Ecore(EFL) application
- *
- * @date    Feb-28-2013
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <string.h>
-#include <sys/time.h>
-#include <Ecore.h>
-
-#include "ico_apf_private.h"
-#include "ico_apf_ecore.h"
-
-/* define static function prototype         */
-static Eina_Bool ico_apf_ecore_fdevent(void *data, Ecore_Fd_Handler *handler);
-static void ico_apf_ecore_fdcontrol(ico_apf_com_poll_t *fd_ctl[], const int num_fds);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  ico_apf_ecore_init
- *          This function connects to AppsController for Ecore application.
- *          If you use AppsController's function, you must call this function.
- *
- *  @param[in]  uri             server URI
- *  @return     result status
- *  @retval     ICO_APF_E_NONE      success
- *  @retval     ICO_APF_E_IO_ERROR  error(failed)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_ecore_init(const char *uri)
-{
-    apfw_trace("ico_apf_ecore_init: Enter(uri=%s)", uri ? uri : "(NULL)");
-
-    /* initialize resource controller           */
-    if (ico_apf_resource_init_client(uri) !=  ICO_APF_RESOURCE_E_NONE)  {
-        apfw_error("ico_apf_ecore_init: Leave(Resource initialize Error)");
-        return ICO_APF_E_IO_ERROR;
-    }
-
-    /* set file descriptor to Ecore main loop   */
-    ico_apf_com_poll_fd_control(ico_apf_ecore_fdcontrol);
-
-    apfw_trace("ico_apf_ecore_init: Leave(OK)");
-    return ICO_APF_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  ico_apf_ecore_term
- *          This function connects to AppsController for Ecore application.
- *          If you use AppsController's function, you must call this function.
- *
- *  @param      none
- *  @return     none
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_apf_ecore_term(void)
-{
-    apfw_trace("ico_apf_ecore_term: Enter");
-
-    /* terminate resource controller            */
-    ico_apf_resource_term_client();
-
-    apfw_trace("ico_apf_ecore_term: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  ico_apf_ecore_init_server
- *          This function connects to AppsController for Ecore application.
- *          If you use AppsController's function, you must call this function.
- *
- *  @param[in]  appid           id of application
- *  @return     result status
- *  @retval     ICO_APF_E_NONE      success
- *  @retval     ICO_APF_E_IO_ERROR  error(failed)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_ecore_init_server(const char *uri)
-{
-    apfw_trace("ico_apf_ecore_init_server: Enter(uri=%s)", uri ? uri : "(NULL)");
-
-    /* initialize resource controller           */
-    if (ico_apf_resource_init_server(uri) !=  ICO_APF_RESOURCE_E_NONE)  {
-        apfw_error("ico_apf_ecore_init_server: Leave(Resource initialize Error)");
-        return ICO_APF_E_IO_ERROR;
-    }
-
-    /* set file descriptor to Ecore main loop   */
-    ico_apf_com_poll_fd_control(ico_apf_ecore_fdcontrol);
-
-    apfw_trace("ico_apf_ecore_init_server: Leave(OK)");
-    return ICO_APF_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  ico_apf_ecore_term_server
- *          This function connects to AppsController for Ecore application.
- *          If you use AppsController's function, you must call this function.
- *
- *  @param      none
- *  @return     none
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_apf_ecore_term_server(void)
-{
-    apfw_trace("ico_apf_ecore_term_server: Enter");
-
-    /* terminate resource controller            */
-    ico_apf_resource_term_server();
-
-    apfw_trace("ico_apf_ecore_term_server: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_comm_connect
- *          callback function called by Ecore when a file descriptor had a change
- *
- * @param[in]   data            user data(ico_apf_com_poll_t)
- * @param[in]   handler         Ecore file descriptor handler
- * @return      call back setting
- * @retval      ECORE_CALLBACK_RENEW    set callback
- */
-/*--------------------------------------------------------------------------*/
-static Eina_Bool
-ico_apf_ecore_fdevent(void *data, Ecore_Fd_Handler *handler)
-{
-    int     flags;
-
-    flags = (ecore_main_fd_handler_active_get(handler, ECORE_FD_READ))
-                    ? ICO_APF_COM_POLL_READ : 0;
-    if (ecore_main_fd_handler_active_get(handler, ECORE_FD_WRITE))
-        flags |= ICO_APF_COM_POLL_WRITE;
-    if (ecore_main_fd_handler_active_get(handler, ECORE_FD_ERROR))
-        flags |= ICO_APF_COM_POLL_ERROR;
-
-    ico_apf_com_poll_fd_event((ico_apf_com_poll_t *)data, flags);
-
-    return ECORE_CALLBACK_RENEW;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_ecore_fdcontrol
- *          This function connects to AppsController.
- *
- * @param[in]   fd_ctl      file descriptors
- * @param[in]   num_fds     number of file descriptors
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_apf_ecore_fdcontrol(ico_apf_com_poll_t *fd_ctl[], const int num_fds)
-{
-    Ecore_Fd_Handler_Flags flags;
-    int     i;
-
-    for (i = 0; i < num_fds; i++) {
-        if (fd_ctl[i]->flags) {
-            flags = (fd_ctl[i]->flags & ICO_APF_COM_POLL_READ) ? ECORE_FD_READ : 0;
-
-            if (fd_ctl[i]->flags & ICO_APF_COM_POLL_WRITE)   flags |= ECORE_FD_WRITE;
-            if (fd_ctl[i]->flags & ICO_APF_COM_POLL_ERROR)   flags |= ECORE_FD_ERROR;
-            if (! fd_ctl[i]->user_data) {
-                /* add file descriptor  */
-                fd_ctl[i]->user_data = (void *)
-                    ecore_main_fd_handler_add(fd_ctl[i]->fd, flags,
-                                              ico_apf_ecore_fdevent,
-                                              (void *)fd_ctl[i], NULL, NULL);
-            }
-            else {
-                /* change event         */
-                ecore_main_fd_handler_active_set((Ecore_Fd_Handler *)fd_ctl[i]->user_data,
-                                                 flags);
-            }
-        }
-        else {
-            /* remove file descriptor   */
-            ecore_main_fd_handler_del((Ecore_Fd_Handler *)fd_ctl[i]->user_data);
-        }
-    }
-}
-
diff --git a/ico-app-framework/ico_apf_log.c b/ico-app-framework/ico_apf_log.c
deleted file mode 100644 (file)
index 6993db0..0000000
+++ /dev/null
@@ -1,246 +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    <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_apf_log.h"
-#include    "ico_apf_apimacro.h"
-
-/* variabe & table                          */
-/* output level debug log                   */
-ICO_APF_API int ico_apf_log_level = 0x7fffffff;
-static  int     ico_apf_log_flushmode = 1;
-static  int     ico_apf_log_initialized = 0;
-
-/* file descriptor of output debug log      */
-static FILE     *sDbgFd = (FILE *)0;
-
-/* name of output source module             */
-static char     sDbgProg[32];
-
-/* local time difference(sec)               */
-static int      sTimeZone = (99*60*60);
-
-/* output lines                             */
-static int      sDbgLines = 0;
-
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_log_print: printout log message
- *
- * @param[in]   fmt     message format(same as printf)
- * @param[in]   ...     arguments if need
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_apf_log_print(const char *fmt, ...)
-{
-    va_list     list;
-
-    if (! sDbgFd)   {
-        ico_apf_log_open(NULL);
-    }
-#if ICO_APF_LOG_STDOUT == 0
-    else if (sDbgLines >= (ICO_APF_LOG_MAXLINES-2)) {
-        if (sDbgLines >= ICO_APF_LOG_MAXLINES)  {
-            ico_apf_log_close();
-            ico_apf_log_open(sDbgProg);
-        }
-        else    {
-            fflush(sDbgFd);
-        }
-    }
-#endif /*ICO_APF_LOG_STDOUT*/
-    if (sDbgFd) {
-        va_start(list, fmt);
-        vfprintf(sDbgFd, fmt, list);
-        va_end(list);
-        if (ico_apf_log_flushmode)  {
-            fflush(sDbgFd);
-        }
-    }
-    if (sDbgFd != stdout)   {
-        sDbgLines ++;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_log_open: open log file
- *
- * @param[in]   prog    program name
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_apf_log_open(const char *prog)
-{
-#if ICO_APF_LOG_STDOUT == 0
-    int     idx;
-    char    sPath[128];
-    char    sPath2[128];
-#endif /*ICO_APF_LOG_STDOUT*/
-
-    if (sDbgFd) {
-        fflush(sDbgFd);
-        if (sDbgFd != stdout)   {
-            fclose(sDbgFd);
-        }
-    }
-
-    sDbgLines = 0;
-
-    if ((! prog) || (*prog == 0))   {
-        sDbgFd = stdout;
-        sDbgProg[0] = 0;
-        return;
-    }
-    else    {
-        strncpy(sDbgProg, prog, sizeof(sDbgProg)-1);
-        sDbgProg[sizeof(sDbgProg)-1] = 0;
-    }
-#if ICO_APF_LOG_STDOUT > 0
-    sDbgFd = stdout;
-#else  /*ICO_APF_LOG_STDOUT*/
-    snprintf(sPath, sizeof(sPath)-1, "%s/%s.log%d",
-             ICO_APF_LOG_DIR, sDbgProg, ICO_APF_LOG_MAXFILES-1);
-    (void) remove(sPath);
-
-    for (idx = (ICO_APF_LOG_MAXFILES-1); idx > 0; idx--)    {
-        strcpy(sPath2, sPath);
-        if (idx > 1)    {
-            snprintf(sPath, sizeof(sPath)-1, "%s/%s.log%d",
-                     ICO_APF_LOG_DIR, sDbgProg, idx-1);
-        }
-        else    {
-            snprintf(sPath, sizeof(sPath)-1, "%s/%s.log",
-                     ICO_APF_LOG_DIR, sDbgProg);
-        }
-        (void) rename(sPath, sPath2);
-    }
-    sDbgFd = fopen(sPath, "w");
-    if (! sDbgFd)   {
-        sDbgFd = stdout;
-    }
-    else if ((ico_apf_log_initialized == 0) &&
-             (sDbgFd != stdout) && (sDbgFd != stderr))  {
-        ico_apf_log_initialized = 1;
-        fflush(stdout);
-        fflush(stderr);
-        stdout = sDbgFd;
-        stderr = sDbgFd;
-    }
-#endif /*ICO_APF_LOG_STDOUT*/
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_log_close: close log file
- *
- * @param       nothing
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_apf_log_close(void)
-{
-#if ICO_APF_LOG_STDOUT == 0
-    if (sDbgFd) {
-        fflush(sDbgFd);
-        if (sDbgFd != stdout)   {
-            fclose(sDbgFd);
-        }
-        sDbgFd = (FILE *)0;
-    }
-#endif /*ICO_APF_LOG_STDOUT*/
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_log_flush: flush log file
- *
- * @param       nothing
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_apf_log_flush(void)
-{
-    if ((sDbgFd != NULL) && (ico_apf_log_flushmode == 0))   {
-        fflush(sDbgFd);
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_apf_log_curtime: create current time string
- *
- * @param[in]   level   log level string(header of log message)
- * @return      current time string
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API char *
-ico_apf_log_curtime(const char *level)
-{
-    struct timeval  NowTime;
-    extern long     timezone;
-    static char     sBuf[28];
-
-    gettimeofday(&NowTime, (struct timezone *)0);
-    if (sTimeZone > (24*60*60)) {
-        tzset();
-        sTimeZone = timezone;
-    }
-    NowTime.tv_sec -= sTimeZone;
-
-    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   ico_apf_log_setlevel: set log output level
- *
- * @param[in]   loglevel    log output level
- * @return      nothing
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_apf_log_setlevel(const int loglevel)
-{
-    ico_apf_log_level = loglevel & (~(ICO_APF_LOG_FLUSH|ICO_APF_LOG_NOFLUSH));
-
-    if (loglevel & (ICO_APF_LOG_FLUSH|ICO_APF_LOG_NOFLUSH))    {
-        if (loglevel & ICO_APF_LOG_FLUSH)  {
-            ico_apf_log_flushmode = 1;
-        }
-        else    {
-            ico_apf_log_flushmode = 0;
-        }
-    }
-}
-
diff --git a/ico-app-framework/ico_apf_private.h b/ico-app-framework/ico_apf_private.h
deleted file mode 100644 (file)
index 0d0d71f..0000000
+++ /dev/null
@@ -1,237 +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   header file of AppsController interface
- *
- * @date    Feb-28-2013
- */
-
-#ifndef __ICO_APF_PRIVATEI_H__
-#define __ICO_APF_PRIVATEI_H__
-
-#include "ico_apf_log.h"
-#include "ico_uxf_sysdef.h"
-#include "ico_apf.h"
-#include "ico_apf_apimacro.h"
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-/*
- * AppsControllerr Protocol(TEXT)
- *
- * TEXT ="cmd resource appid device id (base id)"
- *
- * command(Client->AppsController)
- *  "GET BSCR appid disp id"        ... Get basic screen
- *  "REL BSCR appid disp id"        ... Release basic screen
- *  "GET ISCR appid disp id bid"    ... Get interrupt screen
- *  "REL ISCR appid disp id bid"    ... Release interrupt screen
- *  "GET OSCR appid disp id"        ... Get on screen
- *  "REL OSCR appid disp id"        ... Release on screen
- *  "GET BSND appid zone id adjust" ... Get basic sound
- *  "REL BSND appid zone id"        ... Release basic sound
- *  "GET ISND appid zone id adjust" ... Get interrupt sound
- *  "REL ISND appid zone id"        ... Release interrupt sound
- *  "ADD INPT appid device event"   ... Add input switch
- *  "CHG INPT appid device event"   ... Change input switch
- *  "DEL INPT appid device event"   ... Delete input switch
- * event(AppsController->Client)
- *  "ACQ BSCR appid disp id"        ... Acquired basic screen(with surface visible)
- *  "DEP BSCR appid disp id"        ... Deprived basic screen(with surface invisible)
- *  "WAI BSCR appid disp id"        ... Waitting basic screen(with surface invisible)
- *  "DES BSCR appid disp id"        ... Destoryed basic screen(with surface destory)
- *   * ISCR(interrupt screen), BSND(basic sound), ISND(interrupt sound),
- *     INPT(inout switch) are the same, too.
- * reply(Client->AppsController)
- *  "ACK BSCR appid disp id"        ... OK Reply basic screen
- *  "NAK BSCR appid disp id"        ... NG Reply basic screen
- *   * ISCR(interrupt screen), BSND(basic sound), ISND(interrupt sound),
- *     INPT(inout switch) are the same, too.
- */
-/* Multi Sound Manager Protocol(Text)
- *
- * TEXT ="#cmd# pid"
- *
- * command(Client->Multi Sound Manager)
- *  "#stream_mute_set# pid"         ... Mute control on(mute)
- *  "#stream_mute_reset# pid"       ... Mute control off((no mute)
- *  "#stream_cancel# pid"           ... Cancel
- *  "#get_stream_list#"             ... Get stream list
- *  "#fresh#"                       ... Fresh
- *  "#all_mute_set#"                ... Mute on(mute) all streams
- *  "#all_mute_reset#"              ... Mute off(no mute) all streams
- *                  pid      = process Id (decimal)
- * event(Multi Sound Manager->Client)
- *  "#stream_new# #pid# pid #stream_name# str-name #app_name# app-name #command_end#"
- *                                  ... Create new sound stream
- *                  pid      = process Id (decimal)
- *                  str-name = stream name
- *                  app-name = application name(appid)
- *  "#stream_free# #pid# pid #stream_name# str-name #app_name# app-name #command_end#"
- *                                  ... End sound stream
- * reply(Multi Sound Manager->Client)
- *  "#get_stream_list# #stream_state# state #pid# pid
- *          #stream_name# str-name #app_name# app-name #command_end#"
- *                                  ... reply of #get_stream_list# (multi message)
- *                  state    = "PA_SINK_INPUT_INIT"
- *                           = "PA_SINK_INPUT_DRAINED"
- *                           = "PA_SINK_INPUT_RUNNING"
- *                           = "PA_SINK_INPUT_CORKED"
- *                           = "PA_SINK_INPUT_UNLINKED"
- *                           = "INCORRECT_STATUS"
- *  "#get_stream_list# #no_stream# #command_end#"
- *                                  ... reply of #get_stream_list# (no stream)
- */
-
-/* Protocol name on communication for Application Manager   */
-#define ICO_PROTOCOL_APPSCONTROLLER     "ico_apps_controller"
-
-/* Protocol name on communication for Pulse-Audio Plugin(Multi Sound Manager)*/
-#define ICO_PROTOCOL_MULTISOUNDMANAGER  "ico_soundmgr-protocol"
-
-/* AppsController resource control command and event    */
-#define ICO_APF_SRESOURCE_STATE_ACQUIRED    "ACQ"
-#define ICO_APF_SRESOURCE_STATE_DEPRIVED    "DEP"
-#define ICO_APF_SRESOURCE_STATE_WAITTING    "WAI"
-#define ICO_APF_SRESOURCE_STATE_RELEASED    "DES"
-
-#define ICO_APF_SRESOURCE_COMMAND_GET       "GET"
-#define ICO_APF_SRESOURCE_COMMAND_RELEASE   "REL"
-#define ICO_APF_SRESOURCE_COMMAND_ADD       "ADD"
-#define ICO_APF_SRESOURCE_COMMAND_CHANGE    "CHG"
-#define ICO_APF_SRESOURCE_COMMAND_DELETE    "DEL"
-
-#define ICO_APF_SRESOURCE_REPLY_OK          "ACK"
-#define ICO_APF_SRESOURCE_REPLY_NG          "NAK"
-#define ICO_APF_SRESOURCE_STATE_CONNECTED   "CON"
-#define ICO_APF_SRESOURCE_STATE_DISCONNECTED "DCN"
-
-/* AppsController resource control target object        */
-#define ICO_APF_SRESID_BASIC_SCREEN         "BSCR"
-#define ICO_APF_SRESID_INT_SCREEN           "ISCR"
-#define ICO_APF_SRESID_ON_SCREEN            "OSCR"
-#define ICO_APF_SRESID_BASIC_SOUND          "BSND"
-#define ICO_APF_SRESID_INT_SOUND            "ISND"
-#define ICO_APF_SRESID_INPUT_DEV            "INPT"
-
-/* Multi Sound Manager sound control command            */
-#define ICO_APF_SSOUND_COMMAND_MUTEON       "#stream_mute_set#"
-#define ICO_APF_SSOUND_COMMAND_MUTEOFF      "#stream_mute_reset#"
-#define ICO_APF_SSOUND_COMMAND_CANCEL       "#stream_cancel#"
-#define ICO_APF_SSOUND_COMMAND_GETLIST      "#get_stream_list#"
-#define ICO_APF_SSOUND_COMMAND_FRESH        "#fresh#"
-#define ICO_APF_SSOUND_COMMAND_ALLMUTEON    "#all_mute_set#"
-#define ICO_APF_SSOUND_COMMAND_ALLMUTEOFF   "#all_mute_reset#"
-
-#define ICO_APF_SSOUND_EVENT_NEW            "#stream_new#"
-#define ICO_APF_SSOUND_EVENT_FREE           "#stream_free#"
-
-#define ICO_APF_SSOUND_REPLY_LIST           "#get_stream_list#"
-
-/* Maximum number of send/receive items         */
-#define ICO_APF_RESOURCE_MSG_LEN    256 /* Maximum length of message            */
-#define ICO_APF_RESOURCE_WSOCK_BUFS 128 /* Number of the buffer for send data   */
-#define ICO_APF_RESOURCE_WSOCK_BUFR 64  /* Number of the buffer for receive data*/
-#define ICO_APF_RESOURCE_IP_LEN     20  /* IP address length                    */
-
-/* Define connection type                       */
-#define ICO_APF_COM_TYPE_SERVER         0xf0    /* server type                  */
-#define ICO_APF_COM_TYPE_CONNECTION     0x0f    /* connection type              */
-#define ICO_APF_COM_TYPE_APPSCTL        0x01    /* connect to AppsController    */
-#define ICO_APF_COM_TYPE_SOUNDMGR       0x02    /* connect to Multi Sound Manager*/
-#define ICO_APF_COM_TYPE_SVR_APPSCTL    0x11    /* server(listen) for AppsController*/
-#define ICO_APF_COM_TYPE_SVR_SOUNDMGR   0x12    /* server(listen) for Sound Manager*/
-
-/* Defines of Input/Output Event Flags          */
-#define ICO_APF_COM_POLL_READ   1       /* input flag                           */
-#define ICO_APF_COM_POLL_WRITE  2       /* output flag                          */
-#define ICO_APF_COM_POLL_ERROR  4       /* error flag                           */
-
-/* Data queue for send/receive                  */
-typedef struct  _ico_apf_com_buffer  {
-    short       cmd;                    /* command                              */
-    short       res;                    /* resource                             */
-    int         pid;                    /* requeste client pid                  */
-    char        appid[ICO_UXF_MAX_PROCESS_NAME+1];
-                                        /* application id (for Web application) */
-    char        msg[ICO_APF_RESOURCE_MSG_LEN];
-                                        /* message                              */
-}   ico_apf_com_buffer_t;
-
-/* Listener function prototype                  */
-typedef struct  _ico_apf_com_handle ico_apf_com_handle_t;
-typedef void (*ico_apf_com_eventlistener)(ico_apf_com_handle_t *handle, int cmd, int res,
-                                          int pid, char *appid, char *msg, void* user_data);
-typedef struct  _ico_apf_com_poll   ico_apf_com_poll_t;
-typedef void (*ico_apf_com_pollfd_cb)(ico_apf_com_poll_t *fd_ctl[], const int num_fds);
-
-/* AppsController Handle                        */
-struct  _ico_apf_com_handle {
-    ico_apf_com_handle_t    *next;      /* next handle                          */
-    short   hostid;                     /* Host Id(unused)                      */
-    char    service_on;                 /* connected(=1)/ not connect(=0)       */
-    char    type;                       /* connection type                      */
-    char    ip[ICO_APF_RESOURCE_IP_LEN];/* IP address                           */
-    int     port;                       /* port number                          */
-    int     fd;                         /* Socket file descriptor               */
-    ico_apf_com_poll_t  *poll;          /* poll table                           */
-    int     pid;                        /* client pid (server only)             */
-
-    struct ico_uws_context *uws_context;/* Context of comminucation             */
-    void    *uws_id;                    /* Communication Id                     */
-
-    short   retry;                      /* Retry counter                        */
-    short   res;                        /* (unused)                             */
-    unsigned short  shead;              /* Head position of send datas          */
-    unsigned short  stail;              /* Tail position of send datas          */
-    ico_apf_com_buffer_t *sbuf[ICO_APF_RESOURCE_WSOCK_BUFS];
-                                        /* Send buffers                         */
-    unsigned short  rhead;              /* Head position of receive datas       */
-    unsigned short  rtail;              /* Tail position of receive datas       */
-    ico_apf_com_buffer_t *rbuf[ICO_APF_RESOURCE_WSOCK_BUFR];
-                                        /* Receive buffers                      */
-    ico_apf_com_eventlistener   listener;
-                                        /* Listener function(if NULL, not regist)*/
-    void            *user_data;         /* Listener argument                    */
-};
-
-/* Structure of File Descriptor's Controller    */
-struct _ico_apf_com_poll {
-    ico_apf_com_poll_t  *next;          /* next table                           */
-    int     fd;                         /* number of changing File Descriptor   */
-    int     flags;                      /* input/output/error flag              */
-    void    *apf_fd_control;            /* address of AppFW's controll table    */
-    void    *user_data;                 /* user data                            */
-};
-
-/* API functions prototype                      */
-ico_apf_com_handle_t *ico_apf_com_init_client(const char *uri, const int type);
-ico_apf_com_handle_t *ico_apf_com_init_server(const char *uri, const int type);
-int ico_apf_com_term_client(ico_apf_com_handle_t *handle);
-int ico_apf_com_term_server(ico_apf_com_handle_t *handle);
-int ico_apf_com_isconnected(ico_apf_com_handle_t *handle);
-int ico_apf_com_send(ico_apf_com_handle_t *handle,
-                     const int cmd, const int res, const char *appid, char *msg);
-int ico_apf_com_addeventlistener(ico_apf_com_handle_t *handle,
-                                 ico_apf_com_eventlistener listener,
-                                 void *user_data);
-int ico_apf_com_removeeventlistener(ico_apf_com_handle_t *handle);
-void ico_apf_com_dispatch(ico_apf_com_handle_t *handle);
-
-/* API for file descriptor poll                 */
-int ico_apf_com_poll_fd_control(ico_apf_com_pollfd_cb poll_fd_cb);
-int ico_apf_com_poll_fd_event(ico_apf_com_poll_t *fd_ctl, int flags);
-
-#ifdef  __cplusplus
-}
-#endif
-#endif /*__ICO_APF_PRIVATEI_H__*/
-
diff --git a/ico-app-framework/ico_apf_resource_control.c b/ico-app-framework/ico_apf_resource_control.c
deleted file mode 100644 (file)
index 6b84464..0000000
+++ /dev/null
@@ -1,1432 +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   header file of Apprication Framework (Resource Control)
- *
- * @date    Feb-28-2013
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "ico_apf_private.h"
-#include "ico_uxf_conf.h"
-
-/*  type user callback information          */
-typedef struct _resmgr_user_cb_info {
-    ico_apf_resource_notify_cb_t    callbacks;
-    void                            *user_data;
-} resmgr_user_cb_info_t;
-
-/*  communication handle management table   */
-typedef struct _remgr_com_handle    {
-    struct _remgr_com_handle    *next;
-    ico_apf_com_handle_t        *handle;    /* communication handle     */
-    int                         pid;        /* client process id        */
-    char                        appid[ICO_UXF_MAX_PROCESS_NAME+1];
-                                            /* client application id    */
-} remgr_com_handle_t;
-
-/*  private variable                */
-static ico_apf_com_handle_t     *appsctl_handle = NULL;
-static ico_apf_com_handle_t     *soundmgr_handle = NULL;
-static resmgr_user_cb_info_t    user_cb_info = {NULL, NULL};
-static int                      resmgr_initialized = 0;
-static remgr_com_handle_t       *handles = NULL;
-static remgr_com_handle_t       *freehandles = NULL;
-static Ico_Uxf_Sys_Config       *sysconf = NULL;
-static Ico_Uxf_Sys_Config       *ifsysconf = NULL;
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Callback at received from AppsController for client
- *
- *  @param[in]  handle          communication handle
- *  @param[in]  cmd             command(event) code
- *  @param[in]  res             target resource
- *  @param[in]  pid             request client pid (server only)
- *  @param[in]  appid           request client application id (server only)
- *  @param[in]  msg             received message
- *  @param[in]  user_data       (unused)
- *  @return     none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_apf_resmgr_client_event(ico_apf_com_handle_t *handle, int cmd, int res,
-                            int pid, char *appid, char *msg, void* user_data)
-{
-    int     i;
-    ico_apf_resource_notify_info_t  info;
-
-    apfw_trace("ico_apf_resmgr_client_event: cmd=%d res=%d pid=%d(%s) msg=<%s>",
-               cmd, res, pid, appid, msg);
-
-    if (user_cb_info.callbacks != NULL) {
-        memset(&info, 0, sizeof(info));
-
-        /* get device and id                */
-        for (i = 0; msg[i]; i++)    {
-            if( msg[i] == ' ')  break;
-            if (i < ICO_UXF_MAX_DEVICE_NAME)    {
-                info.device[i] = msg[i];
-            }
-        }
-        if (msg[i] == ' ')  {
-            info.id = strtol(&msg[i+1], (char **)0, 0);
-        }
-        info.state = (ico_apf_resource_state_e)cmd;
-        info.resid = res;
-        info.pid = pid;
-        strncpy(info.appid, appid, ICO_UXF_MAX_PROCESS_NAME);
-        user_cb_info.callbacks(&info, user_cb_info.user_data);
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Callback at received from Application for server
- *
- *  @param[in]  handle          communication handle
- *  @param[in]  cmd             command(event) code
- *  @param[in]  res             target resource
- *  @param[in]  pid             request client pid (server only)
- *  @param[in]  appid           request client application id (server only)
- *  @param[in]  msg             received message
- *  @param[in]  user_data       (unused)
- *  @return     none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_apf_resmgr_server_event(ico_apf_com_handle_t *handle, int cmd, int res,
-                            int pid, char *appid, char *msg, void* user_data)
-{
-    int     i;
-    ico_apf_resource_notify_info_t  info;
-    remgr_com_handle_t  *p;
-    remgr_com_handle_t  *bp;
-
-    apfw_trace("ico_apf_resmgr_server_event: handle=%08x cmd=%d res=%d pid=%d(%s) msg=<%s>",
-               (int)handle, cmd, res, pid, appid, msg);
-
-    /* regist communication handle table    */
-    p = handles;
-    while (p)   {
-        if (p->handle == handle)    break;
-        p = p->next;
-    }
-    if (! p)    {
-        apfw_trace("ico_apf_resmgr_server_event: new client");
-        if (freehandles)    {
-            p = freehandles;
-            freehandles = p->next;
-        }
-        else    {
-            p = malloc(sizeof(remgr_com_handle_t));
-        }
-        if (p)  {
-            memset(p, 0, sizeof(remgr_com_handle_t));
-            if (! handles)  {
-                handles = p;
-            }
-            else    {
-                p->next = handles;
-                handles = p;
-            }
-            p->handle = handle;
-            p->pid = pid;
-        }
-    }
-
-    memset(&info, 0, sizeof(info));
-
-    /* get device and id            */
-    for (i = 0; msg[i] ; i++)   {
-        if (msg[i] == ' ')  break;
-        if (i < ICO_UXF_MAX_DEVICE_NAME)    {
-            info.device[i] = msg[i];
-        }
-    }
-    if (msg[i] == ' ')  {
-        sscanf(&msg[i+1], "%d %d", &info.id, &info.bid);
-    }
-    info.state = (ico_apf_resource_state_e)cmd;
-    info.resid = res;
-    info.pid = pid;
-    if (appid[0] )  {
-        strncpy(info.appid, appid, ICO_UXF_MAX_PROCESS_NAME);
-        strcpy(p->appid, info.appid);
-    }
-    else if (pid != 0)  {
-        info.pid = pid;
-        ico_apf_get_app_id(pid, info.appid);
-        strcpy(p->appid, info.appid);
-    }
-
-    if (info.state == ICO_APF_RESOURCE_STATE_CONNECTED) {
-        /* regist communication handle table    */
-        p = handles;
-        while (p)   {
-            if (p->handle == handle)    break;
-            p = p->next;
-        }
-        if (! p)    {
-            if (freehandles)    {
-                p = freehandles;
-                freehandles = p->next;
-            }
-            else    {
-                p = malloc(sizeof(remgr_com_handle_t));
-            }
-            if (p)  {
-                memset(p, 0, sizeof(remgr_com_handle_t));
-                if (! handles)  {
-                    handles = p;
-                }
-                else    {
-                    p->next = handles;
-                    handles = p;
-                }
-                p->handle = handle;
-                p->pid = pid;
-                strncpy(p->appid, info.appid, ICO_UXF_MAX_PROCESS_NAME);
-            }
-        }
-    }
-    else if (info.state == ICO_APF_RESOURCE_STATE_DISCONNECTED) {
-        /* destory communiction handle table    */
-        p = handles;
-        bp = NULL;
-        while (p)   {
-            if (p->handle == handle)    break;
-            bp = p;
-            p = p->next;
-        }
-        if (p)  {
-            if (bp) {
-                bp->next = p->next;
-            }
-            else    {
-                handles = p->next;
-            }
-            p->next = freehandles;
-            freehandles = p;
-        }
-    }
-    if (user_cb_info.callbacks != NULL) {
-        user_cb_info.callbacks(&info, user_cb_info.user_data);
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Initialize resouce manager component for client Application
- *
- *  @param[in]  uri         server URI
- *  @return result status
- *  @retval ICO_APF_RESOURCE_E_NONE                 success
- *  @retval ICO_APF_RESOURCE_E_INIT_COM_FAILD       can not create connection
- *  @retval ICO_APF_RESOURCE_E_INIT_COMMUNICATION   initialize communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_init_client(const char *uri)
-{
-    apfw_trace("ico_apf_resource_init_client: Enter(%s)", uri ? uri : "NULL");
-
-    if (resmgr_initialized & 1) {
-        apfw_warn("ico_apf_resource_init_client: Leave(already intialiezed)");
-        return ICO_APF_RESOURCE_E_NONE;
-    }
-
-    /* initialize connection for AppsController */
-    appsctl_handle = ico_apf_com_init_client(uri, ICO_APF_COM_TYPE_APPSCTL);
-
-    if (! appsctl_handle)   {
-        apfw_error("ico_apf_resource_init_client: Leave(can not create connection)");
-        return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
-    }
-
-    /* get system configuration                 */
-    ifsysconf = (Ico_Uxf_Sys_Config *)ico_uxf_ifGetSysConfig();
-    if (ifsysconf)  {
-        /* Another module already reads config file                             */
-        /* In this case, you don't release sysconf at finished this function.   */
-        sysconf = (Ico_Uxf_Sys_Config *)ifsysconf;
-    }
-    else    {
-        /* never read a system config                   */
-        sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
-    }
-    if (!sysconf)   {
-        apfw_error("ico_apf_resource_init_client: Leave(can not read configuration files)");
-        return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
-    }
-
-    if (ico_apf_com_addeventlistener(NULL, ico_apf_resmgr_client_event, NULL)
-            != ICO_APF_E_NONE) {
-        apfw_error("ico_apf_resource_init_client: Leave(can not set callback)");
-        return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
-    }
-
-    /* chanage resmgr_client_intialized flag */
-    resmgr_initialized |= 1;
-
-    apfw_trace("ico_apf_resource_init_client: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Terminame resouce manager component
- *
- *  @param      none
- *  @return     none
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_apf_resource_term_client(void)
-{
-    apfw_trace("ico_apf_resource_term_client: Enter");
-
-    /* unset callback functions */
-    ico_apf_resource_unset_event_cb();
-
-    /* terminate resourece server communication */
-    (void) ico_apf_com_term_client(appsctl_handle);
-    appsctl_handle = NULL;
-
-    /* close system configuration   */
-    if (! ifsysconf)    {
-        ico_uxf_closeSysConfig();
-    }
-
-    /* chanage resmgr_client_intialized flag */
-    resmgr_initialized &= ~1;
-
-    apfw_trace("ico_apf_resource_term_client: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Initialize resouce manager component for server Application
- *
- *  @param[in]  uri         my URI
- *  @return result status
- *  @retval ICO_APF_RESOURCE_E_NONE                 success
- *  @retval ICO_APF_RESOURCE_E_INIT_COM_FAILD       can not create connection
- *  @retval ICO_APF_RESOURCE_E_INIT_COMMUNICATION   initialize communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_init_server(const char *uri)
-{
-    apfw_trace("ico_apf_resource_init_server: Enter(%s)", uri ? uri : "NULL");
-
-    if (resmgr_initialized & 2) {
-        apfw_warn("ico_apf_resource_init_server: Leave(already intialiezed)");
-        return ICO_APF_RESOURCE_E_NONE;
-    }
-
-    /* initialize connection for AppsController */
-    appsctl_handle = ico_apf_com_init_server(uri, ICO_APF_COM_TYPE_APPSCTL);
-    if (! appsctl_handle)   {
-        apfw_error("ico_apf_resource_init_server: Leave(can not create connection)");
-        return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
-    }
-
-    /* get system configuration                 */
-    ifsysconf = (Ico_Uxf_Sys_Config *)ico_uxf_ifGetSysConfig();
-    if (ifsysconf)  {
-        /* Another module already reads config file                             */
-        /* In this case, you don't release sysconf at finished this function.   */
-        sysconf = (Ico_Uxf_Sys_Config *)ifsysconf;
-    }
-    else    {
-        /* never read a system config                   */
-        sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
-    }
-    if (!sysconf)   {
-        apfw_error("ico_apf_resource_init_server: Leave(can not read configuration files)");
-        return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
-    }
-
-    if (ico_apf_com_addeventlistener(NULL, ico_apf_resmgr_server_event, NULL)
-            != ICO_APF_E_NONE) {
-        apfw_error("ico_apf_resource_init_server: Leave(can not set callback)");
-        return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
-    }
-
-    /* chanage resmgr_server_intialized flag    */
-    resmgr_initialized = 2;
-
-    /* initialize connection for Multi Sound Manager    */
-    soundmgr_handle = ico_apf_com_init_client(NULL, ICO_APF_COM_TYPE_SOUNDMGR);
-    if (! soundmgr_handle)  {
-        apfw_error("ico_apf_resource_init_server: Leave(can not connect MSM)");
-        return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
-    }
-
-    /* chanage resmgr_client_intialized flag */
-    resmgr_initialized |= 1;
-
-    apfw_trace("ico_apf_resource_init_server: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Terminame resouce manager component
- *
- *  @param      none
- *  @return     none
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_apf_resource_term_server(void)
-{
-    apfw_trace("ico_apf_resource_term_server: Enter");
-
-    /* unset callback functions */
-    ico_apf_resource_unset_event_cb();
-
-    /* terminate resourece server communication */
-    (void) ico_apf_com_term_server(appsctl_handle);
-    appsctl_handle = NULL;
-
-    /* terminate Multi Sound Manager client communication */
-    (void) ico_apf_com_term_client(soundmgr_handle);
-    soundmgr_handle = NULL;
-
-    /* close system configuration   */
-    if (! ifsysconf)    {
-        ico_uxf_closeSysConfig();
-    }
-
-    /* chanage resmgr_client_intialized flag */
-    resmgr_initialized = 0;
-
-    apfw_trace("ico_apf_resource_term_server: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Set event callback function
- *
- *  @param[in]  callbacks   callback functions
- *  @param[in]  user_data   passed data on called callback function
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE     success
- *  @retval     ICO_APF_RESOURCE_E_INVAL    callbacks is null
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_set_event_cb(ico_apf_resource_notify_cb_t callbacks,
-                              void *user_data)
-{
-    apfw_trace("ico_apf_resource_set_event_cb: Enter(0x%08x, 0x%08x)",
-              (int)callbacks, (int)user_data);
-
-    if (callbacks == NULL) {
-        apfw_error("ico_apf_resource_set_event_cb: Leave(callbacks is NULL)");
-        return ICO_APF_RESOURCE_E_INVAL;
-    }
-    user_cb_info.callbacks = callbacks;
-    user_cb_info.user_data = user_data;
-
-    apfw_trace("ico_apf_resource_set_event_cb: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Unset event callback function
- *
- *  @param      none
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE     success(At present, always give back this)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_unset_event_cb(void)
-{
-    apfw_trace("ico_apf_resource_unset_event_cb:");
-
-    user_cb_info.callbacks = NULL;
-    user_cb_info.user_data = NULL;
-
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Get the rights of basic screen
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  src_id      id of basic screen
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_get_screen_mode(const char* disp_dev, int scr_id)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_get_screen_mode: Enter(%s,%d)",
-               disp_dev ? disp_dev : "(NULL)", scr_id);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_get_screen_mode: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (disp_dev)   {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", disp_dev, scr_id);
-    }
-    else    {
-        /* no display URI, default display  */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                 sysconf->display[sysconf->misc.default_displayId].
-                     zone[sysconf->misc.default_dispzoneId].name, scr_id);
-    }
-    if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_GET,
-                         ICO_APF_RESID_BASIC_SCREEN, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_error("ico_apf_resource_get_screen_mode: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_get_screen_mode: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Release the rights of basic screen
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  src_id      id of basic screen
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_release_screen_mode(const char* disp_dev, int scr_id)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_release_screen_mode: Enter(%s,%d)",
-               disp_dev ? disp_dev : "(NULL)", scr_id);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_release_screen_mode: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (disp_dev)   {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", disp_dev, scr_id);
-    }
-    else    {
-        /* no display URI, default display  */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                 sysconf->display[sysconf->misc.default_displayId].
-                     zone[sysconf->misc.default_dispzoneId].name, scr_id);
-    }
-    if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_RELEASE,
-                         ICO_APF_RESID_BASIC_SCREEN, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_warn("ico_apf_resource_release_screen_mode: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_release_screen_mode: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Reply the rights of basic screen
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  src_id      id of basic screen
- *  @param[in]  ok          OK(1) or NG(0)
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_reply_screen_mode(const char* disp_dev, int scr_id, const int ok)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_reply_screen_mode: Enter(%s,%d,%d)",
-               disp_dev ? disp_dev : "(NULL)", scr_id, ok);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_reply_screen_mode: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (disp_dev)   {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", disp_dev, scr_id);
-    }
-    else    {
-        /* no display URI, default display  */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                 sysconf->display[sysconf->misc.default_displayId].
-                     zone[sysconf->misc.default_dispzoneId].name, scr_id);
-    }
-    if (ico_apf_com_send(appsctl_handle,
-                         (ok != 0) ? ICO_APF_RESOURCE_REPLY_OK
-                                   : ICO_APF_RESOURCE_REPLY_NG,
-                         ICO_APF_RESID_BASIC_SCREEN, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_warn("ico_apf_resource_reply_screen_mode: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_reply_screen_mode: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Release the rights of interrupt screen
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  src_id      id of basic screen
- *  @param[in]  int_src_id  id of interrupt screen
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_get_int_screen_mode(const char* disp_dev,
-                                     int scr_id, int int_scr_id)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_get_int_screen_mode: Enter(%s,%d,%d)",
-               disp_dev ? disp_dev : "(NULL)", scr_id, int_scr_id);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_get_int_screen_mode: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (disp_dev)   {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
-                 disp_dev, int_scr_id, scr_id);
-    }
-    else    {
-        /* no display URI, default display  */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
-                 sysconf->display[sysconf->misc.default_displayId].
-                     zone[sysconf->misc.default_dispzoneId].name,
-                 int_scr_id, scr_id);
-    }
-    if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_GET,
-                         ICO_APF_RESID_INT_SCREEN, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_error("ico_apf_resource_get_int_screen_mode: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_get_int_screen_mode: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Release the rights of interrupt screen on basic screen
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  src_id      id of basic screen
- *  @param[in]  int_scr_id  id of interrupt screen
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_release_int_screen_mode(const char* disp_dev,
-                                         int scr_id, int int_scr_id)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_release_int_screen_mode: Enter(%s,%d,%d)",
-               disp_dev ? disp_dev : "(NULL)", scr_id, int_scr_id);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_release_int_screen_mode: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (disp_dev)   {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
-                 disp_dev, int_scr_id, scr_id);
-    }
-    else    {
-        /* no display URI, default display  */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
-                 sysconf->display[sysconf->misc.default_displayId].
-                     zone[sysconf->misc.default_dispzoneId].name,
-                 int_scr_id, scr_id);
-    }
-    if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_RELEASE,
-                         ICO_APF_RESID_INT_SCREEN, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_warn("ico_apf_resource_release_int_screen_mode: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_release_int_screen_mode: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Reply the rights of interrupt screen on basic screen
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  src_id      id of basic screen
- *  @param[in]  int_scr_id  id of interrupt screen
- *  @param[in]  ok          OK(1) or NG(0)
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_reply_int_screen_mode(const char* disp_dev,
-                                       int scr_id, int int_scr_id, const int ok)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_reply_int_screen_mode: Enter(%s,%d,%d,%d)",
-               disp_dev ? disp_dev : "(NULL)", scr_id, int_scr_id, ok);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_reply_int_screen_mode: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (disp_dev)   {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
-                 disp_dev, int_scr_id, scr_id);
-    }
-    else    {
-        /* no display URI, default display  */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
-                 sysconf->display[sysconf->misc.default_displayId].
-                     zone[sysconf->misc.default_dispzoneId].name,
-                 int_scr_id, scr_id);
-    }
-    if (ico_apf_com_send(appsctl_handle,
-                         (ok != 0) ? ICO_APF_RESOURCE_REPLY_OK
-                                   : ICO_APF_RESOURCE_REPLY_NG,
-                         ICO_APF_RESID_INT_SCREEN, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_warn("ico_apf_resource_reply_int_screen_mode: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_reply_int_screen_mode: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Get the rights of interrupt screen on display
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  int_scr_id  id of interrupt screen
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_get_int_screen_mode_disp(const char* disp_dev, int int_scr_id)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_get_int_screen_mode_disp: Enter(%s,%d)",
-               disp_dev ? disp_dev : "(NULL)", int_scr_id);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_get_int_screen_mode_disp: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (disp_dev)   {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", disp_dev, int_scr_id);
-    }
-    else    {
-        /* no display URI, default display  */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                 sysconf->display[sysconf->misc.default_displayId].
-                     zone[sysconf->misc.default_dispzoneId].name, int_scr_id);
-    }
-    if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_GET,
-                         ICO_APF_RESID_ON_SCREEN, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_error("ico_apf_resource_get_int_screen_mode_disp: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_get_int_screen_mode_disp: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Release the rights of interrupt screen on display
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  int_scr_id  id of interrupt screen
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_release_int_screen_mode_disp(const char* disp_dev,
-                                              int int_scr_id)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_release_int_screen_mode_disp: Enter(%s,%d)",
-               disp_dev ? disp_dev : "(NULL)", int_scr_id);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_release_int_screen_mode_disp: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (disp_dev)   {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", disp_dev, int_scr_id);
-    }
-    else    {
-        /* no display URI, default display  */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                 sysconf->display[sysconf->misc.default_displayId].
-                     zone[sysconf->misc.default_dispzoneId].name, int_scr_id);
-    }
-    if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_RELEASE,
-                         ICO_APF_RESID_ON_SCREEN, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_warn("ico_apf_resource_release_int_screen_mode_disp: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_release_int_screen_mode_disp: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Reply the rights of interrupt screen on display
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  int_scr_id  id of interrupt screen
- *  @param[in]  ok          OK(1) or NG(0)
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_reply_int_screen_mode_disp(const char* disp_dev,
-                                            int int_scr_id, const int ok)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_reply_int_screen_mode_disp: Enter(%s,%d,%d)",
-               disp_dev ? disp_dev : "(NULL)", int_scr_id, ok);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_reply_int_screen_mode_disp: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (disp_dev)   {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", disp_dev, int_scr_id);
-    }
-    else    {
-        /* no display URI, default display  */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                 sysconf->display[sysconf->misc.default_displayId].
-                     zone[sysconf->misc.default_dispzoneId].name, int_scr_id);
-    }
-    if (ico_apf_com_send(appsctl_handle,
-                         (ok != 0) ? ICO_APF_RESOURCE_REPLY_OK
-                                   : ICO_APF_RESOURCE_REPLY_NG,
-                         ICO_APF_RESID_ON_SCREEN, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_warn("ico_apf_resource_reply_int_screen_mode_disp: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_reply_int_screen_mode_disp: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Get the rights of basic sound on zone
- *
- *  @param[in]  zone        sound device uri
- *  @param[in]  snd_id      id of basic sound
- *  @param[in]  adjust      adjust acction
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_get_sound_mode(const char* zone, int snd_id, int adjust)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_get_sound_mode: Enter(%s,%d,%d)",
-               zone ? zone : "(NULL)", snd_id, adjust);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_get_sound_mode: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (zone)   {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d", zone, snd_id, adjust);
-    }
-    else    {
-        /* no zone, default zone    */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
-                 sysconf->sound[sysconf->misc.default_soundId].
-                     zone[sysconf->misc.default_soundzoneId].name,
-                 snd_id, adjust);
-    }
-    if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_GET,
-                         ICO_APF_RESID_BASIC_SOUND, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_error("ico_apf_resource_get_sound_mode: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_get_sound_mode: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Release the rights of basic sound on zone
- *
- *  @param[in]  zone        sound device uri
- *  @param[in]  snd_id      id of basic sound
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_release_sound_mode(const char* zone, int snd_id)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_release_sound_mode: Enter(%s,%d)",
-               zone ? zone : "(NULL)", snd_id);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_release_sound_mode: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (zone)   {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", zone, snd_id);
-    }
-    else    {
-        /* no zone, default zone    */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                 sysconf->sound[sysconf->misc.default_soundId].
-                     zone[sysconf->misc.default_soundzoneId].name, snd_id);
-    }
-    if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_RELEASE,
-                         ICO_APF_RESID_BASIC_SOUND, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_warn("ico_apf_resource_release_sound_mode: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_release_sound_mode: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Reply the rights of basic sound on zone
- *
- *  @param[in]  zone        sound device uri
- *  @param[in]  snd_id      id of basic sound
- *  @param[in]  ok          OK(1) or NG(0)
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_reply_sound_mode(const char* zone, int snd_id, const int ok)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_reply_sound_mode: Enter(%s,%d,%d)",
-               zone ? zone : "(NULL)", snd_id, ok);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_reply_sound_mode: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (zone)   {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", zone, snd_id);
-    }
-    else    {
-        /* no zone, default zone    */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                 sysconf->sound[sysconf->misc.default_soundId].
-                     zone[sysconf->misc.default_soundzoneId].name, snd_id);
-    }
-    if (ico_apf_com_send(appsctl_handle,
-                         (ok != 0) ? ICO_APF_RESOURCE_REPLY_OK
-                                   : ICO_APF_RESOURCE_REPLY_NG,
-                         ICO_APF_RESID_BASIC_SOUND, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_warn("ico_apf_resource_reply_sound_mode: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_reply_sound_mode: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Get the rights of interrupt sound on zone
- *
- *  @param[in]  zone        sound device uri
- *  @param[in]  int_snd_id  id of basic sound
- *  @param[in]  adjust      adjust action
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_get_int_sound_mode(const char* zone,
-                                    int int_snd_id, int adjust)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_get_int_sound_mode: Enter(%s,%d,%d)",
-               zone ? zone : "(NULL)", int_snd_id, adjust);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_get_int_sound_mode: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (zone)   {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d", zone, int_snd_id, adjust);
-    }
-    else    {
-        /* no zone, default zone    */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
-                 sysconf->sound[sysconf->misc.default_soundId].
-                     zone[sysconf->misc.default_soundzoneId].name,
-                 int_snd_id, adjust);
-    }
-    if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_GET,
-                         ICO_APF_RESID_INT_SOUND, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_error("ico_apf_resource_get_int_sound_mode: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_get_int_sound_mode: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Release the rights of interrupt sound on zone
- *
- *  @param[in]  zone        sound device uri
- *  @param[in]  int_snd_id  id of interrupt sound
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_release_int_sound_mode(const char* zone, int int_snd_id)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_release_int_sound_mode: Enter(%s,%d)",
-               zone ? zone : "(NULL)", int_snd_id);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_release_int_sound_mode: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (zone)   {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", zone, int_snd_id);
-    }
-    else    {
-        /* no zone, default zone    */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                 sysconf->sound[sysconf->misc.default_soundId].
-                     zone[sysconf->misc.default_soundzoneId].name, int_snd_id);
-    }
-    if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_RELEASE,
-                         ICO_APF_RESID_INT_SOUND, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_warn("ico_apf_resource_release_int_sound_mode: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_release_int_sound_mode: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Reply the rights of interrupt sound on zone
- *
- *  @param[in]  zone        sound device uri
- *  @param[in]  int_snd_id  id of interrupt sound
- *  @param[in]  ok          OK(1) or NG(0)
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_reply_int_sound_mode(const char* zone, int int_snd_id, const int ok)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_reply_int_sound_mode: Enter(%s,%d,%d)",
-               zone ? zone : "(NULL)", int_snd_id, ok);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_reply_int_sound_mode: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (zone)   {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", zone, int_snd_id);
-    }
-    else    {
-        /* no zone, default zone    */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                 sysconf->sound[sysconf->misc.default_soundId].
-                     zone[sysconf->misc.default_soundzoneId].name, int_snd_id);
-    }
-    if (ico_apf_com_send(appsctl_handle,
-                         (ok != 0) ? ICO_APF_RESOURCE_REPLY_OK
-                                   : ICO_APF_RESOURCE_REPLY_NG,
-                         ICO_APF_RESID_INT_SOUND, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_warn("ico_apf_resource_reply_int_sound_mode: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_reply_int_sound_mode: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Add the input event notification from input device
- *
- *  @param[in]  input_dev   input device uri
- *  @param[in]  events      notify input events
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_add_input_event(const char* input_dev, int events)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_add_input_event: Enter(%s,%d)",
-               input_dev ? input_dev : "(NULL)", events);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_add_input_event: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (input_dev)  {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", input_dev, events);
-    }
-    else    {
-        /* no input device, default device  */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                 sysconf->inputdev[sysconf->misc.default_inputdevId].name, events);
-    }
-    if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_ADD,
-                         ICO_APF_RESID_INPUT_DEV, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_error("ico_apf_resource_add_input_event: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_add_input_event: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Change the input event notification from input device
- *
- *  @param[in]  input_dev   input device uri
- *  @param[in]  events      notify input events
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_change_input_event(const char* input_dev, int events)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_change_input_event: Enter(%s,%d)",
-               input_dev ? input_dev : "(NULL)", events);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_change_input_event: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (input_dev)  {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", input_dev, events);
-    }
-    else    {
-        /* no input device, default device  */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                 sysconf->inputdev[sysconf->misc.default_inputdevId].name, events);
-    }
-    if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_CHANGE,
-                         ICO_APF_RESID_INPUT_DEV, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_error("ico_apf_resource_change_input_event: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_change_input_event: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Delete the input event notification from input device
- *
- *  @param[in]  input_dev   input device uri
- *  @param[in]  events      notify input events
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_delete_input_event(const char* input_dev, int events)
-{
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_delete_input_event: Enter(%s,%d)",
-               input_dev ? input_dev : "(NULL)", events);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_delete_input_event: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* set send message parameter */
-    if (input_dev)  {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", input_dev, events);
-    }
-    else    {
-        /* no input device, default device  */
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                 sysconf->inputdev[sysconf->misc.default_inputdevId].name, events);
-    }
-    if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_DELETE,
-                         ICO_APF_RESID_INPUT_DEV, NULL, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_error("ico_apf_resource_delete_input_event: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_delete_input_event: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Send responce form server(AppsController) to client application
- *
- *  @param[in]  appid       client application id
- *  @param[in]  event       event
- *  @param[in]  resource    target resource
- *  @param[in]  device      display device / sound zone
- *  @param[in]  id          application defined object id
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE             success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED  not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION    communication error
- *  @retval     ICO_APF_RESOURCE_E_INVAL            illegal appid or event code
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_send_to_client(const char *appid, const int event,
-                                const int resource, const char *device, const int id)
-{
-    remgr_com_handle_t  *p;
-    char    msg[ICO_APF_RESOURCE_MSG_LEN];
-
-    apfw_trace("ico_apf_resource_send_to_client: Enter(%s,%d,%d,%s,%d)",
-               appid, event, resource, device ? device : "(NULL)", id);
-
-    if ((! resmgr_initialized) || (! appsctl_handle))   {
-        apfw_error("ico_apf_resource_send_to_client: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    /* search client application    */
-    p = handles;
-    while (p)   {
-        if (strcmp(p->appid, appid) == 0)   break;
-        p = p->next;
-    }
-    if (! p)    {
-        apfw_error("ico_apf_resource_send_to_client: Leave(appid not exist)");
-        return ICO_APF_RESOURCE_E_INVAL;
-    }
-
-    /* set send message parameter */
-    if (device) {
-        snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", device, id);
-    }
-    else    {
-        /* no display URI, default display  */
-        if ((resource == ICO_APF_RESID_BASIC_SCREEN) ||
-            (resource == ICO_APF_RESID_INT_SCREEN) ||
-            (resource == ICO_APF_RESID_ON_SCREEN))  {
-            snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                     sysconf->display[sysconf->misc.default_displayId].
-                         zone[sysconf->misc.default_dispzoneId].name, id);
-        }
-        else if (resource == ICO_APF_RESID_INPUT_DEV)   {
-            snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                     sysconf->inputdev[sysconf->misc.default_inputdevId].name, id);
-        }
-        else    {
-            snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
-                     sysconf->sound[sysconf->misc.default_soundId].
-                         zone[sysconf->misc.default_soundzoneId].name, id);
-        }
-    }
-    if (ico_apf_com_send(p->handle, event, resource, appid, msg)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_error("ico_apf_resource_send_to_client: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-
-    apfw_trace("ico_apf_resource_send_to_client: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Send request to Multi Sound Manager
- *
- *  @param[in]  cmd         send command
- *  @param[in]  pid         target pid
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE             success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED  not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION    communication error
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_apf_resource_send_to_soundctl(const ico_apf_sound_state_e cmd, const int pid)
-{
-    apfw_trace("ico_apf_resource_send_to_soundctl: Enter(%s[%d],%d)",
-               cmd == ICO_APF_SOUND_COMMAND_MUTEON ? "Stop" :
-                   (cmd == ICO_APF_SOUND_COMMAND_MUTEOFF ? "Start" : "\0"), (int)cmd, pid);
-
-    if ((! resmgr_initialized) || (! soundmgr_handle))   {
-        apfw_error("ico_apf_resource_send_to_soundctl: Leave(not initialized)");
-        return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
-    }
-
-    if (ico_apf_com_send(soundmgr_handle, cmd, pid, NULL, NULL)
-            != ICO_APF_RESOURCE_E_NONE) {
-        apfw_error("ico_apf_resource_send_to_soundctl: Leave(commnad send error)");
-        return ICO_APF_RESOURCE_E_COMMUNICATION;
-    }
-    apfw_trace("ico_apf_resource_send_to_soundctl: Leave(OK)");
-    return ICO_APF_RESOURCE_E_NONE;
-}
-
diff --git a/ico-app-framework/ico_uxf_conf_app.c b/ico-app-framework/ico_uxf_conf_app.c
deleted file mode 100644 (file)
index 1d35fa0..0000000
+++ /dev/null
@@ -1,1340 +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   user experiance library(read apprication's configuration file)
- *
- * @date    Feb-28-2013
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/file.h>
-#include <errno.h>
-#include <ail.h>
-
-#include <package-manager.h>
-
-#include "ico_apf_log.h"
-#include "ico_apf_apimacro.h"
-#include "ico_uxf_conf_common.h"
-
-/*==============================================================================*/
-/* define                                                                       */
-/*==============================================================================*/
-#define APP_CONF_AIL_NULL_STR   "(NULL)"
-
-#define APP_CONF_EVENT_OK           (0)
-#define APP_CONF_EVENT_FAIL         (1)
-
-typedef struct _conf_pkgmgr_event conf_pkgmgr_event_t;
-
-struct _conf_pkgmgr_event {
-    conf_pkgmgr_event_t *next;
-    char pkg_name[ICO_UXF_MAX_PROCESS_NAME];
-    int type;
-};
-
-/*==============================================================================*/
-/* define static function prototype                                             */
-/*==============================================================================*/
-static Ico_Uxf_App_Config *readAilApplist(void);
-static void ico_uxf_conf_remakeAppHash(void);
-static int ico_uxf_conf_pkgmgrEvent(int req_id, const char *pkg_type,
-                    const char *pkg_name, const char *key, const char *val,
-                    const void *pmsg, void *data);
-static int ico_uxf_conf_addPkgmgrEventListener(void);
-static int ico_uxf_conf_startEvent(const char *pkg_name, int type);
-static int ico_uxf_conf_endEvent(const char *pkg_name, int status);
-
-/*==============================================================================*/
-/* static tables                                                                */
-/*==============================================================================*/
-static Ico_Uxf_App_Config   *_ico_app_config = NULL;
-static Ico_Uxf_App_Config   *_ico_app_config_update = NULL;
-static Ico_Uxf_Sys_Config   *sys_config = NULL;
-static GKeyFile             *sappfile = NULL;
-static char                 *default_icon = NULL;
-
-static pkgmgr_client        *conf_pc = NULL;
-static conf_pkgmgr_event_t  *conf_prog_event = NULL;
-static Ico_Uxf_AppUpdata_Cb conf_cb_func = NULL;
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getAppConfig: get application configurations
- *
- * @param       none
- * @return      application configuration table
- * @retval      !=NULL          success(application configuration table address)
- * @retval      ==NULL          error(can not read configuration files)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API const Ico_Uxf_App_Config *
-ico_uxf_getAppConfig(void)
-{
-    if (_ico_app_config) {
-        return _ico_app_config;
-    }
-    _ico_app_config = g_new0(Ico_Uxf_App_Config,1);
-    _ico_app_config_update = _ico_app_config;
-    return readAilApplist();
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   infoAilpkg: callback function for configuration from AppCore(static function)
- *
- * @param[in]   appinfo         AppCore(AIL) application information
- * @param[in]   data            user data(application index)
- * @return      result
- * @retval      AIL_CB_RET_CONTINUE success(continue next application)
- * @retval      AIL_CB_RET_CANCEL   error(stop all application search)
- */
-/*--------------------------------------------------------------------------*/
-static ail_cb_ret_e
-infoAilpkg(const ail_appinfo_h appinfo, void *data)
-{
-    int     num = (int)data;
-    char    *package;
-    char    *icon;
-    char    *name;
-    char    *category;
-    char    *type;
-    char    *exec;
-    GError  *error;
-    char    *app_category;
-    int     app_category_type;
-    char    add_category[400];
-    int     add_category_len;
-    char    work[80];
-    int     i;
-    bool    bval;
-    struct stat buff;
-    Ico_Uxf_conf_application *apptbl;
-
-    _ico_app_config_update->ailNum++;
-
-    /* get package name for appid */
-    ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &package);
-    if (strcasecmp(package, APP_CONF_AIL_NULL_STR) == 0) {
-        package = NULL;
-    }
-    /* get icon path */
-    ail_appinfo_get_str(appinfo, AIL_PROP_ICON_STR, &icon);
-    if (strcasecmp(icon, APP_CONF_AIL_NULL_STR) == 0) {
-        icon = NULL;
-    }
-    if ((icon == NULL) || (*icon == 0)) {
-        icon = default_icon;
-    }
-    /* get name */
-    ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &name);
-    if (strcasecmp(name, APP_CONF_AIL_NULL_STR) == 0) {
-        name = NULL;
-    }
-
-    /* get default category of this application */
-    add_category[0] = 0;
-    error = NULL;
-    app_category = g_key_file_get_string(sappfile, "app-attributes", package, &error);
-    if (error == NULL)  {
-        app_category_type = 0;
-    }
-    else    {
-        g_clear_error(&error);
-        error = NULL;
-        app_category = g_key_file_get_string(sappfile, "app-attributes", name, &error);
-        if (error == NULL)  {
-            app_category_type = 1;
-        }
-    }
-    add_category_len = 0;
-    if (error != NULL)  {
-        g_clear_error(&error);
-        apfw_trace("infoAilpkg: %s(%s) dose not has app-attributes", package, name);
-    }
-    else    {
-        for (i = 1;; i++)   {
-            strncpy(&add_category[add_category_len], 
-                    app_category, sizeof(add_category)-add_category_len-2);
-            add_category[sizeof(add_category)-2] = 0;
-            add_category_len = strlen(add_category);
-            if (add_category_len > 0)  {
-                if (add_category[add_category_len-1] != ';')   {
-                    strcpy(&add_category[add_category_len++], ";");
-                }
-            }
-            snprintf(work, sizeof(work)-1, "%s.%d",
-                     app_category_type == 0 ? package : name, i);
-            error = NULL;
-            app_category = g_key_file_get_string(sappfile, "app-attributes", work, &error);
-            if (error != NULL)  {
-                g_clear_error(&error);
-                break;
-            }
-        }
-        apfw_trace("infoAilpkg: %s(%s) has app-category=%s", package, name, add_category);
-    }
-    g_clear_error(&error);
-
-    /* get category */
-    ail_appinfo_get_str(appinfo, AIL_PROP_CATEGORIES_STR, &category);
-    if (strcasecmp(category, APP_CONF_AIL_NULL_STR) != 0) {
-        apfw_trace("infoAilpkg: %s + %s", add_category, category);
-        strncpy(&add_category[add_category_len],
-                category, sizeof(add_category)-add_category_len-1);
-        add_category[sizeof(add_category)-1] = 0;
-    }
-    if (add_category[0])    {
-        category = add_category;
-    }
-    else    {
-        category = NULL;
-    }
-
-    /* get type */
-    ail_appinfo_get_str(appinfo, AIL_PROP_TYPE_STR, &type);
-    /* get exec */
-    ail_appinfo_get_str(appinfo, AIL_PROP_EXEC_STR, &exec);
-    if (strcasecmp(exec, APP_CONF_AIL_NULL_STR) == 0) {
-        exec = NULL;
-    }
-
-    if ((package != NULL) && (*package != 0))   {
-        apptbl = &_ico_app_config_update->application[_ico_app_config_update->applicationNum];
-        apptbl->appid = strdup(package);
-        if (icon)   {
-            if ((stat(icon, &buff) == 0) &&
-                (! S_ISDIR(buff.st_mode))) {
-                apptbl->icon_key_name = strdup(icon);
-            }
-            else    {
-                apptbl->icon_key_name = "\0";
-            }
-        }
-        else    {
-            apptbl->icon_key_name = "\0";
-        }
-        if ((name != NULL) && (*name != 0)) {
-            apptbl->name = strdup(name);
-        }
-        else    {
-            apptbl->name = strdup(package);
-        }
-        if (strcasecmp(type, APP_CONF_AIL_NULL_STR) == 0) {
-            apptbl->type = NULL;
-        }
-        else    {
-            apptbl->type = strdup(type);
-        }
-
-        /* set default values       */
-        apptbl->hostId = sys_config->misc.default_hostId;
-        apptbl->kindId = sys_config->misc.default_kindId;
-        apptbl->categoryId = sys_config->misc.default_categoryId;
-        apptbl->invisiblecpu = 100;
-
-        /* get NoDisplay    */
-        if ((apptbl->icon_key_name != NULL) && (*apptbl->icon_key_name != 0)) {
-            bval = false;
-            ail_appinfo_get_bool(appinfo, AIL_PROP_NODISPLAY_BOOL, &bval);
-            apptbl->noicon = (int)bval;
-        }
-        else    {
-            apfw_trace("infoAilpkg: %s(%s) has no icon", package, name);
-            apptbl->noicon = 1;
-        }
-
-        /* analize categorys for extended attributes    */
-        if (category)   {
-            int     i, j, k, m, n;
-            int     found;
-            int     dispidx = sys_config->misc.default_displayId;;
-            int     soundidx = sys_config->misc.default_soundId;;
-            int     inputidx = sys_config->misc.default_inputdevId;
-            Ico_Uxf_conf_display    *display;
-            Ico_Uxf_conf_sound      *sound;
-            char    work[64];
-
-            apfw_trace("Ail.%d category=%s", _ico_app_config_update->applicationNum, category);
-
-            j = 0;
-            for (i = 0;; i++)   {
-                if ((category[i] == 0) || (category[i] == ';')) {
-                    k = i - j;
-                    if (k >= ((int)sizeof(work)-1)) k = sizeof(work)-1;
-                    memcpy(work, &category[j], k);
-                    work[k] = 0;
-                    found = 0;
-
-                    /* find running host        */
-                    if (strncasecmp(work, "run=", 4) == 0)  {
-                        found = 4;
-                    }
-                    for (k = 0; k < sys_config->hostNum; k++)  {
-                        if (strcasecmp(&work[found], sys_config->host[k].name) == 0)   {
-                            apptbl->hostId = sys_config->host[k].id;
-                            found = 1;
-                            break;
-                        }
-                    }
-                    if (found > 1)  {
-                        apfw_error("infoAilpkg: [%s] unknown running host", work);
-                    }
-                    /* find kind                */
-                    if (found == 0) {
-                        if (strncasecmp(work, "kind=", 5) == 0) {
-                            found = 5;
-                        }
-                        for (k = 0; k < sys_config->kindNum; k++)  {
-                            if (strcasecmp(&work[found],
-                                           sys_config->kind[k].name) == 0)   {
-                                apptbl->kindId = sys_config->kind[k].id;
-                                found = 1;
-                                break;
-                            }
-                        }
-                    }
-                    if (found > 1)  {
-                        apfw_error("infoAilpkg: [%s] unknown kind", work);
-                    }
-                    /* find category            */
-                    if (found == 0) {
-                        if (strncasecmp(work, "category=", 9) == 0) {
-                            found = 9;
-                        }
-                        for (k = 0; k < sys_config->categoryNum; k++)  {
-                            if (strcasecmp(&work[found],
-                                           sys_config->category[k].name) == 0)   {
-                                apptbl->categoryId = sys_config->category[k].id;
-                                found = 1;
-                                break;
-                            }
-                        }
-                    }
-                    if (found > 1)  {
-                        apfw_error("infoAilpkg: [%s] unknown category", work);
-                    }
-                    /* find type                */
-                    if (found == 0) {
-                        if (strncasecmp(work, "type=", 5) == 0) {
-                            found = 1;
-                            if (apptbl->type)   {
-                                free(apptbl->type);
-                            }
-                            apptbl->type = strdup(&work[5]);
-                        }
-                    }
-                    /* find display             */
-                    if ((found == 0) &&
-                        (strncasecmp(work, "display", 7) == 0))   {
-                        if (work[7] == '=') {
-                            dispidx = 0;
-                            found = 8;
-                        }
-                        else if ((work[7] == '.') && (work[9] == '='))  {
-                            dispidx = work[8] - '0';
-                            found = 10;
-                            if ((dispidx < 0) || (dispidx >= ICO_UXF_APPDISPLAY_MAX))   {
-                                apfw_error("infoAilpkg: [%s] unknown display number", work);
-                                dispidx = 0;
-                                break;
-                            }
-                        }
-                        else    {
-                            apfw_error("infoAilpkg: [%s] unknown display number", work);
-                            dispidx = 0;
-                            break;
-                        }
-                        if (apptbl->displayzoneNum <= dispidx)  {
-                            apptbl->display[dispidx].displayId
-                                    = sys_config->misc.default_displayId;
-                            apptbl->display[dispidx].layerId
-                                    = sys_config->misc.default_layerId;
-                            apptbl->display[dispidx].zoneId
-                                    = sys_config->misc.default_dispzoneId;
-                        }
-                        for (k = 0; k < sys_config->displayNum; k++)   {
-                            if (strcasecmp(&work[found],
-                                           sys_config->display[k].name) == 0)    {
-                                apptbl->display[dispidx].displayId
-                                        = sys_config->display[k].id;
-                                if (apptbl->displayzoneNum <= dispidx)  {
-                                    apptbl->displayzoneNum = dispidx + 1;
-                                }
-                                found = 1;
-                                break;
-                            }
-                        }
-                    }
-                    if (found > 1)  {
-                        apfw_error("infoAilpkg: [%s] unknown display", work);
-                    }
-                    /* find display layer       */
-                    if ((found == 0) &&
-                        (strncasecmp(work, "layer", 5) == 0)) {
-                        if (work[5] == '=') {
-                            dispidx = 0;
-                            found = 6;
-                        }
-                        else if ((work[5] == '.') && (work[7] == '='))  {
-                            dispidx = work[6] - '0';
-                            found = 8;
-                            if ((dispidx < 0) || (dispidx >= ICO_UXF_APPDISPLAY_MAX))   {
-                                apfw_error("infoAilpkg: [%s] unknown display number", work);
-                                dispidx = 0;
-                                break;
-                            }
-                        }
-                        else    {
-                            apfw_error("infoAilpkg: [%s] unknown display number", work);
-                            dispidx = 0;
-                            break;
-                        }
-                        if (apptbl->displayzoneNum <= dispidx)  {
-                            apptbl->display[dispidx].displayId
-                                    = sys_config->misc.default_displayId;
-                            apptbl->display[dispidx].layerId
-                                    = sys_config->misc.default_layerId;
-                            apptbl->display[dispidx].zoneId
-                                    = sys_config->misc.default_dispzoneId;
-                        }
-                        display = &sys_config->display[apptbl->display[dispidx].displayId];
-
-                        for (k = 0; k < display->layerNum; k++) {
-                            if (strcasecmp(&work[found], display->layer[k].name) == 0)  {
-                                apptbl->display[dispidx].layerId = display->layer[k].id;
-                                if (apptbl->displayzoneNum <= dispidx)  {
-                                    apptbl->displayzoneNum = dispidx + 1;
-                                }
-                                found = 1;
-                                break;
-                            }
-                        }
-                    }
-                    if (found > 1)  {
-                        apfw_error("infoAilpkg: [%s] unknown layer", work);
-                    }
-                    /* find display zone        */
-                    if ((found == 0) &&
-                        (strncasecmp(work, "dispzone", 8) == 0))  {
-                        if (work[8] == '=') {
-                            dispidx = 0;
-                            found = 9;
-                        }
-                        else if ((work[8] == '.') && (work[10] == '=')) {
-                            dispidx = work[9] - '0';
-                            found = 11;
-                            if ((dispidx < 0) || (dispidx >= ICO_UXF_APPDISPLAY_MAX))   {
-                                apfw_error("infoAilpkg: [%s] unknown display number", work);
-                                dispidx = 0;
-                                break;
-                            }
-                        }
-                        else    {
-                            apfw_error("infoAilpkg: [%s] unknown display number", work);
-                            dispidx = 0;
-                            break;
-                        }
-                        if (apptbl->displayzoneNum <= dispidx)  {
-                            apptbl->display[dispidx].displayId
-                                    = sys_config->misc.default_displayId;
-                            apptbl->display[dispidx].layerId
-                                    = sys_config->misc.default_layerId;
-                            apptbl->display[dispidx].zoneId
-                                    = sys_config->misc.default_dispzoneId;
-                        }
-                        display = &sys_config->display[apptbl->display[dispidx].displayId];
-
-                        for (k = 0; k < display->zoneNum; k++)  {
-                            if (strcasecmp(&work[found], display->zone[k].name) == 0)   {
-                                apptbl->display[dispidx].zoneId = display->zone[k].id;
-                                if (apptbl->displayzoneNum <= dispidx)  {
-                                    apptbl->displayzoneNum = dispidx + 1;
-                                }
-                                found = 1;
-                                break;
-                            }
-                        }
-                    }
-                    if (found > 1)  {
-                        apfw_error("infoAilpkg: [%s] unknown display zone", work);
-                    }
-
-                    /* find sound zone      */
-                    if ((found == 0) &&
-                        (strncasecmp(work, "soundzone", 9) == 0)) {
-                        if (work[9] == '=') {
-                            soundidx = 0;
-                            found = 10;
-                        }
-                        else if ((work[9] == '.') && (work[11] == '=')) {
-                            soundidx = work[10] - '0';
-                            found = 12;
-                            if ((soundidx < 0) || (soundidx >= ICO_UXF_APPSOUND_MAX))   {
-                                apfw_error("infoAilpkg: [%s] unknown sound number", work);
-                                soundidx = 0;
-                                break;
-                            }
-                        }
-                        else    {
-                            apfw_error("infoAilpkg: [%s] unknown sound number", work);
-                            soundidx = 0;
-                            break;
-                        }
-                        if (apptbl->soundzoneNum <= soundidx)   {
-                            apptbl->sound[soundidx].soundId
-                                    = sys_config->misc.default_soundId;
-                            apptbl->sound[soundidx].zoneId
-                                    = sys_config->misc.default_soundzoneId;
-                        }
-                        sound = &sys_config->sound[apptbl->sound[soundidx].soundId];
-
-                        for (k = 0; k < sound->zoneNum; k++)    {
-                            if (strcasecmp(&work[found], sound->zone[k].name) == 0) {
-                                apptbl->sound[soundidx].zoneId = sound->zone[k].id;
-                                if (apptbl->soundzoneNum <= soundidx)   {
-                                    apptbl->soundzoneNum = soundidx + 1;
-                                }
-                                found = 1;
-                                break;
-                            }
-                        }
-                    }
-                    if (found > 1)  {
-                        apfw_error("infoAilpkg: [%s] unknown sound zone", work);
-                    }
-
-                    /* find sound           */
-                    if ((found == 0) &&
-                        (strncasecmp(work, "sound", 5) == 0)) {
-                        if (work[5] == '=') {
-                            soundidx = 0;
-                            found = 5;
-                        }
-                        else if ((work[5] == '.') && (work[7] == '='))  {
-                            soundidx = work[6] - '0';
-                            found = 8;
-                            if ((soundidx < 0) || (soundidx >= ICO_UXF_APPSOUND_MAX))   {
-                                apfw_error("infoAilpkg: [%s] unknown sound number", work);
-                                soundidx = 0;
-                                break;
-                            }
-                        }
-                        else    {
-                            apfw_error("infoAilpkg: [%s] unknown sound number", work);
-                            soundidx = 0;
-                            break;
-                        }
-                        if (apptbl->soundzoneNum <= soundidx)   {
-                            apptbl->sound[soundidx].soundId
-                                    = sys_config->misc.default_soundId;
-                            apptbl->sound[soundidx].zoneId
-                                    = sys_config->misc.default_soundzoneId;
-                        }
-                        for (k = 0; k < sys_config->soundNum; k++) {
-                            if (strcasecmp(&work[found], sys_config->sound[k].name) == 0)  {
-                                apptbl->sound[soundidx].soundId = sys_config->sound[k].id;
-                                if (apptbl->soundzoneNum <= soundidx)   {
-                                    apptbl->soundzoneNum = soundidx + 1;
-                                }
-                                found = 1;
-                                break;
-                            }
-                        }
-                    }
-                    if (found > 1)  {
-                        apfw_error("infoAilpkg: [%s] unknown sound", work);
-                    }
-
-                    /* find input device    */
-                    if ((found == 0) &&
-                        (strncasecmp(work, "input", 5) == 0)) {
-                        if (work[5] == '=') {
-                            inputidx = 0;
-                            found = 6;
-                        }
-                        else if ((work[5] == '.') && (work[7] == '='))  {
-                            inputidx = work[6] - '0';
-                            if ((inputidx < 0) || (inputidx >= ICO_UXF_APPINPUT_MAX))   {
-                                apfw_error("infoAilpkg: [%s] unknown input number", work);
-                                found = 1;
-                                break;
-                            }
-                            found = 8;
-                        }
-                        else    {
-                            apfw_error("infoAilpkg: [%s] unknown input number", work);
-                            break;
-                        }
-                        if (apptbl->inputdevNum <= inputidx)    {
-                            apptbl->input[inputidx].inputdevId
-                                    = sys_config->misc.default_inputdevId;
-                        }
-                        for (k = 0; k < sys_config->inputdevNum; k++)  {
-                            m = strlen(sys_config->inputdev[k].name);
-                            if (strncasecmp(&work[found],
-                                            sys_config->inputdev[k].name, m) == 0)  {
-                                if (work[found+m] != '.')   {
-                                    apfw_error("infoAilpkg: [%s] unknown input sw", work);
-                                    break;
-                                }
-                                apptbl->input[inputidx].inputdevId
-                                        = sys_config->inputdev[k].id;
-                                m += (found + 1);
-                                for (n = 0; n < sys_config->inputdev[k].inputswNum; n++)   {
-                                    if (strcasecmp(&work[m],
-                                                   sys_config->inputdev[k].inputsw[n].name)
-                                            == 9) {
-                                        apptbl->input[inputidx].inputswId = n;
-                                        break;
-                                    }
-                                }
-                                if (n < sys_config->inputdev[k].inputswNum)    {
-                                    if (apptbl->inputdevNum <= inputidx)   {
-                                        apptbl->inputdevNum = inputidx + 1;
-                                    }
-                                }
-                                else    {
-                                    apfw_error("infoAilpkg: [%s] unknown input sw", work);
-                                }
-                                found = 1;
-                                break;
-                            }
-                        }
-                        if (k >= sys_config->inputdevNum)  {
-                            apfw_error("infoAilpkg: [%s] unknown input device", work);
-                            found = 1;
-                            break;
-                        }
-                    }
-                    if (found > 1)  {
-                        apfw_error("infoAilpkg: [%s] unknown input", work);
-                    }
-
-                    /* NoDisplay                */
-                    if ((found == 0) && (work[0] != 0)) {
-                        if (strncasecmp(work, "NoDisplay", 9) == 0)  {
-                            apptbl->noicon = 1;
-                            if (work[9] == '=') {
-                                if (strcasecmp(&work[10], "false") == 0)    {
-                                    apptbl->noicon = 0;
-                                }
-                            }
-                            found = 9;
-                        }
-                    }
-
-                    /* surface animation        */
-                    if ((found == 0) && (work[0] != 0)) {
-                        if (strncasecmp(work, "Animation=", 10) == 0)  {
-                            apptbl->animation = strdup(&work[10]);
-                            found = 9;
-                        }
-                    }
-                    /* surface animation time   */
-                    if ((found == 0) && (work[0] != 0)) {
-                        if (strncasecmp(work, "Animation_time=", 15) == 0)  {
-                            apptbl->animation_time = strtol(&work[15], (char **)0, 0);
-                            found = 9;
-                        }
-                    }
-
-                    /* cpu % at invisible       */
-                    if ((found == 0) && (work[0] != 0)) {
-                        if (strncasecmp(work, "invisiblecpu", 12) == 0)  {
-                            apptbl->invisiblecpu = 0;
-                            if (work[12] == '=')    {
-                                if (strcasecmp(&work[13], "yes") == 0)  {
-                                    apptbl->invisiblecpu = 100;
-                                }
-                                else if (strcasecmp(&work[13], "no") != 0)  {
-                                    apptbl->invisiblecpu = strtol(&work[13], (char **)0, 0);
-                                    if (apptbl->invisiblecpu > 100)
-                                        apptbl->invisiblecpu = 100;
-                                }
-                            }
-                            found = 9;
-                        }
-                    }
-
-                    /* configure event          */
-                    if ((found == 0) && (work[0] != 0)) {
-                        if (strcasecmp(work, "noconfigure") == 0)  {
-                            apptbl->noconfigure = 1;
-                            found = 9;
-                        }
-                    }
-
-                    /* overlap on HomeScreen menu   */
-                    if ((found == 0) && (work[0] != 0)) {
-                        if (strcasecmp(work, "menuoverlap") == 0)  {
-                            apptbl->menuoverlap = 1;
-                            found = 9;
-                        }
-                    }
-
-                    /* start mode               */
-                    if ((found == 0) && (work[0] != 0)) {
-                        if (strncasecmp(work, "auto", 4) == 0)  {
-                            apptbl->autostart = 1;
-                        }
-                        else if (strncasecmp(work, "noauto", 6) == 0)   {
-                            apptbl->autostart = 0;
-                        }
-                        else    {
-                            apfw_error("infoAilpkg: [%s] unknown key", work);
-                        }
-                    }
-                    if (category[i] == 0)   break;
-                    j = i + 1;
-                }
-            }
-        }
-        apptbl->exec = strdup(exec);
-        if (apptbl->displayzoneNum == 0)    {
-            apptbl->displayzoneNum = 1;
-            apptbl->display[0].displayId = sys_config->misc.default_displayId;
-            apptbl->display[0].layerId = sys_config->misc.default_layerId;
-            apptbl->display[0].zoneId = sys_config->misc.default_dispzoneId;
-        }
-        if (apptbl->soundzoneNum == 0)  {
-            apptbl->soundzoneNum = 1;
-            apptbl->sound[0].soundId = sys_config->misc.default_soundId;
-            apptbl->sound[0].zoneId = sys_config->misc.default_soundzoneId;
-        }
-        apfw_trace("Ail.%d: appid=%s name=%s exec=%s icon=%s type=%s",
-                   _ico_app_config_update->applicationNum, apptbl->appid, apptbl->name,
-                   apptbl->exec, apptbl->icon_key_name, apptbl->type);
-        apfw_trace("Ail.%d: categ=%d kind=%d disp=%d layer=%d zone=%d "
-                   "sound=%d zone=%d auto=%d noicon=%d anim=%s.%d overlap=%d cpu=%d",
-                   _ico_app_config_update->applicationNum, apptbl->categoryId, apptbl->kindId,
-                   apptbl->display[0].displayId, apptbl->display[0].layerId,
-                   apptbl->display[0].zoneId, apptbl->sound[0].soundId,
-                   apptbl->sound[0].zoneId, apptbl->autostart, apptbl->noicon,
-                   apptbl->animation ? apptbl->animation : "(none)",
-                   apptbl->animation_time, apptbl->menuoverlap, apptbl->invisiblecpu);
-        _ico_app_config_update->applicationNum++;
-    }
-
-    if (_ico_app_config_update->applicationNum > num)
-        return AIL_CB_RET_CANCEL;
-
-    return AIL_CB_RET_CONTINUE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   readAilApplist: get all application configuration from AppCore(static function)
- *
- * @param       none
- * @return      application configuration table
- * @retval      !=NULL          success(application configuration table address)
- * @retval      ==NULL          error(can not read configuration files)
- */
-/*--------------------------------------------------------------------------*/
-static Ico_Uxf_App_Config *
-readAilApplist(void)
-{
-    int     ret, num, wnum;
-    ail_filter_h filter;
-    GError  *error = NULL;
-
-    _ico_app_config_update->applicationNum = 0;
-
-    /* get system configuration */
-    sys_config = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
-    if (! sys_config)   {
-        apfw_error("readAilApplist: can not read system configuration");
-        return NULL;
-    }
-
-    /* read system configuration file for application default category  */
-    sappfile = g_key_file_new();
-
-    GString* filepath = g_string_new("xx");
-    g_string_printf(filepath, "%s/%s", sys_config->misc.confdir, ICO_UXF_CONFIG_APPATTR);
-
-    if (g_key_file_load_from_file(sappfile, filepath->str,
-                                  G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS,
-                                  &error)) {
-        error = NULL;
-        default_icon = g_key_file_get_string(sappfile, "app-icon", "default-icon", &error);
-        if (error != NULL)  {
-            g_clear_error(&error);
-            default_icon = NULL;
-        }
-    }
-    else    {
-        apfw_error("readAilApplist: %s %s", (char *)filepath->str, error->message);
-        g_key_file_free(sappfile);
-        sappfile = NULL;
-    }
-    g_string_free(filepath, TRUE);
-
-    /* count packages */
-    ret = ail_filter_count_appinfo(NULL, &num);
-    if (ret != AIL_ERROR_OK) {
-        if( sappfile)   {
-            g_key_file_free(sappfile);
-            sappfile = NULL;
-        }
-        apfw_trace("readAilApplist: Leave(Ail:cannot count appinfo) = %d", ret);
-        return NULL;
-    }
-    apfw_trace("readAilApplist: number of off AIL package = %d", num);
-
-    ail_filter_new(&filter);
-    ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "menu");
-    ret = ail_filter_count_appinfo(filter, &num);
-    if (ret != AIL_ERROR_OK) {
-        if( sappfile)   {
-            g_key_file_free(sappfile);
-            sappfile = NULL;
-        }
-        apfw_trace("readAilApplist: Leave(Ail:cannot count appinfo(menu)) = %d", ret);
-        return NULL;
-    }
-    apfw_trace("readAilApplist: number of menu AIL package = %d", num);
-    ail_filter_destroy(filter);
-
-    ail_filter_new(&filter);
-    ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "Application");
-    ret = ail_filter_count_appinfo(filter, &wnum);
-    if (ret != AIL_ERROR_OK) {
-        if( sappfile)   {
-            g_key_file_free(sappfile);
-            sappfile = NULL;
-        }
-        apfw_trace("readAilApplist: Leave(Ail:cannot count appinfo(Application)) = %d", ret);
-        return NULL;
-    }
-    apfw_trace("readAilApplist: number of Application AIL package = %d", wnum);
-    ail_filter_destroy(filter);
-    num += wnum;
-
-    _ico_app_config_update->application = g_new0(Ico_Uxf_conf_application, num);
-
-    ail_filter_new(&filter);
-    ret = ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "menu");
-    ret = ail_filter_list_appinfo_foreach(filter, infoAilpkg, (void *)num);
-    if (ret != AIL_ERROR_OK) {
-        if( sappfile)   {
-            g_key_file_free(sappfile);
-            sappfile = NULL;
-        }
-        ail_filter_destroy(filter);
-        apfw_trace("readAilApplist: Leave(Ail:cannot get appinfo(menu)) = %d", ret);
-        return NULL;
-    }
-    ail_filter_destroy(filter);
-
-    ail_filter_new(&filter);
-    ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "Application");
-    ret = ail_filter_list_appinfo_foreach(filter, infoAilpkg, (void *)num);
-    if (ret != AIL_ERROR_OK) {
-        if( sappfile)   {
-            g_key_file_free(sappfile);
-            sappfile = NULL;
-        }
-        ail_filter_destroy(filter);
-        apfw_trace("readAilApplist: Leave(Ail:cannot get appinfo(Application)) = %d", ret);
-        return NULL;
-    }
-    ail_filter_destroy(filter);
-
-    if (_ico_app_config_update->ailNum != num) {
-        if( sappfile)   {
-            g_key_file_free(sappfile);
-            sappfile = NULL;
-        }
-        apfw_trace("readAilApplist: Leave(cannot read ail correctly %d =! %d",
-                    _ico_app_config_update->ailNum, num);
-        return NULL;
-    }
-
-    /* create Hash Table                    */
-    ico_uxf_conf_remakeAppHash();
-
-    if( sappfile)   {
-        g_key_file_free(sappfile);
-    }
-
-    apfw_trace("readAilApplist: Leave");
-
-    return _ico_app_config_update;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_closeAppConfig: close application configuration table
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_uxf_closeAppConfig(void)
-{
-    if(_ico_app_config != NULL){
-        g_free(_ico_app_config->application);
-        g_free(_ico_app_config);
-        _ico_app_config = NULL;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_conf_remakeAppHash: make application hash table(static function)
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_conf_remakeAppHash(void)
-{
-    int         i;
-    int         hash;
-    Ico_Uxf_conf_application    *app;
-
-    memset(_ico_app_config_update->hashnametable, 0, sizeof(_ico_app_config_update->hashnametable));
-
-    for (i = 0; i < _ico_app_config_update->applicationNum; i++)  {
-
-        _ico_app_config_update->application[i].nextidhash = NULL;
-        hash = ICO_UXF_MISC_HASHBYID(i);
-        app = _ico_app_config_update->hashidtable[hash];
-        if (! app) {
-            _ico_app_config_update->hashidtable[hash] = &_ico_app_config_update->application[i];
-        }
-        else    {
-            while (app->nextidhash)    {
-                app = app->nextidhash;
-            }
-            app->nextidhash = &_ico_app_config_update->application[i];
-        }
-
-        _ico_app_config_update->application[i].nextnamehash = NULL;
-        hash = ICO_UXF_MISC_HASHBYNAME(_ico_app_config_update->application[i].appid);
-        app = _ico_app_config_update->hashnametable[hash];
-        if (! app) {
-            _ico_app_config_update->hashnametable[hash] = &_ico_app_config_update->application[i];
-        }
-        else    {
-            while (app->nextnamehash)  {
-                app = app->nextnamehash;
-            }
-            app->nextnamehash = &_ico_app_config_update->application[i];
-        }
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getAppByAppid: get application configuration by application Id
- *
- * @param[in]   appid       application Id
- * @return      application configuration table
- * @retval      !=NULL          success(application configuration table address)
- * @retval      ==NULL          error(application dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API const Ico_Uxf_conf_application *
-ico_uxf_getAppByAppid(const char *appid)
-{
-    Ico_Uxf_conf_application    *app;
-
-    if (!_ico_app_config)  {
-        (void)ico_uxf_getAppConfig();
-    }
-    app = _ico_app_config->hashnametable[ICO_UXF_MISC_HASHBYNAME(appid)];
-
-    while (app)    {
-        if (strcasecmp(app->appid, appid) == 0)   break;
-        app = app->nextnamehash;
-    }
-    if (! app)  {
-        apfw_warn("ico_uxf_getAppByAppid: appid(%s) dose not exist", appid);
-    }
-    return app;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getAppByName: get application configuration by application name
- *
- * @param[in]   name            application name
- * @return      application configuration table
- * @retval      !=NULL          success(application configuration table address)
- * @retval      ==NULL          error(application dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API const Ico_Uxf_conf_application *
-ico_uxf_getAppByName(const char *name)
-{
-    int     i;
-    Ico_Uxf_conf_application    *app = NULL;
-
-    if (!_ico_app_config)  {
-        (void)ico_uxf_getAppConfig();
-    }
-
-    for (i = 0; i < _ico_app_config->applicationNum; i++)   {
-        if (strcasecmp(_ico_app_config->application[i].name, name) == 0)    {
-            app = &_ico_app_config->application[i];
-            break;
-        }
-    }
-    if (! app)  {
-        apfw_warn("ico_uxf_getAppByName: name(%s) dose not exist", name);
-    }
-    return app;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getAppDisplay: get application display
- *
- * @param[in]   app         application configuration table
- * @param[in]   idx         display zone index
- * @param[out]  x           zone X coodinate
- * @param[out]  y           zone Y coodinate
- * @param[out]  width       zone width
- * @param[out]  height      zone height
- * @return      result
- * @retval      ICO_UXF_EOK     succes
- * @retval      ICO_UXF_EINVAL  error(illegal idx)
- * @retval      ICO_UXF_ENOSYS  error(can not read configuration files)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_getAppDisplay(const Ico_Uxf_conf_application *app, const int idx,
-                      int *x, int *y, int *width, int *height)
-{
-    Ico_Uxf_conf_display_zone *zone;
-
-    if (! sys_config)  {
-        return ICO_UXF_ENOSYS;
-    }
-    if ((! app) || (idx < 0) || (idx >= app->displayzoneNum))  {
-        return ICO_UXF_EINVAL;
-    }
-
-    zone = &sys_config->display[app->display[idx].displayId].zone[app->display[idx].zoneId];
-
-    if (x)      *x = zone->x;
-    if (y)      *y = zone->y;
-    if (width)  *width = zone->width;
-    if (height) *height = zone->height;
-
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_conf_addPkgmgrEventListener:
- *          request to listen the pkgmgr's broadcasting.
- *
- * @param       none
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ENOSYS  cannot regist listener
- */
-/*--------------------------------------------------------------------------*/
-static int
-ico_uxf_conf_addPkgmgrEventListener(void)
-{
-    int     ret;
-
-    if (conf_pc) {
-        /* already registied listener */
-        return ICO_UXF_EOK;
-    }
-
-    conf_pc = pkgmgr_client_new(PC_LISTENING);
-    if (conf_pc == NULL) {
-        apfw_trace("ico_uxf_conf_addPkgmgrEventListener: cannot create pkgmgr client");
-        return ICO_UXF_ENOSYS;
-    }
-
-    ret = pkgmgr_client_listen_status(conf_pc, ico_uxf_conf_pkgmgrEvent, NULL);
-    if (ret < 0) {
-        apfw_trace("ico_uxf_conf_addPkgmgrEventListener: "
-                   "cannot register listener of pkgmgr(%d)", ret);
-        pkgmgr_client_free(conf_pc);
-        conf_pc = NULL;
-        return ICO_UXF_ENOSYS;
-    }
-
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_conf_pkgmgrEvent:
- *          This is callback function from pkgmgr.
- *
- * @param[in]   req_id          request id
- * @param[in]   pkg_type        package type
- * @param[in]   pkg_name        package name
- * @param[in]   key             broadcast key(=start/end/...)
- * @param[in]   val             broadcast value(=install/uninstall/ok/fail)
- * @param[in]   pmsg            broadcast comment
- * @param[in]   data            user data
- * @return      always 0
- */
-/*--------------------------------------------------------------------------*/
-static int
-ico_uxf_conf_pkgmgrEvent(int req_id, const char *pkg_type, const char *pkg_name,
-                    const char *key, const char *val, const void *pmsg, void *data)
-{
-    apfw_trace("ico_uxf_conf_PkgmgrEvent: "
-               "Enter(pkg_type=%s, pkg_name=%s, key=%s, val=%s, pmsg=%s)",
-               pkg_type, pkg_name, key, val, pmsg);
-
-    if (strcasecmp(key, "start") == 0) {
-        if (strcasecmp(val, "install") == 0) {
-            ico_uxf_conf_startEvent(pkg_name, ICO_UXF_CONF_EVENT_INSTALL);
-        }
-        else if (strcasecmp(val, "uninstall") == 0) {
-            ico_uxf_conf_startEvent(pkg_name, ICO_UXF_CONF_EVENT_UNINSTALL);
-        }
-    }
-    else if (strcasecmp(key, "install_percent") == 0) {
-        ico_uxf_conf_startEvent(pkg_name, ICO_UXF_CONF_EVENT_INSTALL);
-    }
-    else if (strcasecmp(key, "progress_percent") == 0) {
-
-    }
-    else if (strcasecmp(key, "error") == 0) {
-    }
-    else if (strcasecmp(key, "end") == 0) {
-        if (strcasecmp(val, "ok") == 0) {
-            ico_uxf_conf_endEvent(pkg_name, APP_CONF_EVENT_OK);
-        }
-        else if (strcasecmp(val, "fail") == 0) {
-            ico_uxf_conf_endEvent(pkg_name, APP_CONF_EVENT_FAIL);
-        }
-    }
-
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_conf_startEvent: mark event is start
- *
- * @param[in]   pkg_name        package name
- * @param[in]   type            event type
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ENOMEM  cannot allocate memory
- */
-/*--------------------------------------------------------------------------*/
-static int
-ico_uxf_conf_startEvent(const char *pkg_name, int type)
-{
-    conf_pkgmgr_event_t *new = NULL;
-    conf_pkgmgr_event_t *event = NULL;
-
-    /* check the queue whether the package' event is exist */
-    event = conf_prog_event;
-    while (event) {
-        if (strncmp(event->pkg_name, pkg_name, ICO_UXF_MAX_PROCESS_NAME) == 0) {
-            new = event;
-            break;
-        }
-        event = event->next;
-    }
-
-    if (!new) {
-        new = malloc(sizeof(conf_pkgmgr_event_t));
-        if (!new) {
-            apfw_warn("ico_uxf_conf_startEvent: cannot allocate memory");
-            return ICO_UXF_ENOMEM;
-        }
-        memset(new, 0, sizeof(new));
-        /* insert queue */
-        event = conf_prog_event;
-        while (event) {
-            if (!event->next) {
-                break;
-            }
-            event = event->next;
-        }
-        if (!event) {
-            conf_prog_event = new;
-        }
-        else {
-            event->next = new;
-        }
-        strncpy(new->pkg_name, pkg_name, ICO_UXF_MAX_PROCESS_NAME);
-        new->type = type;
-    }
-
-
-
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_conf_endEvent: mark event is end
- *
- * @param[in]   pkg_name        package name
- * @param[in]   status          end status
- * @return      result
- * @retval      ICO_UXF_EOK     success
- */
-/*--------------------------------------------------------------------------*/
-static int
-ico_uxf_conf_endEvent(const char *pkg_name, int status)
-{
-    int     type;
-    int     cnt;
-    int     ii, jj;
-    int     exist = 0;
-    conf_pkgmgr_event_t *current = NULL;
-    conf_pkgmgr_event_t *event;
-    conf_pkgmgr_event_t *bevent;
-    static Ico_Uxf_App_Config *config = NULL;
-    static Ico_Uxf_App_Config *tmp = NULL;
-
-    apfw_trace("ico_uxf_conf_endEvent: Enter(pkg=%s, stat=%d)", pkg_name, status);
-    /* get start event from queue */
-    event = conf_prog_event;
-    bevent = NULL;
-    while (event) {
-        if (strncmp(event->pkg_name, pkg_name, ICO_UXF_MAX_PROCESS_NAME) == 0) {
-            current = event;
-            break;
-        }
-        bevent = event;
-        event = event->next;
-    }
-    if (current) {
-        if (!bevent) {
-            /* top */
-            conf_prog_event = current->next;
-            current->next = NULL;
-        }
-        else {
-            bevent->next = current->next;
-            current->next = NULL;
-        }
-    }
-    else {
-        return ICO_UXF_ENOSYS;
-    }
-
-    type = current->type;
-    free(current);
-
-    if (status == APP_CONF_EVENT_OK) {
-        config = g_new0(Ico_Uxf_App_Config, 1);
-        _ico_app_config_update = config;
-        config = readAilApplist();
-        cnt = 0;
-        while (! config) {
-            usleep(10000);
-            apfw_trace("ico_uxf_conf_endEvent: Retry %d", cnt);
-            config = readAilApplist();
-            if (cnt > 500) {
-                break;
-            }
-            else {
-                cnt++;
-            }
-        }
-        if (! config) {
-            apfw_warn("ico_uxf_getAppByAppid: cannot access ail normally");
-            return ICO_UXF_EBUSY;
-        }
-        tmp = config;
-        /* old list */
-        config = _ico_app_config;
-        /* new list */
-        _ico_app_config = tmp;
-
-        if (type == ICO_UXF_CONF_EVENT_INSTALL) {
-            for (ii = 0; ii < _ico_app_config->applicationNum; ii++) {
-                exist = 0;
-                for (jj = 0; jj < config->applicationNum; jj++) {
-                    if (strcmp(_ico_app_config->application[ii].appid,
-                               config->application[jj].appid) == 0) {
-                        exist = 1;
-                        break;
-                    }
-                }
-                if ((exist == 0) && conf_cb_func) {
-                    conf_cb_func(_ico_app_config->application[ii].appid,
-                                 ICO_UXF_CONF_EVENT_INSTALL);
-                }
-            }
-        }
-        else if (type == ICO_UXF_CONF_EVENT_UNINSTALL) {
-            for (jj = 0; jj < config->applicationNum; jj++) {
-                exist = 0;
-                for (ii = 0; ii < _ico_app_config->applicationNum; ii++) {
-                    if (strcmp(config->application[jj].appid,
-                               _ico_app_config->application[ii].appid) == 0) {
-                        exist = 1;
-                        break;
-                    }
-                }
-                if ((exist == 0) && conf_cb_func) {
-                    conf_cb_func(config->application[jj].appid,
-                                 ICO_UXF_CONF_EVENT_UNINSTALL);
-                }
-            }
-        }
-        /* free old list */
-        if (config != NULL) {
-            g_free(config->application);
-            g_free(config);
-        }
-    }
-
-    apfw_trace("ico_uxf_conf_endEvent: Leave");
-
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_setAppUpdateCb:
- *
- * @param       none
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ENOSYS  cannot regist callback
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_conf_setAppUpdateCb(Ico_Uxf_AppUpdata_Cb func)
-{
-    int     ret;
-
-    ret = ico_uxf_conf_addPkgmgrEventListener();
-
-    if (ret != ICO_UXF_EOK) {
-        apfw_trace("ico_uxf_conf_setAppUpdateCb: cannot add listener");
-        return ICO_UXF_ENOSYS;
-    }
-    conf_cb_func = func;
-
-    return ICO_UXF_EOK;
-}
-
diff --git a/ico-app-framework/ico_uxf_conf_common.c b/ico-app-framework/ico_uxf_conf_common.c
deleted file mode 100644 (file)
index bc87b31..0000000
+++ /dev/null
@@ -1,148 +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   user experiance library(common function in read configuration)
- *
- * @date    Feb-28-2013
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/file.h>
-#include <errno.h>
-
-#include "ico_apf_log.h"
-#include "ico_apf_apimacro.h"
-#include "ico_uxf_conf_common.h"
-
-/* Number of hash table                         */
-#define ICO_UXF_MISC_HASHSIZE   64          /* Must be 2's factorial            */
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_misc_hashByName: create hash value by name string
- *          there is no distinction of an english capital letter/small
- *
- * @param[in]   name        character string changed into a hash value(NULL termination)
- *
- * @return  create hash value
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_uxf_misc_hashByName(const char *name)
-{
-    int     hash = 0;
-    int     i;
-
-    for (i = 0; name[i]; i++)  {
-        hash = (hash << 1) | (name[i] & 0x1f);
-    }
-    return hash & (ICO_UXF_MISC_HASHSIZE-1);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_conf_getUint: convert value string to value
- *
- * @param[in]   str         string
- * @return      converted value
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_uxf_conf_getUint(const char* str)
-{
-    int key = -1;
-    if (str != NULL)    {
-        if ((strcasecmp(str, "true") == 0) ||
-            (strcasecmp(str, "yes") == 0))   {
-            key = 1;
-        }
-        else if ((strcasecmp(str, "false") == 0) ||
-                 (strcasecmp(str, "no") == 0))   {
-            key = 0;
-        }
-        else    {
-            char    *errpt = (char *)0;
-            key = strtol(str, &errpt, 0);
-            if ((errpt) && (*errpt != 0))  {
-                key = -1;
-            }
-        }
-    }
-    return key;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_conf_countNumericalKey: count numerical keys in configuration file
- *
- * @param[in]   keyfile         configuration file
- * @param[in]   group           configuration groupe(ex.[display])
- * @return      configuration list
- */
-/*--------------------------------------------------------------------------*/
-GList *
-ico_uxf_conf_countNumericalKey(GKeyFile *keyfile, const char* group)
-{
-    GList*  list = NULL;
-    char    **result;
-    gsize   length;
-    int     i;
-
-    result = g_key_file_get_keys(keyfile, group, &length,NULL);
-
-    for (i = 0; i < (int)length; i++) {
-        int id = ico_uxf_conf_getUint(result[i]);
-        if (id >= 0) {
-            list=g_list_append(list,g_strdup(result[i]));
-        }
-    }
-    g_strfreev(result);
-    return list;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_conf_appendStr: connect strings
- *
- * @param[in]   str1            string 1
- * @param[in]   str2            string 2
- * @return      static connected string (str1+str2)
- */
-/*--------------------------------------------------------------------------*/
-const char *
-ico_uxf_conf_appendStr(const char* str1, const char* str2)
-{
-    static char buf[256];
-    sprintf(buf, "%s%s", str1, str2);
-    return buf;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_conf_checkGerror: output configuration error message
- *
- * @param[in]   error           error information
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-ico_uxf_conf_checkGerror(GError** error)
-{
-    if (*error != NULL) {
-        uifw_warn("%s",(*error)->message);
-    }
-    g_clear_error(error);
-}
-
diff --git a/ico-app-framework/ico_uxf_conf_ecore.c b/ico-app-framework/ico_uxf_conf_ecore.c
deleted file mode 100644 (file)
index 16a9aeb..0000000
+++ /dev/null
@@ -1,168 +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   user experiance library(config's callback to Ecore(EFL) application)
- *
- * @date    May-17-2013
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <Ecore.h>
-
-#include "ico_apf_log.h"
-#include "ico_apf_apimacro.h"
-#include "ico_uxf_conf_common.h"
-#include "ico_uxf_conf_ecore.h"
-#include "ico_uxf_private.h"
-
-/*==============================================================================*/
-/* define                                                                       */
-/*==============================================================================*/
-typedef struct _econf_pkgmgr_event econf_pkgmgr_event_t;
-typedef struct _econf_cb_func_info econf_cb_func_info_t;
-
-struct _econf_pkgmgr_event {
-    char appid[ICO_UXF_MAX_PROCESS_NAME];
-    int type;
-};
-
-struct _econf_cb_func_info {
-    econf_cb_func_info_t *next;
-    Ico_Uxf_AppUpdata_Cb func;
-};
-/*==============================================================================*/
-/* define static function prototype                                             */
-/*==============================================================================*/
-static void ico_uxf_econf_updateEvent(const char *appid, int type);
-static Eina_Bool ico_uxf_econf_ecoreEvent(void *data, int type, void *event);
-
-/*==============================================================================*/
-/* static tables                                                                */
-/*==============================================================================*/
-static int                  econf_event_type = -1;
-static Ecore_Event_Handler   *econf_handle = NULL;
-
-static econf_cb_func_info_t *econf_cb_func = NULL;
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_econf_setAppUpdateCb:
- *
- * @param       none
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ENOSYS  cannot regist callback
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_econf_setAppUpdateCb(Ico_Uxf_AppUpdata_Cb func)
-{
-    econf_cb_func_info_t *func_info;
-
-    if (econf_handle == NULL) {
-        econf_event_type = ecore_event_type_new();
-
-        econf_handle = ecore_event_handler_add(econf_event_type,
-                                ico_uxf_econf_ecoreEvent, NULL);
-        if (econf_handle == NULL) {
-            apfw_warn("ico_uxf_setAppUpdateCb: cannot add ecore event handler");
-            return ICO_UXF_ENOSYS;
-        }
-        ico_uxf_conf_setAppUpdateCb(ico_uxf_econf_updateEvent);
-    }
-    if (func) {
-        func_info = malloc(sizeof(econf_cb_func_info_t));
-        if (! func_info) {
-            apfw_warn("ico_uxf_setAppUpdateCb: cannot allocate memory");
-            return ICO_UXF_ENOSYS;
-        }
-        memset(func_info, 0, sizeof(econf_cb_func_info_t));
-        func_info->func = func;
-        if (! econf_cb_func) {
-            econf_cb_func = func_info;
-        }
-        else {
-            func_info->next = econf_cb_func;
-            econf_cb_func = func_info;
-        }
-    }
-
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_econf_updateEvent:
- *          pass configuration change event to ecore event.
- *
- * @param[in]   data            data
- * @param[in]   type            type
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_econf_updateEvent(const char *appid, int type)
-{
-    econf_pkgmgr_event_t *conf_event;
-
-    apfw_trace("ico_uxf_econf_updateEvent: Enter(appid=%s, type=%d)", appid, type);
-
-    conf_event = malloc(sizeof(econf_pkgmgr_event_t));
-    if (!conf_event) {
-        apfw_warn("ico_uxf_econf_updateEvent: cannot allocate memory");
-        return;
-    }
-
-    strncpy(conf_event->appid, appid, ICO_UXF_MAX_PROCESS_NAME);
-    conf_event->type = type;
-
-    ecore_event_add(econf_event_type, conf_event, NULL, NULL);
-
-    apfw_trace("ico_uxf_econf_updateEvent: Leave");
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_econf_ecoreEvent:
- *          callback function from ecore when change app configuration
- *
- * @param[in]   data            data
- * @param[in]   type            type
- * @param[in]   event           event
- * @return      always ECORE_CALLBACK_PASS_ON
- */
-/*--------------------------------------------------------------------------*/
-static Eina_Bool
-ico_uxf_econf_ecoreEvent(void *data, int type, void *event)
-{
-    econf_cb_func_info_t *func_info;
-    econf_pkgmgr_event_t *conf_event = (econf_pkgmgr_event_t *)event;
-    apfw_trace("ico_uxf_econf_ecoreEvent: Enter(ev=%08x)", (unsigned int)event);
-
-    if (conf_event) {
-        ico_uxf_update_procwin(conf_event->appid, conf_event->type);
-        func_info = econf_cb_func;
-        while (func_info) {
-            if (func_info->func) {
-                apfw_trace("ico_uxf_econf_ecoreEvent: func=%08x", (unsigned int)func_info->func);
-                func_info->func(conf_event->appid, conf_event->type);
-            }
-            func_info = func_info->next;
-        }
-    }
-
-    apfw_trace("ico_uxf_econf_ecoreEvent: Leave");
-
-    return ECORE_CALLBACK_DONE;
-}
-
diff --git a/ico-app-framework/ico_uxf_conf_sys.c b/ico-app-framework/ico_uxf_conf_sys.c
deleted file mode 100644 (file)
index b7413c0..0000000
+++ /dev/null
@@ -1,1535 +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   user experiance library(read configuration file in all system)
- *
- * @date    Feb-28-2013
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/file.h>
-#include <errno.h>
-
-#include "ico_apf_log.h"
-#include "ico_apf_apimacro.h"
-#include "ico_uxf_conf_common.h"
-
-static Ico_Uxf_Sys_Config   *reloadSysConfig(void);
-
-static Ico_Uxf_Sys_Config   *_ico_sys_config = NULL;
-
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysConfig: get system configurations
- *
- * @param       none
- * @return      system configuration table
- * @retval      != NULL         success(system configuration table address)
- * @retval      == NULL         error(can not read configuration file)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API const Ico_Uxf_Sys_Config *
-ico_uxf_getSysConfig(void)
-{
-    if (_ico_sys_config) {
-        return _ico_sys_config;
-    }
-    _ico_sys_config = g_new0(Ico_Uxf_Sys_Config,1);
-    return reloadSysConfig();
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_ifGetSysConfig: get system configurations
- *
- * @param       none
- * @return      system configuration table
- * @retval      != NULL         success(system configuration table address)
- * @retval      == NULL         error(the configuration file is not yet read)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API const Ico_Uxf_Sys_Config *
-ico_uxf_ifGetSysConfig(void)
-{
-    return _ico_sys_config;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   pars_dispposition: calculate an expression about display size(static function)
- *
- * @param[in]   exp             expression
- * @param[in]   display         display configuration table
- * @return      calculation result
- */
-/*--------------------------------------------------------------------------*/
-static int
-pars_dispposition(const char *exp, Ico_Uxf_conf_display *display)
-{
-    int     val = 0;
-    int     wval;
-    int     i, j, sign;
-    char    word[32];
-
-    j = 0;
-    sign = 0;
-    for (i = 0; ; i++)  {
-        if (exp[i] == ' ')  continue;
-        if ((exp[i] == 0) || (exp[i] == '+') || (exp[i] == '-') ||
-            (exp[i] == '*') || (exp[i] == '-') || (exp[i] == '/'))  {
-            if (j > 0)  {
-                word[j] = 0;
-                if ((strcasecmp(word, "dispw") == 0) ||
-                    (strcasecmp(word, "width") == 0))   {
-                    wval = display->width;
-                }
-                else if ((strcasecmp(word, "disph") == 0) ||
-                         (strcasecmp(word, "heigh") == 0))  {
-                    wval = display->height;
-                }
-                else    {
-                    wval = strtol(word, (char **)0, 0);
-                }
-                j = 0;
-                if (sign >= 10) {
-                    wval = 0 - wval;
-                }
-                switch (sign % 10)  {
-                case 0:                     /* assign       */
-                    val = wval;
-                    break;
-                case 1:                     /* '+'          */
-                    val += wval;
-                    break;
-                case 2:                     /* '-'          */
-                    val -= wval;
-                    break;
-                case 3:                     /* '*'          */
-                    val *= wval;
-                    break;
-                case 4:                     /* '/'          */
-                    val /= wval;
-                    break;
-                default:
-                    break;
-                }
-                sign = 0;
-                if (exp[i] == '+')      sign = 1;
-                else if (exp[i] == '-') sign = 2;
-                else if (exp[i] == '*') sign = 3;
-                else if (exp[i] == '/') sign = 4;
-                else                    sign = 0;
-            }
-            else    {
-                if ((sign > 0) && (exp[i] == '-'))  {
-                    sign += 10;
-                }
-                else    {
-                    if (exp[i] == '+')      sign = 1;
-                    else if (exp[i] == '-') sign = 2;
-                    else if (exp[i] == '*') sign = 3;
-                    else if (exp[i] == '/') sign = 4;
-                    else                    sign = 0;
-                }
-            }
-            if (exp[i] == 0)    break;
-        }
-        else    {
-            if (j < ((int)sizeof(word)-1))  {
-                word[j++] = exp[i];
-            }
-        }
-    }
-    return val;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   reloadSysConfig: load system configuration file(static function)
- *
- * @param       none
- * @return      system configuration table
- * @retval      != NULL         success(system configuration table address)
- * @retval      == NULL         error(can not read configuration file)
- */
-/*--------------------------------------------------------------------------*/
-static Ico_Uxf_Sys_Config *
-reloadSysConfig(void)
-{
-    GKeyFile *keyfile;
-    GKeyFileFlags flags;
-    GError *error = NULL;
-    gsize length;
-    int i, j, k;
-    int zoneidx;
-    GList*  idlist;
-    char*   dirp;
-    char*   strp;
-
-    apfw_trace("reloadSysConfig: Enter");
-
-    /* decide top directory in all configurations       */
-    dirp = getenv(ICO_UXF_TOP_ENV);
-    if (! dirp)    {
-        dirp = ICO_UXF_TOP_TOPDIR;
-    }
-    strncpy(_ico_sys_config->misc.topdir, dirp, ICO_UXF_CONF_DIR_MAX);
-
-    /* decide top directory in configuration file's     */
-    dirp = getenv(ICO_UXF_CONFIG_ENV);
-    if (dirp)  {
-        strncpy(_ico_sys_config->misc.confdir, dirp, ICO_UXF_CONF_DIR_MAX);
-    }
-    else    {
-        snprintf(_ico_sys_config->misc.confdir, ICO_UXF_CONF_DIR_MAX,
-                 "%s/%s", _ico_sys_config->misc.topdir, ICO_UXF_CONFIG_DIR);
-        dirp = _ico_sys_config->misc.confdir;
-    }
-
-    /* A system-wide definition         */
-    keyfile = g_key_file_new();
-    flags = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS;
-
-    GString* filepath = g_string_new("xx");
-    g_string_printf(filepath, "%s/%s", dirp, ICO_UXF_CONFIG_SYSTEM);
-
-    if (!g_key_file_load_from_file(keyfile, filepath->str, flags, &error)) {
-        fprintf(stderr, "%s: %s\n", (char *)filepath->str, error->message);
-        g_string_free(filepath, TRUE);
-        return NULL;
-    }
-    g_string_free(filepath, TRUE);
-
-    /* log                      */
-    _ico_sys_config->misc.loglevel
-             = g_key_file_get_integer(keyfile, "log", "loglevel", &error);
-    ico_uxf_conf_checkGerror(&error);
-    _ico_sys_config->misc.logflush =
-        ico_uxf_getSysBoolByName(g_key_file_get_string(keyfile, "log", "logflush", &error));
-    ico_uxf_conf_checkGerror(&error);
-
-    /* log setting              */
-    if (getenv("ICO_IVI_NO_LOG"))    {
-        ico_uxf_log_setlevel(0);
-    }
-    else    {
-        ico_uxf_log_setlevel(_ico_sys_config->misc.loglevel |
-                             ((_ico_sys_config->misc.logflush) ?
-                                ICO_APF_LOG_FLUSH : ICO_APF_LOG_NOFLUSH));
-    }
-
-    /* [category] application category name and attributes          */
-    idlist = ico_uxf_conf_countNumericalKey(keyfile, "category");
-    length = g_list_length(idlist);
-    _ico_sys_config->categoryNum = length;
-    _ico_sys_config->category = g_malloc0(sizeof(Ico_Uxf_conf_category) * length);
-
-    for (i = 0; i < (int)length; i++) {
-        const char* key = (const char*) g_list_nth_data(idlist, i);
-        const char* g = "category";
-        _ico_sys_config->category[i].id = ico_uxf_conf_getUint(key);
-        ico_uxf_conf_checkGerror(&error);
-        _ico_sys_config->category[i].name = g_key_file_get_string(keyfile, g, key, &error);
-        ico_uxf_conf_checkGerror(&error);
-
-        strp = (char *)g_key_file_get_string(keyfile, g,
-                                             ico_uxf_conf_appendStr(key, ".view"), &error);
-        ico_uxf_conf_checkGerror(&error);
-        if (strncasecmp(strp, "alway", 5) == 0) {
-            _ico_sys_config->category[i].view = ICO_UXF_POLICY_ALWAYS;
-        }
-        else if (strncasecmp(strp, "run", 3) == 0)  {
-            _ico_sys_config->category[i].view = ICO_UXF_POLICY_RUNNING;
-        }
-        else if (strncasecmp(strp, "park", 4) == 0) {
-            _ico_sys_config->category[i].view = ICO_UXF_POLICY_PARKED;
-        }
-        else if (strncasecmp(strp, "shift_park", 10) == 0)  {
-            _ico_sys_config->category[i].view = ICO_UXF_POLICY_SHIFT_PARKING;
-        }
-        else if ((strncasecmp(strp, "shift_back", 10) == 0) ||
-                 (strncasecmp(strp, "shift_rev", 9) == 0))  {
-            _ico_sys_config->category[i].view = ICO_UXF_POLICY_SHIFT_REVERSES;
-        }
-        else if (strcasecmp(strp, "blinker_left") == 0)   {
-            _ico_sys_config->category[i].view = ICO_UXF_POLICY_BLINKER_LEFT;
-        }
-        else if (strcasecmp(strp, "blinker_right") == 0)  {
-            _ico_sys_config->category[i].view = ICO_UXF_POLICY_BLINKER_RIGHT;
-        }
-        else    {
-            fprintf(stderr, "[%s.view: %s] Unknown view mode\n", key, strp);
-            g_list_free_full(idlist,g_free);
-            g_key_file_free(keyfile);
-            return NULL;
-        }
-
-        strp = (char *)g_key_file_get_string(keyfile, g,
-                                             ico_uxf_conf_appendStr(key, ".sound"), &error);
-        ico_uxf_conf_checkGerror(&error);
-        if (strncasecmp(strp, "alway", 5) == 0) {
-            _ico_sys_config->category[i].sound = ICO_UXF_POLICY_ALWAYS;
-        }
-        else if (strncasecmp(strp, "run", 3) == 0)  {
-            _ico_sys_config->category[i].sound = ICO_UXF_POLICY_RUNNING;
-        }
-        else if (strncasecmp(strp, "park", 4) == 0) {
-            _ico_sys_config->category[i].sound = ICO_UXF_POLICY_PARKED;
-        }
-        else if (strncasecmp(strp, "shift_park", 10) == 0)  {
-            _ico_sys_config->category[i].sound = ICO_UXF_POLICY_SHIFT_PARKING;
-        }
-        else if ((strncasecmp(strp, "shift_back", 10) == 0) ||
-                 (strncasecmp(strp, "shift_rev", 9) == 0))  {
-            _ico_sys_config->category[i].sound = ICO_UXF_POLICY_SHIFT_REVERSES;
-        }
-        else if (strcasecmp(strp, "blinker_left") == 0)   {
-            _ico_sys_config->category[i].sound = ICO_UXF_POLICY_BLINKER_LEFT;
-        }
-        else if (strcasecmp(strp, "blinker_right") == 0)  {
-            _ico_sys_config->category[i].sound = ICO_UXF_POLICY_BLINKER_RIGHT;
-        }
-        else    {
-            fprintf(stderr, "[%s.view: %s] Unknown sound mode\n", key, strp);
-            g_list_free_full(idlist,g_free);
-            g_key_file_free(keyfile);
-            return NULL;
-        }
-
-        strp = (char *)g_key_file_get_string(keyfile, g,
-                                             ico_uxf_conf_appendStr(key, ".input"), &error);
-        ico_uxf_conf_checkGerror(&error);
-        if (strncasecmp(strp, "alway", 5) == 0) {
-            _ico_sys_config->category[i].input = ICO_UXF_POLICY_ALWAYS;
-        }
-        else if (strncasecmp(strp, "run", 3) == 0)  {
-            _ico_sys_config->category[i].input = ICO_UXF_POLICY_RUNNING;
-        }
-        else if (strncasecmp(strp, "park", 4) == 0) {
-            _ico_sys_config->category[i].input = ICO_UXF_POLICY_PARKED;
-        }
-        else if (strncasecmp(strp, "shift_park", 10) == 0)  {
-            _ico_sys_config->category[i].input = ICO_UXF_POLICY_SHIFT_PARKING;
-        }
-        else if ((strncasecmp(strp, "shift_back", 10) == 0) ||
-                 (strncasecmp(strp, "shift_rev", 9) == 0))  {
-            _ico_sys_config->category[i].input = ICO_UXF_POLICY_SHIFT_REVERSES;
-        }
-        else if (strcasecmp(strp, "blinker_left") == 0)   {
-            _ico_sys_config->category[i].input = ICO_UXF_POLICY_BLINKER_LEFT;
-        }
-        else if (strcasecmp(strp, "blinker_right") == 0)  {
-            _ico_sys_config->category[i].input = ICO_UXF_POLICY_BLINKER_RIGHT;
-        }
-        else    {
-            fprintf(stderr, "[%s.view: %s] Unknown input mode\n", key, strp);
-            g_list_free_full(idlist,g_free);
-            g_key_file_free(keyfile);
-            return NULL;
-        }
-        _ico_sys_config->category[i].priority =
-                                g_key_file_get_integer(keyfile, g,
-                                ico_uxf_conf_appendStr(key,".priority"), &error);
-        ico_uxf_conf_checkGerror(&error);
-
-        apfw_trace("Categry.%d id=%d name=%s view=%d sound=%d input=%d prio=%d",
-                   i, _ico_sys_config->category[i].id, _ico_sys_config->category[i].name,
-                   _ico_sys_config->category[i].view, _ico_sys_config->category[i].sound,
-                   _ico_sys_config->category[i].input,
-                   _ico_sys_config->category[i].priority);
-    }
-    g_list_free_full(idlist,g_free);
-
-    /* [kind] application kind name and attributes          */
-    idlist = ico_uxf_conf_countNumericalKey(keyfile, "kind");
-    length = g_list_length(idlist);
-    _ico_sys_config->kindNum = length;
-    _ico_sys_config->kind = g_malloc0(sizeof(Ico_Uxf_conf_kind) * length);
-
-    for (i = 0; i < (int)length; i++) {
-        const char* key = (const char*) g_list_nth_data(idlist, i);
-        const char* g = "kind";
-        _ico_sys_config->kind[i].id = ico_uxf_conf_getUint(key);
-        ico_uxf_conf_checkGerror(&error);
-        _ico_sys_config->kind[i].name = g_key_file_get_string(keyfile, g, key, &error);
-        ico_uxf_conf_checkGerror(&error);
-        strp = (char *)g_key_file_get_string(
-                            keyfile, g, ico_uxf_conf_appendStr(key, ".privilege"), &error);
-        ico_uxf_conf_checkGerror(&error);
-        if (strcasecmp(strp, "almighty") == 0)   {
-            _ico_sys_config->kind[i].priv = ICO_UXF_PRIVILEGE_ALMIGHTY;
-        }
-        else if (strcasecmp(strp, "system") == 0)   {
-            _ico_sys_config->kind[i].priv = ICO_UXF_PRIVILEGE_SYSTEM;
-        }
-        else if (strcasecmp(strp, "system.audio") == 0)   {
-            _ico_sys_config->kind[i].priv = ICO_UXF_PRIVILEGE_SYSTEM_AUDIO;
-        }
-        else if (strcasecmp(strp, "system.visible") == 0)   {
-            _ico_sys_config->kind[i].priv = ICO_UXF_PRIVILEGE_SYSTEM_VISIBLE;
-        }
-        else if (strcasecmp(strp, "maker") == 0)    {
-            _ico_sys_config->kind[i].priv = ICO_UXF_PRIVILEGE_MAKER;
-        }
-        else if (strcasecmp(strp, "certificate") == 0)  {
-            _ico_sys_config->kind[i].priv = ICO_UXF_PRIVILEGE_CERTIFICATE;
-        }
-        else if (strcasecmp(strp, "none") == 0) {
-            _ico_sys_config->kind[i].priv = ICO_UXF_PRIVILEGE_NONE;
-        }
-        else    {
-            fprintf(stderr, "[%s.view: %s] Unknown privilege mode\n", key, strp);
-            g_list_free_full(idlist,g_free);
-            g_key_file_free(keyfile);
-            return NULL;
-        }
-        apfw_trace("Kind.%d id=%d name=%s privilege=%d",
-                   i, _ico_sys_config->kind[i].id, _ico_sys_config->kind[i].name,
-                   _ico_sys_config->kind[i].priv);
-    }
-    g_list_free_full(idlist,g_free);
-
-    /* [port] port numbers              */
-    _ico_sys_config->misc.appscontrollerport
-        = g_key_file_get_integer(keyfile, "port", "appscontrollerport", &error);
-    ico_uxf_conf_checkGerror(&error);
-    _ico_sys_config->misc.soundpluginport
-        = g_key_file_get_integer(keyfile, "port", "soundpluginport", &error);
-    ico_uxf_conf_checkGerror(&error);
-    if (_ico_sys_config->misc.appscontrollerport <= 0)
-        _ico_sys_config->misc.appscontrollerport = 18081;
-    if (_ico_sys_config->misc.soundpluginport <= 0)
-        _ico_sys_config->misc.soundpluginport = 18082;
-
-    /* hosts                        */
-    idlist = ico_uxf_conf_countNumericalKey(keyfile, "host");
-    length = g_list_length(idlist);
-    _ico_sys_config->hostNum = length;
-    _ico_sys_config->host = g_malloc0(sizeof(Ico_Uxf_conf_host) * length);
-
-    for (i = 0; i < (int)length; i++)   {
-        char* key = (char*) g_list_nth_data(idlist, i);
-        const char* g = "host";
-        _ico_sys_config->host[i].id  = ico_uxf_conf_getUint(key);
-        _ico_sys_config->host[i].name = g_key_file_get_string(keyfile, g, key, &error);
-        ico_uxf_conf_checkGerror(&error);
-
-        _ico_sys_config->host[i].address
-            = g_key_file_get_string(keyfile, g, ico_uxf_conf_appendStr(key, ".ip"), &error);
-        ico_uxf_conf_checkGerror(&error);
-        if (g_hostname_is_ip_address(_ico_sys_config->host[i].address)!= TRUE){
-            apfw_error("host[%d] = %s is not ip address style",
-                        _ico_sys_config->host[i].id, _ico_sys_config->host[i].address);
-            exit(1);
-        }
-
-        _ico_sys_config->host[i].type =
-            ico_uxf_getSysHostTypeByName(
-                    g_key_file_get_string(keyfile, g,
-                                          ico_uxf_conf_appendStr(key, ".type"), &error));
-        ico_uxf_conf_checkGerror(&error);
-
-        _ico_sys_config->host[i].homescreen =
-            g_key_file_get_string(keyfile, g,
-                                  ico_uxf_conf_appendStr(key, ".homescreen"), &error);
-        ico_uxf_conf_checkGerror(&error);
-        apfw_trace("Host.%d: Id=%d Name=%s Type=%d Ip=%s HomeScreen=%s",
-            i, _ico_sys_config->host[i].id, (char *)_ico_sys_config->host[i].name,
-            _ico_sys_config->host[i].type, (char *)_ico_sys_config->host[i].address,
-            _ico_sys_config->host[i].homescreen);
-    }
-    g_list_free_full(idlist,g_free);
-
-    /* decide myhost        */
-    const char *penv = getenv(ICO_UXF_ENV_APPINF);
-    int hostid = -1;
-    int dmy1, dmy2, dmy3;
-    char cdmy4[64];
-    if (penv)  {
-        if (sscanf(penv, "%d %d %d %s %d", &dmy1, &dmy2, &dmy3, cdmy4, &hostid) < 5) {
-            hostid = -1;
-        }
-        apfw_trace("reloadSysConfig: Env(%s) = %s, hostId = %d",
-                    ICO_UXF_ENV_APPINF, penv, hostid);
-    }
-
-    if (hostid < 0)    {
-        if ((gethostname(cdmy4, sizeof(cdmy4)-1) >= 0) &&
-            (strncmp(cdmy4, "localhost", 9) != 0))   {
-            apfw_trace("hostname = %s", cdmy4);
-            for (j = 0; cdmy4[j]; j++) {
-                if ((cdmy4[j] == ' ') || (cdmy4[j] == '(') ||
-                    (cdmy4[j] == '@') || (cdmy4[j] == ':'))    {
-                    cdmy4[j] = 0;
-                    break;
-                }
-            }
-            for (j = 0; j < _ico_sys_config->hostNum; j++) {
-                if (strcasecmp(_ico_sys_config->host[j].name, cdmy4) == 0)   {
-                    hostid = _ico_sys_config->host[j].id;
-                    break;
-                }
-            }
-        }
-    }
-
-    if (hostid < 0)    {
-        FILE *fp = popen("/sbin/ifconfig", "r");
-        int foundeth = 0;
-        char sBuf[128];
-
-        if (fp)    {
-            while (fgets(sBuf, sizeof(sBuf)-1, fp))  {
-                if ((! foundeth) || (sBuf[0] != ' '))  {
-                    foundeth = 0;
-                    /* skip to "eth" device     */
-                    if (sBuf[0] == ' ' || sBuf[0] == '\t') continue;
-                    if (strncmp(sBuf, "eth", 3) != 0)    continue;
-                }
-                foundeth = 1;
-
-                for (j = 0; sBuf[j]; j++)  {
-                    if (strncmp(&sBuf[j], "inet6", 5) == 0)  continue;
-                    if (strncmp(&sBuf[j], "inet", 4) == 0)   break;
-                }
-                if (sBuf[j])   {
-                    /* forget "inet" device         */
-                    j += 4;
-                    for (; sBuf[j]; j++)   {
-                        if (sBuf[j] == ':')    break;
-                    }
-                    if (sBuf[j] )  {
-                        j++;
-                        int k;
-                        for (k = j +1; sBuf[k]; k++)   {
-                            if (sBuf[k] == ' ' || sBuf[k] == '\t' ||
-                                sBuf[k] == '\n' || sBuf[k] == '\r')    {
-                                sBuf[k] = 0;
-                                break;
-                            }
-                        }
-                        apfw_trace("My Inet Addr = %s", &sBuf[j]);
-                        for (k = 0; k < _ico_sys_config->hostNum; k++) {
-                            if (strcmp(_ico_sys_config->host[k].address, &sBuf[j]) == 0) {
-                                hostid = _ico_sys_config->host[k].id;
-                                break;
-                            }
-                        }
-                    }
-                }
-                if (hostid >= 0)   break;
-            }
-            fclose(fp);
-        }
-    }
-    if (hostid >= 0)   {
-        _ico_sys_config->misc.myhostId = hostid;
-    }
-    else    {
-        apfw_trace("Default Host = 0, %s", ico_uxf_get_SysLocation(0));
-        _ico_sys_config->misc.myhostId = _ico_sys_config->host[0].id;
-    }
-
-    /* The validity of MyHost is checked.       */
-    Ico_Uxf_conf_host *myhost = (Ico_Uxf_conf_host *)
-            ico_uxf_getSysHostById(_ico_sys_config->misc.myhostId);
-    if (! myhost)  {
-        apfw_critical("MyHostId.%d dose not exist, default 0",
-                      _ico_sys_config->misc.myhostId);
-        myhost = &_ico_sys_config->host[0];
-        if (! myhost)  {
-            apfw_error("HostId.0 dose not exist, GiveUp!");
-            exit(1);
-        }
-        _ico_sys_config->misc.myhostId = myhost->id;
-    }
-
-    _ico_sys_config->misc.myaddress =
-            (char *)ico_uxf_get_SysLocation(_ico_sys_config->misc.myhostId);
-    _ico_sys_config->misc.myhostName = myhost->name;
-
-    _ico_sys_config->misc.homescreen = myhost->homescreen;
-
-    if (myhost->homescreen)    {
-        _ico_sys_config->misc.masterhostId = myhost->id;
-    }
-    else    {
-        _ico_sys_config->misc.masterhostId = _ico_sys_config->misc.myhostId;
-
-        for (i = 0; i < _ico_sys_config->hostNum; i++) {
-            if (_ico_sys_config->host[i].homescreen)   {
-                _ico_sys_config->misc.masterhostId = _ico_sys_config->host[i].id;
-                break;
-            }
-        }
-    }
-    _ico_sys_config->misc.masterhostaddress =
-            (char *)ico_uxf_get_SysLocation(_ico_sys_config->misc.masterhostId);
-
-    apfw_trace("MyHost %d[%s] Master Host %d(%s)", _ico_sys_config->misc.myhostId,
-                _ico_sys_config->misc.myaddress, _ico_sys_config->misc.masterhostId,
-                _ico_sys_config->misc.masterhostaddress);
-
-    _ico_sys_config->misc.default_hostId = ico_uxf_getSysHostByName(
-                            g_key_file_get_string(keyfile, "default", "host", &error));
-    ico_uxf_conf_checkGerror(&error);
-
-    /* display                  */
-    idlist = ico_uxf_conf_countNumericalKey(keyfile, "display");
-    length = g_list_length(idlist);
-    _ico_sys_config->displayNum = length;
-    _ico_sys_config->display = g_malloc0(sizeof(Ico_Uxf_conf_display) * length);
-    zoneidx = 0;
-
-    for (i = 0; i < (int)length; i++) {
-        const char* key = (const char*) g_list_nth_data(idlist, i);
-        const char* g = "display";
-        Ico_Uxf_conf_display *display = &_ico_sys_config->display[i];
-        display->id = ico_uxf_conf_getUint(key);
-        ico_uxf_conf_checkGerror(&error);
-        display->name = g_key_file_get_string(keyfile, g, key, &error);
-        ico_uxf_conf_checkGerror(&error);
-
-        display->hostId =
-            ico_uxf_getSysHostByName(
-                        g_key_file_get_string(keyfile, g,
-                                              ico_uxf_conf_appendStr(key,".host"), &error));
-        ico_uxf_conf_checkGerror(&error);
-        display->displayno =
-            g_key_file_get_integer(keyfile, g,
-                                   ico_uxf_conf_appendStr(key,".displayno"), &error);
-        if (error) {
-            display->displayno = -1;
-            g_clear_error(&error);
-        }
-        display->wayland =
-            g_key_file_get_string(keyfile, g,
-                                  ico_uxf_conf_appendStr(key,".wayland"), &error);
-        ico_uxf_conf_checkGerror(&error);
-
-        display->type =
-            ico_uxf_getSysDispTypeByName(g_key_file_get_string(keyfile, g,
-                                         ico_uxf_conf_appendStr(key,".type"), &error));
-        ico_uxf_conf_checkGerror(&error);
-
-        display->width =
-            g_key_file_get_integer(keyfile, g, ico_uxf_conf_appendStr(key,".width"), &error);
-        ico_uxf_conf_checkGerror(&error);
-        display->height =
-            g_key_file_get_integer(keyfile, g, ico_uxf_conf_appendStr(key,".height"), &error);
-        ico_uxf_conf_checkGerror(&error);
-        display->layerNum =
-            g_key_file_get_integer(keyfile, g, ico_uxf_conf_appendStr(key,".layer"), &error);
-        ico_uxf_conf_checkGerror(&error);
-
-        /* inch                     */
-        display->inch =
-            g_key_file_get_integer(keyfile,g,ico_uxf_conf_appendStr(key,".inch"),&error);
-        ico_uxf_conf_checkGerror(&error);
-
-        apfw_trace("Display.%d Id=%d Name=%s Host=%d DispNo=%d W/H=%d/%d Wayland=%s inch=%d",
-                   i, display->id, (char *)display->name, display->hostId,
-                   display->displayno, display->width, display->height,
-                   display->wayland, display->inch);
-
-        /* display layer            */
-        int displayer_length;
-        gchar **layerlist;
-        gsize layersize;
-        GString* layer_key = g_string_new("");
-        for (displayer_length = 0;
-             displayer_length < ICO_UXF_DISPLAY_LAYER_MAX; displayer_length++)  {
-            g_string_printf(layer_key,"%s.layer.%d",key,displayer_length);
-            if (g_key_file_has_key(keyfile,g,layer_key->str,NULL) != TRUE)   break;
-        }
-        apfw_trace("Display.%d layerNum = %d" ,i, displayer_length);
-        display->layerNum = displayer_length;
-        display->layer = g_malloc0(sizeof(Ico_Uxf_conf_display_layer)*displayer_length);
-
-        for (j = 0; j < displayer_length; j++)  {
-            g_string_printf(layer_key,"%s.layer.%d",key,j);
-            display->layer[j].id = j;
-            layerlist = g_key_file_get_string_list(keyfile, g, layer_key->str,
-                                                   &layersize, &error);
-            ico_uxf_conf_checkGerror(&error);
-            if (layersize <= 0) {
-                apfw_error("Display.%d Layer.%d has no name", i, j);
-            }
-            else    {
-                display->layer[j].name = strdup((char *)layerlist[0]);
-                for (k = 1; k < (int)layersize; k++)    {
-                    if (strcasecmp((char *)layerlist[k], "menuoverlap") == 0)   {
-                        display->layer[j].menuoverlap = 1;
-                    }
-                }
-                apfw_trace("Display.%d Layer.%d id=%d name=%s overlap=%d", i, j,
-                           display->layer[j].id, display->layer[j].name,
-                           display->layer[j].menuoverlap);
-            }
-            if (layerlist)  g_strfreev(layerlist);
-        }
-        g_string_free(layer_key,TRUE);
-
-        /* display zone         */
-        int dispzone_length;
-        GString* zone_key = g_string_new("");
-        for (dispzone_length = 0;
-             dispzone_length < ICO_UXF_DISPLAY_ZONE_MAX; dispzone_length++) {
-            g_string_printf(zone_key,"%s.zone.%d",key,dispzone_length);
-            if (g_key_file_has_key(keyfile,g,zone_key->str,NULL) != TRUE)    break;
-        }
-        apfw_trace("Display.%d zoneNum = %d" ,i, dispzone_length);
-        display->zoneNum = dispzone_length;
-        display->zone = g_malloc0(sizeof(Ico_Uxf_conf_display_zone)*dispzone_length);
-
-        gsize zonesizes[ICO_UXF_DISPLAY_ZONE_MAX];
-        gchar **zonelists[ICO_UXF_DISPLAY_ZONE_MAX];
-        gchar **zonelist;
-        Ico_Uxf_conf_display_zone *zone;
-
-        for (j = 0; j < dispzone_length; j++)   {
-            g_string_printf(zone_key,"%s.zone.%d",key,j);
-            zonelists[j] = g_key_file_get_string_list(
-                                    keyfile, g, zone_key->str, &zonesizes[j], &error);
-            ico_uxf_conf_checkGerror(&error);
-            if ((! zonelists[j]) || (zonesizes[j] <= 0)) {
-                apfw_error("reloadSysConfig: display.%d zone.%d dose not exist",i,j);
-                zonesizes[j] = 0;
-            }
-        }
-        for (j = 0; j < dispzone_length; j++)   {
-            zone = &(display->zone[j]);
-            zone->id = j;
-            zone->zoneidx = zoneidx++;
-            zone->display = display;
-            zone->node = ICO_UXF_NODEDISP_2_NODEID(display->hostId, display->displayno);
-
-            if (zonesizes[j] <= 0)  continue;
-
-            zonelist = zonelists[j];
-            zone->name = strdup((char*)zonelist[0]);
-            if (zonesizes[j] < 5)   {
-                /* default zone is full screen      */
-                zone->x = 0;
-                zone->y = 0;
-                zone->width = display->width;
-                zone->height = display->height;
-            }
-            else    {
-                zone->x = pars_dispposition((char *)zonelist[1], display);
-                zone->y = pars_dispposition((char *)zonelist[2], display);
-                zone->width = pars_dispposition((char *)zonelist[3], display);
-                zone->height = pars_dispposition((char *)zonelist[4], display);
-            }
-        }
-        for (j = 0; j < dispzone_length; j++)   {
-            int k, l, m, n;
-            if (zonesizes[j] <= 5)  continue;
-            zonelist = zonelists[j];
-            zone = &(display->zone[j]);
-            m = 0;
-            for (k = 5; (m < ZONE_MAX_OVERLAP) && (k < (int)zonesizes[j]); k++) {
-                for (l = 0; l < dispzone_length; l++)   {
-                    if (l == j) continue;
-                    if (strcasecmp(zonelist[k], display->zone[l].name) == 0)    {
-                        for (n = 0; n < m; n++) {
-                            if (zone->overlap[n] == display->zone[l].id)    break;
-                        }
-                        if (n >= m) {
-                            zone->overlap[m++] = display->zone[l].id;
-                        }
-                        break;
-                    }
-                }
-                if (l >= dispzone_length)   {
-                    apfw_error("reloadSysConfig: disp.%d zone.%d overlap zone(%s) "
-                               "dose not exist", i, j, (char *)zonelist[k]);
-                }
-            }
-            zone->overlapNum = m;
-        }
-        for (j = 0; j < dispzone_length; j++)   {
-            if (zonelists[j])   g_strfreev(zonelists[j]);
-            zone = &(display->zone[j]);
-            apfw_trace("Disp.%d zone.%d node=%x x/y=%d/%d w/h=%d/%d over=%d.%d %d %d %d %d",
-                       i, j, zone->node, zone->x, zone->y, zone->width, zone->height,
-                       zone->overlapNum, zone->overlap[0], zone->overlap[1],
-                       zone->overlap[2], zone->overlap[3], zone->overlap[4]);
-        }
-        g_string_free(zone_key,TRUE);
-    }
-    g_list_free_full(idlist,g_free);
-
-    /* sound devices                        */
-    idlist = ico_uxf_conf_countNumericalKey(keyfile, "sound");
-    length = g_list_length(idlist);
-    _ico_sys_config->soundNum = length;
-    _ico_sys_config->sound = g_malloc0(sizeof(Ico_Uxf_conf_sound) * length);
-    zoneidx = 0;
-
-    for (i = 0; i < (int)length; i++) {
-        const char* key = (const char*) g_list_nth_data(idlist, i);
-        const char* g = "sound";
-        Ico_Uxf_conf_sound *sound = &_ico_sys_config->sound[i];
-        sound->id = ico_uxf_conf_getUint(key);
-        ico_uxf_conf_checkGerror(&error);
-        sound->name = g_key_file_get_string(keyfile, g, key, &error);
-        ico_uxf_conf_checkGerror(&error);
-
-        sound->hostId =
-            ico_uxf_getSysHostByName(g_key_file_get_string(
-                                    keyfile, g, ico_uxf_conf_appendStr(key,".host"), &error));
-        ico_uxf_conf_checkGerror(&error);
-        sound->soundno =
-            g_key_file_get_integer(keyfile, g,
-                                   ico_uxf_conf_appendStr(key,".soundno"), &error);
-        if (error) {
-            sound->soundno = -1;
-            g_clear_error(&error);
-        }
-
-        apfw_trace("Sound.%d Id=%d Name=%s Host=%d SoundNo=%d",
-                   i, sound->id, (char *)sound->name, sound->hostId, sound->soundno);
-
-        /* sound zone           */
-        int sound_length;
-        GString* sound_key = g_string_new("");
-        for (sound_length = 0;
-             sound_length < ICO_UXF_SOUND_ZONE_MAX; sound_length++) {
-            g_string_printf(sound_key,"%s.zone.%d", key, sound_length);
-            if (g_key_file_has_key(keyfile,g,sound_key->str,NULL) != TRUE)   break;
-        }
-        apfw_trace("Sound.%d zoneNum = %d" ,i, sound_length);
-        sound->zoneNum = sound_length;
-        sound->zone = g_malloc0(sizeof(Ico_Uxf_conf_sound_zone)*sound_length);
-
-        gsize zonesizes[ICO_UXF_SOUND_ZONE_MAX];
-        gchar **zonelists[ICO_UXF_SOUND_ZONE_MAX];
-        gchar **zonelist;
-        Ico_Uxf_conf_sound_zone *zone;
-
-        for (j = 0; j < sound_length; j++)  {
-            g_string_printf(sound_key,"%s.zone.%d",key,j);
-            zonelists[j] =
-                g_key_file_get_string_list(keyfile,g,sound_key->str,&zonesizes[j],&error);
-            ico_uxf_conf_checkGerror(&error);
-            if ((! zonelists[j]) || (zonesizes[j] <= 0)) {
-                apfw_error("reloadSysConfig: sound.%d zone.%d dose not exist",i,j);
-                zonesizes[j] = 0;
-            }
-        }
-        for (j = 0; j < sound_length; j++)  {
-            zone = &(sound->zone[j]);
-            zone->id = j;
-            zone->zoneidx = zoneidx++;
-            zone->sound = sound;
-            if (zonesizes[j] <= 0)  continue;
-
-            zonelist = zonelists[j];
-            zone->name = strdup((char*)zonelist[0]);
-        }
-        for (j = 0; j < sound_length; j++)  {
-            int k, l, m, n;
-            if (zonesizes[j] <= 1)  continue;
-            zonelist = zonelists[j];
-            zone = &(sound->zone[j]);
-            m = 0;
-            for (k = 1; (m < ZONE_MAX_OVERLAP) && (k < (int)zonesizes[j]); k++) {
-                for (l = 0; l < sound_length; l++)  {
-                    if (l == j) continue;
-                    if (strcasecmp((char*)zonelist[k], sound->zone[l].name) == 0)   {
-                        for (n = 0; n < m; n++) {
-                            if (zone->overlap[n] == sound->zone[l].id)  break;
-                        }
-                        if (n >= m) {
-                            zone->overlap[m++] = sound->zone[l].id;
-                        }
-                        break;
-                    }
-                }
-                if (l >= sound_length)  {
-                    apfw_error("reloadSysConfig: sound.%d zone.%d overlap zone(%s) "
-                               "dose not exist", i, j, (char *)zonelist[k]);
-                }
-            }
-            zone->overlapNum = m;
-        }
-        for (j = 0; j < sound_length; j++)  {
-            if (zonelists[j])   g_strfreev(zonelists[j]);
-            zone = &(sound->zone[j]);
-            apfw_trace("Sound.%d zone.%d(%s) over=%d.%d %d %d %d %d",
-                       i, j, zone->name,
-                       zone->overlapNum, zone->overlap[0], zone->overlap[1],
-                       zone->overlap[2], zone->overlap[3], zone->overlap[4]);
-        }
-        g_string_free(sound_key,TRUE);
-    }
-    g_list_free_full(idlist,g_free);
-
-    /* input devices                        */
-    idlist = ico_uxf_conf_countNumericalKey(keyfile, "input");
-    length = g_list_length(idlist);
-    _ico_sys_config->inputdevNum = length;
-    _ico_sys_config->inputdev = g_malloc0(sizeof(Ico_Uxf_conf_inputdev) * length);
-
-    for (i = 0; i < (int)length; i++) {
-        const char* key = (const char*) g_list_nth_data(idlist, i);
-        const char* g = "input";
-        Ico_Uxf_conf_inputdev *inputdev = &_ico_sys_config->inputdev[i];
-        inputdev->id = ico_uxf_conf_getUint(key);
-        ico_uxf_conf_checkGerror(&error);
-        inputdev->name = g_key_file_get_string(keyfile, g, key, &error);
-        ico_uxf_conf_checkGerror(&error);
-
-        /* input sw             */
-        int sw_length;
-        GString* sw_key = g_string_new("");
-        for (sw_length = 0;; sw_length++)   {
-            g_string_printf(sw_key,"%s.sw.%d",key,sw_length);
-            if (g_key_file_has_key(keyfile,g,sw_key->str,NULL) != TRUE)  break;
-        }
-        apfw_trace("Input.%d swNum = %d" ,i, sw_length);
-        inputdev->inputswNum = sw_length;
-        inputdev->inputsw = g_malloc0(sizeof(Ico_Uxf_conf_inputsw)*sw_length);
-
-        /* input sw         */
-        gchar **swlist;
-        gsize   swsize;
-        for (j = 0; j < sw_length; j++) {
-            g_string_printf(sw_key,"%s.sw.%d",key,j);
-            swlist = g_key_file_get_string_list(keyfile,g,sw_key->str,&swsize,&error);
-            ico_uxf_conf_checkGerror(&error);
-            if ((!swlist) || (swsize <= 0))  {
-                apfw_error("reloadSysConfig: input.%d sw.%d dose not exist",i,j);
-                swsize = 0;
-            }
-            else    {
-                inputdev->inputsw[j].inputdev = inputdev;
-                inputdev->inputsw[j].name = strdup((char *)swlist[0]);
-                if (swsize > 1) {
-                    inputdev->inputsw[j].appid = strdup((char *)swlist[1]);
-                    if (swsize > 2) {
-                        inputdev->inputsw[j].keycode = strtol((char *)swlist[2],
-                                                              (char **)0, 0);
-                    }
-                }
-            }
-            g_strfreev(swlist);
-            uifw_trace("Input %s.%s app=%s key=%d",
-                       inputdev->name,
-                       inputdev->inputsw[j].name ? inputdev->inputsw[j].name : " ",
-                       inputdev->inputsw[j].appid ? inputdev->inputsw[j].appid : " ",
-                       inputdev->inputsw[j].keycode);
-        }
-        g_string_free(sw_key,TRUE);
-    }
-    g_list_free_full(idlist,g_free);
-
-    _ico_sys_config->misc.default_kindId = ico_uxf_getSysKindByName(
-                        g_key_file_get_string(keyfile, "default", "kind", &error));
-    ico_uxf_conf_checkGerror(&error);
-    _ico_sys_config->misc.default_categoryId = ico_uxf_getSysCategoryByName(
-                        g_key_file_get_string(keyfile, "default", "category", &error));
-    ico_uxf_conf_checkGerror(&error);
-    _ico_sys_config->misc.default_displayId = ico_uxf_getSysDisplayByName(
-                        g_key_file_get_string(keyfile, "default", "display", &error));
-    ico_uxf_conf_checkGerror(&error);
-    _ico_sys_config->misc.default_layerId = ico_uxf_getSysLayerByName(
-                        _ico_sys_config->misc.default_displayId,
-                        g_key_file_get_string(keyfile, "default", "layer", &error));
-    ico_uxf_conf_checkGerror(&error);
-    _ico_sys_config->misc.default_dispzoneId = ico_uxf_getSysDispZoneByName(
-                        _ico_sys_config->misc.default_displayId,
-                        g_key_file_get_string(keyfile, "default", "displayzone", &error));
-    _ico_sys_config->misc.default_soundId = ico_uxf_getSysSoundByName(
-                        g_key_file_get_string(keyfile, "default", "sound", &error));
-    _ico_sys_config->misc.default_soundzoneId = ico_uxf_getSysSoundZoneByName(
-                        _ico_sys_config->misc.default_soundId,
-                        g_key_file_get_string(keyfile, "default", "soundzone", &error));
-    ico_uxf_conf_checkGerror(&error);
-    _ico_sys_config->misc.default_inputdevId = ico_uxf_getSysInputdevByName(
-                        g_key_file_get_string(keyfile, "default", "inputdev", &error));
-    _ico_sys_config->misc.default_inputswId = ico_uxf_getSysInputswByName(
-                        _ico_sys_config->misc.default_inputdevId,
-                        g_key_file_get_string(keyfile, "default", "inputsw", &error));
-    ico_uxf_conf_checkGerror(&error);
-
-    apfw_trace("Default host=%d kind=%d category=%d disp=%d layer=%d dispzone=%d "
-               "sound=%d soundzone=%d input=%d/%d",
-               _ico_sys_config->misc.default_hostId,
-               _ico_sys_config->misc.default_kindId,
-               _ico_sys_config->misc.default_categoryId,
-               _ico_sys_config->misc.default_displayId,
-               _ico_sys_config->misc.default_layerId,
-               _ico_sys_config->misc.default_dispzoneId,
-               _ico_sys_config->misc.default_soundId,
-               _ico_sys_config->misc.default_soundzoneId,
-               _ico_sys_config->misc.default_inputdevId,
-               _ico_sys_config->misc.default_inputswId);
-    g_key_file_free(keyfile);
-
-    apfw_trace("reloadSysConfig: Leave");
-    return _ico_sys_config;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysHostById: get host configuration by host Id
- *
- * @param[in]   hostId      host Id
- * @return      host configuration table
- * @retval      != NULL         success(host configuration table address)
- * @retval      == NULL         error(host Id dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API const Ico_Uxf_conf_host *
-ico_uxf_getSysHostById(const int hostId)
-{
-    int     i;
-
-    if (!_ico_sys_config) {
-        (void)ico_uxf_getSysConfig();
-    }
-
-    for (i = 0; i < _ico_sys_config->hostNum; i++) {
-        if (_ico_sys_config->host[i].id == hostId) {
-            return &_ico_sys_config->host[i];
-        }
-    }
-    apfw_warn("ico_uxf_getSysHostById(%d) Illegal Host Number", hostId);
-    return NULL;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_get_SysLocation: get host location by host Id
- *
- * @param[in]   hostId      host Id
- * @return      host location name
- * @retval      != NULL         success(host location name)
- * @retval      == NULL         error(host Id dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API const char *
-ico_uxf_get_SysLocation(const int hostId)
-{
-    int     i;
-
-    if (!_ico_sys_config) {
-        (void)ico_uxf_getSysConfig();
-    }
-
-    for (i = 0; i < _ico_sys_config->hostNum; i++) {
-        if (_ico_sys_config->host[i].id == hostId) {
-            return _ico_sys_config->host[i].address;
-        }
-    }
-    apfw_warn("Ico_uxf_get_SysLocation(%d) Illegal Host Number", hostId);
-    return "127.0.0.1";
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysDisplayById: get display configuration by display Id
- *
- * @param[in]   displayId       display Id
- * @return      display configuration table address
- * @retval      != NULL         success(host oy configuration tabel address)
- * @retval      == NULL         error(displayd dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API const Ico_Uxf_conf_display *
-ico_uxf_getSysDisplayById(const int displayId)
-{
-    int     i;
-
-    if (!_ico_sys_config) {
-        (void)ico_uxf_getSysConfig();
-    }
-
-    for (i = 0; i < _ico_sys_config->displayNum; i++)  {
-        if (_ico_sys_config->display[i].id == displayId)   {
-            return &_ico_sys_config->display[i];
-        }
-    }
-    apfw_warn("ico_uxf_getSysDisplayById(%d) Illegal Display Number", displayId);
-    return NULL;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysHostByName: get host Id bu host name
- *
- * @param[in]   shost       host name
- * @return      host Id number
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_getSysHostByName(const char *shost)
-{
-    int     i;
-
-    if (!_ico_sys_config) {
-        (void)ico_uxf_getSysConfig();
-    }
-    if (_ico_sys_config->hostNum <= 0)  {
-        apfw_critical("ico_uxf_getSysHostByName: can not read configuration file");
-        return _ico_sys_config->misc.default_hostId;
-    }
-
-    if ((! shost) || (*shost == 0))    {
-        return _ico_sys_config->host[0].id;
-    }
-
-    for (i = 0; i < _ico_sys_config->hostNum; i++) {
-        if (strcasecmp(shost, _ico_sys_config->host[i].name) == 0)    {
-            return _ico_sys_config->host[i].id;
-        }
-    }
-    apfw_warn("ico_uxf_getSysHostByName(%s) Illegal Host Name", shost);
-    return _ico_sys_config->misc.default_hostId;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysHostTypeByName: get host type number by name(internal function)
- *
- * @param[in]   stype       host type name
- * @return      host type number
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_uxf_getSysHostTypeByName(const char *stype)
-{
-    if ((! stype) || (*stype == 0))    {
-        return ICO_UXF_HOSTTYPE_CENTER;
-    }
-    if (strcasecmp(stype, "center") == 0)    {
-        return ICO_UXF_HOSTTYPE_CENTER;
-    }
-    else if (strcasecmp(stype, "meter") == 0)    {
-        return ICO_UXF_HOSTTYPE_METER;
-    }
-    else if (strcasecmp(stype, "remote") == 0)   {
-        return ICO_UXF_HOSTTYPE_REMOTE;
-    }
-    else if (strcasecmp(stype, "passenger") == 0)    {
-        return ICO_UXF_HOSTTYPE_PASSENGER;
-    }
-    else if (strcasecmp(stype, "rear") == 0) {
-        return ICO_UXF_HOSTTYPE_REAR;
-    }
-    else if (strcasecmp(stype, "rearleft") == 0) {
-        return ICO_UXF_HOSTTYPE_REARLEFT;
-    }
-    else if (strcasecmp(stype, "rearright") == 0)    {
-        return ICO_UXF_HOSTTYPE_REARRIGHT;
-    }
-    apfw_warn("ico_uxf_getSysHostTypeByName(%s) Illegal HostType Name", stype);
-    return strtol(stype, (char **)0, 0);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysDispTypeByName: get display type number by name(internal function)
- *
- * @param[in]   stype       display type name
- * @return      display type number
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_uxf_getSysDispTypeByName(const char *stype)
-{
-    if ((! stype) || (*stype == 0))    {
-        apfw_critical("ico_uxf_getSysDispTypeByName(NULL) Illegal HostType Name");
-        return 0;
-    }
-    if (strcasecmp(stype, "center") == 0)    {
-        return ICO_UXF_DISPLAYTYPE_CENTER;
-    }
-    else if (strcasecmp(stype, "meter") == 0)    {
-        return ICO_UXF_DISPLAYTYPE_METER;
-    }
-    else if (strcasecmp(stype, "remote") == 0)   {
-        return ICO_UXF_DISPLAYTYPE_REMOTE;
-    }
-    else if (strcasecmp(stype, "passenger") == 0)    {
-        return ICO_UXF_DISPLAYTYPE_PASSENGER;
-    }
-    else if (strcasecmp(stype, "rear") == 0) {
-        return ICO_UXF_DISPLAYTYPE_REAR;
-    }
-    else if (strcasecmp(stype, "rearleft") == 0) {
-        return ICO_UXF_DISPLAYTYPE_REARLEFT;
-    }
-    else if (strcasecmp(stype, "rearright") == 0)    {
-        return ICO_UXF_DISPLAYTYPE_REARRIGHT;
-    }
-    apfw_warn("ico_uxf_getSysDispTypeByName(%s) Illegal DisplayType Name", stype);
-    return strtol(stype, (char **)0, 0);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysBoolByName: get boolian value(internal function)
- *
- * @param[in]   sbool       boolian value string
- * @return      boolian value
- * @retval      = 0             false
- * @retval      = 1             true
- */
-/*--------------------------------------------------------------------------*/
-int
-ico_uxf_getSysBoolByName(const char *sbool)
-{
-    if ((! sbool) || (*sbool == 0))    {
-        return 0;
-    }
-    if ((strcasecmp(sbool, "true") == 0) ||
-        (strcasecmp(sbool, "yes") == 0) ||
-        (strcasecmp(sbool, "1") == 0))  {
-        return 1;
-    }
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysDisplayByName: get display Id by display name
- *
- * @param[in]   sdisplay        display name
- * @return      display Id
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_getSysDisplayByName(const char *sdisplay)
-{
-    int     i;
-
-    if (!_ico_sys_config) {
-        (void)ico_uxf_getSysConfig();
-    }
-    if ((! sdisplay) || (*sdisplay == 0))  {
-        apfw_trace("ico_uxf_getSysDisplayByName(NULL) Illegal Display Name");
-        return _ico_sys_config->misc.default_displayId;
-    }
-
-    for (i = 0; i < _ico_sys_config->displayNum; i++) {
-        if (strcasecmp(sdisplay, _ico_sys_config->display[i].name) == 0)    {
-            return _ico_sys_config->display[i].id;
-        }
-    }
-    apfw_warn("ico_uxf_getSysDisplayByName(%s) Illegal Display Name", sdisplay);
-    return _ico_sys_config->misc.default_displayId;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysLayerByName: get layer Id by layer name
- *
- * @param[in]   display     display Id
- * @param[in]   slayer      layer name
- * @return      layer Id
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_getSysLayerByName(const int display, const char *slayer)
-{
-    int     i;
-    char    *errp;
-
-    if (!_ico_sys_config) {
-        (void)ico_uxf_getSysConfig();
-    }
-
-    if ((display < 0) || (display >= _ico_sys_config->displayNum)) {
-        apfw_warn("ico_uxf_getSysLayerByName(%d,%s) Illegal Display Number",
-                            display, slayer);
-        return _ico_sys_config->misc.default_layerId;
-    }
-    if ((! slayer) || (*slayer == 0))  {
-        apfw_trace("ico_uxf_getSysLayerByName(NULL) Illegal Layer Name");
-        return _ico_sys_config->misc.default_layerId;
-    }
-
-    for (i = 0; i < _ico_sys_config->display[display].layerNum; i++)    {
-        if (strcasecmp(slayer, _ico_sys_config->display[display].layer[i].name) == 0)   {
-            return _ico_sys_config->display[display].layer[i].id;
-        }
-    }
-
-    errp = NULL;
-    i = strtol(slayer, &errp, 0);
-    if ((errp) && (*errp != 0)) {
-        apfw_warn("ico_uxf_getSysLayerByName(%d,%s) Illegal Layer Name", display, slayer);
-        i = _ico_sys_config->misc.default_layerId;
-    }
-    return i;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysKindByName: get kind Id by kind name
- *
- * @param[in]   skind       kind name
- * @return      kind Id
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_getSysKindByName(const char *skind)
-{
-    int     i;
-
-    if (!_ico_sys_config) {
-        (void)ico_uxf_getSysConfig();
-    }
-    if (_ico_sys_config->kindNum <= 0)  {
-        apfw_critical("ico_uxf_getSysKindByName: can not read configuration file");
-        return _ico_sys_config->misc.default_kindId;
-    }
-
-    if ((skind) && (*skind != 0))  {
-        for (i = 0; i < _ico_sys_config->kindNum; i++) {
-            if (strcasecmp(skind, _ico_sys_config->kind[i].name) == 0)    {
-                return _ico_sys_config->kind[i].id;
-            }
-        }
-    }
-    apfw_warn("ico_uxf_getSysKindByName(%s) Illegal kind name", skind);
-    return _ico_sys_config->misc.default_kindId;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysCategoryByName: get category Id by category name
- *
- * @param[in]   scategory   category name
- * @return      category Id
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_getSysCategoryByName(const char *scategory)
-{
-    int     i;
-
-    if (!_ico_sys_config) {
-        (void)ico_uxf_getSysConfig();
-    }
-    if (_ico_sys_config->categoryNum <= 0)  {
-        apfw_critical("ico_uxf_getSysCategoryByName: can not read configuration file");
-        return _ico_sys_config->misc.default_categoryId;
-    }
-
-    if ((scategory) && (*scategory != 0))  {
-        for (i = 0; i < _ico_sys_config->categoryNum; i++) {
-            if (strcasecmp(scategory, _ico_sys_config->category[i].name) == 0)    {
-                return _ico_sys_config->category[i].id;
-            }
-        }
-    }
-    apfw_warn("ico_uxf_getSysCategoryByName(%s) Illegal category name", scategory);
-    return _ico_sys_config->misc.default_categoryId;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysDispZoneByName: get display zone Id by display zone name
- *
- * @param[in]   display     display Id
- * @param[in]   sdispzone   displahy zone name
- * @return      display zone Id
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_getSysDispZoneByName(const int display, const char *sdispzone)
-{
-    int     i;
-
-    if (!_ico_sys_config) {
-        (void)ico_uxf_getSysConfig();
-    }
-    if ((display < 0) || (display >= _ico_sys_config->displayNum) ||
-        (_ico_sys_config->display[display].zoneNum <= 0))   {
-        apfw_critical("ico_uxf_getSysDispZoneByName: can not read configuration file");
-        return _ico_sys_config->misc.default_dispzoneId;
-    }
-
-    if ((sdispzone) && (*sdispzone != 0))  {
-        for (i = 0; i < _ico_sys_config->display[display].zoneNum; i++) {
-            if (strcasecmp(sdispzone, _ico_sys_config->display[display].zone[i].name) == 0) {
-                return _ico_sys_config->display[display].zone[i].id;
-            }
-        }
-    }
-    apfw_warn("ico_uxf_getSysDispZoneByName(%s) Illegal zone name", sdispzone);
-    return _ico_sys_config->misc.default_dispzoneId;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysSoundByName: get sound Id by sound name
- *
- * @param[in]   ssound      sound name
- * @return      sound Id
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_getSysSoundByName(const char *ssound)
-{
-    int     i;
-
-    if (!_ico_sys_config) {
-        (void)ico_uxf_getSysConfig();
-    }
-    if (_ico_sys_config->soundNum <= 0) {
-        apfw_critical("ico_uxf_getSysSoundByName: can not read configuration file");
-        return _ico_sys_config->misc.default_soundId;
-    }
-
-    if ((ssound) && (*ssound != 0))    {
-        for (i = 0; i < _ico_sys_config->soundNum; i++) {
-            if (strcasecmp(ssound, _ico_sys_config->sound[i].name) == 0)    {
-                return _ico_sys_config->sound[i].id;
-            }
-        }
-    }
-    apfw_warn("ico_uxf_getSysSoundByName(%s) Illegal sound name", ssound);
-    return _ico_sys_config->misc.default_soundId;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysSoundZoneByName: get sound zone Id by sound zone name
- *
- * @param[in]   sound       sound Id
- * @param[in]   ssoundzone  sound zone name
- * @return      sound zone Id
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_getSysSoundZoneByName(const int sound, const char *ssoundzone)
-{
-    int     i;
-
-    if (!_ico_sys_config) {
-        (void)ico_uxf_getSysConfig();
-    }
-    if ((sound < 0) || (sound >= _ico_sys_config->soundNum) ||
-        (_ico_sys_config->sound[sound].zoneNum <= 0))   {
-        apfw_critical("ico_uxf_getSysSoundZoneByName: can not read configuration file");
-        return _ico_sys_config->misc.default_soundzoneId;
-    }
-
-    if ((ssoundzone) && (*ssoundzone != 0))    {
-        for (i = 0; i < _ico_sys_config->sound[sound].zoneNum; i++) {
-            if (strcasecmp(ssoundzone, _ico_sys_config->sound[sound].zone[i].name) == 0)    {
-                return _ico_sys_config->sound[sound].zone[i].id;
-            }
-        }
-    }
-    apfw_warn("ico_uxf_getSysSoundZoneByName(%s) Illegal zone name", ssoundzone);
-    return _ico_sys_config->misc.default_soundzoneId;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysInputdevByName: get input device Id by input device name
- *
- * @param[in]   sinputdev   input device name
- * @return      input device Id
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_getSysInputdevByName(const char *sinputdev)
-{
-    int     i;
-
-    if (!_ico_sys_config) {
-        (void)ico_uxf_getSysConfig();
-    }
-    if (_ico_sys_config->inputdevNum <= 0)  {
-        apfw_critical("ico_uxf_getSysInputdevByName: can not read configuration file");
-        return _ico_sys_config->misc.default_inputdevId;
-    }
-
-    if ((! sinputdev) || (*sinputdev == 0))    {
-        return _ico_sys_config->misc.default_inputdevId;
-    }
-
-    for (i = 0; i < _ico_sys_config->inputdevNum; i++) {
-        if (strcasecmp(sinputdev, _ico_sys_config->inputdev[i].name) == 0)    {
-            return _ico_sys_config->inputdev[i].id;
-        }
-    }
-    apfw_warn("ico_uxf_getSysInputdevByName(%s) Illegal device Name", sinputdev);
-    return _ico_sys_config->misc.default_inputdevId;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getSysInputswByName: get input switch Id by input switch name
- *
- * @param[in]   inputdev    input device Id
- * @param[in]   sinputsw    input switch name
- * @return      input switch Id
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_getSysInputswByName(const int inputdev, const char *sinputsw)
-{
-    int     i;
-
-    if (!_ico_sys_config) {
-        (void)ico_uxf_getSysConfig();
-    }
-    if ((inputdev < 0) || (inputdev >= _ico_sys_config->inputdevNum) ||
-        (_ico_sys_config->inputdev[inputdev].inputswNum <= 0))  {
-        apfw_critical("ico_uxf_getSysInputswByName: can not read configuration file");
-        return 0;
-    }
-
-    if ((sinputsw) && (*sinputsw != 0)) {
-        for (i = 0; i < _ico_sys_config->inputdev[inputdev].inputswNum; i++)    {
-            if (strcasecmp(sinputsw, _ico_sys_config->inputdev[inputdev].inputsw[i].name)
-                    == 0)    {
-                return i;
-            }
-        }
-    }
-    apfw_warn("ico_uxf_getSysInputswByName(%s) Illegal sw name",
-              sinputsw ? sinputsw : "(NULL)");
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_closeSysConfig: close and release system configuration table
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_uxf_closeSysConfig(void)
-{
-    if (_ico_sys_config != NULL)    {
-        g_free(_ico_sys_config->host);
-        g_free(_ico_sys_config->display);
-        g_free(_ico_sys_config);
-        _ico_sys_config = NULL;
-    }
-}
-
diff --git a/ico-app-framework/ico_uxf_init.c b/ico-app-framework/ico_uxf_init.c
deleted file mode 100644 (file)
index 3b2fc10..0000000
+++ /dev/null
@@ -1,2331 +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   user experiance library(initialize/terminate/event)
- *
- * @date    Feb-28-2013
- */
-
-#include    <stdio.h>
-#include    <stdlib.h>
-#include    <unistd.h>
-#include    <string.h>
-#include    <errno.h>
-#include    <pthread.h>
-#include    <sys/ioctl.h>
-#include    <sys/time.h>
-#include    <fcntl.h>
-
-#include    "wayland-client.h"
-#include    "ico_window_mgr-client-protocol.h"
-#include    "ico_uxf.h"
-#include    "ico_uxf_conf.h"
-#include    "ico_uxf_private.h"
-
-/* static functions             */
-/* wayland standard callback functions      */
-static void ico_uxf_wayland_globalcb(void *data, struct wl_registry *registry,
-                                     uint32_t name, const char *interface,
-                                     uint32_t version);
-static void ico_uxf_output_geometrycb(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);
-static void ico_uxf_output_modecb(void *data, struct wl_output *wl_output,
-                                  uint32_t flags, int32_t width, int32_t height,
-                                  int32_t refresh);
-static void ico_uxf_create_window(uint32_t surfaceid, const char *appid, uint32_t node,
-                                  uint32_t layer, int32_t x, int32_t y,
-                                  int32_t width, int32_t height);
-
-/* ico_window_mgr(Multi Window Manager) callback functions  */
-struct ico_window;
-static void ico_uxf_window_createdcb(void *data, struct ico_window_mgr *ico_window_mgr,
-                                     uint32_t surfaceid, const char *winname, int32_t pid,
-                                     const char *appid);
-static void ico_uxf_window_namecb(void *data, struct ico_window_mgr *ico_window_mgr,
-                                  uint32_t surfaceid, const char *winname);
-static void ico_uxf_window_destroyedcb(void *data, struct ico_window_mgr *ico_window_mgr,
-                                       uint32_t surfaceid);
-static void ico_uxf_window_visiblecb(void *data, struct ico_window_mgr *ico_window_mgr,
-                                     uint32_t surfaceid, int32_t visible, int32_t raise,
-                                     int32_t hint);
-static void ico_uxf_window_configurecb(void *data, struct ico_window_mgr *ico_window_mgr,
-                                       uint32_t surfaceid, uint32_t node,
-                                       uint32_t layer, int32_t x, int32_t y,
-                                       int32_t width, int32_t height, int32_t hint);
-static void ico_uxf_window_activecb(void *data, struct ico_window_mgr *ico_window_mgr,
-                                    uint32_t surfaceid, int32_t active);
-static void ico_uxf_window_layer_visiblecb(void *data, struct ico_window_mgr *ico_window_mgr,
-                                           uint32_t layer, int32_t visible);
-static void ico_uxf_window_surfacecb(void *data, struct ico_window_mgr *ico_window_mgr,
-                                     const char *appid, struct wl_array *surfaces);
-static void ico_uxf_window_mapcb(void *data, struct ico_window_mgr *ico_window_mgr,
-                                 int32_t event, uint32_t surfaceid, int32_t width,
-                                 int32_t height, int32_t stride, int32_t format);
-
-/* ico_input_mgr(Multi Input Manager) callback functions    */
-static void ico_uxf_input_capabilitiescb(void *data, struct ico_exinput *ico_exinput,
-                                         const char *device, int32_t type,
-                                         const char *swname, int32_t input,
-                                         const char *codename, int32_t code);
-static void ico_uxf_input_codecb(void *data, struct ico_exinput *ico_exinput,
-                                 const char *device, int32_t input, const char *codename,
-                                 int32_t code);
-static void ico_uxf_input_inputcb(void *data, struct ico_exinput *ico_exinput,
-                                  uint32_t time, const char *device, int32_t input,
-                                  int32_t code, int32_t state);
-
-/* AppCore(AUL) callback function   */
-static int ico_uxf_aul_aulcb(int pid, void *data);
-
-/* Variables & Tables               */
-Ico_Uxf_Api_Mng         gIco_Uxf_Api_Mng = { 0 };
-
-static pthread_mutex_t  sMutex;
-
-/* Wayland Registry Listener */
-static const struct wl_registry_listener ico_uxf_registry_listener = {
-    ico_uxf_wayland_globalcb
-};
-
-/* Window Manger Interface */
-static const struct ico_window_mgr_listener     windowlistener = {
-    ico_uxf_window_createdcb,
-    ico_uxf_window_namecb,
-    ico_uxf_window_destroyedcb,
-    ico_uxf_window_visiblecb,
-    ico_uxf_window_configurecb,
-    ico_uxf_window_activecb,
-    ico_uxf_window_layer_visiblecb,
-    ico_uxf_window_surfacecb,
-    ico_uxf_window_mapcb
-};
-
-/* Input Manger Interface */
-static const struct ico_exinput_listener      exinputlistener = {
-    ico_uxf_input_capabilitiescb,
-    ico_uxf_input_codecb,
-    ico_uxf_input_inputcb
-};
-
-/* Wayland Output interface */
-static const struct wl_output_listener outputlistener = {
-    ico_uxf_output_geometrycb,
-    ico_uxf_output_modecb
-};
-
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_init: initialize user interface library hor HomeScreen
- *
- * @param[in]   name            application id
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_EBUSY   error(cullentry terminating)
- * @retval      ICO_UXF_ESRCH   error(configuration error)
- * @retval      ICO_UXF_ENOSYS  error(system error)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_init(const char *name)
-{
-    Ico_Uxf_Mng_Display *dsp;
-    Ico_Uxf_Mng_Layer   *lay;
-    Ico_Uxf_Mng_Process *prc;
-    pthread_mutexattr_t sMutexAttr;
-    Ico_Uxf_Sys_Config *sysconf;
-    Ico_Uxf_App_Config *appconf;
-    Ico_Uxf_conf_appdisplay *appdsp;
-    Ico_Uxf_Mng_Callback    *freecb;
-    Ico_Uxf_Mng_EventQue    *freeeq;
-    int         dn, tn;
-    int         ret;
-
-    ico_uxf_log_open(name);
-
-    if (gIco_Uxf_Api_Mng.Initialized)  {
-        if (gIco_Uxf_Api_Mng.Initialized < 0)  {
-            uifw_trace("ico_uxf_init: Enter");
-            uifw_warn("ico_uxf_init: Leave(EBUSY)");
-            return ICO_UXF_EBUSY;
-        }
-        uifw_trace("ico_uxf_init: Enter");
-        uifw_trace("ico_uxf_init: Leave(EOK)");
-        return ICO_UXF_EOK;
-    }
-    uifw_trace("ico_uxf_init: Enter");
-
-    gIco_Uxf_Api_Mng.Initialized = -1;
-    memset(gIco_Uxf_Api_Mng.MyProcess, 0, ICO_UXF_MAX_PROCESS_NAME + 1);
-    strncpy(gIco_Uxf_Api_Mng.MyProcess, name, ICO_UXF_MAX_PROCESS_NAME);
-    gIco_Uxf_Api_Mng.EventMask = 0;
-    gIco_Uxf_Api_Mng.WaylandFd = -1;
-    gIco_Uxf_Api_Mng.Wayland_Display = NULL;
-    gIco_Uxf_Api_Mng.InitTimer = ICO_UXF_SUSP_INITTIME;
-    gIco_Uxf_Api_Mng.Win_Show_Anima = 1;
-    gIco_Uxf_Api_Mng.Win_Hide_Anima = 1;
-
-    /* read configurations */
-    sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
-    appconf = (Ico_Uxf_App_Config *)ico_uxf_getAppConfig();
-    if ((sysconf == NULL) || (appconf == NULL)) {
-        uifw_error("ico_uxf_init: Leave(ESRCH), Configuration Read Error");
-        return ICO_UXF_ESRCH;
-    }
-
-    uifw_trace("ico_uxf_init: set display configurations");
-    /* set display configurations */
-    for (dn = 0; dn < sysconf->displayNum; dn++) {
-        dsp = ico_uxf_mng_display(sysconf->display[dn].id, 1);
-        dsp->attr.type = sysconf->display[dn].type;
-        dsp->attr.num_layers = sysconf->display[dn].layerNum;
-        dsp->attr.hostId = sysconf->display[dn].hostId;
-        dsp->attr.displayNo = sysconf->display[dn].displayno;
-        dsp->attr.w = sysconf->display[dn].width;
-        dsp->attr.h = sysconf->display[dn].height;
-        dsp->attr.pWidth = -1;
-        dsp->attr.pHeight = -1;
-        dsp->attr.orientation = ICO_UXF_ORIENTATION_HORIZONTAL;
-        dsp->attr.inch = sysconf->display[dn].inch;
-        strncpy(dsp->attr.name, sysconf->display[dn].name, ICO_UXF_MAX_WIN_NAME);
-        dsp->attr.name[ICO_UXF_MAX_WIN_NAME] = 0;
-
-        for (tn = 0; tn < sysconf->display[dn].layerNum; tn++) {
-            lay = ico_uxf_mng_layer(sysconf->display[dn].id,
-                                    sysconf->display[dn].layer[tn].id, 1);
-            lay->attr.display = sysconf->display[dn].id;
-            lay->attr.w = sysconf->display[dn].width;
-            lay->attr.h = sysconf->display[dn].height;
-            lay->attr.menuoverlap = sysconf->display[dn].layer[tn].menuoverlap;
-            lay->mng_display = dsp;
-        }
-    }
-
-    uifw_trace("ico_uxf_init: set application configurations(num=%d)",
-               appconf->applicationNum);
-    /* set application configurations */
-    for(dn = 0; dn < appconf->applicationNum; dn++)  {
-        prc = ico_uxf_mng_process(appconf->application[dn].appid, 1);
-        prc->attr.internalid = 0;
-        prc->appconf = (void *)&appconf->application[dn];
-        prc->attr.status = ICO_UXF_PROCSTATUS_STOP;
-        prc->attr.type = appconf->application[dn].categoryId;
-        prc->attr.hostId = appconf->application[dn].hostId;
-        prc->attr.myHost = (prc->attr.hostId == sysconf->misc.myhostId) ? 1 : 0;
-        prc->attr.noicon = appconf->application[dn].noicon;
-        prc->attr.autostart = appconf->application[dn].autostart;
-        prc->attr.invisiblecpu = appconf->application[dn].invisiblecpu;
-
-        appdsp = &appconf->application[dn].display[0];
-        prc->attr.mainwin.window = 0;
-        prc->attr.mainwin.windowtype = appconf->application[dn].categoryId;
-        prc->attr.mainwin.display = appdsp->displayId;
-        prc->attr.mainwin.layer = appdsp->layerId;
-        prc->attr.mainwin.x =
-                sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
-        prc->attr.mainwin.y =
-                sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
-        prc->attr.mainwin.w =
-                sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
-        prc->attr.mainwin.h =
-                sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
-        prc->attr.mainwin.name[ICO_UXF_MAX_WIN_NAME] = 0;
-        prc->attr.numwindows = appconf->application[dn].displayzoneNum;
-        /* get sub windows                          */
-        if (prc->attr.numwindows > 1)   {
-            prc->attr.subwin = malloc(sizeof(Ico_Uxf_ProcessWin) *
-                                      (prc->attr.numwindows - 1));
-            if (! prc->attr.subwin) {
-                uifw_error("ico_uxf_init: No Memory");
-                appconf->application[dn].displayzoneNum = 1;
-                prc->attr.numwindows = 1;
-            }
-            else    {
-                memset(prc->attr.subwin, 0, (prc->attr.numwindows - 1));
-                for (tn = 0; tn < (prc->attr.numwindows - 1); tn++) {
-                    appdsp ++;
-                    prc->attr.subwin[tn].windowtype = prc->attr.mainwin.windowtype;
-                    prc->attr.subwin[tn].display = appdsp->displayId;
-                    prc->attr.subwin[tn].layer = appdsp->layerId;
-                    prc->attr.subwin[tn].x =
-                        sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
-                    prc->attr.subwin[tn].y =
-                        sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
-                    prc->attr.subwin[tn].w =
-                        sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
-                    prc->attr.subwin[tn].h =
-                        sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
-                }
-            }
-        }
-    }
-
-    gIco_Uxf_Api_Mng.Mng_MyProcess
-        = ico_uxf_mng_process(gIco_Uxf_Api_Mng.MyProcess, 0);
-    if (!gIco_Uxf_Api_Mng.Mng_MyProcess) {
-        uifw_error("ico_uxf_init: Leave(ESRCH), Unknown Apprication(%s)",
-                   gIco_Uxf_Api_Mng.MyProcess);
-        return ICO_UXF_ESRCH;
-    }
-    gIco_Uxf_Api_Mng.Mng_MyProcess->attr.internalid = getpid();
-    gIco_Uxf_Api_Mng.Mng_MyProcess->attr.status = ICO_UXF_PROCSTATUS_RUN;
-
-    dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
-
-    uifw_trace("ico_uxf_init: App.%s MainDisplay.%d %08x",
-               gIco_Uxf_Api_Mng.Mng_MyProcess->attr.process,
-               gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, dsp);
-
-    for (ret = 0; ret < (2000/50); ret++)  {
-        gIco_Uxf_Api_Mng.Wayland_Display = wl_display_connect(NULL);
-        if (gIco_Uxf_Api_Mng.Wayland_Display)  break;
-        usleep(50*1000);
-    }
-    if (! gIco_Uxf_Api_Mng.Wayland_Display) {
-        uifw_error("ico_uxf_init:Can not connect to wayland, Abort!!");
-        fprintf(stderr, "ico_uxf_init:Can not connect to wayland, Abort!!\n");
-        exit(1);
-    }
-
-    gIco_Uxf_Api_Mng.Wayland_Registry
-        = wl_display_get_registry(gIco_Uxf_Api_Mng.Wayland_Display);
-    wl_registry_add_listener(gIco_Uxf_Api_Mng.Wayland_Registry,
-                             &ico_uxf_registry_listener, (void *)0);
-
-    for (ret = 0; ret < (500/20); ret++) {
-        if ((gIco_Uxf_Api_Mng.Wayland_WindowMgr != NULL) &&
-            (gIco_Uxf_Api_Mng.Wayland_exInput != NULL) &&
-            (gIco_Uxf_Api_Mng.Wayland_InputMgr != NULL))    break;
-        uifw_trace("ico_uxf_init: call wl_display_dispatch(%08x)",
-                   (int)gIco_Uxf_Api_Mng.Wayland_Display);
-        wl_display_dispatch(gIco_Uxf_Api_Mng.Wayland_Display);
-        usleep(20*1000);
-    }
-    wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-    uifw_trace("ico_uxf_init: Wayland/Weston connect OK");
-
-    gIco_Uxf_Api_Mng.WaylandFd
-        = wl_display_get_fd(gIco_Uxf_Api_Mng.Wayland_Display);
-
-    /* initialize mutex */
-    (void) pthread_mutexattr_init(&sMutexAttr);
-    if (pthread_mutex_init(&sMutex, &sMutexAttr) != 0) {
-        uifw_error("ico_uxf_init: Leave(ENOSYS), Mutex Create Error %d", errno);
-        wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-        gIco_Uxf_Api_Mng.Wayland_Display = NULL;
-        gIco_Uxf_Api_Mng.Initialized = 0;
-        return ICO_UXF_ENOSYS;
-    }
-
-    /* allocate free control blocks         */
-    freecb = ico_uxf_alloc_callback();
-    ico_uxf_free_callback(freecb);
-    freeeq = ico_uxf_alloc_eventque();
-    ico_uxf_free_eventque(freeeq);
-
-    /* flush wayland connection             */
-    ico_window_mgr_declare_manager(gIco_Uxf_Api_Mng.Wayland_WindowMgr, 1);
-    wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-
-    /* application launch/dead callback from AppCore(aul)   */
-    aul_listen_app_launch_signal(ico_uxf_aul_aulcb, (void *)0);
-    aul_listen_app_dead_signal(ico_uxf_aul_aulcb, (void *)1);
-
-    gIco_Uxf_Api_Mng.Initialized = 1;
-
-    uifw_trace("ico_uxf_init: Leave(EOK)");
-    uifw_logflush();
-
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_wl_display_fd: get wayland file discriptor
- *
- * @param       none
- * @return      wayland connect socket file descriptor
- * @retval      >=0         success(file descriptor)
- * @retval      < 0         error(wayland not connect)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_wl_display_fd(void)
-{
-    uifw_trace("ico_uxf_wl_display_fd: fd=%d", gIco_Uxf_Api_Mng.WaylandFd);
-
-    return gIco_Uxf_Api_Mng.WaylandFd;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_shutdown: terminate user interface library hor HomeScreen
- *
- * @param       none
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_EBUSY   error(cullentry terminating)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_shutdown(void)
-{
-    uifw_trace("ico_uxf_shutdown: Enter");
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        if (gIco_Uxf_Api_Mng.Initialized < 0)  {
-            uifw_warn("ico_uxf_shutdown: Leave(EBUSY)");
-            return ICO_UXF_EBUSY;
-        }
-        uifw_trace("ico_uxf_shutdown: Leave(EOK)");
-        return ICO_UXF_EOK;
-    }
-    gIco_Uxf_Api_Mng.Initialized = -1;
-    gIco_Uxf_Api_Mng.LastEvent = 0;
-
-    (void) pthread_mutex_destroy(&sMutex);
-
-    if (gIco_Uxf_Api_Mng.Wayland_Seat) {
-        wl_seat_destroy(gIco_Uxf_Api_Mng.Wayland_Seat);
-        gIco_Uxf_Api_Mng.Wayland_Seat = NULL;
-    }
-    if (gIco_Uxf_Api_Mng.Wayland_exInput) {
-        ico_exinput_destroy(gIco_Uxf_Api_Mng.Wayland_exInput);
-        gIco_Uxf_Api_Mng.Wayland_exInput = NULL;
-    }
-    if (gIco_Uxf_Api_Mng.Wayland_InputMgr) {
-        ico_input_mgr_control_destroy(gIco_Uxf_Api_Mng.Wayland_InputMgr);
-        gIco_Uxf_Api_Mng.Wayland_InputMgr = NULL;
-    }
-    if (gIco_Uxf_Api_Mng.Wayland_Compositor)   {
-        wl_compositor_destroy(gIco_Uxf_Api_Mng.Wayland_Compositor);
-        gIco_Uxf_Api_Mng.Wayland_Compositor = NULL;
-    }
-    if (gIco_Uxf_Api_Mng.Wayland_Display)  {
-        wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-        wl_display_disconnect(gIco_Uxf_Api_Mng.Wayland_Display);
-        gIco_Uxf_Api_Mng.Wayland_Display = NULL;
-    }
-
-    gIco_Uxf_Api_Mng.Initialized = 0;
-
-    uifw_trace("ico_uxf_shutdown: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_main_loop_iterate: process user interface library events
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_uxf_main_loop_iterate(void)
-{
-    int                     arg;
-    Ico_Uxf_Mng_EventQue    *wkque;
-    Ico_Uxf_Mng_Callback    *callback;
-    Ico_Uxf_Event_Cb        func;
-
-    wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-
-    arg = 0;
-    if (ioctl(gIco_Uxf_Api_Mng.WaylandFd, FIONREAD, &arg) < 0)   {
-        uifw_warn("ico_uxf_main_loop_iterate: ioclt(FIONREAD,) Error %d", errno);
-        arg = 0;
-    }
-
-    if (arg > 0)   {
-        wl_display_dispatch(gIco_Uxf_Api_Mng.Wayland_Display);
-    }
-
-    ico_uxf_enter_critical();
-
-    /* notify event */
-    while (gIco_Uxf_Api_Mng.EventQue) {
-
-        wkque = gIco_Uxf_Api_Mng.EventQue;
-        gIco_Uxf_Api_Mng.EventQue = gIco_Uxf_Api_Mng.EventQue->next;
-
-        gIco_Uxf_Api_Mng.LastEvent = wkque->detail.event;
-        callback = gIco_Uxf_Api_Mng.Callback;
-        while (callback) {
-            if (callback->eventmask & gIco_Uxf_Api_Mng.LastEvent) {
-                func = callback->func;
-                arg = callback->arg;
-                ico_uxf_leave_critical();
-
-                uifw_trace("ico_uxf_main_loop: Call Event Callback(%08x,,%08x)",
-                           gIco_Uxf_Api_Mng.LastEvent, arg);
-                (*func)(gIco_Uxf_Api_Mng.LastEvent, wkque->detail, arg);
-
-                ico_uxf_enter_critical();
-            }
-            callback = callback->next;
-        }
-        ico_uxf_free_eventque(wkque);
-    }
-
-    ico_uxf_leave_critical();
-
-    wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_callback_set: set event calback function
- *
- * @param[in]   mask            event mask
- * @param[in]   func            callback function
- * @param[in]   arg             user argument
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ESRCH   error(user interface library not initialized)
- * @retval      ICO_UXF_EINVAL  error(illegal event mask)
- * @retval      ICO_UXF_EBUSY   error(already set same event)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_callback_set(const unsigned int mask, Ico_Uxf_Event_Cb func, const int arg)
-{
-    Ico_Uxf_Mng_Callback    *callback;
-    unsigned int            wkmask;
-
-    uifw_trace("ico_uxf_callback_set: Enter(%08x,%08x,%08x)", mask, (int)func, arg);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_callback_set: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    if (mask)  {
-        wkmask = mask;
-    }
-    else    {
-        wkmask = ICO_UXF_EVENT_ALL;
-    }
-    if ((wkmask & ICO_UXF_EVENT_VALIDALL) == 0) {
-        uifw_warn("ico_uxf_callback_set: Leave(EINVAL)");
-        return ICO_UXF_EINVAL;
-    }
-
-    ico_uxf_enter_critical();
-
-    callback = gIco_Uxf_Api_Mng.Callback;
-    while (callback)   {
-        if ((callback->eventmask == wkmask) && (callback->func == func) &&
-            (callback->arg == arg))    {
-
-            ico_uxf_leave_critical();
-            uifw_warn("ico_uxf_callback_set: Leave(EBUSY)");
-            return ICO_UXF_EBUSY;
-        }
-    }
-
-    callback = ico_uxf_alloc_callback();
-
-    callback->eventmask = wkmask;
-    callback->func = func;
-    callback->arg = arg;
-
-    ico_uxf_regist_callback(callback);
-
-    gIco_Uxf_Api_Mng.EventMask |= wkmask;
-
-    ico_uxf_leave_critical();
-
-    uifw_trace("ico_uxf_callback_set: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_callback_remove: remove event calback function
- *
- * @param[in]   mask            event mask
- * @param[in]   func            callback function
- * @param[in]   arg             user argument
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ESRCH   error(user interface library not initialized)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_callback_remove(const unsigned int mask, Ico_Uxf_Event_Cb func, const int arg)
-{
-    Ico_Uxf_Mng_Callback    *callback;
-    unsigned int            wkmask;
-
-    uifw_trace("ico_uxf_callback_remove: Enter(%08x,%08x,%08x)", mask, (int)func, arg);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_callback_remove: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    if (mask)  {
-        wkmask = mask;
-    }
-    else    {
-        wkmask = ICO_UXF_EVENT_ALL;
-    }
-
-    ico_uxf_enter_critical();
-
-    gIco_Uxf_Api_Mng.EventMask = 0;
-
-    callback = gIco_Uxf_Api_Mng.Callback;
-
-    while (callback)   {
-        if ((callback->eventmask == wkmask) && (callback->func == func) &&
-            (callback->arg == arg))    {
-            ico_uxf_remove_callback(callback);
-        }
-        else    {
-            gIco_Uxf_Api_Mng.EventMask |= callback->eventmask;
-        }
-        callback = callback->next;
-    }
-
-    ico_uxf_leave_critical();
-
-    uifw_trace("ico_uxf_callback_remove: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_free_procwin: free active window management table(internal function)
- *
- * @param[in]   prc             application management table address
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-ico_uxf_free_procwin(Ico_Uxf_Mng_Process *prc)
-{
-    Ico_Uxf_Mng_Window  *p;
-    Ico_Uxf_Mng_Window  *pp;
-    Ico_Uxf_Mng_Window  *freep;
-    int                 hash;
-
-    uifw_trace("ico_uxf_free_procwin: Enter(%d)", prc->attr.process);
-
-    for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++)   {
-        p = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
-        pp = (Ico_Uxf_Mng_Window *)0;
-        while (p)  {
-            if (p->attr.process == prc->attr.process)  {
-                freep = p;
-                p = p->nextidhash;
-                if (! pp)  {
-                    gIco_Uxf_Api_Mng.Hash_WindowId[hash] = p;
-                }
-                else    {
-                    pp->nextidhash = p;
-                }
-                uifw_trace("ico_uxf_free_procwin: Free Window(%08x)", freep->attr.window);
-                free(freep);
-            }
-            else    {
-                pp = p;
-                p = p->nextidhash;
-            }
-        }
-    }
-    uifw_trace("ico_uxf_free_procwin: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_wayland_globalcb: wayland global callback(static function)
- *
- * @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
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_wayland_globalcb(void *data, struct wl_registry *registry,
-                         uint32_t name, const char *interface, uint32_t version)
-{
-    uifw_trace("ico_uxf_wayland_globalcb: Enter(Event=%s DispId=%08x)", interface, name);
-
-    if (strcmp(interface, "ico_window_mgr") == 0)    {
-        gIco_Uxf_Api_Mng.Wayland_WindowMgr = (struct ico_window_mgr *)
-                wl_registry_bind(registry, name, &ico_window_mgr_interface, 1);
-        ico_window_mgr_add_listener(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
-                                    &windowlistener, NULL);
-    }
-    else if (strcmp(interface, "ico_exinput") == 0) {
-        /* regist exinput */
-        gIco_Uxf_Api_Mng.Wayland_exInput = (struct ico_exinput *)
-                wl_registry_bind(registry, name, &ico_exinput_interface, 1);
-        ico_exinput_add_listener(gIco_Uxf_Api_Mng.Wayland_exInput, &exinputlistener, NULL);
-    }
-    else if (strcmp(interface, "ico_input_mgr_control") == 0) {
-        /* regist Multi Input Manager interface */
-        gIco_Uxf_Api_Mng.Wayland_InputMgr = (struct ico_input_mgr_control *)
-                wl_registry_bind(registry, name, &ico_input_mgr_control_interface, 1);
-    }
-    else if (strcmp(interface, "wl_output") == 0) {
-        /* regist wl_output listener to get display info */
-        gIco_Uxf_Api_Mng.Wayland_Output = (struct wl_output *)
-                wl_registry_bind(registry, name, &wl_output_interface, 1);
-        wl_output_add_listener(gIco_Uxf_Api_Mng.Wayland_Output, &outputlistener, NULL);
-    }
-    wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-    uifw_trace("ico_uxf_wayland_globalcb: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_output_geometrycb: wayland display attribute callback(static function)
- *
- * @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
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_output_geometrycb(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_Uxf_Mng_Display *dsp;
-
-    uifw_trace("ico_uxf_output_geometrycb: Enter(x/y=%d/%d, pwidth/height=%d/%d, trans=%d)",
-               x, y, physical_width, physical_height, transform);
-
-    dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
-
-    if (dsp) {
-        if ((transform == WL_OUTPUT_TRANSFORM_90)
-            || (transform == WL_OUTPUT_TRANSFORM_270)
-            || (transform == WL_OUTPUT_TRANSFORM_FLIPPED_90)
-            || (transform == WL_OUTPUT_TRANSFORM_FLIPPED_270))  {
-            dsp->attr.pWidth = physical_height;
-            dsp->attr.pHeight = physical_width;
-            dsp->attr.orientation = ICO_UXF_ORIENTATION_VERTICAL;
-        }
-        else {
-            dsp->attr.pWidth = physical_width;
-            dsp->attr.pHeight = physical_height;
-            dsp->attr.orientation = ICO_UXF_ORIENTATION_HORIZONTAL;
-        }
-    }
-    uifw_trace("ico_uxf_output_geometrycb: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_output_modecb: wayland display mode callback(static function)
- *
- * @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
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_output_modecb(void *data, struct wl_output *wl_output, uint32_t flags,
-                      int32_t width, int32_t height, int32_t refresh)
-{
-    Ico_Uxf_Mng_Display *dsp;
-
-    uifw_trace("ico_uxf_output_modecb: Enter(flg=%d, width=%d, height=%d, ref=%d)",
-               flags, width, height, refresh);
-
-    dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
-
-    if (dsp && (flags & WL_OUTPUT_MODE_CURRENT)) {
-        if (dsp->attr.orientation == ICO_UXF_ORIENTATION_VERTICAL) {
-            dsp->attr.pWidth = height;
-            dsp->attr.pHeight = width;
-        }
-        else {
-            dsp->attr.pWidth = width;
-            dsp->attr.pHeight = height;
-        }
-    }
-    uifw_trace("ico_uxf_output_modecb: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_create_window: Create/Set Window management table(static function)
- *
- * @param[in]   surfaceid       ico_window_mgr surface Id
- * @param[in]   appid           client application Id
- * @param[in]   node            surface node Id
- * @param[in]   layer           surface layer
- * @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
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_create_window(uint32_t surfaceid, const char *appid, uint32_t node, uint32_t layer,
-                      int32_t x, int32_t y, int32_t width, int32_t height)
-{
-    Ico_Uxf_Mng_Window  *win;
-    Ico_Uxf_Mng_EventQue *que;
-    int                 display;
-    Ico_Uxf_Mng_Process *prc;
-
-    ico_uxf_enter_critical();
-
-    win = ico_uxf_mng_window(surfaceid, 0);
-
-    if (! win)  {
-        win = ico_uxf_mng_window(surfaceid, 1);
-        win->attr.eventmask = ICO_UXF_EVENT_NEWWINDOW;
-    }
-    display = ICO_UXF_SURFACEID_2_NODEID(surfaceid);
-    win->mng_display = ico_uxf_mng_display(display, 0);
-    win->mng_layer = ico_uxf_mng_layer(display, layer, 0);
-    win->attr.display = display;
-    win->attr.layer = layer;
-    memset(win->attr.process, 0, ICO_UXF_MAX_PROCESS_NAME + 1);
-    strncpy(win->attr.process, appid, ICO_UXF_MAX_PROCESS_NAME);
-    win->attr.node = node;
-    win->attr.x = x;
-    win->attr.y = y;
-    win->attr.w = width;
-    win->attr.h = height;
-
-    prc = ico_uxf_mng_process(appid, 0);
-    win->mng_process = prc;
-    if ((prc != NULL) && (prc->attr.mainwin.window != (int)surfaceid)) {
-        /* sub-window */
-        win->attr.subwindow = 1;
-    }
-
-    if (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_NEWWINDOW)    {
-
-        que = ico_uxf_alloc_eventque();
-
-        que->detail.event = ICO_UXF_EVENT_NEWWINDOW;
-        que->detail.window.display = display;
-        que->detail.window.window = surfaceid;
-        que->detail.window.layer = layer;
-        que->detail.window.x = win->attr.x;
-        que->detail.window.y = win->attr.y;
-        que->detail.window.w = win->attr.w;
-        que->detail.window.h = win->attr.h;
-        que->detail.window.visible = win->attr.visible;
-        que->detail.window.raise = win->attr.raise;
-        que->detail.window.active = win->attr.active;
-
-        ico_uxf_regist_eventque(que);
-    }
-    ico_uxf_leave_critical();
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_createdcb: wayland surface create callback(static function)
- *
- * @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
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_window_createdcb(void *data, struct ico_window_mgr *ico_window_mgr,
-                         uint32_t surfaceid, const char *winname, int32_t pid,
-                         const char *appid)
-{
-    Ico_Uxf_Mng_Process *prc;
-    Ico_Uxf_Mng_ProcWin *ppwin;
-    Ico_Uxf_Mng_ProcWin *ppw;
-
-    uifw_trace("ico_uxf_window_createdcb: Enter(surf=%08x name=%s pid=%d appid=%s myapp=%s)",
-               (int)surfaceid, winname, pid, appid, gIco_Uxf_Api_Mng.MyProcess);
-
-    prc = ico_uxf_mng_process_find(appid, pid);
-    if (prc)    {
-        /* set window(surface) attrinutes   */
-        ico_window_mgr_set_attributes(gIco_Uxf_Api_Mng.Wayland_WindowMgr, surfaceid,
-                                      ICO_WINDOW_MGR_ATTR_FIXED_ASPECT);
-
-        /* set window animation     */
-        if (prc->appconf != NULL)   {
-            if (((Ico_Uxf_conf_application *)prc->appconf)->animation)  {
-                ico_window_mgr_set_animation(
-                    gIco_Uxf_Api_Mng.Wayland_WindowMgr, surfaceid,
-                    ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE|ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW|
-                    ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE,
-                    ((Ico_Uxf_conf_application *)prc->appconf)->animation,
-                    ((Ico_Uxf_conf_application *)prc->appconf)->animation_time);
-            }
-            else if (((Ico_Uxf_conf_application *)prc->appconf)->animation_time > 0)    {
-                ico_window_mgr_set_animation(
-                    gIco_Uxf_Api_Mng.Wayland_WindowMgr, surfaceid,
-                    ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE|ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW|
-                    ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE,
-                    " ", ((Ico_Uxf_conf_application *)prc->appconf)->animation_time);
-            }
-        }
-        if (prc->attr.mainwin.window <= 0)  {
-            uifw_trace("ico_uxf_window_createdcb: Set Main Window, Config Data");
-            prc->attr.mainwin.window = surfaceid;
-            ico_uxf_create_window(surfaceid, prc->attr.process, prc->attr.mainwin.node,
-                                  prc->attr.mainwin.layer, prc->attr.mainwin.x,
-                                  prc->attr.mainwin.y, prc->attr.mainwin.w,
-                                  prc->attr.mainwin.h);
-            if (gIco_Uxf_Api_Mng.Hook_Window)   {
-                (*gIco_Uxf_Api_Mng.Hook_Window)(prc->attr.process, surfaceid,
-                                                ICO_UXF_HOOK_WINDOW_CREATE_MAIN);
-            }
-        }
-        else    {
-            uifw_trace("ico_uxf_window_createdcb: Sub Window, Dummy Data");
-            ico_uxf_create_window(surfaceid, prc->attr.process, prc->attr.mainwin.node,
-                                  prc->attr.mainwin.layer, ICO_UXF_MAX_COORDINATE,
-                                  ICO_UXF_MAX_COORDINATE, 1, 1);
-            ppwin = (Ico_Uxf_Mng_ProcWin *)malloc(sizeof(Ico_Uxf_Mng_ProcWin));
-            if (ppwin) {
-                memset(ppwin, 0, sizeof(Ico_Uxf_Mng_ProcWin));
-                ppwin->attr.window = surfaceid;
-                ppwin->attr.display = prc->attr.mainwin.display;
-                if (!prc->procwin) {
-                    prc->procwin = ppwin;
-                }
-                else {
-                    ppw = prc->procwin;
-                    while (ppw->next) {
-                        ppw = ppw->next;
-                    }
-                    ppw->next = ppwin;
-                }
-            }
-            if (gIco_Uxf_Api_Mng.Hook_Window)   {
-                (*gIco_Uxf_Api_Mng.Hook_Window)(prc->attr.process, surfaceid,
-                                                ICO_UXF_HOOK_WINDOW_CREATE_SUB);
-            }
-        }
-    }
-    else    {
-        uifw_warn("ico_uxf_window_createdcb: Application.%s dose not exist", appid);
-    }
-    uifw_trace("ico_uxf_window_createdcb: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_namecb: wayland change surface name callback(static function)
- *
- * @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)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_window_namecb(void *data, struct ico_window_mgr *ico_window_mgr,
-                      uint32_t surfaceid, const char *winname)
-{
-    uifw_trace("ico_uxf_window_namecb: surf=%08x name=%s, NOP", (int)surfaceid, winname);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_destroyedcb: wayland surface destroy callback(static function)
- *
- * @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
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_window_destroyedcb(void *data, struct ico_window_mgr *ico_window_mgr,
-                           uint32_t surfaceid)
-{
-    Ico_Uxf_Mng_Window  *p;
-    Ico_Uxf_Mng_Window  *pp;
-    Ico_Uxf_Mng_Window  *freep;
-    Ico_Uxf_Mng_Process *prc;
-    Ico_Uxf_Mng_EventQue *que;
-    int                 hash;
-    char                wkappid[ICO_UXF_MAX_PROCESS_NAME+1];
-    int                 wksubwindow;
-
-    uifw_trace("ico_uxf_window_destroyedcb: Enter(surf=%08x)", (int)surfaceid);
-
-    ico_uxf_enter_critical();
-
-    p = ico_uxf_mng_window(surfaceid, 0);
-
-    if (! p)    {
-        ico_uxf_leave_critical();
-        uifw_trace("ico_uxf_window_destroyedcb: Leave(Surface=%08x dose not exist)",
-                   (int)surfaceid);
-        return;
-    }
-    prc = p->mng_process;
-    if ((prc != NULL) && (prc->attr.mainwin.window == (int)surfaceid))  {
-        prc->attr.mainwin.window = 0;
-    }
-
-    strcpy(wkappid, p->attr.process);
-    wksubwindow = p->attr.subwindow;
-
-    if ((gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_DESTORYWINDOW) &&
-        (p->attr.eventmask & ICO_UXF_EVENT_DESTORYWINDOW)) {
-
-        que = ico_uxf_alloc_eventque();
-        que->detail.event = ICO_UXF_EVENT_DESTORYWINDOW;
-        que->detail.window.display = p->attr.display;
-        que->detail.window.window = surfaceid;
-        que->detail.window.layer = p->attr.layer;
-        que->detail.window.x = p->attr.x;
-        que->detail.window.y = p->attr.y;
-        que->detail.window.w = p->attr.w;
-        que->detail.window.h = p->attr.h;
-        que->detail.window.visible = p->attr.visible;
-        que->detail.window.raise = p->attr.raise;
-        que->detail.window.active = p->attr.active;
-        ico_uxf_regist_eventque(que);
-    }
-
-    for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++)   {
-        p = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
-        pp = (Ico_Uxf_Mng_Window *)0;
-        while (p)  {
-            if (p->attr.window == (int)surfaceid)  {
-                freep = p;
-                p = p->nextidhash;
-                if (! pp)  {
-                    gIco_Uxf_Api_Mng.Hash_WindowId[hash] = p;
-                }
-                else    {
-                    pp->nextidhash = p;
-                }
-                uifw_trace("ico_uxf_window_destroyedcb: Free Window.%08x(%08x)",
-                           (int)freep, freep->attr.window);
-                free(freep);
-                hash = ICO_UXF_MISC_HASHSIZE;
-                break;
-            }
-            pp = p;
-            p = p->nextidhash;
-        }
-    }
-    ico_uxf_leave_critical();
-
-    if (gIco_Uxf_Api_Mng.Hook_Window)   {
-        (*gIco_Uxf_Api_Mng.Hook_Window)(wkappid, surfaceid,
-                                        wksubwindow ? ICO_UXF_HOOK_WINDOW_DESTORY_SUB :
-                                                      ICO_UXF_HOOK_WINDOW_DESTORY_MAIN);
-    }
-    uifw_trace("ico_uxf_window_destroyedcb: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_visiblecb: wayland surface visible callback(static function)
- *
- * @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(1=client request(not changed)/0=changed)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_window_visiblecb(void *data, struct ico_window_mgr *ico_window_mgr,
-                         uint32_t surfaceid, int32_t visible, int32_t raise, int32_t hint)
-{
-    Ico_Uxf_Mng_Window  *win;
-    Ico_Uxf_Mng_EventQue *que;
-    int                 ovisible;
-    int                 oraise;
-
-    ico_uxf_enter_critical();
-
-    win = ico_uxf_mng_window(surfaceid, 0);
-
-    if (!win)  {
-        ico_uxf_leave_critical();
-        uifw_trace("ico_uxf_window_visiblecb: Surface=%08x dose not exist",
-                   (int)surfaceid);
-        return;
-    }
-
-    ovisible = visible;
-    oraise = raise;
-    if (ovisible == 9) {
-        ovisible = win->attr.visible;
-    }
-    if (oraise == 9)   {
-        oraise = win->attr.raise;
-    }
-
-    if ((win->attr.visible != ovisible) ||
-        (win->attr.raise != oraise))   {
-
-        if (((hint == 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_VISIBLE) &&
-             (win->attr.eventmask & ICO_UXF_EVENT_VISIBLE)) ||
-            ((hint != 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_VISIBLE_REQ) &&
-             (win->attr.eventmask & ICO_UXF_EVENT_VISIBLE_REQ)))   {
-
-            que = ico_uxf_alloc_eventque();
-            que->detail.event =
-                    (hint == 0) ? ICO_UXF_EVENT_VISIBLE : ICO_UXF_EVENT_VISIBLE_REQ;
-            que->detail.window.display = win->attr.display;
-            que->detail.window.window = win->attr.window;
-            que->detail.window.layer = win->attr.layer;
-            que->detail.window.x = win->attr.x;
-            que->detail.window.y = win->attr.y;
-            que->detail.window.w = win->attr.w;
-            que->detail.window.h = win->attr.h;
-            que->detail.window.visible = ovisible;
-            que->detail.window.raise = oraise;
-            que->detail.window.active = win->attr.active;
-
-            ico_uxf_regist_eventque(que);
-        }
-    }
-    ico_uxf_leave_critical();
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_configurecb: wayland surface configure callback(static function)
- *
- * @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(1=client request(not changed)/0=changed)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_window_configurecb(void *data, struct ico_window_mgr *ico_window_mgr,
-                           uint32_t surfaceid, uint32_t node,
-                           uint32_t layer, int32_t x, int32_t y,
-                           int32_t width, int32_t height, int32_t hint)
-{
-    Ico_Uxf_Mng_Window  *win;
-    Ico_Uxf_Mng_EventQue *que;
-
-#if 0               /* too many logout, change to comment out   */
-    uifw_trace("ico_uxf_window_configurecb: surf=%08x node=%x layer=%x "
-               "x/y=%d/%d w/h=%d/%d hint=%d",
-               (int)surfaceid, node, layer, x, y, width, height, hint);
-#endif              /* too many logout, change to comment out   */
-
-    ico_uxf_enter_critical();
-
-    win = ico_uxf_mng_window(surfaceid, 0);
-
-    if (!win)  {
-        uifw_error("ico_uxf_window_configurecb: Unknown surface Id(%08x)", (int)surfaceid);
-    }
-    else    {
-        if ((win->attr.layer != (int)layer) ||
-            (win->attr.x != x) || (win->attr.y != y) ||
-            (win->attr.w != width) || (win->attr.h != height)) {
-
-            if (((hint == 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_RESIZE) &&
-                 (win->attr.eventmask & ICO_UXF_EVENT_RESIZE)) ||
-                ((hint != 0) && (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_RESIZE_REQ) &&
-                 (win->attr.eventmask & ICO_UXF_EVENT_RESIZE_REQ)))    {
-
-                que = ico_uxf_alloc_eventque();
-
-                que->detail.event =
-                        (hint == 0) ? ICO_UXF_EVENT_RESIZE : ICO_UXF_EVENT_RESIZE_REQ;
-                que->detail.window.display = win->mng_display->attr.display;
-                que->detail.window.window = win->attr.window;
-                que->detail.window.layer = layer;
-                que->detail.window.x = x;
-                que->detail.window.y = y;
-                que->detail.window.w = width;
-                que->detail.window.h = height;
-                que->detail.window.visible = win->attr.visible;
-                que->detail.window.raise = win->attr.raise;
-                que->detail.window.active = win->attr.active;
-
-                ico_uxf_regist_eventque(que);
-            }
-            if (hint == 0)  {
-                win->attr.x = x;
-                win->attr.y = y;
-                win->attr.w = width;
-                win->attr.h = height;
-                if (win->attr.layer != (int)layer)  {
-                    win->attr.layer = layer;
-                    win->mng_layer = ico_uxf_mng_layer(win->mng_display->attr.display,
-                                                       layer, 0);
-                }
-            }
-        }
-    }
-    ico_uxf_leave_critical();
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_activecb: wayland surface active callback(static function)
- *
- * @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)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_window_activecb(void *data, struct ico_window_mgr *ico_window_mgr,
-                        uint32_t surfaceid, int32_t active)
-{
-    Ico_Uxf_Mng_Window  *win;
-    Ico_Uxf_Mng_EventQue *que;
-
-    uifw_trace("ico_uxf_window_activecb: Enter(surf=%08x active=%d)", surfaceid, active);
-
-    ico_uxf_enter_critical();
-
-    win = ico_uxf_mng_window(surfaceid, 0);
-
-    if (win)  {
-        if (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_ACTIVEWINDOW)    {
-
-            que = ico_uxf_alloc_eventque();
-
-            que->detail.event = ICO_UXF_EVENT_ACTIVEWINDOW;
-            que->detail.window.display = ICO_UXF_SURFACEID_2_NODEID(surfaceid);
-            que->detail.window.window = surfaceid;
-            if (active == ICO_WINDOW_MGR_ACTIVE_SELECTED)   {
-                que->detail.window.active = ICO_UXF_WINDOW_SELECT;
-                win->attr.active = ICO_UXF_WINDOW_POINTER_ACTIVE |
-                                   ICO_UXF_WINDOW_KEYBOARD_ACTIVE;
-            }
-            else    {
-                que->detail.window.active = 0;
-                if (active & ICO_WINDOW_MGR_ACTIVE_POINTER) {
-                    que->detail.window.active |= ICO_UXF_WINDOW_POINTER_ACTIVE;
-                }
-                if (active & ICO_WINDOW_MGR_ACTIVE_KEYBOARD)    {
-                    que->detail.window.active |= ICO_UXF_WINDOW_KEYBOARD_ACTIVE;
-                }
-                win->attr.active = que->detail.window.active;
-            }
-            ico_uxf_regist_eventque(que);
-        }
-    }
-    ico_uxf_leave_critical();
-    uifw_trace("ico_uxf_window_activecb: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_layer_visiblecb: wayland layer visible callback(static function)
- *
- * @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)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_window_layer_visiblecb(void *data, struct ico_window_mgr *ico_window_mgr,
-                               uint32_t layer, int32_t visible)
-{
-    uifw_trace("ico_uxf_window_layer_visiblecb: layer=%x visible=%d, NOP", layer, visible);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_surfacecb: query applicationsurface callback(static function)
- *
- * @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
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_window_surfacecb(void *data, struct ico_window_mgr *ico_window_mgr,
-                         const char *appid, struct wl_array *surfaces)
-{
-    uifw_trace("ico_uxf_window_surfacecb: appid=%s, NOP", appid);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_mapcb: surface map event callback(static function)
- *
- * @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
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_window_mapcb(void *data, struct ico_window_mgr *ico_window_mgr,
-                     int32_t event, uint32_t surfaceid, int32_t width,
-                     int32_t height, int32_t stride, int32_t format)
-{
-    uifw_trace("ico_uxf_window_mapcb: surf=%08x event=%d w/h/s/f=%d/%d/%d/%d",
-               (int)surfaceid, event, width, height, stride, format);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_input_capabilitiescb: wayland extended input
- *                                        input capabilities callback(static function)
- *
- * @param[in]   data            user data(unused)
- * @param[in]   ico_exinput     wayland ico_input_mgr plugin interface
- * @param[in]   device          input device name
- * @param[in]   type            input device type
- * @param[in]   swname          input switch name
- * @param[in]   input           input switch number
- * @param[in]   codename        input code name
- * @param[in]   code            input code value
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_input_capabilitiescb(void *data, struct ico_exinput *ico_exinput,
-                             const char *device, int32_t type, const char *swname,
-                             int32_t input, const char *codename, int32_t code)
-{
-    int     i, j;
-    Ico_Uxf_Sys_Config  *sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
-    Ico_Uxf_InputDev    *inputdev;
-    Ico_Uxf_InputDev    *bpdev;
-    Ico_Uxf_InputSw     *inputsw;
-    Ico_Uxf_InputSw     *bpsw;
-
-    uifw_trace("ico_uxf_input_capabilitiescb: "
-               "Enter(device=%s type=%d sw=%s input=%d code=%s[%d])",
-               device, type, swname, input, codename, code);
-
-    if (! sysconf)  return;
-
-    /* search and create input device table     */
-    bpdev = NULL;
-    inputdev = gIco_Uxf_Api_Mng.InputDev;
-    while (inputdev)    {
-        if (strcasecmp(inputdev->device, device) == 0)  break;
-        bpdev = inputdev;
-        inputdev = inputdev->next;
-    }
-    if (! inputdev) {
-        inputdev = malloc(sizeof(Ico_Uxf_InputDev));
-        if (! inputdev) {
-            uifw_error("ico_uxf_input_capabilitiescb: Leave(No Memory)");
-            return;
-        }
-        memset(inputdev, 0, sizeof(Ico_Uxf_InputDev));
-
-        if (bpdev)  {
-            bpdev->next = inputdev;
-        }
-        else    {
-            gIco_Uxf_Api_Mng.InputDev = inputdev;
-        }
-    }
-    strncpy(inputdev->device, device, sizeof(inputdev->device)-1);
-    inputdev->type = type;
-
-    bpsw = NULL;
-    inputsw = inputdev->inputSw;
-    while (inputsw) {
-        if (strcasecmp(inputsw->swname, swname) == 0)   break;
-        bpsw = inputsw;
-        inputsw = inputsw->next;
-    }
-    if (! inputsw)  {
-        inputsw = malloc(sizeof(Ico_Uxf_InputSw));
-        if (! inputsw)  {
-            uifw_error("ico_uxf_input_capabilitiescb: Leave(No Memory)");
-            return;
-        }
-        if (bpsw)   {
-            bpsw->next = inputsw;
-        }
-        else    {
-            inputdev->inputSw = inputsw;
-        }
-        inputdev->numInputSw ++;
-    }
-    memset(inputsw, 0, sizeof(Ico_Uxf_InputSw));
-    strncpy(inputsw->swname, swname, sizeof(inputsw->swname)-1);
-    inputsw->input = input;
-    inputsw->numCode = 1;
-    inputsw->inputCode[0].code = code;
-    strncpy(inputsw->inputCode[0].codename, codename,
-            sizeof(inputsw->inputCode[0].codename)-1);
-    uifw_trace("ico_uxf_input_capabilitiescb: create new inputsw");
-
-    /* send fixed application if fixed switch   */
-    for (i = 0; i < sysconf->inputdevNum; i++)  {
-        if (strcasecmp(sysconf->inputdev[i].name, inputdev->device) != 0)   continue;
-
-        for (j = 0; j < sysconf->inputdev[i].inputswNum; j++)   {
-            if (! sysconf->inputdev[i].inputsw[j].appid)    continue;
-            if (strcasecmp(sysconf->inputdev[i].inputsw[j].name,
-                inputsw->swname) != 0)  continue;
-
-            uifw_trace("ico_uxf_input_capabilitiescb: input %s.%s = %s",
-                       inputdev->device, inputsw->swname,
-                       sysconf->inputdev[i].inputsw[j].appid);
-            ico_input_mgr_control_add_input_app(gIco_Uxf_Api_Mng.Wayland_InputMgr,
-                                                sysconf->inputdev[i].inputsw[j].appid,
-                                                inputdev->device, inputsw->input, 1,
-                                                sysconf->inputdev[i].inputsw[j].keycode);
-            inputsw->fix = 1;
-            break;
-        }
-    }
-    uifw_trace("ico_uxf_input_capabilitiescb: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_input_codecb: wayland extended input
- *                                input code callback(static function)
- *
- * @param[in]   data            user data(unused)
- * @param[in]   ico_exinput     wayland ico_input_mgr plugin interface
- * @param[in]   device          input device name
- * @param[in]   input           input switch number
- * @param[in]   codename        input code name
- * @param[in]   code            input code value
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_input_codecb(void *data, struct ico_exinput *ico_exinput, const char *device,
-                     int32_t input, const char *codename, int32_t code)
-{
-    int     i;
-    Ico_Uxf_InputDev    *inputdev;
-    Ico_Uxf_InputSw     *inputsw;
-
-    uifw_trace("ico_uxf_input_codecb: device=%s input=%d code=%s[%d]",
-               device, input, codename, code);
-
-    /* search input device table                */
-    inputdev = gIco_Uxf_Api_Mng.InputDev;
-    while (inputdev)    {
-        if (strcasecmp(inputdev->device, device) == 0)  break;
-        inputdev = inputdev->next;
-    }
-    if (! inputdev) {
-        uifw_error("ico_uxf_input_codecb: device.%s dose not exist", device);
-        return;
-    }
-
-    /* search input switch                      */
-    inputsw = inputdev->inputSw;
-    while (inputsw) {
-        if (inputsw->input == input)    break;
-        inputsw = inputsw->next;
-    }
-    if (! inputsw)  {
-        uifw_error("ico_uxf_input_codecb: device.%s input=%d dose not exist",
-                   device, input);
-        return;
-    }
-    for (i = 0; i < inputsw->numCode; i++)  {
-        if (inputsw->inputCode[i].code == code) break;
-    }
-    if (i >= inputsw->numCode)  {
-        if (i >= 8) {
-            uifw_error("ico_uxf_input_codecb: device.%s input=%d number of codes overflow",
-                       device, input);
-            return;
-        }
-        inputsw->numCode ++;
-        i = inputsw->numCode - 1;
-    }
-    memset(inputsw->inputCode[i].codename, 0, sizeof(inputsw->inputCode[i].codename));
-    strncpy(inputsw->inputCode[i].codename, codename,
-            sizeof(inputsw->inputCode[i].codename)-1);
-    inputsw->inputCode[i].code = code;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_input_inputcb: wayland extended input
- *                                 input switch callback(static function)
- *
- * @param[in]   data            user data(unused)
- * @param[in]   ico_exinput     wayland ico_input_mgr plugin interface
- * @param[in]   time            input time(miri-sec)
- * @param[in]   device          input device name
- * @param[in]   input           input switch number
- * @param[in]   code            input code value
- * @param[in]   state           input state(1=switch On/0=switch Off)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ico_uxf_input_inputcb(void *data, struct ico_exinput *ico_exinput, uint32_t time,
-                      const char *device, int32_t input, int32_t code, int32_t state)
-{
-    Ico_Uxf_Mng_EventQue *que;
-    uifw_trace("ico_uxf_input_inputcb: device=%s input=%d code=%d state=%d",
-               device, input, code, state);
-
-    if (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_EXINPUT)    {
-
-        ico_uxf_enter_critical();
-        que = ico_uxf_alloc_eventque();
-
-        strncpy(que->detail.exinput.device, device,
-                sizeof(que->detail.exinput.device)-1);
-        que->detail.exinput.input = input;
-        que->detail.exinput.code = code;
-        que->detail.exinput.state = state;
-
-        ico_uxf_regist_eventque(que);
-        ico_uxf_leave_critical();
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_aul_aulcb: AppCore(AUL) application launch/dead callback(static function)
- *
- * @param[in]   pid             target application process Id
- * @param[in]   data            user data(0=launch, 1=dead)
- * @return      result(always 0, means success)
- */
-/*--------------------------------------------------------------------------*/
-static int
-ico_uxf_aul_aulcb(int pid, void *data)
-{
-    Ico_Uxf_Mng_Process     *proc;
-    int                     hash;
-    Ico_Uxf_Mng_EventQue    *que;
-    int                     dead;
-    char                    appid[ICO_UXF_MAX_PROCESS_NAME+1];
-
-    dead = (int)data;
-    memset(appid, 0, sizeof(appid));
-    if (dead == 0)  {
-        (void) aul_app_get_appid_bypid(pid, appid, sizeof(appid));
-        uifw_trace("ico_uxf_aul_aulcb: Enter(pid=%d, dead=No, appid=%s)", pid, appid);
-    }
-    else    {
-        uifw_trace("ico_uxf_aul_aulcb: Enter(pid=%d, dead=Yes)", pid);
-    }
-    for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
-        proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
-        while (proc)   {
-            if (proc->attr.internalid == pid) break;
-            if (strcmp(proc->attr.process, appid) == 0) break;
-            proc = proc->nextidhash;
-        }
-        if (proc) break;
-    }
-    if (! proc) {
-        /* not handle process,  */
-        /* or the process is correctly terminated by ico_uxf_process_terminate */
-        uifw_trace("ico_uxf_aul_aulcb: Leave(not find)");
-        return 0;
-    }
-    uifw_trace("ico_uxf_aul_aulcb: find(appid=%s)", proc->attr.process);
-
-    ico_uxf_enter_critical();
-    /* set event */
-    que = ico_uxf_alloc_eventque();
-    strncpy(que->detail.process.process, proc->attr.process, ICO_UXF_MAX_PROCESS_NAME);
-    if (dead)   {
-        que->detail.event = ICO_UXF_EVENT_TERMPROCESS;
-        que->detail.process.status = ICO_UXF_PROCSTATUS_STOP;
-
-        /* delete process info */
-        proc->attr.status = ICO_UXF_PROCSTATUS_STOP;
-        proc->attr.internalid = -1;
-        proc->attr.mainwin.window = 0;
-        ico_uxf_free_procwin(proc);
-    }
-    else    {
-        que->detail.event = ICO_UXF_EVENT_EXECPROCESS;
-        que->detail.process.status = ICO_UXF_PROCSTATUS_RUN;
-
-        /* setup process info */
-        if (proc->attr.status != ICO_UXF_PROCSTATUS_RUN)    {
-            proc->attr.internalid = pid;
-            if (proc->attr.status != ICO_UXF_PROCSTATUS_INIT)   {
-                /* child process, search parent process */
-                uifw_trace("ico_uxf_aul_aulcb: fork&exec %s", proc->attr.process);
-                proc->attr.child = 1;
-                /* save parent application if exist     */
-                if (gIco_Uxf_Api_Mng.Mng_LastProcess != proc)   {
-                    proc->parent = gIco_Uxf_Api_Mng.Mng_LastProcess;
-                }
-                else    {
-                    uifw_trace("ico_uxf_aul_aulcb: same process %s real %s", proc->attr.process,
-                               proc->parent ? proc->parent->attr.process : "(None)");
-                }
-            }
-            else    {
-                proc->attr.child = 0;
-            }
-            proc->attr.status = ICO_UXF_PROCSTATUS_RUN;
-        }
-    }
-
-    /* notify event */
-    ico_uxf_regist_eventque(que);
-
-    ico_uxf_leave_critical();
-
-    uifw_trace("ico_uxf_aul_aulcb: Leave");
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_set_lastapp: save last application
- *
- * @param[in]   appid   applicationId (if NULL, no last application)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_uxf_set_lastapp(const char *appid)
-{
-    if (appid)  {
-        gIco_Uxf_Api_Mng.Mng_LastProcess = ico_uxf_mng_process(appid, 0);
-    }
-    else    {
-        gIco_Uxf_Api_Mng.Mng_LastProcess = NULL;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_getchild_appid: get child applicationId
- *
- * @param[in]   appid   parent applicationId
- * @return      last child applicationId
- * @retval      !=NULL      success(applicationId)
- * @retval      ==NULL      no child application
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API char *
-ico_uxf_getchild_appid(const char *appid)
-{
-    Ico_Uxf_Mng_Process *pproc;
-    Ico_Uxf_Mng_Process *proc;
-    int     hash;
-
-    pproc = ico_uxf_mng_process(appid, 0);
-    if (! pproc)    {
-        /* unknown parent application, no child     */
-        uifw_trace("ico_uxf_getchild_appid: Unknown parent(%s)", appid);
-        return NULL;
-    }
-
-    /* search parent        */
-    for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++)    {
-        proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
-        while (proc)    {
-            if (proc->parent == pproc)  {
-                uifw_trace("ico_uxf_getchild_appid: child(%s) parent(%s)",
-                           proc->attr.process, appid);
-                return proc->attr.process;
-            }
-            proc = proc->nextidhash;
-        }
-    }
-    uifw_trace("ico_uxf_getchild_appid: parent(%s) has no child", appid);
-    return NULL;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_set_lastapp: save last application
- *
- * @param[in]   appid   applicationId (if NULL, no last application)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_uxf_timer_wake(const int msec)
-{
-    Ico_Uxf_Mng_Process *proc;
-    int     hash;
-
-    if (gIco_Uxf_Api_Mng.InitTimer > 0) {
-        gIco_Uxf_Api_Mng.InitTimer -= msec;
-        if (gIco_Uxf_Api_Mng.InitTimer > 0) {
-            return;
-        }
-        gIco_Uxf_Api_Mng.InitTimer = 0;
-    }
-
-    if (gIco_Uxf_Api_Mng.NeedTimer == 0)    {
-        return;
-    }
-    gIco_Uxf_Api_Mng.NeedTimer = 0;
-    for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++)    {
-        proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
-        while (proc)    {
-            if (proc->susptimer > 0)    {
-                if (msec >= proc->susptimer)    {
-                    proc->susptimer = 0;
-                    if (proc->attr.suspend) {
-                        if (proc->susp == 0)    {
-                            proc->susp = 1;
-                            uifw_trace("ico_uxf_timer_wake: CPU suspend pid=%d",
-                                       proc->attr.internalid);
-                            kill(proc->attr.internalid, SIGSTOP);
-                        }
-                    }
-                    else if (proc->susp == 0)    {
-                        uifw_trace("ico_uxf_timer_wake: CPU resume pid=%d(show=%d)",
-                                   proc->attr.internalid, proc->showmode);
-                        ico_window_mgr_set_visible(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
-                                                   proc->attr.mainwin.window,
-                                                   ICO_WINDOW_MGR_VISIBLE_SHOW,
-                                                   ICO_WINDOW_MGR_V_NOCHANGE,
-                                                   (proc->showmode != 0) ?
-                                                     ICO_WINDOW_MGR_FLAGS_ANIMATION : 0);
-                        wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-                    }
-                }
-                else    {
-                    proc->susptimer -= msec;
-                    gIco_Uxf_Api_Mng.NeedTimer ++;
-                }
-            }
-            proc = proc->nextidhash;
-        }
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_enter_critical: enter critical section(internal function)
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-ico_uxf_enter_critical(void)
-{
-    if (pthread_mutex_lock(&sMutex)) {
-        uifw_error("ico_uxf_enter_critical: Error<%d>", errno);
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_leave_critical: leave critical section(internal function)
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-ico_uxf_leave_critical(void)
-{
-    if (pthread_mutex_unlock(&sMutex))   {
-        uifw_error("ico_uxf_leave_critical: Error<%d>", errno);
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_alloc_callback: allocate callback management table(internal function)
- *
- * @param       none
- * @return      allocated callback management table address
- */
-/*--------------------------------------------------------------------------*/
-Ico_Uxf_Mng_Callback *
-ico_uxf_alloc_callback(void)
-{
-    Ico_Uxf_Mng_Callback    *p;
-    int                     idx;
-
-    p = gIco_Uxf_Api_Mng.CallbackFree;
-    if (! p)   {
-        p = (Ico_Uxf_Mng_Callback *)malloc(sizeof(Ico_Uxf_Mng_Callback) *
-                                           ICO_UXF_MNG_BLOCK_ALLOCS);
-        if (! p)   {
-            uifw_error("ico_uxf_alloc_callback: NO Memory (malloc Error)");
-            exit(1);
-        }
-        gIco_Uxf_Api_Mng.CallbackFree = p;
-
-        for (idx = 0; idx < ICO_UXF_MNG_BLOCK_ALLOCS; idx++, p++)  {
-            if (idx != (ICO_UXF_MNG_BLOCK_ALLOCS-1))   {
-                p->next = (p+1);
-            }
-            else    {
-                p->next = (struct _Ico_Uxf_Mng_Callback *)0;
-            }
-        }
-        p = gIco_Uxf_Api_Mng.CallbackFree;
-    }
-    gIco_Uxf_Api_Mng.CallbackFree = p->next;
-    return p;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_free_callback: release callback management table(internal function)
- *
- * @param[in]   p           callback management table address
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-ico_uxf_free_callback(Ico_Uxf_Mng_Callback *p)
-{
-    p->next = gIco_Uxf_Api_Mng.CallbackFree;
-    gIco_Uxf_Api_Mng.CallbackFree = p;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_regist_callback: register a callback management table(internal function)
- *
- * @param[in]   p           callback management table address
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-ico_uxf_regist_callback(Ico_Uxf_Mng_Callback *p)
-{
-    p->next = (struct _Ico_Uxf_Mng_Callback *)0;
-
-    if (gIco_Uxf_Api_Mng.Callback) {
-        gIco_Uxf_Api_Mng.CallbackLast->next = p;
-        gIco_Uxf_Api_Mng.CallbackLast = p;
-    }
-    else    {
-        gIco_Uxf_Api_Mng.Callback = p;
-        gIco_Uxf_Api_Mng.CallbackLast = gIco_Uxf_Api_Mng.Callback;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_remove_callback: remove a callback management table(internal function)
- *
- * @param[in]   p           callback management table address
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-ico_uxf_remove_callback(Ico_Uxf_Mng_Callback *p)
-{
-    Ico_Uxf_Mng_Callback    *pp;
-    Ico_Uxf_Mng_Callback    *before;
-
-    pp = gIco_Uxf_Api_Mng.Callback;
-    before = (Ico_Uxf_Mng_Callback *)0;
-
-    while (pp) {
-        if (pp == p)   break;
-        before = pp;
-        pp = pp->next;
-    }
-    if (pp)    {
-        if (before)    {
-            before->next = p->next;
-            if (! p->next) {
-                gIco_Uxf_Api_Mng.CallbackLast = before;
-            }
-        }
-        else    {
-            gIco_Uxf_Api_Mng.Callback = p->next;
-        }
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_alloc_eventque: allocate event queue block(internal function)
- *
- * @param       none
- * @return      allocated event queue control block address
- */
-/*--------------------------------------------------------------------------*/
-Ico_Uxf_Mng_EventQue
-*ico_uxf_alloc_eventque(void)
-{
-    Ico_Uxf_Mng_EventQue    *p;
-    int                 idx;
-
-    p = gIco_Uxf_Api_Mng.EventQueFree;
-    if (! p)   {
-        p = (Ico_Uxf_Mng_EventQue *)
-                malloc(sizeof(Ico_Uxf_Mng_EventQue) * ICO_UXF_MNG_BLOCK_ALLOCS);
-        if (! p)   {
-            uifw_error("ico_uxf_alloc_eventque: NO Memory (malloc Error)");
-            exit(1);
-        }
-        gIco_Uxf_Api_Mng.EventQueFree = p;
-
-        for (idx = 0; idx < ICO_UXF_MNG_BLOCK_ALLOCS; idx++, p++)  {
-            if (idx != (ICO_UXF_MNG_BLOCK_ALLOCS-1))   {
-                p->next = (p+1);
-            }
-            else    {
-                p->next = (struct _Ico_Uxf_Mng_EventQue *)0;
-            }
-        }
-        p = gIco_Uxf_Api_Mng.EventQueFree;
-    }
-    gIco_Uxf_Api_Mng.EventQueFree = p->next;
-
-    return p;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_free_eventque: release event queue block(internal function)
- *
- * @param[in]   p       event queue control block address
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-ico_uxf_free_eventque(Ico_Uxf_Mng_EventQue *p)
-{
-    p->next = gIco_Uxf_Api_Mng.EventQueFree;
-    gIco_Uxf_Api_Mng.EventQueFree = p;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_regist_eventque: register a event queue(internal function)
- *
- * @param[in]   p       event queue control block address
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-ico_uxf_regist_eventque(Ico_Uxf_Mng_EventQue *p)
-{
-    p->next = (struct _Ico_Uxf_Mng_EventQue *)0;
-
-    if (gIco_Uxf_Api_Mng.EventQue) {
-        gIco_Uxf_Api_Mng.EventQueLast->next = p;
-        gIco_Uxf_Api_Mng.EventQueLast = p;
-    }
-    else    {
-        gIco_Uxf_Api_Mng.EventQue = p;
-        gIco_Uxf_Api_Mng.EventQueLast = gIco_Uxf_Api_Mng.EventQue;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_mng_display: get display management table(internal function)
- *
- * @param[in]   display     display Id
- * @param[in]   create      create flag(1=create tabell if not exist/0=not create)
- * @return      display management table address
- * @retval      !=NULL      display management table address
- * @retval      ==NULL      display dose not exist(parameter 'create' only 0)
- */
-/*--------------------------------------------------------------------------*/
-Ico_Uxf_Mng_Display *
-ico_uxf_mng_display(const int display, const int create)
-{
-    Ico_Uxf_Mng_Display *p;
-    Ico_Uxf_Mng_Display *plast;
-
-    p = gIco_Uxf_Api_Mng.Mng_Display;
-    plast = (Ico_Uxf_Mng_Display *)0;
-    while (p)  {
-        if (p->attr.display == display)    break;
-        plast = p;
-        p = p->next;
-    }
-
-    if ((! p) && (create != 0))   {
-
-        p = (Ico_Uxf_Mng_Display *) malloc(sizeof(Ico_Uxf_Mng_Display));
-        if (! p)   {
-            uifw_error("ico_uxf_mng_display: NO Memory (malloc Error)");
-            exit(1);
-        }
-        memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Display));
-        p->attr.display = display;
-        if (plast) {
-            plast->next = p;
-        }
-        else    {
-            gIco_Uxf_Api_Mng.Mng_Display = p;
-        }
-    }
-    return p;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_mng_layer: get layer management table(internal function)
- *
- * @param[in]   display     display Id
- * @param[in]   layer       layer Id
- * @param[in]   create      create flag(1=create tabell if not exist/0=not create)
- * @return      layer management table address
- * @retval      !=NULL      layer management table address
- * @retval      ==NULL      layer dose not exist(parameter 'create' only 0)
- */
-/*--------------------------------------------------------------------------*/
-Ico_Uxf_Mng_Layer *
-ico_uxf_mng_layer(const int display, const int layer, const int create)
-{
-    Ico_Uxf_Mng_Layer   *p;
-    Ico_Uxf_Mng_Layer   *plast;
-
-    p = gIco_Uxf_Api_Mng.Mng_Layer;
-    plast = (Ico_Uxf_Mng_Layer *)0;
-    while (p)  {
-        if ((p->attr.display == display) &&
-            (p->attr.layer == layer))  break;
-        plast = p;
-        p = p->next;
-    }
-
-    if ((! p) && (create != 0))   {
-
-        p = (Ico_Uxf_Mng_Layer *) malloc(sizeof(Ico_Uxf_Mng_Layer));
-        if (! p)   {
-            uifw_error("ico_uxf_mng_layer: NO Memory (malloc Error)");
-            exit(1);
-        }
-        memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Layer));
-        p->attr.layer = layer;
-        if (plast) {
-            plast->next = p;
-        }
-        else    {
-            gIco_Uxf_Api_Mng.Mng_Layer = p;
-        }
-    }
-    return p;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_mng_window: get window management table(internal function)
- *
- * @param[in]   window      window Id(same as ico_window_mgr surface Id)
- * @param[in]   create      create flag(1=create tabell if not exist/0=not create)
- * @return      window management table address
- * @retval      !=NULL      window management table address
- * @retval      ==NULL      window dose not exist(parameter 'create' only 0)
- */
-/*--------------------------------------------------------------------------*/
-Ico_Uxf_Mng_Window *
-ico_uxf_mng_window(const int window, const int create)
-{
-    Ico_Uxf_Mng_Window  *p;
-    Ico_Uxf_Mng_Window  *plast = (Ico_Uxf_Mng_Window *)0;
-    int                 hash;
-
-    hash = ICO_UXF_MISC_HASHBYID(window);
-    p = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
-    while (p)  {
-        if (p->attr.window == window)  break;
-        plast = p;
-        p = p->nextidhash;
-    }
-
-    if ((! p) && (create != 0))    {
-
-        p = (Ico_Uxf_Mng_Window *) malloc(sizeof(Ico_Uxf_Mng_Window));
-        if (! p)   {
-            uifw_error("ico_uxf_mng_window: NO Memory (malloc Error)");
-            exit(1);
-        }
-        memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Window));
-        p->attr.window = window;
-        if (plast) {
-            plast->nextidhash = p;
-        }
-        else    {
-            gIco_Uxf_Api_Mng.Hash_WindowId[hash] = p;
-        }
-        uifw_trace("ico_uxf_mng_window: Create New Table=%08x", (int)p);
-    }
-    return p;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_mng_process: get process management table(internal function)
- *
- * @param[in]   process     application Id
- * @param[in]   create      create flag(1=create tabell if not exist/0=not create)
- * @return      process management table address
- * @retval      !=NULL      process management table address
- * @retval      ==NULL      process dose not exist(parameter 'create' only 0)
- */
-/*--------------------------------------------------------------------------*/
-Ico_Uxf_Mng_Process *
-ico_uxf_mng_process(const char *process, const int create)
-{
-    Ico_Uxf_Mng_Process *p;
-    Ico_Uxf_Mng_Process *plast = (Ico_Uxf_Mng_Process *)0;
-    int                 hash;
-
-    hash = ICO_UXF_MISC_HASHBYNAME(process);
-    p = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
-    while (p)  {
-        if (strncmp(p->attr.process, process, ICO_UXF_MAX_PROCESS_NAME) == 0)   break;
-        plast = p;
-        p = p->nextidhash;
-    }
-
-    if ((! p) && (create != 0))   {
-
-        p = (Ico_Uxf_Mng_Process *) malloc(sizeof(Ico_Uxf_Mng_Process));
-        if (! p)   {
-            uifw_error("ico_uxf_mng_process: NO Memory (malloc Error)");
-            exit(1);
-        }
-        memset((char *)p, 0, sizeof(Ico_Uxf_Mng_Process));
-        strncpy(p->attr.process, process, ICO_UXF_MAX_PROCESS_NAME);
-        if (plast) {
-            plast->nextidhash = p;
-        }
-        else    {
-            gIco_Uxf_Api_Mng.Hash_ProcessId[hash] = p;
-        }
-    }
-    return p;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_mng_process_find: get process management table(internal function)
- *
- * @param[in]   process     application Id
- * @param[in]   pid         processid
- * @return      process management table address
- * @retval      !=NULL      process management table address
- * @retval      ==NULL      process dose not exist(parameter 'create' only 0)
- */
-/*--------------------------------------------------------------------------*/
-Ico_Uxf_Mng_Process *
-ico_uxf_mng_process_find(const char *process, const int pid)
-{
-    Ico_Uxf_Mng_Process *p;
-    int                 hash;
-
-    for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++) {
-        p = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
-        while (p)   {
-            if (p->attr.internalid == pid)              break;
-            if (strcmp(p->attr.process, process) == 0)  break;
-            p = p->nextidhash;
-        }
-        if (p) break;
-    }
-    return p;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_update_procwin: update a process management table
- *
- * @param[in]   appid       application id
- * @param[in]   type        type(install/uninstall)
- * @param[in]   func        window create/destroy hook function
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_uxf_update_procwin(const char *appid, int type)
-{
-    Ico_Uxf_Mng_Process     *prc = NULL;
-    Ico_Uxf_Sys_Config      *sysconf;
-    Ico_Uxf_App_Config      *appconf;
-    Ico_Uxf_conf_appdisplay *appdsp;
-    int                     dn, tn;
-    Ico_Uxf_conf_application *app = NULL;
-
-    uifw_trace("ico_uxf_update_procwin: Enter(appid=%s, type=%d)", appid, type);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_trace("ico_uxf_callback_remove: Leave(not initialized)");
-        return;
-    }
-    prc = ico_uxf_mng_process(appid, 0);
-
-    if (type == ICO_UXF_CONF_EVENT_INSTALL) {
-        if (!prc) {
-            sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
-            appconf = (Ico_Uxf_App_Config *)ico_uxf_getAppConfig();
-            if ((sysconf == NULL) || (appconf == NULL)) {
-                uifw_trace("ico_uxf_update_procwin: Leave(cannot find tables)");
-                return;
-            }
-            for (dn = 0;  dn < appconf->applicationNum; dn++) {
-                app = &appconf->application[dn];
-                if (strncmp(app->appid, appid, ICO_UXF_MAX_PROCESS_NAME) == 0) {
-                    uifw_trace("ico_uxf_update_procwin: Install(%s)", appid);
-                    /* add process management table */
-                    prc = ico_uxf_mng_process(appid, 1);
-                    prc->attr.internalid = 0;
-                    prc->attr.status = ICO_UXF_PROCSTATUS_STOP;
-                    prc->attr.type = app->categoryId;
-                    prc->attr.hostId = app->hostId;
-                    prc->attr.myHost = (prc->attr.hostId == sysconf->misc.myhostId) ? 1 : 0;
-
-                    appdsp = &app->display[0];
-                    prc->attr.mainwin.window = 0;
-                    prc->attr.mainwin.windowtype = app->categoryId;
-                    prc->attr.mainwin.display = appdsp->displayId;
-                    prc->attr.mainwin.layer = appdsp->layerId;
-                    prc->attr.mainwin.x =
-                            sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
-                    prc->attr.mainwin.y =
-                            sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
-                    prc->attr.mainwin.w =
-                            sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
-                    prc->attr.mainwin.h =
-                            sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
-                    prc->attr.mainwin.name[ICO_UXF_MAX_WIN_NAME] = 0;
-                    prc->attr.numwindows = app->displayzoneNum;
-                    /* get sub windows                          */
-                    if (prc->attr.numwindows > 1)   {
-                        prc->attr.subwin = malloc(sizeof(Ico_Uxf_ProcessWin) *
-                                                  (prc->attr.numwindows - 1));
-                        if (! prc->attr.subwin) {
-                            uifw_trace("ico_uxf_update_procwin: Install(No memory)");
-                            app->displayzoneNum = 1;
-                            prc->attr.numwindows = 1;
-                        }
-                        else    {
-                            memset(prc->attr.subwin, 0, (prc->attr.numwindows - 1));
-                            for (tn = 0; tn < (prc->attr.numwindows - 1); tn++) {
-                                appdsp ++;
-                                prc->attr.subwin[tn].windowtype = prc->attr.mainwin.windowtype;
-                                prc->attr.subwin[tn].display = appdsp->displayId;
-                                prc->attr.subwin[tn].layer = appdsp->layerId;
-                                prc->attr.subwin[tn].x =
-                                    sysconf->display[appdsp->displayId].zone[appdsp->zoneId].x;
-                                prc->attr.subwin[tn].y =
-                                    sysconf->display[appdsp->displayId].zone[appdsp->zoneId].y;
-                                prc->attr.subwin[tn].w =
-                                    sysconf->display[appdsp->displayId].zone[appdsp->zoneId].width;
-                                prc->attr.subwin[tn].h =
-                                    sysconf->display[appdsp->displayId].zone[appdsp->zoneId].height;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-    else if (type == ICO_UXF_CONF_EVENT_UNINSTALL) {
-        if (prc) {
-            /* not delete process management table */
-        }
-    }
-
-    uifw_trace("ico_uxf_update_procwin: Leave");
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_screen_size_get: get display physical size
- *
- * @param[out]  width       variable to receive the width of the display
- * @param[out]  height      variable to receive the height of the display
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_uxf_window_screen_size_get(int *width, int *height)
-{
-    Ico_Uxf_Mng_Display *dsp;
-    dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
-
-    uifw_trace("ico_uxf_window_screen_size_get: Enter(dsp=%d(%d))",
-               dsp, gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display);
-
-    if ((dsp != NULL) && (width != NULL) && (height != NULL)) {
-        uifw_trace("ico_uxf_window_screen_size_get: %dx%d",
-                   dsp->attr.pWidth, dsp->attr.pHeight);
-        *width = dsp->attr.pWidth;
-        *height = dsp->attr.pHeight;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_hook: set window create/destroy hook function
- *
- * @param[in]   func        window create/destroy hook function
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_uxf_window_hook(Ico_Uxf_Hook func)
-{
-    uifw_trace("ico_uxf_window_hook: Window Control Hook=%08x", (int)func);
-
-    gIco_Uxf_Api_Mng.Hook_Window = func;
-}
-
diff --git a/ico-app-framework/ico_uxf_inputdev.c b/ico-app-framework/ico_uxf_inputdev.c
deleted file mode 100644 (file)
index e2012ae..0000000
+++ /dev/null
@@ -1,143 +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   heade for input device
- *
- * @date    Feb-28-2013
- */
-
-#include    <stdio.h>
-#include    <stdlib.h>
-#include    <unistd.h>
-#include    <string.h>
-#include    <errno.h>
-
-#include    "ico_uxf.h"
-#include    "ico_uxf_private.h"
-#include    "ico_input_mgr-client-protocol.h"
-
-extern Ico_Uxf_Api_Mng         gIco_Uxf_Api_Mng;
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_inputdev_attribute_get: get input device attribute
- *
- * @param[in]   devidx          input device index (0-)
- * @return      result
- * @retval      !=NULL          success(input device attribute address)
- * @retval      ==NULL          error(device dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API Ico_Uxf_InputDev *
-ico_uxf_inputdev_attribute_get(const int devidx)
-{
-    Ico_Uxf_InputDev    *pdev;
-    int                 idx;
-
-    uifw_trace("ico_uxf_inputdev_attribute_get: Enter(%d)", devidx);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_window_layer: Leave(ESRCH)");
-        return NULL;
-    }
-
-    pdev = gIco_Uxf_Api_Mng.InputDev;
-    idx = 0;
-    while ((pdev != NULL) && (idx < devidx))    {
-        idx ++;
-        pdev = pdev->next;
-    }
-
-    if ((pdev == NULL) || (idx != devidx))  {
-        uifw_trace("ico_uxf_inputdev_attribute_get: Leave(ENOENT)");
-        return NULL;
-    }
-
-    uifw_trace("ico_uxf_inputdev_attribute_get: Leave(EOK, device=%s)", pdev->device);
-    return pdev;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_inputsw_attribute_get: get input switch attribute
- *
- * @param[in]   inputdev        input device attribute
- * @param[in]   swidx           input switch index (0-)
- * @return      result
- * @retval      !=NULL          success(input switch attribute address)
- * @retval      ==NULL          error(device dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API Ico_Uxf_InputSw *
-ico_uxf_inputsw_attribute_get(Ico_Uxf_InputDev *inputdev, const int swidx)
-{
-    Ico_Uxf_InputSw     *psw;
-    int                 idx;
-
-    uifw_trace("ico_uxf_inputsw_attribute_get: Enter(%s,%d)",
-               inputdev ? inputdev->device : "(NULL)", swidx);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_inputsw_attribute_get: Leave(ESRCH)");
-        return NULL;
-    }
-    if ((inputdev == NULL) || (swidx < 0) || (swidx >= inputdev->numInputSw))   {
-        uifw_warn("ico_uxf_inputsw_attribute_get: Leave(device ENOENT)");
-        return NULL;
-    }
-
-    psw = inputdev->inputSw;
-    idx = 0;
-    while ((psw != NULL) && (idx < swidx))  {
-        idx ++;
-        psw = psw->next;
-    }
-
-    if ((psw == NULL) || (idx != swidx))   {
-        uifw_warn("ico_uxf_inputsw_attribute_get: Leave(switch ENOENT)");
-        return NULL;
-    }
-
-    uifw_trace("ico_uxf_inputsw_attribute_get: Leave(EOK, switch=%s.%s)",
-               inputdev->device, psw->swname);
-    return psw;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Send request to Multi Input Manager
- *
- *  @param[in]  add         switch add(=1)/delete(=0)
- *  @param[in]  appid       target application id
- *  @param[in]  device      target input device name
- *  @param[in]  input       target input switch number
- *  @param[in]  keycode     emulated keyboard key-code
- *  @return     result status
- *  @retval     ICO_UXF_EOK success(cullentry always success)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_input_control(const int add, const char *appid,
-                      const char *device, const int input, const int keycode)
-{
-    apfw_trace("ico_uxf_input_control: input switch %s %s %s.%d(%d)",
-               add ? "add" : "del", appid ? appid : "all-app",
-               device ? device : "all-device", input, keycode);
-
-    if (add)    {
-        ico_input_mgr_control_add_input_app(gIco_Uxf_Api_Mng.Wayland_InputMgr, appid,
-                                            device, input, 0, keycode);
-    }
-    else    {
-        ico_input_mgr_control_del_input_app(gIco_Uxf_Api_Mng.Wayland_InputMgr, appid,
-                                            device, input);
-    }
-    return ICO_UXF_EOK;
-}
-
diff --git a/ico-app-framework/ico_uxf_launcher.c b/ico-app-framework/ico_uxf_launcher.c
deleted file mode 100644 (file)
index 58c19b8..0000000
+++ /dev/null
@@ -1,403 +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   user experience library for HomeScreen
- *
- * @date    Feb-28-2013
- */
-
-#include    <stdio.h>
-#include    <stdlib.h>
-#include    <unistd.h>
-#include    <string.h>
-#include    <errno.h>
-
-#include    "wayland-client.h"
-#include    "wayland-util.h"
-#include    "ico_uxf.h"                 /* UX-FW open definition header         */
-#include    "ico_uxf_private.h"         /* UX-FW inner definition header        */
-#include    "ico_uxf_conf.h"
-
-/* valiable & table                     */
-/* UX-FW API inner management table     */
-extern Ico_Uxf_Api_Mng         gIco_Uxf_Api_Mng;
-
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_process_execute: launch a program
- *
- * @param[in]   name        program name
- * @return  result
- * @retval  ICO_UXF_EOK         success
- * @retval  ICO_UXF_ESRCH       error(not initialized)
- * @retval  ICO_UXF_ENOENT      error(does not exist)
- * @retval  ICO_UXF_EBUSY       error(already launch)
- * @retval  ICO_UXF_EPERM       error(no authority)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_process_execute(const char *name)
-{
-    Ico_Uxf_Mng_Process *proc;              /* process management table         */
-    int         hash;
-
-    uifw_trace("ico_uxf_process_execute: Enter(%s)", name);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_process_execute: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++)    {
-        proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
-        while (proc)    {
-            if (strcasecmp(proc->attr.process, name) == 0)  break;
-            proc = proc->nextidhash;
-        }
-        if (proc) break;
-    }
-
-    if (! proc) {
-        uifw_warn("ico_uxf_process_execute: Leave(%s ENOENT)", name);
-        return ICO_UXF_ENOENT;
-    }
-
-    ico_uxf_enter_critical();               /* enter critical section           */
-
-    if (proc->attr.status != ICO_UXF_PROCSTATUS_STOP)   {
-        ico_uxf_leave_critical();           /* leave critical section           */
-        uifw_warn("ico_uxf_process_execute: Leave(%s EBUSY)", name);
-        return ICO_UXF_EBUSY;
-    }
-
-    /* in order to avoid double execute, status set starting    */
-    proc->attr.status = ICO_UXF_PROCSTATUS_INIT;
-    ico_uxf_leave_critical();               /* leave critical section           */
-
-    /* execute program                      */
-    proc->attr.internalid = aul_launch_app(name , NULL);
-    if (proc->attr.internalid < 0)  {
-        uifw_error("ico_uxf_process_execute: Leave(%s ENOSYS), Launch App Error(%d)",
-                   name, proc->attr.internalid);
-        proc->attr.status = ICO_UXF_PROCSTATUS_STOP;
-        return ICO_UXF_ENOSYS;
-    }
-
-    proc->attr.status = ICO_UXF_PROCSTATUS_RUN;
-
-    uifw_trace("ico_uxf_process_execute: Leave(%s)", proc->attr.process);
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_process_terminate: finish a program
- *
- * @param[in]   process     process id
- * @return  result
- * @retval  ICO_UXF_EOK         success
- * @retval  ICO_UXF_ESRCH       error(not initialized)
- * @retval  ICO_UXF_ENOENT      error(does not exist)
- * @retval  ICO_UXF_EAGAIN      error(already launch)
- * @retval  ICO_UXF_EPERM       error(no authority)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_process_terminate(const char *process)
-{
-    Ico_Uxf_Mng_Process     *proc;          /* process management table         */
-    int                     ret;            /* process management table         */
-
-    uifw_trace("ico_uxf_process_terminate: Enter(%s)", process);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_process_terminate: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    /* target is other process */
-    proc = ico_uxf_mng_process(process, 0);
-    if (! proc)    {
-        uifw_warn("ico_uxf_process_terminate: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-
-    ret = aul_terminate_pid(proc->attr.internalid);
-    if (ret < 0) {
-        uifw_warn("ico_uxf_process_terminate: Leave(ENOSYS) cannot terminate pid=%d",
-                  proc->attr.internalid);
-        return ICO_UXF_ENOSYS;
-    }
-
-    proc->attr.status = ICO_UXF_PROCSTATUS_STOP;
-    proc->attr.internalid = -1;
-    proc->attr.mainwin.window = 0;
-    ico_uxf_free_procwin(proc);
-
-    uifw_trace("ico_uxf_process_terminate: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_process_attribute_get: get a process's current state
- *
- * @param[in]   process     process's identity
- * @param[out]  attr        target process's current state
- * @return  result
- * @retval  ICO_UXF_EOK         success
- * @retval  ICO_UXF_ESRCH       error(not initialized)
- * @retval  ICO_UXF_ENOENT      error(does not exist)
- * @retval  ICO_UXF_EPERM       error(no authority)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_process_attribute_get(const char *process, Ico_Uxf_ProcessAttr *attr)
-{
-    Ico_Uxf_Mng_Process *proc;              /* process management table             */
-
-    uifw_trace("ico_uxf_process_attribute_get: Enter(%s)", process);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_process_attribute_get: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    proc = ico_uxf_mng_process(process, 0);
-    if (! proc)    {
-        uifw_warn("ico_uxf_process_attribute_get: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-
-    memcpy((char *)attr, (char *)&(proc->attr), sizeof(Ico_Uxf_ProcessAttr));
-
-    uifw_trace("ico_uxf_process_attribute_get: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_process_is_active: get application activity
- *
- * @param[in]   process     process's identity
- * @return  result
- * @retval  2               process is child process
- * @retval  1               process is active
- * @retval  0               process is not active
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_process_is_active(const char *process)
-{
-    Ico_Uxf_Mng_Process *proc;              /* process management table             */
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_process_is_active: False(ESRCH)");
-        return 0;
-    }
-
-    proc = ico_uxf_mng_process(process, 0);
-    if (! proc)    {
-        uifw_warn("ico_uxf_process_is_active: False(ENOENT)");
-        return 0;
-    }
-
-    if (proc->attr.child)   {
-        uifw_trace("ico_uxf_process_is_active: %s is Child", process);
-        return 2;
-    }
-    uifw_trace("ico_uxf_process_is_active: %s is %s",
-               process, proc->attr.active ? "Active" : "Inactive");
-    return proc->attr.active;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_process_window_get: get a window defined by the process
- *
- * @param[in]   process     process identity
- * @param[out]  attr        return a window definition
- *                          First is main window of the process,
- *                          second henceforth is sub window of the process.
- *                          At present support only main window.
- * @param[in]   num         number of window definition(= array size)
- * @return  result
- * @retval  >= 0            success(number of windows)
- * @retval  ICO_UXF_E2BIG   The number of the process has exceeded num
- *                          The attribute of the process up to a num piece is returned to attr
- * @retval  ICO_UXF_ENOENT  error(does not exist)
- * @retval  ICO_UXF_EINVAL  error(num is 0 or less)
- * @retval  ICO_UXF_ESRCH   error(not initialized)
- * @retval  ICO_UXF_EPERM   error(no authority)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_process_window_get(const char *process, Ico_Uxf_ProcessWin *attr, const int num)
-{
-    Ico_Uxf_Mng_Process *proc;              /* process management table         */
-    Ico_Uxf_Mng_ProcWin *pwin;              /* Process possession window table  */
-    int         n;                          /* number of window                 */
-
-    uifw_trace("ico_uxf_process_window_get: Enter(%s,,%d)", process, num);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_process_window_get: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    if (num <= 0)  {
-        uifw_warn("ico_uxf_process_window_get: Leave(EINVAL)");
-        return ICO_UXF_EINVAL;
-    }
-
-    proc = ico_uxf_mng_process(process, 0);
-    if (! proc)    {
-        uifw_trace("ico_uxf_process_window_get: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-
-    memcpy((char *)&(attr[0]), (char *)&(proc->attr.mainwin), sizeof(Ico_Uxf_ProcessWin));
-
-    pwin = proc->procwin;
-    for (n = 1; n < num; n++)  {
-        if (! pwin)    break;
-        memcpy((char *)&(attr[n]), (char *)&(pwin->attr), sizeof(Ico_Uxf_ProcessWin));
-        pwin = pwin->next;
-    }
-
-    if (pwin)  {
-        n = ICO_UXF_E2BIG;
-        uifw_trace("ico_uxf_process_window_get: Leave(E2BIG)");
-    }
-    else    {
-        uifw_trace("ico_uxf_process_window_get: Leave(%d)", n);
-    }
-    return n;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_process_window_get_one: get a window defined by the process
- *
- * @param[in]   process     process identity(appid)
- * @param[out]  attr        return a window definition
- * @param[in]   winidx      window index(0 is main window, 1-N is sub window)
- * @return  result
- * @retval  ICO_UXF_EOK     success
- * @retval  ICO_UXF_ENOENT  error(does not exist)
- * @retval  ICO_UXF_EINVAL  error(winidx is negative)
- * @retval  ICO_UXF_ESRCH   error(not initialized)
- * @retval  ICO_UXF_EPERM   error(no authority)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_process_window_get_one(const char *process,
-                               Ico_Uxf_ProcessWin *attr, const int winidx)
-{
-    Ico_Uxf_Mng_Process *proc;              /* process management table         */
-    Ico_Uxf_Mng_ProcWin *pwin;              /* Process possession window table  */
-    int         n;                          /* number of window                 */
-
-    uifw_trace("ico_uxf_process_window_get_one: Enter(%s,,%d)", process, winidx);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_process_window_get_one: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    if (winidx < 0)    {
-        uifw_warn("ico_uxf_process_window_get_one: Leave(EINVAL)");
-        return ICO_UXF_EINVAL;
-    }
-
-    proc = ico_uxf_mng_process(process, 0);
-    if (! proc)    {
-        uifw_warn("ico_uxf_process_window_get_one: Leave(ENOENT, no appid)");
-        return ICO_UXF_ENOENT;
-    }
-    if (winidx >= proc->attr.numwindows) {
-        uifw_warn("ico_uxf_process_window_get_one: Leave(ENOENT, winidx over)");
-        return ICO_UXF_ENOENT;
-    }
-
-    if (winidx == 0)    {
-        memcpy(attr, &proc->attr.mainwin, sizeof(Ico_Uxf_ProcessWin));
-    }
-    else    {
-        pwin = proc->procwin;
-        for (n = 1; n < winidx; n++)   {
-            if (! pwin) {
-                uifw_warn("ico_uxf_process_window_get_one: Leave(ENOENT, winidx over)");
-                return ICO_UXF_ENOENT;
-            }
-            pwin = pwin->next;
-        }
-        memcpy(attr, &pwin->attr, sizeof(Ico_Uxf_ProcessWin));
-    }
-    uifw_trace("ico_uxf_process_window_get_one: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_process_query_processes: get all process current status
- *
- * @param[out]  attr        process's current status
- * @return  result
- * @retval  >= 0            success(number of process)
- * @retval  ICO_UXF_E2BIG   The number of the process has exceeded num
- *                          The attribute of the process up to a num piece is returned to attr
- * @retval  ICO_UXF_EOK     success
- * @retval  ICO_UXF_ESRCH   error(not initialized)
- * @retval  ICO_UXF_EINVAL  error(num is 0 or less)
- * @retval  ICO_UXF_EPERM   error(no authority)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_process_query_processes(Ico_Uxf_ProcessAttr attr[], const int num)
-{
-    int         n;                          /* number of process                */
-    Ico_Uxf_Mng_Process *mng;               /* process management table         */
-    int         hash;
-
-    uifw_trace("ico_uxf_process_query_processes: Enter(,%d)", num);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_process_query_processes: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    if (num <= 0)  {
-        uifw_warn("ico_uxf_process_query_processes: Leave(EINVAL)");
-        return ICO_UXF_EINVAL;
-    }
-
-    n = 0;
-    for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++)   {
-        mng = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
-        while (mng)    {
-            if (n >= num)  break;
-            memcpy((char *)(&attr[n]), (char *)&(mng->attr), sizeof(Ico_Uxf_ProcessAttr));
-            n ++;
-            mng = mng->nextidhash;
-        }
-        if (mng)   break;
-    }
-
-    if (mng)   {
-        n = ICO_UXF_E2BIG;
-        uifw_trace("ico_uxf_process_query_processes: Leave(E2BIG)");
-    }
-    else    {
-        uifw_trace("ico_uxf_process_query_processes: Leave(%d)", n);
-    }
-    return n;
-}
-
diff --git a/ico-app-framework/ico_uxf_private.h b/ico-app-framework/ico_uxf_private.h
deleted file mode 100644 (file)
index 1d4f734..0000000
+++ /dev/null
@@ -1,219 +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   user experience library internal header
- *
- * @date    Feb-28-2013
- */
-
-#ifndef _ICO_UXF_INTERNAL_H_
-#define _ICO_UXF_INTERNAL_H_
-
-#include    <wayland-client.h>              /* Wayland client library               */
-#include    <wayland-egl.h>                 /* Wayland EGL library                  */
-#include    <wayland-util.h>                /* Wayland Misc library                 */
-#include    <aul/aul.h>                     /* AppCore                              */
-
-#include    "ico_uxf_sysdef.h"              /* UX-FW System convention value        */
-#include    "ico_uxf_def.h"                 /* UX-FW definition value               */
-#include    "ico_apf_log.h"                 /* wide use log definition              */
-#include    "ico_apf_apimacro.h"
-
-#include    "ico_input_mgr-client-protocol.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* macro                                            */
-                                            /* get DisplayId from SurfaceId         */
-#define ICO_UXF_GETDISPLAYID(surfaceid)   \
-            ((surfaceid >> 16) & 0x00ff)
-
-/* define struct                                    */
-/* struct management callback function              */
-typedef struct  _Ico_Uxf_Mng_Callback   {
-    struct _Ico_Uxf_Mng_Callback    *next;  /* next callback struct                 */
-    unsigned int        eventmask;          /* notify event mask                    */
-    Ico_Uxf_Event_Cb    func;               /* callback function address            */
-    int                 arg;                /* function's argument                  */
-}   Ico_Uxf_Mng_Callback;
-
-/* struct management event queue                    */
-typedef struct  _Ico_Uxf_Mng_EventQue   {
-    struct _Ico_Uxf_Mng_EventQue    *next;  /* next event queue struct              */
-    Ico_Uxf_EventDetail detail;             /* event detail                         */
-}   Ico_Uxf_Mng_EventQue;
-
-/* struct management window which proccess owns     */
-typedef struct  _Ico_Uxf_Mng_ProcWin    {
-    struct _Ico_Uxf_Mng_ProcWin *next;      /* next window                          */
-    Ico_Uxf_ProcessWin  attr;               /* window configuration                 */
-}   Ico_Uxf_Mng_ProcWin;
-
-/* struct management proccess                       */
-typedef struct  _Ico_Uxf_Mng_Process    {
-    struct _Ico_Uxf_Mng_Process *nextidhash;/* next process of the same id and hash */
-    Ico_Uxf_Mng_ProcWin *procwin;           /* process's subwindow                  */
-    void                *appconf;           /* configuration table address          */
-    struct _Ico_Uxf_Mng_Process *parent;    /* parent process                       */
-    short               susptimer;          /* suspend timer                        */
-    char                susp;               /* real suspend flag                    */
-    char                showmode;           /* resume show mode                     */
-    Ico_Uxf_ProcessAttr attr;               /* process configuration                */
-}   Ico_Uxf_Mng_Process;
-
-/* struct management display                        */
-typedef struct  _Ico_Uxf_Mng_Display    {
-    struct _Ico_Uxf_Mng_Display *next;      /* next display                         */
-    Ico_Uxf_DisplayAttr attr;               /* display configuration                */
-}   Ico_Uxf_Mng_Display;
-
-/* struct management layer                          */
-typedef struct  _Ico_Uxf_Mng_Layer  {
-    struct _Ico_Uxf_Mng_Layer   *next;      /* next layer                           */
-    Ico_Uxf_Mng_Display *mng_display;       /* display local cache                  */
-    Ico_Uxf_LayerAttr   attr;               /* layer attribute                      */
-}   Ico_Uxf_Mng_Layer;
-
-#define ICO_UXF_RESREQ_CLIENT       1       /* Request from client                  */
-#define ICO_UXF_RESREQ_AUTO         2       /* Automatic request                    */
-#define ICO_UXF_RESSTAT_NONE        0       /* Resource status: None                */
-#define ICO_UXF_RESSTAT_ACQUIRED    1       /* Resource status: Acruired            */
-#define ICO_UXF_RESSTAT_DEPRIVED    2       /* Resource status: Deprived            */
-
-typedef struct  _Ico_Uxf_Mng_Window {
-    struct _Ico_Uxf_Mng_Window  *nextidhash;/* next window of the same id and hash  */
-    Ico_Uxf_Mng_Display *mng_display;       /* display local cache                  */
-    Ico_Uxf_Mng_Layer   *mng_layer;         /* layer local cache                    */
-    Ico_Uxf_Mng_Process *mng_process;       /* process local cache                  */
-    struct _Ico_Uxf_Mng_Window *mng_parent; /* parent window                        */
-    short               state;              /* Window status                        */
-    unsigned char       request;            /* Request                              */
-    char                res;                /* (unused)                             */
-    Ico_Uxf_WindowAttr  attr;               /* window attribute                     */
-}   Ico_Uxf_Mng_Window;
-
-/* struct management listener added by user         */
-typedef struct _Ico_Uxf_Mng_EventListener {
-    struct _Ico_Uxf_Mng_EventListener *next;/* next table management listener function*/
-    void        (*func)(void *);            /* listener function address            */
-    void        *arg;                       /* listener function's argument         */
-}   Ico_Uxf_Mng_EventListener;
-
-/* struct management UX-FW API                      */
-typedef struct  _Ico_Uxf_Api_Mng    {
-    /* variable                             */
-    int                     Initialized;    /* initialized flag                     */
-    int                     EventMask;      /* receive event                        */
-    unsigned int            LastEvent;      /* last receive event(end synchronization)*/
-    int                     AppsCtlVisible; /* Tempolary visible all windows        */
-    short                   Win_Show_Anima; /* Window animation at show             */
-    short                   Win_Hide_Anima; /* Window animation at hide             */
-    int                     NeedTimer;      /* need timer control                   */
-    int                     InitTimer;      /* initial timer                        */
-
-    /* process information myprocess        */
-    char                    MyProcess[ICO_UXF_MAX_PROCESS_NAME+1];
-                                            /* process id                           */
-    Ico_Uxf_Mng_Process     *Mng_MyProcess; /* process management table             */
-    int                     MyMainWindow;   /* main window id                       */
-    Ico_Uxf_Mng_Process     *Mng_LastProcess;/* last active process management table*/
-
-    /* table management callback function            */
-    Ico_Uxf_Mng_Callback    *Callback;      /* callback management table            */
-    Ico_Uxf_Mng_Callback    *CallbackLast;  /* last at callback management table's  */
-    Ico_Uxf_Mng_Callback    *CallbackFree;  /* free callback management table       */
-
-    /* event queue                                   */
-    Ico_Uxf_Mng_EventQue    *EventQue;      /* event queue list                     */
-    Ico_Uxf_Mng_EventQue    *EventQueLast;  /* last at event queue list             */
-    Ico_Uxf_Mng_EventQue    *EventQueFree;  /* opening event queue                  */
-
-    /* table management resource                     */
-    Ico_Uxf_Mng_Display     *Mng_Display;   /* display attribute cache              */
-    Ico_Uxf_Mng_Layer       *Mng_Layer;     /* layer attribute cache                */
-    Ico_Uxf_Mng_Process     *Hash_ProcessId[ICO_UXF_MISC_HASHSIZE];
-                                            /* process attribute table's hash       */
-    Ico_Uxf_Mng_Window      *Hash_WindowId[ICO_UXF_MISC_HASHSIZE];
-                                            /* window attribute table's hash        */
-    Ico_Uxf_InputDev        *InputDev;      /* Input device table                   */
-
-    /* Wayland                          */
-    struct wl_display       *Wayland_Display;   /* Wayland's display                */
-    struct wl_registry      *Wayland_Registry;  /* Wayland's Registry               */
-    struct wl_compositor    *Wayland_Compositor;/* Wayland's compositor             */
-    struct wl_seat          *Wayland_Seat;      /* Wayland's device input event     */
-    struct ico_window_mgr   *Wayland_WindowMgr; /* Wayland's Window Manager PlugIn  */
-    struct wl_output        *Wayland_Output;    /* Wayland's output describes       */
-    int                     WaylandFd;          /* Wayland's file descriptor        */
-    struct ico_input_mgr_control
-                            *Wayland_InputMgr;  /* Input Manager PulgIn             */
-    struct ico_exinput      *Wayland_exInput;   /* extra input event                */
-
-    /* Hook routines                    */
-    Ico_Uxf_Hook            Hook_Window;        /* Window control hook              */
-}   Ico_Uxf_Api_Mng;
-
-/* define inner misc function               */
-void ico_uxf_enter_critical(void);          /* Exclusion section start              */
-void ico_uxf_leave_critical(void);          /* Exclusion section end                */
-void ico_uxf_broadcast_signal(void);        /* Dissolution of MainLoop's wait       */
-Ico_Uxf_Mng_Callback *ico_uxf_alloc_callback(void);
-                                            /* get a callback management table      */
-void ico_uxf_free_callback(Ico_Uxf_Mng_Callback *p);
-                                            /* free a callback management table     */
-void ico_uxf_regist_callback(Ico_Uxf_Mng_Callback *p);
-                                            /* register callback management table   */
-void ico_uxf_remove_callback(Ico_Uxf_Mng_Callback *p);
-                                            /* deregister callback management table */
-Ico_Uxf_Mng_EventQue *ico_uxf_alloc_eventque(void);
-                                            /* allocate event queue block           */
-void ico_uxf_free_eventque(Ico_Uxf_Mng_EventQue *p);
-                                            /* free a event queue block             */
-void ico_uxf_regist_eventque(Ico_Uxf_Mng_EventQue *p);
-                                            /* register event queue block           */
-Ico_Uxf_Mng_Display *ico_uxf_mng_display(const int display, const int create);
-                                            /* get a display management table       */
-Ico_Uxf_Mng_Layer *ico_uxf_mng_layer(const int display, const int layer,
-                                     const int create);
-                                            /* get a layer management table         */
-Ico_Uxf_Mng_Window *ico_uxf_mng_window(const int window, const int create);
-                                            /* get a window management table        */
-Ico_Uxf_Mng_Process *ico_uxf_mng_process(const char *process, const int create);
-                                            /* get a process management table       */
-Ico_Uxf_Mng_Process *ico_uxf_mng_process_find(const char *process, const int pid);
-                                            /* get a process management table       */
-void ico_uxf_update_procwin(const char *appid, int type);
-                                            /* update a process management table    */
-void ico_uxf_free_procwin(Ico_Uxf_Mng_Process *prc);
-                                            /* release application windows          */
-#define ICO_UXF_WITHANIMA   0x0100          /* with animation                       */
-void ico_uxf_window_visible_control(Ico_Uxf_Mng_Window *winmng,
-                                    const int show, const int raise);
-                                            /* Window visible and cpu control       */
-int ico_uxf_gl_create_window(const int display, const int layer, const int x,
-                             const int y, const int w, const int h, const int full);
-                                            /* create window by OpenGL ES/EGL       */
-
-/* define log macros    */
-#ifndef uifw_trace
-#define uifw_trace      ICO_UXF_DEBUG
-#define uifw_critical   ICO_UXF_CRITICAL
-#define uifw_info       ICO_UXF_INFO
-#define uifw_warn       ICO_UXF_WARN
-#define uifw_error      ICO_UXF_ERROR
-#define uifw_logflush   ico_uxf_log_flush
-#endif  /*uifw_trace*/
-
-#ifdef __cplusplus
-}
-#endif
-#endif  /* _ICO_UXF_INTERNAL_H_ */
-
diff --git a/ico-app-framework/ico_uxf_window.c b/ico-app-framework/ico_uxf_window.c
deleted file mode 100644 (file)
index 2fc21ec..0000000
+++ /dev/null
@@ -1,1012 +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   header file of Window control for HomeScreen
- *
- * @date    Feb-28-2013
- */
-
-#include    <stdio.h>
-#include    <stdlib.h>
-#include    <unistd.h>
-#include    <string.h>
-#include    <signal.h>
-#include    <errno.h>
-
-#include    "ico_uxf.h"
-#include    "ico_uxf_conf.h"
-#include    "ico_uxf_private.h"
-#include    "ico_window_mgr-client-protocol.h"
-
-extern Ico_Uxf_Api_Mng         gIco_Uxf_Api_Mng;
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_visible_control: window visible control(internal function)
- *
- * @param[in]   winmng          process management table
- * @param[in]   show            show(1)/hide(0)/nochange(other)
- * @param[in]   raise           raise(1)/lower(0)/nochange(other)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-ico_uxf_window_visible_control(Ico_Uxf_Mng_Window *winmng, const int show, const int raise)
-{
-    int showshow = show & 0x0ffff;
-
-    uifw_trace("ico_uxf_window_visible_control: send visible to weston(%s,%08x,%x,%d)",
-               (winmng->mng_process)->attr.process, winmng->attr.window, showshow, raise);
-
-    if ((showshow & (~ICO_UXF_WITHANIMA)) == ICO_WINDOW_MGR_VISIBLE_SHOW)   {
-
-        if (((winmng->mng_process)->attr.invisiblecpu == 0) &&
-            ((winmng->mng_process)->attr.suspend != 0))   {
-
-            /* change to show, application resume   */
-            (winmng->mng_process)->attr.suspend = 0;
-            (winmng->mng_process)->susptimer = 0;
-            if ((winmng->mng_process)->susp)    {
-                (winmng->mng_process)->susp = 0;
-                (winmng->mng_process)->showmode = showshow;
-                (winmng->mng_process)->susptimer = ICO_UXF_SUSP_DELAY;
-                gIco_Uxf_Api_Mng.NeedTimer = 1;
-                kill((winmng->mng_process)->attr.internalid, SIGCONT);
-                uifw_trace("ico_uxf_window_visible_control: CPU resume(%s)",
-                           (winmng->mng_process)->attr.process);
-                if ((raise == ICO_WINDOW_MGR_RAISE_RAISE) ||
-                    (raise == ICO_WINDOW_MGR_RAISE_LOWER))  {
-                    ico_window_mgr_set_visible(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
-                                               winmng->attr.window,
-                                               ICO_WINDOW_MGR_V_NOCHANGE, raise, 0);
-                    if ((show & 0x00010000) == 0)   {
-                        wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-                    }
-                }
-                return;
-            }
-        }
-        else if (((winmng->mng_process)->showmode & (~ICO_UXF_WITHANIMA)) ==
-                 ICO_WINDOW_MGR_VISIBLE_SHOW)   {
-            return;
-        }
-    }
-
-    /* send visible control to Weston(Multi Window Manager)     */
-    ico_window_mgr_set_visible(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
-                               winmng->attr.window, showshow & (~ICO_UXF_WITHANIMA), raise,
-                               (showshow & ICO_UXF_WITHANIMA) ?
-                                 ICO_WINDOW_MGR_FLAGS_ANIMATION : 0);
-    if ((show & 0x00010000) == 0)   {
-        wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-    }
-    if (((showshow & (~ICO_UXF_WITHANIMA)) == ICO_WINDOW_MGR_VISIBLE_HIDE) &&
-        ((winmng->mng_process)->attr.invisiblecpu == 0) &&
-        ((winmng->mng_process)->attr.suspend == 0))   {
-        /* change to hide, application suspend  */
-        (winmng->mng_process)->attr.suspend = 1;
-        (winmng->mng_process)->showmode = showshow;
-        (winmng->mng_process)->susptimer = ICO_UXF_SUSP_DELAY;
-        gIco_Uxf_Api_Mng.NeedTimer = 1;
-        uifw_trace("ico_uxf_window_visible_control: set CPU suspend(%s)",
-                   (winmng->mng_process)->attr.process);
-    }
-    else    {
-        (winmng->mng_process)->showmode = 0xff;
-        (winmng->mng_process)->susptimer = 0;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_layer: Set window layer
- *
- * @param[in]   window          window Id
- * @param[in]   layer           layer Id
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ESRCH   error(not initialized)
- * @retval      ICO_UXF_ENOENT  error(window or layer dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_layer(const int window, const int layer)
-{
-    Ico_Uxf_Mng_Window  *winmng;
-    Ico_Uxf_Mng_Layer   *layermng;
-
-    uifw_trace("ico_uxf_window_layer: Enter(%08x,%d)", window, layer);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_window_layer: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    winmng = ico_uxf_mng_window(window, 0);
-    if ((! winmng) || (! winmng->mng_display)) {
-        uifw_warn("ico_uxf_window_layer: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-
-    layermng = ico_uxf_mng_layer(winmng->attr.display, layer, 0);
-    if ((! layermng) || (! layermng->mng_display)) {
-        uifw_warn("ico_uxf_window_layer: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-
-    uifw_trace("ico_uxf_window_layer: ico_window_mgr_set_window_layer(%08x,%d)",
-               window, layer);
-    winmng->mng_layer = layermng;
-    ico_window_mgr_set_window_layer(gIco_Uxf_Api_Mng.Wayland_WindowMgr, window, layer);
-    wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-
-    uifw_trace("ico_uxf_window_layer: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_layer_visible: Control layer visibility
- *
- * @param[in]   display         display Id
- * @param[in]   layer           layer Id
- * @param[in]   visible         layer show(1)/hide(0)
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ESRCH   error(not initialized)
- * @retval      ICO_UXF_ENOENT  error(layer dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_layer_visible(const int display, const int layer, const int visible)
-{
-    Ico_Uxf_Mng_Layer   *layermng;
-
-    uifw_trace("ico_uxf_layer_visible: Enter(%d,%d,%d)", display, layer, visible);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_layer_visible: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    layermng = ico_uxf_mng_layer(display, layer, 0);
-    if ((! layermng) || (! layermng->mng_display)) {
-        uifw_warn("ico_uxf_layer_visible: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-
-    uifw_trace("ico_uxf_layer_visible: ico_window_mgr_set_layer_visible(%d,%d)",
-               layer, visible);
-    ico_window_mgr_set_layer_visible(gIco_Uxf_Api_Mng.Wayland_WindowMgr, layer, visible);
-    wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-
-    uifw_trace("ico_uxf_layer_visible: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_resize_flag: resize window(surface) size
- *
- * @param[in]   window          window Id(same as ico_window_mgr surface Id)
- * @param[in]   w               window width
- * @param[in]   h               window height
- * @param[in]   flag            0=send resize event to client/1=no send
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ESRCH   error(not initialized)
- * @retval      ICO_UXF_ENOENT  error(layer dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_resize_flag(const int window, const int w, const int h, const int flag)
-{
-    Ico_Uxf_Mng_Window  *winmng;
-
-    uifw_trace("ico_uxf_window_resize: Enter(%08x,%d,%d,%d)", window, w, h, flag);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_window_resize: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    winmng = ico_uxf_mng_window(window, 0);
-    if ((! winmng) || (! winmng->mng_layer))   {
-        uifw_warn("ico_uxf_window_resize: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-
-    if ((w <= 0) || (w > winmng->mng_layer->attr.w) ||
-        (h <= 0) || (h > winmng->mng_layer->attr.h))   {
-        uifw_warn("ico_uxf_window_resize: Leave(EINVAL)");
-        return ICO_UXF_EINVAL;
-    }
-
-    winmng->attr.w = w;
-    winmng->attr.h = h;
-
-    ico_window_mgr_set_positionsize(gIco_Uxf_Api_Mng.Wayland_WindowMgr, window,
-                                    winmng->attr.node,
-                                    ICO_WINDOW_MGR_V_NOCHANGE, ICO_WINDOW_MGR_V_NOCHANGE,
-                                    winmng->attr.w, winmng->attr.h,
-                                      (flag ? ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE : 0));
-    wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-
-    uifw_trace("ico_uxf_window_resize: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_resize: resize window(surface) size
- *
- * @param[in]   window          window Id(same as ico_window_mgr surface Id)
- * @param[in]   w               window width
- * @param[in]   h               window height
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ESRCH   error(not initialized)
- * @retval      ICO_UXF_ENOENT  error(layer dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_resize(const int window, const int w, const int h)
-{
-    return ico_uxf_window_resize_flag(window, w, h, 0);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_move: move window(surface) geometry
- *
- * @param[in]   window          window Id(same as ico_window_mgr surface Id)
- * @param[in]   x               window upper-left X coodinate of display
- * @param[in]   y               window upper-left Y coodinate of display
- * @param[in]   animation       move with animation(=1)/no animation(=0)
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ESRCH   error(not initialized)
- * @retval      ICO_UXF_ENOENT  error(layer dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_move(const int window, const int x, const int y, const int animation)
-{
-    Ico_Uxf_Mng_Window  *winmng;
-
-    uifw_trace("ico_uxf_window_move: Enter(%08x,%d,%d,%d)", window, x, y, animation);
-
-    if(gIco_Uxf_Api_Mng.Initialized <= 0)   {
-        uifw_warn("ico_uxf_window_move: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    winmng = ico_uxf_mng_window(window, 0);
-    if ((! winmng) || (! winmng->mng_layer))   {
-        uifw_warn("ico_uxf_window_move: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-
-    winmng->attr.x = x;
-    winmng->attr.y = y;
-
-    ico_window_mgr_set_positionsize(gIco_Uxf_Api_Mng.Wayland_WindowMgr, window,
-                                    winmng->attr.node, winmng->attr.x, winmng->attr.y,
-                                    ICO_WINDOW_MGR_V_NOCHANGE, ICO_WINDOW_MGR_V_NOCHANGE,
-                                    ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE |
-                                    ((animation != 0) ? ICO_WINDOW_MGR_FLAGS_ANIMATION : 0));
-    wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-
-    uifw_trace("ico_uxf_window_move: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_raise: raise window(surface)
- *
- * @param[in]   window          window Id(same as ico_window_mgr surface Id)
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ESRCH   error(not initialized)
- * @retval      ICO_UXF_ENOENT  error(layer dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_raise(const int window)
-{
-    Ico_Uxf_Mng_Window  *winmng;
-
-    uifw_trace("ico_uxf_window_raise: Enter(%08x)", window);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_window_raise: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    winmng = ico_uxf_mng_window(window, 0);
-    if ((! winmng) || (! winmng->mng_display)) {
-        uifw_warn("ico_uxf_window_raise: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-
-    ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_V_NOCHANGE,
-                                   ICO_WINDOW_MGR_RAISE_RAISE);
-
-    uifw_trace("ico_uxf_window_raise: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_lower: lower window(surface)
- *
- * @param[in]   window          window Id(same as ico_window_mgr surface Id)
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ESRCH   error(not initialized)
- * @retval      ICO_UXF_ENOENT  error(layer dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_lower(const int window)
-{
-    Ico_Uxf_Mng_Window  *winmng;
-
-    uifw_trace("ico_uxf_window_lower: Enter(%08x)", window);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_window_lower: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    winmng = ico_uxf_mng_window(window, 0);
-    if ((! winmng) || (! winmng->mng_display)) {
-        uifw_warn("ico_uxf_window_lower: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-
-    ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_V_NOCHANGE,
-                                   ICO_WINDOW_MGR_RAISE_LOWER);
-
-    uifw_trace("ico_uxf_window_lower: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_active: active window(surface)
- *
- * @param[in]   window          window Id(same as ico_window_mgr surface Id)
- * @param[in]   target          target(pointer and/or keyboard)
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ESRCH   error(not initialized)
- * @retval      ICO_UXF_ENOENT  error(layer dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_active(const int window, const int target)
-{
-    Ico_Uxf_Mng_Window  *winmng;
-    Ico_Uxf_Mng_Process *proc;
-    Ico_Uxf_Mng_Process *aproc;
-    int                 hash;
-
-    uifw_trace("ico_uxf_window_active: Enter(%08x,%x)", window, target);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_window_active: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    winmng = ico_uxf_mng_window(window, 0);
-    if ((! winmng) || (! winmng->mng_display)) {
-        uifw_warn("ico_uxf_window_active: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-
-    uifw_trace("ico_uxf_window_active: ico_window_mgr_set_active(%08x)", window);
-    ico_window_mgr_set_active(gIco_Uxf_Api_Mng.Wayland_WindowMgr, window, target);
-    wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-
-    /* reset all active window widthout target window   */
-    for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++)   {
-        winmng = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
-        while (winmng) {
-            if (winmng->attr.window == window)  {
-                winmng->attr.active = target;
-            }
-            else    {
-                if (target == 0)    {
-                    winmng->attr.active = 0;
-                }
-                else    {
-                    winmng->attr.active &= ~target;
-                }
-            }
-            winmng = winmng->nextidhash;
-        }
-    }
-
-    /* reset all active application without this application    */
-    aproc = NULL;
-    for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++)    {
-        proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
-        while (proc)    {
-            if (proc->attr.mainwin.window == window)    {
-                aproc = proc;
-            }
-            else    {
-                if (target == 0)    {
-                    proc->attr.active = 0;
-                }
-                else    {
-                    proc->attr.active &= ~target;
-                }
-            }
-            proc = proc->nextidhash;
-        }
-    }
-    if (aproc)  {
-        aproc->attr.active = target;
-    }
-    uifw_trace("ico_uxf_window_active: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_event_mask: set window(surface) event mask
- *
- * @param[in]   window          window Id(same as ico_window_mgr surface Id)
- * @param[in]   mask            event mask
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ESRCH   error(not initialized)
- * @retval      ICO_UXF_ENOENT  error(layer dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_event_mask(const int window, const unsigned int mask)
-{
-    Ico_Uxf_Mng_Window  *winmng;
-
-    uifw_trace("ico_uxf_window_event_mask: Enter(%08x,%08x)", window, mask);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_window_event_mask: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    winmng = ico_uxf_mng_window(window, 0);
-    if (! winmng)  {
-        uifw_warn("ico_uxf_window_event_mask: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-
-    winmng->attr.eventmask = mask;
-
-    uifw_trace("ico_uxf_window_event_mask: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_attribute_get: get window(surface) attribute
- *
- * @param[in]   window          window Id(same as ico_window_mgr surface Id)
- * @param[out]  attr            window attribute
- * @return      result
- * @retval      ICO_UXF_EOK     success
- * @retval      ICO_UXF_ESRCH   error(not initialized)
- * @retval      ICO_UXF_ENOENT  error(layer dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_attribute_get(const int window, Ico_Uxf_WindowAttr *attr)
-{
-    Ico_Uxf_Mng_Window  *winmng;
-
-    uifw_trace("ico_uxf_window_attribute_get: Enter(%08x)", window);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_window_attribute_get: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    winmng = ico_uxf_mng_window(window, 0);
-    if (! winmng)  {
-        uifw_warn("ico_uxf_window_attribute_get: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-
-    memcpy((char *)attr, (char *)&(winmng->attr), sizeof(Ico_Uxf_WindowAttr));
-
-    uifw_trace("ico_uxf_window_attribute_get: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_query_windows: get all windows attribute
- *
- * @param[in]   display         target display Id
- * @param[out]  attr            window attribute array
- * @param[in]   num             number of window attribute area
- * @return      result
- * @retval      >= 0            success(number of windows)
- * @retval      ICO_UXF_ESRCH   error(not initialized)
- * @retval      ICO_UXF_EINVAL  error(illegal parameter 'num')
- * @retval      ICO_UXF_E2BIG   error(number of windows over 'num')
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_query_windows(const int display, Ico_Uxf_WindowAttr attr[], const int num)
-{
-    int                 n;
-    Ico_Uxf_Mng_Window  *winmng;
-    int                 hash;
-
-    uifw_trace("ico_uxf_window_query_windows: Enter(%d,,%d)", display, num);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_window_query_windows: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    if (num <= 0)  {
-        uifw_warn("ico_uxf_window_query_windows: Leave(EINVAL)");
-        return ICO_UXF_EINVAL;
-    }
-
-    n = 0;
-    for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++)   {
-        winmng = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
-        while (winmng) {
-            if (n >= num)      break;
-            memcpy((char *)(&attr[n]), (char *)&(winmng->attr), sizeof(Ico_Uxf_WindowAttr));
-            n ++;
-            winmng = winmng->nextidhash;
-        }
-        if (winmng)    break;
-    }
-    if (winmng)    {
-        n = ICO_UXF_E2BIG;
-        uifw_trace("ico_uxf_window_query_windows: Leave(E2BIG)");
-    }
-    else    {
-        uifw_trace("ico_uxf_window_query_windows: Leave(%d)", n);
-    }
-    return n;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_control: target window control from AppsController
- *
- * @param[in]   appid       Application Id
- * @param[in]   winidx      Window index
- * @param[in]   control     Window control
- *                            ICO_UXF_APPSCTL_INVISIBLE:   Invisible by low priority
- *                            ICO_UXF_APPSCTL_REGULATION:  Invisible by regulation
- *                            ICO_UXF_APPSCTL_TEMPVISIBLE: Visible as HomeScreen menu
- * @param[in]   onoff       Flag On(1)/Off(0)
- *                            ICO_UXF_APPSCTL_INVISIBLE:   On(1) is invisible
- *                            ICO_UXF_APPSCTL_REGULATION:  On(1) is invisible
- *                            ICO_UXF_APPSCTL_TEMPVISIBLE: On(1) is visible(menu)
- * @return  result
- * @retval  ICO_UXF_EOK         success
- * @retval  ICO_UXF_ESRCH       error(not initialized)
- * @retval  ICO_UXF_ENOENT      error(not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_control(const char *appid, const int winidx,
-                       const int control, const int onoff)
-{
-#define MAX_APP_WINDOWS 20
-    Ico_Uxf_ProcessWin  procattr[MAX_APP_WINDOWS];
-    int         nwin;
-    Ico_Uxf_Mng_Window  *winmng;            /* window management table      */
-    int         hash;
-    int         newcontrol;
-    int         i;
-
-    uifw_trace("ico_uxf_window_control: Enter(%s,%d,%x,%d)",
-               appid, winidx, control, onoff);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0)  {
-        uifw_warn("ico_uxf_window_control: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    if (control == ICO_UXF_APPSCTL_TEMPVISIBLE) {
-        if (onoff != gIco_Uxf_Api_Mng.AppsCtlVisible)   {
-            if (onoff > 0)  gIco_Uxf_Api_Mng.AppsCtlVisible = 1;
-            else            gIco_Uxf_Api_Mng.AppsCtlVisible = 0;
-
-            /* control all windows          */
-            for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++)    {
-                winmng = gIco_Uxf_Api_Mng.Hash_WindowId[hash];
-                while (winmng)  {
-                    if ((winmng->attr.window > 0) && (winmng->attr.visible))    {
-                        if ((winmng->mng_process)->attr.noicon == 0)    {
-                            if ((gIco_Uxf_Api_Mng.AppsCtlVisible != 0) ||
-                                (winmng->attr.control == 0))    {
-                                i = ICO_WINDOW_MGR_VISIBLE_SHOW;
-                            }
-                            else    {
-                                i = ICO_WINDOW_MGR_VISIBLE_HIDE;
-                            }
-                        }
-                        else    {
-                            if ((gIco_Uxf_Api_Mng.AppsCtlVisible == 0) &&
-                                (winmng->attr.control == 0))    {
-                                i = ICO_WINDOW_MGR_VISIBLE_SHOW;
-                            }
-                            else    {
-                                i = ICO_WINDOW_MGR_VISIBLE_HIDE;
-                            }
-                        }
-                        ico_uxf_window_visible_control(winmng, i | 0x00010000,
-                                                       ICO_WINDOW_MGR_V_NOCHANGE);
-                    }
-                    winmng = winmng->nextidhash;
-                }
-            }
-            wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
-        }
-        uifw_trace("ico_uxf_window_control: Leave(EOK)");
-    }
-    else    {
-        /* get current application status       */
-        if (winidx >= 0)    {
-            if (ico_uxf_process_window_get_one(appid, procattr, winidx) == ICO_UXF_EOK) {
-                nwin = 1;
-            }
-            else    {
-                nwin = 0;
-            }
-        }
-        else    {
-            /* all window           */
-            nwin = ico_uxf_process_window_get(appid, procattr, MAX_APP_WINDOWS);
-        }
-        if ((nwin == ICO_UXF_E2BIG) || (nwin > MAX_APP_WINDOWS))  nwin = MAX_APP_WINDOWS;
-        if (nwin < 0)  {
-            uifw_trace("ico_uxf_window_control: Leave(Unknown appid(%s))", appid);
-            return ICO_UXF_ENOENT;
-        }
-        for (i = 0; i < nwin; i++)  {
-            if (procattr[i].window == 0)    continue;
-            winmng = ico_uxf_mng_window(procattr[i].window, 0);
-            if (! winmng)   {
-                uifw_trace("ico_uxf_window_control: winid=%08x not exist",
-                           procattr[i].window);
-                continue;
-            }
-            newcontrol = winmng->attr.control;
-            if (onoff)  newcontrol |= control;
-            else        newcontrol &= (~control);
-
-            uifw_trace("ico_uxf_window_control: control %08x(%s) %02x=>%02x vis=%d icon=%d",
-                       procattr[i].window, (winmng->mng_process)->attr.process,
-                       winmng->attr.control, newcontrol, winmng->attr.visible,
-                       (winmng->mng_process)->attr.noicon);
-            if (winmng->attr.control != newcontrol) {
-                winmng->attr.control = newcontrol;
-                if (winmng->attr.visible != 0)  {
-                    if ((gIco_Uxf_Api_Mng.AppsCtlVisible != 0) &&
-                        (((winmng->mng_process)->appconf == NULL) ||
-                         ((((Ico_Uxf_conf_application *)(winmng->mng_process)->appconf)->
-                           menuoverlap == 0) &&
-                          (winmng->mng_layer->attr.menuoverlap == 0)))) {
-                        if ((winmng->mng_process)->attr.noicon == 0)    newcontrol = 0;
-                        else                                            newcontrol = 1;
-                    }
-                    /* request to Weston(Multi Window Manager)  */
-                    if (newcontrol == 0)    {
-                        i = ICO_WINDOW_MGR_VISIBLE_SHOW;
-                        if (gIco_Uxf_Api_Mng.Win_Show_Anima)
-                            i |= ICO_UXF_WITHANIMA;
-                    }
-                    else    {
-                        i = ICO_WINDOW_MGR_VISIBLE_HIDE;
-                        if (gIco_Uxf_Api_Mng.Win_Hide_Anima)
-                            i |= ICO_UXF_WITHANIMA;
-                    }
-                    ico_uxf_window_visible_control(winmng, i,
-                                                   ICO_WINDOW_MGR_V_NOCHANGE);
-                }
-            }
-            uifw_trace("ico_uxf_window_control: Leave(EOK) control=%x(%d) visible=%d",
-                       winmng->attr.control, gIco_Uxf_Api_Mng.AppsCtlVisible,
-                       winmng->attr.visible);
-        }
-    }
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_control: target window control from AppsController
- *
- * @param[in]   control     Control Target(0=Hide/1=Show)
- * @param[in]   animation   Animation(0=Without Animation/1=With Animation)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API void
-ico_uxf_window_animation_control(const int control, const int animation)
-{
-    uifw_trace("ico_uxf_window_animation_control: %s to %s",
-        control ? "Show" : "Hide", animation ? "Animation" : "No Animation");
-    if (control)    {
-        gIco_Uxf_Api_Mng.Win_Show_Anima = animation;
-    }
-    else    {
-        gIco_Uxf_Api_Mng.Win_Hide_Anima = animation;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_show: show a target window
- *          if target window's state is visible, do nothing and return success
- *
- * @param[in]   window      Window identity
- * @return  result
- * @retval  ICO_UXF_EOK         success
- * @retval  ICO_UXF_ESRCH       error(not initialized)
- * @retval  ICO_UXF_ENOENT      error(not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_show(const int window)
-{
-    Ico_Uxf_Mng_Window  *winmng;            /* window management table      */
-
-    uifw_trace("ico_uxf_window_show: Enter(%08x)", window);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_window_show: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    winmng = ico_uxf_mng_window(window, 0);
-    if ((! winmng) || (! winmng->mng_display)) {
-        uifw_warn("ico_uxf_window_show: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-    winmng->attr.visible = 1;
-
-    if (winmng->attr.control == 0)  {
-        /* request to display to Weston(Multi Window Manager)   */
-        ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_VISIBLE_SHOW,
-                                       ICO_WINDOW_MGR_V_NOCHANGE);
-    }
-    uifw_trace("ico_uxf_window_show: Leave(EOK) control=%x", winmng->attr.control);
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_hide: hide a target window
- *          if target window's state is unvisible, do nothing and return success
- *
- * @param[in]   window      target window identity
- * @return  result
- * @retval  ICO_UXF_EOK         success
- * @retval  ICO_UXF_ESRCH       error(not initialized)
- * @retval  ICO_UXF_ENOENT      error(not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_hide(const int window)
-{
-    Ico_Uxf_Mng_Window  *winmng;            /* window management table      */
-
-    uifw_trace("ico_uxf_window_hide: Enter(%08x)", window);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_window_hide: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    winmng = ico_uxf_mng_window(window, 0);
-    if ((! winmng) || (! winmng->mng_display)) {
-        uifw_warn("ico_uxf_window_hide: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-    winmng->attr.visible = 0;
-
-    /* request to hide to Weston(Multi Window Manager)  */
-    ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_VISIBLE_HIDE,
-                                   ICO_WINDOW_MGR_V_NOCHANGE);
-
-    uifw_trace("ico_uxf_window_hide: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_visible_raise: control status of visible(show/hide)
- *                                        and order(raise/lower)
- *
- * @param[in]   window      target window identity
- * @param[in]   visible     visible(1)/unvisible(0)/nochange(other)
- * @param[in]   raise       forefront(1)/maximum back(0)/nochange(other)
- * @return  result
- * @retval  ICO_UXF_EOK         success
- * @retval  ICO_UXF_ESRCH       error(not initialized)
- * @retval  ICO_UXF_ENOENT      error(not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_visible_raise(const int window, const int visible, const int raise)
-{
-    Ico_Uxf_Mng_Window  *winmng;            /* window management table      */
-    int                 vis = visible;
-    int                 rai = raise;
-
-    uifw_trace("ico_uxf_window_visible_raise: Enter(%08x,%d,%d)", window, visible, raise);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0)  {
-        uifw_warn("ico_uxf_window_visible_raise: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    winmng = ico_uxf_mng_window(window, 0);
-    if ((! winmng) || (! winmng->mng_display))  {
-        uifw_warn("ico_uxf_window_visible_raise: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-
-    if (vis == 0)   {
-        winmng->attr.visible = 0;
-        vis = ICO_WINDOW_MGR_VISIBLE_HIDE;
-    }
-    else if (vis == 1)  {
-        winmng->attr.visible = 1;
-        vis = ICO_WINDOW_MGR_VISIBLE_SHOW;
-        if (gIco_Uxf_Api_Mng.AppsCtlVisible == 0)   {
-            /* application screen       */
-            if (winmng->attr.control != 0)  {
-                uifw_trace("ico_uxf_window_visible_raise: change to hide(ctrl=%x menu=0)",
-                           winmng->attr.control);
-                vis = ICO_WINDOW_MGR_VISIBLE_HIDE;
-            }
-        }
-        else    {
-            /* HomeScreen menu screen   */
-            if ((winmng->mng_process)->attr.noicon != 0)    {
-                uifw_trace("ico_uxf_window_visible_raise: change to hide(ctrl=%x menu=1)",
-                           winmng->attr.control);
-                vis = ICO_WINDOW_MGR_VISIBLE_HIDE;
-            }
-        }
-    }
-    else    {
-        vis = ICO_WINDOW_MGR_V_NOCHANGE;
-    }
-    if (raise == 0) {
-        rai = ICO_WINDOW_MGR_RAISE_LOWER;
-    }
-    else if (raise == 1)    {
-        rai = ICO_WINDOW_MGR_RAISE_RAISE;
-    }
-    else    {
-        rai = ICO_WINDOW_MGR_V_NOCHANGE;
-    }
-
-    if ((vis != ICO_WINDOW_MGR_V_NOCHANGE) ||
-        (rai != ICO_WINDOW_MGR_V_NOCHANGE)) {
-        /* request to visible status and order status to Weston(Multi Window Manager)   */
-        ico_uxf_window_visible_control(winmng, vis, rai);
-    }
-    uifw_trace("ico_uxf_window_visible_raise: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_visible_animation: show/hide a target window with animation
- *
- * @param[in]   window      Window identity
- * @param[in]   show        Show(1)/Hide(0)
- * @return  result
- * @retval  ICO_UXF_EOK         success
- * @retval  ICO_UXF_ESRCH       error(not initialized)
- * @retval  ICO_UXF_ENOENT      error(not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_visible_animation(const int window, const int show)
-{
-    Ico_Uxf_Mng_Window  *winmng;            /* window management table      */
-
-    uifw_trace("ico_uxf_window_visible_animation: Enter(%08x,%d)", window, show);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_window_visible_animation: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    winmng = ico_uxf_mng_window(window, 0);
-    if ((! winmng) || (! winmng->mng_display)) {
-        uifw_warn("ico_uxf_window_visible_animation: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-    winmng->attr.visible = show ? 1 : 0;
-
-    if (show)   {
-        if (winmng->attr.control == 0)  {
-            /* request to display to Weston(Multi Window Manager)   */
-            ico_uxf_window_visible_control(winmng,
-                                           ICO_WINDOW_MGR_VISIBLE_SHOW|ICO_UXF_WITHANIMA,
-                                           ICO_WINDOW_MGR_V_NOCHANGE);
-        }
-    }
-    else    {
-        ico_uxf_window_visible_control(winmng,
-                                       ICO_WINDOW_MGR_VISIBLE_HIDE|ICO_UXF_WITHANIMA,
-                                       ICO_WINDOW_MGR_V_NOCHANGE);
-    }
-    uifw_trace("ico_uxf_window_visible_animation: Leave(EOK) control=%x",
-               winmng->attr.control);
-    return ICO_UXF_EOK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ico_uxf_window_animation: set window animation
- *
- * @param[in]   window              Window identity
- * @param[in]   type                Target animation type,
- * @param[in]   animation           Animation name, if NULL, no change
- * @param[in]   time                Animation time(ms), if 0, default time
- * @return  result
- * @retval  ICO_UXF_EOK         success
- * @retval  ICO_UXF_ESRCH       error(not initialized)
- * @retval  ICO_UXF_ENOENT      error(not exist)
- */
-/*--------------------------------------------------------------------------*/
-ICO_APF_API int
-ico_uxf_window_animation(const int window, const int type,
-                         const char *animation, const int time)
-{
-    Ico_Uxf_Mng_Window  *winmng;            /* window management table      */
-
-    uifw_trace("ico_uxf_window_animation: Enter(%08x,%x,%s,%d)",
-               window, type, animation ? animation : "NULL", time);
-
-    if (gIco_Uxf_Api_Mng.Initialized <= 0) {
-        uifw_warn("ico_uxf_window_animation: Leave(ESRCH)");
-        return ICO_UXF_ESRCH;
-    }
-
-    winmng = ico_uxf_mng_window(window, 0);
-    if ((! winmng) || (! winmng->mng_display)) {
-        uifw_warn("ico_uxf_window_animation: Leave(ENOENT)");
-        return ICO_UXF_ENOENT;
-    }
-
-    if (animation)  {
-        ico_window_mgr_set_animation(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
-                                     winmng->attr.window, type, animation, time);
-    }
-    else    {
-        ico_window_mgr_set_animation(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
-                                     winmng->attr.window, type, " ", time);
-    }
-    uifw_trace("ico_uxf_window_animation: Leave(EOK)");
-    return ICO_UXF_EOK;
-}
-
diff --git a/ico-app-framework/test/Makefile.am b/ico-app-framework/test/Makefile.am
deleted file mode 100644 (file)
index 9a59af8..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-lib_LTLIBRARIES = libico-app-fw.la     \
-                               libico-app-fw-efl.la
-
-#include_HEADERS =     \
-#      ico_apf.h                                       \
-#      ico_apf_error.h                         \
-#      ico_apf_resource_control.h      \
-#      ico_apf_ecore.h
-       
-noinst_PROGRAMS =      \
-       test_server             \
-       test_client
-
-libico_app_fw_la_CFLAGS = -I../include -I/usr/include/ico-uxf-weston-plugin $(AUL_CFLAGS) @GLIB_CFLAGS@
-libico_app_fw_la_LDFLAGS = -version-info 0:5:0
-libico_app_fw_la_SOURCES =          \
-       ico_syc_log.c                           \
-       ico_uxfw_conf_common.c          \
-       ico_uxfw_conf_sys.c                     \
-       ico_uxfw_conf_app.c                     \
-       ico_uxfw_init.c                         \
-       ico_uxfw_launcher.c                     \
-       ico_uxfw_window.c                       \
-       ico_apf_communication.c         \
-       ico_apf_resource_control.c      \
-       ico_apf_appmgr.c
-
-libico_app_fw_efl_la_CFLAGS = -I../include $(EFL_CFLAGS) @GLIB_CFLAGS@
-libico_app_fw_efl_la_LDFLAGS = -version-info 0:5:0
-libico_app_fw_efl_la_SOURCES =          \
-       ico_apf_ecore.c
-
-AM_CFLAGS = $(GCC_CFLAGS)
-AM_CPPFLAGS = $(GCC_CFLAGS)    \
-       -DDATADIR='"$(datadir)"'                \
-       -DMODULEDIR='"$(moduledir)"'            \
-       -DLIBEXECDIR='"$(libexecdir)"'
-AM_LDFLAGS = -module -avoid-version -rpath $(libdir) -lwayland-egl -lEGL -lGLESv2
-
-check_PROGRAMS =       test_client
-
-test_client_lib = ./.libs/libico-app-fw-efl.so ./.libs/libico-app-fw.so  -lico-uxf-weston-plugin -laul
-test_server_lib = ./.libs/libico-app-fw-efl.so ./.libs/libico-app-fw.so  -lico-uxf-weston-plugin -laul
-test_efl_libs = -lecore_evas -lecore -levas -lecore_wayland -lelementary
-
-test_client_SOURCE = test_client.c
-test_client_CFLAGS = -I../include $(EFL_CFLAGS) @GLIB_CFLAGS@
-test_client_LDADD = $(test_client_lib) $(test_efl_libs) -lwebsockets -lrt -lm
-
-test_server_SOURCE = test_client.c
-test_server_CFLAGS = -I../include $(EFL_CFLAGS) @GLIB_CFLAGS@
-test_server_LDADD = $(test_server_lib) $(test_efl_libs) -lwebsockets -lrt -lm
-
-.FORCE :
-
diff --git a/ico-app-framework/test/gotest_client.sh b/ico-app-framework/test/gotest_client.sh
deleted file mode 100755 (executable)
index cd2c993..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-export LD_LIBRARY_PATH=./.libs:$LD_LIBRARY_PATH
-./test_client
-
diff --git a/ico-app-framework/test/gotest_server.sh b/ico-app-framework/test/gotest_server.sh
deleted file mode 100755 (executable)
index f38d6ff..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-export LD_LIBRARY_PATH=./.libs:$LD_LIBRARY_PATH
-./test_server
-
diff --git a/ico-app-framework/test/test_client.c b/ico-app-framework/test/test_client.c
deleted file mode 100644 (file)
index 29acf48..0000000
+++ /dev/null
@@ -1,287 +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   client program for application resource control test
- *
- * @date    Feb-28-2013
- */
-#ifdef HAVE_CONFIG_H
-#undef HAVE_CONFIG_H
-#endif
-
-#ifdef HAVE_CONFIG_H
-
-#include "config.h"
-#else
-#define __UNUSED__
-#define PACKAGE_EXAMPLES_DIR "."
-#endif
-
-#include <Ecore.h>
-#include <Ecore_Evas.h>
-#include <stdio.h>
-#include "ico_apf.h"
-#include "ico_apf_ecore.h"
-#include "ico_uxfw_conf.h"
-
-#define WIDTH  (520)
-#define HEIGHT (380)
-
-static int  loop = 0;
-
-static Ecore_Evas *ee;
-static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png";
-
-static void
-_on_destroy(Ecore_Evas *ee __UNUSED__)
-{
-    ecore_main_loop_quit();
-}
-
-static int  callno = 0;
-
-static void
-send_command(const int cno)
-{
-    int     ret = 0;
-    char    device[32];
-
-    sprintf(device, "Dev%03d", cno+1);
-
-    switch (cno)    {
-    case 0:
-        ret = ico_apf_resource_get_screen_mode(device, cno+101);
-        break;
-    case 1:
-        ret = ico_apf_resource_release_screen_mode(device, cno+101);
-        break;
-    case 2:
-        ret = ico_apf_resource_get_int_screen_mode(device, cno+201, cno+101);
-        break;
-    case 3:
-        ret = ico_apf_resource_get_int_screen_mode_disp(device, cno+101);
-        break;
-    case 4:
-        ret = ico_apf_resource_release_int_screen_mode(device, cno+201, cno+101);
-        break;
-    case 5:
-        ret = ico_apf_resource_release_int_screen_mode_disp(device, cno+101);
-        break;
-    case 6:
-        ret = ico_apf_resource_get_sound_mode(device, cno+101, cno+301);
-        break;
-    case 7:
-        ret = ico_apf_resource_release_sound_mode(device, cno+101);
-        break;
-    case 8:
-        ret = ico_apf_resource_get_int_sound_mode(device, cno+101, cno+301);
-        break;
-    case 9:
-        ret = ico_apf_resource_release_int_sound_mode(device, cno+101);
-        break;
-    case 10:
-        ret = ico_apf_resource_add_input_event(device, cno+101);
-        break;
-    case 11:
-        ret = ico_apf_resource_change_input_event(device, cno+101);
-        break;
-    case 12:
-        ret = ico_apf_resource_delete_input_event(device, cno+101);
-        break;
-    default:
-        break;
-    }
-
-    if (ret == 0)   {
-        printf("## Client send command(%d) dev=%s\n", cno, device);
-    }
-    else    {
-        printf("## Client send command(%d) Error[%d]\n", cno, ret);
-    }
-    fflush(stdout);
-}
-
-static void
-res_callback(ico_apf_resource_notify_info_t* info, void *user_data)
-{
-    printf("##==> Client callbacked! evt=%d res=%d id=%d bid=%d appid=%s "
-           "dev=%s user_data=%d\n",
-           info->state, info->resid, info->id, info->bid, info->appid,
-           info->device, (int)user_data);
-    fflush(stdout);
-
-    callno ++;
-    if ((loop !=0) && (callno > 12))    {
-        callno = 0;
-    }
-    if (callno <= 12)   {
-        send_command(callno);
-    }
-}
-
-int
-main(int argc, char *argv[])
-{
-    Evas *canvas, *sub_canvas;
-    Evas_Object *bg, *r1, *r2, *r3; /* "sub" canvas objects */
-    Evas_Object *border, *img; /* canvas objects */
-    Ecore_Evas *sub_ee;
-    int     i;
-    int     width;
-    int     height;
-    unsigned int    color;
-    int     r, g, b, a;
-    int     appno = 1;
-    int     no_callback = 0;
-    char    sTitle[64];
-
-    width = WIDTH;
-    height = HEIGHT;
-    color = 0xc0c0c0c0;
-    for (i = 1; i < argc; i++)  {
-        if (argv[i][0] == '@')  {
-            appno = strtol(&argv[i][1], (char **)0, 0);
-        }
-        if (argv[i][0] != '-')  continue;
-        if (strncasecmp(argv[i], "-width=", 7) == 0)    {
-            width = strtol(&argv[i][7], (char **)0, 0);
-        }
-        else if (strncasecmp(argv[i], "-height=", 8) == 0)  {
-            height = strtol(&argv[i][8], (char **)0, 0);
-        }
-        else if (strncasecmp(argv[i], "-color=", 7) == 0)   {
-            color = strtoul(&argv[i][7], (char **)0, 0);
-        }
-        else if (strncasecmp(argv[i], "-nocb", 5) == 0)   {
-            no_callback = 1;
-        }
-        else if (strncasecmp(argv[i], "-loop", 5) == 0)   {
-            loop = 1;
-        }
-    }
-
-    ecore_evas_init();
-
-    /* configuration test   */
-    (void)ico_uxf_getSysConfig();
-    (void)ico_uxf_getAppConfig();
-
-    if( ico_apf_ecore_init(NULL) != ICO_APF_E_NONE) {
-        fprintf(stderr, "ico_apf_ecore_init() Error\n"); fflush(stderr);
-        ecore_evas_shutdown();
-        return -1;
-    }
-    if (no_callback == 0)   {
-        ico_apf_resource_set_event_cb(res_callback, (void*)1);
-    }
-
-    /* this will give you a window with an Evas canvas under the first engine available */
-    ee = ecore_evas_new(NULL, 0, 0, width, height, "frame=0");
-    if (!ee) goto error;
-
-    ecore_evas_size_min_set(ee, width, height);
-    ecore_evas_size_max_set(ee, width, height);
-
-    ecore_evas_callback_delete_request_set(ee, _on_destroy);
-    sprintf(sTitle, "EFL Native Application %d", appno);
-    ecore_evas_title_set(ee, sTitle);
-    ecore_evas_show(ee);
-
-    canvas = ecore_evas_get(ee);
-
-    bg = evas_object_rectangle_add(canvas);
-    r = (color>>16)&0x0ff;
-    g = (color>>8)&0x0ff;
-    b = color&0x0ff;
-    a = (color>>24)&0x0ff;
-    if (a != 255)   {
-        r = (r * a) / 255;
-        g = (g * a) / 255;
-        b = (b * a) / 255;
-    }
-    evas_object_color_set(bg, r, g, b, a); /* bg color */
-    evas_object_move(bg, 0, 0); /* at origin */
-    evas_object_resize(bg, width, height); /* covers full canvas */
-    evas_object_show(bg);
-
-    /* this is a border around the image containing a scene of another * canvas */
-    border = evas_object_image_filled_add(canvas);
-    evas_object_image_file_set(border, border_img_path, NULL);
-    evas_object_image_border_set(border, 3, 3, 3, 3);
-    evas_object_image_border_center_fill_set(border, EVAS_BORDER_FILL_NONE);
-
-    evas_object_move(border, width / 6, height / 6);
-    evas_object_resize(border, (2 * width) / 3, (2 * height) / 3);
-    evas_object_show(border);
-
-    img = ecore_evas_object_image_new(ee);
-    evas_object_image_filled_set(img, EINA_TRUE);
-    evas_object_image_size_set(
-        img, ((2 * width) / 3) - 6, ((2 * height) / 3) - 6);
-    sub_ee = ecore_evas_object_ecore_evas_get(img);
-    sub_canvas = ecore_evas_object_evas_get(img);
-
-    evas_object_move(img, (width / 6) + 3, (height / 6) + 3);
-
-    /* apply the same size on both! */
-    evas_object_resize(img, ((2 * width) / 3) - 6, ((2 * height) / 3) - 6);
-    ecore_evas_resize(sub_ee, ((2 * width) / 3) - 6, ((2 * height) / 3) - 6);
-
-    r1 = evas_object_rectangle_add(sub_canvas);
-    evas_object_color_set(r1, g, b, r, 255);
-    evas_object_move(r1, 10, 10);
-    evas_object_resize(r1, 100, 100);
-    evas_object_show(r1);
-
-    r2 = evas_object_rectangle_add(sub_canvas);
-    evas_object_color_set(r2, b/2, g/2, r/2, 128);
-    evas_object_move(r2, 10, 10);
-    evas_object_resize(r2, 50, 50);
-    evas_object_show(r2);
-
-    r3 = evas_object_rectangle_add(sub_canvas);
-    evas_object_color_set(r3, b, r, g, 255);
-    evas_object_move(r3, 60, 60);
-    evas_object_resize(r3, 50, 50);
-    evas_object_show(r3);
-
-    evas_object_show(img);
-
-    /* get screen           */
-    send_command(0);
-    if (no_callback)    {
-        int     ii;
-
-        for (ii = 1; ii <= 12; ii++)    {
-            send_command(ii);
-        }
-
-        /* check receive buffer overflow    */
-        for (ii = 0; ii <  64; ii++)    {
-            send_command(ii);
-        }
-    }
-
-    ecore_main_loop_begin();
-
-    ico_apf_ecore_term();
-
-    ecore_evas_free(ee);
-    ecore_evas_shutdown();
-
-    return 0;
-
-error:
-    fprintf(stderr, "You got to have at least one Evas engine built"
-                    " and linked up to ecore-evas for this example to run"
-                    " properly.\n");
-    ecore_evas_shutdown();
-    return -1;
-}
-
diff --git a/ico-app-framework/test/test_server.c b/ico-app-framework/test/test_server.c
deleted file mode 100644 (file)
index f259285..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-/**
- * @brief   server(HomeScreen) program for application control
- *
- * @date    Feb-28-2013
- */
-#ifdef HAVE_CONFIG_H
-#undef HAVE_CONFIG_H
-#endif
-
-#ifdef HAVE_CONFIG_H
-
-#include "config.h"
-#else
-#define __UNUSED__
-#define PACKAGE_EXAMPLES_DIR "."
-#endif
-
-#include <Ecore.h>
-#include <Ecore_Evas.h>
-#include <stdio.h>
-#include "ico_apf.h"
-#include "ico_apf_ecore.h"
-
-#define WIDTH  (520)
-#define HEIGHT (380)
-
-static Ecore_Evas *ee;
-static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png";
-
-static void
-_on_destroy(Ecore_Evas *ee __UNUSED__)
-{
-    ecore_main_loop_quit();
-}
-
-static void
-res_callback(ico_apf_resource_notify_info_t* info, void *user_data)
-{
-    printf("##==> Server callbacked! cmd=%d res=%d id=%d bid=%d appid=%s "
-           "dev=%s user_data=%d\n",
-           info->state, info->resid, info->id, info->bid, info->appid,
-           info->device, (int)user_data);
-    fflush(stdout);
-
-    if ((info->state == ICO_APF_RESOURCE_COMMAND_GET) ||
-        (info->state == ICO_APF_RESOURCE_COMMAND_RELEASE) ||
-        (info->state == ICO_APF_RESOURCE_COMMAND_ADD) ||
-        (info->state == ICO_APF_RESOURCE_COMMAND_CHANGE) ||
-        (info->state == ICO_APF_RESOURCE_COMMAND_DELETE))   {
-        switch (info->id % 4)   {
-        case 0:
-            ico_apf_resource_send_to_client(
-                    info->appid, ICO_APF_RESOURCE_STATE_ACQUIRED, info->resid,
-                    info->device[0] ? info->device : "UnKnown", info->id);
-            printf("##==> Server send %d %d dev=%s id=%d\n",
-                   ICO_APF_RESOURCE_STATE_ACQUIRED, info->resid, info->device, info->id);
-            break;
-        case 1:
-            ico_apf_resource_send_to_client(
-                    info->appid, ICO_APF_RESOURCE_STATE_DEPRIVED, info->resid,
-                    info->device[0] ? info->device : "UnKnown", info->id);
-            printf("##==> Server send %d %d dev=%s id=%d\n",
-                   ICO_APF_RESOURCE_STATE_DEPRIVED, info->resid, info->device, info->id);
-            break;
-        case 2:
-            ico_apf_resource_send_to_client(
-                    info->appid, ICO_APF_RESOURCE_STATE_WAITTING, info->resid,
-                    info->device[0] ? info->device : "UnKnown", info->id);
-            printf("##==> Server send %d %d dev=%s id=%d\n",
-                   ICO_APF_RESOURCE_STATE_WAITTING, info->resid, info->device, info->id);
-            break;
-        case 3:
-            ico_apf_resource_send_to_client(
-                    info->appid, ICO_APF_RESOURCE_STATE_RELEASED, info->resid,
-                    info->device[0] ? info->device : "UnKnown", info->id);
-            printf("##==> Server send %d %d dev=%s id=%d\n",
-                   ICO_APF_RESOURCE_STATE_RELEASED, info->resid, info->device, info->id);
-            break;
-        default:
-            break;
-        }
-    }
-    else    {
-        printf("##==> Server receive illegal command(%d)\n", info->state);
-    }
-    fflush(stdout);
-}
-
-int
-main(int argc, char *argv[])
-{
-    Evas *canvas, *sub_canvas;
-    Evas_Object *bg, *r1, *r2, *r3; /* "sub" canvas objects */
-    Evas_Object *border, *img; /* canvas objects */
-    Ecore_Evas *sub_ee;
-    int     i;
-    int     width;
-    int     height;
-    unsigned int    color;
-    int     r, g, b, a;
-    int     appno = 1;
-    char    sTitle[64];
-
-    width = WIDTH;
-    height = HEIGHT;
-    color = 0xc080b0e0;
-    for (i = 1; i < argc; i++)  {
-        if (argv[i][0] == '@')  {
-            appno = strtol(&argv[i][1], (char **)0, 0);
-        }
-        if (argv[i][0] != '-')  continue;
-        if (strncasecmp(argv[i], "-width=", 7) == 0)    {
-            width = strtol(&argv[i][7], (char **)0, 0);
-        }
-        else if (strncasecmp(argv[i], "-height=", 8) == 0)  {
-            height = strtol(&argv[i][8], (char **)0, 0);
-        }
-        else if (strncasecmp(argv[i], "-color=", 7) == 0)   {
-            color = strtoul(&argv[i][7], (char **)0, 0);
-        }
-    }
-
-    ecore_evas_init();
-
-    if( ico_apf_ecore_init_server(NULL) != ICO_APF_E_NONE)  {
-        fprintf(stderr, "ico_apf_ecore_init_server() Error\n"); fflush(stderr);
-        ecore_evas_shutdown();
-        return -1;
-    }
-    ico_apf_resource_set_event_cb(res_callback, (void*)2);
-
-    /* this will give you a window with an Evas canvas under the first
-     * engine available */
-    ee = ecore_evas_new(NULL, 0, 0, width, height, "frame=0");
-    if (!ee) goto error;
-
-    ecore_evas_size_min_set(ee, width, height);
-    ecore_evas_size_max_set(ee, width, height);
-
-    ecore_evas_callback_delete_request_set(ee, _on_destroy);
-    sprintf(sTitle, "EFL Native Application %d", appno);
-    ecore_evas_title_set(ee, sTitle);
-    ecore_evas_show(ee);
-
-    canvas = ecore_evas_get(ee);
-
-    bg = evas_object_rectangle_add(canvas);
-    r = (color>>16)&0x0ff;
-    g = (color>>8)&0x0ff;
-    b = color&0x0ff;
-    a = (color>>24)&0x0ff;
-    if (a != 255)   {
-        r = (r * a) / 255;
-        g = (g * a) / 255;
-        b = (b * a) / 255;
-    }
-    evas_object_color_set(bg, r, g, b, a); /* bg color */
-    evas_object_move(bg, 0, 0); /* at origin */
-    evas_object_resize(bg, width, height); /* covers full canvas */
-    evas_object_show(bg);
-
-    /* this is a border around the image containing a scene of another * canvas */
-    border = evas_object_image_filled_add(canvas);
-    evas_object_image_file_set(border, border_img_path, NULL);
-    evas_object_image_border_set(border, 3, 3, 3, 3);
-    evas_object_image_border_center_fill_set(border, EVAS_BORDER_FILL_NONE);
-
-    evas_object_move(border, width / 6, height / 6);
-    evas_object_resize(border, (2 * width) / 3, (2 * height) / 3);
-    evas_object_show(border);
-
-    img = ecore_evas_object_image_new(ee);
-    evas_object_image_filled_set(img, EINA_TRUE);
-    evas_object_image_size_set(
-        img, ((2 * width) / 3) - 6, ((2 * height) / 3) - 6);
-    sub_ee = ecore_evas_object_ecore_evas_get(img);
-    sub_canvas = ecore_evas_object_evas_get(img);
-
-    evas_object_move(img, (width / 6) + 3, (height / 6) + 3);
-
-    /* apply the same size on both! */
-    evas_object_resize(img, ((2 * width) / 3) - 6, ((2 * height) / 3) - 6);
-    ecore_evas_resize(sub_ee, ((2 * width) / 3) - 6, ((2 * height) / 3) - 6);
-
-    r1 = evas_object_rectangle_add(sub_canvas);
-    evas_object_color_set(r1, g, b, r, 255);
-    evas_object_move(r1, 10, 10);
-    evas_object_resize(r1, 100, 100);
-    evas_object_show(r1);
-
-    r2 = evas_object_rectangle_add(sub_canvas);
-    evas_object_color_set(r2, b/2, g/2, r/2, 128);
-    evas_object_move(r2, 10, 10);
-    evas_object_resize(r2, 50, 50);
-    evas_object_show(r2);
-
-    r3 = evas_object_rectangle_add(sub_canvas);
-    evas_object_color_set(r3, b, r, g, 255);
-    evas_object_move(r3, 60, 60);
-    evas_object_resize(r3, 50, 50);
-    evas_object_show(r3);
-
-    evas_object_show(img);
-
-    ecore_main_loop_begin();
-
-    ico_apf_ecore_term_server();
-
-    ecore_evas_free(ee);
-    ecore_evas_shutdown();
-
-    return 0;
-
-error:
-    fprintf(stderr, "You got to have at least one Evas engine built"
-                    " and linked up to ecore-evas for this example to run"
-                    " properly.\n");
-    ecore_evas_shutdown();
-    return -1;
-}
-
diff --git a/include/home_screen.h b/include/home_screen.h
deleted file mode 100644 (file)
index 9d69087..0000000
+++ /dev/null
@@ -1,174 +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   header file of homescreen application
- *
- * @date    Feb-15-2013
- */
-
-#ifndef _HOME_SCREEN_H_
-#define _HOME_SCREEN_H_
-
-#include "ico_uxf.h"
-
-/*============================================================================*/
-/* definition                                                                 */
-/*============================================================================*/
-#define ICO_HS_OK               (0)
-#define ICO_HS_ERR              (-1)
-
-#define ICO_HS_TOUCH_TOBE_HIDE  (1)
-#define ICO_HS_TOUCH_TOBE_SHOW  (2)
-#define ICO_HS_TOUCH_IN_HIDE    (3)
-#define ICO_HS_TOUCH_IN_SHOW    (4)
-
-#define ICO_HS_TILE_NOCHANGE    (1)
-#define ICO_HS_TILE_APPLIST     (2)
-#define ICO_HS_TILE_OTHERS      (5)
-#define ICO_HS_TILE_SMALL       (11)
-#define ICO_HS_TILE_HWIDE       (21)
-#define ICO_HS_TILE_VWIDE       (12)
-#define ICO_HS_TILE_LARGE       (22)
-
-#define ICO_HS_TILE_CHAN        (18)
-#define ICO_HS_TILE_SIZE_S      (170)
-#define ICO_HS_TILE_SIZE_W      (ICO_HS_TILE_SIZE_S*2 + ICO_HS_TILE_CHAN)
-
-#define ICO_HS_CONFIG_HOMESCREEN    "homescreen"
-#define ICO_HS_CONFIG_ONSCREEN      "onscreen"
-#define ICO_HS_CONFIG_STATUBAR      "statusbar"
-#define ICO_HS_CONFIG_SOUND         "sound"
-
-#define ICO_HS_CONFIG_TILE_COLCNT   "tileinfo_colcnt"
-#define ICO_HS_CONFIG_TILE_ROWCNT   "tileinfo_rowcnt"
-#define ICO_HS_CONFIG_TILE_VALID    "tileinfo_valid"
-#define ICO_HS_CONFIG_TILE_TYPE     "tileinfo_type"
-#define ICO_HS_CONFIG_TILE_APP      "tileinfo_app"
-
-#define ICO_HS_CONFIG_TILE_ROWCNT_DEFAULT   (4)
-#define ICO_HS_CONFIG_TILE_COLCNT_DEFAULT   (5)
-#define ICO_HS_CONFIG_TILE_APP_DEFAULT    "none"
-
-#define ICO_HS_CONFIG_WS_PORT       "wsport"
-#define ICO_HS_CONFIG_ORIENTAION    "orientation"
-
-#define ICO_HS_CONFIG_BG            "bgimage"
-
-#define ICO_HS_CONFIG_SB            "statusbar"
-#define ICO_HS_CONFIG_ONS           "onscreen"
-#define ICO_HS_APPID_DEFAULT_SB     "org.tizen.ico.statusbar"    /* default status bar appid */
-#define ICO_HS_APPID_DEFAULT_ONS    "org.tizen.ico.onscreen"    /* default on screen appid */
-#define ICO_HS_APPID_DEFAULT_TOUCH  "TOUCH_SCREEN"    /* default touch screen name */
-
-#define ICO_HS_GROUP_SPECIAL        "menu"
-
-#define ICO_HS_ONS_APPLI_KILL_NAME   "appli_kill.edj"
-#define ICO_HS_ONS_APPLI_LIST_NAME   "appli_list.edj"
-#define ICO_HS_ONS_PART_RECT_NAME    "rect_"
-#define ICO_HS_ONS_PART_NEXT_NAME    "next_bt"
-#define ICO_HS_ONS_PART_CANCEL_NAME  "cancel_bt"
-
-#define ICO_HS_WS_PORT              (10001)
-#define ICO_HS_WS_HOST              ("127.0.0.1")
-
-#define ICO_HS_APP_NUM_MAX          (128)
-#define ICO_HS_WINDOW_NUM_MAX       (10)
-#define ICO_HS_MSG_SIZE             (1024)
-#define ICO_HS_TEMP_BUF_SIZE        (256)
-#define ICO_HS_NOTILE_APP_MAX       (20)
-
-#define ICO_HS_PROTOCOL             "hs-protocol"
-
-#define ICO_HS_PROTOCOL_CM          "gui-protocol"
-                  /* protocol to communicate external tools */
-#define ICO_HS_PROTOCOL_SB          "statusbar-protocol"
-                  /* protocol to communicate status bar     */
-#define ICO_HS_PROTOCOL_OS          "onscreen-protocol"
-                  /* protocol to communicate onscreen       */
-#define ICO_HS_PROTOCOL_APP         "app-protocol"
-            /* protocol to communicate application(not used)*/
-#define ICO_HS_PROTOCOL_TYPE_CM      (1)
-#define ICO_HS_PROTOCOL_TYPE_SB      (2)
-#define ICO_HS_PROTOCOL_TYPE_OS      (3)
-#define ICO_HS_PROTOCOL_TYPE_APP     (4)
-#define ICO_HS_MSG_HEAD_CM           "GUI"
-#define ICO_HS_MSG_HEAD_SB           "STB"
-#define ICO_HS_MSG_HEAD_OS           "ONS"
-#define ICO_HS_MSG_HEAD_APP          "APP"
-#define HS_REQ_ANS_HELLO        "REQ_ANS_HELLO"
-
-#define ICO_HS_SIZE_SB_HEIGHT        (64)
-#define ICO_HS_SIZE_LAYOUT_WIDTH     (768)
-#define ICO_HS_SIZE_LAYOUT_HEIGHT    (1024)
-
-/* define for statusbar configuration */
-#define ICO_SB_CONFIG_SHTCT_APP      "shortcut_app"
-
-/* define for sound configuration */
-#define ICO_HS_SND_TYPE_DEFAULT      (1)
-
-#define ICO_HS_SND_CNAME_DEFAULT     "sound_default"
-#define ICO_HS_SND_FNAME_DEFAULT     "default.wav"
-
-/*============================================================================*/
-/* definition                                                                 */
-/*============================================================================*/
-typedef struct _hs_window_data hs_window_data_t;
-struct _hs_window_data {
-    char appid[ICO_UXF_MAX_PROCESS_NAME+1];
-    char exe_name[ICO_UXF_MAX_PROCESS_NAME+1];
-    int terminate;
-    int visible;
-    int raise;
-    int resize_w;
-    int resize_h;
-    int move_x;
-    int move_y;
-    int category;
-};
-
-/*============================================================================*/
-/* functions                                                                  */
-/*============================================================================*/
-extern void hs_tile_free_app(int idx);
-extern void hs_tile_kill_app(const char *appid);
-extern void hs_tile_set_app(int idx, const char *appid);
-extern int hs_tile_get_index_app(const char *appid);
-extern int hs_tile_get_index_pos(int x, int y, int w, int h);
-extern int hs_tile_get_minchange(void);
-extern void hs_tile_show_screen(void);
-extern int hs_get_index_appscreendata(const char *appid);
-extern void hs_req_ctlr_tile(void);
-extern void hs_click_escutcheon(void);
-extern int hs_click_applist(void);
-extern void hs_show_onscreen(void);
-extern void hs_hide_onscreen(void);
-extern void hs_show_appscreen(const char *appid);
-extern void hs_tile_delete_hide(const char *appid);
-
-extern void hs_get_image_path(char *buff, int len);
-extern void hs_get_sound_path(char *buff, int len);
-extern void hs_get_edj_path(char *buff, int len);
-extern void hs_get_ons_edj_path(char *buff, int len);
-extern void hs_get_conf_path(char *buff, int len);
-
-extern hs_window_data_t hs_command_tile_req[ICO_HS_APP_NUM_MAX];
-extern hs_window_data_t hs_app_screen_window[ICO_HS_APP_NUM_MAX];
-extern char hs_name_homescreen[ICO_UXF_MAX_PROCESS_NAME+1];
-extern char hs_kill_appid[ICO_UXF_MAX_PROCESS_NAME];
-extern char hs_active_onscreen[ICO_UXF_MAX_PROCESS_NAME];
-
-extern int hs_snd_play(char *wav_file);
-extern char *hs_snd_get_filename(int type);
-extern int hs_snd_init(void);
-#endif    /* _HOME_SCREEN_H_ */
-
-/**
- * End of File. (home_screen.h)
- */
diff --git a/include/home_screen_conf.h b/include/home_screen_conf.h
deleted file mode 100644 (file)
index 04fd406..0000000
+++ /dev/null
@@ -1,40 +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   header file of homescreen configuration
- *
- * @date    Feb-15-2013
- */
-
-#ifndef _HOME_SCREEN_CONF_H_
-#define _HOME_SCREEN_CONF_H_
-
-#include <glib.h>
-#include "ico_uxf_sysdef.h"
-#include "ico_uxf_def.h"
-#include "ico_apf_log.h"
-
-/*============================================================================*/
-/* definition                                                                 */
-/*============================================================================*/
-#define ICO_HOMESCREEN_CONFIG_FILE "homescreen.conf"
-#define ICO_ONSCREEN_CONFIG_FILE   "onscreen.conf"
-#define ICO_STATUSBAR_CONFIG_FILE  "statusbar.conf"
-
-/*============================================================================*/
-/* functions                                                                  */
-/*============================================================================*/
-extern int initHomeScreenConfig(const char *conf);
-extern int hs_conf_get_integer(const char *group_name, 
-                     const char *key, int default_value);
-extern const char *hs_conf_get_string(const char *group_name, 
-                        const char *key, const char *default_value);
-
-#endif /* _HOME_SCREEN_CONF_H_ */
-
diff --git a/include/home_screen_lib.h b/include/home_screen_lib.h
deleted file mode 100644 (file)
index 2171e97..0000000
+++ /dev/null
@@ -1,33 +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   header file for homescreen communication
- *
- * @date    Feb-15-2013
- */
-
-#ifndef __HOME_SCREEN_LIB_H__
-#define __HOME_SCREEN_LIB_H__
-
-/*============================================================================*/
-/* definition                                                                 */
-/*============================================================================*/
-struct socket_data {
-    struct libwebsocket_context *ws_context;
-    int port;
-};
-
-/*============================================================================*/
-/* functions                                                                  */
-/*============================================================================*/
-extern int hs_lib_main(int port);
-extern int hs_lib_event_message(int type, char *format, ...);
-
-#endif /* __HOME_SCREEN_LIB_H__ */
-
diff --git a/include/home_screen_parser.h b/include/home_screen_parser.h
deleted file mode 100644 (file)
index 6e2fe24..0000000
+++ /dev/null
@@ -1,121 +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   header file of command parser tools
- *
- * @date    Feb-15-2013
- */
-
-#ifndef _HOME_SCREEN_PARSER_H_
-#define _HOME_SCREEN_PARSER_H_
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <getopt.h>
-#include <glib-object.h>
-#include <json-glib/json-glib.h>
-
-#include "ico_uxf.h"
-#include "home_screen.h"
-#include "ico_uxf_conf.h"
-
-/*============================================================================*/
-/* definition                                                                 */
-/*============================================================================*/
-#define UNEXECUTED          0
-#define EXECUTED            1
-
-#define IGNORE              (-1)
-#define EXECUTE             (0)
-
-typedef struct _hs_command_req hs_command_req_t;
-struct _hs_command_req {
-    struct {
-        char    appid[ICO_UXF_MAX_PROCESS_NAME+1];
-        struct {
-            char    *appid;
-        } execute;
-        struct {
-            char *appid;
-        } terminate;
-        struct {
-            char *appid;
-        } suspend;
-        struct {
-            char *appid;
-        } resume;
-    } program;
-    struct {
-        int status;
-        struct {
-            int window;
-        } show;
-        struct {
-            int window;
-        } hide;
-        struct {
-            int window;
-            int visible;
-            int raise;
-        } visible_raise;
-        struct {
-            int window;
-            int w;
-            int h;
-        } resize;
-        struct {
-            int window;
-            int size_m;
-            int size_n;
-        } resize_tile;
-        struct {
-            int window;
-            int x;
-            int y;
-        } move;
-        struct {
-            int window;
-            int m;
-            int n;
-        } move_tile;
-        struct {
-            int window;
-        } raise;
-        struct {
-            int window;
-        } lower;
-        struct {
-            int window;
-            unsigned int    mask;
-        } event_mask;
-    } window[ICO_HS_WINDOW_NUM_MAX];
-    struct {
-        struct {
-            int  input;
-        } add_app;
-        struct {
-            int  input;
-        } del_app;
-    } input;
-};
-
-/*============================================================================*/
-/* functions                                                                  */
-/*============================================================================*/
-extern int hs_parse_form(char *, int);
-extern int hs_conftrol_form(const char*, int);
-extern void hs_dump_app(void);
-extern int hs_control_app_screen(void);
-extern void hs_get_tilescreendata(void);
-
-extern int hs_req_touch;
-extern int hs_stat_touch;
-
-#endif /* _HOME_SCREEN_PARSER_H_ */
diff --git a/include/ico_apf.h b/include/ico_apf.h
deleted file mode 100644 (file)
index e5e57f6..0000000
+++ /dev/null
@@ -1,22 +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   header file of Application Framework
- *
- * @date    Feb-28-2013
- */
-
-#ifndef __ICO_APF_H__
-#define __ICO_APF_H__
-
-#include    "ico_apf_resource_control.h"
-#include    "ico_apf_error.h"
-
-#endif /*__ICO_APF_H__*/
-
diff --git a/include/ico_apf_ecore.h b/include/ico_apf_ecore.h
deleted file mode 100644 (file)
index 9f610a6..0000000
+++ /dev/null
@@ -1,67 +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   header file of Apprication Framework (for Ecode(EFL) based application)
- *
- * @date    Feb-28-2013
- */
-
-#ifndef __ICO_APF_ECORE_H__
-#define __ICO_APF_ECORE_H__
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Initialize AppsController interface for Ecode(EFL) based application
- *
- *  @param[in]  uri         server URI
- *  @return     result status
- *  @retval     ICO_APF_E_NONE      success
- *  @retval     ICO_APF_E_IO_ERROR  error(failed)
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_ecore_init(const char *uri);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Terminame AppsController interface for Ecode(EFL) based application
- *
- *  @param      none
- *  @return     result status
- *  @return     none
- */
-/*--------------------------------------------------------------------------*/
-void ico_apf_ecore_term(void);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Initialize AppsController interface for server(AppsController)
- *
- *  @param[in]  uri         my URI
- *  @return     result status
- *  @retval     ICO_APF_E_NONE      success
- *  @retval     ICO_APF_E_IO_ERROR  error(failed)
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_ecore_init_server(const char *uri);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Terminame AppsController interface for server(AppsController)
- *
- *  @param      none
- *  @return     none
- */
-/*--------------------------------------------------------------------------*/
-void ico_apf_ecore_term_server(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* __ICO_APF_ECORE_H__ */
diff --git a/include/ico_apf_error.h b/include/ico_apf_error.h
deleted file mode 100644 (file)
index 5594e27..0000000
+++ /dev/null
@@ -1,80 +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   header file of Apprication Framework (declaration of API error code)
- *
- * @date    Feb-28-2013
- */
-
-#ifndef __ICO_APF_ERROR_H__
-#define __ICO_APF_ERROR_H__
-
-#include <tizen.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief Enumerations of common error code for Application Framework.
- */
-typedef enum
-{
-    ICO_APF_E_NONE          = TIZEN_ERROR_NONE,  /**< Successful */
-    ICO_APF_E_INVALID_PARAM = TIZEN_ERROR_INVALID_PARAMETER,
-    ICO_APF_E_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,
-    ICO_APF_E_IO_ERROR      = TIZEN_ERROR_IO_ERROR,
-    ICO_APF_E_UNKNOWN       = TIZEN_ERROR_UNKNOWN
-} ico_app_fw_error_e;
-
-/**
- * @brief Enumerations of error code for Application Communication.
- */
-typedef enum
-{
-    ICO_APF_COM_E_CREATE_CTX    = -200, /**< Create context failed */
-    ICO_APF_COM_E_CLT_CONNECT   = -201, /**< Client connect failed */
-    ICO_APF_COM_E_CLOSED        = -202, /**< Connection closed */
-    ICO_APF_COM_E_WRITE         = -203, /**< libwebsocket_write error */
-    ICO_APF_COM_E_RESERVED      = -204, /**< Reserve data failed */
-    ICO_APF_COM_E_NO_EXIST      = -205, /**< Uri does not exist */
-    ICO_APF_COM_E_UNKNOWN       = -300, /**< Other error */
-} ico_app_fw_com_error_e;
-
-/**
- *@brief Enumerations of error code for Application Manager.
- */
-typedef enum
-{
-    ICO_APP_CTL_E_NONE          = TIZEN_ERROR_NONE,  /**< Successful */
-    ICO_APP_CTL_E_INVALID_PARAM = TIZEN_ERROR_INVALID_PARAMETER,
-    ICO_APP_CTL_E_OUT_OF_MEM    = TIZEN_ERROR_OUT_OF_MEMORY,
-    ICO_APP_CTL_E_IO_ERR        = TIZEN_ERROR_IO_ERROR,
-} ico_app_ctl_error_e;
-
-/**
- * @brief Enumerations of error code for Resource Manager.
- */
-typedef enum _resmgr_error {
-    ICO_APF_RESOURCE_E_NONE            =  0, /* Successful */
-    ICO_APF_RESOURCE_E_UNKOWN          = -1, /* unkown error */
-    ICO_APF_RESOURCE_E_INVAL           = -2, /* invalid parameter */
-    ICO_APF_RESOURCE_E_NOT_IMPLEMENTED = -3, /* not implemented */
-    ICO_APF_RESOURCE_E_NOT_INITIALIZED = -4, /* not initialized resmger module */
-    ICO_APF_RESOURCE_E_INIT_COM_FAILD  = -5, /* intialize communication error */
-    ICO_APF_RESOURCE_E_COMMUNICATION   = -6, /* communication error */
-    ICO_APF_RESOURCE_E_MSG_PARSER      = -7, /* message parser faild */
-    ICO_APF_RESOURCE_E_SERVER_CLOSED   = -8, /* server colosed */
-    ICO_APF_RESOURCE_E_SEND_DATA       = -9, /* send data faile */
-} ico_apf_resmgr_error_e;
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __ICO_APF_ERROR_H__ */
diff --git a/include/ico_apf_log.h b/include/ico_apf_log.h
deleted file mode 100644 (file)
index a304aa1..0000000
+++ /dev/null
@@ -1,102 +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 public header for log output
- *
- * @date    Feb-15-2013
- */
-
-#ifndef _ICO_APF_LOG_H_
-#define _ICO_APF_LOG_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Log output destination       */
-#ifndef ICO_APF_LOG_STDOUT
-#define ICO_APF_LOG_STDOUT      0       /* Log output to stdout(=1) or file(=0)     */
-#endif /*ICO_APF_LOG_STDOUT*/
-#define ICO_APF_LOG_DIR         "/var/log/ico"
-                                        /* Directory name of Log destination        */
-
-/* Maximum lines/files          */
-#define ICO_APF_LOG_MAXLINES    10000   /* Maximum output lines of one log file     */
-#define ICO_APF_LOG_MAXFILES    6       /* Maximum number of the log file           */
-
-/* Log output level             */
-#define ICO_APF_LOG_DEBUG       128     /* Debug write                              */
-#define ICO_APF_LOG_INFO        64      /* Information                              */
-#define ICO_APF_LOG_WARNING     16      /* Warning                                  */
-#define ICO_APF_LOG_CRITICAL    8       /* Critical                                 */
-#define ICO_APF_LOG_ERROR       4       /* Error                                    */
-
-/* Log output flush             */
-#define ICO_APF_LOG_FLUSH       0x4000  /* Log outout with log flush                */
-#define ICO_APF_LOG_NOFLUSH     0x2000  /* Log output without log flush             */
-
-/* Function prototypes          */
-void ico_apf_log_print(const char *fmt, ...);
-void ico_apf_log_open(const char *Prog);
-void ico_apf_log_close(void);
-void ico_apf_log_flush(void);
-char *ico_apf_log_curtime(const char *level);
-void ico_apf_log_setlevel(const int loglevel);
-
-/* Current log output level     */
-extern int  ico_apf_log_level;
-
-/* Macros for log output        */
-#define ICO_APF_DEBUG(fmt,...)  \
-    {if( ico_apf_log_level >= ICO_APF_LOG_DEBUG) {ico_apf_log_print("%s> "fmt" (%s,%s:%d)\n",ico_apf_log_curtime("DBG"),##__VA_ARGS__,__func__,__FILE__,__LINE__);} }
-#define ICO_APF_INFO(fmt,...)   \
-    {if( ico_apf_log_level >= ICO_APF_LOG_INFO) {ico_apf_log_print("%s> "fmt" (%s,%s:%d)\n",ico_apf_log_curtime("INF"),##__VA_ARGS__,__func__,__FILE__,__LINE__);} }
-#define ICO_APF_WARN(fmt,...)   \
-    {if( ico_apf_log_level >= ICO_APF_LOG_WARNING) {ico_apf_log_print("%s> "fmt" (%s,%s:%d)\n",ico_apf_log_curtime("WRN"),##__VA_ARGS__,__func__,__FILE__,__LINE__);} }
-#define ICO_APF_CRITICAL(fmt,...)   \
-    {if( ico_apf_log_level >= ICO_APF_LOG_CRITICAL) {ico_apf_log_print("%s> "fmt" (%s,%s:%d)\n",ico_apf_log_curtime("CRI"),##__VA_ARGS__,__func__,__FILE__,__LINE__);} }
-#define ICO_APF_ERROR(fmt,...)  \
-    {if( ico_apf_log_level >= ICO_APF_LOG_ERROR) {ico_apf_log_print("%s> "fmt" (%s,%s:%d)\n",ico_apf_log_curtime("ERR"),##__VA_ARGS__,__func__,__FILE__,__LINE__);} }
-
-/* Macros for compativility */
-#ifndef apfw_trace
-#define apfw_debug          ICO_APF_DEBUG
-#define apfw_trace          ICO_APF_DEBUG
-#define apfw_info           ICO_APF_INFO
-#define apfw_warn           ICO_APF_WARN
-#define apfw_critical       ICO_APF_CRITICAL
-#define apfw_error          ICO_APF_ERROR
-#define apfw_logflush       ico_apf_log_flush
-#endif /*apfw_trace*/
-
-#define uim_debug           ICO_APF_DEBUG
-#define uifw_debug          ICO_APF_DEBUG
-#define uifw_trace          ICO_APF_DEBUG
-#define uifw_info           ICO_APF_INFO
-#define uifw_warn           ICO_APF_WARN
-#define uifw_critical       ICO_APF_CRITICAL
-#define uifw_error          ICO_APF_ERROR
-#define uifw_logflush       ico_apf_log_flush
-
-#define ICO_UXF_DEBUG       ICO_APF_DEBUG
-#define ICO_UXF_INFO        ICO_APF_INFO
-#define ICO_UXF_WARN        ICO_APF_WARN
-#define ICO_UXF_CRITICAL    ICO_APF_CRITICAL
-#define ICO_UXF_ERROR       ICO_APF_ERROR
-
-#define ico_uxf_log_open        ico_apf_log_open
-#define ico_uxf_log_close       ico_apf_log_close
-#define ico_uxf_log_flush       ico_apf_log_flush
-#define ico_uxf_log_setlevel    ico_apf_log_setlevel
-
-#ifdef __cplusplus
-}
-#endif
-#endif  /* _ICO_APF_LOG_H_ */
-
diff --git a/include/ico_apf_resource_control.h b/include/ico_apf_resource_control.h
deleted file mode 100644 (file)
index 6784e6f..0000000
+++ /dev/null
@@ -1,491 +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   header file of Apprication Framework (Resource Control)
- *
- * @date    Feb-28-2013
- */
-
-#include    "ico_uxf_sysdef.h"
-
-#ifndef __ICO_APF_RESOURCE_CONTROL_H__
-#define __ICO_APF_RESOURCE_CONTROL_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- *  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;
-#define ICO_APF_RESOURCE_COMMAND_MIN    ((int)(ICO_APF_RESOURCE_STATE_ACQUIRED))
-#define ICO_APF_RESOURCE_COMMAND_MAX    ((int)(ICO_APF_RESOURCE_STATE_DISCONNECTED))
-
-/*
- *  sound control
- */
-typedef enum _sound_resource {
-    ICO_APF_SOUND_COMMAND_MUTEON        = 21,   /* mute on          */
-    ICO_APF_SOUND_COMMAND_MUTEOFF       = 22,   /* mute off         */
-    ICO_APF_SOUND_COMMAND_CANCEL        = 23,   /* cancel           */
-    ICO_APF_SOUND_COMMAND_GETLIST       = 24,   /* get stream list  */
-    ICO_APF_SOUND_COMMAND_FRESH         = 25,   /* fresh            */
-    ICO_APF_SOUND_COMMAND_ALLMUTEON     = 26,   /* mute on all streams*/
-    ICO_APF_SOUND_COMMAND_ALLMUTEOFF    = 27,   /* mute off all streams*/
-
-    ICO_APF_SOUND_EVENT_NEW             = 28,   /* created new stream*/
-    ICO_APF_SOUND_EVENT_FREE            = 29,   /* destoryed stream */
-
-    ICO_APF_SOUND_REPLY_LIST            = 30    /* reply on stream list*/
-} ico_apf_sound_state_e;
-#define ICO_APF_SOUND_COMMAND_MIN       ((int)(ICO_APF_SOUND_COMMAND_MUTEON))
-#define ICO_APF_SOUND_COMMAND_CMD       ((int)(ICO_APF_SOUND_COMMAND_ALLMUTEOFF))
-#define ICO_APF_SOUND_COMMAND_MAX       ((int)(ICO_APF_SOUND_REPLY_LIST))
-
-/*
- *  notify callback information
- */
-typedef struct _resmgr_notify_info {
-    ico_apf_resid_e resid;
-    int             id;
-    int             bid;
-    int             pid;
-    char            appid[ICO_UXF_MAX_PROCESS_NAME+1];
-    ico_apf_resource_state_e state;
-    char            device[ICO_UXF_MAX_DEVICE_NAME+1];
-} ico_apf_resource_notify_info_t;
-
-typedef void (*ico_apf_resource_notify_cb_t)(ico_apf_resource_notify_info_t* info,
-                                             void *user_data);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Initialize resouce manager component for client Application
- *
- *  @param[in]  uri         server URI
- *  @return result status
- *  @retval ICO_APF_RESOURCE_E_NONE                 success
- *  @retval ICO_APF_RESOURCE_E_INIT_COM_FAILD       can not create connection
- *  @retval ICO_APF_RESOURCE_E_INIT_COMMUNICATION   initialize communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_init_client(const char *uri);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Terminame resouce manager component
- *
- *  @param      none
- *  @return     none
- */
-/*--------------------------------------------------------------------------*/
-void ico_apf_resource_term_client(void);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Initialize resouce manager component for sever(AppsController)
- *
- *  @param[in]  uri         my URI
- *  @return result status
- *  @retval ICO_APF_RESOURCE_E_NONE                 success
- *  @retval ICO_APF_RESOURCE_E_INIT_COM_FAILD       can not create connection
- *  @retval ICO_APF_RESOURCE_E_INIT_COMMUNICATION   initialize communication error
- *  @retval ICO_APF_RESOURCE_E_INVALID_PARAMETER    appid is null
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_init_server(const char *uri);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Terminame resouce manager component for server(AppsController)
- *
- *  @param      none
- *  @return     none
- */
-/*--------------------------------------------------------------------------*/
-void ico_apf_resource_term_server(void);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Set event callback function
- *
- *  @param[in]  callbacks   callback functions
- *  @param[in]  user_data   passed data on called callback function
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE     success
- *  @retval     ICO_APF_RESOURCE_E_INVAL    callbacks is null
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_set_event_cb(ico_apf_resource_notify_cb_t callbacks,
-                                  void *user_data);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Unset event callback function
- *
- *  @param      none
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE     success(At present, always give back this)
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_unset_event_cb(void);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Get the rights of basic screen
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  src_id      id of basic screen
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_get_screen_mode(const char* disp_dev, int scr_id);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Release the rights of basic screen
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  src_id      id of basic screen
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_release_screen_mode(const char* disp_dev, int scr_id);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Reply the basic screen status change event
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  src_id      id of basic screen
- *  @param[in]  ok          OK(1) or NG(0)
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_reply_screen_mode(const char* disp_dev, int scr_id, const int ok);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Release the rights of interrupt screen
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  src_id      id of basic screen
- *  @param[in]  int_src_id  id of interrupt screen
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_get_int_screen_mode(const char* disp_dev,
-                                         int scr_id, int int_scr_id);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Release the rights of interrupt screen on basic screen
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  src_id      id of basic screen
- *  @param[in]  int_scr_id  id of interrupt screen
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_release_int_screen_mode(const char* disp_dev,
-                                             int scr_id, int int_scr_id);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Reply the rights of interrupt screen on basic screen
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  src_id      id of basic screen
- *  @param[in]  int_src_id  id of interrupt screen
- *  @param[in]  ok          OK(1) or NG(0)
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_reply_int_screen_mode(const char* disp_dev,
-                                           int scr_id, int int_scr_id, const int ok);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Get the rights of interrupt screen on display
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  int_scr_id  id of interrupt screen
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_get_int_screen_mode_disp(const char* disp_dev,
-                                              int int_scr_id);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Release the rights of interrupt screen on display
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  int_scr_id  id of interrupt screen
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_release_int_screen_mode_disp(const char* disp_dev,
-                                                  int int_scr_id);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Reply the rights of interrupt screen on display
- *
- *  @param[in]  disp_dev    display device uri
- *  @param[in]  int_scr_id  id of interrupt screen
- *  @param[in]  ok          OK(1) or NG(0)
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_reply_int_screen_mode_disp(const char* disp_dev,
-                                                int int_scr_id, const int ok);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Get the rights of basic sound on zone
- *
- *  @param[in]  zone        sound device uri
- *  @param[in]  snd_id      id of basic sound
- *  @param[in]  adjust      adjust acction
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_get_sound_mode(const char* zone, int snd_id, int adjust);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Release the rights of basic sound on zone
- *
- *  @param[in]  zone        sound device uri
- *  @param[in]  snd_id      id of basic sound
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_release_sound_mode(const char* zone, int snd_id);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Reply the rights of basic sound on zone
- *
- *  @param[in]  zone        sound device uri
- *  @param[in]  snd_id      id of basic sound
- *  @param[in]  ok          OK(1) or NG(0)
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_reply_sound_mode(const char* zone, int snd_id, const int ok);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Get the rights of interrupt sound on zone
- *
- *  @param[in]  zone        sound device uri
- *  @param[in]  int_snd_id  id of basic sound
- *  @param[in]  adjust      adjust action
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_get_int_sound_mode(const char* zone,
-                                        int int_snd_id, int adjust);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Release the rights of interrupt sound on zone
- *
- *  @param[in]  zone        sound device uri
- *  @param[in]  int_snd_id  id of interrupt sound
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_release_int_sound_mode(const char* zone, int int_snd_id);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Reply the rights of interrupt sound on zone
- *
- *  @param[in]  zone        sound device uri
- *  @param[in]  int_snd_id  id of interrupt sound
- *  @param[in]  ok          OK(1) or NG(0)
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_reply_int_sound_mode(const char* zone,
-                                          int int_snd_id, const int ok);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Add the input event notification from input device
- *
- *  @param[in]  input_dev   input device uri
- *  @param[in]  events      notify input events
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_add_input_event(const char* input_dev, int events);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Change the input event notification from input device
- *
- *  @param[in]  input_dev   input device uri
- *  @param[in]  events      notify input events
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_change_input_event(const char* input_dev, int events);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Delete the input event notification from input device
- *
- *  @param[in]  input_dev   input device uri
- *  @param[in]  events      notify input events
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE               success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED    not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION      communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_delete_input_event(const char* input_dev, int events);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Send responce form server(AppsController) to client application
- *
- *  @param[in]  appid       client application id
- *  @param[in]  event       event
- *  @param[in]  resource    target resource
- *  @param[in]  device      display device / sound zone
- *  @param[in]  id          application defined object id
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE             success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED  not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION    communication error
- *  @retval     ICO_APF_RESOURCE_E_INVAL            illegal appid or event code
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_send_to_client(const char *appid, const int event,
-                                    const int resource, const char *device, const int id);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Send request to Multi Input Manager
- *
- *  @param[in]  cmd         send command
- *  @param[in]  pid         target pid
- *  @return     result status
- *  @retval     ICO_APF_RESOURCE_E_NONE             success
- *  @retval     ICO_APF_RESOURCE_E_NOT_INITIALIZED  not initialized
- *  @retval     ICO_APF_RESOURCE_E_COMMUNICATION    communication error
- */
-/*--------------------------------------------------------------------------*/
-int ico_apf_resource_send_to_soundctl(const ico_apf_sound_state_e cmd, const int pid);
-
-/*--------------------------------------------------------------------------*/
-/**
- *  @brief  Get aplication Id
- *
- *  @param[in]  pid         process id (if 0, current process id)
- *  @param[out] appid       client application id
- *  @return     result status
- *  @retval     ICO_APP_CTL_E_NONE              success
- *  @retval     ICO_APP_CTL_E_INVALID_PARAM     error(pid dose not exist)
- */
-/*--------------------------------------------------------------------------*/
-/* Applicaton Manager                           */
-int ico_apf_get_app_id(const int pid, char *appid);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /*__ICO_APF_RESOURCE_CONTROL_H__*/
diff --git a/include/ico_syc_apc.h b/include/ico_syc_apc.h
deleted file mode 100644 (file)
index 4f935f8..0000000
+++ /dev/null
@@ -1,96 +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   header file of Apprications Controller
- *
- * @date    Feb-28-2013
- */
-
-#ifndef _ICO_SYC_APC_H_
-#define _ICO_SYC_APC_H_
-
-#include "ico_apf_log.h"
-#include "ico_uxf_sysdef.h"
-#include "ico_uxf_conf.h"
-#include "ico_uxf_def.h"
-#include "ico_syc_def.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Maximum values                           */
-#define ICO_SYC_APC_REGULATION_LISTENERS    4   /* number of regulation listeners   */
-
-/* Vehicle information values               */
-#define ICO_SYC_APC_REGULATION_SPEED_RUNNING    (4.0)
-#define ICO_SYC_APC_REGULATION_SHIFT_NEUTRALS   (0)
-#define ICO_SYC_APC_REGULATION_SHIFT_1ST        (1)
-#define ICO_SYC_APC_REGULATION_SHIFT_2ND        (2)
-#define ICO_SYC_APC_REGULATION_SHIFT_3RD        (3)
-#define ICO_SYC_APC_REGULATION_SHIFT_DRIVE      (4)
-#define ICO_SYC_APC_REGULATION_SHIFT_REVERSES   (128)
-#define ICO_SYC_APC_REGULATION_SHIFT_PARKING    (255)
-#define ICO_SYC_APC_REGULATION_BLINKER_NONE     (0)
-#define ICO_SYC_APC_REGULATION_BLINKER_RIGHT    (1)
-#define ICO_SYC_APC_REGULATION_BLINKER_LEFT     (2)
-
-#define ICO_SYC_APC_REGULATION_REGULATION       (0)
-#define ICO_SYC_APC_REGULATION_NOREGULATION     (1)
-#define ICO_SYC_APC_REGULATION_NOCHANGE         (9)
-
-typedef struct _ico_apc_reguration_control  {
-    unsigned char   display;                /* display(1=visible/0=invisible)   */
-    unsigned char   sound;                  /* sound(1=play/0=mute)             */
-    unsigned char   input;                  /* inputsw(1=use/0=unuse)           */
-    unsigned char   res;                    /* (unused)                         */
-} ico_apc_reguration_control_t;
-                                            /* application context (pointer only)*/
-typedef struct _ico_apc_context *ico_apc_context_h;
-
-                                            /* regulation event callback function*/
-typedef void (*ico_apc_regulation_cb_t)(const int appcategory,
-                                        const ico_apc_reguration_control_t control,
-                                        void *user_data);
-                                            /* respurce control                 */
-typedef void (*ico_apc_resource_control_t)(const Ico_Uxf_conf_application *conf,
-                                           const int control);
-
-/* API prototype                            */
-/* Apps Controller initialize/terminate     */
-                                            /* initialize Apps Controller       */
-int ico_syc_apc_init(ico_apc_resource_control_t display,
-                     ico_apc_resource_control_t sound,
-                     ico_apc_resource_control_t input);
-                                            /* Terminate Apps Controller        */
-void ico_syc_apc_term(void);
-                                            /* Check waiting application        */
-int ico_syc_apc_is_waitshow(const char *appid);
-                                            /* Select active application        */
-void ico_syc_apc_active(const char *appid);
-
-/* Apps Controller regulation control           */
-                                            /* regulation controller initialize     */
-int ico_syc_apc_regulation_init(void);
-                                            /* regulation controller terminate  */
-int ico_syc_apc_regulation_term(void);
-                                            /* set regulation change listener       */
-void ico_syc_apc_regulation_listener(ico_apc_regulation_cb_t func, void *user_data);
-                                            /* get application visible control  */
-int ico_syc_apc_regulation_app_visible(const int category);
-                                            /* get application sound control    */
-int ico_syc_apc_regulation_app_sound(const int category);
-                                            /* get application input control    */
-int ico_syc_apc_regulation_app_input(const int category);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /*_ICO_SYC_APC_H_*/
-
diff --git a/include/ico_syc_application.h b/include/ico_syc_application.h
new file mode 100644 (file)
index 0000000..233d2b4
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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 files of Resource Control API
+ *          for general application
+ *
+ * @date    July-31-2013
+ */
+
+#ifndef _ICO_SYC_APPLICATION_H_
+#define _ICO_SYC_APPLICATION_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*============================================================================*/
+/* include files                                                              */
+/*============================================================================*/
+#include "ico_syc_error.h"
+#include "ico_syc_type.h"
+
+#include "ico_syc_appresctl.h"
+
+#endif /*_ICO_SYC_APPLICATION_H_*/
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/include/ico_syc_appresctl.h b/include/ico_syc_appresctl.h
new file mode 100644 (file)
index 0000000..8084309
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * 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 Resource Control API
+ *
+ * @date    July-31-2013
+ */
+
+#ifndef _ICO_SYC_APPRESCTL_H_
+#define _ICO_SYC_APPRESCTL_H_
+
+#include "ico_syc_private.h"
+#include "ico_syc_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*============================================================================*/
+/* definition                                                                 */
+/*============================================================================*/
+struct ico_syc_res_context;
+
+/*============================================================================*/
+/* enum                                                                       */
+/*============================================================================*/
+/*
+ * type of resource
+ * @ICO_SYC_RES_BASIC: basic resource
+ * @ICO_SYC_RES_INTERRUPT: interruption resource
+ */
+typedef enum _resource_type {
+    ICO_SYC_RES_BASIC       = 0,
+    ICO_SYC_RES_INTERRUPT   = 1
+} ico_syc_res_type_e;
+
+/*
+ * type of sound adjust
+ * @ICO_SYC_SOUND_MUTE: mute the basic sound
+ *                      while playing the interruption sound
+ * @ICO_SYC_SOUND_WAITING: wait the basic sound
+ *                         until the interruption sound end
+ * @ICO_SYC_SOUND_TOGETHER: play the basic sound and the interruption sound
+ *                          at the same time
+ * @ICO_SYC_SOUND_VOL_DOWN: turn the volume down of the basic sound
+ *                          while playing the interruption sound
+ */
+typedef enum _ {
+    ICO_SYC_SOUND_MUTE      = 0,
+    ICO_SYC_SOUND_WAITING   = 1,
+    ICO_SYC_SOUND_TOGETHER  = 2,
+    ICO_SYC_SOUND_VOL_DOWN  = 3
+} ico_syc_sound_adjust_e;
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_acquire_res
+ *          Acquire the resources(window/sound/input).
+ *          User can choose window and sound resource's type
+ *          "basic" or "interruption".
+ *          If user want to acquire the sound resource only,
+ *          user sets NULL to argument "window" and "input".
+ *
+ * @param[in]   window                  window resource's information
+ * @param[in]   sound                   sound resource's information
+ * @param[in]   input                   input resource's information
+ * @param[in]   type                    window and sound resource's type
+ *                                      (basic or interruption)
+ * @return      resource's context address
+ * @retval      address                 success
+ * @retval      NULL                    error
+ * @see         ico_syc_res_type_e
+ */
+/*--------------------------------------------------------------------------*/
+struct ico_syc_res_context * ico_syc_acquire_res(
+                             const ico_syc_res_window_t *window,
+                             const ico_syc_res_sound_t *sound,
+                             const ico_syc_res_input_t *input,
+                             int type);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_release_res
+ *          Release the resources(window/sound/input).
+ *
+ * @param[in]   context                 resource context
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_release_res(struct ico_syc_res_context *context);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_set_input_region
+ *          Set the input region. (for haptic device)
+ *          Callback function notifies the result of setting the input region.
+ *
+ * @param[in]   input                   input region's information
+ * @param[in]   attr                    input region's attribute
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_set_input_region(const ico_syc_input_region_t *input, int attr);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_unset_input_region
+ *          Unset the input region. (for haptic device)
+ *          Callback function notifies the result of unsetting the input region.
+ *
+ * @param[in]   input                   input region's information
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_unset_input_region(const ico_syc_input_region_t *input);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*_ICO_SYC_APPRESCTL_H_*/
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/include/ico_syc_common.h b/include/ico_syc_common.h
new file mode 100644 (file)
index 0000000..48e5315
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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 Common API
+ *          for privilege and general applications
+ *
+ * @date    July-31-2013
+ */
+
+#ifndef _ICO_SYC_COMMON_H_
+#define _ICO_SYC_COMMON_H_
+
+#include "ico_syc_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_connect
+ *          Connect to System Controller,
+ *          and set the listener to notify the event of System Controller.
+ *          If user does not want to set callback function,
+ *          set NULL to argument "callback".
+ *
+ * @param[in]   callback                callback function
+ * @param[in]   user_data               passed data on called callback function
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_connect(ico_syc_callback_t callback, void *user_data);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_disconnect
+ *          Disconnect the link from System Controller,
+ *          and unset the listener to notify the event of System Controller.
+ *
+ * @param       none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void ico_syc_disconnect(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*_ICO_SYC_COMMON_H_*/
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/include/ico_syc_def.h b/include/ico_syc_def.h
deleted file mode 100644 (file)
index d8405ae..0000000
+++ /dev/null
@@ -1,48 +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   System Controller public header for permanent value
- *
- * @date    Feb-28-2013
- */
-
-#ifndef _ICO_SYC_DEF_H_
-#define _ICO_SYC_DEF_H_
-
-#include "ico_apf_error.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* common API error code        */
-#define ICO_SYC_EOK     ICO_APF_RESOURCE_E_NONE             /* OK                   */
-#define ICO_SYC_ENOENT  ICO_APF_RESOURCE_E_UNKOWN           /* No such object       */
-#define ICO_SYC_ESRCH   ICO_APF_RESOURCE_E_NOT_INITIALIZED  /* Not initialized      */
-#define ICO_SYC_EIO     ICO_APF_RESOURCE_E_COMMUNICATION    /* I/O error            */
-#define ICO_SYC_ENOMEM  ICO_APF_RESOURCE_E_NOT_IMPLEMENTED  /* Out of memory        */
-#define ICO_SYC_EINVAL  ICO_APF_RESOURCE_E_INVAL            /* Invalid argument     */
-#define ICO_SYC_ENOSYS  (-99)                               /* System error         */
-
-/* Vehicle information internal key */
-enum    _ico_syc_regulation_vehicleinfo_id  {
-    ICO_SYC_VEHICLEINFO_VEHICLE_SPEED = 1,  /* vehicle speed                        */
-    ICO_SYC_VEHICLEINFO_SHIFT_POSITION,     /* shift position                       */
-    ICO_SYC_VEHICLEINFO_TURN_SIGNAL,        /* blinker signal                       */
-    ICO_SYC_VEHICLEINFO_LIGHT_LEFT,         /* left turn light status               */
-    ICO_SYC_VEHICLEINFO_LIGHT_RIGHT,        /* right turn light status              */
-
-    ICO_SYC_VEHICLEINFO_MAX                 /* maximum number of type               */
-};
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _ICO_SYC_DEF_H_ */
-
diff --git a/include/ico_syc_error.h b/include/ico_syc_error.h
new file mode 100644 (file)
index 0000000..f0ecc9f
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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 Error definition
+ *          for privilege and general applications
+ *
+ * @date    July-31-2013
+ */
+
+#ifndef _ICO_SYC_ERROR_H_
+#define _ICO_SYC_ERROR_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*============================================================================*/
+/* definition                                                                 */
+/*============================================================================*/
+/*
+ * id of error
+ */
+typedef enum _ico_syc_error {
+    ICO_SYC_ERR_NONE            = 0,    /* success */
+    ICO_SYC_ERR_CONNECT         = -100, /* fail to connect */
+    ICO_SYC_ERR_CLOSED          = -101, /* closed */
+    ICO_SYC_ERR_INVALID_PARAM   = -102, /* invalid parameter */
+    ICO_SYC_ERR_OUT_OF_MEMORY   = -103, /* out of memory */
+    ICO_SYC_ERR_SYSTEM          = -104,
+    ICO_SYC_ERR_UNKNOWN         = -200  /* unknown error */
+} ico_syc_err_e;
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*_ICO_SYC_ERROR_H_*/
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/include/ico_syc_inputctl.h b/include/ico_syc_inputctl.h
new file mode 100644 (file)
index 0000000..524adcf
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * 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 Input Control API
+ *          for privilege applications
+ *
+ * @date    July-31-2013
+ */
+
+#ifndef _ICO_SYC_INPUTCTL_H_
+#define _ICO_SYC_INPUTCTL_H_
+
+#include <ico_input_mgr-client-protocol.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*============================================================================*/
+/* enum                                                                       */
+/*============================================================================*/
+/*
+ * type of input event's allocation
+ * @ICO_SYC_INPUT_ALLOC_FIX: fixed allocation
+ * @ICO_SYC_INPUT_ALLOC_VARIABLE: variable allocation
+ */
+typedef enum _input_alloc {
+    ICO_SYC_INPUT_ALLOC_FIX         = 1,
+    ICO_SYC_INPUT_ALLOC_VARIABLE    = 0
+} ico_syc_input_alloc_e;
+
+/*
+ * type of input event
+ * @ICO_SYC_INPUT_TYPE_POINTER: mouse event
+ * @ICO_SYC_INPUT_TYPE_KEYBOARD: keyboard event
+ * @ICO_SYC_INPUT_TYPE_TOUCH: touch panel event
+ * @ICO_SYC_INPUT_TYPE_SWITCH: switch event
+ */
+typedef enum _input_type {
+    ICO_SYC_INPUT_TYPE_POINTER  = ICO_INPUT_MGR_DEVICE_TYPE_POINTER,
+    ICO_SYC_INPUT_TYPE_KEYBOARD = ICO_INPUT_MGR_DEVICE_TYPE_KEYBOARD,
+    ICO_SYC_INPUT_TYPE_TOUCH    = ICO_INPUT_MGR_DEVICE_TYPE_TOUCH,
+    ICO_SYC_INPUT_TYPE_SWITCH   = ICO_INPUT_MGR_DEVICE_TYPE_SWITCH
+} ico_syc_input_type_e;
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_add_input
+ *          Add the input event to the application.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   device                  input device
+ * @param[in]   input                   input number
+ * @param[in]   fix                     fixed allocation or variable allocation
+ * @param[in]   keycode                 keycode
+ *                                      (If set "0", not allocate to keycode)
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ * @see         ico_syc_input_alloc_e
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_add_input(const char *appid, const char *device,
+                      int input, int fix, int keycode);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_delete_input
+ *          Delete the input event assigned to the application.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   device                  input device
+ * @param[in]   input                   input number
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_delete_input(const char *appid, const char *device, int input);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_send_input
+ *          Send the input event to the application.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @param[in]   type                    device type of input event
+ * @param[in]   deviceno                input device number
+ * @param[in]   code                    input event code
+ * @param[in]   value                   input event value
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ * @see         ico_syc_input_type_e
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_send_input(const char *appid, int surface, int type,
+                       int deviceno, int code, int value);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*_ICO_SYC_INPUTCTL_H_*/
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/include/ico_syc_msg.h b/include/ico_syc_msg.h
new file mode 100644 (file)
index 0000000..9520753
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ * 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
+ *          to send and receive message
+ *
+ * @date    July-31-2013
+ */
+
+#ifndef _ICO_SYC_MSG_H_
+#define _ICO_SYC_MSG_H_
+
+#include <json-glib/json-glib.h>
+
+#include <ico_uws.h>
+
+#include "ico_syc_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * typedef message
+ */
+typedef JsonGenerator *msg_t;
+
+/*
+ * typedef message string
+ */
+typedef gchar *msg_str_t;
+
+/*============================================================================*/
+/* internal functions                                                         */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_init_msg
+ *          Initialize to create and sent message.
+ *
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void ico_syc_init_msg(void);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_send_msg
+ *          Send message to System Controller.
+ *
+ * @param[in]   msg                     json object (msg_t)
+ * @return      result
+ * @return      0                       success
+ * @return      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_send_msg(msg_t msg);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_get_command
+ *          Get command from message data.
+ *
+ * @param[in]   data                    message data
+ * @param[in]   len                     length of data
+ * @return      command
+ * @return      command                 success
+ * @return      -1                      error
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_get_command(const void *data, size_t len);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_get_str_member
+ *          Get string member from json object.
+ *
+ * @param[in]   obj                     json object
+ * @param[in]   name                    json object member name
+ * @return      string data
+ * @return      not NULL                success
+ * @return      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+char *ico_syc_get_str_member(JsonObject *obj, const gchar *name);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_get_int_member
+ *          Get int member from json object.
+ *
+ * @param[in]   obj                     json object
+ * @param[in]   name                    json object member name
+ * @return      integer data
+ * @return      num                     success
+ * @return      -1                      error
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_get_int_member(JsonObject *obj, const gchar *name);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_free_msg
+ *          Free the json object.
+ *
+ * @param[in]   msg                     json object (msg_t)
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void ico_syc_free_msg(msg_t msg);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_term_msg
+ *          Terminate to create and send message.
+ *
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void ico_syc_term_msg(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*_ICO_SYC_MSG_H_*/
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/include/ico_syc_msg_cmd_def.h b/include/ico_syc_msg_cmd_def.h
new file mode 100644 (file)
index 0000000..f11221d
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * 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_msg_cmd_def.h
+ *
+ *  @brief  
+ */
+/*========================================================================*/
+#ifndef __ICO_SYC_MSG_CMD_DEF_H__
+#define __ICO_SYC_MSG_CMD_DEF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*============================================================================*/
+/* definition                                                                 */
+/*============================================================================*/
+/*
+ * uri and protocol
+ */
+#define ICO_SYC_URI             (char *)"ws://127.0.0.1:18081"
+#define ICO_SYC_PROTOCOL        (char *)"ico_syc_protocol"
+
+/*
+ * message primary key name
+ */
+#define MSG_PRMKEY_APPID        (char *)"appid"
+#define MSG_PRMKEY_CMD          (char *)"command"
+#define MSG_PRMKEY_PID          (char *)"pid"
+
+/* for privilege API */
+#define MSG_PRMKEY_ARG          (char *)"arg"
+/* window controller and input controller */
+#define MSG_PRMKEY_WINNAME      (char *)"winname"
+#define MSG_PRMKEY_SURFACE      (char *)"surface"
+#define MSG_PRMKEY_LAYER        (char *)"layer"
+#define MSG_PRMKEY_NODE         (char *)"node"
+#define MSG_PRMKEY_ZONE         (char *)"zone"
+#define MSG_PRMKEY_ANIM_NAME    (char *)"anim_name"
+#define MSG_PRMKEY_ANIM_TIME    (char *)"anim_time"
+#define MSG_PRMKEY_ATTR         (char *)"attr"
+#define MSG_PRMKEY_DEV          (char *)"device"
+#define MSG_PRMKEY_INPUT        (char *)"input_num"
+#define MSG_PRMKEY_ALLOC        (char *)"alloc_type"
+#define MSG_PRMKEY_KEY          (char *)"keycode"
+#define MSG_PRMKEY_DEVICE       (char *)"deviceno"
+#define MSG_PRMKEY_EV_TYPE      (char *)"ev_type"
+#define MSG_PRMKEY_EV_CODE      (char *)"ev_code"
+#define MSG_PRMKEY_EV_VAL       (char *)"ev_value"
+#define MSG_PRMKEY_POS_X        (char *)"pos_x"
+#define MSG_PRMKEY_POS_Y        (char *)"pos_y"
+#define MSG_PRMKEY_WIDTH        (char *)"width"
+#define MSG_PRMKEY_HEIGHT       (char *)"height"
+#define MSG_PRMKEY_RAISE        (char *)"raise"
+#define MSG_PRMKEY_VISIBLE      (char *)"visible"
+#define MSG_PRMKEY_ACTIVE       (char *)"active"
+#define MSG_PRMKEY_STRIDE       (char *)"stride"
+#define MSG_PRMKEY_FORMAT       (char *)"format"
+#define MSG_PRMKEY_RATE         (char *)"framerate"
+/* user controller */
+#define MSG_PRMKEY_USER         (char *)"user"
+#define MSG_PRMKEY_PASSWD       (char *)"password"
+#define MSG_PRMKEY_USER_NUM     (char *)"user_num"
+#define MSG_PRMKEY_USER_LIST    (char *)"user_list"
+#define MSG_PRMKEY_USER_LOGIN   (char *)"user_login"
+
+/* for general API */
+#define MSG_PRMKEY_RES          (char *)"res"
+#define MSG_PRMKEY_REGION       (char *)"region"
+/* app resource controller */
+#define MSG_PRMKEY_RES_WINDOW   (char *)"window"
+#define MSG_PRMKEY_RES_SOUND    (char *)"sound"
+#define MSG_PRMKEY_RES_INPUT    (char *)"input"
+#define MSG_PRMKEY_RES_ZONE     (char *)"zone"
+#define MSG_PRMKEY_RES_NAME     (char *)"name"
+#define MSG_PRMKEY_RES_SURFACE  (char *)"surface"
+#define MSG_PRMKEY_RES_ID       (char *)"id"
+#define MSG_PRMKEY_RES_ADJUST   (char *)"adjust"
+#define MSG_PRMKEY_RES_EV       (char *)"event"
+#define MSG_PRMKEY_RES_TYPE     (char *)"type"
+#define MSG_PRMKEY_RES_POS_X    (char *)"pos_x"
+#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_ATTR     (char *)"attr"
+
+
+/*
+ *
+ */
+/* commnad type mask */
+#define MSG_CMD_TYPE_WINCTRL            0x00010000
+#define MSG_CMD_TYPE_INPUTCTRL          0x00020000
+#define MSG_CMD_TYPE_USERMGR            0x00030000
+#define MSG_CMD_TYPE_RESOURCEMGR        0x00040000
+#define MSG_CMD_TYPE_INPUTDEVSETTING    0x00050000
+#define MSG_CMD_TYPE_MASK               0xFFFF0000
+
+/*
+ * message command name
+ */
+/* common */
+#define MSG_CMD_SEND_APPID          0x00000001
+/* window controller */
+#define MSG_CMD_CREATE              0x00010001
+#define MSG_CMD_DESTROY             0x00010002
+#define MSG_CMD_SHOW                0x00010003
+#define MSG_CMD_HIDE                0x00010004
+#define MSG_CMD_MOVE                0x00010005
+#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
+/* user controller */
+#define MSG_CMD_CHANGE_USER     0x00030001
+#define MSG_CMD_GET_USERLIST    0x00030002
+/* 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
+
+#ifdef __cplusplus
+}
+#endif
+#endif  /* __ICO_SYC_MSG_CMD_DEF_H__ */
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/include/ico_syc_private.h b/include/ico_syc_private.h
new file mode 100644 (file)
index 0000000..1f72e56
--- /dev/null
@@ -0,0 +1,345 @@
+/*
+ * 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    Aug-7-2013
+ */
+
+#ifndef _ICO_SYC_PRIVATE_H_
+#define _ICO_SYC_PRIVATE_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <ico_uws.h>
+
+#include "ico_syc_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*============================================================================*/
+/* definition                                                                 */
+/*============================================================================*/
+/*
+ * uri and protocol
+ */
+#define ICO_SYC_URI             (char *)"ws://127.0.0.1:18081"
+#define ICO_SYC_PROTOCOL        (char *)"ico_syc_protocol"
+
+#define ICO_SYC_MAX_LEN         128
+
+/*============================================================================*/
+/* variable & table                                                           */
+/*============================================================================*/
+struct ico_syc_res_context {
+    char                    appid[ICO_SYC_MAX_LEN];
+    /* window resource */
+    ico_syc_res_window_t    *window;
+    /* sound resource */
+    ico_syc_res_sound_t     *sound;
+    /* input resource */
+    ico_syc_res_input_t     *input;
+
+    /* window and sound resource type (basic or interruption) */
+    int                     type;
+};
+
+/*============================================================================*/
+/* internal function (common)                                                 */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_get_context
+ *          Get the ico_uws context connected to System Controller.
+ *
+ * @return      uws_context
+ * @retval      context                 success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+struct ico_uws_context *ico_syc_get_context(void);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_get_id
+ *          Get the ico_uws id to send message to System Controller.
+ *
+ * @return      uws_id
+ * @retval      id                      success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+void *ico_syc_get_id(void);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_get_appid
+ *          Get the application id.
+ *
+ * @return      appid
+ * @retval      appid                   success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+char *ico_syc_get_appid(void);
+
+/*============================================================================*/
+/* internal function (winctl)                                                 */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_win
+ *          Execute callback function. (ICO_SYC_EV_WIN_ACTIVE
+ *                                      ICO_SYC_EV_WIN_CREATE
+ *                                      ICO_SYC_EV_WIN_DESTROY)
+ *
+ * @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_win(ico_syc_callback_t callback, void *user_data,
+                    int event, const void *data, size_t len);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_win_attr
+ *          Execute callback function. (ICO_SYC_EV_WIN_ATTR_CHANGE)
+ *
+ * @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_win_attr(ico_syc_callback_t callback, void *user_data,
+                         int event, const void *data, size_t len);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_thumb
+ *          Execute callback function. (ICO_SYC_EV_THUMB_PREPARE
+ *                                      ICO_SYC_EV_THUMB_CHANGE
+ *                                      ICO_SYC_EV_THUMB_UNMAP)
+ *
+ * @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_thumb(ico_syc_callback_t callback, void *user_data,
+                      int event, const void *data, size_t len);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_layer
+ *          Execute callback function. (ICO_SYC_EV_LAYER_ATTR_CHANGE)
+ *
+ * @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_layer(ico_syc_callback_t callback, void *user_data,
+                      int event, const void *data, size_t len);
+
+/*============================================================================*/
+/* internal function (userctl)                                                */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_auth
+ *          Execute callback function. (ICO_SYC_EV_AUTH_FAIL)
+ *
+ * @param[in]   callback                callback function
+ * @param[in]   user_data               passed data on called callback function
+ * @param[in]   event                   event code
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void ico_syc_cb_auth(ico_syc_callback_t callback, void *user_data, int event);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_userlist
+ *          Execute callback function. (ICO_SYC_EV_USERLIST)
+ *
+ * @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_userlist(ico_syc_callback_t callback, void *user_data,
+                         int event, const void *data, size_t len);
+
+/*============================================================================*/
+/* internal function (appresctl)                                              */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @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               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_res(ico_syc_callback_t callback, void *user_data,
+                    int event, const void *data, size_t len);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_region
+ *          Execute callback function. (ICO_SYC_EV_INPUT_SET
+ *                                      ICO_SYC_EV_INPUT_UNSET)
+ *
+ * @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_region(ico_syc_callback_t callback, void *user_data,
+                       int event, const void *data, size_t len);
+
+
+/*============================================================================*/
+/* log macro                                                                  */
+/*============================================================================*/
+#ifndef  _NO_USE_DLOG
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "ICO_SYC"
+#include <dlog/dlog.h>
+
+#define _ERR(fmt, arg...)                                       \
+    do {                                                        \
+        fprintf(stderr,                                         \
+                "ico_syc E: %s:%d [ "fmt" ]\n",                 \
+                __FUNCTION__,                                   \
+                __LINE__,                                       \
+                ##arg);                                         \
+        LOGE("%s:%d " fmt, __FUNCTION__, __LINE__, ##arg);      \
+    } while (0)
+
+#define _WARN(fmt, arg...)                                      \
+    do {                                                        \
+        fprintf(stderr,                                         \
+                "ico_syc W: %s:%d [ "fmt" ]\n",                 \
+                __FUNCTION__,                                   \
+                __LINE__,                                       \
+                ##arg);                                         \
+        LOGW("%s:%d " fmt, __FUNCTION__, __LINE__, ##arg);      \
+    } while (0)
+
+#define _INFO(fmt, arg...)                                      \
+    do {                                                        \
+        fprintf(stderr,                                         \
+                "ico_syc I: %s:%d [ "fmt" ]\n",                 \
+                __FUNCTION__,                                   \
+                __LINE__,                                       \
+                ##arg);                                         \
+        LOGI("%s:%d " fmt, __FUNCTION__, __LINE__, ##arg);      \
+    } while (0)
+
+#define _DBG(fmt, arg...)                                       \
+    do {                                                        \
+        LOGD("%s:%d " fmt, __FUNCTION__, __LINE__, ##arg);      \
+    } while (0)
+
+#else
+
+#define _ERR(fmt, arg...)                                       \
+    do {                                                        \
+        fprintf(stderr,                                         \
+                "ico_syc E: %s:%d [ "fmt" ]\n",                 \
+                __FUNCTION__,                                   \
+                __LINE__,                                       \
+                ##arg);                                         \
+    } while (0)
+
+#define _WARN(fmt, arg...)                                      \
+    do {                                                        \
+        fprintf(stderr,                                         \
+                "ico_syc W: %s:%d [ "fmt" ]\n",                 \
+                __FUNCTION__,                                   \
+                __LINE__,                                       \
+                ##arg);                                         \
+    } while (0)
+
+
+#define _INFO(fmt, arg...)                                      \
+    do {                                                        \
+        fprintf(stderr,                                         \
+                "ico_syc I: %s:%d [ "fmt" ]\n",                 \
+                __FUNCTION__,                                   \
+                __LINE__,                                       \
+                ##arg);                                         \
+    } while (0)
+
+#define _DBG(fmt, arg...)                                       \
+    do {                                                        \
+        if (getenv("ICO_SYC_DEBUG")) {                          \
+            fprintf(stderr,                                     \
+                    "ico_syc D: %s:%d [ "fmt" ]\n",             \
+                    __FUNCTION__,                               \
+                    __LINE__,                                   \
+                    ##arg);                                     \
+        }                                                       \
+    } while (0)
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*_ICO_SYC_PRIVATE_H_*/
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/include/ico_syc_privilege.h b/include/ico_syc_privilege.h
new file mode 100644 (file)
index 0000000..aa7857b
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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 files of System Control API
+ *          for privilege application
+ *
+ * @date    July-31-2013
+ */
+
+#ifndef _ICO_SYC_PRIVILEGE_H_
+#define _ICO_SYC_PRIVILEGE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*============================================================================*/
+/* include files                                                              */
+/*============================================================================*/
+#include "ico_syc_error.h"
+#include "ico_syc_type.h"
+
+#include "ico_syc_winctl.h"
+#include "ico_syc_inputctl.h"
+#include "ico_syc_userctl.h"
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*_ICO_SYC_PRIVILEGE_H_*/
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/include/ico_syc_type.h b/include/ico_syc_type.h
new file mode 100644 (file)
index 0000000..0e9de4e
--- /dev/null
@@ -0,0 +1,257 @@
+/*
+ * 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
+ *          for privilege and general applications
+ *
+ * @date    Aug-6-2013
+ */
+
+#ifndef _ICO_SYC_TYPE_H_
+#define _ICO_SYC_TYPE_H_
+
+#include <ico_window_mgr-client-protocol.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*============================================================================*/
+/* global API                                                                 */
+/*============================================================================*/
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define ICO_API __attribute__ ((visibility("default")))
+#else
+#define ICO_API
+#endif
+
+/*============================================================================*/
+/* enum                                                                       */
+/*============================================================================*/
+/*
+ * id of event
+ */
+typedef enum _event_id {
+    ICO_SYC_EV_WIN_CREATE           = 1,  /* create window */
+    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_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 */
+    ICO_SYC_EV_RES_ACQUIRE          = 11, /* acquired resource */
+    ICO_SYC_EV_RES_DEPRIVE          = 12, /* deprived resource */
+    ICO_SYC_EV_RES_WAITING          = 13, /* waiting resource */
+    ICO_SYC_EV_RES_REVERT           = 14, /* reverted resource */
+    ICO_SYC_EV_RES_RELEASE          = 15, /* released resource */
+    ICO_SYC_EV_INPUT_SET            = 16, /* set input region */
+    ICO_SYC_EV_INPUT_UNSET          = 17  /* unset input region */
+} ico_syc_ev_e;
+
+/*
+ * general fixed value for window attribute
+ * @ICO_SYC_WIN_NOCHANGE: no change value
+ */
+typedef enum _win_value {
+    ICO_SYC_WIN_NOCHANGE    = ICO_WINDOW_MGR_V_NOCHANGE
+} ico_syc_win_value_e;
+
+/*
+ * thumbnail data format
+ * @ICO_SYC_THUMB_FORMAT_ARGB: argb format
+ * @ICO_SYC_THUMB_FORMAT_XRGB: xrgb format
+ */
+typedef enum _thumb_format {
+    ICO_SYC_THUMB_FORMAT_ARGB = WL_SHM_FORMAT_ARGB8888,
+    ICO_SYC_THUMB_FORMAT_XRGB = WL_SHM_FORMAT_XRGB8888
+} ico_syc_thumb_format_e;
+
+/*
+ * window raise/lower status
+ * @ICO_SYC_WIN_RAISE_RAISE: raise the surface
+ * @ICO_SYC_WIN_RAISE_LOWER: lower the surface
+ * @ICO_SYC_WIN_RAISE_NOCHANGE: order of showing surface is not change
+ */
+typedef enum _window_raise {
+    ICO_SYC_WIN_RAISE_RAISE     = ICO_WINDOW_MGR_RAISE_RAISE,
+    ICO_SYC_WIN_RAISE_LOWER     = ICO_WINDOW_MGR_RAISE_LOWER,
+    ICO_SYC_WIN_RAISE_NOCHANGE  = ICO_WINDOW_MGR_V_NOCHANGE
+} ico_syc_win_raise_e;
+
+/*
+ * window show/hide status
+ * @ICO_SYC_WIN_VISIBLE_SHOW: show the surface
+ * @ICO_SYC_WIN_VISIBLE_HIDE: hide the surface
+ * @ICO_SYC_WIN_VISIBLE_NOCHANGE: show/hide status is not change
+ */
+typedef enum _window_visible {
+    ICO_SYC_WIN_VISIBLE_SHOW        = ICO_WINDOW_MGR_VISIBLE_SHOW,
+    ICO_SYC_WIN_VISIBLE_HIDE        = ICO_WINDOW_MGR_VISIBLE_HIDE,
+    ICO_SYC_WIN_VISIBLE_NOCHANGE    = ICO_WINDOW_MGR_V_NOCHANGE
+} ico_syc_win_visible_e;
+
+/*
+ * type of window active
+ * @ICO_SYC_WIN_ACTIVE_NONE: surface is not active
+ * @ICO_SYC_WIN_ACTIVE_POINTER: pointing device is active
+ * @ICO_SYC_WIN_ACTIVE_KEYBOARD: keyboard is active
+ * @ICO_SYC_WIN_ACTIVE_SELECTED: pointing device that is operated
+ *                               by touch panel or mouse is still active
+ */
+typedef enum _window_active {
+    ICO_SYC_WIN_ACTIVE_NONE     = ICO_WINDOW_MGR_ACTIVE_NONE,
+    ICO_SYC_WIN_ACTIVE_POINTER  = ICO_WINDOW_MGR_ACTIVE_POINTER,
+    ICO_SYC_WIN_ACTIVE_KEYBOARD = ICO_WINDOW_MGR_ACTIVE_KEYBOARD,
+    ICO_SYC_WIN_ACTIVE_SELECTED = ICO_WINDOW_MGR_ACTIVE_SELECTED
+} ico_syc_win_act_e;
+
+/*
+ * layer show/hide status
+ * @ICO_SYC_LAYER_VISIBLE_SHOW: show the layer
+ * @ICO_SYC_LAYER_VISIBLE_HIDE: hide the layer
+ */
+typedef enum _layer_visible {
+    ICO_SYC_LAYER_VISIBLE_SHOW  = 0,
+    ICO_SYC_LAYER_VISIBLE_HIDE  = 1
+} ico_syc_layer_visible_e;
+
+/*============================================================================*/
+/* structure                                                                  */
+/*============================================================================*/
+/*
+ * window move information (zone/position/size)
+ */
+typedef struct _win_move {
+    char *zone;     /* area of showing application window */
+    int  pos_x;     /* window's display position (x) */
+    int  pos_y;     /* window's display position (y) */
+    int  width;     /* window width */
+    int  height;    /* window height */
+} ico_syc_win_move_t;
+
+/*
+ * window information
+ */
+typedef struct _win_info {
+    char *appid;    /* application id */
+    char *name;     /* window's surface name */
+    int  surface;   /* window's surface id */
+} ico_syc_win_info_t;
+
+/*
+ * window attributes
+ */
+typedef struct _win_attr {
+    char *appid;    /* application id */
+    char *name;     /* window's surface name */
+    int  surface;   /* window's surface id */
+    int  nodeid;    /* ecu number and display number in the ecu */
+    int  layer;     /* id of layer that the application's window is on */
+    int  pos_x;     /* window's display position (x) */
+    int  pos_y;     /* window's display position (y) */
+    int  width;     /* window width */
+    int  height;    /* window height */
+    int  raise;     /* changed order showing surface in the layer */
+    int  visible;   /* visible status */
+    int  active;    /* window active status */
+} ico_syc_win_attr_t;
+
+/*
+ * thumbnail information
+ * (notify from callback function)
+ */
+typedef struct _thumb_info {
+    char *appid;    /* application id */
+    int  surface;   /* window's surface id */
+    int  width;     /* window width */
+    int  height;    /* window height */
+    int  stride;    /* bites par line of frame buffer */
+    int  format;    /* format of thumbnail data */
+} ico_syc_thumb_info_t;
+
+/*
+ * layer attributes
+ */
+typedef struct _layer_attr {
+    int  layer;     /* layer id */
+    int  visible;   /* visible status */
+} ico_syc_layer_attr_t;
+
+/*
+ * user list
+ */
+typedef struct _user_list {
+    int  user_num;      /* number of user */
+    char **userlist;    /* address of user list */
+    char *user_login;   /* name of login user */
+} ico_syc_userlist_t;
+
+/*
+ * window resource information
+ */
+typedef struct _res_win {
+    char *zone;         /* area of showing application window */
+    char *name;         /* window's surface name */
+    char *id;           /* window id */
+} ico_syc_res_window_t;
+
+/*
+ * sound resource information
+ */
+typedef struct _res_sound {
+    char *zone;         /* area of playing sound */
+    char *name;         /* sound stream name */
+    char *id;           /* sound id */
+    int  adjust;        /* adjust action */
+} ico_syc_res_sound_t;
+
+/*
+ * input resource information
+ */
+typedef struct _res_input {
+    char *name;         /* input device name */
+    int  event;         /* input event id */
+} ico_syc_res_input_t;
+
+/*
+ * input region information
+ */
+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 */
+} ico_syc_input_region_t;
+
+/*
+ * resource(window/sound/input) information
+ */
+typedef struct _res_info {
+    ico_syc_res_window_t *window;  /* window resource information */
+    ico_syc_res_sound_t  *sound;   /* sound resource information */
+    ico_syc_res_input_t  *input;   /* input resource information */
+} ico_syc_res_info_t;
+
+/*============================================================================*/
+/* callback function                                                          */
+/*============================================================================*/
+typedef void (*ico_syc_callback_t) (const ico_syc_ev_e event,
+                                    const void *detail,
+                                    void *user_data);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*_ICO_SYC_TYPE_H_*/
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/include/ico_syc_userctl.h b/include/ico_syc_userctl.h
new file mode 100644 (file)
index 0000000..ebd7d5f
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * 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 User Control API
+ *          for privilege applications
+ *
+ * @date    July-31-2013
+ */
+
+#ifndef _ICO_SYC_USERCTL_H_
+#define _ICO_SYC_USERCTL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_change_user
+ *          Change the login user.
+ *          If fails to authenticate the user,
+ *          callback function notifies the result.
+ *
+ * @param[in]   name                    user name
+ * @param[in]   password                user's password
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void ico_syc_change_user(const char *name, const char *password);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_get_userlist
+ *          Get the user list.
+ *          Callback function notifies the user list.
+ *
+ * @param       none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void ico_syc_get_userlist(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*_ICO_SYC_USERCTL_H_*/
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/include/ico_syc_winctl.h b/include/ico_syc_winctl.h
new file mode 100644 (file)
index 0000000..cd0a3d1
--- /dev/null
@@ -0,0 +1,219 @@
+/*
+ * 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 Window Control API
+ *          for privilege applications
+ *
+ * @date    July-31-2013
+ */
+
+#ifndef _ICO_SYC_WINCTL_H_
+#define _ICO_SYC_WINCTL_H_
+
+#include <ico_window_mgr-client-protocol.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*============================================================================*/
+/* enum                                                                       */
+/*============================================================================*/
+/*
+ * showing window
+ * @ICO_SYC_WIN_SHOW_ALL: show all of the application windows
+ */
+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                                                                  */
+/*============================================================================*/
+/*
+ * animation information
+ */
+typedef struct _animation_info {
+    char *name;     /* name of animation (ex. fade,slide,zoom etc..) */
+    int  time;      /* millisecond time to show the transition's animation */
+} ico_syc_animation_t;
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_show
+ *          Show the application window with animation.
+ *          If user sets argument surface "ICO_SYC_WIN_SHOW_ALL",
+ *          show all of the application windows.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @param[in]   animation               animation information
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ * @see         ico_syc_win_show_e
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_show(const char *appid, int surface,
+                 const ico_syc_animation_t *animation);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_hide
+ *          Hide the application window with animation.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @param[in]   animation               animation information
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_hide(const char *appid, int surface,
+                 const ico_syc_animation_t *animation);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_move
+ *          Move the application window with animation.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @param[in]   move                    move information (zone/position/size)
+ * @param[in]   animation               animation information
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_move(const char *appid, int surface,
+                 const ico_syc_win_move_t *move,
+                 const ico_syc_animation_t *animation);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_change_active
+ *          Change the active window which receives the input-event notification
+ *          from System Controller.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_change_active(const char *appid, int surface);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_change_layer
+ *          Change the window's layer.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @param[in]   layer                   window's layer id
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+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.
+ *
+ * @param[in]   surface                 window's surface id
+ * @param[in]   framerate               notify cycle [ms]
+ * @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);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_unmap_thumb
+ *          Unmap the thumbnail data.
+ *          User calls this API when receiving the notification that
+ *          terminated the application.
+ *
+ * @param[in]   surface                 window's surface id
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_unmap_thumb(int surface);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_show_layer
+ *          Show the layer.
+ *
+ * @param[in]   layer                   window's layer id
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_show_layer(int layer);
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_hide_layer
+ *          Hide the layer.
+ *
+ * @param[in]   layer                   window's layer id
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+int ico_syc_hide_layer(int layer);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*_ICO_SYC_WINCTL_H_*/
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/include/ico_uxf.h b/include/ico_uxf.h
deleted file mode 100644 (file)
index 548ac95..0000000
+++ /dev/null
@@ -1,25 +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   user experiance library public header file
- *
- * @date    Feb-28-2013
- */
-
-#ifndef _ICO_UXF_H_
-#define _ICO_UXF_H_
-
-#include    <ico_apf_log.h>             /* Macros for log output            */
-#include    <ico_uxf_sysdef.h>          /* System definition values         */
-#include    <ico_uxf_def.h>             /* Public permanent define symbols  */
-#include    <ico_uxf_typedef.h>         /* ublic data and structue types    */
-#include    <ico_uxf_proto.h>           /* Prototypic declaration of APIs   */
-
-#endif  /* _ICO_UXF_H_ */
-
diff --git a/include/ico_uxf_conf.h b/include/ico_uxf_conf.h
deleted file mode 100644 (file)
index 41066e1..0000000
+++ /dev/null
@@ -1,277 +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   user experiance library public header file(configuration)
- *
- * @date    Feb-28-2013
- */
-
-#ifndef ICO_UXF_CONF_H_
-#define ICO_UXF_CONF_H_
-
-#include <glib.h>
-#include "ico_uxf_conf_def.h"
-#include "ico_uxf_sysdef.h"
-#include "ico_uxf_def.h"
-#include "ico_uxf_typedef.h"
-#include "ico_apf_log.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _ico_uxf_conf_misc {
-    char topdir[ICO_UXF_CONF_DIR_MAX+1];
-    char confdir[ICO_UXF_CONF_DIR_MAX+1];
-    short myhostId;
-    short masterhostId;
-    char *myhostName;
-    char *myaddress;
-    char *homescreen;
-    char *masterhostaddress;
-    short default_hostId;
-    short default_kindId;
-    short default_categoryId;
-    short default_displayId;
-    short default_layerId;
-    short default_dispzoneId;
-    short default_soundId;
-    short default_soundzoneId;
-    short default_inputdevId;
-    short default_inputswId;
-    int appscontrollerport;
-    int soundpluginport;
-    int loglevel;
-    int logflush;
-} Ico_Uxf_conf_misc;
-
-typedef struct _ico_uxf_conf_host {
-    int id;
-    char *name;
-    char *address;
-    int type;
-    char *homescreen;
-} Ico_Uxf_conf_host;
-
-typedef struct _ico_uxf_conf_category {
-    int id;
-    char *name;
-    short view;
-    short type;
-    short sound;
-    short input;
-    short priority;
-    short res;                                  /* (unused)         */
-} Ico_Uxf_conf_category;
-
-typedef struct _ico_uxf_conf_kind {
-    int id;
-    char *name;
-    short priv;
-    short priority;
-} Ico_Uxf_conf_kind;
-
-typedef struct _ico_uxf_conf_appdisplay {
-    short displayId;
-    short layerId;
-    short zoneId;
-    short res;                                  /* (unused)         */
-} Ico_Uxf_conf_appdisplay;
-
-typedef struct _ico_uxf_conf_appsound {
-    short soundId;
-    short zoneId;
-} Ico_Uxf_conf_appsound;
-
-typedef struct _ico_uxf_conf_appinput {
-    short inputdevId;
-    short inputswId;
-} Ico_Uxf_conf_appinput;
-
-typedef struct _ico_uxf_conf_application {
-    char *appid;
-    char *name;
-    char *group;
-    char *exec;
-    char *type;
-    int hostId;
-    char *location;
-    char *icon_key_name;
-    char *animation;
-    short animation_time;
-    char autostart;
-    char noicon;
-    char noconfigure;
-    char menuoverlap;
-    char res[2];
-    unsigned short invisiblecpu;
-    short kindId;
-    short categoryId;
-    short displayzoneNum;
-    short soundzoneNum;
-    short inputdevNum;
-    Ico_Uxf_conf_appdisplay display[ICO_UXF_APPDISPLAY_MAX];
-    Ico_Uxf_conf_appsound   sound[ICO_UXF_APPSOUND_MAX];
-    Ico_Uxf_conf_appinput   input[ICO_UXF_APPINPUT_MAX];
-    struct _ico_uxf_conf_application *nextidhash;
-    struct _ico_uxf_conf_application *nextnamehash;
-} Ico_Uxf_conf_application;
-
-typedef struct _ico_uxf_conf_display_layer {
-    int id;
-    char *name;
-    char menuoverlap;
-    char res[3];                                /* (unused)         */
-} Ico_Uxf_conf_display_layer;
-
-#define ZONE_MAX_OVERLAP    (ICO_UXF_DISPLAY_ZONE_MAX-1)
-typedef struct _ico_uxf_conf_display_zone {
-    int id;
-    char *name;
-    short node;
-    short x;
-    short y;
-    short width;
-    short height;
-    short zoneidx;
-    struct _ico_uxf_conf_display *display;
-    unsigned char overlapNum;
-    unsigned char overlap[ZONE_MAX_OVERLAP];
-} Ico_Uxf_conf_display_zone;
-
-typedef struct _ico_uxf_conf_display {
-    int id;
-    char *name;
-    short hostId;
-    short displayno;
-    short type;
-    short width;
-    short height;
-    short inch;
-    short layerNum;
-    short zoneNum;
-    char *wayland;
-    Ico_Uxf_conf_display_layer *layer;
-    Ico_Uxf_conf_display_zone *zone;
-} Ico_Uxf_conf_display;
-
-typedef struct _ico_uxf_conf_sound_zone {
-    int id;
-    char *name;
-    short zoneidx;
-    short res;                                  /* (unused)         */
-    struct _ico_uxf_conf_sound *sound;
-    unsigned char overlapNum;
-    unsigned char overlap[ZONE_MAX_OVERLAP];
-} Ico_Uxf_conf_sound_zone;
-
-typedef struct _ico_uxf_conf_sound {
-    int id;
-    char *name;
-    short hostId;
-    short soundno;
-    short type;
-    short zoneNum;
-    Ico_Uxf_conf_sound_zone *zone;
-} Ico_Uxf_conf_sound;
-
-typedef struct _ico_uxf_conf_inputsw {
-    struct _ico_uxf_conf_inputdev   *inputdev;
-    char *name;
-    char *appid;
-    int keycode;
-} Ico_Uxf_conf_inputsw;
-
-typedef struct _ico_uxf_conf_inputdev {
-    int id;
-    char *name;
-    short inputswNum;
-    short res;                                  /* (unused)         */
-    Ico_Uxf_conf_inputsw *inputsw;
-} Ico_Uxf_conf_inputdev;
-
-typedef struct _ico_uxf_sys_config {
-    Ico_Uxf_conf_misc misc;
-    short hostNum;
-    short categoryNum;
-    short kindNum;
-    short displayNum;
-    short soundNum;
-    short inputdevNum;
-    Ico_Uxf_conf_host *host;
-    Ico_Uxf_conf_category *category;
-    Ico_Uxf_conf_kind *kind;
-    Ico_Uxf_conf_display *display;
-    Ico_Uxf_conf_sound *sound;
-    Ico_Uxf_conf_inputdev *inputdev;
-} Ico_Uxf_Sys_Config;
-
-typedef struct _ico_uxf_app_config {
-    int applicationNum;
-    int ailNum;
-    Ico_Uxf_conf_application *application;
-    Ico_Uxf_conf_application *hashidtable[ICO_UXF_MISC_HASHSIZE];
-    Ico_Uxf_conf_application *hashnametable[ICO_UXF_MISC_HASHSIZE];
-} Ico_Uxf_App_Config;
-
-typedef void (*Ico_Uxf_AppUpdata_Cb)(const char *appid, int type);
-
-const Ico_Uxf_Sys_Config* ico_uxf_getSysConfig(void);
-const Ico_Uxf_Sys_Config* ico_uxf_ifGetSysConfig(void);
-const Ico_Uxf_App_Config* ico_uxf_getAppConfig(void);
-
-void ico_uxf_closeSysConfig(void);
-void ico_uxf_closeAppConfig(void);
-
-int ico_uxf_getSysKindByName(const char *skind);
-int ico_uxf_getSysCategoryByName(const char *scategory);
-int ico_uxf_getSysHostByName(const char *shost);
-int ico_uxf_getSysHostTypeByName(const char *stype);
-int ico_uxf_getSysDisplayByName(const char *sdisplay);
-int ico_uxf_getSysDispTypeByName(const char *stype);
-int ico_uxf_getSysLayerByName(const int display, const char *slayer);
-int ico_uxf_getSysDispZoneByName(const int display, const char *sdispzone);
-int ico_uxf_getSysSoundByName(const char *ssound);
-int ico_uxf_getSysSoundZoneByName(const int sound, const char *ssoundzone);
-int ico_uxf_getSysInputdevByName(const char *sinputdev);
-int ico_uxf_getSysInputswByName(const int inputdev, const char *sinputsw);
-int ico_uxf_getSysBoolByName(const char *sbool);
-int ico_uxf_getAppDisplay(const Ico_Uxf_conf_application *app, const int idx,
-                          int *x, int *y, int *width, int *height);
-
-const Ico_Uxf_conf_host* ico_uxf_getSysHostById(const int hostId);
-const Ico_Uxf_conf_application* ico_uxf_getAppByAppid(const char *appid);
-const Ico_Uxf_conf_application* ico_uxf_getAppByName(const char *name);
-const Ico_Uxf_conf_category* ico_uxf_getAppCategoryById(const int categoryId);
-const Ico_Uxf_conf_display* ico_uxf_getSysDisplayById(const int displayId);
-const char *ico_uxf_get_SysLocation( const int hostId );
-
-int ico_uxf_conf_setAppUpdateCb(Ico_Uxf_AppUpdata_Cb func);
-
-/* define log macros    */
-#ifndef uifw_trace
-#define uifw_debug      ICO_UXF_DEBUG
-#define uifw_trace      ICO_UXF_DEBUG
-#define uifw_critical   ICO_UXF_CRITICAL
-#define uifw_info       ICO_UXF_INFO
-#define uifw_warn       ICO_UXF_WARN
-#define uifw_error      ICO_UXF_ERROR
-#define uifw_logflush   ico_uxf_log_flush
-#endif  /*uifw_trace*/
-
-void ico_uxf_closeSysConfig(void);
-
-#define ICO_UXF_CONF_EVENT_INSTALL      (0)
-#define ICO_UXF_CONF_EVENT_UNINSTALL    (1)
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* ICO_UXF_CONF_H_ */
-
diff --git a/include/ico_uxf_conf_common.h b/include/ico_uxf_conf_common.h
deleted file mode 100644 (file)
index 27f97f1..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-/**
- * @brief   user experiance library public header file(configuration)
- *
- * @date    Feb-28-2013
- */
-
-#ifndef ICO_UXF_CONF_COMMON_H_
-#define ICO_UXF_CONF_COMMON_H_
-
-#include <glib.h>
-
-#include "ico_uxf_sysdef.h"
-#include "ico_uxf_def.h"
-#include "ico_uxf_conf.h"
-#include "ico_apf_log.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Prototyypes of configuration functions           */
-int ico_uxf_conf_getUint(const char* str);
-GList* ico_uxf_conf_countNumericalKey(GKeyFile *keyfile, const char* group);
-const char* ico_uxf_conf_appendStr(const char* str1, const char* str2);
-void ico_uxf_conf_checkGerror(GError** error);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* ICO_UXF_CONF_COMMON_H_ */
-
diff --git a/include/ico_uxf_conf_def.h b/include/ico_uxf_conf_def.h
deleted file mode 100644 (file)
index cba3ee5..0000000
+++ /dev/null
@@ -1,51 +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   user experiance library public header file(configuration)
- *
- * @date    Feb-28-2013
- */
-
-#ifndef ICO_UXF_CONF_DEF_H_
-#define ICO_UXF_CONF_DEF_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Environment variable for UI-FW top directory             */
-#define ICO_UXF_TOP_ENV         "UIFW_TOPDIR"
-
-/* Default top directory of UI-FW                           */
-#define ICO_UXF_TOP_TOPDIR      "/usr/apps/org.tizen.ico.homescreen"
-
-/* Environment variable for top directory of cconfiguration files   */
-#define ICO_UXF_CONFIG_ENV      "UIFW_CONFDIR"
-
-/* Default top directory of cconfiguration files            */
-#define ICO_UXF_CONFIG_DIR      "res/config"
-
-/* Configuration file names                                 */
-#define ICO_UXF_CONFIG_SYSTEM   "system.conf"
-#define ICO_UXF_CONFIG_APPATTR  "app_attr.conf"
-
-/* Directory of application manifest                        */
-#define ICO_UXF_CONFIG_APPSDIR  "apps"
-
-/* Maximum length of the configuration directory name       */
-#define ICO_UXF_CONF_DIR_MAX    63
-
-/* Maximum length of Wayland connection name                */
-#define ICO_UXF_CONF_WAYLAND_NAME   39
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* ICO_UXF_CONF_DEF_H_ */
-
diff --git a/include/ico_uxf_conf_ecore.h b/include/ico_uxf_conf_ecore.h
deleted file mode 100644 (file)
index 1997da4..0000000
+++ /dev/null
@@ -1,47 +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   user experiance library public header file(configuration)
- *
- * @date    Feb-28-2013
- */
-
-#ifndef _ICO_UXF_CONF_ECORE_H_
-#define _ICO_UXF_CONF_ECORE_H_
-
-#include <glib.h>
-#include "ico_uxf_conf_def.h"
-#include "ico_uxf_sysdef.h"
-#include "ico_uxf_def.h"
-#include "ico_uxf_typedef.h"
-#include "ico_apf_log.h"
-#include "ico_uxf_conf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int ico_uxf_econf_setAppUpdateCb(Ico_Uxf_AppUpdata_Cb func);
-
-/* define log macros    */
-#ifndef uifw_trace
-#define uifw_debug      ICO_UXF_DEBUG
-#define uifw_trace      ICO_UXF_DEBUG
-#define uifw_critical   ICO_UXF_CRITICAL
-#define uifw_info       ICO_UXF_INFO
-#define uifw_warn       ICO_UXF_WARN
-#define uifw_error      ICO_UXF_ERROR
-#define uifw_logflush   ico_uxf_log_flush
-#endif  /*uifw_trace*/
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _ICO_UXF_CONF_ECORE_H_ */
-
diff --git a/include/ico_uxf_def.h b/include/ico_uxf_def.h
deleted file mode 100644 (file)
index 4bbdbad..0000000
+++ /dev/null
@@ -1,143 +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   header file of user experience liblary for HomeScreen(define symbols)
- *
- * @date    Feb-28-2013
- */
-
-#ifndef _ICO_UXF_DEF_H_
-#define _ICO_UXF_DEF_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* ECU type                                 */
-#define ICO_UXF_HOSTTYPE_CENTER     0               /* Center display               */
-#define ICO_UXF_HOSTTYPE_METER      1               /* Meter display                */
-#define ICO_UXF_HOSTTYPE_REMOTE     2               /* Information device(mobile device)*/
-#define ICO_UXF_HOSTTYPE_PASSENGER  3               /* Passenger display            */
-#define ICO_UXF_HOSTTYPE_REAR       4               /* Rear-seat entertainment      */
-#define ICO_UXF_HOSTTYPE_REARLEFT   5               /* Rear-seat entertainment(Left)*/
-#define ICO_UXF_HOSTTYPE_REARRIGHT  6               /* Rear-seat entertainment(right)*/
-
-/* Default DisplayId                        */
-#define ICO_UXF_DISPLAY_DEFAULT     0               /* Default display              */
-
-/* Display type                             */
-#define ICO_UXF_DISPLAYTYPE_CENTER      0           /* Center display               */
-#define ICO_UXF_DISPLAYTYPE_METER       1           /* Meter display                */
-#define ICO_UXF_DISPLAYTYPE_REMOTE      2           /* Information device(mobile device)*/
-#define ICO_UXF_DISPLAYTYPE_PASSENGER   3           /* Passenger display            */
-#define ICO_UXF_DISPLAYTYPE_REAR        4           /* Rear-seat display            */
-#define ICO_UXF_DISPLAYTYPE_REARLEFT    5           /* Rear-seat display(left)      */
-#define ICO_UXF_DISPLAYTYPE_REARRIGHT   6           /* Rear-seat display(right)     */
-
-/* Window active status                     */
-#define ICO_UXF_WINDOW_INACTIVE         0           /* not active                   */
-#define ICO_UXF_WINDOW_POINTER_ACTIVE   1           /* pointer active               */
-#define ICO_UXF_WINDOW_KEYBOARD_ACTIVE  2           /* keyboard active              */
-#define ICO_UXF_WINDOW_SELECT           4           /* window selected by operation */
-
-/* Policy                                   */
-#define ICO_UXF_POLICY_ALWAYS           0           /* No control                   */
-#define ICO_UXF_POLICY_RUNNING          1           /* Runnning only                */
-#define ICO_UXF_POLICY_PARKED           2           /* Parked only                  */
-#define ICO_UXF_POLICY_SHIFT_PARKING    3           /* Shift-position is park       */
-#define ICO_UXF_POLICY_SHIFT_REVERSES   4           /* Shift-position is reverses   */
-#define ICO_UXF_POLICY_BLINKER_LEFT     5           /* Blinker is left              */
-#define ICO_UXF_POLICY_BLINKER_RIGHT    6           /* Blinker is right             */
-
-/* Privilege                                */
-#define ICO_UXF_PRIVILEGE_ALMIGHTY      0           /* almighty privilege           */
-#define ICO_UXF_PRIVILEGE_SYSTEM        1           /* system level                 */
-#define ICO_UXF_PRIVILEGE_SYSTEM_AUDIO  2           /* system level(audio only)     */
-#define ICO_UXF_PRIVILEGE_SYSTEM_VISIBLE 3          /* system level(visible only)   */
-#define ICO_UXF_PRIVILEGE_MAKER         4           /* maker level                  */
-#define ICO_UXF_PRIVILEGE_CERTIFICATE   5           /* certificated                 */
-#define ICO_UXF_PRIVILEGE_NONE          6           /* no privilege                 */
-
-/* Event values                             */
-#define ICO_UXF_EVENT_ALL               0xffffffff  /* Mask value of all events     */
-#define ICO_UXF_EVENT_VISIBLE           0x00000001  /* Change window visibility     */
-#define ICO_UXF_EVENT_RESIZE            0x00000002  /* Change window position/size  */
-#define ICO_UXF_EVENT_VISIBLE_REQ       0x00000004  /* Request for window visibility*/
-#define ICO_UXF_EVENT_RESIZE_REQ        0x00000008  /* request for window position/size*/
-#define ICO_UXF_EVENT_NEWWINDOW         0x00000010  /* Created new window           */
-#define ICO_UXF_EVENT_DESTORYWINDOW     0x00000020  /* Destroyed a window           */
-#define ICO_UXF_EVENT_ACTIVEWINDOW      0x00000040  /* Change window active status  */
-#define ICO_UXF_EVENT_EXECPROCESS       0x00000100  /* Application started          */
-#define ICO_UXF_EVENT_TERMPROCESS       0x00000200  /* Application stopped          */
-#define ICO_UXF_EVENT_EXINPUT           0x00200000  /* extra input event            */
-
-#define ICO_UXF_EVENT_VALIDALL          0x8020037f  /* Set of the event with a meaning*/
-
-/* Application status                       */
-#define ICO_UXF_PROCSTATUS_STOP     0x00000000      /* Stopped                      */
-#define ICO_UXF_PROCSTATUS_INIT     0x00000001      /* Initializing                 */
-#define ICO_UXF_PROCSTATUS_RUN      0x00000002      /* Running                      */
-#define ICO_UXF_PROCSTATUS_TERM     0x00000004      /* Terminating                  */
-
-/* Window controll hook code                */
-#define ICO_UXF_HOOK_WINDOW_CREATE_MAIN     0x00    /* created main window          */
-#define ICO_UXF_HOOK_WINDOW_CREATE_SUB      0x01    /* created sub window           */
-#define ICO_UXF_HOOK_WINDOW_DESTORY_MAIN    0x10    /* destoryed main window        */
-#define ICO_UXF_HOOK_WINDOW_DESTORY_SUB     0x11    /* destoryed sub window         */
-
-/* API return code                          */
-#define ICO_UXF_EOK             0                   /* OK                           */
-#define ICO_UXF_EPERM           -1                  /* Operation not permitted      */
-#define ICO_UXF_ENOENT          -2                  /* No such object               */
-#define ICO_UXF_ESRCH           -3                  /* Not initialized              */
-#define ICO_UXF_EIO             -5                  /* I/O(send/receive) error      */
-#define ICO_UXF_ENXIO           -6                  /* Not exist                    */
-#define ICO_UXF_E2BIG           -7                  /* Buffer size too smale        */
-#define ICO_UXF_EBADF           -9                  /* Illegal data type            */
-#define ICO_UXF_EAGAIN          -11                 /* Try again                    */
-#define ICO_UXF_ENOMEM          -12                 /* Out of memory                */
-#define ICO_UXF_EFAULT          -14                 /* Bad address                  */
-#define ICO_UXF_EBUSY           -16                 /* Not available now            */
-#define ICO_UXF_EEXIST          -17                 /* Multiple define              */
-#define ICO_UXF_EINVAL          -22                 /* Invalid argument             */
-#define ICO_UXF_ENOSYS          -38                 /* System error                 */
-
-/* AppsControol control flag                */
-#define ICO_UXF_APPSCTL_INVISIBLE   0x01            /* invisibled by AppsController */
-#define ICO_UXF_APPSCTL_REGULATION  0x02            /* invisibled by Regulation     */
-#define ICO_UXF_APPSCTL_TEMPVISIBLE 0x10            /* tempolary visible for menu   */
-
-/* Log output level                         */
-#define ICO_UXF_LOGLEVEL_ERROR    4                 /* Error                        */
-#define ICO_UXF_LOGLEVEL_CRITICAL 8                 /* Critical                     */
-#define ICO_UXF_LOGLEVEL_WARNING 16                 /* Warning                      */
-#define ICO_UXF_LOGLEVEL_INFO    64                 /* Information                  */
-#define ICO_UXF_LOGLEVEL_DEBUG  128                 /* Debug write                  */
-
-/* Macros for node Id                       */
-#define ICO_UXF_NODEID_2_HOSTID(nodeid)         (((unsigned int)nodeid) >> 8)
-#define ICO_UXF_NODEID_2_DISPLAYNO(nodeid)      (((unsigned int)nodeid) & 0x0ff)
-#define ICO_UXF_NODEDISP_2_NODEID(nodeid, displayno)  \
-                                                ((nodeid << 8) | displayno)
-#define ICO_UXF_SURFACEID_2_HOSTID(surfid)      (((unsigned int)surfid) >> 24)
-#define ICO_UXF_SURFACEID_2_DISPLAYNO(surfid)   ((((unsigned int)surfid) >> 16) & 0x0ff)
-#define ICO_UXF_SURFACEID_2_NODEID(surfid)      (((unsigned int)surfid) >> 16)
-#define ICO_UXF_SURFACEID_BASE(nodeid)          (((unsigned int)nodeid) << 16)
-
-/* Macros for generate hash value           */
-extern int ico_uxf_misc_hashByName(const char *name);
-#define ICO_UXF_MISC_HASHSIZE       64      /* Hash table size(must be 2's factorial*/
-#define ICO_UXF_MISC_HASHBYID(v)        (v & (ICO_UXF_MISC_HASHSIZE-1))
-#define ICO_UXF_MISC_HASHBYNAME(name)   ico_uxf_misc_hashByName(name)
-
-#ifdef __cplusplus
-}
-#endif
-#endif  /* _ICO_UXF_DEF_H_ */
-
diff --git a/include/ico_uxf_proto.h b/include/ico_uxf_proto.h
deleted file mode 100644 (file)
index 8565a83..0000000
+++ /dev/null
@@ -1,137 +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   header file of user experience library for HomeScreen
- *
- * @date    Feb-28-2013
- */
-
-#ifndef _ICO_UXF_PROTO_H_
-#define _ICO_UXF_PROTO_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Initialize/terminate/MainLoop/Others           */
-struct wl_display;
-int ico_uxf_init(const char *name);
-                                        /* Initialize(for general application)  */
-int ico_uxf_shutdown(void);
-                                        /* Terminate                            */
-void ico_uxf_main_loop_iterate(void);
-                                        /* Iterate mainLoop                     */
-int ico_uxf_callback_set(const unsigned int mask,
-                         Ico_Uxf_Event_Cb func, const int arg);
-                                        /* Add event callback function          */
-int ico_uxf_callback_remove(const unsigned int mask,
-                            Ico_Uxf_Event_Cb func, const int arg);
-                                        /* Remove event callback function       */
-void ico_uxf_timer_wake(const int msec);
-                                        /* UX-FW timer                          */
-
-/* Control window                               */
-int ico_uxf_window_event_mask(const int window, const unsigned int mask);
-                                        /* Set event to receive through the window*/
-int ico_uxf_window_attribute_get(const int window, Ico_Uxf_WindowAttr *attr);
-                                        /* Get window attribute                 */
-int ico_uxf_window_query_display(const int display, Ico_Uxf_DisplayAttr *attr);
-                                        /* Get display attribute                */
-int ico_uxf_window_query_displays(Ico_Uxf_DisplayAttr attr[], const int num);
-                                        /* Get all displays attribute           */
-int ico_uxf_window_query_layer(const int display, const int layer,
-                               Ico_Uxf_LayerAttr *attr);
-                                        /* Get layer attribute                  */
-int ico_uxf_window_query_layers(const int display,
-                                Ico_Uxf_LayerAttr attr[], const int num);
-                                        /* Get all layers attribute             */
-int ico_uxf_window_query_windows(const int display,
-                                 Ico_Uxf_WindowAttr attr[], const int num);
-                                        /* Get all windows attribute            */
-void ico_uxf_window_screen_size_get(int *width, int *height);
-                                        /* Get display size                     */
-int ico_uxf_window_layer(const int window, const int layer);
-                                        /* Set window layer                     */
-int ico_uxf_layer_visible(const int display, const int layer, const int visible);
-                                        /* Show/Hide layer                      */
-int ico_uxf_window_show(const int window);
-                                        /* Show window                          */
-int ico_uxf_window_hide(const int window);
-                                        /* Hide window                          */
-int ico_uxf_window_visible_animation(const int window, const int show);
-                                        /* Show/Hide with animation             */
-int ico_uxf_window_visible_raise(const int window,
-                                 const int visible, const int raise);
-                                        /* Set window show/hide and raise/lower */
-int ico_uxf_window_resize(const int window, const int w, const int h);
-                                        /* Resize window size                   */
-int ico_uxf_window_resize_flag(const int window, const int w, const int h, const int flag);
-                                        /* Resize window size (with option)     */
-int ico_uxf_window_move(const int window, const int x, const int y, const int anima);
-                                        /* Move window                          */
-int ico_uxf_window_raise(const int window);
-                                        /* Raise window                         */
-int ico_uxf_window_lower(const int window);
-                                        /* Lower window                         */
-int ico_uxf_window_active(const int window, const int target);
-                                        /* Activate window                      */
-int ico_uxf_window_animation(const int window, const int type,
-                             const char *animation, const int time);
-                                        /* Set window animation                 */
-void ico_uxf_window_animation_control(const int control, const int animation);
-                                        /* Set animation control                */
-int ico_uxf_window_control(const char *appid, const int winidx,
-                           const int control, const int onoff);
-                                        /* Window visible control from AppsController*/
-void ico_uxf_window_hook(Ico_Uxf_Hook func);
-                                        /* Set window control hook              */
-/* Input switch                                 */
-Ico_Uxf_InputDev *ico_uxf_inputdev_attribute_get(const int devidx);
-                                        /* get input device attribute           */
-Ico_Uxf_InputSw  *ico_uxf_inputsw_attribute_get(Ico_Uxf_InputDev *inputdev, const int swidx);
-                                        /* get input switch attribute           */
-int ico_uxf_input_control(const int add, const char *appid,
-                          const char *device, const int input, const int keycode);
-                                        /* control input switch                 */
-/* Launcher API                                 */
-int ico_uxf_process_execute(const char *name);
-                                        /* Start application                    */
-int ico_uxf_process_terminate(const char *process);
-                                        /* Stop application                     */
-int ico_uxf_process_attribute_get(const char *process, Ico_Uxf_ProcessAttr *attr);
-                                        /* Get application status               */
-int ico_uxf_process_is_active(const char *process);
-                                        /* Get application activity             */
-void *ico_uxf_process_exttable_get(const char *process);
-                                        /* Get extended table address           */
-int ico_uxf_process_exttable_set(const char *process, void *table);
-                                        /* Set extended table address           */
-int ico_uxf_process_window_get(const char *process,
-                               Ico_Uxf_ProcessWin *attr, const int num);
-                                        /* Get all windows of one application   */
-int ico_uxf_process_window_get_one(const char *process,
-                                   Ico_Uxf_ProcessWin *attr, const int winidx);
-                                        /* Get one windows of one application   */
-int ico_uxf_process_query_processes(Ico_Uxf_ProcessAttr attr[], const int num);
-                                        /* Get all aplications attribute        */
-void ico_uxf_set_lastapp(const char *appid);
-                                        /* Set/Reset last application           */
-char *ico_uxf_getchild_appid(const char *appid);
-                                        /* Get child applicationId              */
-
-/* Wayland depend function                      */
-int ico_uxf_wl_display_fd(void);
-                                        /* Get wayland connect file descriptor  */
-struct wl_display *ico_uxf_wl_display(void);
-                                        /* Get wayland display                  */
-#ifdef __cplusplus
-}
-#endif
-#endif  /* _ICO_UXF_PROTO_H_ */
-
diff --git a/include/ico_uxf_sysdef.h b/include/ico_uxf_sysdef.h
deleted file mode 100644 (file)
index a462700..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0.  The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-/**
- * @brief   user experiance library public header file(system limit vaule)
- *
- * @date    Feb-28-2013
- */
-
-#ifndef _ICO_UXF_SYSDEF_H_
-#define _ICO_UXF_SYSDEF_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Default values                           */
-#define ICO_UXF_PROC_DEFAULT_HOMESCREEN "org.tizen.ico.homescreen"
-                                            /* Default application ID of HomeScreen */
-#define ICO_UXF_ENV_APPINF  "ICO_UXF_ENV_APPINF"
-                                            /* The name of the environment variable that*/
-                                            /* an application manager hands to application*/
-/* Maximum values on system wide            */
-#define ICO_UXF_HOST_MAX            16      /* Maximum number of ECUs               */
-#define ICO_UXF_DISPLAY_LAYER_MAX   16      /* Maximum number of Layers             */
-#define ICO_UXF_CATEGORY_MAX        20      /* Maximum number of application categorys*/
-#define ICO_UXF_DISPLAY_ZONE_MAX    30      /* Maximum zone on display in car       */
-#define ICO_UXF_SOUND_ZONE_MAX      10      /* Maximum zone on sound in car         */
-#define ICO_UXF_INPUT_SW_MAX        50      /* Maximum input sw in car              */
-#define ICO_UXF_REGULATION_VIC_MAX  20      /* Maxumum vehicle info for regulation  */
-
-/* Maximum length of string (with out last NULL)    */
-#define ICO_UXF_MAX_PROCESS_NAME    63      /* Maximum length of application name   */
-#define ICO_UXF_MAX_WIN_NAME        23      /* Maximum length of window name        */
-#define ICO_UXF_MAX_DISP_NAME       23      /* Maximum length of display name       */
-#define ICO_UXF_MAX_SOUND_NAME      23      /* Maximum length of sound device name  */
-#define ICO_UXF_MAX_DEVICE_NAME     63      /* Maximum length of resource device name*/
-#define ICO_UXF_MAX_STREAM_NAME     63      /* Maximum length of sound stream name  */
-
-/* Maximum values on each application       */
-#define ICO_UXF_APPDISPLAY_MAX      5       /* Maximum display zones for a application*/
-#define ICO_UXF_APPSOUND_MAX        5       /* Maximum sound zones for a application*/
-#define ICO_UXF_APPINPUT_MAX        20      /* Maximum input switch for a application*/
-
-/* Number to manage the processing internall block  */
-#define ICO_UXF_MNG_BLOCK_ALLOCS    20      /* Number to assign dynamic management block*/
-
-/* 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             */
-
-/* maximum value        */
-#define ICO_UXF_MAX_COORDINATE      16384   /* maximum coordinate position + 1      */
-
-/* timer                */
-#define ICO_UXF_SUSP_INITTIME   (5*1000)    /* initiale no suspend time (ms)        */
-#define ICO_UXF_SUSP_DELAY      (200)       /* suspend delay time (ms)              */
-
-#ifdef __cplusplus
-}
-#endif
-#endif  /* _ICO_UXF_SYSDEF_H_ */
-
diff --git a/include/ico_uxf_typedef.h b/include/ico_uxf_typedef.h
deleted file mode 100644 (file)
index 105444a..0000000
+++ /dev/null
@@ -1,189 +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   header file of user experience library for HomeScreen(data structure)
- *
- * @date    Feb-28-2013
- */
-
-#ifndef _ICO_UXF_TYPEDEF_H_
-#define _ICO_UXF_TYPEDEF_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Structure of display attribute           */
-typedef struct  _Ico_Uxf_DisplayAttr    {
-    int                 display;        /* Display ID                           */
-    int                 type;           /* Type                                 */
-    short               num_layers;     /* Number of layers                     */
-    short               hostId;         /* Host ID                              */
-    short               displayNo;      /* Consecutive numbers                  */
-    short               w;              /* The number of the lateral pixels     */
-    short               h;              /* The number of vertical pixels        */
-    short               inch;           /* Screen physical size(0.1 inches of units)*/
-    short               pWidth;         /* compositor width                     */
-    short               pHeight;        /* compositor height                    */
-    short               orientation;
-#define ICO_UXF_ORIENTATION_HORIZONTAL  (0)
-#define ICO_UXF_ORIENTATION_VERTICAL    (1)
-    char                name[ICO_UXF_MAX_WIN_NAME+1];
-                                        /* Display name                         */
-}   Ico_Uxf_DisplayAttr;
-
-/* Structure of layer attribute             */
-typedef struct  _Ico_Uxf_LayerAttr  {
-    int                 layer;          /* Layer ID                             */
-    int                 display;        /* Display ID                           */
-    short               w;              /* The number of the lateral pixels     */
-    short               h;              /* The number of vertical pixels        */
-    char                menuoverlap;    /* Overlap HomeScreen menu              */
-    char                res[3];         /* (unused)                             */
-}   Ico_Uxf_LayerAttr;
-
-/* Structure of window attribute            */
-typedef struct  _Ico_Uxf_WindowAttr {
-    int                 window;         /* Window ID                            */
-    int                 display;        /* Display ID                           */
-    int                 layer;          /* Layer ID                             */
-    int                 zone;           /* Display Zone ID                      */
-    char                process[ICO_UXF_MAX_PROCESS_NAME+1];
-                                        /* Application ID                       */
-    unsigned int        eventmask;      /* Event to receive through this window */
-    short               subwindow;      /* Main window(=0) or Sub window(>0)    */
-    short               node;           /* Node Id                              */
-    short               x;              /* Upper left X coordinate of the window*/
-    short               y;              /* Upper left Y coordinate of the window*/
-    short               w;              /* Width of window                      */
-    short               h;              /* height of window                     */
-    char                control;        /* Visibility control from AppsController*/
-    char                visible;        /* Visibility                           */
-    char                raise;          /* Raise/Lower                          */
-    char                active;         /* Active/Inactive                      */
-}   Ico_Uxf_WindowAttr;
-
-/* Structure of input code                  */
-typedef struct _Ico_Uxf_InputCode   {
-    int         code;                       /* input switch code value              */
-    char        codename[20];               /* input switch code name               */
-}   Ico_Uxf_InputCode;
-
-/* Structure of input switch                */
-typedef struct _Ico_Uxf_InputSw {
-    struct _Ico_Uxf_InputSw     *next;      /* next input switch table              */
-    char        swname[20];                 /* input switch name                    */
-    int         input;                      /* input switch number                  */
-    short       fix;                        /* fixed application switch             */
-    short       numCode;                    /* number of codes                      */
-    Ico_Uxf_InputCode   inputCode[8];       /* code table                           */
-}   Ico_Uxf_InputSw;
-
-/* Structure of input device                */
-typedef struct _Ico_Uxf_InputDev    {
-    struct _Ico_Uxf_InputDev    *next;      /* next input device                    */
-    char        device[32];                 /* input device name                    */
-    int         type;                       /* input device type(unused)            */
-    int         numInputSw;                 /* number of input switch               */
-    Ico_Uxf_InputSw     *inputSw;           /* input switch list                    */
-}   Ico_Uxf_InputDev;
-
-/* Structure of window of application       */
-typedef struct  _Ico_Uxf_ProcessWin {
-    int                 window;         /* Window ID                            */
-                                        /* (0 if window not create)             */
-    int                 windowtype;     /* Type                                 */
-    int                 display;        /* Display ID                           */
-    int                 layer;          /* Layer ID                             */
-    short               zone;           /* Zone ID                              */
-    short               node;           /* Default node Id                      */
-    short               x;              /* Default X coordinate of the window   */
-    short               y;              /* Default Y coordinate of the window   */
-    short               w;              /* Default width of window              */
-    short               h;              /* Default height of window             */
-    char                name[ICO_UXF_MAX_WIN_NAME+1];
-                                        /* Window name                          */
-}   Ico_Uxf_ProcessWin;
-
-/* Structure of application attribute       */
-typedef struct  _Ico_Uxf_ProcessAttr    {
-    char                process[ICO_UXF_MAX_PROCESS_NAME+1];
-                                        /* Application ID                       */
-    int                 internalid;     /* ProcessID                            */
-    int                 type;           /* Type                                 */
-    short               hostId;         /* Host ID who works of the application */
-    short               myHost;         /* Works in my host(=1) or Other host(=0)*/
-    short               numwindows;     /* Number of windows                    */
-    short               numsounds;      /* Number of sound                      */
-    short               numinputs;      /* Number of input                      */
-    Ico_Uxf_ProcessWin  mainwin;        /* Main window of application           */
-    Ico_Uxf_ProcessWin  *subwin;        /* Sub window of application            */
-    short               status;         /* Running status                       */
-    char                active;         /* Active/Inactive                      */
-    char                child;          /* Child process                        */
-    char                noicon;         /* No icon flag                         */
-    char                autostart;      /* Autostart flag                       */
-    char                suspend;        /* application susupend flag            */
-    unsigned char       invisiblecpu;   /* cpu % at invisible                   */
-}   Ico_Uxf_ProcessAttr;
-
-/* Detail of event                          */
-typedef union  _Ico_Uxf_EventDetail    {
-    int                 event;          /* Event number                         */
-    struct  {                           /* Window event                         */
-        int             event;          /* Event number                         */
-        /* Event about the state conversion of the window                       */
-        /* ICO_UXF_EVENT_VISIBLE,RESIZE,MOVE,REDRAW,NEWWINDOW,DESTORYWINDOW     */
-        int             display;        /* Display ID                           */
-        int             window;         /* Window ID                            */
-        int             layer;          /* layer ID                             */
-        short           x;              /* Window position                      */
-        short           y;
-        short           w;              /* Window size                          */
-        short           h;
-        char            visible;        /* Visibility                           */
-        char            raise;          /* Raise/Lower                          */
-        char            active;         /* Active/inactive(not impliment)       */
-        char            res;            /* (unuse)                              */
-    }           window;
-
-    struct  {                           /* Application event                    */
-        int             event;          /* Event number                         */
-        /* Event about the operating conditions change of the application       */
-        /* EXECPROCESS, TERMPROCESS                                             */
-        char            process[ICO_UXF_MAX_PROCESS_NAME+1];
-                                        /* Application ID                       */
-        int             status;         /* Running status                       */
-        int             regulation;     /* Current regulation                   */
-    }           process;
-
-    struct {                            /* Input Manager event                  */
-        int             event;          /* Event number                         */
-        /* Multi Input Manager event                                            */
-        /* ICO_UXF_EVENT_EXINPUT                                                */
-        char            device[32];     /* input device name                    */
-        int             input;          /* input number                         */
-        int             code;           /* input code                           */
-        int             state;          /* input status                         */
-    }           exinput;
-
-}   Ico_Uxf_EventDetail;
-
-/* Event callback function                  */
-typedef void (*Ico_Uxf_Event_Cb)(const int event,
-                                 const Ico_Uxf_EventDetail detail, int arg);
-
-/* Hook function                            */
-typedef void (*Ico_Uxf_Hook)(const char *appid, const int info1, const int info2);
-
-#ifdef __cplusplus
-}
-#endif
-#endif  /* _ICO_UXF_TYPEDEF_H_ */
-
diff --git a/install-appcore.sh b/install-appcore.sh
deleted file mode 100755 (executable)
index e2325d3..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/sh
-
-#library(libico-app-fw)
-rm -fr /usr/lib/libico-app-fw-efl.*
-cp ico-app-framework/.libs/libico-app-fw-efl.so.0.0.7 /usr/lib
-ln -s /usr/lib/libico-app-fw-efl.so.0.0.7 /usr/lib/libico-app-fw-efl.so.0
-ln -s /usr/lib/libico-app-fw-efl.so.0.0.7 /usr/lib/libico-app-fw-efl.so
-chmod 0755 /usr/lib/libico-app-fw-efl.so.0.0.7
-rm -fr /usr/lib/libico-app-fw.*
-cp ico-app-framework/.libs/libico-app-fw.so.0.0.7 /usr/lib
-ln -s /usr/lib/libico-app-fw.so.0.0.7 /usr/lib/libico-app-fw.so.0
-ln -s /usr/lib/libico-app-fw.so.0.0.7 /usr/lib/libico-app-fw.so
-chmod 0755 /usr/lib/libico-app-fw.so.0.0.7
-
-#test tools
-rm -fr /usr/bin/ico_send_hscommand
-rm -fr /usr/bin/ico_send_inputevent
-rm -fr /usr/bin/ico_set_vehicleinfo
-cp test/ico_send_hscommand /usr/bin
-cp test/ico_send_inputevent /usr/bin
-cp test/ico_set_vehicleinfo /usr/bin
-chmod 0755 /usr/bin/ico_send_hscommand /usr/bin/ico_send_inputevent /usr/bin/ico_set_vehicleinfo
-
-#HomeScreen
-HOMESCREEN=org.tizen.ico.homescreen
-rm -rf /usr/apps/$HOMESCREEN/var
-rm -rf /usr/apps/$HOMESCREEN/res
-mkdir -p /usr/apps/$HOMESCREEN/res/images
-mkdir -p /usr/apps/$HOMESCREEN/res/edj
-mkdir -p /usr/apps/$HOMESCREEN/res/config
-cp -rf res/config /usr/apps/$HOMESCREEN/res
-cp -rf data/apps/$HOMESCREEN /usr/apps/
-mkdir -p /usr/apps/$HOMESCREEN/bin/
-cp src/HomeScreen /usr/apps/$HOMESCREEN/bin/
-cp src/home_screen_bg.edj /usr/apps/$HOMESCREEN/res/edj
-cp src/home_screen_touch.edj /usr/apps/$HOMESCREEN/res/edj
-chmod 666 /usr/apps/$HOMESCREEN/res/edj/home_screen_*
-cp res/images/api_all_off.png /usr/apps/$HOMESCREEN/res/images
-cp res/images/api_all_on.png /usr/apps/$HOMESCREEN/res/images
-chmod 666 /usr/apps/$HOMESCREEN/res/images/api_all_*
-cp data/share/applications/$HOMESCREEN.desktop /usr/share/applications/
-cp data/share/packages/$HOMESCREEN.xml /usr/share/packages/
-cp res/apps/$HOMESCREEN/* /usr/apps/$HOMESCREEN/res/config
-
-#StatusBar
-PKGNAME=org.tizen.ico.statusbar
-rm -rf /usr/apps/$PKGNAME/res
-mkdir -p /usr/apps/$PKGNAME/res/images
-mkdir -p /usr/apps/$PKGNAME/res/edj
-mkdir -p /usr/apps/$PKGNAME/res/config
-cp -rf data/apps/$PKGNAME /usr/apps/
-mkdir -p /usr/apps/$PKGNAME/bin/
-cp src/StatusBar /usr/apps/$PKGNAME/bin/
-cp res/images/time*.png /usr/apps/$PKGNAME/res/images
-cp res/images/applist_*.png /usr/apps/$PKGNAME/res/images
-cp res/images/home*.png /usr/apps/$PKGNAME/res/images
-chmod 666 /usr/apps/$PKGNAME/res/images/time*.png
-cp data/share/applications/$PKGNAME.desktop /usr/share/applications/
-cp data/share/packages/$PKGNAME.xml /usr/share/packages/
-cp res/apps/$PKGNAME/* /usr/apps/$PKGNAME/res/config
-
-#OnScreen
-PKGNAME=org.tizen.ico.onscreen
-rm -rf /usr/apps/$PKGNAME/res
-mkdir -p /usr/apps/$PKGNAME/res/images
-mkdir -p /usr/apps/$PKGNAME/res/edj
-mkdir -p /usr/apps/$PKGNAME/res/config
-cp -rf data/apps/$PKGNAME /usr/apps/
-mkdir -p /usr/apps/$PKGNAME/bin/
-cp src/OnScreen /usr/apps/$PKGNAME/bin/
-cp src/appli_list.edj /usr/apps/$PKGNAME/res/edj
-cp src/appli_kill.edj /usr/apps/$PKGNAME/res/edj
-chmod 666 /usr/apps/$PKGNAME/res/edj/*.edj
-chmod 666 /usr/apps/$PKGNAME/res/images/*.png > /dev/null 2>&1
-cp data/share/applications/$PKGNAME.desktop /usr/share/applications/
-cp data/share/packages/$PKGNAME.xml /usr/share/packages/
-cp res/apps/$PKGNAME/* /usr/apps/$PKGNAME/res/config
-
-#reload AppCore database
-/usr/bin/pkg_initdb
-/usr/bin/ail_initdb
-
diff --git a/lib/Makefile.am b/lib/Makefile.am
new file mode 100644 (file)
index 0000000..37ecf92
--- /dev/null
@@ -0,0 +1,4 @@
+SUBDIRS=\
+    apps-framework  \
+    misc \
+    system-controller 
diff --git a/lib/apps-framework/Makefile.am b/lib/apps-framework/Makefile.am
new file mode 100644 (file)
index 0000000..4412b5b
--- /dev/null
@@ -0,0 +1,45 @@
+lib_LTLIBRARIES = libico-appfw.la
+
+COMMON_LIBS = -lm -lwebsockets -lico-uxf-weston-plugin
+
+libico_appfw_la_CFLAGS = -I../../include $(OPT_CFLAGS) $(UWS_CFLAGS) \
+                          $(AUL_CFLAGS) @ECORE_CFLAGS@ \
+                          -I/usr/include/ico-uxf-weston-plugin \
+                          -I/usr/include/ico-util
+
+libico_appfw_la_LIBADD =  $(OPT_LIBS) $(WL_LIBS) $(AUL_LIBS) $(UWS_LIBS) $(COMMON_LIBS) @ECORE_LIBS@
+libico_appfw_la_LDFLAGS = -version-info 0:1:0 
+libico_appfw_la_SOURCES =          \
+    ico_syc_appresctl.c \
+       ico_syc_common.c    \
+       ico_syc_inputctl.c  \
+       ico_syc_msg.c       \
+       ico_syc_userctl.c   \
+       ico_syc_winctl.c
+
+AM_CFLAGS = $(GCC_CFLAGS)
+AM_CPPFLAGS = $(GCC_CFLAGS)    \
+       -DDATADIR='"$(datadir)"'                \
+       -DMODULEDIR='"$(moduledir)"'            \
+       -DLIBEXECDIR='"$(libexecdir)"'
+AM_LDFLAGS = -module -avoid-version -rpath $(libdir) -lwebsockets
+
+install-exec-hook:
+       mkdir -p $(INSTALL_ROOT)/$(includedir)/ico-appfw
+       install -m 644 ../../include/ico_syc_application.h $(INSTALL_ROOT)/$(includedir)/ico-appfw
+       install -m 644 ../../include/ico_syc_appresctl.h $(INSTALL_ROOT)/$(includedir)/ico-appfw
+       install -m 644 ../../include/ico_syc_common.h $(INSTALL_ROOT)/$(includedir)/ico-appfw
+       install -m 644 ../../include/ico_syc_error.h $(INSTALL_ROOT)/$(includedir)/ico-appfw
+       install -m 644 ../../include/ico_syc_inputctl.h $(INSTALL_ROOT)/$(includedir)/ico-appfw
+       install -m 644 ../../include/ico_syc_private.h $(INSTALL_ROOT)/$(includedir)/ico-appfw
+       install -m 644 ../../include/ico_syc_privilege.h $(INSTALL_ROOT)/$(includedir)/ico-appfw
+       install -m 644 ../../include/ico_syc_type.h $(INSTALL_ROOT)/$(includedir)/ico-appfw
+       install -m 644 ../../include/ico_syc_userctl.h $(INSTALL_ROOT)/$(includedir)/ico-appfw
+       install -m 644 ../../include/ico_syc_winctl.h $(INSTALL_ROOT)/$(includedir)/ico-appfw
+
+uninstall:
+       rm -rf $(INSTALL_ROOT)/$(includedir)/ico-appfw
+       rm -rf $(INSTALL_ROOT)/$(libdir)/libico-appfw*
+
+.FORCE :
+
diff --git a/lib/apps-framework/ico_syc_appresctl.c b/lib/apps-framework/ico_syc_appresctl.c
new file mode 100644 (file)
index 0000000..7220b3e
--- /dev/null
@@ -0,0 +1,1045 @@
+/*
+ * 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 Resource Control API
+ *          for general applications
+ *
+ * @date    Aug-7-2013
+ */
+
+#include <string.h>
+#include <unistd.h>
+
+#include <aul/aul.h>
+
+#include "ico_syc_application.h"
+#include "ico_syc_msg_cmd_def.h"
+#include "ico_syc_msg.h"
+#include "ico_syc_private.h"
+
+/*============================================================================*/
+/* define static function prototype                                           */
+/*============================================================================*/
+static ico_syc_res_window_t *_create_res_window(char *zone,
+                                                char *name, char *id);
+static ico_syc_res_sound_t *_create_res_sound(char *zone, char *name, char *id,
+                                              int adjust);
+static ico_syc_res_input_t *_create_res_input(char *name, int event);
+static void _free_res_window(ico_syc_res_window_t *window);
+static void _free_res_sound(ico_syc_res_sound_t *sound);
+static void _free_res_input(ico_syc_res_input_t *input);
+static struct ico_syc_res_context * _create_context(
+                                    char *appid,
+                                    const ico_syc_res_window_t *window,
+                                    const ico_syc_res_sound_t *sound,
+                                    const ico_syc_res_input_t *input,
+                                    int type);
+/* create send message */
+static JsonObject *_create_window_msg(ico_syc_res_window_t *window);
+static JsonObject *_create_sound_msg(ico_syc_res_sound_t *sound);
+static JsonObject *_create_input_msg(ico_syc_res_input_t *input);
+static msg_t _create_acquire_res_msg(const struct ico_syc_res_context *context);
+static msg_t _create_release_res_msg(const struct ico_syc_res_context *context);
+static msg_t _create_set_region_msg(const char *appid,
+                                    const ico_syc_input_region_t *input,
+                                    int attr);
+static msg_t _create_unset_region_msg(const char *appid,
+                                      const ico_syc_input_region_t *input);
+
+/*============================================================================*/
+/* static function                                                            */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_res_window
+ *          Allocate memory for window resource information.
+ *
+ * @param[in]   zone                    window zone
+ * @param[in]   name                    windo name 
+ * @param[in]   id                      window id
+ * @return      resource info
+ * @retval      address                 success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static ico_syc_res_window_t *
+_create_res_window(char *zone, char *name, char *id)
+{
+    ico_syc_res_window_t *info  = NULL;
+
+    if (zone == NULL || name == NULL) {
+        _ERR("invalid parameter (zone, name is NULL)");
+        return NULL;
+    }
+
+    /* alloc memory */
+    info = calloc(1, sizeof(ico_syc_res_window_t));
+    if (info == NULL) {
+        _ERR("calloc failed");
+        return NULL;
+    }
+    /* clear memory */
+    memset(info, 0, sizeof(ico_syc_res_window_t));
+
+    /* set element */
+    info->zone = strdup(zone);
+    info->name = strdup(name);
+    if (id != NULL) {
+        info->id = strdup(id);
+    }
+
+    return info;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_res_sound
+ *          Allocate memory for sound resource information.
+ *
+ * @param[in]   zone                    sound zone
+ * @param[in]   name                    sound name 
+ * @param[in]   id                      sound id
+ * @param[in]   adjust                  adjust type
+ * @return      resource info
+ * @retval      address                 success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static ico_syc_res_sound_t *
+_create_res_sound(char *zone, char *name, char *id, int adjust)
+{
+    ico_syc_res_sound_t *info   = NULL;
+
+    if (zone == NULL || name == NULL) {
+        _ERR("invalid parameter (zone, name is NULL)");
+        return NULL;
+    }
+
+    /* alloc memory */
+    info = calloc(1, sizeof(ico_syc_res_sound_t));
+    if (info == NULL) {
+        _ERR("calloc failed");
+        return NULL;
+    }
+    /* clear memory */
+    memset(info, 0, sizeof(ico_syc_res_sound_t));
+
+    /* set element */
+    info->zone = strdup(zone);
+    info->name = strdup(name);
+    if (id != NULL) {
+        info->id = strdup(id);
+    }
+    info->adjust = adjust;
+
+    return info;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_res_input
+ *          Allocate memory for input resource information.
+ *
+ * @param[in]   name                    input device name
+ * @param[in]   event                   input event
+ * @return      resource info
+ * @retval      address                 success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static ico_syc_res_input_t *
+_create_res_input(char *name, int event)
+{
+    ico_syc_res_input_t *info   = NULL;
+
+    if (name == NULL) {
+        _ERR("invalid parameter (name is NULL)");
+        return NULL;
+    }
+
+    /* alloc memory */
+    info = calloc(1, sizeof(ico_syc_res_input_t));
+    if (info == NULL) {
+        _ERR("calloc failed");
+        return NULL;
+    }
+    /* clear memory */
+    memset(info, 0, sizeof(ico_syc_res_input_t));
+
+    /* set element */
+    info->name = strdup(name);
+    info->event = event;
+
+    return info;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _free_res_window
+ *          Free memory of window resource information.
+ *
+ * @param[in]   window                  window resource's information
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+_free_res_window(ico_syc_res_window_t *window)
+{
+    if (window == NULL) {
+        return;
+    }
+
+    /* free element */
+    if (window->zone != NULL) free(window->zone);
+    if (window->name != NULL) free(window->name);
+    if (window->id != NULL) free(window->id);
+    /* free */
+    free(window);
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _free_res_sound
+ *          Free memory of sound resource information.
+ *
+ * @param[in]   sound                   sound resource's information
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+_free_res_sound(ico_syc_res_sound_t *sound)
+{
+    if (sound == NULL) {
+        return;
+    }
+
+    /* free element */
+    if (sound->zone != NULL) free(sound->zone);
+    if (sound->name != NULL) free(sound->name);
+    if (sound->id != NULL) free(sound->id);
+    /* free */
+    free(sound);
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _free_res_input
+ *          Free memory of input resource information.
+ *
+ * @param[in]   input                   input resource's information
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+_free_res_input(ico_syc_res_input_t *input)
+{
+    if (input == NULL) {
+        return;
+    }
+
+    /* free element */
+    if (input->name != NULL) free(input->name);
+    /* free */
+    free(input);
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_context
+ *          Create resource information context.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   window                  window resource's information
+ * @param[in]   sound                   sound resource's information
+ * @param[in]   input                   input resource's information
+ * @param[in]   type                    window and sound resource type
+ *                                      (basic or interruption)
+ * @return      resource's context address
+ * @retval      address                 success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static struct ico_syc_res_context *
+_create_context(char *appid, const ico_syc_res_window_t *window,
+                const ico_syc_res_sound_t *sound,
+                const ico_syc_res_input_t *input,
+                int type)
+{
+    struct ico_syc_res_context *context = NULL;
+
+    context = (struct ico_syc_res_context *)
+                              malloc(sizeof(struct ico_syc_res_context));
+    if (context == NULL) {
+        _ERR("malloc failed");
+        return NULL;
+    }
+    memset(context, 0, sizeof(struct ico_syc_res_context));
+
+    /* set appid */
+    strcpy(context->appid, appid);
+
+    /* set window info */
+    if (window != NULL) {
+        context->window = _create_res_window(window->zone, window->name,
+                                             window->id);
+    }
+    /* set sound info */
+    if (sound != NULL) {
+        context->sound = _create_res_sound(sound->zone, sound->name,
+                                           sound->id, sound->adjust);
+    }
+    /* set input info */
+    if (input != NULL) {
+        context->input = _create_res_input(input->name, input->event);
+    }
+
+    /* set resource type */
+    if (window != NULL || sound != NULL) {
+        context->type = type;
+    }
+
+    return context;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_window_msg
+ *          Create the JsonObject to set the window resource information.
+ *
+ * @param[in]   window                  window resource information
+ * @return      json object
+ * @retval      json object             success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static JsonObject *
+_create_window_msg(ico_syc_res_window_t *window)
+{
+    JsonObject *info    = NULL;
+
+    if (window == NULL) {
+        _ERR("invalid parameter (window is NULL)");
+        return NULL;
+    }
+
+    /* create json object */
+    info = json_object_new();
+    if (info == NULL) {
+        _ERR("json_object_new failed");
+        return NULL;
+    }
+
+    /* set member */
+    json_object_set_string_member(info, MSG_PRMKEY_RES_ZONE, window->zone);
+    json_object_set_string_member(info, MSG_PRMKEY_RES_NAME, window->name);
+    json_object_set_string_member(info, MSG_PRMKEY_RES_ID, window->id);
+
+    return info;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_sound_msg
+ *          Create the JsonObject to set the sound resource information.
+ *
+ * @param[in]   sound                   sound resource information
+ * @return      json object
+ * @retval      json object             success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static JsonObject *
+_create_sound_msg(ico_syc_res_sound_t *sound)
+{
+    JsonObject *info    = NULL;
+
+    if (sound == NULL) {
+        _ERR("invalid parameter (sound is NULL)");
+        return NULL;
+    }
+
+    /* create json object */
+    info = json_object_new();
+    if (info == NULL) {
+        _ERR("json_object_new failed");
+        return NULL;
+    }
+
+    /* set member */
+    json_object_set_string_member(info, MSG_PRMKEY_RES_ZONE, sound->zone);
+    json_object_set_string_member(info, MSG_PRMKEY_RES_NAME, sound->name);
+    json_object_set_string_member(info, MSG_PRMKEY_RES_ID, sound->id);
+    json_object_set_int_member(info, MSG_PRMKEY_RES_ADJUST, sound->adjust);
+
+    return info;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_input_msg
+ *          Create the JsonObject to set the input resource information.
+ *
+ * @param[in]   input                   input resource information
+ * @return      json object
+ * @retval      json object             success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static JsonObject *
+_create_input_msg(ico_syc_res_input_t *input)
+{
+    JsonObject *info    = NULL;
+
+    if (input == NULL) {
+        _ERR("invalid parameter (input is NULL)");
+        return NULL;
+    }
+
+    /* create json object */
+    info = json_object_new();
+    if (info == NULL) {
+        _ERR("json_object_new failed");
+        return NULL;
+    }
+
+    /* set member */
+    json_object_set_string_member(info, MSG_PRMKEY_RES_NAME, input->name);
+    json_object_set_int_member(info, MSG_PRMKEY_RES_EV, input->event);
+
+    return info;
+}
+
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_acquire_res_msg
+ *          Create the message to acquire the resource (window/sound/input).
+ *
+ * @param[in]   context                 resource context
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_acquire_res_msg(const struct ico_syc_res_context *context)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *resobj  = NULL;
+    JsonObject *info    = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object */
+    obj = json_object_new();
+    resobj = json_object_new();
+    if (obj == NULL || resobj == NULL) {
+        _ERR("json_object_new failed");
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_ACQUIRE_RES);
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, context->appid);
+    json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
+
+    /* window resource */
+    if (context->window != NULL) {
+        info = _create_window_msg(context->window);
+        /* set object */
+        json_object_set_object_member(resobj, MSG_PRMKEY_RES_WINDOW, info);
+    }
+
+    /* sound resource */
+    if (context->sound != NULL) {
+        info = _create_sound_msg(context->sound);
+        /* set object */
+        json_object_set_object_member(resobj, MSG_PRMKEY_RES_SOUND, info);
+    }
+
+    /* input resource */
+    if (context->input != NULL) {
+        info = _create_input_msg(context->input);
+        /* set object */
+        json_object_set_object_member(resobj, MSG_PRMKEY_RES_INPUT, info);
+    }
+
+    /* resource type */
+    if (context->window != NULL || context->sound != NULL) {
+        json_object_set_int_member(resobj, MSG_PRMKEY_RES_TYPE, context->type);
+    }
+    /* set resource object */
+    json_object_set_object_member(obj, MSG_PRMKEY_RES, resobj);
+
+    /* 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_release_res_msg
+ *          Create the message to release the resource (window/sound/input).
+ *
+ * @param[in]   context                 resource context
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_release_res_msg(const struct ico_syc_res_context *context)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *resobj  = NULL;
+    JsonObject *info    = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object */
+    obj = json_object_new();
+    resobj = json_object_new();
+    if (obj == NULL || resobj == NULL) {
+        _ERR("json_object_new failed");
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_RELEASE_RES);
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, context->appid);
+    json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
+
+    /* window resource */
+    if (context->window != NULL) {
+        info = _create_window_msg(context->window);
+        /* set object */
+        json_object_set_object_member(resobj, MSG_PRMKEY_RES_WINDOW, info);
+    }
+
+    /* sound resource */
+    if (context->sound != NULL) {
+        info = _create_sound_msg(context->sound);
+        /* set object */
+        json_object_set_object_member(resobj, MSG_PRMKEY_RES_SOUND, info);
+    }
+
+    /* input resource */
+    if (context->input != NULL) {
+        info = _create_input_msg(context->input);
+        /* set object */
+        json_object_set_object_member(resobj, MSG_PRMKEY_RES_INPUT, info);
+    }
+    /* resource type */
+    if (context->window != NULL || context->sound != NULL) {
+        json_object_set_int_member(resobj, MSG_PRMKEY_RES_TYPE, context->type);
+    }
+    /* set resource object */
+    json_object_set_object_member(obj, MSG_PRMKEY_RES, resobj);
+
+    /* 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_region_msg
+ *          Create the message to set the input region.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   input                   input region's information
+ * @param[in]   attr                    input region's attribute
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_set_region_msg(const char *appid, const ico_syc_input_region_t *input,
+                       int attr)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *resobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object */
+    obj = json_object_new();
+    resobj = json_object_new();
+    if (obj == NULL || resobj == NULL) {
+        _ERR("json_object_new failed");
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_SET_REGION);
+    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);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_ATTR, attr);
+    json_object_set_object_member(obj, MSG_PRMKEY_REGION, resobj);
+
+    /* 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_unset_region_msg
+ *          Create the message to unset the input region.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   input                   input region's information
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_unset_region_msg(const char *appid, const ico_syc_input_region_t *input)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *resobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object */
+    obj = json_object_new();
+    resobj = json_object_new();
+    if (obj == NULL || resobj == NULL) {
+        _ERR("json_object_new failed");
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_UNSET_REGION);
+    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);
+    json_object_set_object_member(obj, MSG_PRMKEY_REGION, resobj);
+
+    /* 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                                                   */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @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
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+ico_syc_cb_res(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 *resobj  = NULL;
+    JsonObject *info    = NULL;
+
+    ico_syc_res_info_t *res_info    = NULL;
+    char *zone, *name, *id;
+    int adjust, input_ev;
+
+    /* alloc memory */
+    res_info = calloc(1, sizeof(ico_syc_res_info_t));
+    if (res_info == NULL) {
+        _ERR("calloc failed");
+        return;
+    }
+    /* clear memory */
+    memset(res_info, 0, sizeof(ico_syc_res_info_t));
+
+    /* start parser */
+    parser = json_parser_new();
+    gbool = json_parser_load_from_data(parser, data, len, &error);
+    if (gbool == FALSE) {
+        g_object_unref(parser);
+        free(res_info);
+        _ERR("json_parser_load_from_data failed");
+        return;
+    }
+
+    /* get root node */
+    root = json_parser_get_root(parser);
+    if (root == NULL) {
+        g_object_unref(parser);
+        free(res_info);
+        _ERR("json_parser_get_root failed (root is NULL)");
+        return;
+    }
+
+    /* get object from root */
+    obj = json_node_get_object(root);
+    /* check object */
+    if (json_object_has_member(obj, MSG_PRMKEY_RES) == FALSE) {
+        _ERR("invalid message");
+        return;
+    }
+    resobj = json_object_get_object_member(obj, MSG_PRMKEY_RES);
+
+    /* window resource */
+    if (json_object_has_member(resobj, MSG_PRMKEY_RES_WINDOW) == TRUE) {
+        info = json_object_get_object_member(resobj, MSG_PRMKEY_RES_WINDOW);
+        zone = ico_syc_get_str_member(info, MSG_PRMKEY_RES_ZONE);
+        name = ico_syc_get_str_member(info, MSG_PRMKEY_RES_NAME);
+        id = ico_syc_get_str_member(info, MSG_PRMKEY_RES_ID);
+
+        res_info->window = _create_res_window(zone, name, id);
+    }
+
+    /* sound resource */
+    if (json_object_has_member(resobj, MSG_PRMKEY_RES_SOUND) == TRUE) {
+        info = json_object_get_object_member(resobj, MSG_PRMKEY_RES_SOUND);
+        zone = ico_syc_get_str_member(info, MSG_PRMKEY_RES_ZONE);
+        name = ico_syc_get_str_member(info, MSG_PRMKEY_RES_NAME);
+        id = ico_syc_get_str_member(info, MSG_PRMKEY_RES_ID);
+        adjust = ico_syc_get_int_member(info, MSG_PRMKEY_RES_ADJUST);
+
+        res_info->sound = _create_res_sound(zone, name, id, adjust);
+    }
+
+    /* input resource */
+    if (json_object_has_member(resobj, MSG_PRMKEY_RES_INPUT) == TRUE) {
+        info = json_object_get_object_member(resobj, MSG_PRMKEY_RES_INPUT);
+        name = ico_syc_get_str_member(info, MSG_PRMKEY_RES_NAME);
+        input_ev = ico_syc_get_int_member(info, MSG_PRMKEY_RES_EV);
+
+        res_info->input = _create_res_input(name, input_ev);
+    }
+
+    /* exec callback */
+    callback(event, res_info, user_data);
+
+    /* free memory */
+    g_object_unref(parser);
+    _free_res_window(res_info->window);
+    _free_res_sound(res_info->sound);
+    _free_res_input(res_info->input);
+    free(res_info);
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_region
+ *          Execute callback function.  (ICO_SYC_EV_INPUT_SET
+ *                                       ICO_SYC_EV_INPUT_UNSET)
+ *
+ * @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
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+ico_syc_cb_region(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 *resobj  = NULL;
+
+    ico_syc_input_region_t *region  = NULL;
+
+    /* alloc memory */
+    region = calloc(1, sizeof(ico_syc_input_region_t));
+    if (region == NULL) {
+        _ERR("calloc failed");
+        return;
+    }
+    /* clear memory */
+    memset(region, 0, sizeof(ico_syc_input_region_t));
+
+    /* start parser */
+    parser = json_parser_new();
+    gbool = json_parser_load_from_data(parser, data, len, &error);
+    if (gbool == FALSE) {
+        g_object_unref(parser);
+        free(region);
+        _ERR("json_parser_load_from_data failed");
+        return;
+    }
+
+    /* get root node */
+    root = json_parser_get_root(parser);
+    if (root == NULL) {
+        g_object_unref(parser);
+        free(region);
+        _ERR("json_parser_get_root failed (root is NULL)");
+        return;
+    }
+
+    /* get object from root */
+    obj = json_node_get_object(root);
+    /* check object */
+    if (json_object_has_member(obj, MSG_PRMKEY_REGION) == FALSE) {
+        _ERR("invalid message");
+        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);
+    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);
+
+    /* exec callback */
+    callback(event, region, user_data);
+
+    /* free memory */
+    g_object_unref(parser);
+    free(region);
+
+    return;
+}
+
+/*============================================================================*/
+/* public interface function                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_acquire_res
+ *          Acquire the resources(window/sound/input).
+ *          User can choose window and sound resource's type
+ *          "basic" or "interruption".
+ *          If user want to acquire the sound resource only,
+ *          user sets NULL to argument "window" and  "input".
+ *
+ * @param[in]   window                  window resource's information
+ * @param[in]   sound                   sound resource's information
+ * @param[in]   input                   input resource's information
+ * @param[in]   type                    window and sound resource's type
+ *                                      (basic or interruption)
+ * @return      resource's context address
+ * @retval      address                 success
+ * @retval      NULL                    error
+ * @see         ico_syc_res_type_e
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API struct ico_syc_res_context *
+ico_syc_acquire_res(const ico_syc_res_window_t *window,
+                    const ico_syc_res_sound_t *sound,
+                    const ico_syc_res_input_t *input,
+                    int type)
+{
+    msg_t msg;
+    char *appid;
+    struct ico_syc_res_context *context = NULL;
+
+    /* check argument */
+    if (window == NULL && sound == NULL && input == NULL) {
+        _ERR("invalid parameter (all resources is NULL)");
+        return NULL;
+    }
+
+    /* get appid */
+    appid = ico_syc_get_appid();
+
+    /* create context */
+    context = _create_context(appid, window, sound, input, type);
+    if (context == NULL) {
+        _ERR("context is NULL");
+        return NULL;
+    }
+
+    /* make message */
+    msg = _create_acquire_res_msg(context);
+    /* send message */
+    (void)ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return context;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_release_res
+ *          Release the resources(window/sound/input).
+ *
+ * @param[in]   context                 resource context
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_release_res(struct ico_syc_res_context *context)
+{
+    msg_t msg;
+
+    /* check argument */
+    if (context == NULL) {
+        _ERR("invalid parameter (context is NULL)");
+        return ICO_SYC_ERR_INVALID_PARAM;
+    }
+
+    /* make message */
+    msg = _create_release_res_msg(context);
+    /* send message */
+    (void)ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    /* free resource info */
+    _free_res_window(context->window);
+    _free_res_sound(context->sound);
+    _free_res_input(context->input);
+    /* free context */
+    free(context);
+
+    return ICO_SYC_ERR_NONE;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_set_input_region
+ *          Set the input region. (for haptic device)
+ *          Callback function notifies the result of setting the input region.
+ *
+ * @param[in]   input                   input region's information
+ * @param[in]   attr                    input region's attribute
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_set_input_region(const ico_syc_input_region_t *input, int attr)
+{
+    msg_t msg;
+    char *appid;
+
+    /* check argument */
+    if (input == NULL) {
+        _ERR("invalid parameter (ico_syc_input_region_t is NULL)");
+        return ICO_SYC_ERR_INVALID_PARAM;
+    }
+
+    /* get appid */
+    appid = ico_syc_get_appid();
+
+    /* make message */
+    msg = _create_set_region_msg(appid, input, attr);
+    /* send message */
+    (void)ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return ICO_SYC_ERR_NONE;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_unset_input_region
+ *          Unset the input region. (for haptic device)
+ *          Callback function notifies the result of unsetting the input region.
+ *
+ * @param[in]   input                   input region's information
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_unset_input_region(const ico_syc_input_region_t *input)
+{
+    msg_t msg;
+    char *appid;
+
+    /* check argument */
+    if (input == NULL) {
+        _ERR("invalid parameter (ico_syc_input_region_t is NULL)");
+        return ICO_SYC_ERR_INVALID_PARAM;
+    }
+
+    /* get appid */
+    appid = ico_syc_get_appid();
+
+    /* make message */
+    msg = _create_unset_region_msg(appid, input);
+    /* send message */
+    (void)ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return ICO_SYC_ERR_NONE;
+}
+
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/lib/apps-framework/ico_syc_common.c b/lib/apps-framework/ico_syc_common.c
new file mode 100644 (file)
index 0000000..dc51c79
--- /dev/null
@@ -0,0 +1,700 @@
+/*
+ * 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   Common API to connect System Controller
+ *          for privilege and general applications
+ *
+ * @date    Aug-19-2013
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+
+#include <aul.h>
+#include <glib.h>
+#include <ico_uws.h>
+
+#include <Ecore.h>
+#include <Eina.h>
+
+#include "ico_syc_common.h"
+#include "ico_syc_error.h"
+#include "ico_syc_msg_cmd_def.h"
+#include "ico_syc_msg.h"
+#include "ico_syc_private.h"
+
+/*============================================================================*/
+/* define static function prototype                                           */
+/*============================================================================*/
+static msg_t _create_appid_msg(void);
+static void _syc_ev_callback(const struct ico_uws_context *uws_context,
+                             const ico_uws_evt_e event,
+                             const void *id,
+                             const ico_uws_detail *detail,
+                             void *user_data);
+static void _add_queue(void *data, size_t len);
+static int _get_event_from_cmd(int command);
+static int _exec_callback(void *user_data);
+static Eina_Bool _ecore_fd_cb(void *data, Ecore_Fd_Handler *handler);
+static void _add_poll_fd(int fd);
+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);
+
+/*============================================================================*/
+/* variable & table                                                           */
+/*============================================================================*/
+static char syc_appid[ICO_SYC_MAX_LEN];
+
+static struct ico_uws_context *uws_context  = NULL;
+static void *uws_id                         = NULL;
+static ico_syc_callback_t syc_callback      = NULL;
+static void *syc_user_data                  = NULL;
+static Ecore_Fd_Handler *ecore_fd_handler   = NULL;
+
+/* queue for receive data */
+GQueue *recv_info_q = NULL;
+GQueue *recv_free_q = NULL;
+
+/* receive data info table */
+typedef struct _recv_info {
+    char    data[1024];
+    size_t  len;
+} recv_info_t;
+
+/* pthread mutex initialize */
+static pthread_mutex_t q_mutex  = PTHREAD_MUTEX_INITIALIZER;
+
+/* semaphore */
+static sem_t recv_sem;
+
+/*============================================================================*/
+/* static function                                                            */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_appid_msg
+ *          Create the message to send application id.
+ *
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_appid_msg(void)
+{
+    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;
+    }
+
+    /* create root object */
+    root = json_node_new(JSON_NODE_OBJECT);
+    json_node_take_object(root, obj);
+
+    /* set message */
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_SEND_APPID);
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, syc_appid);
+    json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
+
+    /* create generator object */
+    gen = json_generator_new();
+    json_generator_set_root(gen, root);
+
+    return gen;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _syc_ev_callback
+ *          Callback Function.
+ *
+ * @param[in]   uws_context             ico_uws context
+ * @param[in]   event                   event code
+ * @param[in]   id                      unique id
+ * @param[in]   detail                  detail information
+ * @param[in]   user_data               passed data on called callback function
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+static void
+_syc_ev_callback(const struct ico_uws_context *uws_context,
+                 const ico_uws_evt_e event, const void *id,
+                 const ico_uws_detail *detail, void *user_data)
+{
+    msg_t msg = NULL;
+
+    switch (event) {
+    case ICO_UWS_EVT_OPEN:
+        uws_id = (void *)id;
+        /* send appid and retry to send message */
+        msg = _create_appid_msg();
+        ico_syc_send_msg(msg);
+        break;
+    case ICO_UWS_EVT_CLOSE:
+        uws_id = NULL;
+        break;
+    case ICO_UWS_EVT_ERROR:
+        break;
+    case ICO_UWS_EVT_RECEIVE:
+        _add_queue(detail->_ico_uws_message.recv_data,
+                   detail->_ico_uws_message.recv_len);
+        break;
+    case ICO_UWS_EVT_ADD_FD:
+        _add_poll_fd(detail->_ico_uws_fd.fd);
+        break;
+    case ICO_UWS_EVT_DEL_FD:
+        _del_poll_fd(detail->_ico_uws_fd.fd);
+        break;
+    default:
+        break;
+    }
+
+    /* free message */
+    if (msg != NULL) {
+        ico_syc_free_msg(msg);
+    }
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _add_queue
+ *          Enqueue recieve data.
+ *
+ * @param[in]   data                    data
+ * @param[in]   len                     length of data
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+_add_queue(void *data, size_t len)
+{
+    recv_info_t *recv_data;
+
+    /* mutex lock */
+    pthread_mutex_lock(&q_mutex);
+    if (g_queue_is_empty(recv_free_q) == TRUE) {
+        /* alloc memory */
+        recv_data = calloc(1, sizeof(recv_info_t));
+        if (recv_data == NULL) {
+            /* mutex unlock */
+            pthread_mutex_unlock(&q_mutex);
+            _ERR("calloc failed");
+            return;
+        }
+    }
+    else {
+        /* get free memory */
+        recv_data = g_queue_pop_head(recv_free_q);
+        if (recv_data == NULL) {
+            /* mutex unlock */
+            pthread_mutex_unlock(&q_mutex);
+            _ERR("g_queue_pop_head failed");
+            return;
+        }
+    }
+    memset(recv_data, 0, sizeof(recv_info_t));
+
+    /* set data */
+    snprintf(recv_data->data, sizeof(recv_data->data), "%s", (char *)data);
+    recv_data->len = len;
+
+    /* enqueue */
+    g_queue_push_tail(recv_info_q, recv_data);
+    /* mutex unlock */
+    pthread_mutex_unlock(&q_mutex);
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _get_event_from_cmd
+ *          Get event id from command.
+ *
+ * @param[in]   command                 command
+ * @return      event id
+ * @retval      event id                success
+ * @retval      -1                      error
+ */
+/*--------------------------------------------------------------------------*/
+static int _get_event_from_cmd(int command)
+{
+    int event   = -1;
+    switch (command) {
+    case MSG_CMD_CREATE:
+        event = ICO_SYC_EV_WIN_CREATE;
+        break;
+    case MSG_CMD_DESTROY:
+        event = ICO_SYC_EV_WIN_DESTROY;
+        break;
+    case MSG_CMD_CHANGE_ATTR:
+        event = ICO_SYC_EV_WIN_ATTR_CHANGE;
+        break;
+    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;
+    case MSG_CMD_UNMAP_THUMB:
+        event = ICO_SYC_EV_THUMB_UNMAP;
+        break;
+    case MSG_CMD_CHANGE_LAYER_ATTR:
+        event = ICO_SYC_EV_LAYER_ATTR_CHANGE;
+        break;
+    case MSG_CMD_CHANGE_USER:
+        event = ICO_SYC_EV_AUTH_FAIL;
+        break;
+    case MSG_CMD_GET_USERLIST:
+        event = ICO_SYC_EV_USERLIST;
+        break;
+    case MSG_CMD_ACQUIRE_RES:
+        event = ICO_SYC_EV_RES_ACQUIRE;
+        break;
+    case MSG_CMD_DEPRIVE_RES:
+        event = ICO_SYC_EV_RES_DEPRIVE;
+        break;
+    case MSG_CMD_WAITING_RES:
+        event = ICO_SYC_EV_RES_WAITING;
+        break;
+    case MSG_CMD_REVERT_RES:
+        event = ICO_SYC_EV_RES_REVERT;
+        break;
+    case MSG_CMD_RELEASE_RES:
+        event = ICO_SYC_EV_RES_RELEASE;
+        break;
+    case MSG_CMD_SET_REGION:
+        event = ICO_SYC_EV_INPUT_SET;
+        break;
+    case MSG_CMD_UNSET_REGION:
+        event = ICO_SYC_EV_INPUT_UNSET;
+        break;
+    default:
+        break;
+    }
+
+    return event;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _exec_callback
+ *          Execute callback function.
+ *
+ * @param[in]   user_data               passed data on called callback function
+ * @return      result
+ * @retval      0                       success (always success)
+ */
+/*--------------------------------------------------------------------------*/
+static int
+_exec_callback(void *user_data)
+{
+    recv_info_t *recv_data  = NULL;
+    int cmd                 = -1;
+    int event;
+
+    if (syc_callback == NULL) {
+        _DBG("not setting callback function");
+        return ICO_SYC_ERR_NONE;
+    }
+
+    while (g_queue_is_empty(recv_info_q) != TRUE) {
+        /* mutex lock */
+        pthread_mutex_lock(&q_mutex);
+        recv_data = g_queue_pop_head(recv_info_q);
+        /* mutex unlock */
+        pthread_mutex_unlock(&q_mutex);
+
+        /* exec callback */
+        cmd = ico_syc_get_command(recv_data->data, recv_data->len);
+        event = _get_event_from_cmd(cmd);
+        switch (event) {
+        case ICO_SYC_EV_WIN_CREATE:
+        case ICO_SYC_EV_WIN_DESTROY:
+        case ICO_SYC_EV_WIN_ACTIVE:
+            ico_syc_cb_win(syc_callback, user_data, event,
+                           recv_data->data, recv_data->len);
+            break;
+        case ICO_SYC_EV_WIN_ATTR_CHANGE:
+            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:
+            ico_syc_cb_thumb(syc_callback, user_data, event,
+                             recv_data->data, recv_data->len);
+            break;
+        case ICO_SYC_EV_LAYER_ATTR_CHANGE:
+            ico_syc_cb_layer(syc_callback, user_data, event,
+                             recv_data->data, recv_data->len);
+            break;
+        case ICO_SYC_EV_USERLIST:
+            ico_syc_cb_userlist(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;
+        case ICO_SYC_EV_RES_ACQUIRE:
+        case ICO_SYC_EV_RES_DEPRIVE:
+        case ICO_SYC_EV_RES_WAITING:
+        case ICO_SYC_EV_RES_REVERT:
+        case ICO_SYC_EV_RES_RELEASE:
+            ico_syc_cb_res(syc_callback, user_data, event,
+                           recv_data->data, recv_data->len);
+            break;
+        case ICO_SYC_EV_INPUT_SET:
+        case ICO_SYC_EV_INPUT_UNSET:
+            ico_syc_cb_region(syc_callback, user_data, event,
+                              recv_data->data, recv_data->len);
+            break;
+        default:
+            break;
+        }
+
+        /* mutex lock */
+        pthread_mutex_lock(&q_mutex);
+        /* recv_info push free_queue */
+        g_queue_push_tail(recv_free_q, recv_data);
+        /* mutex unlock */
+        pthread_mutex_unlock(&q_mutex);
+    }
+
+    return ICO_SYC_ERR_NONE;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _ecore_fd cb
+ *          ecore FD callback function.
+ *
+ * @return      result
+ * @retval      ECORE_CALLBACK_RENEW    success (always success)
+ */
+/*--------------------------------------------------------------------------*/
+static Eina_Bool
+_ecore_fd_cb(void *data, Ecore_Fd_Handler *handler)
+{
+    int ret = 0;
+    _DBG("_ecore_fd_cb: post semaphore");
+    ret = sem_post(&recv_sem);
+    if (-1 == ret) {
+        _ERR("_ecore_fd_cb: sem_post failed(%d:%s)", errno, strerror(errno));
+    }
+    return ECORE_CALLBACK_RENEW;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _add_poll_fd
+ *          Add file descriptor for poll.
+ *
+ * @param[in]   fd                      file descriptor
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+_add_poll_fd(int fd)
+{
+    Ecore_Fd_Handler_Flags flags = 0;
+    flags = (Ecore_Fd_Handler_Flags)(ECORE_FD_READ | ECORE_FD_ERROR);
+
+    ecore_fd_handler = ecore_main_fd_handler_add(fd, flags, _ecore_fd_cb,
+                                                 NULL, NULL, NULL);
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _del_poll_fd
+ *          Delete file descriptor for poll.
+ *
+ * @param[in]   fd                      file descriptor
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+_del_poll_fd(int fd)
+{
+    ecore_main_fd_handler_del(ecore_fd_handler);
+    ecore_fd_handler = NULL;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _poll_fd_thread
+ *          Polling file descriptor thread.
+ *
+ * @param[in]   args                    file descriptor
+ * @return      NULL
+ */
+/*--------------------------------------------------------------------------*/
+static void *
+_poll_fd_thread(void *args)
+{
+    int ret = 0;
+    while (1) {
+        _DBG("_poll_fd_thread: wait semaphore");
+        ret = sem_wait(&recv_sem);
+        if (-1 == ret) {
+            _ERR("_poll_fd_thread: sem_wait failed(%d:%s)",
+                 errno, strerror(errno));
+            break;
+        }
+        /* recive message */
+        ico_uws_service(uws_context);
+        _exec_callback(syc_user_data);
+    }
+    pthread_exit(0);
+
+    return NULL;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _connect_client
+ *          Connect to System Controller.
+ *
+ * @param[in]   callback                callback function
+ * @param[in]   user_data               passed data on called callback function
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+static int
+_connect_client(ico_syc_callback_t callback, void *user_data)
+{
+    int ret;
+
+    /* connect to System Controller */
+    uws_context = ico_uws_create_context(ICO_SYC_URI, ICO_SYC_PROTOCOL);
+    if (uws_context == NULL) {
+        _ERR("ico_uws_create_context failed");
+        return ICO_SYC_ERR_CONNECT;
+    }
+
+    /* set callback */
+    ret = ico_uws_set_event_cb(uws_context, _syc_ev_callback, NULL);
+    if (ret != ICO_UWS_ERR_NONE) {
+        _ERR("ico_uws_set_event_cb failed");
+        return ICO_SYC_ERR_UNKNOWN;
+    }
+
+    /* set callback and user data */
+    syc_callback = callback;
+    syc_user_data = user_data;
+
+    return ICO_SYC_ERR_NONE;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _disconnect_client
+ *          Disconnect from System Controller.
+ *
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+static void 
+_disconnect_client(void)
+{
+    /* unset callback */
+    ico_uws_unset_event_cb(uws_context);
+    syc_callback = NULL;
+
+    /* close */
+    ico_uws_close(uws_context);
+
+    return;
+}
+
+/*============================================================================*/
+/* internal common function                                                   */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_get_context
+ *          Get the ico_uws context connected to System Controller.
+ *
+ * @return      uws_context
+ * @retval      context                 success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+struct ico_uws_context *
+ico_syc_get_context(void)
+{
+    return uws_context;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_get_id
+ *          Get the ico_uws id to send message to System Controller.
+ *
+ * @return      uws_id
+ * @retval      id                      success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+void *
+ico_syc_get_id(void)
+{
+    return uws_id;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_get_appid
+ *          Get the application id.
+ *
+ * @return      appid
+ * @retval      appid                   success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+char *
+ico_syc_get_appid(void)
+{
+    return syc_appid;
+}
+
+/*============================================================================*/
+/* public interface function                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_connect
+ *          Connect to System Controller.
+ *          and set the listener to notify the event of System Controller.
+ *          If user does not want to set callback function,
+ *          set NULL to argument "callback".
+ *
+ * @param[in]   callback                callback function
+ * @param[in]   user_data               passed data on called callback function
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_connect(ico_syc_callback_t callback, void *user_data)
+{
+    pthread_t thread;
+    int pid, ret;
+
+    /* get appid from pid */
+    memset(syc_appid, 0, sizeof(syc_appid));
+    pid = getpid();
+    ret = aul_app_get_appid_bypid(pid, syc_appid, sizeof(syc_appid));
+    if (ret != AUL_R_OK) {
+        _ERR("app_get_appid_bypid failed. pid=%d", pid);
+        memset(syc_appid, 0, sizeof(syc_appid));
+    }
+    else {
+        _INFO("get appid by pid (pid=%d, appid=%s)", pid, syc_appid);
+    }
+
+    /* initalize semaphore */
+    ret = sem_init(&recv_sem, 0, 0);
+    if (-1 == ret) {
+        _ERR("ico_syc_connect: sem_init failed(%d:%s)",
+             errno, strerror(errno));
+        return ICO_SYC_ERR_SYSTEM;
+    }
+
+    /* initialize ecore lib */
+    ecore_init();
+
+    /* pthread start */
+    ret = pthread_create(&thread, NULL, _poll_fd_thread, (void *)NULL);
+    if (-1 == ret) {
+        _ERR("ico_syc_connect: pthread_create failed(%d:%s)",
+             errno, strerror(errno));
+        return ICO_SYC_ERR_SYSTEM;
+    }
+
+    /* init to create message */
+    ico_syc_init_msg();
+    /* init queue */
+    recv_info_q = g_queue_new();
+    recv_free_q = g_queue_new();
+
+    /* connect to System Controller */
+    ret = _connect_client(callback, user_data);
+    if (ret != ICO_SYC_ERR_NONE) {
+        return ret;
+    }
+
+    return ICO_SYC_ERR_NONE;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_disconnect
+ *          Disconnect the link from System Controller.
+ *          and unset the listener to notify the event of System Controller.
+ *
+ * @param       none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API void
+ico_syc_disconnect(void)
+{
+    recv_info_t *info;
+
+    /* close the connection */
+    if (uws_context != NULL) {
+        _disconnect_client();
+    }
+
+    /* terminate */
+    ico_syc_term_msg();
+
+    /* free queue */
+    while (g_queue_is_empty(recv_info_q) != TRUE) {
+        /* free recv_info_t */
+        info = g_queue_pop_head(recv_info_q);
+        free(info);
+    }
+    g_queue_free(recv_info_q);
+
+    while (g_queue_is_empty(recv_free_q) != TRUE) {
+        /* free recv_info_t */
+        info = g_queue_pop_head(recv_free_q);
+        free(info);
+    }
+    g_queue_free(recv_free_q);
+
+    return;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/lib/apps-framework/ico_syc_inputctl.c b/lib/apps-framework/ico_syc_inputctl.c
new file mode 100644 (file)
index 0000000..f5e5dd4
--- /dev/null
@@ -0,0 +1,311 @@
+/*
+ * 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   Input Control API
+ *          for privilege applications
+ *
+ * @date    July-31-2013
+ */
+
+#include "ico_syc_msg_cmd_def.h"
+#include "ico_syc_msg.h"
+#include "ico_syc_private.h"
+#include "ico_syc_privilege.h"
+
+/*============================================================================*/
+/* define static function prototype                                           */
+/*============================================================================*/
+static msg_t _create_add_input_msg(const char *appid, const char *device,
+                                  int input, int fix, int keycode);
+static msg_t _create_del_input_msg(const char *appid,
+                                  const char *device, int input);
+static msg_t _create_send_input_msg(const char *appid, int surface, int type,
+                                   int deviceno, int code, int value);
+
+/*============================================================================*/
+/* static function                                                            */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_add_input_msg
+ *          Create the message to add input device.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   device                  input device
+ * @param[in]   input                   input number
+ * @param[in]   fix                     fixed allocation or variable allocation
+ * @param[in]   keycode                 keycode
+ *                                      (If set "0", not allocate to keycode)
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_add_input_msg(const char *appid, const char *device,
+                     int input, int fix, int keycode)
+{
+    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_ADD_INPUT);
+    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_DEV, device);
+    json_object_set_int_member(argobj, MSG_PRMKEY_INPUT, input);
+    json_object_set_int_member(argobj, MSG_PRMKEY_ALLOC, fix);
+    json_object_set_int_member(argobj, MSG_PRMKEY_KEY, keycode);
+    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;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_del_input_msg
+ *          Create the message to delete input device.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   device                  input device
+ * @param[in]   input                   input number
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_del_input_msg(const char *appid, const char *device, int input)
+{
+    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_DEL_INPUT);
+    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_DEV, device);
+    json_object_set_int_member(argobj, MSG_PRMKEY_INPUT, input);
+    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;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_send_input_msg
+ *          Create the message to send input event.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @param[in]   type                    device type of input event
+ * @param[in]   deviceno                input device number
+ * @param[in]   code                    input event code
+ * @param[in]   value                   input event value
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_send_input_msg(const char *appid, int surface, int type,
+                       int deviceno, int code, int value)
+{
+    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_SEND_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(argobj, MSG_PRMKEY_SURFACE, surface);
+    json_object_set_int_member(argobj, MSG_PRMKEY_EV_TYPE, type);
+    json_object_set_int_member(argobj, MSG_PRMKEY_DEVICE, deviceno);
+    json_object_set_int_member(argobj, MSG_PRMKEY_EV_CODE, code);
+    json_object_set_int_member(argobj, MSG_PRMKEY_EV_VAL, value);
+    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;
+}
+
+/*============================================================================*/
+/* public interface function                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_add_input
+ *          Add the input event to the application.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   device                  input device
+ * @param[in]   input                   input number
+ * @param[in]   fix                     fixed allocation or variable allocation
+ * @param[in]   keycode                 keycode
+ *                                      (If set "0", not allocate to keycode)
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ * @see         ico_syc_input_alloc_e
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_add_input(const char *appid, const char *device,
+                  int input, int fix, int keycode)
+{
+    int ret = ICO_SYC_ERR_NONE;
+    msg_t msg;
+
+    /* check argument */
+    if (appid == NULL || device == NULL) {
+        _ERR("invalid parameter (appid or device is NULL)");
+        return ICO_SYC_ERR_INVALID_PARAM;
+    }
+
+    /* make message */
+    msg = _create_add_input_msg(appid, device, input, fix, keycode);
+    /* send message */
+    ret = ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return ret;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_delete_input
+ *          Delete the input event assigned to the application.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   device                  input device
+ * @param[in]   input                   input number
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_delete_input(const char *appid, const char *device, int input)
+{
+    int ret = ICO_SYC_ERR_NONE;
+    msg_t msg;
+
+    /* check argument */
+    if (appid == NULL || device == NULL) {
+        _ERR("invalid parameter (appid or device is NULL)");
+        return ICO_SYC_ERR_INVALID_PARAM;
+    }
+
+    /* make message */
+    msg = _create_del_input_msg(appid, device, input);
+    /* send message */
+    ret = ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return ret;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_send_input
+ *          Send the input event to the application.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @param[in]   type                    device type of input event
+ * @param[in]   deviceno                input device number
+ * @param[in]   code                    input event code
+ * @param[in]   value                   input event value
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ * @see         ico_syc_input_type_e
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_send_input(const char *appid, int surface, int type,
+                   int deviceno, int code, int value)
+{
+    int ret = ICO_SYC_ERR_NONE;
+    msg_t msg;
+
+    /* check argument */
+    if (appid == NULL) {
+        _ERR("invalid parameter (appid is NULL)");
+        return ICO_SYC_ERR_INVALID_PARAM;
+    }
+
+    /* make message */
+    msg = _create_send_input_msg(appid, surface, type, deviceno, code, value);
+    /* send message */
+    ret = ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return ret;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/lib/apps-framework/ico_syc_msg.c b/lib/apps-framework/ico_syc_msg.c
new file mode 100644 (file)
index 0000000..370e183
--- /dev/null
@@ -0,0 +1,423 @@
+/*
+ * 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   Message API (Internal Function)
+ *
+ * @date    July-31-2013
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+
+#include <ico_uws.h>
+
+#include "ico_syc_error.h"
+#include "ico_syc_msg_cmd_def.h"
+#include "ico_syc_msg.h"
+#include "ico_syc_private.h"
+#include "ico_syc_type.h"
+
+/*============================================================================*/
+/* define static function prototype                                           */
+/*============================================================================*/
+static void _store_data(msg_str_t msg, size_t len);
+static void _send_stored_data(void);
+
+/*============================================================================*/
+/* variable & table                                                           */
+/*============================================================================*/
+/* queue for send data */
+GQueue *send_info_q = NULL;
+GQueue *send_free_q = NULL;
+
+/* pthread mutex initialize */
+static pthread_mutex_t in_out_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+/* send data info table */
+typedef struct _send_info {
+    char    data[1024];
+    size_t  len;
+} send_info_t;
+
+/*============================================================================*/
+/* static function                                                            */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _store_data
+ *          Enqueue data that could not send.
+ *
+ * @param[in]   data                    data
+ * @param[in]   len                     length of data
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+_store_data(msg_str_t data, size_t len)
+{
+    send_info_t *send_data;
+
+    /* mutex lock */
+    pthread_mutex_lock(&in_out_mutex);
+    if (g_queue_is_empty(send_free_q) == TRUE) {
+        /* alloc memory */
+        send_data = calloc(1, sizeof(send_info_t));
+        if (send_data == NULL) {
+            /* mutex unlock */
+            pthread_mutex_unlock(&in_out_mutex);
+            _ERR("calloc failed");
+            return;
+        }
+    }
+    else {
+        /* get free memory */
+        send_data = g_queue_pop_head(send_free_q);
+        if (send_data == NULL) {
+            /* mutex unlock */
+            pthread_mutex_unlock(&in_out_mutex);
+            _ERR("g_queue_pop_head failed");
+            return;
+        }
+    }
+    memset(send_data, 0, sizeof(send_info_t));
+
+    /* set data */
+    snprintf(send_data->data, sizeof(send_data->data), "%s", (char *)data);
+    send_data->len = len;
+    _DBG("store [%s]", send_data->data);
+
+    /* enqueue */
+    g_queue_push_tail(send_info_q, send_data);
+    /* mutex unlock */
+    pthread_mutex_unlock(&in_out_mutex);
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _send_stored_data
+ *          Send data that could not send before.
+ *
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+_send_stored_data(void)
+{
+    struct ico_uws_context *context = NULL;
+    void *id                        = NULL;
+    send_info_t *info               = NULL;
+
+    /* get ico_uws context and id */
+    context = ico_syc_get_context();
+    id = ico_syc_get_id();
+    if (context == NULL || id == NULL) {
+        _ERR("connection error (ico_uws context or id is NULL)");
+        return;
+    }
+
+    while (g_queue_is_empty(send_info_q) != TRUE) {
+        /* mutex lock */
+        pthread_mutex_lock(&in_out_mutex);
+        /* pop data */
+        info = g_queue_pop_head(send_info_q);
+        /* mutex unlock */
+        pthread_mutex_unlock(&in_out_mutex);
+        _INFO("send stored data [%s]", info->data);
+
+        /* send data */
+        ico_uws_service(context);
+        ico_uws_send(context, id, (unsigned char *)info->data, info->len);
+
+        /* mutex lock */
+        pthread_mutex_lock(&in_out_mutex);
+        /* push free_queue */
+        g_queue_push_tail(send_free_q, info);
+        /* mutex unlock */
+        pthread_mutex_unlock(&in_out_mutex);
+    }
+
+    return;
+}
+
+/*============================================================================*/
+/* internal common function                                                   */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_init_msg
+ *          Initialize to create and send message.
+ *
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+ico_syc_init_msg(void)
+{
+    /* init queue */
+    send_info_q = g_queue_new();
+    send_free_q = g_queue_new();
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_send_msg
+ *          Send message to System Controller.
+ *          If set argument NULL, send stored message to System Controller.
+ *
+ * @param[in]   msg                     json object (msg_t)
+ * @return      result
+ * @return      0                       success
+ * @return      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+int
+ico_syc_send_msg(msg_t msg)
+{
+    struct ico_uws_context *context = NULL;
+    void *id                        = NULL;
+    msg_str_t data                  = NULL;
+    size_t len                      = 0;
+
+    /* check stored data exists */
+    if (g_queue_is_empty(send_info_q) != TRUE) {
+        /* send stored data */
+        _send_stored_data();
+    }
+
+    /* if msg is NULL, exit this method */
+    if (msg == NULL) {
+        return ICO_SYC_ERR_NONE;
+    }
+
+    /* mutex lock */
+    pthread_mutex_lock(&in_out_mutex);
+    /* get data */
+    data = json_generator_to_data(msg, &len);
+    if (data == NULL) {
+        /* mutex unlock */
+        pthread_mutex_unlock(&in_out_mutex);
+        _ERR("json_generator_to_data failed");
+        return ICO_SYC_ERR_INVALID_PARAM;
+    }
+
+    /* get ico_uws context and id */
+    context = ico_syc_get_context();
+    id = ico_syc_get_id();
+    if (context == NULL || id == NULL) {
+        /* mutex unlock */
+        pthread_mutex_unlock(&in_out_mutex);
+        _store_data(data, len);
+        g_free(data);
+        _WARN("stored data (retry to send when connecting)");
+        return ICO_SYC_ERR_CONNECT;
+    }
+    _INFO("send data [%s]", data);
+
+    /* send data */
+    ico_uws_service(context);
+    ico_uws_send(context, id, (unsigned char *)data, len);
+
+    /* free */
+    g_free(data);
+    /* mutex unlock */
+    pthread_mutex_unlock(&in_out_mutex);
+
+    return ICO_SYC_ERR_NONE;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_get_command
+ *          Get command from message data.
+ *
+ * @param[in]   data                    message data
+ * @param[in]   len                     length of data
+ * @return      command
+ * @return      command                 success
+ * @return      -1                      error
+ */
+/*--------------------------------------------------------------------------*/
+int
+ico_syc_get_command(const void *data, size_t len)
+{
+    JsonParser *parser  = NULL;
+    GError *error       = NULL;
+    gboolean gbool      = FALSE;
+    JsonNode *root      = NULL;
+    JsonObject *obj     = NULL;
+    int cmd             = -1;
+
+    /* check argument */
+    if (data == NULL || len == 0) {
+        _ERR("invalid parameter (data is NULL or length is 0)");
+        return ICO_SYC_ERR_INVALID_PARAM;
+    }
+
+    /* 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 -1;
+    }
+
+    /* 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 -1;
+    }
+
+    /* get object from root */
+    obj = json_node_get_object(root);
+    /* get command */
+    cmd = json_object_get_int_member(obj, MSG_PRMKEY_CMD);
+
+    /* unref */
+    g_object_unref(parser);
+
+    return cmd;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_get_str_member
+ *          Get string member from json object.
+ *
+ * @param[in]   obj                     json object
+ * @param[in]   name                    json object member name
+ * @return      string data
+ * @return      not NULL                success
+ * @return      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+char *
+ico_syc_get_str_member(JsonObject *obj, const gchar *name)
+{
+    char *str   = NULL;
+
+    /* member exists or not */
+    if (json_object_has_member(obj, name) == FALSE) {
+        return NULL;
+    }
+
+    /* null check */
+    if (json_object_get_null_member(obj, name) == TRUE) {
+        return NULL;
+    }
+
+    /* get string member */
+    str = (char *)json_object_get_string_member(obj, name);
+
+    return str;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_get_int_member
+ *          Get int member from json object.
+ *
+ * @param[in]   obj                     json object
+ * @param[in]   name                    json object member name
+ * @return      integer data
+ * @return      num                     success
+ * @return      -1                      error
+ */
+/*--------------------------------------------------------------------------*/
+int
+ico_syc_get_int_member(JsonObject *obj, const gchar *name)
+{
+    int num   = -1;
+
+    /* member exists or not */
+    if (json_object_has_member(obj, name) == FALSE) {
+        return -1;
+    }
+
+    /* null check */
+    if (json_object_get_null_member(obj, name) == TRUE) {
+        return -1;
+    }
+
+    /* get int member */
+    num = json_object_get_int_member(obj, name);
+
+    return num;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_free_msg
+ *          Free the json object.
+ *
+ * @param[in]   msg                     json object (msg_t)
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+ico_syc_free_msg(msg_t msg)
+{
+    /* check argument */
+    if (msg == NULL) {
+        _INFO("msg is NULL");
+        return;
+    }
+
+    JsonNode *node = json_generator_get_root(msg);
+    json_object_unref(json_node_get_object(node));
+    json_node_free(node);
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_term_msg
+ *          Terminate to create and send message.
+ *
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+ico_syc_term_msg(void)
+{
+    send_info_t *info;
+
+    /* free queue */
+    while (g_queue_is_empty(send_info_q) != TRUE) {
+        /* free send_info_t */
+        info = g_queue_pop_head(send_info_q);
+        free(info);
+    }
+    g_queue_free(send_info_q);
+
+    while (g_queue_is_empty(send_free_q) != TRUE) {
+        /* free send_info_t */
+        info = g_queue_pop_head(send_free_q);
+        free(info);
+    }
+    g_queue_free(send_free_q);
+
+    return;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/lib/apps-framework/ico_syc_userctl.c b/lib/apps-framework/ico_syc_userctl.c
new file mode 100644 (file)
index 0000000..4b0376d
--- /dev/null
@@ -0,0 +1,327 @@
+/*
+ * 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   User Control API
+ *          for privilege applications
+ *
+ * @date    Aug-22-2013
+ */
+
+#include <string.h>
+
+#include "ico_syc_msg_cmd_def.h"
+#include "ico_syc_msg.h"
+#include "ico_syc_private.h"
+#include "ico_syc_privilege.h"
+
+/*============================================================================*/
+/* define static function prototype                                           */
+/*============================================================================*/
+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 function                                                            */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_change_user_msg
+ *          Create the message to change the login user.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   name                    user name
+ * @param[in]   password                user's password
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_change_user_msg(const char *appid, const char *name,
+                        const char *password)
+{
+    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_CHANGE_USER);
+    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_USER, name);
+    json_object_set_string_member(argobj, MSG_PRMKEY_PASSWD, password);
+    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;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_userlist_msg
+ *          Create the message to get the user list.
+ *
+ * @param[in]   appid                   application id
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_userlist_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_USERLIST);
+    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;
+}
+
+/*============================================================================*/
+/* internal common function                                                   */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_auth
+ *          Execute callback function. (ICO_SYC_EV_AUTH_FAIL)
+ *
+ * @param[in]   callback                callback function
+ * @param[in]   user_data               passed data on called callback function
+ * @param[in]   event                   event code
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+ico_syc_cb_auth(ico_syc_callback_t callback, void *user_data, int event)
+{
+    /* exec callback (no detail data) */
+    callback(event, NULL, user_data);
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_userlist
+ *          Execute callback function. (ICO_SYC_EV_USERLIST)
+ *
+ * @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_userlist(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;
+    JsonArray *array    = NULL;
+    char **list         = NULL;
+    int id, num;
+
+    ico_syc_userlist_t  *userlist   = NULL;
+
+    /* alloc memory */
+    userlist = calloc(1, sizeof(ico_syc_userlist_t));
+    if (userlist == NULL) {
+        _ERR("calloc failed");
+        return;
+    }
+    /* clear memory */
+    memset(userlist, 0, sizeof(ico_syc_userlist_t));
+
+    /* start parser */
+    parser = json_parser_new();
+    gbool = json_parser_load_from_data(parser, data, len, &error);
+    if (gbool == FALSE) {
+        g_object_unref(parser);
+        free(userlist);
+        _ERR("json_parser_load_from_data failed");
+        return;
+    }
+
+    /* get root node */
+    root = json_parser_get_root(parser);
+    if (root == NULL) {
+        g_object_unref(parser);
+        free(userlist);
+        _ERR("json_parser_get_root failed (root is NULL)");
+        return;
+    }
+
+    /* get object from root */
+    obj = json_node_get_object(root);
+    /* check object */
+    if (json_object_has_member(obj, MSG_PRMKEY_ARG) == FALSE) {
+        /* free */
+        free(userlist);
+        _ERR("invalid message");
+        return;
+    }
+    /* get object from obj */
+    argobj = json_object_get_object_member(obj, MSG_PRMKEY_ARG);
+    /* get user num */
+    num = ico_syc_get_int_member(argobj, MSG_PRMKEY_USER_NUM);
+    userlist->user_num = num;
+
+    /* get userlist */
+    if (json_object_has_member(argobj, MSG_PRMKEY_USER_LIST) == FALSE) {
+        userlist->userlist = NULL;
+        _WARN("userlist does not exist");
+    }
+    else {
+        /* alloc memory */
+        list = malloc(sizeof(char *) * num);
+        if (list == NULL) {
+            g_object_unref(parser);
+            free(userlist);
+            _ERR("malloc failed");
+            return;
+        }
+        /* set user name */
+        array = json_object_get_array_member(argobj, MSG_PRMKEY_USER_LIST);
+        for (id = 0; id < num; id++) {
+            list[id] = strdup(json_array_get_string_element(array, id));
+        }
+        userlist->userlist = list;
+    }
+
+    /* set login user name */
+    userlist->user_login = strdup(ico_syc_get_str_member
+                                              (argobj, MSG_PRMKEY_USER_LOGIN));
+
+    /* exec callback */
+    callback(event, userlist, user_data);
+
+    /* free memory */
+    g_object_unref(parser);
+    if (list != NULL) {
+        for (id = 0; id < num; id++) {
+            free(list[id]);
+        }
+        free(list);
+    }
+    free(userlist->user_login);
+    free(userlist);
+
+    return;
+}
+
+/*============================================================================*/
+/* public interface function                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_change_user
+ *          Change the login user.
+ *          If fails to authenticate the user,
+ *          callback function notifies the result.
+ *
+ * @param[in]   name                    user name
+ * @param[in]   password                user's password
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API void
+ico_syc_change_user(const char *name, const char *password)
+{
+    msg_t msg;
+    char *appid;
+
+    /* get appid */
+    appid = ico_syc_get_appid();
+
+    /* make message */
+    msg = _create_change_user_msg(appid, name, password);
+    /* send message */
+    (void)ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_get_userlist
+ *          Get the user list.
+ *          Callback function notifies the user list.
+ *
+ * @param       none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API void
+ico_syc_get_userlist(void)
+{
+    msg_t msg;
+    char *appid;
+
+    /* get appid */
+    appid = ico_syc_get_appid();
+
+    /* make message */
+    msg = _create_userlist_msg(appid);
+    /* send message */
+    (void)ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/lib/apps-framework/ico_syc_winctl.c b/lib/apps-framework/ico_syc_winctl.c
new file mode 100644 (file)
index 0000000..ae85481
--- /dev/null
@@ -0,0 +1,1159 @@
+/*
+ * 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   Window Control API
+ *          for privilege applications
+ *
+ * @date    Aug-22-2013
+ */
+
+#include <string.h>
+
+#include "ico_syc_msg_cmd_def.h"
+#include "ico_syc_msg.h"
+#include "ico_syc_private.h"
+#include "ico_syc_privilege.h"
+
+/*============================================================================*/
+/* definition                                                                 */
+/*============================================================================*/
+#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 static function prototype                                           */
+/*============================================================================*/
+static msg_t _create_win_msg(const char *appid, int surface,
+                             const ico_syc_animation_t *animation,
+                             int type);
+static msg_t _create_win_move_msg(const char *appid, int surface,
+                                  const ico_syc_win_move_t *move,
+                                  const ico_syc_animation_t *animation);
+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_layer_msg(const char *appid, int layer, int attr,
+                               int type);
+
+/*============================================================================*/
+/* static function                                                            */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_win_msg
+ *          Create the message to show/hide the application window.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @param[in]   animation               animation information
+ * @param[in]   type                    type of command
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_win_msg(const char *appid, int surface,
+                const ico_syc_animation_t *animation, int type)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+    int cmd             = -1;
+
+    /* create json object */
+    obj = json_object_new();
+    argobj = json_object_new();
+    if (obj == NULL || argobj == NULL) {
+        _ERR("json_object_new failed");
+        return NULL;
+    }
+
+    /* set command */
+    if (type == _CMD_SHOW_WIN) {
+        cmd = MSG_CMD_SHOW;
+    }
+    else if (type == _CMD_HIDE_WIN) {
+        cmd = MSG_CMD_HIDE;
+    }
+
+    /* set message */
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
+    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(argobj, MSG_PRMKEY_SURFACE, surface);
+    /* set animation info */
+    if (animation != NULL) {
+        json_object_set_string_member(argobj, MSG_PRMKEY_ANIM_NAME,
+                                      animation->name);
+        json_object_set_int_member(argobj, MSG_PRMKEY_ANIM_TIME,
+                                   animation->time);
+    }
+    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;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_win_move_msg
+ *          Create the message to move the application window.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @param[in]   move                    move information (zone/position/size)
+ * @param[in]   animation               animation information
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_win_move_msg(const char *appid, int surface,
+                     const ico_syc_win_move_t *move,
+                     const ico_syc_animation_t *animation)
+{
+    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_MOVE);
+    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(argobj, MSG_PRMKEY_SURFACE, surface);
+    /* set move info */
+    if (move->zone != NULL) {
+        json_object_set_string_member(argobj, MSG_PRMKEY_ZONE, move->zone);
+    }
+    else {
+        json_object_set_int_member(argobj, MSG_PRMKEY_POS_X, move->pos_x);
+        json_object_set_int_member(argobj, MSG_PRMKEY_POS_Y, move->pos_y);
+    }
+    json_object_set_int_member(argobj, MSG_PRMKEY_WIDTH, move->width);
+    json_object_set_int_member(argobj, MSG_PRMKEY_HEIGHT, move->height);
+    /* set animation info */
+    if (animation != NULL) {
+        json_object_set_string_member(argobj, MSG_PRMKEY_ANIM_NAME,
+                                      animation->name);
+        json_object_set_int_member(argobj, MSG_PRMKEY_ANIM_TIME,
+                                   animation->time);
+    }
+    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;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_active_win_msg
+ *          Create the message to change active window.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_active_win_msg(const char *appid, int surface)
+{
+    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_CHANGE_ACTIVE);
+    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(argobj, MSG_PRMKEY_SURFACE, surface);
+    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;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_change_layer_msg
+ *          Create the message to change application window's layer.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @param[in]   layer                   window's layer id
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_change_layer_msg(const char *appid, int surface, int layer)
+{
+    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_CHANGE_LAYER);
+    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(argobj, MSG_PRMKEY_SURFACE, surface);
+    json_object_set_int_member(argobj, MSG_PRMKEY_LAYER, layer);
+    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;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_prepare_thumb_msg
+ *          Create the message to prepare thumbnail.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @param[in]   framerate               notify cycle [ms]
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_prepare_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();
+    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, cmd);
+    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(argobj, MSG_PRMKEY_SURFACE, surface);
+    json_object_set_int_member(argobj, MSG_PRMKEY_RATE, framerate);
+    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;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_thumb_msg
+ *          Create the message to map/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)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+    int cmd             = -1;
+
+    /* create json object */
+    obj = json_object_new();
+    argobj = json_object_new();
+    if (obj == NULL || argobj == NULL) {
+        _ERR("json_object_new failed");
+        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_string_member(obj, MSG_PRMKEY_APPID, appid);
+    json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
+
+    json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, surface);
+    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;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   _create_layer_msg
+ *          Create the message to show/hide layer or to set layer attribute.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   layer                   window's layer id
+ * @param[in]   attr                    attribute
+ * @param[in]   type                    type of command
+ * @return      json generator
+ * @retval      json generator          success
+ * @retval      NULL                    error
+ */
+/*--------------------------------------------------------------------------*/
+static msg_t
+_create_layer_msg(const char *appid, int layer, int attr, int type)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+    int cmd             = -1;
+
+    /* create json object */
+    obj = json_object_new();
+    argobj = json_object_new();
+    if (obj == NULL || argobj == NULL) {
+        _ERR("json_object_new failed");
+        return NULL;
+    }
+
+    /* set command */
+    if (type == _CMD_SHOW_LAYER) {
+        cmd = MSG_CMD_SHOW_LAYER;
+    }
+    else if (type == _CMD_HIDE_LAYER) {
+        cmd = MSG_CMD_HIDE_LAYER;
+    }
+
+    /* set message */
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
+    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(argobj, MSG_PRMKEY_LAYER, layer);
+    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                                                   */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_win
+ *          Execute callback function. (ICO_SYC_EV_WIN_ACTIVE
+ *                                      ICO_SYC_EV_WIN_CREATE
+ *                                      ICO_SYC_EV_WIN_DESTROY)
+ *
+ * @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_win(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_win_info_t *win_info    = NULL;
+
+    /* alloc memory */
+    win_info = calloc(1, sizeof(ico_syc_win_info_t));
+    if (win_info == NULL) {
+        _ERR("calloc failed");
+        return;
+    }
+    /* clear memory */
+    memset(win_info, 0, sizeof(ico_syc_win_info_t));
+
+    /* start parser */
+    parser = json_parser_new();
+    gbool = json_parser_load_from_data(parser, data, len, &error);
+    if (gbool == FALSE) {
+        g_object_unref(parser);
+        free(win_info);
+        _ERR("json_parser_load_from_data failed");
+        return;
+    }
+
+    /* get root node */
+    root = json_parser_get_root(parser);
+    if (root == NULL) {
+        g_object_unref(parser);
+        free(win_info);
+        _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);
+        free(win_info);
+        _ERR("invalid message" );
+        return;
+    }
+    /* get object from obj */
+    argobj = json_object_get_object_member(obj, MSG_PRMKEY_ARG);
+
+    /* set data */
+    win_info->appid = strdup(ico_syc_get_str_member(obj, MSG_PRMKEY_APPID));
+    win_info->name = strdup(ico_syc_get_str_member(argobj, MSG_PRMKEY_WINNAME));
+    win_info->surface = ico_syc_get_int_member(argobj, MSG_PRMKEY_SURFACE);
+
+    /* exec callback */
+    callback(event, win_info, user_data);
+
+    /* free memory */
+    g_object_unref(parser);
+    if (win_info->appid != NULL) free(win_info->appid);
+    if (win_info->name != NULL) free(win_info->name);
+    free(win_info);
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_win_attr
+ *          Execute callback function. (ICO_SYC_EV_WIN_ATTR_CHANGE)
+ *
+ * @param[in]   callback                callback function
+ * @param[in]   user_data               :assed 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_win_attr(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_win_attr_t *win_attr    = NULL;
+
+    /* alloc memory */
+    win_attr = calloc(1, sizeof(ico_syc_win_attr_t));
+    if (win_attr == NULL) {
+        _ERR("calloc failed");
+        return;
+    }
+    /* clear memory */
+    memset(win_attr, 0, sizeof(ico_syc_win_attr_t));
+
+    /* start parser */
+    parser = json_parser_new();
+    gbool = json_parser_load_from_data(parser, data, len, &error);
+    if (gbool == FALSE) {
+        g_object_unref(parser);
+        free(win_attr);
+        _ERR("json_parser_load_from_data failed");
+        return;
+    }
+
+    /* get root node */
+    root = json_parser_get_root(parser);
+    if (root == NULL) {
+        g_object_unref(parser);
+        free(win_attr);
+        _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);
+        free(win_attr);
+        _ERR("invalid message" );
+        return;
+    }
+    /* get object from obj */
+    argobj = json_object_get_object_member(obj, MSG_PRMKEY_ARG);
+
+    /* set data */
+    win_attr->appid = strdup(ico_syc_get_str_member(obj, MSG_PRMKEY_APPID));
+    win_attr->name = strdup(ico_syc_get_str_member(argobj, MSG_PRMKEY_WINNAME));
+    win_attr->surface = ico_syc_get_int_member(argobj, MSG_PRMKEY_SURFACE);
+    win_attr->nodeid = ico_syc_get_int_member(argobj, MSG_PRMKEY_NODE);
+    win_attr->layer = ico_syc_get_int_member(argobj, MSG_PRMKEY_LAYER);
+    win_attr->pos_x = ico_syc_get_int_member(argobj, MSG_PRMKEY_POS_X);
+    win_attr->pos_y = ico_syc_get_int_member(argobj, MSG_PRMKEY_POS_Y);
+    win_attr->width = ico_syc_get_int_member(argobj, MSG_PRMKEY_WIDTH);
+    win_attr->height = ico_syc_get_int_member(argobj, MSG_PRMKEY_HEIGHT);
+    win_attr->raise = ico_syc_get_int_member(argobj, MSG_PRMKEY_RAISE);
+    win_attr->visible = ico_syc_get_int_member(argobj, MSG_PRMKEY_VISIBLE);
+    win_attr->active = ico_syc_get_int_member(argobj, MSG_PRMKEY_ACTIVE);
+
+    /* exec callback */
+    callback(event, win_attr, user_data);
+
+    /* free memory */
+    g_object_unref(parser);
+    if (win_attr->appid != NULL) free(win_attr->appid);
+    if (win_attr->name != NULL) free(win_attr->name);
+    free(win_attr);
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_thumb
+ *          Execute callback function. (ICO_SYC_EV_THUMB_PREPARE
+ *                                      ICO_SYC_EV_THUMB_CHANGE
+ *                                      ICO_SYC_EV_THUMB_UNMAP)
+ *
+ * @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_thumb(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_thumb_info_t *thumb_info    = NULL;
+
+    /* alloc memory */
+    thumb_info = calloc(1, sizeof(ico_syc_thumb_info_t));
+    if (thumb_info == NULL) {
+        _ERR("calloc failed");
+        return;
+    }
+    /* clear memory */
+    memset(thumb_info, 0, sizeof(ico_syc_thumb_info_t));
+
+    /* start parser */
+    parser = json_parser_new();
+    gbool = json_parser_load_from_data(parser, data, len, &error);
+    if (gbool == FALSE) {
+        g_object_unref(parser);
+        free(thumb_info);
+        _ERR("json_parser_load_from_data failed");
+        return;
+    }
+
+    /* get root node */
+    root = json_parser_get_root(parser);
+    if (root == NULL) {
+        g_object_unref(parser);
+        free(thumb_info);
+        _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);
+        free(thumb_info);
+        _ERR("invalid message" );
+        return;
+    }
+    /* get object from obj */
+    argobj = json_object_get_object_member(obj, MSG_PRMKEY_ARG);
+
+    /* set data */
+    thumb_info->appid = strdup(ico_syc_get_str_member(obj, MSG_PRMKEY_APPID));
+
+    thumb_info->surface = ico_syc_get_int_member(argobj,
+                                                 MSG_PRMKEY_SURFACE);
+    thumb_info->width = ico_syc_get_int_member(argobj, MSG_PRMKEY_WIDTH);
+    thumb_info->height = ico_syc_get_int_member(argobj, MSG_PRMKEY_HEIGHT);
+    thumb_info->stride = ico_syc_get_int_member(argobj, MSG_PRMKEY_STRIDE);
+    thumb_info->format = ico_syc_get_int_member(argobj, MSG_PRMKEY_FORMAT);
+
+    /* exec callback */
+    callback(event, thumb_info, user_data);
+
+    /* free memory */
+    g_object_unref(parser);
+    free(thumb_info->appid);
+    free(thumb_info);
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @internal
+ * @brief   ico_syc_cb_layer
+ *          Execute callback function. (ICO_SYC_EV_LAYER_ATTR_CHANGE)
+ *
+ * @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_layer(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_layer_attr_t *layer_attr    = NULL;
+
+    /* alloc memory */
+    layer_attr = calloc(1, sizeof(ico_syc_layer_attr_t));
+    if (layer_attr == NULL) {
+        _ERR("calloc failed");
+        return;
+    }
+    /* clear memory */
+    memset(layer_attr, 0, sizeof(ico_syc_layer_attr_t));
+
+    /* start parser */
+    parser = json_parser_new();
+    gbool = json_parser_load_from_data(parser, data, len, &error);
+    if (gbool == FALSE) {
+        g_object_unref(parser);
+        free(layer_attr);
+        _ERR("json_parser_load_from_data failed");
+        return;
+    }
+
+    /* get root node */
+    root = json_parser_get_root(parser);
+    if (root == NULL) {
+        g_object_unref(parser);
+        free(layer_attr);
+        _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);
+        free(layer_attr);
+        _ERR("invalid message" );
+        return;
+    }
+    /* get object from obj */
+    argobj = json_object_get_object_member(obj, MSG_PRMKEY_ARG);
+    /* set data */
+    layer_attr->layer = ico_syc_get_int_member(argobj, MSG_PRMKEY_LAYER);
+    layer_attr->visible = ico_syc_get_int_member(argobj,
+                                                     MSG_PRMKEY_VISIBLE);
+
+    /* exec callback */
+    callback(event, layer_attr, user_data);
+
+    /* free memory */
+    g_object_unref(parser);
+    free(layer_attr);
+
+    return;
+}
+
+/*============================================================================*/
+/* public interface function                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_show
+ *          Show the application window with animation.
+ *          If user sets argument surface "ICO_SYC_WIN_SHOW_ALL",
+ *          show all of the application windows.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @param[in]   animation               animation information
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_show(const char *appid, int surface,
+             const ico_syc_animation_t *animation)
+{
+    int ret = ICO_SYC_ERR_NONE;
+    msg_t msg;
+
+    /* check argument */
+    if (appid == NULL) {
+        _ERR("invalid parameter (appid is NULL)");
+        return ICO_SYC_ERR_INVALID_PARAM;
+    }
+
+    /* make message */
+    msg = _create_win_msg(appid, surface, animation, _CMD_SHOW_WIN);
+    /* send message */
+    ret = ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return ret;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_hide
+ *          Hide the application window with animation.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @param[in]   animation               animation information
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_hide(const char *appid, int surface,
+             const ico_syc_animation_t *animation)
+{
+    int ret = ICO_SYC_ERR_NONE;
+    msg_t msg;
+
+    /* check argument */
+    if (appid == NULL) {
+        _ERR("invalid parameter (appid is NULL)");
+        return ICO_SYC_ERR_INVALID_PARAM;
+    }
+
+    /* make message */
+    msg = _create_win_msg(appid, surface, animation, _CMD_HIDE_WIN);
+    /* send message */
+    ret = ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return ret;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_move
+ *          Move the application window with animation.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @param[in]   move                    move information (zone/position/size)
+ * @param[in]   animation               animation information
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_move(const char *appid, int surface,
+             const ico_syc_win_move_t *move,
+             const ico_syc_animation_t *animation)
+{
+    int ret = ICO_SYC_ERR_NONE;
+    msg_t msg;
+
+    /* check argument */
+    if (appid == NULL) {
+        _ERR("invalid parameter (appid is NULL)");
+        return ICO_SYC_ERR_INVALID_PARAM;
+    }
+
+    /* make message */
+    msg = _create_win_move_msg(appid, surface, move, animation);
+    /* send message */
+    ret = ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return ret;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_change_active
+ *          Change the active window which receives the win-event notification
+ *          from System Controller.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_change_active(const char *appid, int surface)
+{
+    int ret = ICO_SYC_ERR_NONE;
+    msg_t msg;
+
+    /* check argument */
+    if (appid == NULL) {
+        _ERR("invalid parameter (appid is NULL)");
+        return ICO_SYC_ERR_INVALID_PARAM;
+    }
+
+    /* make message */
+    msg = _create_active_win_msg(appid, surface);
+    /* send message */
+    ret = ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return ret;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_change_layer
+ *          Change the window's layer.
+ *
+ * @param[in]   appid                   application id
+ * @param[in]   surface                 window's surface id
+ * @param[in]   layer                   window's layer id
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_change_layer(const char *appid, int surface, int layer)
+{
+    int ret = ICO_SYC_ERR_NONE;
+    msg_t msg;
+
+    /* check argument */
+    if (appid == NULL) {
+        _ERR("invalid parameter (appid is NULL)");
+        return ICO_SYC_ERR_INVALID_PARAM;
+    }
+
+    /* make message */
+    msg = _create_change_layer_msg(appid, surface, layer);
+    /* send message */
+    ret = ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return ret;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @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.
+ *
+ * @param[in]   surface                 window's surface id
+ * @param[in]   framerate               notify cycle [ms]
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_prepare_thumb(int surface, int framerate)
+{
+    int ret = ICO_SYC_ERR_NONE;
+    msg_t msg;
+    char *appid;
+
+    /* get appid */
+    appid = ico_syc_get_appid();
+
+    /* make message */
+    msg = _create_prepare_thumb_msg(appid, surface, framerate);
+    /* send message */
+    ret = ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return ret;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @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
+ *          terminated the application.
+ *
+ * @param[in]   surface                 window's surface id
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_unmap_thumb(int surface)
+{
+    int ret = ICO_SYC_ERR_NONE;
+    msg_t msg;
+    char *appid;
+
+    /* get appid */
+    appid = ico_syc_get_appid();
+
+    /* make message */
+    msg = _create_thumb_msg(appid, surface, _CMD_UNMAP_THUMB);
+    /* send message */
+    ret = ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return ret;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_show_layer
+ *          Show the layer.
+ *
+ * @param[in]   layer                   window's layer id
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_show_layer(int layer)
+{
+    int ret = ICO_SYC_ERR_NONE;
+    msg_t msg;
+    char *appid;
+
+    /* get appid */
+    appid = ico_syc_get_appid();
+
+    /* make message */
+    msg = _create_layer_msg(appid, layer, 0, _CMD_SHOW_LAYER);
+    /* send message */
+    ret = ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return ret;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_syc_hide_layer
+ *          Hide the layer.
+ *
+ * @param[in]   layer                   window's layer id
+ * @return      result
+ * @retval      0                       success
+ * @retval      not 0                   error
+ */
+/*--------------------------------------------------------------------------*/
+ICO_API int
+ico_syc_hide_layer(int layer)
+{
+    int ret = ICO_SYC_ERR_NONE;
+    msg_t msg;
+    char *appid;
+
+    /* get appid */
+    appid = ico_syc_get_appid();
+
+    /* make message */
+    msg = _create_layer_msg(appid, layer, 0, _CMD_HIDE_LAYER);
+    /* send message */
+    ret = ico_syc_send_msg(msg);
+    /* free send message */
+    ico_syc_free_msg(msg);
+
+    return ret;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/lib/misc/Makefile.am b/lib/misc/Makefile.am
new file mode 100644 (file)
index 0000000..43f6785
--- /dev/null
@@ -0,0 +1,2 @@
+SUBDIRS=\
+   state-machine 
diff --git a/lib/misc/state-machine/CicoBlockParser.cpp b/lib/misc/state-machine/CicoBlockParser.cpp
new file mode 100644 (file)
index 0000000..2d277be
--- /dev/null
@@ -0,0 +1,381 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <string>
+#include <vector>
+#include <ctype.h>
+#include <string.h>
+
+#include "CicoBlockParser.h"
+
+
+/**
+ * Perform a block classification defined string.
+ * perform a json parse
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+
+/**
+ * error message store
+ */
+std::string CicoBlockParser::m_err;
+
+/**
+ * @brief CicoBlockParser::CicoBlockParser
+ * @      constructor
+ * @      initial member variables
+ */
+CicoBlockParser::CicoBlockParser()
+{
+    m_void = (void*)0;
+    m_jsonTmp = (char*)0;
+}
+
+/**
+ * @brief CicoBlockParser::~CicoBlockParser
+ * @      Destructor
+ * @      release memory under the management
+ */
+CicoBlockParser::~CicoBlockParser()
+{
+    int sz = m_childs.size();
+    for (int i = 0; i < sz; i++) {
+        delete (m_childs[i]);
+    }
+    m_childs.clear();
+
+    if ((char*)0 != m_jsonTmp) {
+        delete m_jsonTmp;
+        m_jsonTmp = (char*)0;
+    }
+
+}
+
+/**
+ * @brief CicoBlockParser::getStateMachineParts
+ * @      get stateMachine block
+ * @param str
+ * @return true: get success/false:get fail
+ */
+bool CicoBlockParser::getStateMachineParts(const char* str)
+{
+
+    size_t tmp_sz = strlen(str);
+    char  tmp_s[tmp_sz+1];
+    tmp_s[0]='\0';
+    size_t t2sz = spaceLess(tmp_s, str); // strip string set workspace
+
+    char*  tmpstr = tmp_s;
+    const char* tmpend = tmpstr+t2sz;
+
+    const char* key0 = D_PTF1;          // "stateMachine"
+    bool    dqF = false;                // flag double quotate
+    char*   sttM = (char*)0;
+    char*   ts = tmpstr;
+    const char* errq = (char*)0;
+    for (; *ts != '\0'; ts++) {
+        if ((true == dqF) && ('\"' == *ts)) { // double quotate ?
+            dqF = false;                // end string part
+            errq = (char*)0;
+            continue;                   // continue of for *ts != 0
+        }
+
+        if ((false == dqF) && ('\"' == *ts)) { // double quotate ?
+            if (0 == strncmp(ts, key0, strlen(key0))) { // stateMachine ?
+                sttM = ts;
+                break;                  // break of for *ts != 0
+            }
+            else {
+                dqF = true;             // start string part
+                errq = ts;
+                continue;               // continue of for *ts != 0
+            }
+        }
+        if (tmpend == ts) {
+            break;                      // break of for *ts != 0
+        }
+    }
+
+    if ((char*)0 != sttM) {
+        m_kind = STTMAC;
+        if ((char*)0 != getBrackets(sttM, tmpend)) { 
+            return true;
+        }
+    }
+    else {
+        std::string errhead;
+        if (errq) {
+            getErrorHead(errhead, errq);
+        }
+        else {
+            getErrorHead(errhead, tmpstr);
+        }
+        std::ostringstream stream;
+        stream << "define error(\"" << errhead << "\")";
+        m_err = stream.str();
+    }
+    return false;
+}
+
+/**
+ * @brief CicoBlockParser::getBrackets
+ * @      get state/finalState/historyState/event block
+ * @param tmpstr string top
+ * @param tmpend string end
+ * @return !=0:next string pointer ==0:get failure
+ */
+const char* CicoBlockParser::getBrackets(char* tmpstr, const char* tmpend)
+{
+    // block hea key word
+    const char* key1 = D_PTS1;          // "\"state\""
+    const char* key2 = D_PTS2;          // "\"finalState\""
+    const char* key3 = D_PTS3;          // "\"historyState\""
+    const char* key4 = D_PTS4;          // "\"event\""
+    std::string errhead;
+    getErrorHead(errhead, tmpstr);
+    int bracketsCnt = 0;                // counter
+    bool dqF = false;                   // flag double quotate
+    char* ts = tmpstr;
+    const char* te = tmpend;
+
+    if ('\"' == *ts) {
+        dqF = true;
+    }
+    ts++;
+
+    while ('\0' != *ts) {               // Repeat until you find the stop code
+        if ((true == dqF) && ('\"' == *ts)) { // Is it the end of the string ?
+            dqF = false;                // end string part
+            ts++;                       // next code
+            continue;                   // continue of while
+        }
+        if ((false == dqF) && ('\"' == *ts)) { // Is it the start of the string ?
+            const char* tr = (char*)0;
+            if (0 == strncmp(ts, key1, strlen(key1))) { // Is it parts of state
+                CicoBlockParser* smdp = new CicoBlockParser;
+                m_childs.push_back(smdp);
+                smdp->m_kind = STT;
+                tr = smdp->getBrackets(ts, te);
+            }
+            else if (0 == strncmp(ts, key2, strlen(key2))) {
+                CicoBlockParser* smdp = new CicoBlockParser;
+                m_childs.push_back(smdp);
+                smdp->m_kind = FSTT;
+                tr = smdp->getBrackets(ts, te);
+            }
+            else if (0 == strncmp(ts, key3, strlen(key3))) {
+                CicoBlockParser* smdp = new CicoBlockParser;
+                m_childs.push_back(smdp);
+                smdp->m_kind = HSTT;
+                tr = smdp->getBrackets(ts, te);
+            }
+            else if (0 == strncmp(ts, key4, strlen(key4))) {
+                CicoBlockParser* smdp = new CicoBlockParser;
+                m_childs.push_back(smdp);
+                smdp->m_kind = EV;
+                tr = smdp->getBrackets(ts, te);
+            }
+            else {
+                dqF = true;             // start of the string
+                ts++;
+                continue;               // continue of while
+            }
+            if ((char*)0 == tr) {
+                return tr;
+            }
+            if (',' == *(ts-1)) {
+                ts--;
+            }
+#if 0
+            if ('\0'==*tr) {            // stop code
+                ts = '\0';              // set stop code
+            }
+            else {
+                strcpy(ts , tr);
+            }
+            te = ts + strlen(ts);
+#else
+            char* s = ts;
+            for (const char* d = tr; d < te; s++, d++) {
+                *s = *d;
+            }
+            *s = '\0';
+            te = s;
+#endif
+        }
+
+        if ((false == dqF) && ('{' == *ts)) {
+            bracketsCnt++;
+            ts++;
+            continue;                   // continue of while
+        }
+
+        if ((false == dqF) && ('}' == *ts)) {
+            bracketsCnt--;
+            if (0 < bracketsCnt) {
+                ts++;
+                continue;                // continue of while
+            }
+            else if (0 == bracketsCnt) {
+                size_t szt = ts - tmpstr;
+                m_parts.assign(tmpstr, szt+1);
+                ts++;
+                return ts;
+            }
+            else {
+                if (m_err.empty()) {
+                    std::ostringstream stream;
+                    stream<<"r-brackets mis.:"<<errhead;
+                    m_err = stream.str();
+                }
+                return (char*)0;
+            }
+        }
+        if (te == ts) {
+            break;                      // break of while
+        }
+        ts++;
+    }
+    if (m_err.empty()) {
+        std::ostringstream stream;
+        stream<<"syntax:"<<errhead;
+        m_err = stream.str();
+    }
+    return (char*)0;
+}
+
+
+/**
+ * @brief CicoBlockParser::getErrorHead
+ * @      error message parts edit
+ * @param errhead output message
+ * @param strtop message edit source
+ */
+void CicoBlockParser::getErrorHead(std::string& errhead, const char* strtop)
+{
+    int     edsz = 49;                  // get header string max size
+    char    tmperr[edsz];               // temp. area
+    const char* s = strtop; 
+    char*   d = tmperr;
+    int     dqCnt = 0;                  // double quotate counter
+    for (int k = 0; k < (edsz-1); k++) {
+        *d = *s++;                      // copy code;
+        if ('\"' == *d) {               // double quotate ?
+            dqCnt++;                    // count up
+            if (6==dqCnt) {
+                d++;                    // set position stop code
+                break;                  // break of for k
+            }
+        }
+        d++;                            // next store position
+        if ('\0' == *s) {               // stop code
+            break;                      // break of for k
+        }
+    }
+    *d='\0';                            // stop code
+    errhead.assign(tmperr);
+}
+
+/**
+ * string less space code
+ * @brief CicoBlockParser::spaceLess
+ * @param s source
+ * @param d store area
+ * @return store string size
+ */
+int CicoBlockParser::spaceLess(char* d, const char* s) const
+{
+    size_t  dsz = 0;                    // return value
+    char*   dd = d;                     // work pointer set destination
+    bool    dqF = false;                // flag double quotate
+    bool    cmtF = false;               // comment flag
+    const char* ss = s;                 // work pointer source set
+    for (; *ss != '\0'; ss++) {         // loop string size
+        // "(double quotate) block check
+        if ((false == cmtF) && (false == dqF) && ('\"' == *ss)) {
+            dqF = true;                 // start string part
+        }
+        else if ((false == cmtF) && (true == dqF) && ('\"' == *ss)) {
+            dqF = false;                // end string part
+        }
+        // comment(/* .. */) block check
+        else if ((false == cmtF) && (false == dqF) &&
+                 ('/' == *ss) && ('*' == *(ss+1))) {
+            cmtF = true;                // start comment part
+        }
+        else if ((ss != s) && (true == cmtF) && (false == dqF) &&
+                 ('/' == *ss) && ('*' == *(ss-1))) {
+            cmtF = false;               // end comment part
+            continue;
+        }
+        bool storeF = false;            // store flag off
+        if (true == dqF) {              // string part ?
+            storeF = true;              // store flag on
+        }
+        else if ((false == cmtF) && (0 == isspace(*ss))) { // is not space code
+            storeF = true;              // store flag on
+        }
+        if (true == storeF) {           // is flag on ?
+            *dd = *ss;                  // code copy
+            dd++;                       // pointer up
+            *dd='\0';                   // Stop code insert
+            dsz++;                      // store string size count
+        }
+    }
+    return dsz;
+}
+
+/**
+ * @brief CicoBlockParser::jsonParse
+ * @param objectname
+ * @return true:parse success false:parse fail
+ */
+bool CicoBlockParser::jsonParse(const char* objectname)
+{
+    std::string tmpstr("{");
+    tmpstr += m_parts;
+    tmpstr += std::string("}");
+    size_t sz = tmpstr.size();
+    m_jsonTmp = new char[sz+1];
+    strcpy(m_jsonTmp, tmpstr.c_str());
+    char* start = m_jsonTmp;
+    char* end = m_jsonTmp + sz;
+    m_err = picojson::parse(m_v, start, end);
+    if (!m_err.empty()) {
+        if ((char*)0 != m_jsonTmp) {
+            delete m_jsonTmp;
+            m_jsonTmp = (char*)0;
+        }
+        return false;
+    }
+    if (false == m_v.get(objectname).is<picojson::object>()) {
+        m_err = std::string("get error(");
+        m_err += std::string(objectname);
+        m_err += std::string(")");
+        if ((char*)0 != m_jsonTmp) {
+            delete m_jsonTmp;
+            m_jsonTmp = (char*)0;
+        }
+        return false;
+    }
+    return true;
+}
diff --git a/lib/misc/state-machine/CicoBlockParser.h b/lib/misc/state-machine/CicoBlockParser.h
new file mode 100644 (file)
index 0000000..f04e264
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#ifndef CICOBLOCKPARSER_H
+#define CICOBLOCKPARSER_H
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <vector>
+#include "picojson.h"
+
+/**
+ * Part head string define
+ */
+#define D_PTF1      "\"stateMachine\""
+#define D_PTS1      "\"state\""
+#define D_PTS2      "\"finalState\""
+#define D_PTS3      "\"historyState\""
+#define D_PTS4      "\"event\""
+
+
+/**
+ * Perform a block classification defined string.
+ * perform a json parse
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+/**
+ * @brief The CicoBlockParser class
+ */
+class CicoBlockParser{
+public:
+    enum E_PARTSKIND{
+        UNKNOWN = 0,                    // unknown
+        STTMAC = 1,                     // state machine
+        STT,                            // state
+        HSTT,                           // history state
+        FSTT,                           // final state
+        EV                              // event
+    };
+                CicoBlockParser();
+    virtual     ~CicoBlockParser();
+
+
+    bool        getStateMachineParts(const char* tmpstr);
+    const std::string& getError();
+    int         spaceLess(char* d, const char* s) const;
+    void*       getVoid() const;
+    void        setVoid(void* v);
+    bool        jsonParse(const char* objectname);
+    bool        isJsonParse() const;
+    void        getErrorHead(std::string& errhead, const char* strtop);
+public:
+    E_PARTSKIND m_kind;
+    std::string m_parts;
+    std::vector<CicoBlockParser*> m_childs;
+    picojson::value m_v;
+
+protected:
+    const char* getBrackets(char* tmpstr, const char* tmpend);
+
+private:
+    static std::string m_err;
+    void*       m_void;
+    char*       m_jsonTmp;
+};
+
+/**
+ * @brief get error message
+ * @return error message
+ */
+inline const std::string& CicoBlockParser::getError()
+{
+    return m_err;
+}
+
+/**
+ * @brief get void pointer
+ * @return void pointer
+ */
+inline void* CicoBlockParser::getVoid() const
+{
+    return m_void;
+}
+
+/**
+ * @brief set void pointer
+ * @param v register void pointer
+ */
+inline void CicoBlockParser::setVoid(void* v)
+{
+    m_void = v;
+}
+
+/**
+ * @brief json parse condhition
+ * @return treu:parse / false:not parse
+ */
+inline bool CicoBlockParser::isJsonParse() const
+{
+    if ((char*)0 != m_jsonTmp) {
+        return true;
+    }
+    return false;
+}
+
+#endif // CICOBLOCKPARSER_H
diff --git a/lib/misc/state-machine/CicoEvent.cpp b/lib/misc/state-machine/CicoEvent.cpp
new file mode 100644 (file)
index 0000000..ba53e9f
--- /dev/null
@@ -0,0 +1,361 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+
+#include <iostream>
+#include <sstream>
+#include <string>
+
+#include "CicoEvent.h"
+
+
+
+/**
+ * Event delivery class
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+
+
+/**
+ * @brief CicoEvent::CicoEvent
+ */
+CicoEvent::CicoEvent():
+    m_ev(0), m_tov(EEvtGCUnset), m_gcvi(0), m_gcvd(0.0), m_adVal((void*)0)
+{
+}
+
+/**
+ * @brief CicoEvent::CicoEvent
+ * @param ev event number
+ * @param adval Additional information user
+ */
+CicoEvent::CicoEvent(unsigned short ev, void* adval):
+    m_ev(ev), m_tov(EEvtGCUnset), m_gcvi(0), m_gcvd(0.0), m_adVal(adval)
+{
+}
+
+/**
+ * @brief CicoEvent::CicoEvent
+ * @param ev event number
+ * @param gcv Comparison value of guard condition
+ * @param adval Additional information user
+ */
+CicoEvent::CicoEvent(unsigned short ev, int gcv, void* adval):
+    m_ev(ev), m_tov(EEvtGCInt), m_gcvi(gcv), m_gcvd(0.0), m_adVal(adval)
+{
+}
+
+/**
+ * @brief CicoEvent::CicoEvent
+ * @param oev copy source
+ */
+CicoEvent::CicoEvent(const CicoEvent& oev)
+{
+    *this = oev;
+}
+
+/**
+ * @brief CicoEvent::CicoEvent
+ * @param ev event number
+ * @param gcv Comparison value of guard condition
+ * @param adval Additional information user
+ */
+CicoEvent::CicoEvent(unsigned short ev, double gcv, void* adval):
+    m_ev(ev), m_tov(EEvtGCDouble), m_gcvi(0), m_gcvd(gcv), m_adVal(adval)
+{
+}
+
+/**
+ * @brief CicoEvent::CicoEvent
+ * @param ev event number
+ * @param gcv Comparison value of guard condition
+ * @param adval Additional information user
+ */
+CicoEvent::CicoEvent(unsigned short ev, const std::string& gcv, void* adval):
+    m_ev(ev), m_tov(EEvtGCStr), m_gcvi(0), m_gcvd(0.0), m_gcvs(gcv), m_adVal(adval)
+{
+}
+
+/**
+ * @brief CicoEvent::~CicoEvent
+ */
+CicoEvent::~CicoEvent()
+{
+    m_adVal = (void*)0;
+}
+
+/**
+ * @brief isEventMatch
+ * @param a Comparison target A
+ * @param b Comparison target B
+ * @return true:match false:mismatch
+ */
+bool isEventMatch(const CicoEvent& a, const CicoEvent& b)
+{
+    if (a.m_ev == b.m_ev) {
+        return true;
+    }
+    return false;
+}
+
+
+/**
+ * @brief operator ==
+ * @param a Comparison target A
+ * @param b Comparison target B
+ * @return true:match false:mismatch
+ */
+bool operator==(const CicoEvent& a, const CicoEvent& b)
+{
+    if (a.m_tov == b.m_tov) {
+        if (CicoEvent::EEvtGCUnset == a.m_tov) {
+            return false;
+        }
+        else if (CicoEvent::EEvtGCInt == a.m_tov) {
+            if (a.m_gcvi == b.m_gcvi) {
+                return true;
+            }
+            return false;
+        }
+        else if (CicoEvent::EEvtGCDouble == a.m_tov) {
+            if (a.m_gcvd == b.m_gcvd) {
+                return true;
+            }
+            return false;
+        }
+        else if (CicoEvent::EEvtGCStr == a.m_tov) {
+            if (a.m_gcvs == b.m_gcvs) {
+                return true;
+            }
+            return false;
+        }
+    }
+    return false;
+}
+
+/**
+ * @brief operator !=
+ * @param a Comparison target A
+ * @param b Comparison target B
+ * @return true:mismatch false:match
+ */
+bool operator!=(const CicoEvent& a, const CicoEvent& b)
+{
+    if (a.m_tov == b.m_tov) {
+        if (CicoEvent::EEvtGCUnset == a.m_tov) {
+            return false;
+        }
+        else if (CicoEvent::EEvtGCInt == a.m_tov) {
+            if (a.m_gcvi != b.m_gcvi) {
+                return true;
+            }
+            return false;
+        }
+        else if (CicoEvent::EEvtGCDouble == a.m_tov) {
+            if (a.m_gcvd != b.m_gcvd) {
+                return true;
+            }
+            return false;
+        }
+        else if (CicoEvent::EEvtGCStr == a.m_tov) {
+            if (a.m_gcvs != b.m_gcvs) {
+                return true;
+            }
+            return false;
+        }
+    }
+    return false;
+}
+
+/**
+ * @brief operator >
+ * @param a Comparison target A
+ * @param b Comparison target B
+ * @return true:greater than false not greater than
+ */
+bool operator>(const CicoEvent& a, const CicoEvent& b)
+{
+    if (a.m_tov == b.m_tov) {
+        if (CicoEvent::EEvtGCUnset == a.m_tov) {
+            return false;
+        }
+        else if (CicoEvent::EEvtGCInt == a.m_tov) {
+            if (a.m_gcvi > b.m_gcvi) {
+                return true;
+            }
+            return false;
+        }
+        else if (CicoEvent::EEvtGCDouble == a.m_tov) {
+            if (a.m_gcvd > b.m_gcvd) {
+                return true;
+            }
+            return false;
+        }
+        else if (CicoEvent::EEvtGCStr == a.m_tov) {
+            if (a.m_gcvs > b.m_gcvs) {
+                return true;
+            }
+            return false;
+        }
+    }
+    return false;
+}
+
+/**
+ * @brief operator >=
+ * @param a Comparison target A
+ * @param b Comparison target B
+ * @return true:greater than or equal false:not greater than or equal
+ */
+bool operator>=(const CicoEvent& a, const CicoEvent& b)
+{
+    if (a.m_tov == b.m_tov) {           //
+        if (CicoEvent::EEvtGCUnset == a.m_tov) {
+            return false;
+        }
+        else if (CicoEvent::EEvtGCInt == a.m_tov) {
+            if (a.m_gcvi >= b.m_gcvi) {
+                return true;
+            }
+            return false;
+        }
+        else if (CicoEvent::EEvtGCDouble == a.m_tov) {
+            if (a.m_gcvd >= b.m_gcvd) {
+                return true;
+            }
+            return false;
+        }
+        else if (CicoEvent::EEvtGCStr == a.m_tov) {
+            if (a.m_gcvs >= b.m_gcvs) {
+                return true;
+            }
+            return false;
+        }
+    }
+    return false;
+}
+
+/**
+ * @brief operator <
+ * @param a Comparison target A
+ * @param b Comparison target B
+ * @return true:less than false:not less than
+ */
+bool operator<(const CicoEvent& a, const CicoEvent& b)
+{
+    if (a.m_tov == b.m_tov) {
+        if (CicoEvent::EEvtGCUnset == a.m_tov) {
+            return false;
+        }
+        else if (CicoEvent::EEvtGCInt == a.m_tov) {
+            if (a.m_gcvi < b.m_gcvi) {
+                return true;
+            }
+            return false;
+        }
+        else if (CicoEvent::EEvtGCDouble == a.m_tov) {
+            if (a.m_gcvd < b.m_gcvd) {
+                return true;
+            }
+            return false;
+        }
+        else if (CicoEvent::EEvtGCStr == a.m_tov) {
+            if (a.m_gcvs < b.m_gcvs) {
+                return true;
+            }
+            return false;
+        }
+    }
+    return false;
+}
+
+/**
+ * @brief operator <=
+ * @param a Comparison target A
+ * @param b Comparison target B
+ * @return true:less than or equal false:not less than or equal
+ */
+bool operator<=(const CicoEvent& a, const CicoEvent& b)
+{
+    if (a.m_tov == b.m_tov) {
+        if (CicoEvent::EEvtGCUnset == a.m_tov) {
+            return false;
+        }
+        else if (CicoEvent::EEvtGCInt == a.m_tov) {
+            if (a.m_gcvi <= b.m_gcvi) {
+                return true;
+            }
+            return false;
+        }
+        else if (CicoEvent::EEvtGCDouble == a.m_tov) {
+            if (a.m_gcvd <= b.m_gcvd) {
+                return true;
+            }
+            return false;
+        }
+        else if (CicoEvent::EEvtGCStr == a.m_tov) {
+            if (a.m_gcvs <= b.m_gcvs) {
+                return true;
+            }
+            return false;
+        }
+    }
+    return false;
+}
+
+/**
+ * @brief CicoEvent::operator =
+ * @param s copy source
+ */
+void CicoEvent::operator=(const CicoEvent& s)
+{
+    m_ev    = s.m_ev;
+    m_tov   = s.m_tov;
+    m_gcvi  = s.m_gcvi;
+    m_gcvd  = s.m_gcvd;
+    m_gcvs  = s.m_gcvs;
+    m_adVal = s.m_adVal;
+}
+
+/**
+ * @brief getLogPartF
+ * @param e edit target
+ * @param l log string output
+ */
+void getLogPartF(const CicoEvent& e, std::string& l)
+{
+    std::stringstream stm;
+    stm << "EV:{" << e.getEV() << ":";     // EV:{9999:[99/99.9/"xxx"]} image edit
+
+    switch (e.getVTG()) {
+    case CicoEvent::EEvtGCInt:
+        stm << e.getGCVi();
+        break;
+    case CicoEvent::EEvtGCDouble:
+        stm << e.getGCVd();
+        break;
+    case CicoEvent::EEvtGCStr:
+        stm << "\"" << e.getGCVs() << "\"";
+        break;
+    default:
+        break;
+    }
+    stm << "}";
+    l =  stm.str();
+}
diff --git a/lib/misc/state-machine/CicoEvent.h b/lib/misc/state-machine/CicoEvent.h
new file mode 100644 (file)
index 0000000..b4c01b4
--- /dev/null
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#ifndef CICOEVENT_H
+#define CICOEVENT_H
+
+#include <iostream>
+#include <string>
+
+
+/**
+ * Event delivery class
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+
+/**
+ * @brief The CicoEvent class
+ */
+class  CicoEvent {
+public:
+    enum E_EvType {
+        Resv    = 0,                    // 
+        Start   = 1,                    // start of state-machine
+        Stop    = 2,                    // stop of state-machine
+        History = 101,                  //
+        DetectTheEnd = 201,             //
+        User    = 1000,                 // user 
+        MaxUser = 65535                 // user max
+    };
+
+    // type of value
+    enum E_TOV {                        // Type the value of the guard condition
+        EEvtGCUnset = 0,                //  unset
+        EEvtGCInt,                      //  Integer number
+        EEvtGCDouble,                   //  Floating point
+        EEvtGCStr                       //  String
+    };
+    // Constructior
+                CicoEvent();
+                CicoEvent(unsigned short ev, void* adval = 0);
+                CicoEvent(unsigned short ev, int gcv, void* adval = 0);
+                CicoEvent(unsigned short ev, double gcv, void* adval = 0);
+                CicoEvent(unsigned short ev, const std::string& gcv,
+                          void* adval = 0);
+                CicoEvent(const CicoEvent& oev);
+
+    // destructor
+    virtual     ~CicoEvent();
+
+    unsigned short getEV() const;
+    void        setEV(unsigned short ev);
+
+    int         getGCVi() const;
+    double      getGCVd() const;
+    const std::string& getGCVs() const;
+    void        setGCV(int gcv);
+    void        setGCV(double gcv);
+    void        setGCV(const std::string& gcv);
+
+    E_TOV       getVTG() const;
+
+    void*       getAdVal() const;
+    void        setAdVal(void* adval);
+
+    friend bool isEventMatch(const CicoEvent& a, const CicoEvent& b);
+
+    friend bool operator==(const CicoEvent& a, const CicoEvent& b);
+    friend bool operator!=(const CicoEvent& a, const CicoEvent& b);
+    friend bool operator>(const CicoEvent& a, const CicoEvent& b);
+    friend bool operator>=(const CicoEvent& a, const CicoEvent& b);
+    friend bool operator<(const CicoEvent& a, const CicoEvent& b);
+    friend bool operator<=(const CicoEvent& a, const CicoEvent& b);
+
+    void operator=(const CicoEvent& s);
+
+protected:
+    unsigned short m_ev;                // event number
+    E_TOV       m_tov;                  // Type the value of the guard condition
+    int         m_gcvi;                 // store Integer number
+    double      m_gcvd;                 // store Floating point
+    std::string m_gcvs;                 // store String
+
+private:
+    void*       m_adVal;                // Additional information value
+
+};
+
+/**
+ * @brief get event number
+ * @return event number
+ */
+inline unsigned short CicoEvent::getEV() const
+{
+    return m_ev;                        // event number
+}
+
+/**
+ * @brief register event number
+ * @param ev event number
+ */
+inline void CicoEvent::setEV(unsigned short ev)
+{
+    m_ev = ev;                          // event number
+}
+
+/**
+ * @brief get Comparison value of guard condition
+ * @return Comparison value of guard condition
+ */
+inline int CicoEvent::getGCVi() const
+{
+    return m_gcvi;                      // Type the value of the guard condition
+}
+
+/**
+ * @brief get Comparison value of guard condition
+ * @return Comparison value of guard condition
+ */
+inline double CicoEvent::getGCVd() const
+{
+    return m_gcvd;                      // Type the value of the guard condition
+}
+
+/**
+ * @brief get Comparison value of guard condition
+ * @return Comparison value of guard condition
+ */
+inline const std::string& CicoEvent::getGCVs() const
+{
+    return m_gcvs;
+}
+
+/**
+ * @brief get type of guard condition value
+ * @return type of guard condition value
+ */
+inline CicoEvent::E_TOV CicoEvent::getVTG() const
+{
+    return m_tov;
+}
+
+/**
+ * @brief register Comparison value of guard condition
+ * @param gcv Comparison value of guard condition
+ */
+inline void CicoEvent::setGCV(int gcv)
+{
+    m_tov = EEvtGCInt;
+    m_gcvi = gcv;
+}
+
+/**
+ * @brief register Comparison value of guard condition
+ * @param gcv Comparison value of guard condition
+ */
+inline void CicoEvent::setGCV(double gcv)
+{
+    m_tov = EEvtGCDouble;
+    m_gcvd = gcv;
+}
+
+/**
+ * @brief register Comparison value of guard condition
+ * @param gcv Comparison value of guard condition
+ */
+inline void CicoEvent::setGCV(const std::string& gcv)
+{
+    m_tov = EEvtGCStr;
+    m_gcvs = gcv;
+}
+
+/**
+ * @brief get Additional information user
+ * @return Additional information user
+ */
+inline void* CicoEvent::getAdVal() const
+{
+    return m_adVal;
+}
+
+/**
+ * @brief register Additional information user
+ * @param adval Additional information user
+ */
+inline void CicoEvent::setAdVal(void* adval)
+{
+    m_adVal = adval;
+}
+
+#endif // CICOEVENT_H
diff --git a/lib/misc/state-machine/CicoEventInfo.cpp b/lib/misc/state-machine/CicoEventInfo.cpp
new file mode 100644 (file)
index 0000000..a4cc864
--- /dev/null
@@ -0,0 +1,610 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#include <iostream>
+#include <string>
+#include <vector>
+#include <algorithm>
+#include <sstream>
+#include "CicoEvent.h"
+#include "CicoEventInfo.h"
+#include "CicoStateCore.h"
+
+
+/**
+ * event infomation class
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+/**
+ * @brief CicoEventInfo::CicoEventInfo
+ * @param ev base event data
+ */
+CicoEventInfo::CicoEventInfo(unsigned short ev):
+    CicoEvent(ev)
+{
+    m_JGCE =  Ejnj;                     //
+    m_transition = (CicoStateCore*)0;   // Initialize the pointer value
+}
+
+/**
+ * @brief CicoEventInfo::CicoEventInfo
+ * @param ev event number
+ * @param gcstr operator kind
+ * @param value Comparison value
+ */
+CicoEventInfo::CicoEventInfo(unsigned short ev, const std::string& gcstr,
+                             int value):
+    CicoEvent(ev, value)
+{
+    m_JGCE = chgGCType(gcstr);          // string change to enum
+    m_transition = (CicoStateCore*)0;   // Initialize the pointer value
+}
+
+/**
+ * @brief CicoEventInfo::CicoEventInfo
+ * @param ev event number
+ * @param gcstr operator kind
+ * @param value Comparison value
+ */
+CicoEventInfo::CicoEventInfo(unsigned short ev, const std::string& gcstr,
+                             double value):
+    CicoEvent(ev, value)
+{
+    m_JGCE = chgGCType(gcstr);          // string change to enum
+    m_transition = (CicoStateCore*)0;   // Initialize the pointer value
+}
+
+/**
+ * @brief CicoEventInfo::CicoEventInfo
+ * @param ev event number
+ * @param gcstr operator kind
+ * @param value Comparison value
+ */
+CicoEventInfo::CicoEventInfo(unsigned short ev, const std::string& gcstr,
+                             const std::string& value):
+    CicoEvent(ev, value)
+{
+    m_JGCE = chgGCType(gcstr);          // string change to enum
+    m_transition = (CicoStateCore*)0;   // Initialize the pointer value
+}
+
+/**
+ * @brief CicoEventInfo::CicoEventInfo
+ * @param name event name
+ * @param ev event number
+ */
+CicoEventInfo::CicoEventInfo(const std::string& name, unsigned short ev):
+    CicoEvent(ev), m_name(name)
+{
+    m_JGCE =  Ejnj;
+    m_transition = (CicoStateCore*)0;   // Initialize the pointer value
+}
+
+/**
+ * @brief CicoEventInfo::CicoEventInfo
+ * @param name event name
+ * @param ev event number
+ * @param gcstr operator kind
+ * @param value Comparison value
+ */
+CicoEventInfo::CicoEventInfo(const std::string& name, unsigned short ev,
+                             const std::string& gcstr, int value):
+    CicoEvent(ev, value), m_name(name)
+{
+    m_JGCE = chgGCType(gcstr);          // string change to enum
+    m_transition = (CicoStateCore*)0;   // Initialize the pointer value
+}
+
+/**
+ * @brief CicoEventInfo::CicoEventInfo
+ * @param name event name
+ * @param ev event number
+ * @param gcstr operator kind
+ * @param value Comparison value
+ */
+CicoEventInfo::CicoEventInfo(const std::string& name, unsigned short ev,
+                             const std::string& gcstr, double value):
+    CicoEvent(ev, value), m_name(name)
+{
+    m_JGCE = chgGCType(gcstr);          // string change to enum
+    m_transition = (CicoStateCore*)0;   // Initialize the pointer value
+}
+
+/**
+ * @brief CicoEventInfo::CicoEventInfo
+ * @param name event name
+ * @param ev event number
+ * @param gcstr operator kind
+ * @param value Comparison value
+ */
+CicoEventInfo::CicoEventInfo(const std::string& name, unsigned short ev,
+                             const std::string& gcstr,
+                             const std::string& value):
+    CicoEvent(ev, value), m_name(name)
+{
+    m_JGCE = chgGCType(gcstr);          // string change to enum
+    m_transition = (CicoStateCore*)0;   // Initialize the pointer value
+}
+
+/**
+ * @brief CicoEventInfo::CicoEventInfo
+ * @param ei copy source
+ */
+CicoEventInfo::CicoEventInfo(const CicoEventInfo& ei):
+    CicoEvent()
+{
+    m_JGCE = Ejnj;
+    m_transition = (CicoStateCore*)0;   // Initialize the pointer value
+    *this = ei;
+}
+
+/**
+ * @brief CicoEventInfo::~CicoEventInfo
+ */
+CicoEventInfo::~CicoEventInfo()
+{
+    if (false == m_vEvt.empty()) {
+        m_vEvt.clear();
+    }
+    if (false == m_vJGCE.empty()) {
+        m_vJGCE.clear();
+    }
+    if (false == m_vAgc.empty()) {
+        m_vAgc.clear();
+    }
+//    m_transition = (CicoStateCore*)0;
+}
+
+/**
+ * @brief CicoEventInfo::addAndGurdCondition
+ * @param gcstr operator kind
+ * @param value Comparison value
+ * @return true:added success false:added fail
+ */
+bool CicoEventInfo::addAndGurdCondition(const std::string& gcstr, int value)
+{
+    CicoEvent e(m_ev, value);
+    E_JGCE j = chgGCType(gcstr);        // string change to enum
+    if (Ejnj == j) {
+        return false;
+    }
+    addGurdCondition(e, j, EAGC_AND);
+    return true;
+}
+
+/**
+ * @brief CicoEventInfo::addAndGurdCondition
+ * @param gcstr operator kind
+ * @param value Comparison value
+ * @return true:added success false:added fail
+ */
+bool CicoEventInfo::addAndGurdCondition(const std::string& gcstr, double value)
+{
+    CicoEvent e(m_ev, value);
+    E_JGCE j = chgGCType(gcstr);        // string change to enum
+    if (Ejnj == j) {
+        return false;
+    }
+    addGurdCondition(e, j, EAGC_AND);
+    return true;
+}
+
+/**
+ * @brief CicoEventInfo::addAndGurdCondition
+ * @param gcstr operator kind
+ * @param value Comparison value
+ * @return true:added success false:added fail
+ */
+bool CicoEventInfo::addAndGurdCondition(const std::string& gcstr,
+                                        const std::string& value)
+{
+    CicoEvent e(m_ev, value);
+    E_JGCE j = chgGCType(gcstr);        // string change to enum
+    if (Ejnj == j) {
+        return false;
+    }
+    addGurdCondition(e, j, EAGC_AND);
+    return true;
+}
+
+/**
+ * @brief CicoEventInfo::addOrGurdCondition
+ * @param gcstr operator kind
+ * @param value Comparison value
+ * @return true:added success false:added fail
+ */
+bool CicoEventInfo::addOrGurdCondition(const std::string& gcstr, int value)
+{
+    CicoEvent e(m_ev, value);
+    E_JGCE j = chgGCType(gcstr);        // string change to enum
+    if (Ejnj == j) {
+        return false;
+    }
+    addGurdCondition(e, j, EAGC_OR);
+    return true;
+}
+
+
+/**
+ * @brief CicoEventInfo::addOrGurdCondition
+ * @param gcstr operator kind
+ * @param value Comparison value
+ * @return true:added success false:added fail
+ */
+bool CicoEventInfo::addOrGurdCondition(const std::string& gcstr,
+                                       double value)
+{
+    CicoEvent e(m_ev, value);
+    E_JGCE j = chgGCType(gcstr);        // string change to enum
+    if (Ejnj == j) {
+        return false;
+    }
+    addGurdCondition(e, j, EAGC_OR);
+    return true;
+}
+
+/**
+ * @brief CicoEventInfo::addOrGurdCondition
+ * @param gcstr operator kind
+ * @param value Comparison value
+ * @return true:added success false:added fail
+ */
+bool CicoEventInfo::addOrGurdCondition(const std::string& gcstr,
+                                       const std::string& value)
+{
+    CicoEvent e(m_ev, value);
+    E_JGCE j = chgGCType(gcstr);        // string change to enum
+    if (Ejnj == j) {
+        return false;
+    }
+    addGurdCondition(e, j, EAGC_OR);
+    return true;
+}
+
+/**
+ * @brief CicoEventInfo::Judge
+ * @param ev event data
+ * @param sm compare trigger state-object
+ * @return true:event match false:event Mismatch
+ */
+bool CicoEventInfo::Judge(const CicoEvent& ev, const CicoStateCore* sm) const
+{
+    if (m_ev != ev.getEV()) {           //
+        return false;                   // event number mismatch
+    }
+    // The event number matches
+    if (Ejnj == m_JGCE) {               // Without guard condition
+        return true;                    // event match !
+    }
+    // check guard condition
+    bool bR = checkGurdCondition(m_JGCE, *((CicoEvent*)this), ev, sm); // return value
+
+    int sz = m_vEvt.size();
+    for (int i=0; i<sz; i++) {
+        bool bR2 = checkGurdCondition(m_vJGCE[i], m_vEvt[i], ev, sm);
+        E_AGC agc = m_vAgc[i];
+        if (EAGC_AND == agc) {
+            bR &= bR2;
+        }
+        else if (EAGC_OR == agc) {
+            bR |= bR2;
+        }
+        else {
+            return false;
+        }
+    }
+    return bR;
+}
+
+/**
+ * @brief CicoEventInfo::checkGurdCondition
+ * @param j operator
+ * @param base event data
+ * @param rec event data
+ * @param sm compair trigger state-object
+ * @return treu:match false:Mismatch
+ */
+bool CicoEventInfo::checkGurdCondition(E_JGCE j, const CicoEvent& base,
+                                       const CicoEvent& rec,
+                                       const CicoStateCore* sm) const
+{
+    bool bR = false;                    // return value init.
+    if ((Ein == j)||(Enot == j)) {      // Guard condition of active state object
+        const CicoStateCore* stt = (CicoStateCore*)0;
+        if (EEvtGCInt == base.getVTG()) {
+            stt = getStateF(sm, base.getGCVi());
+        }
+        else if (EEvtGCStr == base.getVTG()) {
+            stt = getStateF(sm, base.getGCVs());
+        }
+        if ((CicoStateCore*)0 == stt) {
+            return false;
+        }
+        bR = checkActive(j, *stt);
+    }
+    else {                              // Remaining comparisons
+        bR = checkCompare(j, base, rec);
+    }
+    return bR;
+}
+
+/**
+ * @brief CicoEventInfo::checkActive
+ * @param j in or not operator
+ * @param stt check target
+ * @return true:event match false:event Mismatch
+ */
+bool CicoEventInfo::checkActive(E_JGCE j, const CicoStateCore& stt) const
+{
+    if (Ein == j) {
+        if (true == stt.isActive()) {
+            return true;
+        }
+    }
+    else if (Enot == j) {
+        if (false == stt.isActive()) {
+            return true;
+        }
+    }
+    return false;
+}
+
+/**
+ * @brief CicoEventInfo::checkCompare
+ * @param j operator
+ * @param base Comparison Event
+ * @param rec Comparison Event
+ * @return true:match false:Mismatch
+ */
+bool CicoEventInfo::checkCompare(E_JGCE j, const CicoEvent& base,
+                                 const CicoEvent& rec) const
+{
+    bool bR = false;
+    switch (j) {
+    case Ejeq:                          // equal
+        if (base == rec) {
+            bR = true;
+        }
+        break;
+    case Ejne:                          // Not equal
+        if (base != rec) {
+            bR = true;
+        }
+        break;
+    case Ejgt:                          // greater than
+        if (base < rec) {
+            bR = true;
+        }
+        break;
+    case Ejge:                          // greater than or equal
+        if (base <= rec) {
+            bR = true;
+        }
+        break;
+    case Ejlt:                          // less than
+        if (base > rec) {
+            bR = true;
+        }
+        break;
+    case Ejle:                          // less than or equal
+        if (base >= rec) {
+            bR = true;
+        }
+        break;
+    default:                            // ERROR
+        break;
+    }
+    return bR;
+}
+
+/**
+ * @brief CicoEventInfo::addGurdCondition
+ * @param e Comparison Event
+ * @param j operator infomation(==/!=/>/>=/</<=/in/not)
+ * @param a and/or
+ */
+void CicoEventInfo::addGurdCondition(CicoEvent& e, E_JGCE j, E_AGC a)
+{
+    if (Ejnj == m_JGCE) {
+        E_TOV tov = e.getVTG();
+        if (EEvtGCInt == tov) {
+            setGCV(e.getGCVi());
+            m_JGCE = j;
+        }
+        else if (EEvtGCDouble == tov) {
+            setGCV(e.getGCVd());
+            m_JGCE = j;
+        }
+        else if (EEvtGCStr == tov) {
+            setGCV(e.getGCVs());
+            m_JGCE = j;
+        }
+    }
+    else {
+       m_vEvt.push_back(e);
+       m_vJGCE.push_back(j);
+       m_vAgc.push_back(a);
+    }
+}
+
+/**
+ * @brief CicoEventInfo::chgGCType
+ * @param gcstr string operator
+ * @return enum operator
+ */
+CicoEventInfo::E_JGCE CicoEventInfo::chgGCType(const std::string& gcstr) const
+{
+    if (gcstr == DEFJGCE_EQ) {          // "="
+        return Ejeq;                    // equal
+    }
+    else if (gcstr == DEFJGCE_NE) {     // "!="
+        return Ejne;                    // Not equal
+    }
+    else if (gcstr == DEFJGCE_GT) {     // "<"
+        return Ejgt;                    // greater than
+    }
+    else if (gcstr == DEFJGCE_GE) {     // "<="
+        return Ejge;                    // greater than or equal
+    }
+    else if (gcstr == DEFJGCE_GE2) {    // "=<"
+        return Ejge;                    // greater than or equal
+    }
+    else if (gcstr == DEFJGCE_LT) {     // ">"
+        return Ejlt;                    // less than
+    }
+    else if (gcstr == DEFJGCE_LE) {     // ">="
+        return Ejle;                    // less than or equal
+    }
+    else if (gcstr == DEFJGCE_LE2) {    // "=>"
+        return Ejle;                    // less than or equal
+    }
+    else {                              //
+        std::string s(gcstr);           // copy string
+        transform(s.begin(), s.end(), s.begin(), tolower); // converted to lower case
+        if (s == DEFJGCE_IN) {          // "in"
+            return Ein;                 // in active state object
+        }
+        else if (s == DEFJGCE_NOT) {    // "not"
+            return Enot;                // not active state object
+        }
+        else {
+            /*
+            * _D_ERROR
+            */
+        }
+    }
+    return Ejnj;                        // Not Judgment
+}
+
+/**
+ * @brief CicoEventInfo::operator =
+ * @param s copy source
+ */
+void CicoEventInfo::operator=(const CicoEventInfo& s)
+{
+    // CicoEvent Block
+    setEV(s.getEV());
+    E_TOV tov = s.getVTG();
+    switch (tov) {
+    case EEvtGCInt:
+        setGCV(s.getGCVi());
+        break;
+    case EEvtGCDouble:
+        setGCV(s.getGCVd());
+        break;
+    case EEvtGCStr:
+        setGCV(s.getGCVs());
+        break;
+    default:
+        break;
+    }
+
+    setAdVal(s.getAdVal());
+
+    // CicoEventInfo Block
+    m_name = s.m_name;                  // copy event name
+    m_JGCE = s.m_JGCE;                  // copy Judgment guard condition expression
+    int sz = s.m_vEvt.size();           // get vector member size
+    for (int i = 0; i < sz; i++) {      // vector menber size loop
+        m_vEvt.push_back(s.m_vEvt[i]);
+        m_vJGCE.push_back(s.m_vJGCE[i]);
+        m_vAgc.push_back(s.m_vAgc[i]);
+    }
+    m_transition = s.m_transition;      //
+}
+
+/**
+ * @brief getLogPartF
+ * @param e log target
+ * @param l store log string
+ */
+void getLogPartF(const CicoEventInfo& e, std::string& l)
+{
+    const char* opstr[] = {
+        "??",                       //       Ejnj Not Judgment
+        DEFJGCE_EQ,                     // "="   Ejeq equal
+        DEFJGCE_NE,                     // "!="  Ejne Not equal
+        DEFJGCE_LT,                     // "<"   Ejlt less than
+        DEFJGCE_LE,                     // "<="  Ejle less than or equal
+        DEFJGCE_GT,                     // ">"   Ejgt greater than
+        DEFJGCE_GE,                     // ">="  Ejge greater than or equal
+        DEFJGCE_IN,                     // "in"  Ein  in active state object
+        DEFJGCE_NOT,                    // "not" Enot not active state object
+    };
+    std::stringstream stm;
+    stm << "EI:{";
+    if (!((e.getName()).empty())) {
+        stm << "\"" << e.getName() << "\"";
+    }
+    stm << ":" << e.getEV() << ":";
+    CicoEventInfo::E_JGCE jgce = e.getGCType();
+    if (CicoEventInfo::Ejnj != jgce) {
+        stm << opstr[jgce];
+    }
+    bool bInNot = false;
+    if ((CicoEventInfo::Ein == jgce)||
+        (CicoEventInfo::Enot == jgce)) {
+        bInNot = true;
+        stm << "(";
+    }
+    switch (jgce) {
+    case CicoEvent::EEvtGCInt:
+        stm << e.getGCVi();
+        break;
+    case CicoEvent::EEvtGCDouble:
+        stm << e.getGCVd();
+        break;
+    case CicoEvent::EEvtGCStr:
+        stm << "\"" << e.getGCVs() << "\"";
+        break;
+    default:                            // CicoEvent::EEvtGCUnset
+        break;
+    }
+    if (true == bInNot) {
+        stm << ")";
+    }
+//    if (0 != e->m_vAgc.size()) {
+//        stm << ":{...}";
+//    }
+    stm << "}";
+    l = stm.str();
+}
+
+/**
+ * @brief operator ==
+ * @param a Comparison target A
+ * @param b Comparison target B
+ * @return
+ */
+bool operator==(const CicoEventInfo& a, const CicoEventInfo& b)
+{
+    if (a.getEV() == b.getEV()) {       // event No. match
+        bool anm = a.m_name.empty();
+        bool bnm = b.m_name.empty();
+        if ((true == anm) && (true == bnm)) { //
+            return true;
+        }
+        else if ((false == anm) && (false == bnm)) {
+            if (a.m_name == b.m_name) {
+                return true;
+            }
+        }
+    }
+    return false;
+}
diff --git a/lib/misc/state-machine/CicoEventInfo.h b/lib/misc/state-machine/CicoEventInfo.h
new file mode 100644 (file)
index 0000000..3b305b7
--- /dev/null
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#ifndef CICOEVENTINFO_H
+#define CICOEVENTINFO_H
+
+#include <iostream>
+#include <string>
+#include <vector>
+#include "CicoEvent.h"
+
+#ifndef CICOSTATECORE_H
+class CicoStateCore;
+#endif
+
+#ifndef CICOSTATE_H
+class CicoState;
+#endif
+
+#ifndef CICOSTATEMACHINE_H
+class CicoStateMachine;
+#endif
+
+#define DEFJGCE_EQ      "="
+#define DEFJGCE_NE      "!="
+#define DEFJGCE_LT      "<"
+#define DEFJGCE_LE2     "=<"
+#define DEFJGCE_LE      "<="
+#define DEFJGCE_GT      ">"
+#define DEFJGCE_GE2     "=>"
+#define DEFJGCE_GE      ">="
+#define DEFJGCE_IN      "in"
+#define DEFJGCE_NOT     "not"
+
+
+/**
+ * event infomation object class
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+
+/**
+ * @brief The CicoEventInfo class
+ */
+class  CicoEventInfo : public  CicoEvent
+{
+public:
+    // type of added guard condition
+    enum E_AGC {
+        EAGC_NON = 0,                   // none
+        EAGC_AND = 1,                   // AND
+        EAGC_OR                         // OR
+    };
+
+    // Judgment guard condition expression
+    enum  E_JGCE {
+        Ejnj = 0,                       // Not Judgment
+        Ejeq = 1,                       // equal
+        Ejne,                           // Not equal
+        Ejlt,                           // less than
+        Ejle,                           // less than or equal
+        Ejgt,                           // greater than
+        Ejge,                           // greater than or equal
+        Ein,                            // in active state object
+        Enot                            // not active state object
+    };
+
+    // Constructior
+                CicoEventInfo(unsigned short ev);
+                CicoEventInfo(unsigned short ev, const std::string& gcstr,
+                              int value);
+                CicoEventInfo(unsigned short ev, const std::string& gcstr,
+                              double value);
+                CicoEventInfo(unsigned short ev, const std::string& gcstr,
+                              const std::string& value);
+
+                CicoEventInfo(unsigned short ev, const std::string& gcstr,
+                              CicoState* stt);
+
+                CicoEventInfo(const std::string& name, unsigned short ev);
+                CicoEventInfo(const std::string& name, unsigned short ev,
+                              const std::string& gcstr, int value);
+                CicoEventInfo(const std::string& name, unsigned short ev,
+                              const std::string& gcstr, double value);
+                CicoEventInfo(const std::string& name, unsigned short ev,
+                              const std::string& gcstr,
+                              const std::string& value);
+                CicoEventInfo(const std::string& name, unsigned short ev,
+                              const std::string& gcstr, CicoState* stt);
+                CicoEventInfo(const CicoEventInfo& ei);
+    // destructor
+    virtual     ~CicoEventInfo();
+
+    bool        addAndGurdCondition(const std::string& gcstr, int value);
+    bool        addAndGurdCondition(const std::string& gcstr, double value);
+    bool        addAndGurdCondition(const std::string& gcstr,
+                                    const std::string& value);
+
+    bool        addOrGurdCondition(const std::string& gcstr, int value);
+    bool        addOrGurdCondition(const std::string& gcstr, double value);
+    bool        addOrGurdCondition(const std::string& gcstr,
+                                   const std::string& value);
+
+    bool        Judge(const CicoEvent& ev, const CicoStateCore* sm) const;
+
+    const std::string& getName() const;
+    void        setName(const std::string& name);
+
+    CicoStateCore*  getTransition() const;
+    void        setTransition(CicoStateCore* transition);
+
+    void operator=(const CicoEventInfo& s);
+    friend bool operator==(const CicoEventInfo& a, const CicoEventInfo& b);
+
+    E_JGCE      getGCType() const;
+
+protected:
+
+    E_JGCE      chgGCType(const std::string& gcstr) const;
+
+    bool        checkGurdCondition(E_JGCE j, const CicoEvent& base,
+                                   const CicoEvent& rec,
+                                   const CicoStateCore* sm) const;
+    bool        checkActive(E_JGCE j, const CicoStateCore& stt) const;
+    bool        checkCompare(E_JGCE j, const CicoEvent& base,
+                             const CicoEvent& rec) const;
+
+    void        addGurdCondition(CicoEvent& e, E_JGCE j, E_AGC a);
+
+    friend const CicoStateCore* getState(const CicoStateCore* s,
+                                         const int value);
+    friend const CicoStateCore* getState(const CicoStateCore* s,
+                                         const std::string& name);
+
+private:
+
+    std::string     m_name;             // event name
+    E_JGCE          m_JGCE;             // guard condition 
+    std::vector<CicoEvent> m_vEvt;      // additional guard condition
+    std::vector<E_JGCE>    m_vJGCE;     // 
+    std::vector<E_AGC>     m_vAgc;      // 
+    CicoStateCore*  m_transition;       // Transition destination
+
+};
+
+/**
+ * @brief CicoEventInfo::getName
+ * @return event identification name
+ */
+inline const std::string& CicoEventInfo::getName() const
+{
+    return m_name;
+}
+
+/**
+ * @brief CicoEventInfo::setName
+ * @      set event name
+ * @param name event identification name
+ */
+inline void CicoEventInfo::setName(const std::string& name)
+{
+    m_name = name;
+}
+
+/**
+ * @brief CicoEventInfo::getTransition
+ * @      get object destination state
+ * @return registered transition state-object pointer
+ */
+inline CicoStateCore* CicoEventInfo::getTransition() const
+{
+    return m_transition;
+}
+
+/**
+ * @brief CicoEventInfo::setTransition
+ *  @     set object destination state
+ * @param transition pointer state object
+ */
+inline void CicoEventInfo::setTransition(CicoStateCore* transition)
+{
+    m_transition = transition;
+}
+
+/**
+ * @brief CicoEventInfo::getGCType
+ * @return
+ */
+inline CicoEventInfo::E_JGCE CicoEventInfo::getGCType() const
+{
+    return m_JGCE;
+}
+
+#endif // CICOEVENTINFO_H
diff --git a/lib/misc/state-machine/CicoFinalState.cpp b/lib/misc/state-machine/CicoFinalState.cpp
new file mode 100644 (file)
index 0000000..b1ab1c1
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#include <iostream>
+#include <string>
+#include <vector>
+#include "CicoStateCore.h"
+#include "CicoFinalState.h"
+
+
+/**
+ * final state object class
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+
+/**
+ * @brief CicoFinalState::CicoFinalState
+ * @param parent parent object
+ */
+CicoFinalState::CicoFinalState(CicoState* parent):
+    CicoStateCore(EFinalState, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoFinalState::CicoFinalState
+ * @param name Identification name
+ * @param parent parent object
+ */
+CicoFinalState::CicoFinalState(const std::string& name, CicoState* parent):
+    CicoStateCore(EFinalState, name, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoFinalState::CicoFinalState
+ * @param value Identification number
+ * @param parent parent object
+ */
+CicoFinalState::CicoFinalState(int value, CicoState* parent):
+    CicoStateCore(EFinalState, value, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoFinalState::CicoFinalState
+ * @param name Identification name
+ * @param value Identification number
+ * @param parent parent object
+ */
+CicoFinalState::CicoFinalState(const std::string& name, int value,
+                               CicoState* parent):
+    CicoStateCore(EFinalState, name, value, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoFinalState::CicoFinalState
+ * @param parent parent object
+ */
+CicoFinalState::CicoFinalState(CicoStateMachine* parent):
+    CicoStateCore(EFinalState, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoFinalState::CicoFinalState
+ * @param name Identification name
+ * @param parent parent object
+ */
+CicoFinalState::CicoFinalState(const std::string& name,
+                               CicoStateMachine* parent):
+    CicoStateCore(EFinalState, name, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoFinalState::CicoFinalState
+ * @param value Identification number
+ * @param parent parent object
+ */
+CicoFinalState::CicoFinalState(int value, CicoStateMachine* parent):
+    CicoStateCore(EFinalState, value, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoFinalState::CicoFinalState
+ * @param name Identification name
+ * @param value Identification number
+ * @param parent parent object
+ */
+CicoFinalState::CicoFinalState(const std::string& name, int value,
+                               CicoStateMachine* parent):
+    CicoStateCore(EFinalState, name, value, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoFinalState::start
+ * @param ev
+ * @return
+ */
+bool CicoFinalState::start(const CicoEvent& ev, bool)
+{
+    m_activeState = true;               // activate
+    onEntry(ev);                        // entry
+    m_activeState = false;              // deactivate
+    stateEndF(m_parent, ev);
+    return true;
+}
+
+/**
+ * @brief CicoFinalState::setParent
+ * @param parent parent object
+ */
+void CicoFinalState::setParent(CicoState* parent)
+{
+    CicoStateCore::setParent((CicoStateCore*)parent);
+}
+
+/**
+ * @brief CicoFinalState::setParent
+ * @param parent parent object
+ */
+void CicoFinalState::setParent(CicoStateMachine* parent)
+{
+    CicoStateCore::setParent((CicoStateCore*)parent);
+}
diff --git a/lib/misc/state-machine/CicoFinalState.h b/lib/misc/state-machine/CicoFinalState.h
new file mode 100644 (file)
index 0000000..7b98e63
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#ifndef CICOFINALSTATE_H
+#define CICOFINALSTATE_H
+
+#include <iostream>
+#include <string>
+
+#include "CicoStateCore.h"
+
+
+#ifndef CICOSTATEMACHINE_H
+class CicoStateMachine;
+#endif
+
+#ifndef CICOSTATE_H
+class CicoState;
+#endif
+
+
+/**
+ * final state object class
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+
+/**
+ * @brief The CicoFinalState class
+ */
+class CicoFinalState :public CicoStateCore
+{
+public:
+    // Constructior
+                CicoFinalState(CicoState* parent=0);
+                CicoFinalState(const std::string& name, CicoState* parent=0);
+                CicoFinalState(int value, CicoState* parent=0);
+                CicoFinalState(const std::string& name, int value,
+                               CicoState* parent=0);
+                CicoFinalState(CicoStateMachine* parent);
+                CicoFinalState(const std::string& name,
+                               CicoStateMachine* parent);
+                CicoFinalState(int value, CicoStateMachine* parent);
+                CicoFinalState(const std::string& name, int value,
+                               CicoStateMachine* parent);
+    void        setParent(CicoState* parent);
+    void        setParent(CicoStateMachine* parent);
+
+    void        addEntryAction(CicoStateAction* action, int addval = 0);
+
+protected:
+    virtual bool start(const CicoEvent& ev, bool parent=false);
+
+private:
+
+};
+
+/**
+ * @brief CicoFinalState::addEntryAction
+ * @param action register callback action class
+ * @param addval additional value
+ */
+inline void CicoFinalState::addEntryAction(CicoStateAction* action, int addval)
+{
+    CicoStateCore::addEntryAction(action, addval);
+}
+
+#endif // CICOFINALSTATE_H
diff --git a/lib/misc/state-machine/CicoHistoryState.cpp b/lib/misc/state-machine/CicoHistoryState.cpp
new file mode 100644 (file)
index 0000000..f9ac193
--- /dev/null
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+
+#include <iostream>
+#include <string>
+#include <vector>
+#include "CicoStateCore.h"
+#include "CicoHistoryState.h"
+
+/**
+ * history state object class
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+
+/**
+ * @brief CicoHistoryState::CicoHistoryState
+ * @param parent parent object
+ */
+CicoHistoryState::CicoHistoryState(CicoState* parent):
+    CicoStateCore(EHistoryState, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoHistoryState::CicoHistoryState
+ * @param name Identification name
+ * @param parent parent object
+ */
+CicoHistoryState::CicoHistoryState(const std::string& name, CicoState* parent):
+    CicoStateCore(EHistoryState, name, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoHistoryState::CicoHistoryState
+ * @param value Identification number
+ * @param parent parent object
+ */
+CicoHistoryState::CicoHistoryState(int value, CicoState* parent):
+    CicoStateCore(EHistoryState, value, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoHistoryState::CicoHistoryState
+ * @param name Identification name
+ * @param value Identification number
+ * @param parent parent object
+ */
+CicoHistoryState::CicoHistoryState(const std::string& name, int value,
+                                   CicoState* parent):
+    CicoStateCore(EHistoryState, name, value, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoHistoryState::CicoHistoryState
+ * @param parent parent object
+ */
+CicoHistoryState::CicoHistoryState(CicoStateMachine* parent):
+    CicoStateCore(EHistoryState, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoHistoryState::CicoHistoryState
+ * @param name Identification name
+ * @param parent parent object
+ */
+CicoHistoryState::CicoHistoryState(const std::string& name,
+                                   CicoStateMachine* parent):
+    CicoStateCore(EHistoryState, name, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoHistoryState::CicoHistoryState
+ * @param value Identification number
+ * @param parent parent object
+ */
+CicoHistoryState::CicoHistoryState(int value, CicoStateMachine* parent):
+    CicoStateCore(EHistoryState, value, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoHistoryState::CicoHistoryState
+ * @param name Identification name
+ * @param value Identification number
+ * @param parent parent object
+ */
+CicoHistoryState::CicoHistoryState(const std::string& name, int value,
+                                   CicoStateMachine* parent):
+    CicoStateCore(EHistoryState, name, value, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoHistoryState::~CicoHistoryState
+ */
+CicoHistoryState::~CicoHistoryState()
+{
+    m_vDState.clear();
+    m_vHState.clear();
+}
+
+/**
+ * @brief CicoHistoryState::addDefaultState
+ * @param stts default state object
+ */
+void CicoHistoryState::addDefaultState(std::vector<CicoState*> stts)
+{
+    int sz = stts.size();
+    for (int i = 0; i < sz; i++) {
+        m_vDState.push_back(stts[i]);
+    }
+}
+
+/**
+ * @brief CicoHistoryState::addDefaultState
+ * @param stts default state object
+ */
+void CicoHistoryState::addDefaultState(CicoState* stt)
+{
+        m_vDState.push_back(stt);
+}
+
+/**
+ * @brief CicoHistoryState::holdHistory
+ */
+void CicoHistoryState::holdHistory()
+{
+    bool bR = false;
+    if ((CicoStateCore*)0 != m_parent) { // exist is parent
+        // Discard the previous history
+        m_vHState.clear();
+        std::vector<const CicoState*> t;
+        // Stores the new history
+        if (Deep == m_historyType) {    // deep history ?
+            /*
+            * Deep history
+            */
+            bR = getCurrentStateF(m_parent, t, CicoStateCore::ELvlBttm);
+        }
+        else {
+            /*
+            * Shallow history
+            */
+            bR = getCurrentStateF(m_parent, t, CicoStateCore::ELvlTop);
+        }
+        if (false == bR) {
+            /*
+            * _D_ERROR
+            */
+        }
+        else {
+            int sz = t.size();
+            for (int i = 0; i < sz; i++) {
+                m_vHState.push_back((CicoState*)t[i]);
+            }
+        }
+    }
+    else {
+        /*
+        * _D_ERROR
+        */
+    }
+}
+
+/**
+ * @brief CicoHistoryState::start
+ * @param ev trigger event data
+ * @return
+ */
+bool CicoHistoryState::start(const CicoEvent& ev, bool)
+{
+    toActivate(ev);
+
+    toDeactivate(ev);
+
+    int szH = m_vHState.size();
+    int szD = m_vDState.size();
+    if (0 != szH) {
+        for (int i = 0; i < szH; i++) {
+            CicoStateCore* t = (CicoStateCore*)m_vHState[i];
+            startF(t, ev, false);
+        }
+    }
+    else if (0 != szD) {
+        for (int i = 0; i < szD; i++) {
+            CicoStateCore* t =(CicoStateCore*)m_vDState[i];
+            startF(t, ev, true);
+        }
+    }
+    else {
+        /*
+        * _D_ERROR
+        */
+        startF(m_parent, ev, true);
+    }
+    return true;
+}
+
+/**
+ * @brief getCurrentStateF
+ * @param stt get top 
+ * @param states store active state objects area
+ * @param policy get poicy
+ * @return true:get success false:get fail
+ */
+bool getCurrentStateF(CicoStateCore* stt,
+                      std::vector<const CicoState*>& states,
+                      CicoStateCore::E_GetPolicy policy)
+{
+    return stt->getCurrentState(states, policy);
+}
+
+/**
+ * @brief CicoHistoryState::setParent
+ * @param parent parent object
+ */
+void CicoHistoryState::setParent(CicoState* parent)
+{
+    CicoStateCore::setParent((CicoStateCore*)parent);
+}
+
+/**
+ * @brief CicoHistoryState::setParent
+ * @param parent parent object
+ */
+void CicoHistoryState::setParent(CicoStateMachine* parent)
+{
+    CicoStateCore::setParent((CicoStateCore*)parent);
+}
diff --git a/lib/misc/state-machine/CicoHistoryState.h b/lib/misc/state-machine/CicoHistoryState.h
new file mode 100644 (file)
index 0000000..d11671f
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+
+#ifndef CICOHISTORYSTATE_H
+#define CICOHISTORYSTATE_H
+
+#include <iostream>
+#include <string>
+#include <vector>
+#include "CicoStateCore.h"
+
+#ifndef CICOSTATE_H
+class CicoState;
+#endif
+
+#ifndef CICOSTATEMACHINE_H
+class CicoStateMachine;
+#endif
+
+/**
+ * history state object class
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+/**
+ * @brief The CicoHistoryState class
+ */
+class  CicoHistoryState : public CicoStateCore
+{
+public:
+    // history type
+    enum E_HType {
+        Shallow = 1,                    // Shallow History
+        Deep                            // Deep History
+    };
+    // constructor
+                CicoHistoryState(CicoState* parent=0);
+                CicoHistoryState(const std::string& name, CicoState* parent=0);
+                CicoHistoryState(int value, CicoState* parent=0);
+                CicoHistoryState(const std::string& name, int value,
+                                 CicoState* parent=0);
+                CicoHistoryState(CicoStateMachine* parent);
+                CicoHistoryState(const std::string& name,
+                                 CicoStateMachine* parent);
+                CicoHistoryState(int value, CicoStateMachine* parent);
+                CicoHistoryState(const std::string& name, int value,
+                                 CicoStateMachine* parent);
+
+    // destructor
+                ~CicoHistoryState();
+
+    void        addDefaultState(std::vector<CicoState*> stts);
+    void        addDefaultState(CicoState* stt);
+
+    E_HType     getHistoryType() const;
+    void        setHistoryType(E_HType type);
+
+    void        setParent(CicoState* parent);
+    void        setParent(CicoStateMachine* parent);
+
+    void        addEntryAction(CicoStateAction* action, int addval = 0);
+
+    void        addExitAction(CicoStateAction* action, int addval = 0);
+
+protected:
+    virtual bool start(const CicoEvent& ev, bool parent=false);
+
+    virtual void holdHistory();
+
+private:
+    E_HType     m_historyType;          // history type
+    std::vector<CicoState*> m_vDState;  // store default area
+    std::vector<CicoState*> m_vHState;  // store history area
+};
+
+/**
+ * @brief CicoHistoryState::getHistoryType
+ * @return history type(Shallow or Deep)
+ */
+inline CicoHistoryState::E_HType CicoHistoryState::getHistoryType() const
+{
+    return m_historyType;
+}
+
+/**
+ * @brief CicoHistoryState::setHistoryType
+ * @      set history type
+ * @param type history type(Shallow or Deep)
+ */
+inline void CicoHistoryState::setHistoryType(E_HType type)
+{
+    m_historyType = type;
+}
+
+/**
+ * @brief CicoHistoryState::addEntryAction
+ * @param action register callback action class
+ * @param addval additional value
+ */
+inline void CicoHistoryState::addEntryAction(CicoStateAction* action, int addval)
+{
+    CicoStateCore::addEntryAction(action, addval);
+}
+
+/**
+ * @brief CicoHistoryState::addExitAction
+ * @param action register callback action class
+ * @param addval additional value
+ */
+inline void CicoHistoryState::addExitAction(CicoStateAction* action, int addval)
+{
+    CicoStateCore::addExitAction(action, addval);
+}
+
+#endif // CICOHISTORYSTATE_H
diff --git a/lib/misc/state-machine/CicoState.cpp b/lib/misc/state-machine/CicoState.cpp
new file mode 100644 (file)
index 0000000..ab6bc65
--- /dev/null
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+
+#include <iostream>
+#include <string>
+#include <vector>
+#include "CicoStateCore.h"
+#include "CicoState.h"
+
+/**
+ * State object class definition
+ * I represent the state. The state identified by the name or number
+ * Depending on the event information of the member variable, perform -
+ * the determination of the transition, the transition
+ * I used during the transition or identification number, name identification.
+ * Please be sure to set either.
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+/**
+ * @brief CicoState::CicoState
+ * @param parent parent object
+ */
+CicoState::CicoState(CicoState* parent):
+    CicoStateCore(EState, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoState::CicoState
+ * @param name Identification name
+ * @param parent parent object
+ */
+CicoState::CicoState(const std::string& name, CicoState* parent):
+    CicoStateCore(EState, name, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoState::CicoState
+ * @param value Identification number
+ * @param parent parent object
+ */
+CicoState::CicoState(int value, CicoState* parent):
+    CicoStateCore(EState, value, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoState::CicoState
+ * @param name Identification name
+ * @param value Identification number
+ * @param parent parent object
+ */
+CicoState::CicoState(const std::string& name, int value, CicoState* parent):
+    CicoStateCore(EState, name, value, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoState::CicoState
+ * @param parent parent object
+ */
+CicoState::CicoState(CicoStateMachine* parent):
+    CicoStateCore(EState, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoState::CicoState
+ * @param name Identification name
+ * @param parent parent object
+ */
+CicoState::CicoState(const std::string& name, CicoStateMachine* parent):
+    CicoStateCore(EState, name, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoState::CicoState
+ * @param value Identification number
+ * @param parent parent object
+ */
+CicoState::CicoState(int value, CicoStateMachine* parent):
+    CicoStateCore(EState, value, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoState::CicoState
+ * @param name Identification name
+ * @param value Identification number
+ * @param parentparent object
+ */
+CicoState::CicoState(const std::string& name, int value,
+                     CicoStateMachine* parent):
+    CicoStateCore(EState, name, value, (CicoStateCore*)parent)
+{
+}
+
+/**
+ * @brief CicoState::~CicoState
+ */
+CicoState::~CicoState()
+{
+}
+
+/**
+ * @brief CicoState::addState
+ * @param state child object
+ */
+void CicoState::addState(CicoState* state)
+{
+    CicoStateCore::addState((CicoStateCore*)state);
+}
+
+/**
+ * @brief CicoState::addState
+ * @param state child object
+ */
+void CicoState::addState(CicoFinalState* state)
+{
+    CicoStateCore::addState((CicoStateCore*)state);
+}
+
+/**
+ * @brief CicoState::addState
+ * @param state child object
+ */
+void CicoState::addState(CicoHistoryState* state)
+{
+    CicoStateCore::addState((CicoStateCore*)state);
+}
+
+/**
+ * @brief CicoState::addTransition
+ * @param evInf transition trigger data
+ * @param state Transition destination
+ */
+void CicoState::addTransition(const CicoEventInfo& evInf, CicoState* state)
+{
+    CicoStateCore::addTransition(evInf, (CicoStateCore*)state);
+}
+
+/**
+ * @brief CicoState::addTransition
+ * @param evInf transition trigger data
+ * @param state Transition destination
+ */
+void CicoState::addTransition(const CicoEventInfo& evInf, CicoFinalState* state)
+{
+    CicoStateCore::addTransition(evInf, (CicoStateCore*)state);
+}
+
+/**
+ * @brief CicoState::addTransition
+ * @param evInf transition trigger data
+ * @param state Transition destination
+ */
+void CicoState::addTransition(const CicoEventInfo& evInf, CicoHistoryState* state)
+{
+    CicoStateCore::addTransition(evInf, (CicoStateCore*)state);
+}
+
+/**
+ * @brief CicoState::setFinishTransition
+ * @param state Transition destination
+ */
+void CicoState::setFinishTransition(CicoState* state)
+{
+    CicoStateCore::setFinishTransition((CicoStateCore*)state);
+}
+
+/**
+ * @brief CicoState::setFinishTransition
+ * @param state
+ * @param state Transition destination
+ */
+void CicoState::setFinishTransition(CicoFinalState* state)
+{
+    CicoStateCore::setFinishTransition((CicoStateCore*)state);
+}
+
+/**
+ * @brief CicoState::setFinishTransition
+ * @param state Transition destination
+ */
+void CicoState::setFinishTransition(CicoHistoryState* state)
+{
+    CicoStateCore::setFinishTransition((CicoStateCore*)state);
+}
+
+/**
+ * @brief CicoState::addInitState
+ * @param state start position
+ */
+void CicoState::addInitState(CicoState* state)
+{
+    CicoStateCore::addInitState((CicoStateCore*)state);
+}
+
+/**
+ * @brief CicoState::addInitState
+ * @param state start position
+ */
+void CicoState::addInitState(CicoHistoryState* state)
+{
+    CicoStateCore::addInitState((CicoStateCore*)state);
+}
diff --git a/lib/misc/state-machine/CicoState.h b/lib/misc/state-machine/CicoState.h
new file mode 100644 (file)
index 0000000..6d8479f
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#ifndef CICOSTATE_H
+#define CICOSTATE_H
+
+#include <iostream>
+#include <string>
+#include <vector>
+#include "CicoStateCore.h"
+
+#ifndef CICOFINALSTATE_H
+class CicoFinalState;
+#endif
+
+#ifndef CICOHISTORYSTATE_H
+class CicoHistoryState;
+#endif
+
+#ifndef CICOSTATEMACHINE_H
+class CicoStateMachine;
+#endif
+
+/**
+ * State object class definition
+ * I represent the state. The state identified by the name or number
+ * Depending on the event information of the member variable, perform -
+ * the determination of the transition, the transition
+ * I used during the transition or identification number, name identification.
+ * Please be sure to set either.
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+/**
+ * @brief The CicoState class
+ */
+class CicoState : public CicoStateCore
+{
+public:
+    // Constructior
+                CicoState(CicoState* parent=0);
+                CicoState(const std::string& name, CicoState* parent=0);
+                CicoState(int value, CicoState* parent=0);
+                CicoState(const std::string& name, int value,
+                          CicoState* parent=0);
+                CicoState(CicoStateMachine* parent);
+                CicoState(const std::string& name, CicoStateMachine* parent);
+                CicoState(int value, CicoStateMachine* parent);
+                CicoState(const std::string& name, int value,
+                          CicoStateMachine* parent);
+    // destructor
+    virtual     ~CicoState();
+
+    // registration of child
+    void        addState(CicoState* state);
+    void        addState(CicoFinalState* state);
+    void        addState(CicoHistoryState* state);
+
+    // registration of event and transition
+    void        addTransition(const CicoEventInfo& evInf, CicoState* state);
+    void        addTransition(const CicoEventInfo& evInf,
+                              CicoFinalState* state);
+    void        addTransition(const CicoEventInfo& evInf,
+                              CicoHistoryState* state);
+
+    // registration of finish transition
+    void        setFinishTransition(CicoState* state);
+    void        setFinishTransition(CicoFinalState* state);
+    void        setFinishTransition(CicoHistoryState* state);
+
+    // registration of start position
+    void        addInitState(CicoState* state);
+    void        addInitState(CicoHistoryState* state);
+
+    bool        getCurrentState(std::vector<const CicoState*>& states,
+                                CicoStateCore::E_GetPolicy policy=CicoStateCore::ELvlBttm);
+    const CicoState* getCurrentState();
+
+
+    void        addEntryAction(CicoStateAction* action, int addval = 0);
+
+    void        addExitAction(CicoStateAction* action, int addval = 0);
+
+    void        addDoAction(CicoStateAction* action, int addval = 0);
+
+    void        setParent(CicoState* parent);
+    void        setParent(CicoStateMachine* parent);
+
+protected:
+private:
+
+};
+
+/**
+ * @brief CicoState::addEntryAction
+ * @param action register callback action class
+ * @param addval additional value
+ */
+inline void CicoState::addEntryAction(CicoStateAction* action, int addval)
+{
+    CicoStateCore::addEntryAction(action, addval);
+}
+
+/**
+ * @brief CicoState::addExitAction
+ * @param action register callback action class
+ * @param addval additional value
+ */
+inline void CicoState::addExitAction(CicoStateAction* action, int addval)
+{
+    CicoStateCore::addExitAction(action, addval);
+}
+
+/**
+ * @brief CicoState::addDoAction
+ * @param action register callback action class
+ * @param addval additional value
+ */
+inline void CicoState::addDoAction(CicoStateAction* action, int addval)
+{
+    CicoStateCore::addDoAction(action, addval);
+}
+
+/**
+ * @brief CicoState::getCurrentState
+ * @param states active state-object pointers store area
+ * @param policy get policy
+ * @return true:get success / false:get fail
+ */
+inline bool CicoState::getCurrentState(std::vector<const CicoState*>& states,
+                                       CicoStateCore::E_GetPolicy policy)
+{
+    return CicoStateCore::getCurrentState(states, policy);
+
+}
+
+/**
+ * @brief CicoState::getCurrentState
+ * @return active state-object pointer
+ */
+inline const CicoState* CicoState::getCurrentState()
+{
+    return (CicoState*)CicoStateCore::getCurrentState();
+
+}
+
+/**
+ * @brief CicoState::setParent
+ * @     set parent(state-object or stateMachine-object)
+ * @param parent state-object pointer
+ */
+inline void CicoState::setParent(CicoState* parent)
+{
+    CicoStateCore::setParent((CicoStateCore*)parent);
+}
+
+/**
+ * @brief CicoState::setParent
+ * @      set parent(state object or stateMachine object)
+ * @param parent
+ */
+inline void CicoState::setParent(CicoStateMachine* parent)
+{
+    CicoStateCore::setParent((CicoStateCore*)parent);
+}
+
+#endif // CICOSTATE_H
diff --git a/lib/misc/state-machine/CicoStateAction.cpp b/lib/misc/state-machine/CicoStateAction.cpp
new file mode 100644 (file)
index 0000000..fa315c1
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+
+#include "CicoStateAction.h"
+
+/**
+ * Base class for action execution of entry / exit / do
+ * @author m.kamoshida
+ * @version 0.1
+ */
+/**
+ * @brief CicoStateAction::CicoStateAction
+ */
+CicoStateAction::CicoStateAction()
+{
+}
+
+/**
+ * @brief CicoStateAction::onEnttry
+ * @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)
+{
+}
+
+/**
+ * @brief CicoStateAction::onEnttry
+ * @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)
+{
+}
+
+/**
+ * @brief CicoStateAction::onEnttry
+ * @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)
+{
+}
+
+
+/**
+ * @brief CicoStateAction::onExit
+ * @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::onExit(const CicoEvent&, const CicoState*, int)
+{
+}
+
+/**
+ * @brief CicoStateAction::onExit
+ * @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::onExit(const CicoEvent&, const CicoHistoryState*, int)
+{
+}
+
+
+/**
+ * @brief CicoStateAction::onDo
+ * @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::onDo(const CicoEvent&, const CicoState*, int)
+{
+}
diff --git a/lib/misc/state-machine/CicoStateAction.h b/lib/misc/state-machine/CicoStateAction.h
new file mode 100644 (file)
index 0000000..04ef4ad
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#ifndef CICOSTATEACTION_H
+#define CICOSTATEACTION_H
+
+#include "CicoEvent.h"
+
+#ifndef CICOSTATE_H
+class CicoState;
+#endif
+
+#ifndef CICOHISTORYSTATE_H
+class CicoHistoryState;
+#endif
+
+#ifndef CICOFINALSTATE_H
+class CicoFinalState;
+#endif
+
+/**
+ * Base class for action execution of entry / exit / do
+ * @author m.kamoshida
+ * @version 0.1
+ */
+/**
+ * @brief The CicoStateAction class
+ */
+class CicoStateAction
+{
+public:
+    // Constructior
+                CicoStateAction();
+
+    virtual void onEnttry(const CicoEvent& ev, const CicoState* stt,
+                          int addval);
+    virtual void onEnttry(const CicoEvent& ev, const CicoFinalState* stt,
+                          int addval);
+    virtual void onEnttry(const CicoEvent& ev, const CicoHistoryState* stt,
+                          int addval);
+
+    virtual void onExit(const CicoEvent& ev, const CicoState* stt,
+                        int addval);
+    virtual void onExit(const CicoEvent& ev, const CicoHistoryState* stt,
+                        int addval);
+
+    virtual void onDo(const CicoEvent& ev, const CicoState* stt,
+                      int addval);
+
+private:
+};
+
+#endif // CICOSTATEACTION_H
diff --git a/lib/misc/state-machine/CicoStateCore.cpp b/lib/misc/state-machine/CicoStateCore.cpp
new file mode 100644 (file)
index 0000000..51a4f6b
--- /dev/null
@@ -0,0 +1,1313 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <vector>
+#include "CicoEvent.h"
+#include "CicoEventInfo.h"
+#include "CicoStateAction.h"
+#include "CicoStateCore.h"
+#include "CicoState.h"
+#include "CicoStateInternal.h"
+
+extern bool SttMdbg;
+
+/**
+ * It is the core definition of the state transition
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+/**
+ * @brief CicoStateCore::CicoStateCore
+ * @param ts type of state-object class
+ * @param parent parent state-object
+ */
+CicoStateCore::CicoStateCore(E_TOSO ts, CicoStateCore* parent):
+    m_eType(ts)
+{
+    m_activeState      = false;
+    m_value            = 0;
+    m_parent           = (CicoStateCore*)0;
+    m_existHistoy      = false;
+    m_stateTermination = (CicoStateCore*)0;
+    // Set the parent-child relationship
+    addStateF(parent, this);
+    initTransition();
+    initStartPosition();
+    initSttAction();
+}
+
+/**
+ * @brief CicoStateCore::CicoStateCore
+ * @param ts type of state-object class
+ * @param name Identification name
+ * @param parent parent state-object
+ */
+CicoStateCore::CicoStateCore(E_TOSO ts, const std::string& name,
+                             CicoStateCore* parent):
+    m_name(name), m_eType(ts)
+{
+    m_activeState      = false;
+    m_value            = 0;
+    m_parent           = (CicoStateCore*)0;
+    m_existHistoy      = false;
+    m_stateTermination = (CicoStateCore*)0;
+    // Set the parent-child relationship
+    addStateF(parent, this);
+    initTransition();
+    initStartPosition();
+    initSttAction();
+}
+
+/**
+ * @brief CicoStateCore::CicoStateCore
+ * @param ts type of state-object class
+ * @param name Identification name
+ * @param value Identification number
+ * @param parent parent state-object
+ */
+CicoStateCore::CicoStateCore(E_TOSO ts, const std::string& name, int value,
+                             CicoStateCore* parent):
+    m_name(name), m_value(value), m_eType(ts)
+{
+    m_activeState      = false;
+    m_parent           = (CicoStateCore*)0;
+    m_existHistoy      = false;
+    m_stateTermination = (CicoStateCore*)0;
+    // Set the parent-child relationship
+    addStateF(parent, this);
+    initTransition();
+    initStartPosition();
+    initSttAction();
+}
+
+/**
+ * @brief CicoStateCore::CicoStateCore
+ * @param ts type of state-object class
+ * @param value Identification number
+ * @param parent parent state-object
+ */
+CicoStateCore::CicoStateCore(E_TOSO ts, int value, CicoStateCore* parent):
+    m_value(value),  m_eType(ts)
+{
+    m_activeState      = false;
+    m_parent           = (CicoStateCore*)0;
+    m_existHistoy      = false;
+    m_stateTermination = (CicoStateCore*)0;
+    // Set the parent-child relationship
+    addStateF(parent, this);
+    initTransition();
+    initStartPosition();
+    initSttAction();
+}
+
+/**
+ * @brief CicoStateCore::~CicoStateCore
+ */
+CicoStateCore::~CicoStateCore()
+{
+    // Release area childs state-object
+    int sz = m_childs.size();
+    for (int i = 0; i < sz; i++) {
+        delete (m_childs[i]);
+    }
+    m_childs.clear();
+    // transition area clear
+    clearTransition();
+    // start position area clear
+    clearStartPosition();
+    // entry/exit/do action are clear
+    clearSttAction();
+}
+
+/**
+ * state-object activate
+ * @param ev trigger event
+ * @return
+ */
+/**
+ * @brief CicoStateCore::start
+ * @param ev trigger event data
+ * @param parent Operation in the direction of the parent
+ * @return true:Activation success false:Activation fail
+ */
+bool CicoStateCore::start(const CicoEvent& ev, bool parent)
+{
+    if (true == m_activeState) {        // Already running state-object
+        return false;                   // do not do anything
+    }
+
+    toActivate(ev);
+
+    if (false == parent) {              // Has no parent(Avoid the initialization of the parent)
+        return true;                    // do not do anything
+    }
+
+    int sz = m_childs.size();           // 
+    if (0 == sz) {                      // 
+        return true;                    // 
+    }
+
+    // operate starting position
+    if (EPDir == m_startPosition.suk) {
+        startF(m_startPosition.u.d, ev, true);
+        return true;
+    }
+    else if (EPVec == m_startPosition.suk) {
+        // Perform a plurality of start position
+        int sz2 = m_startPosition.u.v->size();
+        for (int i = 0; i < sz2; i++) {
+            startF((*m_startPosition.u.v)[i], ev, true);
+        }
+        return true;
+    }
+
+    // Start position is not registered
+#if 0
+    {
+        std::string s;
+        getLogPartF(this, s);
+        _INFO("START POSITION IS NOT REGISTERED:%s", s.c_str());
+    }
+#endif
+    bool dup = false;                       // duplication
+    CicoStateCore* chs = (CicoStateCore*)0;
+    for (int i = 0; i < sz; i++) {
+        if (true == m_childs[i]->isHistoryState()) {
+            if ((CicoStateCore*)0 != chs) {
+                dup = true;
+            }
+            else {
+                chs = m_childs[i];
+            }
+        }
+    }
+    if (((CicoStateCore*)0 != chs) && (false == dup)) {
+        startF(chs, ev, true);
+        return true;
+    }
+    std::vector<CicoStateCore*> sto;
+    if (1 != sz) {                      // 
+        int cnt = 0;
+        getRegisteredInit(sto, cnt);
+        if (1 != cnt) {
+            {
+                std::string s;
+                getLogPartF(this, s);
+                _ERR("START POSITION IS UNKNOWN:%d:%s", cnt,s.c_str());
+            }
+            return false;
+        }
+    }
+    else {
+        sto.push_back(m_childs[0]);
+    }
+    sz = sto.size();
+    for (int i = 0; i < sz; i++) {      // 
+        startF(sto[i], ev, true);       // 
+    }
+    return true;
+}
+
+/**
+ * @brief CicoStateCore::stop
+ * @param ev trigger event data
+ * @return true:Deactivation success false:Deactivation fail
+ */
+bool CicoStateCore::stop(const CicoEvent& ev)
+{
+    if (false == m_activeState) {
+        return false;
+    }
+    toDeactivate(ev);
+    return true;
+}
+
+/**
+ * @brief CicoStateCore::setParent
+ * @param parent registration parent data
+ */
+void CicoStateCore::setParent(CicoStateCore* parent)
+{
+    m_parent = parent;
+}
+
+
+/**
+ * @brief setParentF
+ * @param stt registration target
+ * @param parent registration parent data
+ */
+void setParentF(CicoStateCore* stt, CicoStateCore* parent)
+{
+    stt->setParent(parent);
+}
+
+/**
+ * @brief CicoStateCore::setName
+ * @param name Identification name
+ */
+void CicoStateCore::setName(const std::string& name)
+{
+    m_name = name;
+}
+
+/**
+ * @brief CicoStateCore::addState
+ * @param state child registration data
+ */
+void CicoStateCore::addState(CicoStateCore* state)
+{
+    if ((CicoStateCore*)0 != state) {   // If the parameters are correct
+        m_childs.push_back(state);      // Recognized as a child
+        state->setParent(this);         // I'm a parent
+        if (true == state->isHistoryState()) { // history state object
+            m_existHistoy = true;       // flag on
+        }
+    }
+}
+
+/**
+ * @brief CicoStateCore::addTransition
+ * @param evInf event registration
+ * @param state Transition destination data
+ */
+void CicoStateCore::addTransition(const CicoEventInfo& evInf,
+                                  CicoStateCore* state)
+{
+    CicoEventInfo *ei = new CicoEventInfo(evInf); // copy object
+    ei->setTransition(state);           // Set the destination state object
+
+    if (EPUnused == m_eventInfo.suk) {  // unused
+        m_eventInfo.u.d = ei;
+        m_eventInfo.suk = EPDir;
+    }
+    else if (EPDir == m_eventInfo.suk) {
+        CicoEventInfo* tmp = m_eventInfo.u.d;
+        m_eventInfo.u.d = (CicoEventInfo*)0;
+        m_eventInfo.u.v = new std::vector<CicoEventInfo*>;
+        m_eventInfo.suk = EPVec;
+        m_eventInfo.u.v->push_back(tmp);
+        m_eventInfo.u.v->push_back(ei);
+    }
+    else if (EPVec == m_eventInfo.suk) {
+        m_eventInfo.u.v->push_back(ei);
+    }
+}
+
+/**
+ * @brief CicoStateCore::addInitState
+ * @param state start position data
+ */
+void CicoStateCore::addInitState(CicoStateCore* state)
+{
+    if (EPUnused == m_startPosition.suk) {
+        m_startPosition.u.d = state;
+        m_startPosition.suk = EPDir;
+    }
+    else if (EPDir == m_startPosition.suk) {
+        CicoStateCore* tmp = m_startPosition.u.d;
+        m_startPosition.u.d = (CicoStateCore*)0;
+
+        m_startPosition.u.v = new std::vector<CicoStateCore*>;
+        m_startPosition.u.v->push_back(tmp);
+        m_startPosition.u.v->push_back(state);
+        m_startPosition.suk = EPVec;
+    }
+    else if (EPVec == m_startPosition.suk) {
+        m_startPosition.u.v->push_back(state);
+    }
+}
+
+/**
+ * @brief CicoStateCore::setFinishTransition
+ * @param state Transition destination termination detection
+ */
+void CicoStateCore::setFinishTransition(CicoStateCore* state)
+{
+    m_stateTermination = state;
+}
+
+/**
+ * @brief CicoStateCore::addEntryAction
+ * @param action registration action
+ * @param addval registration additional value number
+ */
+void CicoStateCore::addEntryAction(CicoStateAction* action, int addval)
+{
+    if ((CicoStateAction*)0 == action) {
+        return;
+    }
+    addAction(m_entry, action, addval);
+}
+
+/**
+ * @brief CicoStateCore::addExitAction
+ * @param action registration action
+ * @param addval registration additional value number
+ */
+void CicoStateCore::addExitAction(CicoStateAction* action, int addval)
+{
+    if ((CicoStateAction*)0 == action) {
+        return;
+    }
+    addAction(m_exit, action, addval);
+}
+
+/**
+ * @brief CicoStateCore::addDoAction
+ * @param action registration action
+ * @param addval registration additional value number
+ */
+void CicoStateCore::addDoAction(CicoStateAction* action, int addval)
+{
+    if ((CicoStateAction*)0 == action) {
+        return;
+    }
+    addAction(m_do, action, addval);
+}
+
+/**
+ * @brief CicoStateCore::addAction
+ * @param ssa Registration destination
+ * @param action registration action
+ * @param addval registration additional value number
+ */
+void CicoStateCore::addAction(stSttAction& ssa, CicoStateAction* action, int addval)
+{
+    if (EPUnused == ssa.suk) {
+        ssa.u.d.dcsa = action;
+        ssa.u.d.dav  = addval;
+        ssa.suk      = EPDir;
+    }
+    else if (EPDir == ssa.suk) {
+        CicoStateAction* tmpActn = ssa.u.d.dcsa;
+        int tmpAddval            = ssa.u.d.dav;
+        ssa.u.d.dcsa             = (CicoStateAction*)0;
+        ssa.u.d.dav              = 0;
+        ssa.u.v.vcsa  = new std::vector<CicoStateAction*>; // entry action
+        ssa.u.v.vav = new std::vector<int>; // entry action additional value
+        ssa.suk = EPVec;
+        ssa.u.v.vcsa->push_back(tmpActn);
+        ssa.u.v.vav->push_back(tmpAddval);
+        ssa.u.v.vcsa->push_back(action);
+        ssa.u.v.vav->push_back(addval);
+        
+    }
+    else if (EPVec == ssa.suk) {
+        ssa.u.v.vcsa->push_back(action);
+        ssa.u.v.vav->push_back(addval);
+    }
+}
+
+/**
+ * @brief CicoStateCore::toActivate
+ * @param ev Trigger event data
+ */
+void CicoStateCore::toActivate(const CicoEvent& ev)
+{
+
+    if (true == m_activeState) {
+        return;
+    }
+
+    if ((CicoStateCore*)0 != m_parent) {
+        toActivateF(m_parent, ev);
+    }
+
+    m_activeState = true;               // activate
+
+    onEntry(ev);                        // entry
+    if (SttMdbg) {
+        std::string sl;
+        getLogPartF(this, sl);
+        std::string el;
+        getLogPartF(ev, el);
+        _DBG("%s.toActivate(%s)", sl.c_str(), el.c_str());
+    }
+}
+
+/**
+ * @brief toActivateF
+ * @param stt Activate target
+ * @param ev Trigger event data
+ */
+void toActivateF(CicoStateCore* stt, const CicoEvent& ev)
+{
+    if (stt) {
+        stt->toActivate(ev);
+    }
+}
+
+/**
+ * @brief CicoStateCore::toDeactivate
+ * @param ev Trigger event data
+ */
+void CicoStateCore::toDeactivate(const CicoEvent& ev)
+{
+    if (false == m_activeState) {
+        return;
+    }
+    int sz = m_childs.size();
+    for (int i = 0; i < sz; i++) {
+        toDeactivateF(m_childs[i], ev);
+    }
+    onExit(ev);                         // exit
+    m_activeState = false;              // not active
+    if (SttMdbg) {
+        std::string sl;
+        getLogPartF(this, sl);
+        std::string el;
+        getLogPartF(ev, el);
+        _DBG("%s.toDeactivate(%s)", sl.c_str(), el.c_str());
+    }
+}
+
+/**
+ * @brief toDeactivateF
+ * @param stt Deactivate target
+ * @param ev Trigger event data
+ */
+void toDeactivateF(CicoStateCore* stt, const CicoEvent& ev)
+{
+    if (stt) {
+        stt->toDeactivate(ev);
+    }
+}
+
+
+/**
+ * @brief CicoStateCore::onEntry
+ * @param ev Trigger event data
+ */
+void CicoStateCore::onEntry(const CicoEvent& ev)
+{
+    if (EPDir == m_entry.suk) {
+        onEntryRun(m_entry.u.d.dcsa, ev, m_entry.u.d.dav);
+    }
+    else if (EPVec == m_entry.suk) {
+        int sz = m_entry.u.v.vcsa->size();
+        for (int i = 0; i < sz; i++) {
+            onEntryRun((*m_entry.u.v.vcsa)[i], ev, (*m_entry.u.v.vav)[i]);
+        }
+    }
+}
+
+/**
+ * @brief CicoStateCore::onEntryRun
+ * @param run target object
+ * @param ev Trigger event data
+ * @param val additional value number
+ */
+void CicoStateCore::onEntryRun(CicoStateAction* run, const CicoEvent& ev,
+                               int val)
+{
+    if (run) {
+        if (true == isState()) {
+            run->onEnttry(ev, (CicoState*)this, val);
+        }
+        else if (true == isFinalState()) {
+            run->onEnttry(ev, (CicoFinalState*)this, val);
+        }
+        else if (true == isHistoryState()) {
+            run->onEnttry(ev, (CicoHistoryState*)this, val);
+        }
+    }
+}
+
+/**
+ * @brief CicoStateCore::onExit
+ * @param ev Trigger event data
+ */
+void CicoStateCore::onExit(const CicoEvent& ev)
+{
+    if (EPDir == m_exit.suk) {
+        onExitRun(m_exit.u.d.dcsa, ev, m_exit.u.d.dav);
+    }
+    else if (EPVec == m_exit.suk) {
+        int sz = m_exit.u.v.vcsa->size();
+        for (int i = 0; i < sz; i++) {
+            onExitRun((*m_exit.u.v.vcsa)[i], ev, (*m_exit.u.v.vav)[i]);
+        }
+    }
+}
+
+/**
+ * @brief CicoStateCore::onExitRun
+ * @param run target object
+ * @param ev Trigger event data
+ * @param val additional value number
+ */
+void CicoStateCore::onExitRun(CicoStateAction* run, const CicoEvent& ev,
+                               int val)
+{
+    if (run) {
+        if (true == isState()) {
+            run->onExit(ev, (CicoState*)this, val);
+        }
+        else if (true == isHistoryState()) {
+            run->onExit(ev, (CicoHistoryState*)this, val);
+        }
+    }
+}
+
+/**
+ * @brief CicoStateCore::onDo
+ * @param ev Trigger event data
+ */
+void CicoStateCore::onDo(const CicoEvent& ev)
+{
+    if (EPDir == m_do.suk) {
+        onDoRun(m_do.u.d.dcsa, ev, m_do.u.d.dav);
+    }
+    else if (EPVec == m_do.suk) {
+        int sz = m_do.u.v.vcsa->size();
+        for (int i = 0; i < sz; i++) {
+            onDoRun((*m_do.u.v.vcsa)[i], ev, (*m_do.u.v.vav)[i]);
+        }
+    }
+}
+
+/**
+ * @brief CicoStateCore::onDoRun
+ * @param run target object
+ * @param ev Trigger event data
+ * @param val additional value number
+ */
+void CicoStateCore::onDoRun(CicoStateAction* run, const CicoEvent& ev, int val)
+{
+    if (run) {
+        if (true == isState()) {
+            run->onDo(ev, (CicoState*)this, val);
+        }
+    }
+}
+
+/**
+ * @brief CicoStateCore::getActiveSonar
+ * @param stt store objects
+ * @param impact store impact data
+ * @return true:get success fail:get fail
+ */
+bool CicoStateCore::getActiveSonar(std::vector<CicoState*>& stt,
+                                   std::vector<E_ActiveImpact>& impact)
+{
+    if (false == m_activeState) {
+        return false;
+    }
+    stt.push_back((CicoState*)this);
+    impact.push_back(Single);
+    int szbk = impact.size();
+
+    bool bR = getActiveSonarChild(stt,  impact);
+    if (true==bR) {
+        impact[ szbk-1 ] = Follower;    // Single -> Follower
+    }
+    return true;
+}
+
+/**
+ * @brief CicoStateCore::getActiveSonarChild
+ * @param stt store objects
+ * @param impact store impact data
+ * @return true:get success fail:get fail
+ */
+bool CicoStateCore::getActiveSonarChild(std::vector<CicoState*>& stt,
+                                        std::vector<E_ActiveImpact>& impact)
+{
+    bool bR = false;
+    int sz = m_childs.size();
+    for (int i = 0; i < sz; i++) {
+        bR |= (m_childs[i])->getActiveSonar(stt, impact);
+    }
+    return bR;
+}
+
+/**
+ * @brief CicoStateCore::eventTest
+ * @param ev event data
+ * @param sm my state-machine object
+ * @return true:Transition occurs false:The transition has not occurred
+ */
+const CicoEventInfo* CicoStateCore::eventTest(const CicoEvent& ev,
+                                              const CicoStateCore* sm) const
+{
+    const CicoEventInfo* r = (CicoEventInfo*)0;
+    if (EPDir == m_eventInfo.suk) {
+        if (true == m_eventInfo.u.d->Judge(ev, sm)) {
+            r = m_eventInfo.u.d;
+        }
+    }
+    else if (EPVec == m_eventInfo.suk) {
+        int sz = m_eventInfo.u.v->size();
+        for (int i = 0; i < sz; i++) {
+            const CicoEventInfo* t = (*m_eventInfo.u.v)[i];
+            if (true == t->Judge(ev, sm)) { // event match?
+                r = t;
+                break;                  // break of for i<sz
+            }
+        }
+    }
+    return r;
+}
+
+/**
+ * @brief eventTestF
+ * @param stt event test target
+ * @param ev event data
+ * @param sm stt state-machine object
+ * @return true:Transition occurs false:The transition has not occurred
+ */
+const CicoEventInfo* eventTestF(const CicoStateCore* stt,
+                                const CicoEvent& ev,
+                                const CicoStateCore* sm)
+{
+    if (stt) {
+        return stt->eventTest(ev, sm);
+    }
+    return (CicoEventInfo*)0;
+}
+
+/**
+ * @brief addStateF
+ * @param parent parent state-object
+ * @param state child state-object
+ */
+void addStateF(CicoStateCore* parent, CicoStateCore* state)
+{
+    if (parent) {
+        parent->addState(state);
+    }
+}
+
+/**
+ * @brief CicoStateCore::holdHistory
+ */
+void CicoStateCore::holdHistory()
+{
+    if (false == m_existHistoy) {       // have historyState under
+        return;                         // no have is return
+    }
+    // Ihave history state-object  Stores a history
+    int sz = m_childs.size();          // get child count
+    for (int i = 0; i < sz; i++) {     // 
+        CicoStateCore* t = (m_childs[i]); //
+        if (true == t->isHistoryState()) { // is historyState-object?
+            holdHistoryF(t);
+        }
+    }
+}
+
+/**
+ * @brief holdHistoryF
+ * @param s target state-object
+ */
+void holdHistoryF(CicoStateCore* s)
+{
+    if (s) {
+        s->holdHistory();
+    }
+}
+
+/**
+ * @brief CicoStateCore::getCurrentState
+ * @param states store active state-object data area
+ * @param policy get policy
+ * @return true:get success false:get fail
+ */
+bool CicoStateCore::getCurrentState(std::vector<const CicoState*>& states,
+                                    E_GetPolicy policy)
+{
+
+    bool bR = false;
+
+    if (ELvlTop == policy) {            // 
+        int sz = m_childs.size();
+        for (int i = 0; i < sz; i++) {
+            CicoStateCore* t = m_childs[i];
+            if (true == t->isActive()) { // active ?
+                bR = true;
+                states.push_back((CicoState*)t);
+            }
+        }
+    }
+    else {
+        std::vector<CicoState*> stt;
+        std::vector<E_ActiveImpact> impact;
+        if (true == getActiveSonarChild(stt, impact)) {
+            if (ELvlAll == policy) {    //
+                int sz = impact.size(); //
+                for (int i = 0; i < sz; i++) {
+                    states.push_back(stt[i]);
+                }
+                bR = true;
+            }
+            else {
+                int sz = impact.size(); //
+                for (int i = 0; i < sz; i++) {
+                    if (Single == impact[i]) {
+                        bR = true;
+                        states.push_back(stt[i]);
+                    }
+                }
+            }
+        }
+    }
+    return bR;
+}
+
+/**
+ * @brief CicoStateCore::getCurrentState
+ * @return not 0:active state-object 0:not have active state-object
+ */
+const CicoState* CicoStateCore::getCurrentState()
+{
+    CicoState* r = (CicoState*)0;
+    int sz = m_childs.size();
+    for (int i = 0; i < sz; i++) {      //
+        CicoStateCore* t = m_childs[i];
+        if (true == t->isActive()) {    // active ?
+            r = (CicoState*)t;          //
+            break;                      // break of for i
+        }
+    }
+    return r;
+}
+
+/**
+ * @brief CicoStateCore::isRegisteredInit
+ * @return true:have start position  false:not have start position
+ */
+bool CicoStateCore::isRegisteredInit() const
+{
+    if (EPUnused == m_startPosition.suk) {
+        return false;
+    }
+    return true;
+}
+
+/**
+ * @brief CicoStateCore::getRegisteredInit
+ * @param stt store start position objects
+ * @param cnt store count
+ */
+void CicoStateCore::getRegisteredInit(std::vector<CicoStateCore*>& stt,
+                                      int& cnt)
+{
+    // operate starting position
+    if (EPDir == m_startPosition.suk) {
+        stt.push_back(m_startPosition.u.d);
+        cnt++;
+    }
+    else if (EPVec == m_startPosition.suk) {
+        // Perform a plurality of start position
+        int sz = m_startPosition.u.v->size();
+        for (int i = 0; i < sz; i++) {
+            stt.push_back((*m_startPosition.u.v)[i]);
+        }
+        cnt++;
+    }
+    int sz = m_childs.size();           //
+    for (int i = 0; i < sz; i++) {      //
+        m_childs[i]->getRegisteredInit(stt, cnt);
+    }
+}
+
+/**
+ * @brief CicoStateCore::stateEnd
+ * @param ev trigger event
+ */
+void CicoStateCore::stateEnd(const CicoEvent& ev)
+{
+    int sz = m_childs.size();
+    bool b = false;
+    for (int i = 0; i < sz; i++) {
+        if (true == (m_childs[i])->isActive()) {
+            b = true;
+            break;                      // break of for i
+        }
+    }
+    if (true == b) {
+        return;
+    }
+    if ((CicoStateCore*)0 != m_stateTermination) {
+        CicoEventInfo ei("DetectTheEnd", CicoEvent::DetectTheEnd);
+        onTransition(ev, this, m_stateTermination);
+        return;
+    }
+    stop(ev);
+    stateEndF(m_parent, ev);
+}
+
+/**
+ * @brief stateEndF
+ * @param stt target objects
+ * @param ev trigger event
+ */
+void stateEndF(CicoStateCore* stt, const CicoEvent& ev)
+{
+    if (stt) {
+        stt->stateEnd(ev);
+    }
+}
+
+/**
+ * @brief CicoStateCore::onTransition
+ * @param ev trigger event
+ * @param s Transition source
+ * @param d Transition destination
+ */
+void CicoStateCore::onTransition(const CicoEvent& ev, CicoStateCore* s, CicoStateCore* d)
+{
+    std::vector<CicoStateCore*> stpstt;
+    stpstt.push_back(s);
+
+    std::vector<CicoStateCore*> rts;
+    getRoots(s, rts);
+    int szs = rts.size();
+    if (0!=szs) {
+        std::vector<CicoStateCore*> rtd;
+        getRoots(d, rtd);
+        int szd = rtd.size();
+        for (int i = 0; i < szs; i++) {
+            for (int j = 0; j < szd; j++) {
+                if (rts[i] == rtd[j]) {
+                    rts[i] = (CicoStateCore*)0;
+                    break;              // break of for j
+                }
+            }
+            if ((CicoStateCore*)0==rts[i]) {
+                break;                  // break of for i
+            }
+        }
+        for (int i = 0; i < szs; i++) {
+            if ((CicoStateCore*)0==rts[i]) {
+                break;                  // break of for i
+            }
+            stpstt.push_back(rts[i]);
+        }
+    }
+    int sz = stpstt.size();
+    // store history
+    for (int i = 0; i < sz; i++) {
+        holdHistoryF(stpstt[i]);
+    }
+    // stop Transition source
+    for (int i = 0; i < sz; i++) {
+        (stpstt[i])->stop(ev);
+    }
+    // start Transition destination
+    startF(d, ev, true);
+    {
+        std::string sl;
+        getLogPartF(s, sl);
+        std::string el;
+        getLogPartF(ev, el);
+        std::string dl;
+        getLogPartF(d, dl);
+        _INFO("TRANSITION:%s-%s->%s", sl.c_str(), el.c_str(), dl.c_str());
+    }
+}
+
+/**
+ * @brief CicoStateCore::getRoots
+ * @param stt base object
+ * @param roots store roots object
+ */
+void CicoStateCore::getRoots(const CicoStateCore* stt,
+                             std::vector<CicoStateCore*>& roots)
+{
+    const CicoStateCore* p = stt->getParent();
+    while ((CicoStateCore*)0 != p) {
+        if (true == p->isStateMachine()) { // stateMachine class Object
+            break;                      // breack of while
+        }
+        roots.push_back((CicoStateCore*)p); // set parent
+        p = p->getParent();             // get parent
+    }
+}
+
+/**
+ * @brief CicoStateCore::onDoExec
+ * @param ev triger event
+ * @return true:execute false:not execute
+ */
+bool CicoStateCore::onDoExec(const CicoEvent& ev)
+{
+    bool bR = false;
+    if (EPUnused != m_do.suk) {
+        onDo(ev);
+        bR = true;
+        {
+            std::string sl;
+            getLogPartF(this, sl);
+            std::string el;
+            getLogPartF(ev, el);
+            _INFO("%s.onDoExec(%s).onDo", sl.c_str(), el.c_str());
+        }
+    }
+    else if (EPUnused != m_entry.suk) {
+        onEntry(ev);
+        bR = true;
+        {
+            std::string sl;
+            getLogPartF(this, sl);
+            std::string el;
+            getLogPartF(ev, el);
+            _INFO("%s.onDoExec(%s).onEntry", sl.c_str(), el.c_str());
+        }
+    }
+    return bR;
+}
+
+/**
+ * @brief onDoExecF
+ * @param s target objects
+ * @param ev trigger event
+ * @return true:execute false:not execute
+ */
+bool onDoExecF(CicoStateCore* s, const CicoEvent& ev)
+{
+    if (s) {
+        return s->onDoExec(ev);
+    }
+    return false;
+}
+
+/**
+ * @brief CicoStateCore::getState
+ * @param value Identification number
+ * @return not 0:machi Identification number object
+ *@        0:not find
+ */
+const CicoStateCore* CicoStateCore::getState(const int value) const
+{
+    if (m_value == value) {
+        return this;
+    }
+    int sz = m_childs.size();
+    if (0 != sz) {
+        for (int i = 0; i < sz; i++) {
+            const CicoStateCore* r;
+            r = getStateF(m_childs[i], value);
+            if ((CicoStateCore*)0 != r) {
+                return r;
+            }
+        }
+    }
+    return (CicoStateCore*)0;
+}
+
+/**
+ * @brief CicoStateCore::getObjects
+ * @param obj store object area
+ */
+void CicoStateCore::getObjects(std::vector<CicoStateCore*>& obj)
+{
+    obj.push_back(this);                // store my state-object pointer
+    int sz = m_childs.size();
+    for (int i=0; i<sz; i++) {
+        m_childs[i]->getObjects(obj);   // store childs state-object pointer
+    }
+}
+
+/**
+ * @brief CicoStateCore::getEventInfo
+ * @param name event name
+ * @param ev event number
+ * @return not 0:machi event object  0:not find
+ */
+const CicoEventInfo* CicoStateCore::getEventInfo(const std::string& name,
+                                                 unsigned short ev) const
+{
+    const CicoEventInfo tei(name, ev);
+    const CicoEventInfo* r = (CicoEventInfo*)0;
+    if (EPDir == m_eventInfo.suk) {
+        if (tei == *m_eventInfo.u.d) {
+            r = m_eventInfo.u.d;
+        }
+    }
+    else if (EPVec == m_eventInfo.suk) {
+        int sz = m_eventInfo.u.v->size();
+        for (int i =0; i < sz; i++) {
+            const CicoEventInfo* t = (*m_eventInfo.u.v)[i];
+            if (tei == *t) {
+                r = t;
+                break;                  // break of for i<sz
+            }
+        }
+    }
+    return (CicoEventInfo*)r;           // not find
+}
+
+/**
+ * @brief getStateF
+ * @param s search object top
+ * @param value find Identification number
+ * @return not 0:match object 0:not find
+ */
+const CicoStateCore* getStateF(const CicoStateCore* s, const int value)
+{
+    if (s) {
+        return s->CicoStateCore::getState(value);
+    }
+    return (CicoStateCore*)0;
+}
+
+/**
+ * @brief CicoStateCore::getState
+ * @param name find Identification name
+ * @return not 0:match object 0:not find
+ */
+const CicoStateCore* CicoStateCore::getState(const std::string& name) const
+{
+    if (m_name == name) {
+        return this;
+    }
+    int sz = m_childs.size();
+    if (0 != sz) {
+        for (int i = 0; i < sz; i++) {
+            const CicoStateCore* r;
+            r = getStateF(m_childs[i], name);
+            if ((CicoStateCore*)0 != r) {
+                return r;
+            }
+        }
+    }
+    return (CicoStateCore*)0;
+}
+
+/**
+ * @brief getStateF
+ * @param s search object top
+ * @param name find Identification name
+ * @return not 0:match object 0:not find
+ */
+const CicoStateCore* getStateF(const CicoStateCore* s, const std::string& name)
+{
+    if (s) {
+        return s->CicoStateCore::getState(name);
+    }
+    return (CicoStateCore*)0;
+}
+
+/**
+ * @brief startF
+ * @param s start target object
+ * @param e trigger event data
+ * @param parent Operation in the direction of the parent
+ * @return true:Activation success false:Activation fail
+ */
+bool startF(CicoStateCore* s, const CicoEvent& e, bool parent)
+{
+    bool bR = false;
+    if (s) {
+        bR = s->start(e, parent);
+    }
+    return bR;
+}
+
+/**
+ * @brief getLogPartF
+ * @param s log target
+ * @param l store message area
+ */
+void getLogPartF(const CicoStateCore* s, std::string& l)
+{
+    std::stringstream stm;
+    switch (s->m_eType) {               // type my class
+    case CicoStateCore::EStateMachine:
+        stm << "SM:{";                  // SM:{"name":999} image edit
+        break;
+    case CicoStateCore::EState:
+        stm << "S:{";                   // S:{"name":999} image edit
+        break;
+    case CicoStateCore::EHistoryState:
+        stm << "HS:{";                  // HS:{"name":999} image edit
+        break;
+    case CicoStateCore::EFinalState:
+        stm << "FS:{";                  // FS:{"name":999} image edit
+        break;
+    default:
+        stm << "??:{";                  // ??:{"name":999} image edit
+        break;
+    }
+    if (!s->getName().empty()) {
+        stm << "\"" << s->getName() << "\"";
+    }
+    stm << ":" << s->getValue() << "}";
+    l = stm.str();
+}
+
+/**
+ * @brief CicoStateCore::initTransition
+ */
+void CicoStateCore::initTransition()
+{
+    m_eventInfo.suk = EPUnused;         // unused
+    // pointer clear
+    m_eventInfo.u.d = (CicoEventInfo*)0;
+    m_eventInfo.u.v = (std::vector<CicoEventInfo*>*)0;
+}
+
+/**
+ * @brief CicoStateCore::initStartPosition
+ */
+void CicoStateCore::initStartPosition()
+{
+    m_startPosition.suk = EPUnused;     // unused
+    // pointer clear
+    m_startPosition.u.d = (CicoStateCore*)0;
+    m_startPosition.u.v = (std::vector<CicoStateCore*>*)0;
+}
+
+/**
+ * @brief CicoStateCore::initSttAction
+ */
+void CicoStateCore::initSttAction()
+{
+    // entry action
+    m_entry.suk      = EPUnused;        // unused
+    // entry action pointer clear
+    m_entry.u.d.dcsa = (CicoStateAction*)0;
+    m_entry.u.d.dav  = 0;
+    m_entry.u.v.vcsa = (std::vector<CicoStateAction*>*)0;
+    m_entry.u.v.vav  = (std::vector<int>*)0;
+
+    // exit action
+    m_exit.suk       = EPUnused;        // unused
+    // exit action pointer clear
+    m_exit.u.d.dcsa  = (CicoStateAction*)0;
+    m_exit.u.d.dav   = 0;
+    m_exit.u.v.vcsa  = (std::vector<CicoStateAction*>*)0;
+    m_exit.u.v.vav   = (std::vector<int>*)0;
+
+    // do action
+    m_do.suk         = EPUnused;        // unused
+    // do action pointer clear
+    m_do.u.d.dcsa    = (CicoStateAction*)0;
+    m_do.u.d.dav     = 0;
+    m_do.u.v.vcsa    = (std::vector<CicoStateAction*>*)0;
+    m_do.u.v.vav     = (std::vector<int>*)0;
+}
+
+/**
+ * @brief CicoStateCore::clearTransition
+ */
+void CicoStateCore::clearTransition()
+{
+    if (EPVec == m_eventInfo.suk) {
+        if ((std::vector<CicoEventInfo*>*)0 != m_eventInfo.u.v) {
+            int sz = m_eventInfo.u.v->size();
+            for (int i = 0; i < sz; i++) {
+                delete (*m_eventInfo.u.v)[i];
+            }
+            m_eventInfo.u.v->clear();   // vector entry data clear
+            delete m_eventInfo.u.v;
+            m_eventInfo.u.v = (std::vector<CicoEventInfo*>*)0;
+        }
+    }
+    else if (EPDir == m_eventInfo.suk) {
+        delete m_eventInfo.u.d;
+        m_eventInfo.u.d = (CicoEventInfo*)0;
+    }
+    m_eventInfo.suk = EPUnused;         // unused
+}
+
+/**
+ * @brief CicoStateCore::clearStartPosition
+ */
+void CicoStateCore::clearStartPosition()
+{
+    if (EPVec == m_startPosition.suk) {
+        if ((std::vector<CicoStateCore*>*)0 != m_startPosition.u.v) {
+            m_startPosition.u.v->clear();
+            delete m_startPosition.u.v;
+            m_startPosition.u.v = (std::vector<CicoStateCore*>*)0;
+        }
+    }
+    else if (EPDir == m_startPosition.suk) {
+        m_startPosition.u.d = (CicoStateCore*)0;
+    }
+    m_startPosition.suk = EPUnused;     // unused
+}
+
+/**
+ * @brief CicoStateCore::clearSttAction
+ */
+void CicoStateCore::clearSttAction()
+{
+    // entry action
+    if (EPVec == m_entry.suk) {
+        if ((std::vector<CicoStateAction*>*)0 != m_entry.u.v.vcsa) {
+            m_entry.u.v.vcsa->clear();
+            delete m_entry.u.v.vcsa;
+            m_entry.u.v.vcsa = (std::vector<CicoStateAction*>*)0;
+        }
+        if ((std::vector<int>*)0 != m_entry.u.v.vav) {
+            m_entry.u.v.vav->clear();
+            delete m_entry.u.v.vav;
+            m_entry.u.v.vav  = (std::vector<int>*)0;
+        }
+    }
+    else if (EPDir == m_entry.suk) {
+        m_entry.u.d.dcsa = (CicoStateAction*)0;
+        m_entry.u.d.dav  = 0;
+    }
+    m_entry.suk      = EPUnused;        // unused
+
+    // exit action
+    if (EPVec == m_exit.suk) {
+        if ((std::vector<CicoStateAction*>*)0 != m_exit.u.v.vcsa) {
+            m_exit.u.v.vcsa->clear();
+            delete m_exit.u.v.vcsa;
+            m_exit.u.v.vcsa = (std::vector<CicoStateAction*>*)0;
+        }
+        if ((std::vector<int>*)0 != m_exit.u.v.vav) {
+            m_exit.u.v.vav->clear();
+            delete m_exit.u.v.vav;
+            m_exit.u.v.vav  = (std::vector<int>*)0;
+        }
+    }
+    else if (EPDir == m_exit.suk) {
+        m_exit.u.d.dcsa = (CicoStateAction*)0;
+        m_exit.u.d.dav  = 0;
+    }
+    m_exit.suk       = EPUnused;        // unused
+
+    // do action
+    if (EPVec == m_do.suk) {
+        if ((std::vector<CicoStateAction*>*)0 != m_do.u.v.vcsa) {
+            m_do.u.v.vcsa->clear();
+            delete m_do.u.v.vcsa;
+            m_do.u.v.vcsa = (std::vector<CicoStateAction*>*)0;
+        }
+        if ((std::vector<int>*)0 != m_do.u.v.vav) {
+            m_do.u.v.vav->clear();
+            delete m_do.u.v.vav;
+            m_do.u.v.vav  = (std::vector<int>*)0;
+        }
+    }
+    else if (EPDir == m_do.suk) {
+        m_do.u.d.dcsa = (CicoStateAction*)0;
+        m_do.u.d.dav  = 0;
+    }
+    m_do.suk         = EPUnused;        // unused
+}
diff --git a/lib/misc/state-machine/CicoStateCore.h b/lib/misc/state-machine/CicoStateCore.h
new file mode 100644 (file)
index 0000000..8cbbe9a
--- /dev/null
@@ -0,0 +1,434 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#ifndef CICOSTATECORE_H
+#define CICOSTATECORE_H
+
+#include <iostream>
+#include <string>
+#include <vector>
+#include "CicoEvent.h"
+
+#ifndef CICOEVENTINFO_H
+class CicoEventInfo;
+#endif
+
+#ifndef CICOSTATE_H
+class CicoState;
+#endif
+
+#ifndef CICOSTATEACTION_H
+class CicoStateAction;
+#endif
+
+#ifndef CICOSTATEMACHINE_H
+class CicoStateMachine;
+#endif
+
+#ifndef CICOSTAEACTION_H
+class CicoStateAction;
+#endif
+
+#ifndef CICOHISTORYSTATE_H
+class CicoHistoryState;
+#endif
+
+
+/**
+ * It is the core definition of the state transition
+ * @author m.kamoshida
+ * @version 0.1
+ */
+/**
+ * @brief The CicoStateCore class
+ */
+class CicoStateCore {
+public:
+    // Type of state object
+    enum E_TOSO {
+        EStateMachine = 0,              // kind of stateMachine object
+        EState,                         // kind of state object
+        EHistoryState,                  // kind of history state object
+        EFinalState                     // kind of final state 0bject
+    };
+
+    enum E_GetPolicy {                  // get current state policy
+        ELvlTop = 0,                    //  First-degree active state
+        ELvlAll,                        //  ALL active state
+        ELvlBttm                        //  Buttom active state
+    };
+    // Constructior
+                CicoStateCore(E_TOSO ts, CicoStateCore* parent =0);
+                CicoStateCore(E_TOSO ts, const std::string& name,
+                              CicoStateCore* parent =0);
+                CicoStateCore(E_TOSO ts, const std::string& name, int value,
+                              CicoStateCore* parent =0);
+                CicoStateCore(E_TOSO ts, int value, CicoStateCore* parent =0);
+
+    // destructor
+    virtual     ~CicoStateCore();
+
+    // Identification name get/set
+    const std::string& getName() const;
+    void        setName(const std::string& name);
+
+    // Identification number get/set
+    int         getValue() const;
+    void        setValue(int value);
+
+    // get parent
+    const CicoStateCore* getParent() const;
+
+    // active/inactive get
+    bool        isActive() const;             // active state
+
+    // get object kind
+    E_TOSO      getType() const;
+    bool        isStateMachine() const;
+    bool        isState() const;
+    bool        isFinalState() const;
+    bool        isHistoryState() const;
+
+    bool        isRegisteredInit() const;
+
+    // c-wrapper I/F
+    void        getObjects(std::vector<CicoStateCore*>& obj);
+    const CicoEventInfo* getEventInfo(const std::string& name,
+                                      unsigned short ev) const;
+protected:
+    /**
+     * union kind type
+     */
+    enum E_SttUnionKind {
+        EPUnused = 0,                   // unused
+        EPDir,                          // pointer direct
+        EPVec                           // pointer vector
+    };
+
+    /**
+     * event infomation define
+     */
+    typedef struct {
+        E_SttUnionKind                  suk;
+        union {
+            CicoEventInfo*               d; // direct pointer
+            std::vector<CicoEventInfo*>* v; // vecter pointers
+        } u;
+    } stEventInfo;
+
+    /**
+     * start position define
+     */
+    typedef struct {
+        E_SttUnionKind                  suk; // union kind
+        union {
+            CicoStateCore*               d; // direct pointer
+            std::vector<CicoStateCore*>* v; // vector pointers
+        } u;
+    } stStartPosition;
+
+    /**
+     * StateAction define
+     */
+    typedef struct {
+        CicoStateAction*                dcsa; // direct pointer
+        int                             dav;  // additional value
+    } stDirSttAction;
+
+    typedef struct {
+        std::vector<CicoStateAction*>*  vcsa; // vector pointers
+        std::vector<int>*               vav;  // vector additional values
+    } stVecSttAction;
+
+    typedef struct {
+        E_SttUnionKind                  suk; // union kind
+        union {
+            stDirSttAction              d;   // direct data
+            stVecSttAction              v;   // vector datas
+        } u;
+    } stSttAction;
+
+    // my area operations
+    void        initTransition();
+    void        initStartPosition();
+    void        initSttAction();
+
+    void        clearTransition();
+    void        clearStartPosition();
+    void        clearSttAction();
+
+
+
+    void        setParent(CicoStateCore* parent);
+    friend void setParentF(CicoStateCore* stt, CicoStateCore* parent);
+
+
+    void        addState(CicoStateCore* state);
+    friend void addStateF(CicoStateCore* parent, CicoStateCore* state);
+
+
+    void        setFinishTransition(CicoStateCore* state);
+
+
+    void        addTransition(const CicoEventInfo& evInf,
+                              CicoStateCore* state);
+
+
+    void        addInitState(CicoStateCore* state);
+
+
+    void        addEntryAction(CicoStateAction* action, int addval);
+
+
+    void        addExitAction(CicoStateAction* action, int addval);
+
+
+    void        addDoAction(CicoStateAction* action, int addval);
+
+
+    void        addAction(stSttAction& ssa, CicoStateAction* action,
+                          int addval);
+
+
+    void        toActivate(const CicoEvent& ev);
+    friend void toActivateF(CicoStateCore* stt, const CicoEvent& ev);
+
+
+    void        toDeactivate(const CicoEvent& ev);
+    friend void toDeactivateF(CicoStateCore* stt, const CicoEvent& ev);
+
+
+    void        onEntry(const CicoEvent& ev);
+    void        onExit(const CicoEvent& ev);
+    void        onDo(const CicoEvent& ev);
+    void        onEntryRun(CicoStateAction* run, const CicoEvent& ev, int val);
+    void        onExitRun(CicoStateAction* run, const CicoEvent& ev, int val);
+    void        onDoRun(CicoStateAction* run, const CicoEvent& ev, int val);
+
+    enum E_ActiveImpact {
+        Single = 0,                     // is Active
+        Follower                        // is Follower active
+    };
+    // get active state-objects
+    bool        getActiveSonar(std::vector<CicoState*>& stt,
+                               std::vector<E_ActiveImpact>& impact);
+    //
+    bool        getActiveSonarChild(std::vector<CicoState*>& stt,
+                                    std::vector<E_ActiveImpact>& impact);
+
+    // 
+    const CicoEventInfo* eventTest(const CicoEvent& ev,
+                                   const CicoStateCore* sm) const;
+    // 
+    friend const CicoEventInfo* eventTestF(const CicoStateCore* stt,
+                                           const CicoEvent& ev,
+                                           const CicoStateCore* sm);
+
+    // start state-object   Activation
+    virtual bool start(const CicoEvent& ev, bool parent = true);
+    friend bool startF(CicoStateCore* s, const CicoEvent& ev, bool parent);
+
+    // stop state-object  Deactivation
+    virtual bool stop(const CicoEvent& ev);
+
+    //
+    virtual void holdHistory();         // Hold History
+    friend void holdHistoryF(CicoStateCore* s);
+
+    // 
+    bool        getCurrentState(std::vector<const CicoState*>& states,
+                                E_GetPolicy policy);
+    const CicoState* getCurrentState(); //
+    friend bool getCurrentStateF(CicoStateCore* stt,
+                                std::vector<const CicoState*>& states,
+                                E_GetPolicy policy);
+
+    void        getRegisteredInit(std::vector<CicoStateCore*>& stt, int& cnt);
+
+    //
+    void        stateEnd(const CicoEvent& ev);
+    friend void stateEndF(CicoStateCore* stt, const CicoEvent& ev);
+
+    // The transition from s to d
+    void        onTransition(const CicoEvent& ev, CicoStateCore* s, CicoStateCore* d);
+
+    //
+    void        getRoots(const CicoStateCore* stt, std::vector<CicoStateCore*>& roots);
+
+    // do action system
+    bool        onDoExec(const CicoEvent& ev);
+    friend bool onDoExecF(CicoStateCore* s, const CicoEvent& ev);
+
+    //
+    const CicoStateCore* getState(const int value) const;
+    const CicoStateCore* getState(const std::string& name) const;
+    friend const CicoStateCore* getStateF(const CicoStateCore* s,
+                                          const int value);
+    friend const CicoStateCore* getStateF(const CicoStateCore* s,
+                                          const std::string& name);
+
+    // log
+    friend void getLogPartF(const CicoStateCore* s, std::string& l);
+
+protected:
+    bool        m_activeState;
+    std::string m_name;                 // identification name
+    int         m_value;                // identification number
+    E_TOSO      m_eType;                // type my class
+    CicoStateCore* m_parent;            // parent state object
+    std::vector<CicoStateCore*> m_childs; // Child state-objects
+    bool        m_existHistoy;          // flag History holder
+    CicoStateCore* m_stateTermination;  //
+    // transition datas
+    stEventInfo m_eventInfo;
+    // start position
+    stStartPosition m_startPosition;
+    // entry action
+    stSttAction m_entry;
+    // exit action
+    stSttAction m_exit;
+    // do action
+    stSttAction m_do;
+
+private:
+
+};
+
+/**
+ * @brief CicoStateCore::getName
+ * @      get state-object identification nemae
+ * @return state-object identification name
+ */
+inline const std::string& CicoStateCore::getName() const
+{
+    return m_name;
+}
+
+/**
+ * @brief CicoStateCore::getValue
+ * @     get state-object identification number
+ * @return state-object identification number
+ */
+inline int CicoStateCore::getValue() const
+{
+    return m_value;
+}
+
+/**
+ * @brief CicoStateCore::setValue
+ * @      set state-object identification number
+ * @paran value identification number
+ */
+inline void CicoStateCore::setValue(int value)
+{
+    m_value = value;
+}
+
+/**
+ * @brief CicoStateCore::getParent
+ * @return not 0:parent state-object pointer / 0:none parent
+ */
+inline const CicoStateCore* CicoStateCore::getParent() const
+{
+    return m_parent;                    // parent state object
+}
+
+/**
+ * @brief CicoStateCore::getType
+ * @return type of state-object class
+ */
+inline CicoStateCore::E_TOSO CicoStateCore::getType() const
+{
+    return m_eType;
+}
+
+/**
+ * @brief CicoStateCore::isActive
+ * get active/notactive status
+ * @return active state true:active / false:not active
+ */
+inline bool CicoStateCore::isActive() const
+{
+    return m_activeState;
+}
+
+/**
+ * @brief CicoStateCore::isStateMachine
+ * @return true:stateMachine-object
+ * @       false:none stateMachine-object
+ */
+inline bool CicoStateCore::isStateMachine() const
+{
+    if (EStateMachine == m_eType) {
+        return true;
+    }
+    return false;
+}
+
+/**
+ * @brief CicoStateCore::isState
+ * @return true:state-object
+ * @       false:none state-object
+ */
+inline bool CicoStateCore::isState() const
+{
+    if (EState == m_eType) {
+        return true;
+    }
+    return false;
+}
+
+/**
+ * @brief CicoStateCore::isFinalState
+ * @return true:finalState-object
+ * @       false:none finaltate-object
+ */
+inline bool CicoStateCore::isFinalState() const
+{
+    if (EFinalState == m_eType) {
+        return true;
+    }
+    return false;
+}
+
+/**
+ * @brief CicoStateCore::isHistoryState
+ * @return true:historyState-object
+ * @       false:none historystate-object
+ */
+inline bool CicoStateCore::isHistoryState() const
+{
+    if (EHistoryState == m_eType) {
+        return true;
+    }
+    return false;
+}
+/**
+ * @brief getLogPartF
+ * @param e
+ * @param l
+ */
+void getLogPartF(const CicoEvent& e, std::string& l);
+
+/**
+ * @brief getLogPartF
+ * @param e
+ * @param l
+ */
+void getLogPartF(const CicoEventInfo& e, std::string& l);
+
+#endif // CICOSTATECORE_H
diff --git a/lib/misc/state-machine/CicoStateInternal.h b/lib/misc/state-machine/CicoStateInternal.h
new file mode 100644 (file)
index 0000000..2570039
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#ifndef CICOSTATEINTERNAL_H
+#define CICOSTATEINTERNAL_H
+
+/**
+ * state machine internal
+ * log define
+ *    LOG_CICO, LOG_CONSOLE,
+ */
+
+#include <cstdio>
+#include <cstdlib>
+
+#define LOG_TAG "STT_MCN"
+
+#ifdef LOG_CICO
+#   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__)
+#else // LOG_ICO
+#   ifdef LOG_CONSOLE
+
+#       define _ERR(fmt, arg...) \
+            do {fprintf(stderr, "SttM: " fmt "\n", ##arg);}while (0)
+
+#       define _INFO(fmt, arg...) \
+            do {fprintf(stdout, fmt "\n", ##arg);} while (0)
+
+#       define _DBG(fmt, arg...) \
+            do { \
+                if (getenv("SttM_DEBUG")) { \
+                fprintf(stdout, fmt "\n",##arg); \
+            }while (0)
+#   else // LOG_CONSOLE
+#       include <dlog.h>
+#       ifdef _DLOG_H_
+
+#           define _ERR(fmt, arg...) \
+                do { \
+                    fprintf(stderr, "SttM: " fmt "\n", ##arg); \
+                    LOGE(fmt, ##arg); \
+                }while (0)
+
+#           define _INFO(...) LOGI(__VA_ARGS__)
+
+#           define _DBG(...) LOGD(__VA_ARGS__)
+#       else // _DLOG_H_
+#           define _ERR(fmt, arg...)
+
+#           define _INFO(fmt, arg...)
+
+#           define _DBG(fmt, arg...)
+
+#       endif // _DLOG_H_
+#   endif // LOG_CONSOLE
+#endif // LOG_ICO
+
+#endif // CICOSTATEINTERNAL_H
diff --git a/lib/misc/state-machine/CicoStateMachine.cpp b/lib/misc/state-machine/CicoStateMachine.cpp
new file mode 100644 (file)
index 0000000..554d7ec
--- /dev/null
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#include "CicoEvent.h"
+#include "CicoEventInfo.h"
+#include "CicoStateCore.h"
+#include "CicoState.h"
+#include "CicoHistoryState.h"
+#include "CicoFinalState.h"
+#include "CicoStateMachine.h"
+#include "CicoStateInternal.h"
+
+#if 1
+bool SttMdbg = false;
+#else
+bool SttMdbg = true;
+#endif
+
+/**
+ * state-machine object class definition
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+/**
+ * @brief CicoStateMachine::CicoStateMachine
+ * @param value Identification number
+ */
+CicoStateMachine::CicoStateMachine(int value):
+    CicoStateCore(EStateMachine, value)
+{
+    m_eventExec = false;                // During event processing flag
+}
+
+/**
+ * @brief CicoStateMachine::CicoStateMachine
+ * @param name Identification name
+ * @param value Identification number
+ */
+CicoStateMachine::CicoStateMachine(const std::string& name, int value):
+    CicoStateCore(EStateMachine, name, value)
+{
+    m_eventExec = false;                // During event processing flag
+}
+
+/**
+ * @brief CicoStateMachine::eventEntry
+ * @param ev delivery of the event
+ * @return true:Transition occurs false:The transition has not occurred
+ */
+bool CicoStateMachine::eventEntry(const CicoEvent& ev)
+{
+    if (SttMdbg) {
+        std::string el;
+        getLogPartF(ev, el);
+        _DBG("CicoStateMachine::eventEntry(%s)", el.c_str());
+    }
+    if (true == m_eventExec) {          // Execution of the request will not be accepted during execution
+        if (SttMdbg) {
+            _DBG("CicoStateMachine::eventEntry() not be accepted");
+        }
+        return false;
+    }
+    m_eventExec = true;                 // During event processing flag
+
+    std::vector<CicoState*> stt;        // store active state-objects
+    std::vector<CicoStateCore::E_ActiveImpact> impact; // inpact flag area
+    if (false == getActiveSonarChild(stt, impact)) { // get active objects and flags
+                                        // get fail
+        m_eventExec = false;            // During event processing flag off
+        if (SttMdbg) {
+            _DBG("false=CicoStateMachine::eventEntry() P1");
+        }
+        return false;
+    }
+    int sz = stt.size();
+    if (0==sz) {
+        m_eventExec = false;            // During event processing flag off
+        if (SttMdbg) {
+            _DBG("false=CicoStateMachine::eventEntry() P2");
+        }
+        return false;
+    }
+    bool bR = false;
+    for (int i=0; i< sz; i++) {         // sz is get active state-objects count
+        CicoStateCore* s = (CicoStateCore*)stt[i]; // get target
+        if (false == s->isActive()) {   // inactive ?
+            continue;                   // next state-object
+        }
+        const CicoEventInfo* evi = eventTestF(s, ev, this); //
+        if ((CicoEventInfo*)0 == evi) { //
+            continue;                   // next state-objects
+        }
+        CicoStateCore* ds = evi->getTransition(); // Gets the transition destination
+        /*
+        *   ev  transition event trigger
+        *   s   transition source
+        *   evi registration event data
+        *   ds  transition destination
+        */
+        if (SttMdbg) {
+            std::string eil;
+            getLogPartF(*evi, eil);
+            _DBG("CicoStateMachine::eventEntry match %s", eil.c_str());
+        }
+        if (((CicoStateCore*)0 != ds) && (s != ds)) {
+            onTransition(ev, s, ds);    // transition request
+            bR = true;
+        }
+        else {
+            bR = onDoExecF(s, ev);
+        }
+    }
+    m_eventExec = false;                // During event processing flag off
+    if (SttMdbg) {
+        _DBG("%s=CicoStateMachine::eventEntry() P3", bR?"true":"false");
+    }
+    return bR;
+}
+
+/**
+ * @brief CicoStateMachine::eventTest
+ * @param ev delivery of the event
+ * @return true:Transition occurs false:The transition has not occurred
+ */
+bool CicoStateMachine::eventTest(const CicoEvent& ev)
+{
+    if (SttMdbg) {
+        std::string el;
+        getLogPartF(ev, el);
+        _DBG("CicoStateMachine::eventTest(%s)", el.c_str());
+    }
+    if (true == m_eventExec) {          // Execution of the request will not be accepted during execution
+        if (SttMdbg) {
+            _DBG("CicoStateMachine::eventTest() not be accepted");
+        }
+        return false;
+    }
+    std::vector<CicoState*> stt;
+    std::vector<CicoStateCore::E_ActiveImpact> impact;
+    if (false == getActiveSonarChild(stt, impact)) {
+                                        // get fail
+        if (SttMdbg) {
+            _DBG("false=CicoStateMachine::eventTest() P1");
+        }
+        return false;
+    }
+    int sz = stt.size();
+    if (0==sz) {
+        if (SttMdbg) {
+            _DBG("false=CicoStateMachine::eventTest() P2");
+        }
+        return false;
+    }
+    bool bR = false;
+    for (int i=0; i< sz; i++) {
+        CicoStateCore* s = (CicoStateCore*)stt[i];
+        if (false == s->isActive()) {
+            continue;
+        }
+        const CicoEventInfo* evi = eventTestF(s, ev, this);
+        if ((CicoEventInfo*)0 != evi) {
+            bR = true;
+            break;
+        }
+    }
+    if (SttMdbg) {
+        _DBG("%s=CicoStateMachine::() P3", bR?"true":"false");
+    }
+    return bR;
+}
+
+
+/**
+ * @brief CicoStateMachine::start
+ * @return true:start success false:start fail
+ */
+bool CicoStateMachine::start()
+{
+    CicoEvent e(CicoEvent::Start);
+    return CicoStateCore::start(e);
+}
+
+/**
+ * @brief CicoStateMachine::stop
+ * @return true:stop success false:stop fail
+ */
+bool CicoStateMachine::stop()
+{
+    CicoEvent e(CicoEvent::Stop);
+    return CicoStateCore::stop(e);
+}
diff --git a/lib/misc/state-machine/CicoStateMachine.h b/lib/misc/state-machine/CicoStateMachine.h
new file mode 100644 (file)
index 0000000..fbb9f0c
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#ifndef CICOSTATEMACHINE_H
+#define CICOSTATEMACHINE_H
+
+#include <iostream>
+#include <string>
+#include <vector>
+
+#include "CicoStateCore.h"
+
+#ifndef CICOSTATE_H
+class CicoState;
+#endif
+
+#ifndef CICOFINALSTATE_H
+class CicoFinalState;
+#endif
+
+#ifndef CICOHISTORYSTATE_H
+class CicoHistoryState;
+#endif
+
+
+/**
+ * state-machine object class definition
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+/**
+ * @brief The CicoStateMachine class
+ *   state-machine object class definition
+ */
+class CicoStateMachine : public CicoStateCore
+{
+public:
+    // Constructior
+                CicoStateMachine(int value = 0);
+                CicoStateMachine(const std::string& name, int value = 0);
+
+    // registration state/historyState/fainalState objects
+    void        addState(CicoState* state);
+    void        addState(CicoFinalState* state);
+    void        addState(CicoHistoryState* state);
+
+    // registration start position
+    void        addInitState(CicoState* state);
+    void        addInitState(CicoHistoryState* state);
+
+    // start state-machine
+    bool        start();
+
+    // Delivery of the event
+    bool        eventEntry(const CicoEvent& ev);
+    // Test event delivery
+    bool        eventTest(const CicoEvent& ev);
+
+    // stop state-machine
+    bool        stop();
+
+    // Acquisition of state-objects is registered
+    const CicoStateCore* getState(const int value) const;
+    const CicoStateCore* getState(const std::string& name) const;
+
+    // get current active state-objects
+    bool        getCurrentState(std::vector<const CicoState*>& states,
+                                CicoStateCore::E_GetPolicy policy=CicoStateCore::ELvlBttm);
+    const CicoState* getCurrentState();
+
+protected:
+private:
+    bool        m_eventExec;            // During event processing flag
+};
+
+/**
+ * @brief CicoStateMachine::addState
+ * @param state register child state-object pointer
+ */
+inline void CicoStateMachine::addState(CicoState* state)
+{
+    CicoStateCore::addState((CicoStateCore*)state);
+}
+
+/**
+ * @brief CicoStateMachine::addState
+ * @param state register child state-object pointer
+ */
+inline void CicoStateMachine::addState(CicoFinalState* state)
+{
+    CicoStateCore::addState((CicoStateCore*)state);
+}
+
+/**
+ * @brief CicoStateMachine::addState
+ * @param state register child state-object pointer
+ */
+inline void CicoStateMachine::addState(CicoHistoryState* state)
+{
+    CicoStateCore::addState((CicoStateCore*)state);
+}
+
+/**
+ * @brief CicoStateMachine::addInitState
+ * @param state
+ * @param state state-object pointer is tart position
+ */
+inline void CicoStateMachine::addInitState(CicoState* state)
+{
+    CicoStateCore::addInitState((CicoStateCore*)state);
+}
+
+/**
+ * @brief CicoStateMachine::addInitState
+ * @param state state-object pointer is tart positions
+ */
+inline void CicoStateMachine::addInitState(CicoHistoryState* state)
+{
+    CicoStateCore::addInitState((CicoStateCore*)state);
+}
+
+/**
+ * @brief CicoStateMachine::getCurrentState
+ * @param states active state-object pointers store area
+ * @param policy get policy
+ * @return true:get success / false get fail
+ */
+inline bool CicoStateMachine::getCurrentState(std::vector<const CicoState*>& states,
+                                              CicoStateCore::E_GetPolicy policy)
+{
+    return CicoStateCore::getCurrentState(states, policy);
+}
+
+/**
+ * @brief CicoStateMachine::getCurrentState
+ * @      get active state-object
+ * @return active state-object pointer
+ */
+inline const CicoState* CicoStateMachine::getCurrentState()
+{
+    return CicoStateCore::getCurrentState();
+}
+
+/**
+ * @brief CicoStateMachine::getState
+ * @param value state-object identification number
+ * @return not 0:state-object pointer/0 get fail
+ */
+inline const CicoStateCore* CicoStateMachine::getState(const int value) const
+{
+    return CicoStateCore::getState(value);
+}
+
+/**
+ * @brief CicoStateMachine::getState
+ * @param name state-object identification name
+ * @return not 0:state-object pointer/0 get fail
+ */
+inline const CicoStateCore* CicoStateMachine::getState(const std::string& name) const
+{
+    return CicoStateCore::getState(name);
+}
+
+#endif // CICOSTATEMACHINE_H
diff --git a/lib/misc/state-machine/CicoStateMachineCreator.cpp b/lib/misc/state-machine/CicoStateMachineCreator.cpp
new file mode 100644 (file)
index 0000000..f5232c3
--- /dev/null
@@ -0,0 +1,1118 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+
+#include <iostream>
+#include <string>
+#include <vector>
+#include <fstream>
+
+#include "CicoBlockParser.h"
+#include "CicoEvent.h"
+#include "CicoEventInfo.h"
+#include "CicoStateCore.h"
+#include "CicoState.h"
+#include "CicoHistoryState.h"
+#include "CicoFinalState.h"
+#include "CicoStateMachine.h"
+#include "CicoStateMachineCreator.h"
+
+#include "picojson.h"
+
+/**
+ * state-machine produce from the definition file or string
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+/**
+ * @brief CicoStateMachineCreator::createFile
+ * @      state-machine produce from the definition file
+ * @param filename state-machine definition file
+ * @return not 0: create stateMachine-object pointer
+ * @       0:create fail
+ */
+CicoStateMachine* CicoStateMachineCreator::createFile(const std::string& filename)
+{
+    m_err.clear();
+    char tmp[512];
+    std::string readtmp("");
+    std::ifstream ifs;
+    ifs.open(filename.c_str());
+    if (ifs) {
+        while (!ifs.eof()) {
+            ifs.getline(tmp, sizeof(tmp));
+            readtmp += std::string(tmp);
+        }
+        ifs.close();
+    }
+    if (!readtmp.empty()) {
+        return create(readtmp.c_str());
+    }
+    else {
+        m_err = std::string("file fail");
+    }
+    return (CicoStateMachine*)0;
+}
+
+/**
+ * @brief CicoStateMachineCreator::create
+ * @      state-machine produce from the definition string
+ * @param sttdef state-machine definition string
+ * @return not 0: create stateMachine-object pointer
+ * @       0:create fail
+ */
+CicoStateMachine* CicoStateMachineCreator::create(const char* sttdef)
+{
+    m_err.clear();
+    CicoBlockParser cbp;
+    if (false == cbp.getStateMachineParts(sttdef)) { // parse
+        m_err = cbp.getError();
+        return (CicoStateMachine*)0;
+    }
+    if (CicoBlockParser::STTMAC != cbp.m_kind) { // Failure to obtain staeMachine
+        m_err = "Failure to obtain staeMachine";
+        return (CicoStateMachine*)0;
+    }
+    CreateStateObjects(cbp);
+    CicoStateMachine* csm = (CicoStateMachine*)cbp.getVoid();
+    if (!m_err.empty()) {
+        if ((CicoStateMachine*)0 != csm) {
+            delete csm;
+        }
+        return (CicoStateMachine*)0;
+    }
+    setConnect(cbp, csm);
+    if (!m_err.empty()) {
+        if ((CicoStateMachine*)0 != csm) {
+            delete csm;
+        }
+        return (CicoStateMachine*)0;
+    }
+    return csm;
+}
+
+/**
+ * @brief CicoStateMachineCreator::CreateStateObjects
+ * @param cbp state-object json definition parts
+ * @param parent Hierarchical information
+ */
+void CicoStateMachineCreator::CreateStateObjects(CicoBlockParser& cbp, CicoStateCore* parent)
+{
+    if (CicoBlockParser::EV == cbp.m_kind) {
+        return;
+    }
+    switch (cbp.m_kind) {
+    case CicoBlockParser::STTMAC:           // stateMachine
+        CreateStateMachine(cbp);
+        break;
+    case CicoBlockParser::STT:              // state
+        CreateState(cbp, parent);
+        break;
+    case CicoBlockParser::HSTT:             // history state
+        CreateHistoryState(cbp, parent);
+        break;
+    case CicoBlockParser::FSTT:             // final state
+        CreateFinalState(cbp, parent);
+        break;
+    default:
+        break;
+    }
+    if (!m_err.empty()) {
+        return;
+    }
+    CicoStateCore* my = (CicoStateCore*)cbp.getVoid();
+    if ((CicoStateCore*)0 == my) {
+        m_err = "create error state object";
+        return;
+    }
+    int sz = cbp.m_childs.size();
+    for (int i=0; i<sz; i++) {
+        CreateStateObjects(*cbp.m_childs[i], my);
+        if (!m_err.empty()) {
+            return;
+        }
+    }
+}
+
+/**
+ * @brief CicoStateMachineCreator::CreateStateMachine
+ * @param cbp definition stateMachine-object json parts
+ */
+void CicoStateMachineCreator::CreateStateMachine(CicoBlockParser& cbp)
+{
+    if (false == cbp.isJsonParse()) {
+        if (false == cbp.jsonParse(DKstateMachine)) {
+            m_err = cbp.getError();
+            return;
+        }
+    }
+    picojson::object o = cbp.m_v.get(DKstateMachine).get<picojson::object>();
+    std::string name;
+    int value = 0;
+    bool bn = parseName(o, name);
+    bool bv = parseValueI(o, value);
+    if ((true == bn) || (true == bv)) {
+        CicoStateMachine* csm = new CicoStateMachine(name, value);
+        cbp.setVoid((void*)csm);
+    }
+    else {
+        std::ostringstream stream;
+        if (false == cbp.m_parts.empty()) {
+            std::string h;
+            cbp.getErrorHead(h, cbp.m_parts.c_str());
+            stream << "stateMachine define error:" << h;
+        }
+        else {
+            stream << "stateMachine unkown";
+        }
+        m_err = stream.str();
+    }
+}
+
+/**
+ * @brief CicoStateMachineCreator::CreateState
+ * @param cbp definition state-object json parts
+ * @param parent Hierarchical information
+ */
+void CicoStateMachineCreator::CreateState(CicoBlockParser& cbp,
+                                          CicoStateCore* parent)
+{
+    if (false == cbp.isJsonParse()) {
+        if (false == cbp.jsonParse(DKstate)) {
+            m_err = cbp.getError();
+            return;
+        }
+    }
+    picojson::object o = cbp.m_v.get(DKstate).get<picojson::object>();
+    std::string name;
+    int value = 0;
+    bool bn = parseName(o, name);
+    bool bv = parseValueI(o, value);
+    if ((true == bn) || (true == bv)) {
+        CicoState* cs = (CicoState*)0;
+        if (true == parent->isStateMachine()) {
+            cs = new CicoState(name, value, (CicoStateMachine*)parent);
+        }
+        else if (true == parent->isState()) {
+            cs = new CicoState(name, value, (CicoState*)parent);
+        }
+
+        if ((CicoState*)0 != cs) {
+            cbp.setVoid((void*)cs);
+        }
+    }
+    else {
+        std::ostringstream stream;
+        if (false == cbp.m_parts.empty()) {
+            std::string h;
+            cbp.getErrorHead(h, cbp.m_parts.c_str());
+            stream << "state define error:" << h;
+        }
+        else {
+            stream << "state unkown";
+        }
+        m_err = stream.str();
+    }
+}
+
+/**
+ * @brief CicoStateMachineCreator::CreateHistoryState
+ * @param cbp definition historyState-object json parts
+ * @param parent Hierarchical information
+ */
+void CicoStateMachineCreator::CreateHistoryState(CicoBlockParser& cbp,
+                                                 CicoStateCore* parent)
+{
+    if (false == cbp.isJsonParse()) {
+        if (false == cbp.jsonParse(DKhistoryState)) {
+            m_err = cbp.getError();
+            return;
+        }
+    }
+    std::string h;
+    if (false == cbp.m_parts.empty()) {
+        cbp.getErrorHead(h, cbp.m_parts.c_str());
+    }
+    picojson::object o = cbp.m_v.get(DKhistoryState).get<picojson::object>();
+    std::string name;
+    int value = 0;
+    bool bn = parseName(o, name);
+    bool bv = parseValueI(o, value);
+    CicoHistoryState::E_HType eht = CicoHistoryState::Shallow;
+    if (false == parseHistoryType(o,  eht)) {
+        std::ostringstream stream;
+        if (false == h.empty()) {
+            stream << "history type define error:" << h;
+        }
+        else {
+            stream << "history unkown";
+        }
+        m_err = stream.str();
+        return;
+    }
+    if ((true == bn) || (true == bv)) {
+        CicoHistoryState* chs = (CicoHistoryState*)0;
+        if (true == parent->isStateMachine()) {
+            chs = new CicoHistoryState(name, value, (CicoStateMachine*)parent);
+        }
+        else if (true == parent->isState()) {
+            chs = new CicoHistoryState(name, value, (CicoState*)parent);
+        }
+
+        if ((CicoHistoryState*)0 != chs) {
+            cbp.setVoid((void*)chs);
+            chs->setHistoryType(eht);
+        }
+    }
+    else {
+        std::ostringstream stream;
+        if (false == h.empty()) {
+            stream << "historyState define error:" << h;
+        }
+        else {
+            stream << "historyState unkown";
+        }
+        m_err = stream.str();
+        return;
+    }
+}
+
+/**
+ * @brief CicoStateMachineCreator::CreateFinalState
+ * @param cbp definition finalState-object json parts
+ * @param parent Hierarchical information
+ */
+void CicoStateMachineCreator::CreateFinalState(CicoBlockParser& cbp,
+                                               CicoStateCore* parent)
+{
+    if (false == cbp.isJsonParse()) {
+        if (false == cbp.jsonParse(DKfinalState)) {
+            m_err = cbp.getError();
+            return;
+        }
+    }
+    picojson::object o = cbp.m_v.get(DKfinalState).get<picojson::object>();
+    std::string name;
+    int value = 0;
+    bool bn = parseName(o, name);
+    bool bv = parseValueI(o, value);
+    if ((true == bn) || (true == bv)) {
+        CicoFinalState* cfs = (CicoFinalState*)0;
+        if (true == parent->isStateMachine()) {
+            cfs = new CicoFinalState(name, value, (CicoStateMachine*)parent);
+        }
+        else if (true == parent->isState()) {
+            cfs = new CicoFinalState(name, value, (CicoState*)parent);
+        }
+
+        if ((CicoFinalState*)0 != cfs) {
+            cbp.setVoid((void*)cfs);
+        }
+    }
+    else {
+        std::ostringstream stream;
+        if (false == cbp.m_parts.empty()) {
+            std::string h;
+            cbp.getErrorHead(h, cbp.m_parts.c_str());
+            stream << "finalState define error:" << h;
+        }
+        else {
+            stream << "finalState unkown";
+        }
+        m_err = stream.str();
+    }
+}
+
+/**
+ * @brief CicoStateMachineCreator::setConnect
+ *        Registration of transition information
+ * @param cbp definition json parts
+ * @param csm stateMachine object pointer
+ * @param parent Hierarchical information
+ */
+void CicoStateMachineCreator::setConnect(CicoBlockParser& cbp,
+                                         CicoStateMachine* csm,
+                                         CicoStateCore* parent)
+{
+    switch (cbp.m_kind) {
+    case CicoBlockParser::STTMAC:           // stateMachine
+        setConnectStateMachine(cbp, csm);
+        break;
+    case CicoBlockParser::STT:              // state
+        setConnectState(cbp, csm);
+        break;
+    case CicoBlockParser::HSTT:             // history state
+        setConnectHistoryState(cbp, csm);
+        break;
+    case CicoBlockParser::FSTT:             // final state
+        break;
+    case CicoBlockParser::EV:               // event
+        CreateEvent(cbp, csm, parent);
+        break;
+    default:
+        break;
+    }
+    if (!m_err.empty()) {
+        return;
+    }
+    CicoStateCore* childsParent = (CicoStateCore*)cbp.getVoid();
+    int sz = cbp.m_childs.size();
+    for (int i=0; i<sz; i++) {
+        setConnect(*cbp.m_childs[i], csm, childsParent);
+        if (!m_err.empty()) {
+            return;
+        }
+    }
+
+}
+
+/**
+ * @brief CicoStateMachineCreator::setConnectStateMachine
+ *        Acquisition and registration of the starting position
+ * @param cbp definition json parts
+ * @param csm stateMachine object pointer
+ */
+void CicoStateMachineCreator::setConnectStateMachine(CicoBlockParser& cbp,
+                                                     CicoStateMachine* csm)
+{
+    setInitial(cbp, DKstateMachine, csm);
+}
+
+/**
+ * @brief CicoStateMachineCreator::setInitial
+ *        Acquisition and registration of the starting position
+ * @param cbp definition json parts
+ * @param key json object parse key
+ * @param csm stateMachine object pointer
+
+ */
+void CicoStateMachineCreator::setInitial(CicoBlockParser& cbp, const char* key,
+                                         CicoStateMachine* csm)
+{
+    CicoStateCore* csc = (CicoStateCore*)cbp.getVoid();
+    if ((CicoStateCore*)0 == csc) {
+        m_err = std::string("have no stateCore Pointer");
+        return;
+    }
+    picojson::object o = cbp.m_v.get(key).get<picojson::object>();
+    picojson::value& vini = o[DKinitial];
+    std::vector<CicoStateCore*> vec;
+    std::string err;
+    if (false == parseStateObject(vini, vec, csm, err)) {
+        std::string tmp("initial ");
+        tmp += m_err;
+        m_err = tmp;
+        return;
+    }
+    int sz = vec.size();
+    if (0 == sz) {
+        vini = o[DKinitial2];
+        if (false == parseStateObject(vini, vec, csm, err)) {
+            std::string tmp("i ");
+            tmp += m_err;
+            m_err = tmp;
+            return;
+        }
+    }
+    sz = vec.size();
+    if (0 == sz) {
+        return;
+    }
+    for (int i = 0; i < sz; i++) {
+        addInitial(csc, vec[i]);
+    }
+}
+
+/**
+ * @brief CicoStateMachineCreator::addInitial
+ *        registration of the starting position
+ * @param tgt registration target
+ * @param dat registration position data
+ */
+void CicoStateMachineCreator::addInitial(CicoStateCore* tgt,
+                                         CicoStateCore* dat)
+{
+    CicoStateMachine* tgt1 = (CicoStateMachine*)0;
+    CicoState* tgt2 = (CicoState*)0;
+    if (tgt->isStateMachine()) {
+        tgt1 = (CicoStateMachine*)tgt;
+    }
+    else if (tgt->isState()) {
+        tgt2 = (CicoState*)tgt;
+    }
+    else {
+        m_err = std::string("target type mismatch");
+        return;
+    }
+
+    if (dat->isState()) {
+        if (tgt1) {
+            tgt1->addInitState((CicoState*)dat);
+        }
+        else if (tgt2) {
+            tgt2->addInitState((CicoState*)dat);
+        }
+    }
+    else if (dat->isHistoryState()) {
+        if (tgt1) {
+            tgt1->addInitState((CicoHistoryState*)dat);
+        }
+        else if (tgt2) {
+            tgt2->addInitState((CicoHistoryState*)dat);
+        }
+    }
+    else {
+        m_err = std::string("get pointer type mismatch");
+        return;
+    }
+}
+
+/**
+ * @brief CicoStateMachineCreator::setConnectState
+ *        Acquisition and registration of the starting position
+ *        and finish position to state-object
+ * @param cbp definition json parts
+ * @param csm stateMachine object pointer
+ */
+void CicoStateMachineCreator::setConnectState(CicoBlockParser& cbp,
+                                              CicoStateMachine* csm)
+{
+    setInitial(cbp, DKstate, csm);
+    setFinish(cbp, DKstate, csm);
+}
+
+/**
+ * @brief CicoStateMachineCreator::setFinish
+ *        Acquisition and registration of the and finish position
+ * @param cbp definition json parts
+ * @param key json parse get key
+ * @param csm stateMachine object pointer
+ */
+void CicoStateMachineCreator::setFinish(CicoBlockParser& cbp, const char* key,
+                                        CicoStateMachine* csm)
+{
+    CicoStateCore* csc = (CicoStateCore*)cbp.getVoid();
+    if ((CicoStateCore*)0 == csc) {
+        m_err = std::string("have no stateCore Pointer");
+        return;
+    }
+    if (false == csc->isState()) {
+        m_err = std::string("have no state Pointer");
+        return;
+    }
+    CicoState* tgt = (CicoState*)csc;
+    const CicoStateCore* dat = (CicoStateCore*)0;
+    picojson::object o = cbp.m_v.get(key).get<picojson::object>();
+    picojson::value& vf = o[DKfinish];
+    std::vector<CicoStateCore*> vec;
+    std::string err;
+    if (false == parseStateObject(vf, vec, csm, err)) {
+        std::string tmp("finish ");
+        tmp += err;
+        m_err = tmp;
+        return;
+    }
+    int sz = vec.size();
+    if (0 == sz) {
+        vf = o[DKfinish2];
+        if (false == parseStateObject(vf, vec, csm, err)) {
+            std::string tmp("finish ");
+            tmp += err;
+            m_err = tmp;
+            return;
+        }
+    }
+    std::string h;
+    if (false == cbp.m_parts.empty()) {
+        cbp.getErrorHead(h, cbp.m_parts.c_str());
+    }
+    sz = vec.size();
+    if (1 < sz) {
+        std::ostringstream stream;
+        if (false == h.empty()) {
+            stream << "finish is multiple:" << h;
+        }
+        else {
+            stream << "finish is multiple";
+        }
+        m_err = stream.str();
+    }
+    if (1 == sz ) {
+        dat = vec[0];
+        if (dat->isState()) {
+            tgt->setFinishTransition((CicoState*)dat);
+        }
+        else if (dat->isHistoryState()) {
+            tgt->setFinishTransition((CicoHistoryState*)dat);
+        }
+        else if (dat->isFinalState()) {
+            tgt->setFinishTransition((CicoFinalState*)dat);
+        }
+        else {
+            std::ostringstream stream;
+            if (false == h.empty()) {
+                stream << "finish is mismatch:" << h;
+            }
+            else {
+                stream << "finish is mismatch";
+            }
+            m_err = stream.str();
+        }
+    }
+}
+
+/**
+ * @brief CicoStateMachineCreator::setConnectHistoryState
+ * @param cbp definition json parts
+ * @param csm stateMachine object pointer
+ */
+void CicoStateMachineCreator::setConnectHistoryState(CicoBlockParser& cbp,
+                                                     CicoStateMachine* csm)
+{
+    CicoStateCore* csc = (CicoStateCore*)cbp.getVoid();
+    if ((CicoState*)0 == csc) {
+        m_err = std::string("have no stateCore Pointer");
+        return;
+    }
+    if (false == csc->isHistoryState()) {
+        m_err = std::string("have no historyState Pointer");
+        return;
+    }
+    CicoHistoryState* chs = (CicoHistoryState*)csc;
+    setDefault(cbp, chs, csm);
+}
+
+/**
+ * @brief CicoStateMachineCreator::setDefault
+ * @param cbp definition json parts
+ * @param chs historyState-objects
+ * @param csm stateMachine object pointer
+ */
+void CicoStateMachineCreator::setDefault(CicoBlockParser& cbp,
+                                         CicoHistoryState* chs,
+                                         CicoStateMachine* csm)
+{
+    picojson::object o = cbp.m_v.get(DKhistoryState).get<picojson::object>();
+    picojson::value& vd = o[DKdefault];
+    std::vector<CicoStateCore*> vec;
+    std::string err;
+    if (false == parseStateObject(vd, vec, csm, err)) {
+        std::string tmp("default ");
+        tmp += err;
+        m_err = tmp;
+        return;
+    }
+    int sz = vec.size();
+    if (0 == sz) {
+        vd = o[DKdefault2];
+        if (false == parseStateObject(vd, vec, csm, err)) {
+            std::string tmp("d ");
+            tmp += err;
+            m_err = tmp;
+            return;
+        }
+    }
+    sz = vec.size();
+    if (0 == sz) {
+        return;
+    }
+    for (int i = 0; i < sz; i++) {
+        addDefault(chs, vec[i]);
+    }
+}
+
+/**
+ * @brief CicoStateMachineCreator::addDefault
+ * @param chs registration target
+ * @param csc default position object
+ */
+void CicoStateMachineCreator::addDefault(CicoHistoryState* chs, CicoStateCore* csc)
+{
+    if (false == csc->isState()) {
+        m_err = std::string("have no state Pointer");
+        return;
+    }
+    chs->addDefaultState((CicoState*)csc);
+}
+
+/**
+ * @brief CicoStateMachineCreator::CreateEvent
+ *        registration of event triger and transition
+ * @param cbp definition json parts 
+ * @param csm stateMachine object pointer
+ * @param parent Hierarchical information
+ */
+void CicoStateMachineCreator::CreateEvent(CicoBlockParser& cbp,
+                                          CicoStateMachine* csm,
+                                          CicoStateCore* parent)
+{
+    if ((CicoState*)0 == parent) {
+        m_err = std::string("have no stateCore Parent");
+        return;
+    }
+    if (false == parent->isState()) {
+        m_err = std::string("no State Parent");
+        return;
+    }
+    std::string h;
+    if (false == cbp.m_parts.empty()) {
+        cbp.getErrorHead(h, cbp.m_parts.c_str());
+    }
+    if (false == cbp.isJsonParse()) {
+        if (false == cbp.jsonParse(DKevent)) {
+            m_err = cbp.getError();
+            return;
+        }
+    }
+    CicoState* cs = (CicoState*)parent;
+    picojson::object o = cbp.m_v.get(DKevent).get<picojson::object>();
+    // get name
+    std::string name;
+    parseName(o, name);
+    // get value
+    int value = 0;
+    if (false == parseValueI(o, value)) {
+        std::ostringstream stream;
+        if (false == h.empty()) {
+            stream << "value is mismatch:" << h;
+        }
+        else {
+            stream << "value is mismatch";
+        }
+        m_err = stream.str();
+        return;
+    }
+    CicoEventInfo evi(name, (unsigned short)value);
+    // tarnsition get
+    picojson::value& vd = o[DKtransition];
+    std::vector<CicoStateCore*> vec;
+    std::string err;
+    if (false == parseStateObject(vd, vec, csm, err)) {
+        std::string tmp("transition ");
+        tmp += err;
+        m_err = tmp;
+        return;
+    }
+    int sz = vec.size();
+    if (0 == sz) {
+        vd = o[DKtransition2];
+        if (false == parseStateObject(vd, vec, csm, err)) {
+            std::string tmp("t ");
+            tmp += err;
+            m_err = tmp;
+            return;
+        }
+    }
+    sz = vec.size();
+    if (1 != sz) {
+        std::ostringstream stream;
+        if (false == h.empty()) {
+            stream << "transition is mismatch:" << h;
+        }
+        else {
+            stream << "transition is mismatch";
+        }
+        m_err = stream.str();
+        return;
+    }
+    const CicoStateCore* trs = vec[0];
+    // get guard condition
+    picojson::value& vgc = o[DKguardCondition];
+    if (false == regGuardCondition(vgc, evi)) {
+        vgc = o[DKguardCondition2];
+        regGuardCondition(vgc, evi);
+    }
+    // register event infomation
+    if (trs->isState()) {
+        cs->addTransition(evi, (CicoState*)trs);
+    }
+    else if (trs->isHistoryState()) {
+        cs->addTransition(evi, (CicoHistoryState*)trs);
+    }
+    else if (trs->isFinalState()) {
+        cs->addTransition(evi, (CicoFinalState*)trs);
+    }
+    else {
+        std::ostringstream stream;
+        if (false == h.empty()) {
+            stream << "transition is mismatch:" << h;
+        }
+        else {
+            stream << "transition is mismatch";
+        }
+        m_err = stream.str();
+        return;
+    }
+}
+
+/**
+ * @brief CicoStateMachineCreator::regGuardCondition
+ * @param v json parse data
+ * @param evi registration of event target
+ * @return
+ */
+bool CicoStateMachineCreator::regGuardCondition(picojson::value& v,
+                                                CicoEventInfo& evi)
+{
+    bool r = false;
+    if (v.is<picojson::array>()) {
+        picojson::array& arry = v.get<picojson::array>();
+        for (picojson::array::const_iterator it = arry.begin();
+             it != arry.end(); it++) {
+            std::string vdata;
+            if (it->is<picojson::object>()) {
+                picojson::object ogc = it->get<picojson::object>();
+                setGuardCondition(evi, ogc);
+                r = true;
+            }
+        }
+    }
+    else if (v.is<picojson::object>()) {
+        picojson::object ogc = v.get<picojson::object>();
+        setGuardCondition(evi, ogc);
+        r = true;
+    }
+    return r;
+}
+
+/**
+ * @brief CicoStateMachineCreator::setGuardCondition
+ * @param evi registration of event target
+ * @param o definition gurd condition data of event
+ */
+void CicoStateMachineCreator::setGuardCondition(CicoEventInfo& evi, picojson::object& o)
+{
+    std::string op;
+    if (false == parseOperator(o, op)) {
+        m_err = std::string("operator unkown");
+        return;
+    }
+    bool bAnd = false;
+    std::string j;
+    if (true ==parseJoin(o, j)) {
+        if (std::string(DVand)==j) {
+            bAnd = true;
+        }
+        else if (std::string(DVor)!=j) {
+            m_err = std::string("join unkown");
+            return;
+        }
+    }
+    int num;
+    double dbl;
+    std::string str;
+    if (true == parseValueIS(o, num, str)) {
+        if (str.empty()) {
+            if (true == bAnd) {
+                evi.addAndGurdCondition(op, num);
+            }
+            else {
+                evi.addOrGurdCondition(op, num);
+            }
+        }
+        else {
+            if (true == bAnd) {
+                evi.addAndGurdCondition(op, str);
+            }
+            else {
+                evi.addOrGurdCondition(op, str);
+            }
+        }
+    }
+    else if (true == parseValuedD(o, dbl)) {
+        if (true == bAnd) {
+            evi.addAndGurdCondition(op, dbl);
+        }
+        else {
+            evi.addOrGurdCondition(op, dbl);
+        }
+    }
+    else {
+        m_err = std::string("value,valued unkown");
+        return;
+    }
+}
+
+/**
+ * @brief CicoStateMachineCreator::getJsonString
+ * @param v json parse value
+ * @param str store json parse value
+ * @return true:get success  false:get fail
+ */
+bool CicoStateMachineCreator::getJsonString(picojson::value& v,
+                                            std::string& str)
+{
+    if (v.is<std::string>()) {
+        str = v.get<std::string>();
+        return true;
+    }
+    return false;
+}
+
+/**
+ * @brief CicoStateMachineCreator::getJsonNumber
+ * @param v json parse value
+ * @param num store json parse value
+ * @return true:get success   false:get fail
+ */
+bool CicoStateMachineCreator::getJsonNumber(picojson::value& v, int& num)
+{
+    if (v.is<double>()) {
+        num = (int)v.get<double>();
+        return true;
+    }
+    return false;
+}
+
+/**
+ * @brief CicoStateMachineCreator::getJsonDouble
+ * @param v json parse value
+ * @param d store json parse value
+ * @return true:get success  false:get fail
+ */
+bool CicoStateMachineCreator::getJsonDouble(picojson::value& v, double& d)
+{
+    if (v.is<double>()) {
+        d = (double)v.get<double>();
+        return true;
+    }
+    return false;
+}
+
+/**
+ * @brief CicoStateMachineCreator::parseName
+ * @param o  json parse objects
+ * @param nm store json parse "name" object value
+ * @return true:get success false:get fail
+ */
+bool CicoStateMachineCreator::parseName(picojson::object& o, std::string& nm)
+{
+    picojson::value& vnm = o[DKname];
+    if (true == getJsonString(vnm, nm)) {
+        return true;
+    }
+    vnm = o[DKname2];
+    if (true == getJsonString(vnm, nm)) {
+        return true;
+    }
+    return false;
+}
+
+/**
+ * @brief CicoStateMachineCreator::parseValueI
+ * @param o  json parse objects
+ * @param v store json parse "value" object value
+ * @return true:get success false:get fail
+ */
+bool CicoStateMachineCreator::parseValueI(picojson::object& o, int& v)
+{
+    picojson::value& vvl = o[DKvalue];
+    if (true == getJsonNumber(vvl, v)) {
+        return true;
+    }
+    vvl = o[DKvalue2];
+    if (true == getJsonNumber(vvl, v)) {
+        return true;
+    }
+    return false;
+}
+
+/**
+ * @brief CicoStateMachineCreator::parseValueIS
+ * @param o json parse objects
+ * @param n store json parse "value" object value
+ * @param s store json parse "value" object value
+ * @return true:get success false:get fail
+ */
+bool CicoStateMachineCreator::parseValueIS(picojson::object& o, int& n,
+                                           std::string& s)
+{
+    picojson::value& vvl = o[DKvalue];
+    if (true == getJsonNumber(vvl, n)) {
+        s.clear();
+        return true;
+    }
+    else if (true == getJsonString(vvl, s)) {
+        return true;
+    }
+    vvl = o[DKvalue2];
+    if (true == getJsonNumber(vvl, n)) {
+        s.clear();
+        return true;
+    }
+    else if (true == getJsonString(vvl, s)) {
+        return true;
+    }
+    return false;
+}
+
+/**
+ * @brief CicoStateMachineCreator::parseValuedD
+ * @param o  json parse objects
+ * @param v store json parse "valued" object value
+ * @return true:get success false:get fail
+ */
+bool CicoStateMachineCreator::parseValuedD(picojson::object& o, double& v)
+{
+    picojson::value& vvl = o[DKvalued];
+    if (true == getJsonDouble(vvl, v)) {
+        return true;
+    }
+    vvl = o[DKvalued2];
+    if (true == getJsonDouble(vvl, v)) {
+        return true;
+    }
+    return false;
+}
+
+
+/**
+ * @brief CicoStateMachineCreator::parseHistoryType
+ * @param o  json parse objects
+ * @param e store json parse "type" object value
+ * @return true:get success false:get fail
+ */
+bool CicoStateMachineCreator::parseHistoryType(picojson::object& o,
+                                               CicoHistoryState::E_HType& e)
+{
+    picojson::value& vty = o[DKtype];
+    std::string tmp;
+    if (false == getJsonString(vty, tmp)) {
+        vty = o[DKtype2];
+        if (false == getJsonString(vty, tmp)) {
+            return false;
+        }
+    }
+    if (false == tmp.empty()) {
+        if (std::string(DVShallow) == tmp) {
+            e = CicoHistoryState::Shallow;
+            return true;
+        }
+        else if (std::string(DVDeep) == tmp) {
+            e = CicoHistoryState::Deep;
+            return true;
+        }
+    }
+    return false;
+}
+
+/**
+ * @brief CicoStateMachineCreator::parseStateObject
+ * @param v json parse value
+ * @param vec store state-objects pointer array
+ * @param csm stateMachine object pointer
+ * @param err store gat fail error message
+ * @return true:get success false:get fail
+ */
+bool CicoStateMachineCreator::parseStateObject(picojson::value& v,
+                                               std::vector<CicoStateCore*>& vec,
+                                               CicoStateMachine* csm,
+                                               std::string& err)
+{
+    if (v.is<picojson::array>()) {
+        picojson::array& arry = v.get<picojson::array>();
+        for (picojson::array::const_iterator it = arry.begin();
+             it != arry.end(); it++) {
+            std::string vdata;
+            if (it->is<std::string>()) {
+                std::string v = it->get<std::string>();
+                const CicoStateCore* csc = csm->getState(v);
+                if ((CicoStateCore*)0 == csc) {
+                    std::ostringstream stream;
+                    stream << "state is not find:V:\"" << v << "\"";
+                    err = stream.str();
+                    return false;
+                }
+                vec.push_back((CicoStateCore*)csc);
+            }
+            else if (it->is<double>()) {
+                int v = (int) it->get<double>();
+                const CicoStateCore* csc = csm->getState(v);
+                if ((CicoStateCore*)0 == csc) {
+                    std::ostringstream stream;
+                    stream << "state is not find:V:" << v;
+                    err = stream.str();
+                    return false;
+                }
+                vec.push_back((CicoStateCore*)csc);
+            }
+        }
+    }
+    else if (v.is<double>()) {
+        int vi = (int) v.get<double>();
+        const CicoStateCore* csc = csm->getState(vi);
+        if ((CicoStateCore*)0 == csc) {
+            std::ostringstream stream;
+            stream << "state is not find:S:" << vi;
+            err = stream.str();
+            return false;
+        }
+        vec.push_back((CicoStateCore*)csc);
+    }
+    else if (v.is<std::string>()) {
+        std::string vs = v.get<std::string>();
+        const CicoStateCore* csc = csm->getState(vs);
+        if ((CicoStateCore*)0 == csc) {
+            std::ostringstream stream;
+            stream << "state is not find:S:\"" << vs << "\"";
+            err = stream.str();
+            return false;
+        }
+        vec.push_back((CicoStateCore*)csc);
+    }
+    return true;
+}
+
+/**
+ * @brief CicoStateMachineCreator::parseOperator
+ * @param o json parse object
+ * @param op store json "operation" object value
+ * @return true:get success false:get fail
+ */
+bool CicoStateMachineCreator::parseOperator(picojson::object& o, std::string& op)
+{
+    picojson::value& vop = o[DKoperator];
+    if (true == getJsonString(vop, op)) {
+        return true;
+    }
+    vop = o[DKoperator2];
+    if (true == getJsonString(vop, op)) {
+        return true;
+    }
+    return false;
+}
+
+
+/**
+ * @brief CicoStateMachineCreator::parseJoin
+ * @param o json parse object
+ * @param j store "join" value
+ * @return true:get success false:get fail
+ */
+bool CicoStateMachineCreator::parseJoin(picojson::object& o, std::string& j)
+{
+    picojson::value& vnm = o[DKjoin];
+    if (true == getJsonString(vnm, j)) {
+        return true;
+    }
+    vnm = o[DKjoin2];
+    if (true == getJsonString(vnm, j)) {
+        return true;
+    }
+    return false;
+}
diff --git a/lib/misc/state-machine/CicoStateMachineCreator.h b/lib/misc/state-machine/CicoStateMachineCreator.h
new file mode 100644 (file)
index 0000000..7c130ba
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+
+
+#ifndef CICOSTATEMACHINECREATOR_H
+#define CICOSTATEMACHINECREATOR_H
+#include <iostream>
+#include <string>
+#include <vector>
+#include "CicoBlockParser.h"
+#include "CicoEventInfo.h"
+
+#ifndef CICOSTATECORE_H
+class CicoStateCore;
+#endif
+
+#ifndef CICOSTATEMACHINE_H
+class CicoStateMachine;
+#endif
+
+#ifndef CICOSTATE_H
+class CicoState;
+#endif
+
+#ifndef CICOFINALSTATE_H
+class CicoFinalState;
+#endif
+
+#ifndef CICOHISTORYSTATE_H
+class CicoHistoryState;
+#endif
+
+#define DKstateMachine      "stateMachine"
+#define DKstate             "state"
+#define DKfinalState        "finalState"
+#define DKhistoryState      "historyState"
+#define DKevent             "event"
+
+#define DKname              "name"
+#define DKname2             "n"
+#define DKvalue             "value"
+#define DKvalue2            "v"
+#define DKinitial           "initial"
+#define DKinitial2          "i"
+#define DKfinish            "finish"
+#define DKfinish2           "f"
+#define DKdefault           "default"
+#define DKdefault2          "d"
+#define DKguardCondition    "guardCondition"
+#define DKguardCondition2   "g"
+#define DKoperator          "operator"
+#define DKoperator2         "o"
+#define DKtransition        "transition"
+#define DKtransition2       "t"
+#define DKtype              "type"
+#define DKtype2             "ht"
+#define DKvalued            "valued"
+#define DKvalued2           "vd"
+#define DKjoin              "join"
+#define DKjoin2              "j"
+
+#define DVShallow           "Shallow"
+#define DVDeep              "Deep"
+#define DVand               "and"
+#define DVor                "or"
+
+
+/**
+ * StateMachine-Object creator
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+/**
+ * @brief The CicoStateMachineCreator class
+ * @      state-machine produce from the definition file or string
+ */
+class CicoStateMachineCreator
+{
+public:
+    CicoStateMachine* createFile(const std::string& filename);
+
+    CicoStateMachine* create(const char* sttdef);
+    const std::string& getError();
+
+protected:
+    void        CreateStateObjects(CicoBlockParser& cbp,
+                                  CicoStateCore* parent = 0);
+    void        CreateStateMachine(CicoBlockParser& cbp);
+    void        CreateState(CicoBlockParser& cbp, CicoStateCore* parent);
+    void        CreateHistoryState(CicoBlockParser& cbp,
+                                   CicoStateCore* parent);
+    void        CreateFinalState(CicoBlockParser& cbp, CicoStateCore* parent);
+
+    void        setConnect(CicoBlockParser& cbp, CicoStateMachine* csm,
+                           CicoStateCore* parent=0);
+
+    void        setConnectStateMachine(CicoBlockParser& cbp,
+                                       CicoStateMachine* csm);
+    void        setConnectState(CicoBlockParser& cbp, CicoStateMachine* csm);
+    void        setConnectHistoryState(CicoBlockParser& cbp,
+                                       CicoStateMachine* csm);
+    void        setInitial(CicoBlockParser& cbp, const char* key,
+                           CicoStateMachine* csm);
+    void        addInitial(CicoStateCore* tgt, CicoStateCore* dat);
+
+    void        setFinish(CicoBlockParser& cbp, const char* key,
+                          CicoStateMachine* csm);
+
+    void        setDefault(CicoBlockParser& cbp, CicoHistoryState* chs,
+                           CicoStateMachine* csm);
+    void        addDefault(CicoHistoryState* chs, CicoStateCore* csc);
+
+
+    void        CreateEvent(CicoBlockParser& cbp, CicoStateMachine* csm,
+                            CicoStateCore* parent);
+
+    bool        regGuardCondition(picojson::value& v, CicoEventInfo& evi);
+    void        setGuardCondition(CicoEventInfo& evi, picojson::object& o);
+
+    bool        getJsonString(picojson::value& v, std::string& str);
+    bool        getJsonNumber(picojson::value& v, int& num);
+    bool        getJsonDouble(picojson::value& v, double& d);
+    bool        parseName(picojson::object& o, std::string& nm);
+
+    bool        parseValueI(picojson::object& o, int& v);
+    bool        parseValueIS(picojson::object& o, int& n, std::string& s);
+
+    bool        parseValuedD(picojson::object& o, double& v);
+
+    bool        parseHistoryType(picojson::object& o,
+                                 CicoHistoryState::E_HType& e);
+
+    bool        parseStateObject(picojson::value& v,
+                                 std::vector<CicoStateCore*>& vec,
+                                 CicoStateMachine* csm, std::string& err);
+
+    bool        parseOperator(picojson::object& o, std::string& op);
+    bool        parseJoin(picojson::object& o, std::string& j);
+
+private:
+    std::string m_err;
+
+};
+
+/**
+ * @brief CicoStateMachineCreator::getError
+ * @      get error message
+ * @return error message
+ */
+inline const std::string& CicoStateMachineCreator::getError()
+{
+    return m_err;
+}
+
+#endif // CICOSTATEMACHINECREATOR_H
diff --git a/lib/misc/state-machine/Makefile.am b/lib/misc/state-machine/Makefile.am
new file mode 100644 (file)
index 0000000..25b3a77
--- /dev/null
@@ -0,0 +1,51 @@
+AM_CPPFLAGS = $(GCC_CXXFLAGS) -DLOG_CICO
+#AM_CPPFLAGS = $(GCC_CXXFLAGS) -DLOG_CONSOLE
+#AM_CPPFLAGS = $(GCC_CXXFLAGS)
+
+lib_LTLIBRARIES =                              \
+       libico-state-machine.la
+
+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
+
+libico_state_machine_la_CPPFLAGS =     \
+       $(GCC_CXXFLAGS)                                 \
+       -DLOG_CICO                                              \
+    @DLOG_CFLAGS@
+
+libico_state_machine_la_LIBADD =       \
+    @DLOG_LIBS@
+
+AM_LDFLAGS = -module -avoid-version -rpath $(libdir)
+
+install-exec-hook:
+       mkdir -p $(INSTALL_ROOT)/$(includedir)/ico-state-machine
+       install -m 644 CicoBlockParser.h $(INSTALL_ROOT)/$(includedir)/ico-state-machine
+       install -m 644 CicoEvent.h $(INSTALL_ROOT)/$(includedir)/ico-state-machine
+       install -m 644 CicoEventInfo.h $(INSTALL_ROOT)/$(includedir)/ico-state-machine
+       install -m 644 CicoFinalState.h $(INSTALL_ROOT)/$(includedir)/ico-state-machine
+       install -m 644 CicoHistoryState.h $(INSTALL_ROOT)/$(includedir)/ico-state-machine
+       install -m 644 CicoState.h $(INSTALL_ROOT)/$(includedir)/ico-state-machine
+       install -m 644 CicoStateAction.h $(INSTALL_ROOT)/$(includedir)/ico-state-machine
+       install -m 644 CicoStateCore.h $(INSTALL_ROOT)/$(includedir)/ico-state-machine
+       install -m 644 CicoStateMachine.h $(INSTALL_ROOT)/$(includedir)/ico-state-machine
+       install -m 644 CicoStateMachineCreator.h $(INSTALL_ROOT)/$(includedir)/ico-state-machine
+
+uninstall:
+       rm -rf $(INSTALL_ROOT)/$(includedir)/ico-state-machine
+       rm -rf $(INSTALL_ROOT)/$(libdir)/libico-state-machine*
+
+.FORCE :
diff --git a/lib/misc/state-machine/ico_StateMachine_CWrapper.cpp b/lib/misc/state-machine/ico_StateMachine_CWrapper.cpp
new file mode 100644 (file)
index 0000000..89fe910
--- /dev/null
@@ -0,0 +1,3277 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#include <vector>
+#include <iostream>
+#include <string>
+#include <vector>
+#include <fstream>
+
+#include "CicoEvent.h"
+#include "CicoEventInfo.h"
+#include "CicoStateAction.h"
+#include "CicoStateCore.h"
+#include "CicoState.h"
+#include "CicoHistoryState.h"
+#include "CicoFinalState.h"
+#include "CicoStateMachine.h"
+#include "CicoStateMachineCreator.h"
+#include "ico_StateMachine_CWrapper.h"
+#include "CicoStateInternal.h"
+
+/**
+ * stateMachine C Wrapper functions
+ */
+
+static std::vector<CicoStateCore*>  stateObjects;
+static std::vector<CicoEventInfo*>  evInfObjects;
+static std::vector<void*>           callbackFnc;
+
+StateMachineCWrapperErr_E sttmerr;
+
+
+/**
+ * @brief GCOpKind
+ * @      Definitions used in the function ico_sttm_addTransitionGCI ,
+ * @      ico_sttm_addTransitionGCD , ico_sttm_addTransitionGCS
+ * @      ico_sttm_addGCI , ico_sttm_addGCD , ico_sttm_addGCS
+ */
+const char* GCOpKind[] = {
+    "",
+    DEFJGCE_EQ,     // "="   Guard condition is equal to
+    DEFJGCE_NE,     // "!="  Guard condition is not equal to
+    DEFJGCE_LT,     // "<"   Guard condition is less than
+    DEFJGCE_LE,     // "<="  Guard condition is less than or equal
+    DEFJGCE_GT,     // ">"   Guard condition is greater than
+    DEFJGCE_GE,     // ">="  Guard condition is greater than or equal
+    DEFJGCE_IN,     // "in"  Guard condition is the state of the state-object
+    DEFJGCE_NOT,    // "not" Guard condition is the state of the state-object
+};
+
+/**
+ * @brief getID2ObjSTT
+ * @      c-wrapper local ID to CicoStateCore pointer
+ * @param id c-wrapper local ID
+ * @return not 0:get success
+ * @       0:get faile
+ */
+CicoStateCore* getID2ObjSTT(int id)
+{
+    int sz = stateObjects.size();
+    if ((1 > id) || (id > sz)) {
+        return (CicoStateCore*)0;
+    }
+    return stateObjects[(id-1)];
+}
+
+
+/**
+ * @brief getID2ObjSTTX
+ * @      c-wrapper local ID to CicoStateCore pointer
+ * @param id c-wrapper local ID
+ * @return not 0:get success
+ * @       0:get faile
+ */
+extern "C" void* getID2ObjSTTX(int id)
+{
+    return (void*)getID2ObjSTT(id);
+}
+
+/**
+ * @brief getObjSTT2ID
+ * @      CicoStateCore pointer to c-wrapper local ID
+ * @param stt 
+ * @return not 0:get success(c-wrapper local ID)
+ * @       0:get faile
+ */
+int getObjSTT2ID(const CicoStateCore* stt)
+{
+    int r = 0;
+    int sz = stateObjects.size();
+    for (int i=0; i<sz; i++) {
+        if (stt == stateObjects[i]) {
+            r = i+1;
+            break;                      // break of for i<sz
+        }
+    }
+    return r;
+}
+
+/**
+ * @brief getID2ObjEV
+ * @      c-wrapper local ID to CicoEventInfo pointer
+ * @param id c-wrapper local ID
+ * @return not 0:CicoEventInfo pointer
+ * @       0:get faile
+ */
+CicoEventInfo*  getID2ObjEV(int id)
+{
+    int sz = evInfObjects.size();
+    if ((1 > id) || (id > sz)) {
+        return (CicoEventInfo*)0;
+    }
+    return evInfObjects[(id-1)];
+}
+
+/**
+ * @brief supplementName
+ * @      supplement name
+ * @param name
+ * @return supplement name
+ */
+const char* supplementName(const char* name)
+{
+    static const char* emptychar = "";
+    if ((char*)0 == name) {
+        return emptychar;
+    }
+    return name;
+}
+
+/* Registration system */
+/**
+ * @brief Create an stateMachine-object and state-object with the specified file
+ * @param file faile path pseudo-json
+ * @return not 0:stateMachine-object Id no.(c-wrapper local ID)
+ * @       0:create error
+ */
+extern "C" int ico_sttm_createStateMachineFile(const char* file)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateMachineCreator csmc;
+    CicoStateMachine* csm = csmc.createFile(file);
+    if ((CicoStateMachine*)0 == csm) {
+        sttmerr = STTMCREATEERR;
+        _DBG("ico_sttm_createStateMachineFile %s", csmc.getError().c_str());
+        return 0;
+    }
+    csm->getObjects(stateObjects);
+    int r = 0;
+    int sz = stateObjects.size();
+    for (int i = 0; i < sz; i++) {
+        if (stateObjects[i] == csm) {   // match object pointer
+            r = i+1;                    // get return value
+            break;                      // break of for i<sz
+        }
+    }
+    return r;
+}
+
+
+/**
+ * @brief Create an stateMachine-object and state-object with the specified text
+ * @param buff text pseudo-json
+ * @return not 0:stateMachine-object ID no.(c-wrapper local ID)
+ * @       0:create error
+ */
+extern "C" int ico_sttm_createStateMachineText(const char* buff)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateMachineCreator csmc;
+    CicoStateMachine* csm = csmc.create(buff);
+    if ((CicoStateMachine*)0 == csm) {
+        sttmerr = STTMCREATEERR;
+        _DBG("ico_sttm_createStateMachineText %s", csmc.getError().c_str());
+        return 0;
+    }
+    csm->getObjects(stateObjects);      // get all state-objects
+    int r = 0;                          //
+    int sz = stateObjects.size();       //
+    for (int i = 0; i < sz; i++) {      //
+        if (stateObjects[i] == csm) {   // match object pointer
+            r = i+1;                    // get return value
+            break;                      // break of for i<sz
+        }
+    }
+    return r;
+}
+
+/**
+ * @brief Create stateMachine-object
+ * @param name stateMachine-object name (Option)
+ * @param value stateMachine-object ID no.
+ * @return not 0:stateMachine-object ID no.(c-wrapper local ID)
+ * @       0:create error
+ */
+extern "C" int ico_sttm_createStateMachine(const char* name, int value)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateMachine* csm;
+    const char* sname = supplementName(name);
+    csm = new CicoStateMachine(sname, value);
+    if ((CicoStateMachine*)0 == csm) {
+        sttmerr = STTMNEWERR;
+        _ERR("ico_sttm_createStateMachine \"%s\", %d", sname, value);
+        return 0;
+    }
+    stateObjects.push_back(csm);
+    return stateObjects.size();
+}
+
+/**
+ * @brief Create state-object
+ * @param parent parent ID no.(c-wrapper local ID)
+ * @param name state-object name (Option)
+ * @param value state-object ID no.
+ * @return not 0:state-object ID no.(c-wrapper local ID)
+ * @       0:create faile
+ */
+extern "C" int ico_sttm_createState(int parent, const char* name, int value)
+{
+    sttmerr = STTMNOERROR;
+    const char* sname = supplementName(name);
+    CicoStateCore* cscParent = getID2ObjSTT(parent); // ID to state-object
+    if ((CicoStateCore*)0 == cscParent) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_createState >>%d<<, \"%s\", %d", parent, sname,value);
+        return 0;
+    }
+    CicoState* cs = (CicoState*)0;
+    if (cscParent->isStateMachine()) {
+        cs = new CicoState(sname, value, (CicoStateMachine*)cscParent);
+    }
+    else if (cscParent->isState()) {
+        cs = new CicoState(sname, value, (CicoState*)cscParent);
+    }
+    if ((CicoState*)0 == cs) {
+        sttmerr = STTMNEWERR;
+        _ERR("ico_sttm_createState %d(%s:%d:%d), \"%s\", %d",
+             parent, cscParent->getName().c_str(), cscParent->getValue(),
+             (int)cscParent->getType(), sname, value);
+        return 0;
+    }
+    stateObjects.push_back(cs);
+    return stateObjects.size();
+}
+
+/**
+ * @brief Create historyState-object
+ * @param parent parent ID no.(c-wrapper local ID)
+ * @param name historyState-object name (Option)
+ * @param value historyState-object ID no.
+ * @return not 0:historyState-object ID no.(c-wrapper local ID)
+ * @       0:create error
+ */
+extern "C" int ico_sttm_createHState(int parent, const char* name, int value,
+                                 HISTORY_TYPE_E typ)
+{
+    sttmerr = STTMNOERROR;
+    const char* sname = supplementName(name);
+    CicoStateCore* cscParent = getID2ObjSTT(parent); // ID to state-object
+    if ((CicoStateCore*)0 == cscParent) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_createHState >>%d<<, \"%s\", %d, %d", parent, sname, value, (int)typ);
+        return 0;
+    }
+    CicoHistoryState* chs = (CicoHistoryState*)0;
+    if (cscParent->isStateMachine()) {
+        chs = new CicoHistoryState(sname, value, (CicoStateMachine*)cscParent);
+    }
+    else if (cscParent->isState()) {
+        chs = new CicoHistoryState(sname, value, (CicoState*)cscParent);
+    }
+    if ((CicoHistoryState*)0 == chs) {
+        sttmerr = STTMNEWERR;
+        _ERR("ico_sttm_createHState >>%d(%s:%d:%d)<<, \"%s\", %d, %d",
+             parent, cscParent->getName().c_str(), cscParent->getValue(),
+             (int)cscParent->getType(), sname, value, (int)typ);
+        return 0;
+    }
+    if (E_SHALLOW == typ) {
+        chs->setHistoryType(CicoHistoryState::Shallow);
+    }
+    else if (E_DEEP == typ) {
+        chs->setHistoryType(CicoHistoryState::Deep);
+    }
+    else {
+        sttmerr = STTMPARAMERR;
+        _DBG("ico_sttm_createHState %d(%s:%d:%d), \"%s\", %d,>>%d<<",
+             parent, cscParent->getName().c_str(), cscParent->getValue(),
+             (int)cscParent->getType(), sname, value, (int)typ);
+        delete chs;
+        return 0;
+    }
+    stateObjects.push_back((CicoStateCore*)chs);
+    return stateObjects.size();
+}
+
+/**
+ * @brief Create finalState-object
+ * @param parent parent ID no.(c-wrapper local ID)
+ * @param name finalState-object name (Option)
+ * @param value finalState-object ID no.
+ * @return not 0:finalState-object ID no.(c-wrapper local ID)
+ * @       0:create error
+ */
+extern "C" int ico_sttm_createFState(int parent, const char* name, int value)
+{
+    sttmerr = STTMNOERROR;
+    const char* sname = supplementName(name);
+    CicoStateCore* cscParent = getID2ObjSTT(parent); // ID to state-object
+    if ((CicoStateCore*)0 == cscParent) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_createFState >>%d<<, \"%s\", %d", parent, sname, value);
+        return 0;
+    }
+    CicoFinalState* cfs = (CicoFinalState*)0;
+    if (cscParent->isStateMachine()) {
+        cfs = new CicoFinalState(sname, value, (CicoStateMachine*)cscParent);
+    }
+    else if (cscParent->isState()) {
+        cfs = new CicoFinalState(sname, value, (CicoState*)cscParent);
+    }
+    if ((CicoFinalState*)0 == cfs) {
+        sttmerr = STTMNEWERR;
+        _ERR("ico_sttm_createFState >>%d(%s:%d:%d)<<, \"%s\", %d",
+             parent, cscParent->getName().c_str(), cscParent->getValue(),
+             (int)cscParent->getType(), sname, value);
+        return 0;
+    }
+    stateObjects.push_back((CicoStateCore*)cfs);
+    return stateObjects.size();
+}
+
+/**
+ * @brief Registration of transition events
+ * @param sCWId ID no. to be registered(c-wrapper local ID)
+ * @param trCWId of transition destination(c-wrapper local ID)
+ * @param evi Registration event
+ * @param fname function name of the caller
+ * @return not 0:ID no. of the event to register(c-wrapper local ID)
+ * @       0:added error
+ */
+int ico_sttm_addTransitionX(int sCWId, int trCWId, CicoEventInfo& evi,
+                      const char* fname)
+{
+    CicoStateCore* cscTarget = getID2ObjSTT(sCWId); // ID to state-object
+    if ((CicoStateCore*)0 == cscTarget) {
+        sttmerr = STTMNOTFIND;
+        _DBG("%s >>%d<<, \"%s\", %d, ..., %d",
+             fname, sCWId, evi.getName().c_str(), (int)evi.getEV(),
+             trCWId);
+        return 0;
+    }
+    CicoStateCore* cscTrans = getID2ObjSTT(trCWId); // ID to state-object
+    if ((CicoStateCore*)0 == cscTrans) {
+        sttmerr = STTMNOTFIND;
+        _DBG("%s %d, \"%s\", %d, ...,>>%d<<",
+             fname, sCWId, evi.getName().c_str(), (int)evi.getEV(),
+             trCWId);
+        return 0;
+    }
+    if (false == cscTarget->isState()) {
+        sttmerr = STTMTYPEMISMATCH;
+        _DBG("%s >>%d(%s:%d:%d)<<, \"%s\", %d, ..., %d",
+             fname, sCWId, cscTarget->getName().c_str(),
+             cscTarget->getValue(), (int)cscTarget->getType(),
+             evi.getName().c_str(), (int)evi.getEV(), trCWId);
+        return 0;
+    }
+    CicoState* csTgt = (CicoState*)cscTarget;
+    if (true == cscTrans->isState()) {
+        csTgt->addTransition(evi, (CicoState*)cscTrans);
+    }
+    else if (true == cscTrans->isFinalState()) {
+        csTgt->addTransition(evi, (CicoFinalState*)cscTrans);
+    }
+    else if (true == cscTrans->isHistoryState()) {
+        csTgt->addTransition(evi, (CicoHistoryState*)cscTrans);
+    }
+    else {
+        sttmerr = STTMTYPEMISMATCH;
+        _DBG("%s %d, \"%s\", %d, ...,>>%d(%s:%d:%d)<<",
+             fname, sCWId, evi.getName().c_str(), (int)evi.getEV(),
+             trCWId, cscTarget->getName().c_str(),
+             cscTarget->getValue(), (int)cscTarget->getType());
+        return 0;
+    }
+    const CicoEventInfo* t = csTgt->getEventInfo(evi.getName(), evi.getEV());
+    evInfObjects.push_back((CicoEventInfo*)t);
+    return evInfObjects.size();
+}
+
+/**
+ * @brief Registration of transition events
+ * @param sCWId ID no. to be registered(c-wrapper local ID)
+ * @param name event name
+ * @param ev event no.(Use the 1000-65535)
+ * @param trCWId of transition destination(c-wrapper local ID)
+ * @return not 0:ID no. of the event to register(c-wrapper local ID)
+ * @       0:added error
+ */
+extern "C" int ico_sttm_addTransition(int sCWId, 
+                                      const char* evname, unsigned short ev,
+                                      int trCWId)
+{
+    sttmerr = STTMNOERROR;
+    const char* sname = supplementName(evname);
+    CicoEventInfo evi(sname, ev);
+    int r = ico_sttm_addTransitionX(sCWId, trCWId, evi, "ico_sttm_addTransition");
+    return r;
+}
+
+
+/**
+ * @brief Registration of transition events
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param value value is state-object identification number
+ * @param name state-object Identification name
+ * @param evname event name
+ * @param ev event no.(Use the 1000-65535)
+ * @param trVal state-object identification value destination
+ * @param namTrns state-object Identification name destination
+ * @return not 0:ID no. of the event to register(c-wrapper local ID)
+ * @       0:added error
+ */
+extern "C" int ico_sttm_addTransition_V_(int smCWId, int value,
+                                         const char* evname, unsigned short ev,
+                                         int trCWId)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveSVal(smCWId, value);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addTransition_VV >>%d<<,>>%d<<, %s,%d, %d", smCWId,
+             value, evname, ev, trCWId);
+        return 0;
+    }
+    return ico_sttm_addTransition(id, evname, ev, trCWId);
+}
+
+extern "C" int ico_sttm_addTransition_VV(int smCWId, int value,
+                                         const char* evname, unsigned short ev,
+                                         int trVal)
+{
+    sttmerr = STTMNOERROR;
+    int idT = ico_sttm_retrieveSVal(smCWId, trVal);
+    if (0 == idT) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addTransition_VV >>%d<<, %d, %s,%d,>>%d<<", smCWId,
+             value, evname, ev, trVal);
+        return 0;
+    }
+    return ico_sttm_addTransition_V_(smCWId, value, evname, ev, idT);
+}
+
+extern "C" int ico_sttm_addTransitionVVV(int smVal, int value,
+                                         const char* evname, unsigned short ev,
+                                         int trVal)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addTransitionVVV >>%d<<, %d, %s,%d, %d", smVal,
+             value, evname, ev, trVal);
+        return 0;
+    }
+    return ico_sttm_addTransition_VV(id, value, evname, ev, trVal);
+}
+
+extern "C" int ico_sttm_addTransition_N_(int smCWId, const char* name,
+                                         const char* evname, unsigned short ev,
+                                         int trCWId)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrivevSName(smCWId, name);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addTransitionVVV >>%d<<,>>%s<<, %s,%d,%d", smCWId,
+             name, evname, ev, trCWId);
+        return 0;
+    }
+    return ico_sttm_addTransition(id, evname, ev, trCWId);
+
+
+}
+extern "C" int ico_sttm_addTransition_NN(int smCWId, const char* name,
+                                         const char* evname, unsigned short ev,
+                                         const char* trNm)
+{
+    sttmerr = STTMNOERROR;
+    int idT = ico_sttm_retrivevSName(smCWId, trNm);
+    if (0 == idT) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addTransitionVVV >>%d<<, %s, %s,%d,>>%s<<", smCWId,
+             name, evname, ev, trNm);
+        return 0;
+    }
+    return ico_sttm_addTransition_N_(smCWId, name, evname, ev, idT);
+}
+
+extern "C" int ico_sttm_addTransitionNNN(const char* smNm, const char* name,
+                                         const char* evname, unsigned short ev,
+                                         const char* trNm)
+{
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addTransitionNNN >>%s<<, %s, %s, %d, %s", smNm,
+             name, evname, ev, trNm);
+        return 0;
+    }
+    return ico_sttm_addTransition_NN(id, name, evname, ev, trNm);
+}
+
+/**
+ * @brief Registration of transition events
+ * @param sCWId ID no. to be registered(c-wrapper local ID)
+ * @param name event name
+ * @param ev event no.(Use the 1000-65535)
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @param trCWId destination(c-wrapper local ID)
+ * @return not 0:ID no. of the event to register(c-wrapper local event-ID)
+ * @       0:added error
+ */
+extern "C" int ico_sttm_addTransitionGCI(int sCWId,
+                                         const char* evname, unsigned short ev,
+                                         GC_OP_KIND_E gce, int gcv, int trCWId)
+{
+    sttmerr = STTMNOERROR;
+    const char* sname = supplementName(evname);
+    CicoEventInfo evi(sname, ev, GCOpKind[gce], gcv);
+    int r = ico_sttm_addTransitionX(sCWId, trCWId, evi, "ico_sttm_addTransitionGCI");
+    return r;
+}
+
+extern "C" int ico_sttm_addTransitionGCD(int sCWId,
+                                         const char* evname, unsigned short ev,
+                                         GC_OP_KIND_E gce, double gcv,
+                                         int trCWId)
+{
+    sttmerr = STTMNOERROR;
+    const char* sname = supplementName(evname);
+    CicoEventInfo evi(sname, ev, GCOpKind[gce], gcv);
+    int r = ico_sttm_addTransitionX(sCWId, trCWId, evi, "ico_sttm_addTransitionGCD");
+    return r;
+}
+
+extern "C" int ico_sttm_addTransitionGCS(int sCWId,
+                                         const char* evname, unsigned short ev,
+                                         GC_OP_KIND_E gce, const char* gcv,
+                                         int trCWId)
+{
+    sttmerr = STTMNOERROR;
+    const char* sname = supplementName(evname);
+    CicoEventInfo evi(sname, ev, GCOpKind[gce], gcv);
+    int r = ico_sttm_addTransitionX(sCWId, trCWId, evi, "ico_sttm_addTransitionGCS");
+    return r;
+}
+
+
+/**
+ * @brief Registration of transition events
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param value value is state-object identification number
+ * @param evname event name 
+ * @param ev event no.(Use the 1000-65535)
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @param trCWId destination(c-wrapper local ID)
+ * @return not 0:ID no. of the event to register(c-wrapper local event-ID)
+ * @       0:added error
+ */
+extern "C" int ico_sttm_addTransGCI_V_(int smCWId, int value,
+                          const char* evname, unsigned short ev,
+                          GC_OP_KIND_E gce, int gcv,
+                          int trCWId)
+{
+
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveSVal(smCWId, value);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _ERR("ico_sttm_addTransGCI_V_ >>%d<<,>>%d<<, %s, %d, %d, %d, %d",
+              smCWId, value, evname, ev, (int)gce, gcv, trCWId);
+        return 0;
+    }
+    return ico_sttm_addTransitionGCI(id, evname, ev, gce, gcv, trCWId);
+}
+
+extern "C" int ico_sttm_addTransGCD_V_(int smCWId, int value,
+                          const char* evname, unsigned short ev,
+                          GC_OP_KIND_E gce, double gcv,
+                          int trCWId)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveSVal(smCWId, value);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _ERR("ico_sttm_addTransGCD_V_ >>%d<<,>>%d<<, %s, %d, %d, %f, %d",
+              smCWId, value, evname, ev, (int)gce, gcv, trCWId);
+        return 0;
+    }
+    return ico_sttm_addTransitionGCD(id, evname, ev, gce, gcv, trCWId);
+}
+
+extern "C" int ico_sttm_addTransGCS_V_(int smCWId, int value,
+                          const char* evname, unsigned short ev,
+                          GC_OP_KIND_E gce, const char* gcv,
+                          int trCWId)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveSVal(smCWId, value);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _ERR("ico_sttm_addTransGCD_V_ >>%d<<,>>%d<<, %s, %d, %d, %s, %d",
+              smCWId, value, evname, ev, (int)gce, gcv, trCWId);
+        return 0;
+    }
+    return ico_sttm_addTransitionGCS(id, evname, ev, gce, gcv, trCWId);
+}
+
+/**
+ * @brief Registration of transition events
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param value value is state-object identification number
+ * @param evname event name 
+ * @param ev event no.(Use the 1000-65535)
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @param trVl value is state-object identification number transition, destination
+ * @return not 0:ID no. of the event to register(c-wrapper local event-ID)
+ * @       0:added error
+ */
+extern "C" int ico_sttm_addTransGCI_VV(int smCWId, int value,
+                                       const char* evname, unsigned short ev,
+                                       GC_OP_KIND_E gce, int gcv,
+                                       int trVl)
+{
+    sttmerr = STTMNOERROR;
+    int idT = ico_sttm_retrieveSVal(smCWId, trVl);
+    if (0 == idT) {
+        sttmerr = STTMNOTFIND;
+        _ERR("ico_sttm_addTransGCI_VV >>%d<<, %d, %s, %d, %d, %d,>>%d<<",
+              smCWId, value, evname, ev, (int)gce, gcv, trVl);
+        return 0;
+    }
+    return ico_sttm_addTransGCI_V_(smCWId, value, evname, ev, gce, gcv, idT);
+}
+
+extern "C" int ico_sttm_addTransGCD_VV(int smCWId, int value,
+                                       const char* evname, unsigned short ev,
+                                       GC_OP_KIND_E gce, double gcv,
+                                       int trVl)
+{
+    sttmerr = STTMNOERROR;
+    int idT = ico_sttm_retrieveSVal(smCWId, trVl);
+    if (0 == idT) {
+        sttmerr = STTMNOTFIND;
+        _ERR("ico_sttm_addTransGCD_VV >>%d<<, %d, %s, %d, %d, %f,>>%d<<",
+              smCWId, value, evname, ev, (int)gce, gcv, trVl);
+        return 0;
+    }
+    return ico_sttm_addTransGCD_V_(smCWId, value, evname, ev, gce, gcv, idT);
+}
+
+extern "C" int ico_sttm_addTransGCS_VV(int smCWId, int value,
+                                       const char* evname, unsigned short ev,
+                                       GC_OP_KIND_E gce, const char* gcv,
+                                       int trVl)
+{
+    sttmerr = STTMNOERROR;
+    int idT = ico_sttm_retrieveSVal(smCWId, trVl);
+    if (0 == idT) {
+        sttmerr = STTMNOTFIND;
+        _ERR("ico_sttm_addTransGCS_VV >>%d<<, %d, %s, %d, %d, %s,>>%d<<",
+              smCWId, value, evname, ev, (int)gce, gcv, trVl);
+        return 0;
+    }
+    return ico_sttm_addTransGCS_V_(smCWId, value, evname, ev, gce, gcv, idT);
+}
+
+
+
+extern "C" int ico_sttm_addTransGCIVVV(int smVal, int value,
+                                       const char* evname, unsigned short ev,
+                                       GC_OP_KIND_E gce, int gcv,
+                                       int trVl)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addTransGCIVVV >>%d<<, %d, %s, %d, %d, %d, %d", smVal,
+             value, evname, ev, gce, gcv, trVl);
+        return 0;
+    }
+    return ico_sttm_addTransGCI_VV(id, value, evname, ev, gce, gcv, trVl);
+}
+
+extern "C" int ico_sttm_addTransGCDVVV(int smVal, int value,
+                                       const char* evname, unsigned short ev,
+                                       GC_OP_KIND_E gce, double gcv,
+                                       int trVl)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addTransGCIVVV >>%d<<, %d, %s, %d, %d, %f, %d", smVal,
+             value, evname, ev, gce, gcv, trVl);
+        return 0;
+    }
+    return ico_sttm_addTransGCD_VV(id, value, evname, ev, gce, gcv, trVl);
+}
+
+extern "C" int ico_sttm_addTransGCSVVV(int smVal, int value,
+                                       const char* evname, unsigned short ev,
+                                       GC_OP_KIND_E gce, const char* gcv,
+                                       int trVl)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addTransGCSVVV >>%d<<, %d, %s, %d, %d, %s, %d", smVal,
+             value, evname, ev, gce, gcv, trVl);
+        return 0;
+    }
+    return ico_sttm_addTransGCS_VV(id, value, evname, ev, gce, gcv, trVl);
+}
+
+/**
+ * @brief Registration of transition events
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param name  name is state-object Identification name
+ * @param evname event name 
+ * @param ev event no.(Use the 1000-65535)
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @param transition destination(c-wrapper local ID)
+ * @return not 0:ID no. of the event to register(c-wrapper local event-ID)
+ * @       0:added error
+ */
+extern "C" int ico_sttm_addTransGCI_N_(int smCWId, const char* name,
+                                       const char* evname, unsigned short ev,
+                                       GC_OP_KIND_E gce, int gcv,
+                                       int trCWId)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrivevSName(smCWId, name);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addTransGCI_N_ >>%d<<, %s, %s, %d, %d, %d, %d", smCWId,
+             name, evname, ev, gce, gcv, trCWId);
+        return 0;
+    }
+    return ico_sttm_addTransitionGCI(id, evname, ev, gce, gcv, trCWId);
+}
+
+extern "C" int ico_sttm_addTransGCD_N_(int smCWId, const char* name,
+                                       const char* evname, unsigned short ev,
+                                       GC_OP_KIND_E gce, double gcv,
+                                       int trCWId)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrivevSName(smCWId, name);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addTransGCD_N_ >>%d<<, %s, %s, %d, %d, %f, %d", smCWId,
+             name, evname, ev, gce, gcv, trCWId);
+        return 0;
+    }
+    return ico_sttm_addTransitionGCD(id, evname, ev, gce, gcv, trCWId);
+}
+
+extern "C" int ico_sttm_addTransGCS_N_(int smCWId, const char* name, 
+                                       const char* evname, unsigned short ev,
+                                       GC_OP_KIND_E gce, const char* gcv,
+                                       int trCWId)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrivevSName(smCWId, name);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addTransGCD_N_ >>%d<<, %s, %s, %d, %d, %s, %d", smCWId,
+             name, evname, ev, gce, gcv, trCWId);
+        return 0;
+    }
+    return ico_sttm_addTransitionGCS(id, evname, ev, gce, gcv, trCWId);
+}
+
+/**
+ * @brief Registration of transition events
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param name name is state-object Identification name
+ * @param evname event name 
+ * @param ev event no.(Use the 1000-65535)
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @param trNm name is state-object Identification name destination
+ * @return not 0:ID no. of the event to register(c-wrapper local event-ID)
+ * @       0:added error
+ */
+extern "C" int ico_sttm_addTransGCI_NN(int smCWId, const char* name,
+                                       const char* evname, unsigned short ev,
+                                       GC_OP_KIND_E gce, int gcv,
+                                       const char* trNm)
+{
+    sttmerr = STTMNOERROR;
+    int idT = ico_sttm_retrivevSName(smCWId, trNm);
+    if (0 == idT) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addTransGCI_NN >>%d<<, %s, %s, %d, %d, %d,>>%s<<", smCWId,
+             name, evname, ev, gce, gcv, trNm);
+        return 0;
+    }
+    return ico_sttm_addTransGCI_N_(smCWId, name, evname, ev, gce, gcv, idT);
+}
+
+extern "C" int ico_sttm_addTransGCD_NN(int smCWId, const char* name,
+                                       const char* evname, unsigned short ev,
+                                       GC_OP_KIND_E gce, double gcv,
+                                       const char* trNm)
+{
+    sttmerr = STTMNOERROR;
+    int idT = ico_sttm_retrivevSName(smCWId, trNm);
+    if (0 == idT) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addTransGCD_NN >>%d<<, %s, %s, %d, %d, %f,>>%s<<", smCWId,
+             name, evname, ev, gce, gcv, trNm);
+        return 0;
+    }
+    return ico_sttm_addTransGCD_N_(smCWId, name, evname, ev, gce, gcv, idT);
+}
+
+extern "C" int ico_sttm_addTransGCS_NN(int smCWId, const char* name, 
+                                       const char* evname, unsigned short ev,
+                                       GC_OP_KIND_E gce, const char* gcv,
+                                       const char* trNm)
+{
+    sttmerr = STTMNOERROR;
+    int idT = ico_sttm_retrivevSName(smCWId, trNm);
+    if (0 == idT) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addTransGCS_NN >>%d<<, %s, %s, %d, %d, %s,>>%s<<", smCWId,
+             name, evname, ev, gce, gcv, trNm);
+        return 0;
+    }
+    return ico_sttm_addTransGCS_N_(smCWId, name, evname, ev, gce, gcv, idT);
+}
+
+extern "C" int ico_sttm_addTransGCINNN(const char* smNm, const char* name,
+                                       const char* evname, unsigned short ev,
+                                       GC_OP_KIND_E gce, int gcv,
+                                       const char* trNm)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        _DBG("ico_sttm_addTransGCINNN >>%s<<, %s, %s, %d, %d, %d, %s", smNm,
+             name, evname, ev, gce, gcv, trNm);
+        return 0;
+    }
+    return ico_sttm_addTransGCI_NN(id, name, evname, ev, gce, gcv, trNm);
+}
+
+extern "C" int ico_sttm_addTransGCDNNN(const char* smNm, const char* name,
+                                       const char* evname, unsigned short ev,
+                                       GC_OP_KIND_E gce, double gcv,
+                                       const char* trNm)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        _DBG("ico_sttm_addTransGCDNNN >>%s<<, %s, %s, %d, %d, %f, %s", smNm,
+             name, evname, ev, gce, gcv, trNm);
+        return 0;
+    }
+    return ico_sttm_addTransGCD_NN(id, name, evname, ev, gce, gcv, trNm);
+}
+
+extern "C" int ico_sttm_addTransGCSNNN(const char* smNm, const char* name,
+                                       const char* evname, unsigned short ev,
+                                       GC_OP_KIND_E gce, const char* gcv,
+                                       const char* trNm)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        _DBG("ico_sttm_addTransGCSNNN >>%s<<, %s, %s, %d, %d, %s, %s", smNm,
+             name, evname, ev, gce, gcv, trNm);
+        return 0;
+    }
+    return ico_sttm_addTransGCS_NN(id, name, evname, ev, gce, gcv, trNm);
+}
+
+
+/**
+ * @brief add guard condition
+ * @param evi register target
+ * @param j logical operator
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @return true:Success
+ * @       false:added failure
+ */
+bool addGC(CicoEventInfo* evi, GC_JOIN_E j, GC_OP_KIND_E gce, int gcv)
+{
+    if (E_GC_AND == j) {
+        return evi->addAndGurdCondition(GCOpKind[gce], gcv);
+    }
+    else if (E_GC_OR == j) {
+        return evi->addOrGurdCondition(GCOpKind[gce], gcv);
+    }
+    return false;
+}
+
+
+bool addGC(CicoEventInfo* evi, GC_JOIN_E j, GC_OP_KIND_E gce, double gcv)
+{
+    if (E_GC_AND == j) {
+        return evi->addAndGurdCondition(GCOpKind[gce], gcv);
+    }
+    else if (E_GC_OR == j) {
+        return evi->addOrGurdCondition(GCOpKind[gce], gcv);
+    }
+    return false;
+}
+
+
+bool addGC(CicoEventInfo* evi, GC_JOIN_E j, GC_OP_KIND_E gce, const char* gcv)
+{
+    if (E_GC_AND == j) {
+        return evi->addAndGurdCondition(GCOpKind[gce], gcv);
+    }
+    else if (E_GC_OR == j) {
+        return evi->addOrGurdCondition(GCOpKind[gce], gcv);
+    }
+    return false;
+}
+
+/**
+ * @brief add guard condition
+ * @param evId ID no. to be registered(c-wrapper local event-ID)
+ * @param j logical operator
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @return not 0:Success
+ * @       0:added failure
+ */
+extern "C" int ico_sttm_addGCI(int evId, GC_JOIN_E j, GC_OP_KIND_E gce, int gcv)
+{
+    sttmerr = STTMNOERROR;
+    CicoEventInfo* eviTarget = getID2ObjEV(evId);
+    if ((CicoEventInfo*)0 == eviTarget) {
+        sttmerr = STTMEVNOTFIND;
+        _DBG("ico_sttm_addGCI >>%d<<,%d, %d, %d",evId, (int)j, (int)gce, gcv);
+        return 0;
+    }
+    if (false == addGC(eviTarget, j, gce, gcv)) {
+        sttmerr = STTMPARAMERR;
+        _DBG("ico_sttm_addGCI ,>>%d<<, %d, %d, %d",evId, (int)j, (int)gce, gcv);
+    }
+    return evId;
+}
+
+extern "C" int ico_sttm_addGCD(int evId, GC_JOIN_E j, GC_OP_KIND_E gce, double gcv)
+{
+    sttmerr = STTMNOERROR;
+    CicoEventInfo* eviTarget = getID2ObjEV(evId);
+    if ((CicoEventInfo*)0 == eviTarget) {
+        sttmerr = STTMEVNOTFIND;
+        _DBG("ico_sttm_addGCD >>%d<<,%d, %d, %f",evId, (int)j, (int)gce, gcv);
+        return 0;
+    }
+    if (false == addGC(eviTarget, j, gce, gcv)) {
+        sttmerr = STTMPARAMERR;
+        _DBG("ico_sttm_addGCD %d,>>%d<<, %d, %f",evId, (int)j, (int)gce, gcv);
+        return 0;
+    }
+    return evId;
+}
+
+extern "C" int ico_sttm_addGCS(int evId, GC_JOIN_E j, GC_OP_KIND_E gce,
+                                const char* gcv)
+{
+    sttmerr = STTMNOERROR;
+    if ((char*)0==gcv) {
+        sttmerr = STTMEVNOTFIND;
+        _DBG("ico_sttm_addGCS %d,%d, %d,>>nill<<",evId, (int)j, (int)gce);
+        return 0;
+    }
+    CicoEventInfo* eviTarget = getID2ObjEV(evId);
+    if ((CicoEventInfo*)0 == eviTarget) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addGCS >>%d<<,%d, %d, \"%s\"",evId, (int)j, (int)gce,
+             gcv);
+        return 0;
+    }
+    if (false == addGC(eviTarget, j, gce, gcv)) {
+        sttmerr = STTMPARAMERR;
+        _DBG("ico_sttm_addGCS %d,>>%d<<, %d, \"%s\"",evId, (int)j, (int)gce, gcv);
+        return 0;
+    }
+    return evId;
+}
+
+/**
+ * @brief ico_sttm_getStateMachineX
+ * @param smCWId stateMachine-object ID
+ * @param fname calling function Name
+ * @return not 0:get success 0:get fail
+ */
+CicoStateMachine* ico_sttm_getStateMachineX(int smCWId, const char* fname)
+{
+    CicoStateCore* cscTarget = getID2ObjSTT(smCWId); // ID to state-object
+    if ((CicoStateCore*)0 == cscTarget) {
+        sttmerr = STTMNOTFIND;
+        _DBG("%s >>%d<<",fname, smCWId);
+        return (CicoStateMachine*)0;
+    }
+    if (false == cscTarget->isStateMachine()) {
+        sttmerr = STTMTYPEMISMATCH;
+        _DBG("%s >>%d(%s:%d:%d)<<", fname, smCWId,
+             cscTarget->getName().c_str(), cscTarget->getValue(),
+             (int)cscTarget->getType());
+        return (CicoStateMachine*)0;
+    }
+    return (CicoStateMachine*)cscTarget;
+}
+
+/**
+ * @brief add guard condition
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param evname event name 
+ * @param ev event no.(Use the 1000-65535)
+ * @param j logical operator
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @return not 0:Success
+ * @       0:added failure
+ */
+
+CicoStateCore* getStateObject(int smCWId, int value, const char* fnc)
+{
+    CicoStateMachine* csm;
+    csm = ico_sttm_getStateMachineX(smCWId, fnc);
+    if ((CicoStateMachine*)0 == csm) {
+        sttmerr = STTMNOTFIND;
+        _DBG("%s>>%d<<, %d", fnc, smCWId, value);
+        return 0;
+    }
+    const CicoStateCore* csc = csm->getState(value);
+    if ((CicoStateCore*)0 == csc) {
+        sttmerr = STTMPARAMERR;
+        _DBG("%s %d,>>%d<<", fnc, smCWId, value);
+        return 0;
+    }
+    return (CicoStateCore*)csc;
+}
+
+
+CicoStateCore* getStateObject(int smCWId, const char* name, const char* fnc)
+{
+    CicoStateMachine* csm;
+    csm = ico_sttm_getStateMachineX(smCWId, fnc);
+    if ((CicoStateMachine*)0 == csm) {
+        sttmerr = STTMNOTFIND;
+        _DBG("%s>>%d<<, %s", fnc, smCWId, name);
+        return 0;
+    }
+    const CicoStateCore* csc = csm->getState(name);
+    if ((CicoStateCore*)0 == csc) {
+        sttmerr = STTMPARAMERR;
+        _DBG("%s %d,>>%s<<", fnc, smCWId, name);
+        return 0;
+    }
+    return (CicoStateCore*)csc;
+}
+
+
+CicoEventInfo* getEventInfoV(int smCWId, int value,
+                             const char* evname, unsigned short ev,
+                             const char* fnc)
+{
+    CicoStateCore* csc;
+    csc = getStateObject(smCWId, value, fnc);
+    if ((CicoStateCore*)0 == csc) {
+        return 0;
+    }
+    const CicoEventInfo* t = csc->getEventInfo(evname, ev);
+    if ((CicoEventInfo*)0 == t) {
+        sttmerr = STTMPARAMERR;
+        _DBG("%s %d, %d,>>%s, %d<<", fnc, smCWId, value, evname, ev);
+        return 0;
+    }
+    return (CicoEventInfo*)t;
+}
+
+
+CicoEventInfo* getEventInfoN(int smCWId, const char* name,
+                             const char* evname, unsigned short ev,
+                             const char* fnc)
+{
+    CicoStateCore* csc;
+    csc = getStateObject(smCWId, name, fnc);
+    if ((CicoStateCore*)0 == csc) {
+        return 0;
+    }
+    const CicoEventInfo* t = csc->getEventInfo(evname, ev);
+    if ((CicoEventInfo*)0 == t) {
+        sttmerr = STTMPARAMERR;
+        _DBG("%s %d, %s,>>%s, %d<<", fnc, smCWId, name, evname, ev);
+        return 0;
+    }
+    return (CicoEventInfo*)t;
+}
+
+
+/**
+ * @brief add guard condition
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param value value is state-object identification number
+ * @param evname event name 
+ * @param ev event no.(Use the 1000-65535)
+ * @param j logical operator
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @return not 0:Success
+ * @       0:added failure
+ */
+extern "C" int ico_sttm_addGCI_V(int smCWId, int value,
+                                 const char* evname, unsigned short ev,
+                                 GC_JOIN_E j, GC_OP_KIND_E gc, int gcv)
+{
+    sttmerr = STTMNOERROR;
+    const char* fnc = "ico_sttm_addGCI_V";
+    CicoEventInfo* t;
+    t = getEventInfoV(smCWId, value, evname, ev, fnc);
+    if ((CicoEventInfo*)0 == t) {
+        return 0;
+    }
+    if (false == addGC(t, j, gc, gcv)) {
+        sttmerr = STTMPARAMERR;
+        _DBG("%s %d, %d, %s, %d, >> %d, %d, %d<<", fnc, smCWId, value,
+             evname, ev, (int)j, (int)gc, gcv);
+        return 0;
+    }
+    return 1;
+}
+
+
+extern "C" int ico_sttm_addGCD_V(int smCWId, int value,
+                                 const char* evname, unsigned short ev,
+                                 GC_JOIN_E j, GC_OP_KIND_E gc, double gcv)
+{
+    sttmerr = STTMNOERROR;
+    const char* fnc = "ico_sttm_addGCD_V";
+    CicoEventInfo* t;
+    t = getEventInfoV(smCWId, value, evname, ev, fnc);
+    if ((CicoEventInfo*)0 == t) {
+        return 0;
+    }
+    if (false == addGC(t, j, gc, gcv)) {
+        sttmerr = STTMPARAMERR;
+        _DBG("%s %d, %d, %s, %d, >> %d, %d, %f<<", fnc, smCWId, value,
+             evname, ev, (int)j, (int)gc, gcv);
+        return 0;
+    }
+    return 1;
+}
+
+extern "C" int ico_sttm_addGCS_V(int smCWId, int value,
+                                 const char* evname, unsigned short ev,
+                                 GC_JOIN_E j, GC_OP_KIND_E gc, const char* gcv)
+{
+    sttmerr = STTMNOERROR;
+    const char* fnc = "ico_sttm_addGCS_V";
+    CicoEventInfo* t;
+    t = getEventInfoV(smCWId, value, evname, ev, fnc);
+    if ((CicoEventInfo*)0 == t) {
+        return 0;
+    }
+    if (false == addGC(t, j, gc, gcv)) {
+        sttmerr = STTMPARAMERR;
+        _DBG("%s %d, %d, %s, %d, >> %d, %d, %s<<", fnc, smCWId, value,
+             evname, ev, (int)j, (int)gc, gcv);
+        return 0;
+    }
+    return 1;
+}
+
+/**
+ * @brief add guard condition
+ * @param smVal value is stateMachine-object identification number
+ * @param value value is state-object identification number
+ * @param evname event name 
+ * @param ev event no.(Use the 1000-65535)
+ * @param j logical operator
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @return not 0:Success
+ * @       0:added failure
+ */
+extern "C" int ico_sttm_addGCIVV(int smVal, int value,
+                                 const char* evname, unsigned short ev,
+                                 GC_JOIN_E j, GC_OP_KIND_E gc, int gcv)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addGCIVV >>%d<<, %d, %s, %d, %d, %d, %d", smVal,
+             value, evname, ev, j, gc, gcv);
+        return 0;
+    }
+    return ico_sttm_addGCI_V(id, value, evname, ev, j, gc, gcv);
+}
+
+extern "C" int ico_sttm_addGCDVV(int smVal, int value,
+                                 const char* evname, unsigned short ev,
+                                 GC_JOIN_E j, GC_OP_KIND_E gc, double gcv)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addGCDVV >>%d<<, %d, %s, %d, %d, %d, %f", smVal,
+             value, evname, ev, j, gc, gcv);
+        return 0;
+    }
+    return ico_sttm_addGCD_V(id, value, evname, ev, j, gc, gcv);
+}
+
+extern "C" int ico_sttm_addGCSVV(int smVal, int value,
+                                 const char* evname, unsigned short ev,
+                                 GC_JOIN_E j, GC_OP_KIND_E gc, const char* gcv)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addGCSVV >>%d<<, %d, %s, %d, %d, %d, %s", smVal,
+             value, evname, ev, j, gc, gcv);
+        return 0;
+    }
+    return ico_sttm_addGCS_V(id, value, evname, ev, j, gc, gcv);
+}
+
+
+/**
+ * @brief add guard condition
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param name  name is state-object Identification name
+ * @param evname event name 
+ * @param ev event no.(Use the 1000-65535)
+ * @param j logical operator
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @return not 0:Success
+ * @       0:added failure
+ */
+extern "C" int ico_sttm_addGCI_N(int smCWId, const char* name,
+                                 const char* evname, unsigned short ev,
+                                 GC_JOIN_E j, GC_OP_KIND_E gc, int gcv)
+{
+    sttmerr = STTMNOERROR;
+    const char* fnc = "ico_sttm_addGCI_N";
+    CicoEventInfo* t;
+    t = getEventInfoN(smCWId, name, evname, ev, fnc);
+    if ((CicoEventInfo*)0 == t) {
+        return 0;
+    }
+    if (false == addGC(t, j, gc, gcv)) {
+        sttmerr = STTMPARAMERR;
+        _DBG("%s %d, %s, %s, %d, >> %d, %d, %d<<", fnc, smCWId, name,
+             evname, ev, (int)j, (int)gc, gcv);
+        return 0;
+    }
+    return 1;
+}
+
+extern "C" int ico_sttm_addGCD_N(int smCWId, const char* name,
+                                 const char* evname, unsigned short ev,
+                                 GC_JOIN_E j, GC_OP_KIND_E gc, double gcv)
+{
+    sttmerr = STTMNOERROR;
+    const char* fnc = "ico_sttm_addGCD_N";
+    CicoEventInfo* t;
+    t = getEventInfoN(smCWId, name, evname, ev, fnc);
+    if ((CicoEventInfo*)0 == t) {
+        return 0;
+    }
+    if (false == addGC(t, j, gc, gcv)) {
+        sttmerr = STTMPARAMERR;
+        _DBG("%s %d, %s, %s, %d, >> %d, %d, %f<<", fnc, smCWId, name,
+             evname, ev, (int)j, (int)gc, gcv);
+        return 0;
+    }
+    return 1;
+}
+
+
+extern "C" int ico_sttm_addGCS_N(int smCWId, const char* name,
+                                 const char* evname, unsigned short ev,
+                                 GC_JOIN_E j, GC_OP_KIND_E gc, const char* gcv)
+{
+    sttmerr = STTMNOERROR;
+    const char* fnc = "ico_sttm_addGCS_N";
+    CicoEventInfo* t;
+    t = getEventInfoN(smCWId, name, evname, ev, fnc);
+    if ((CicoEventInfo*)0 == t) {
+        return 0;
+    }
+    if (false == addGC(t, j, gc, gcv)) {
+        sttmerr = STTMPARAMERR;
+        _DBG("%s %d, %s, %s, %d, >> %d, %d, %s<<", fnc, smCWId, name,
+             evname, ev, (int)j, (int)gc, gcv);
+        return 0;
+    }
+    return 1;
+}
+
+/**
+ * @brief add guard condition
+ * @param smNm stateMachine-object Identification name
+ * @param name  name is state-object Identification name
+ * @param evname event name 
+ * @param ev event no.(Use the 1000-65535)
+ * @param j logical operator
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @return not 0:Success
+ * @       0:added failure
+ */
+extern "C" int ico_sttm_addGCINN(const char* smNm, const char* name,
+                                 const char* evname, unsigned short ev,
+                                 GC_JOIN_E j, GC_OP_KIND_E gc, int gcv)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addGCINN >>%s<<, %s, %s, %d, %d, %d, %d", smNm, 
+             name, evname, ev, j,  gc, gcv);
+        return 0;
+    }
+    return ico_sttm_addGCI_N(id, name, evname, ev, j,  gc, gcv);
+}
+
+extern "C" int ico_sttm_addGCDNN(const char* smNm, const char* name,
+                                 const char* evname, unsigned short ev,
+                                 GC_JOIN_E j, GC_OP_KIND_E gc, double gcv)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addGCDNN >>%s<<, %s, %s, %d, %d, %d, %f", smNm, 
+             name, evname, ev, j,  gc, gcv);
+        return 0;
+    }
+    return ico_sttm_addGCD_N(id, name, evname, ev, j,  gc, gcv);
+}
+
+extern "C" int ico_sttm_addGCSNN(const char* smNm, const char* name,
+                                 const char* evname, unsigned short ev,
+                                 GC_JOIN_E j, GC_OP_KIND_E gc, const char* gcv)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addGCSNN >>%s<<, %s, %s, %d, %d, %d, %s", smNm, 
+             name, evname, ev, j,  gc, gcv);
+        return 0;
+    }
+    return ico_sttm_addGCS_N(id, name, evname, ev, j,  gc, gcv);
+}
+
+/**
+ * @brief callback call entryAction/exitAction/doAction
+ * @param ev callback function parameter(trigger event)
+ * @param sCWId callback function parameter
+ * @param fnc callback function
+ */
+extern "C" {
+    void callbackActionC(st_event* ev, int sCWId, void* vfnc)
+    {
+        void (*fnc)(st_event*, int) = (void (*)(st_event*, int))vfnc;
+        fnc(ev, sCWId);
+    }
+}
+
+/**
+ * @breif callback action for c++ 
+ * @param ev trigger event
+ * @param state-objects the action occurred
+ */
+void callbackActionCPP(const CicoEvent& ev, const CicoStateCore* stt, int vec)
+{
+    int sz = callbackFnc.size();
+    if ((1 > vec) || (sz < vec)) {
+        return;
+    }
+
+    int sCWId = getObjSTT2ID(stt);
+    if (0 == sCWId) {                   // state-objects outside the control
+        return;                         //
+    }
+
+    st_event stev;
+    stev.ev = ev.getEV();
+
+    CicoEvent::E_TOV tov = ev.getVTG();
+    if ( CicoEvent::EEvtGCInt == tov) {
+        stev.uk = E_NUMBER;
+        stev.u.i = ev.getGCVi();
+    }
+    else if (CicoEvent::EEvtGCDouble == tov) {
+        stev.uk = E_DOUBLE;
+        stev.u.d = ev.getGCVd();
+    }
+    else if (CicoEvent::EEvtGCStr == tov) {
+        stev.uk = E_STRING;
+        stev.u.s = ev.getGCVs().c_str();
+    }
+    else {
+        stev.uk = E_NONE;
+    }
+    stev.v = ev.getAdVal();
+
+    callbackActionC(&stev, sCWId, callbackFnc[vec-1]);
+    return;
+}
+
+#ifndef CWAPPERCALLBACKACTION_H
+#define CWAPPERCALLBACKACTION_H
+/**
+ * C Wrapper call back CicoStateAction
+ */
+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,
+                  int addval);
+    // exit-Action
+    void onExit(const CicoEvent& ev, const CicoState* stt, int addval);
+    void onExit(const CicoEvent& ev, const CicoHistoryState* stt, int addval);
+
+    // doAction
+    void onDo(const CicoEvent& ev, const CicoState* stt, int addval);
+};
+#endif  // CWAPPERCALLBACKACTION_H
+
+/**
+ * @brief cnstractor
+ */
+CicoCWrapperCallbackAction::CicoCWrapperCallbackAction()
+{
+}
+
+/**
+ * @brief entry Action callback
+ * @param ev trigger event data
+ * @param stt entery state-object
+ * @param addval Additional information
+ */
+void CicoCWrapperCallbackAction::onEnttry(const CicoEvent& ev,
+                                          const CicoState* stt, int addval)
+{
+    callbackActionCPP(ev, (CicoStateCore*)stt, addval);
+}
+
+void CicoCWrapperCallbackAction::onEnttry(const CicoEvent& ev,
+                                          const CicoFinalState* stt, int addval)
+{
+    callbackActionCPP(ev, (CicoStateCore*)stt, addval);
+}
+
+void CicoCWrapperCallbackAction::onEnttry(const CicoEvent& ev,
+                                          const CicoHistoryState* stt, int addval)
+{
+    callbackActionCPP(ev, (CicoStateCore*)stt, addval);
+}
+
+/**
+ * @brief exit Action callback
+ * @param ev trigger event data
+ * @param stt exit state-object
+ * @param addval Additional information
+ */
+void CicoCWrapperCallbackAction::onExit(const CicoEvent& ev,
+                                        const CicoState* stt, int addval)
+{
+    callbackActionCPP(ev, (CicoStateCore*)stt, addval);
+}
+
+void CicoCWrapperCallbackAction::onExit(const CicoEvent& ev,
+                                        const CicoHistoryState* stt, int addval)
+{
+    callbackActionCPP(ev, (CicoStateCore*)stt, addval);
+}
+
+/**
+ * @brief do Action callback
+ * @param ev trigger event data
+ * @param stt active state-object
+ * @param addval Additional information
+ */
+void CicoCWrapperCallbackAction::onDo(const CicoEvent& ev,
+                                      const CicoState* stt, int addval)
+{
+    callbackActionCPP(ev, (CicoStateCore*)stt, addval);
+}
+
+/**
+ * Declaration of the class CicoCWrapperCallbackAction
+ */
+CicoCWrapperCallbackAction cWprActn;
+
+
+/* registration entry-Action,exit-Action,do-action callback */
+/**
+ * @brief Callback registration
+ * @param sCWId ID no. to be registered(c-wrapper local ID)
+ * @param fanc callback function
+ * @return not 0:Success 
+ * @       0:Failure
+ */
+extern "C" int ico_sttm_addEntryAction(int sCWId, void (*fnc)(st_event*, int))
+{
+    sttmerr = STTMNOERROR;
+    CicoStateCore* csc = getID2ObjSTT(sCWId); // ID to state-object
+    if ((CicoStateCore*)0 == csc) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addEntryAction >>%d<<, fnc", sCWId);
+        return 0;
+    }
+    if (0 == fnc) {
+        sttmerr = STTMPARAMERR;
+        _DBG("ico_sttm_addEntryAction %d,>>fnc(0x0)<<", sCWId);
+        return 0;
+    }
+
+    callbackFnc.push_back((void*)fnc);
+    int addval = callbackFnc.size();
+
+    if (true == csc->isState()) {
+        CicoState* cs = (CicoState*)csc;
+        cs->addEntryAction((CicoStateAction*)&cWprActn, addval);
+    }
+    else if (true == csc->isFinalState()) {
+        CicoFinalState* cfs = (CicoFinalState*)csc;
+        cfs->addEntryAction((CicoStateAction*)&cWprActn, addval);
+    }
+    else if (true == csc->isHistoryState()) {
+        CicoHistoryState* chs = (CicoHistoryState*)csc;
+        chs->addEntryAction((CicoStateAction*)&cWprActn, addval);
+    }
+    else {
+        sttmerr = STTMTYPEMISMATCH;
+        _DBG("ico_sttm_addEntryAction >>%d(%s:%d:%d)<<,fnc", sCWId,
+             csc->getName().c_str(), csc->getValue(), (int)csc->getType());
+        return 0;
+    }
+    return sCWId;
+}
+
+
+extern "C" int ico_sttm_addExitAction(int sCWId, void (*fnc)(st_event*, int))
+{
+    sttmerr = STTMNOERROR;
+    CicoStateCore* csc = getID2ObjSTT(sCWId); // ID to state-object
+    if ((CicoStateCore*)0 == csc) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addExitAction >>%d<<, fnc", sCWId);
+        return 0;
+    }
+    if (0 == fnc) {
+        sttmerr = STTMPARAMERR;
+        _DBG("ico_sttm_addExitAction %d,>>fnc(0x0)<<", sCWId);
+        return 0;
+    }
+
+    callbackFnc.push_back((void*)fnc);
+    int addval = callbackFnc.size();
+
+    if (true == csc->isState()) {
+        CicoState* cs = (CicoState*)csc;
+        cs->addExitAction((CicoStateAction*)&cWprActn, addval);
+    }
+    else if (true == csc->isHistoryState()) {
+        CicoHistoryState* chs = (CicoHistoryState*)csc;
+        chs->addExitAction((CicoStateAction*)&cWprActn, addval);
+    }
+    else {
+        sttmerr = STTMTYPEMISMATCH;
+        _DBG("ico_sttm_addExitAction >>%d(%s:%d:%d)<<,fnc", sCWId,
+             csc->getName().c_str(), csc->getValue(), (int)csc->getType());
+        return 0;
+    }
+    return sCWId;
+}
+
+
+extern "C" int ico_sttm_addDoAction(int sCWId, void (*fnc)(st_event*, int))
+{
+    sttmerr = STTMNOERROR;
+    CicoStateCore* csc = getID2ObjSTT(sCWId); // ID to state-object
+    if ((CicoStateCore*)0 == csc) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addDoAction >>%d<<, fnc", sCWId);
+        return 0;
+    }
+    if (0 == fnc) {
+        sttmerr = STTMPARAMERR;
+        _DBG("ico_sttm_addDoAction %d,>>fnc(0x0)<<", sCWId);
+        return 0;
+    }
+
+    callbackFnc.push_back((void*)fnc);
+    int addval = callbackFnc.size();
+
+    if (true == csc->isState()) {
+        CicoState* cs = (CicoState*)csc;
+        cs->addDoAction((CicoStateAction*)&cWprActn, addval);
+    }
+    else {
+        sttmerr = STTMTYPEMISMATCH;
+        _DBG("ico_sttm_addDoAction >>%d(%s:%d:%d)<<,fnc", sCWId,
+             csc->getName().c_str(), csc->getValue(), (int)csc->getType());
+        return 0;
+    }
+    return sCWId;
+}
+
+/**
+ * @brief Callback registration
+ * @param smCWId ID no. to eb registered stateMachine-object(c-wrapper local ID)
+ * @param value value is state-object identification number
+ * @param fanc callback function
+ * @return not 0:Success 
+ * @       0:added Failure
+ */
+extern "C" int ico_sttm_addEntryAction_V(int smCWId, int value,
+                                         void (*fnc)(st_event* ev, int sCWId))
+{
+    sttmerr = STTMNOERROR;
+    int lid = ico_sttm_retrieveSVal(smCWId, value);
+    if (0 == lid) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addEntryAction_V >>%d<<,>>%d<<, .", smCWId, value);
+        return 0;
+    }
+    return ico_sttm_addEntryAction(lid, fnc);
+}
+
+extern "C" int ico_sttm_addExitAction_V(int smCWId, int value,
+                                        void (*fnc)(st_event* ev, int sCWId))
+{
+    sttmerr = STTMNOERROR;
+    int lid = ico_sttm_retrieveSVal(smCWId, value);
+    if (0 == lid) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addExitAction_V >>%d<<,>>%d<<, .", smCWId, value);
+        return 0;
+    }
+    return ico_sttm_addExitAction(lid, fnc);
+}
+
+extern "C" int ico_sttm_addDoAction_V(int smCWId, int value,
+                                      void (*fnc)(st_event* ev, int sCWId))
+{
+    sttmerr = STTMNOERROR;
+    int lid = ico_sttm_retrieveSVal(smCWId, value);
+    if (0 == lid) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addDoAction_V >>%d<<,>>%d<<, .", smCWId, value);
+        return 0;
+    }
+    return ico_sttm_addDoAction(lid, fnc);
+}
+
+/**
+ * @brief Callback registration
+ * @param smVal value is stateMachine-object identification number
+ * @param value value is state-object identification number
+ * @param fanc callback function
+ * @return not 0:Success 
+ * @       0:added Failure
+ */
+extern "C" int ico_sttm_addEntryActionVV(int smVal, int value,
+                                         void (*fnc)(st_event* ev, int sCWId))
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addEntryActionVV >>%d<<, %d, .", smVal, value);
+        return 0;
+    }
+    return ico_sttm_addEntryAction_V(id, value, fnc);
+}
+
+extern "C" int ico_sttm_addExitActionVV(int smVal, int value,
+                                        void (*fnc)(st_event* ev, int sCWId))
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addExitActionVV >>%d<<, %d, .", smVal, value);
+        return 0;
+    }
+    return ico_sttm_addExitAction_V(id, value, fnc);
+}
+
+extern "C" int ico_sttm_addDoActionVV(int smVal, int value,
+                                      void (*fnc)(st_event* ev, int sCWId))
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addDoActionVV >>%d<<, %d, .", smVal, value);
+        return 0;
+    }
+    return ico_sttm_addDoAction_V(id, value, fnc);
+}
+
+
+/**
+ * @brief Callback registration
+ * @param smCWId ID no. to eb registered stateMachine-object(c-wrapper local ID)
+ * @param name  name is state-object Identification name
+ * @param fanc callback function
+ * @return not 0:Success 
+ * @       0:added Failure
+ */
+extern "C" int ico_sttm_addEntryAction_N(int smCWId, const char* name,
+                                         void (*fnc)(st_event* ev, int sCWId))
+{
+    int lid = ico_sttm_retrivevSName(smCWId, name);
+    if (0 == lid) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addEntryAction_N >>%d<<,>>%s<<, .", smCWId, name);
+        return 0;
+    }
+    return ico_sttm_addEntryAction(lid, fnc);
+}
+
+extern "C" int ico_sttm_addExitAction_N(int smCWId, const char* name,
+                                        void (*fnc)(st_event* ev, int sCWId))
+{
+    int lid = ico_sttm_retrivevSName(smCWId, name);
+    if (0 == lid) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addExitAction_N >>%d<<,>>%s<<, .", smCWId, name);
+        return 0;
+    }
+    return ico_sttm_addExitAction(lid, fnc);
+}
+
+extern "C" int ico_sttm_addDoAction_N(int smCWId, const char* name,
+                                      void (*fnc)(st_event* ev, int sCWId))
+{
+    int lid = ico_sttm_retrivevSName(smCWId, name);
+    if (0 == lid) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addDoAction_N >>%d<<,>>%s<<, .", smCWId, name);
+        return 0;
+    }
+    return ico_sttm_addDoAction(lid, fnc);
+}
+
+/**
+ * @brief Callback registration
+ * @param smNm stateMachine-object Identification name
+ * @param name  name is state-object Identification name
+ * @param fanc callback function
+ * @return not 0:Success 
+ * @       0:added Failure
+ */
+extern "C" int ico_sttm_addEntryActionNN(const char* smNm, const char* name,
+                                         void (*fnc)(st_event* ev, int sCWId))
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addEntryActionNN >>%s<<, %s, .", smNm, name);
+        return 0;
+    }
+    return ico_sttm_addEntryAction_N(id, name, fnc);
+}
+
+extern "C" int ico_sttm_addExitActionNN(const char* smNm, const char* name,
+                                        void (*fnc)(st_event* ev, int sCWId))
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addExitActionNN >>%s<<, %s, .", smNm, name);
+        return 0;
+    }
+    return ico_sttm_addExitAction_N(id, name, fnc);
+}
+
+extern "C" int ico_sttm_addDoActionNN(const char* smNm, const char* name,
+                                      void (*fnc)(st_event* ev, int sCWId))
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addDoActionNN >>%s<<, %s, .", smNm, name);
+        return 0;
+    }
+    return ico_sttm_addDoAction_N(id, name, fnc);
+}
+
+
+/**
+ * @brief Registration at the time of termination detection transition destination
+ * @param sCWId ID no. to be registered(c-wrapper local ID)
+ * @param trCWId finish transition destination(c-wrapper local ID)
+ * @return not 0:Success
+ * @       0:set Failure
+ */
+extern "C" int ico_sttm_setFinishTransition(int sCWId, int trCWId)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateCore* cscTarget = getID2ObjSTT(sCWId); // ID to state-object
+    if ((CicoStateCore*)0 == cscTarget) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_setFinishTransition >>%d<<, %d", sCWId, trCWId);
+        return 0;
+    }
+    CicoStateCore* cscTrans = getID2ObjSTT(trCWId); // ID to state-object
+    if ((CicoStateCore*)0 == cscTrans) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_setFinishTransition %d,>>%d<<", sCWId, trCWId);
+        return 0;
+    }
+    if (false == cscTarget->isState()) {
+        sttmerr = STTMTYPEMISMATCH;
+        _DBG("ico_sttm_setFinishTransition >>%d(%s:%d:%d)<<, %d", sCWId,
+             cscTarget->getName().c_str(), cscTarget->getValue(),
+             (int)cscTarget->getType(), trCWId);
+        return 0;
+    }
+    CicoState* cs = (CicoState*) cscTarget;
+    if (true == cscTrans->isState()) {
+        cs->setFinishTransition((CicoState*)cscTrans);
+    }
+    else if (true == cscTrans->isFinalState()) {
+        cs->setFinishTransition((CicoFinalState*)cscTrans);
+    }
+    else if (true == cscTrans->isHistoryState()) {
+        cs->setFinishTransition((CicoHistoryState*)cscTrans);
+    }
+    else {
+        sttmerr = STTMTYPEMISMATCH;
+        _DBG("ico_sttm_setFinishTransition %d,>>%d(%s:%d:%d)<<", sCWId,
+             trCWId, cscTarget->getName().c_str(),
+             cscTarget->getValue(), (int)cscTarget->getType());
+        return 0;
+    }
+    return sCWId;
+}
+
+/**
+ * @brief Registration at the time of termination detection transition destination
+ * @param smCWId ID no. to eb registered stateMachine-object(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param value value is state-object identification number
+ * @param trCWId finish transition destination(c-wrapper local ID)
+ * @param trVl value is state-object identification number transition destination
+ * @return not 0:Success
+ * @       0:set Failure
+ */
+extern "C" int ico_sttm_setFinishTransition_V_(int smCWId, int value,
+                                               int trCWId)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveSVal(smCWId, value);
+    if (0 == id) {
+        _DBG("ico_sttm_setFinishTransition_V_ >> %d, %d<<, %d",smCWId, value, trCWId);
+        return 0;
+    }
+    return ico_sttm_setFinishTransition(id, trCWId);
+}
+
+extern "C" int ico_sttm_setFinishTransition_VV(int smCWId, int value,
+                                               int trVl)
+{
+    sttmerr = STTMNOERROR;
+    int idT = ico_sttm_retrieveSVal(smCWId, trVl);
+    if (0 == idT) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_setFinishTransition_VV >>%d<<, %d,>>%d<<",smCWId, value, trVl);
+        return 0;
+    }
+    return ico_sttm_setFinishTransition_V_(smCWId, value, idT);
+}
+
+extern "C" int ico_sttm_setFinishTransitionVVV(int smVal, int value, int trVl)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_setFinishTransitionVVV >>%d<<, %d, %d", smVal,
+             value, trVl);
+        return 0;
+    }
+    return ico_sttm_setFinishTransition_VV(id, value, trVl);
+}
+
+
+/**
+ * @brief Registration at the time of termination detection transition destination
+ * @param smCWId ID no. to eb registered stateMachine-object(c-wrapper local ID)
+ * @param name  name is state-object Identification name
+ * @param trCWId finish transition destination(c-wrapper local ID)
+ * @return not 0:Success
+ * @       0:set Failure
+ */
+extern "C" int ico_sttm_setFinishTransition_N_(int smCWId, const char* name,
+                                               int trCWId)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrivevSName(smCWId, name);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_setFinishTransition_N_ >>%d, %s<<, %d",smCWId, name, trCWId);
+        return 0;
+    }
+    return ico_sttm_setFinishTransition(id, trCWId);
+}
+
+extern "C" int ico_sttm_setFinishTransition_NN(int smCWId, const char* name,
+                                               const char* trNm)
+{
+    sttmerr = STTMNOERROR;
+    int idT = ico_sttm_retrivevSName(smCWId, trNm);
+    if (0 == idT) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_setFinishTransition_NN >>%d<<, %s,>>%s<<",smCWId,
+             name, trNm);
+        return 0;
+    }
+    return ico_sttm_setFinishTransition_N_(smCWId, name, idT);
+}
+
+extern "C" int ico_sttm_setFinishTransitionNNN(const char* smNm,
+                                               const char* name,
+                                               const char* trNm)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_setFinishTransitionNNN >>%s<<, %s, %s", smNm, name,
+             trNm);
+        return 0;
+    }
+    return ico_sttm_setFinishTransition_NN(id, name, trNm);
+
+}
+
+
+/**
+ * @brief Registration of default history state-objectss
+ * @param sCWId ID no. to be registered(c-wrapper local ID)
+ * @param dfCWId  default transition destination(c-wrapper local ID)
+ * @return not 0:Success
+ * @       0:added Failure
+ */
+extern "C" int ico_sttm_addDefault(int sCWId, int dfCWId)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateCore* cscTarget = getID2ObjSTT(sCWId); // ID to state-object
+    if ((CicoStateCore*)0 == cscTarget) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addDefault >>%d<<, %d", sCWId, dfCWId);
+        return 0;
+    }
+    CicoStateCore* cscDef = getID2ObjSTT(dfCWId); // ID to state-object
+    if ((CicoStateCore*)0 == cscDef) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addDefault %d,>>%d<<", sCWId, dfCWId);
+        return 0;
+    }
+    if (false == cscTarget->isHistoryState()) {
+        sttmerr = STTMTYPEMISMATCH;
+        _DBG("ico_sttm_addDefault >>%d(%s:%d:%d)<<, %d", sCWId,
+             cscTarget->getName().c_str(), cscTarget->getValue(),
+             (int)cscTarget->getType(), dfCWId);
+        return 0;
+    }
+    CicoHistoryState* chs = (CicoHistoryState*) cscTarget;
+    if (true == cscDef->isState()) {
+        chs->addDefaultState((CicoState*)cscDef);
+    }
+    else {
+        sttmerr = STTMTYPEMISMATCH;
+        _DBG("ico_sttm_addDefault %d,>>%d(%s:%d:%d)<<", sCWId,
+             dfCWId, cscTarget->getName().c_str(),
+             cscTarget->getValue(), (int)cscTarget->getType());
+        return 0;
+    }
+    return sCWId;
+}
+
+/**
+ * @brief Registration of default history state-objectss
+ * @param smCWId ID no. to eb registered stateMachine-object(c-wrapper local ID)
+ * @param value value is state-object identification number
+ * @param dfCWId  default transition destination(c-wrapper local ID)
+ * @param dfVal value is state-object identification number
+ * @return not 0:Success
+ * @       0:added Failure
+ */
+extern "C" int ico_sttm_addDefault_V_(int smCWId, int value, int dfCWId)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveSVal(smCWId, value);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addDefaultV >>%d, %d<<, %d", smCWId, value, dfCWId);
+        return 0;
+    }
+    return ico_sttm_addDefault(id, dfCWId);
+}
+
+extern "C" int ico_sttm_addDefault_VV(int smCWId, int value, int dfVal)
+{
+    sttmerr = STTMNOERROR;
+    int dfCWId = ico_sttm_retrieveSVal(smCWId, dfVal);
+    if (0 == dfCWId) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addDefaultVV >>%d<<, %d,>>%d<<", smCWId, value, dfVal);
+        return 0;
+    }
+    return ico_sttm_addDefault_V_(smCWId, value, dfCWId);
+}
+
+extern "C" int ico_sttm_addDefaultVVV(int smVal, int value, int dfVal)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addDefaultVVV >>%d<<, %d,>>%d<<", smVal, value,
+             dfVal);
+        return 0;
+    }
+    return ico_sttm_addDefault_VV(id, value, dfVal);
+}
+
+/**
+ * @brief Registration of default history state-objectss
+ * @param smCWId ID no. to eb registered stateMachine-object(c-wrapper local ID)
+ * @param name  name is state-object Identification name
+ * @param dfCWId  default transition destination(c-wrapper local ID)
+ * @param dfNm  name is state-object Identification name
+ * @return not 0:Success
+ * @       0:added Failure
+ */
+extern "C" int ico_sttm_addDefault_N_(int smCWId, const char* name, int dfCWId)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrivevSName(smCWId, name);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addDefault_N_ >>%d, %s<<, %d",smCWId, name, dfCWId);
+        return 0;
+    }
+    return ico_sttm_addDefault(id, dfCWId);
+}
+
+extern "C" int ico_sttm_addDefault_NN(int smCWId, const char* name, const char* dfNm)
+{
+    sttmerr = STTMNOERROR;
+    int idD = ico_sttm_retrivevSName(smCWId, dfNm);
+    if (0 == idD) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addDefault_NN >>%d<<, %s,>>%s<<", smCWId, name, dfNm);
+        return 0;
+    }
+    return ico_sttm_addDefault_N_(smCWId, name, idD);
+}
+
+extern "C" int ico_sttm_addDefaultNNN(const char* smNm, const char* name,
+                                      const char* dfNm)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addDefaultNNN >>%s<<, %s, %s", smNm, name, dfNm);
+        return 0;
+    }
+    return ico_sttm_addDefault_NN(id, name, dfNm);
+}
+
+/**
+ * @breif Registration of start position state-objects
+ * @param ID stateMachine-object/state-object ID no.(c-wrapper local ID)
+ * @param sCWId start position state-object ID no.(c-wrapper local ID)
+ * @return not 0:Success
+ * @       0:add failure
+ */
+extern "C" int ico_sttm_addStartPosition(int CWId, int sCWId)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateCore* cscTarget = getID2ObjSTT(CWId); // ID to state-object
+    if ((CicoStateCore*)0 == cscTarget) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_setStartPosition >>%d<<, %d", CWId, sCWId);
+        return 0;
+    }
+    CicoStateCore* cscIni = getID2ObjSTT(sCWId); // ID to state-object
+    if ((CicoStateCore*)0 == cscIni) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_setStartPosition %d,>>%d<<", CWId, sCWId);
+        return 0;
+    }
+    CicoState* cs = (CicoState*)0;
+    CicoHistoryState* chs = (CicoHistoryState*)0;
+    if (true == cscIni->isState()) {
+        cs = (CicoState*)cscIni;
+    }
+    else if (true == cscIni->isHistoryState()) {
+        chs = (CicoHistoryState*)cscIni;
+    }
+    else {
+        sttmerr = STTMTYPEMISMATCH;
+        _DBG("ico_sttm_setStartPosition %d,>>%d(%s:%d:%d)<<", CWId, sCWId,
+             cscIni->getName().c_str(), cscIni->getValue(),
+             (int)cscIni->getType());
+        return 0;
+    }
+    if (true == cscTarget->isStateMachine()) {
+        CicoStateMachine* csm = (CicoStateMachine*)cscTarget;
+        if ((CicoState*)0 != cs) {
+            csm->addInitState(cs);
+        }
+        else {
+            csm->addInitState(chs);
+        }
+    }
+    else if (true == cscTarget->isState()) {
+        CicoState* csT = (CicoState*)cscTarget;
+        if ((CicoState*)0 != cs) {
+            csT->addInitState(cs);
+        }
+        else {
+            csT->addInitState(chs);
+        }
+    }
+    else {
+        sttmerr = STTMTYPEMISMATCH;
+        _DBG("ico_sttm_setStartPosition >>%d(%s:%d:%d)<<, %d", CWId,
+             cscTarget->getName().c_str(), cscTarget->getValue(),
+             (int)cscTarget->getType(), sCWId);
+        return 0;
+    }
+    return CWId;
+}
+
+
+
+/**
+ * @breif Registration of start position state-objects
+ * @param smCWId ID no. to eb registered stateMachine-object(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param value value is state-object identification number
+ * @param sCWId start position state-object ID no.(c-wrapper local ID)
+ * @param value spVal is state-object identification number
+ * @return not 0:Success
+ * @       0:set failure
+ */
+extern "C" int ico_sttm_addStartPosition_V_(int smCWId, int value, int sCWId)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveSVal(smCWId, value);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addStartPosition_V_ >>%d, %d<<, %d",smCWId, value, sCWId);
+        return 0;
+    }
+    return ico_sttm_addStartPosition(id, sCWId);
+}
+
+
+extern "C" int ico_sttm_addStartPosition_VV(int smCWId, const int value, int spVal)
+{
+    sttmerr = STTMNOERROR;
+    int idSP = ico_sttm_retrieveSVal(smCWId, spVal);
+    if (0 == idSP) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addStartPosition_VV >>%d<<, %d,>>%d<<",smCWId, value, spVal);
+        return 0;
+    }
+    return ico_sttm_addStartPosition_V_(smCWId, value, idSP);
+}
+
+extern "C" int ico_sttm_addStartPositionVVV(int smVal, int value, int spVal)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addStartPositionVVV >>%d<<, %d, %d", smVal, value,
+             spVal);
+        return 0;
+    }
+    return ico_sttm_addStartPosition_VV(id, value, spVal);
+}
+
+extern "C" int ico_sttm_addStartPositionSMVV(int smVal, int spVal)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addStartPositionSMVV >>%d<<, %d", smVal, spVal);
+        return 0;
+    }
+    int idSP = ico_sttm_retrieveSVal(id, spVal);
+    if (0 == idSP) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addStartPositionSMVV %d,>>%d<<",smVal, spVal);
+        return 0;
+    }
+    return ico_sttm_addStartPosition(id, idSP);
+}
+
+
+/**
+ * @breif Registration of start position state-objects
+ * @param smCWId ID no. to eb registered stateMachine-object(c-wrapper local ID)
+ * @param name  name is state-object Identification name
+ * @param sCWId start position state-object ID no.(c-wrapper local ID)
+ * @param name  spNm is state-object Identification name
+ * @return not 0:Success
+ * @       0:set failure
+ */
+extern "C" int ico_sttm_addStartPosition_N_(int smCWId, const char* name, int sCWId)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrivevSName(smCWId, name);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addStartPosition_N_ >>%d, %s<<, %d",smCWId, name, sCWId);
+        return 0;
+    }
+    return ico_sttm_addStartPosition(id, sCWId);
+}
+
+extern "C" int ico_sttm_addStartPosition_NN(int smCWId, const char* name,
+                                            const char*  spNm)
+{
+    sttmerr = STTMNOERROR;
+    int idSP = ico_sttm_retrivevSName(smCWId, spNm);
+    if (0 == idSP) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addStartPosition_NN >>%d<<, %s,>>%s<<",smCWId, name,
+             spNm);
+        return 0;
+    }
+    return ico_sttm_addStartPosition_N_(smCWId, name, idSP);
+}
+
+extern "C" int ico_sttm_addStartPositionNNN(const char* smNm, const char* name,
+                                            const char* spNm)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addStartPositionNNN >>%s<<, %s, %s", smNm, name,
+             spNm);
+        return 0;
+    }
+    return ico_sttm_addStartPosition_NN(id, name, spNm);
+}
+
+extern "C" int ico_sttm_addStartPositionSMNN(const char* smNm, const char* spNm)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addStartPositionSMNN >>%s<<, %s", smNm, spNm);
+        return 0;
+    }
+    int idSP = ico_sttm_retrivevSName(id, spNm);
+    if (0 == idSP) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_addStartPositionSMNN %s,>>%s<<",smNm, spNm);
+        return 0;
+    }
+    return ico_sttm_addStartPosition(id, idSP);
+}
+
+
+/* Operational system */
+/**
+ * @breif start stateMachine
+ * @param smCWId stateMachine-object ID no. to be registered(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param smNm stateMachine-object Identification name
+ * @return not 0:Success
+ * @       0:start Failure
+ */
+extern "C" int ico_sttm_start(int smCWId)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateMachine* csm = ico_sttm_getStateMachineX(smCWId, "ico_sttm_start");
+    if ((CicoStateMachine*)0 == csm) {
+        return 0;
+    }
+    return csm->start()? smCWId:0;
+}
+
+
+
+extern "C" int ico_sttm_startV(int smVal)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_startV >>%d<<", smVal);
+        return 0;
+    }
+    return ico_sttm_start(id);
+}
+
+extern "C" int ico_sttm_startN(const char* smNm)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_startN >>%s<<", smNm);
+        return 0;
+    }
+    return ico_sttm_start(id);
+}
+
+/**
+ * @breif stop stateMachine
+ * @param smCWId stateMachine-object ID no. to be registered(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param smNm stateMachine-object Identification name
+ * @return not 0:Success
+ * @       0:stop Failure
+ */
+extern "C" int ico_sttm_stop(int smCWId)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateMachine* csm = ico_sttm_getStateMachineX(smCWId, "ico_sttm_stop");
+    if ((CicoStateMachine*)0 == csm) {
+        return 0;
+    }
+    return csm->stop()? smCWId:0;
+}
+
+extern "C" int ico_sttm_stopV(int smVal)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_stopV >>%d<<", smVal);
+        return 0;
+    }
+    return ico_sttm_stop(id);
+}
+
+extern "C" int ico_sttm_stopN(const char* smNm)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_stopN >>%s<<", smNm);
+        return 0;
+    }
+    return ico_sttm_stop(id);
+}
+
+bool ico_sttm_eventX(int smCWId, CicoEvent& ev, const char* fname)
+{
+    CicoStateMachine* csm = ico_sttm_getStateMachineX(smCWId, fname);
+    if ((CicoStateMachine*)0 == csm) {
+        return 0;
+    }
+    return csm->eventEntry(ev);
+}
+
+/**
+ * @brief Issue an event
+ * @param smCWId stateMachine-object ID no. to be registered(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param smNm stateMachine-object Identification name
+ * @param ev event No.(Use the 1000-65535)
+ * @param gcv Comparison value of guard condition
+ * @param info Additional information user
+ * @return not 0:Success on Transition
+ * @       0: none Transition
+ */
+extern "C" int ico_sttm_event(int smCWId, unsigned short ev, void* info)
+{
+    sttmerr = STTMNOERROR;
+    CicoEvent oev(ev, info);
+    return ico_sttm_eventX(smCWId, oev, "ico_sttm_event")? smCWId:0;
+}
+
+extern "C" int ico_sttm_eventGCI(int smCWId, unsigned short ev, int gcv, void* info)
+{
+    sttmerr = STTMNOERROR;
+    CicoEvent oev(ev, gcv, info);
+    return ico_sttm_eventX(smCWId, oev, "ico_sttm_eventGCI")? smCWId:0;
+}
+
+extern "C" int ico_sttm_eventGCD(int smCWId, unsigned short ev, double gcv, void* info)
+{
+    sttmerr = STTMNOERROR;
+    CicoEvent oev(ev, gcv, info);
+    return ico_sttm_eventX(smCWId, oev, "ico_sttm_eventGCD")? smCWId:0;
+}
+
+extern "C" int ico_sttm_eventGCS(int smCWId, unsigned short ev, const char* gcv, void* info)
+{
+    sttmerr = STTMNOERROR;
+    CicoEvent oev(ev, gcv, info);
+    return ico_sttm_eventX(smCWId, oev, "ico_sttm_eventGCS")? smCWId:0;
+}
+
+extern "C" int ico_sttm_eventV(int smVal, unsigned short ev, void* info)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventV >>%d<<, %d, .", smVal, ev);
+        return 0;
+    }
+    return ico_sttm_event(id, ev, info);
+}
+
+extern "C" int ico_sttm_eventGCIV(int smVal, unsigned short ev, int gcv,
+                                  void* info)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventGCIV >>%d<<, %d, %d, .", smVal, ev, gcv);
+        return 0;
+    }
+    return ico_sttm_eventGCI(id, ev, gcv, info);
+}
+
+extern "C" int ico_sttm_eventGCDV(int smVal, unsigned short ev, double gcv,
+                                  void* info)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventGCDV >>%d<<, %d, %f, .", smVal, ev, gcv);
+        return 0;
+    }
+    return ico_sttm_eventGCD(id, ev, gcv, info);
+}
+
+extern "C" int ico_sttm_eventGCSV(int smVal, unsigned short ev,
+                                  const char* gcv, void* info)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventGCSV >>%d<<, %d, %s, .", smVal, ev, gcv);
+        return 0;
+    }
+    return ico_sttm_eventGCS(id, ev, gcv, info);
+}
+
+extern "C" int ico_sttm_eventN(const char* smNm, unsigned short ev, void* info)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventN >>%s<<, %d, .", smNm, ev);
+        return 0;
+    }
+    return ico_sttm_event(id, ev, info);
+}
+
+extern "C" int ico_sttm_eventGCIN(const char* smNm, unsigned short ev, int gcv,
+                                  void* info)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventGCIN >>%s<<, %d, %d, .", smNm, ev, gcv);
+        return 0;
+    }
+    return ico_sttm_eventGCI(id, ev, gcv, info);
+}
+
+extern "C" int ico_sttm_eventGCDN(const char* smNm, unsigned short ev, double gcv,
+                                  void* info)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventGCDN >>%s<<, %d, %f, .", smNm, ev, gcv);
+        return 0;
+    }
+    return ico_sttm_eventGCD(id, ev, gcv, info);
+}
+
+extern "C" int ico_sttm_eventGCSN(const char* smNm, unsigned short ev, const char* gcv,
+                       void* info)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventGCSN >>%s<<, %d, %s, .", smNm, ev, gcv);
+        return 0;
+    }
+    return ico_sttm_eventGCS(id, ev, gcv, info);
+}
+
+
+
+bool ico_sttm_eventTestX(int smCWId, CicoEvent& ev, const char* fname)
+{
+    CicoStateMachine* csm = ico_sttm_getStateMachineX(smCWId, fname);
+    if ((CicoStateMachine*)0 == csm) {
+        return 0;
+    }
+    return csm->eventTest(ev);
+}
+
+/**
+ * @brief Test of the transition
+ * @param smCWId stateMachine-object ID no. to be registered(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param smNm stateMachine-object Identification name
+ * @param ev event No.(Use the 1000-65535)
+ * @param gcv Comparison value of guard condition
+ * @param info Additional information user
+ * @return not 0:Success on Transition
+ * @       0: none Transition
+ */
+extern "C" int ico_sttm_eventTest(int smCWId, unsigned short ev)
+{
+    sttmerr = STTMNOERROR;
+    CicoEvent oev(ev);
+    return ico_sttm_eventTestX(smCWId, oev, "ico_sttm_eventTest")? smCWId:0;
+}
+
+extern "C" int ico_sttm_eventTestGCI(int smCWId, unsigned short ev, int gcv)
+{
+    sttmerr = STTMNOERROR;
+    CicoEvent oev(ev, gcv);
+    return ico_sttm_eventTestX(smCWId, oev, "ico_sttm_eventTestGCI")? smCWId:0;
+}
+
+extern "C" int ico_sttm_eventTestGCD(int smCWId, unsigned short ev, double gcv)
+{
+    sttmerr = STTMNOERROR;
+    CicoEvent oev(ev, gcv);
+    return ico_sttm_eventTestX(smCWId, oev, "ico_sttm_eventTestGCD")? smCWId:0;
+}
+
+extern "C" int ico_sttm_eventTestGCS(int smCWId, unsigned short ev, const char* gcv)
+{
+    sttmerr = STTMNOERROR;
+    CicoEvent oev(ev, gcv);
+    return ico_sttm_eventTestX(smCWId, oev, "ico_sttm_eventTestGCS")? smCWId:0;
+}
+
+extern "C" int ico_sttm_eventTestV(int smVal, unsigned short ev)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventTestV >>%d<<, %d, .", smVal, ev);
+        return 0;
+    }
+    return ico_sttm_eventTest(id, ev);
+}
+
+extern "C" int ico_sttm_eventTestGCIV(int smVal, unsigned short ev, int gcv)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventGCIV >>%d<<, %d, %d, .", smVal, ev, gcv);
+        return 0;
+    }
+    return ico_sttm_eventTestGCI(id, ev, gcv);
+}
+
+extern "C" int ico_sttm_eventTestGCDV(int smVal, unsigned short ev, double gcv)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventTestGCDV >>%d<<, %d, %f, .", smVal, ev, gcv);
+        return 0;
+    }
+    return ico_sttm_eventTestGCD(id, ev, gcv);
+}
+
+extern "C" int ico_sttm_eventTestGCSV(int smVal, unsigned short ev, const char* gcv)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventTestGCSV >>%d<<, %d, %s, .", smVal, ev, gcv);
+        return 0;
+    }
+    return ico_sttm_eventTestGCS(id, ev, gcv);
+}
+
+extern "C" int ico_sttm_eventTestN(const char* smNm, unsigned short ev)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventTestN >>%s<<, %d, .", smNm, ev);
+        return 0;
+    }
+    return ico_sttm_eventTest(id, ev);
+}
+
+extern "C" int ico_sttm_eventTestGCIN(const char* smNm, unsigned short ev, int gcv)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventTestGCIN >>%s<<, %d, %d, .", smNm, ev, gcv);
+        return 0;
+    }
+    return ico_sttm_eventTestGCI(id, ev, gcv);
+}
+
+extern "C" int ico_sttm_eventTestGCDN(const char* smNm, unsigned short ev, double gcv)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventTestGCDN >>%s<<, %d, %f, .", smNm, ev, gcv);
+        return 0;
+    }
+    return ico_sttm_eventTestGCD(id, ev, gcv);
+}
+
+extern "C" int ico_sttm_eventTestGCSN(const char* smNm, unsigned short ev,
+                           const char* gcv)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_eventTestGCSN >>%s<<, %d, %s, .", smNm, ev, gcv);
+        return 0;
+    }
+    return ico_sttm_eventTestGCS(id, ev, gcv);
+}
+
+/**
+ * @brief retrieve stateMachine-object
+ * @param value/name  stateMachine-object ID no. / name
+ * @return not 0:stateMachine-object ID no.(c-wrapper local ID)
+ * @       0:not find
+ */
+extern "C" int ico_sttm_retrieveMVal(int value)
+{
+    sttmerr = STTMNOERROR;
+    int r = 0;
+    int sz = stateObjects.size();
+    for (int i = 0; i< sz; i++) {
+        if (true == stateObjects[i]->isStateMachine()) {
+            if (value == stateObjects[i]->getValue() ) {
+                r = i+1;
+                break;                  // break of for i<sz
+            }
+        }
+    }
+    return r;
+}
+
+extern "C" int ico_sttm_retrieveMName(const char* name)
+{
+    sttmerr = STTMNOERROR;
+    std::string oname(name);
+    int r = 0;
+    int sz = stateObjects.size();
+    for (int i = 0; i< sz; i++) {
+        if (true == stateObjects[i]->isStateMachine()) {
+            if (oname == stateObjects[i]->getName()) {
+                r = i+1;
+                break;                  // break of for i<sz
+            }
+        }
+    }
+    return r;
+}
+
+/**
+ * @brief retrieve state-object(state/historyState/finalState)
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param value/name  state(state/historyState/finalState)-object ID no. / name
+ * @return not 0:state-object ID no.(c-wrapper local ID)
+ * @       0:not find
+ */
+extern "C" int ico_sttm_retrieveSVal(int smCWId, int value)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateMachine* csm;
+    csm = ico_sttm_getStateMachineX(smCWId, "ico_sttm_retrieveSVal");
+    if ((CicoStateMachine*)0 == csm) {
+        return 0;
+    }
+    const CicoStateCore* csc = csm->getState(value);
+    if ((CicoStateCore*)0 == csc) {
+        _DBG("ico_sttm_retrieveSVal %d, >>%d<<", smCWId, value);
+        return 0;
+    }
+    return getObjSTT2ID(csc);
+}
+
+extern "C" int ico_sttm_retrivevSName(int smCWId, const char* name)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateMachine* csm;
+    csm = ico_sttm_getStateMachineX(smCWId, "ico_sttm_retrivevSName");
+    if ((CicoStateMachine*)0 == csm) {
+        return 0;
+    }
+    const CicoStateCore* csc = csm->getState(name);
+    if ((CicoStateCore*)0 == csc) {
+        _DBG("ico_sttm_retrivevSName %d, >>%s<<", smCWId, name);
+        return 0;
+    }
+    return getObjSTT2ID(csc);
+}
+
+
+/**
+ * @brief object check
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @return not 0:stateMachine-object
+ * @           0:no stateMachine-object
+ */
+extern "C" int ico_sttm_isStateMachine(int smCWId)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateCore* cscTarget = getID2ObjSTT(smCWId); // ID to state-object
+    if ((CicoStateCore*)0 == cscTarget) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_isStateMachine >>%d<<", smCWId);
+        return 0;
+    }
+    return cscTarget->isStateMachine()? smCWId:0;
+}
+
+/**
+ * @brief object check
+ * @param sCWId state-object ID no.(c-wrapper local ID)
+ * @return not 0:state-object
+ * @       0:no state-object
+ */
+extern "C" int ico_sttm_isState(int sCWId)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateCore* cscTarget = getID2ObjSTT(sCWId); // ID to state-object
+    if ((CicoStateCore*)0 == cscTarget) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_isState >>%d<<", sCWId);
+        return 0;
+    }
+    return cscTarget->isState()? sCWId:0;
+}
+
+
+/**
+ * @brief object check
+ * @param sCWId historyState-object ID no.(c-wrapper local ID)
+ * @return not 0:state-object
+ * @       0:no state-object
+ */
+extern "C" int ico_sttm_isHistoryState(int sCWId)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateCore* cscTarget = getID2ObjSTT(sCWId); // ID to state-object
+    if ((CicoStateCore*)0 == cscTarget) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_isHistoryState >>%d<<", sCWId);
+        return 0;
+    }
+    return cscTarget->isHistoryState()? sCWId:0;
+}
+
+
+/**
+ * @brief object check
+ * @param sCWId finalState-object ID no.(c-wrapper local ID)
+ * @return not 0:state-object
+ * @       0:no state-object
+ */
+extern "C" int ico_sttm_isFinalState(int sCWId)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateCore* cscTarget = getID2ObjSTT(sCWId); // ID to state-object
+    if ((CicoStateCore*)0 == cscTarget) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_isFinalState >>%d<<", sCWId);
+        return 0;
+    }
+    return cscTarget->isFinalState()? sCWId:0;
+}
+
+/**
+ * @brief get state-object running
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param X[] Enter the active state-objects(c-wrapper local ID) or value or name
+ * @param size of array sCWIds or values or names
+ * @param value true:get value false:get c-wrapper ID
+ * @param p top or all or bottom get position is getCurrentState parameter
+ * @param fname call function name
+ * @return Number of registered X
+ * @       -1:size over
+ */
+int ico_sttm_getActiveStateX(int smCWId, int X[], size_t arysz, bool value,
+                             CicoStateCore::E_GetPolicy p, const char* fname)
+{
+    CicoStateMachine* csm;
+    csm = ico_sttm_getStateMachineX(smCWId, fname);
+    if ((CicoStateMachine*)0 == csm) {
+        return 0;
+    }
+    std::vector<const CicoState*> stt;
+    if (false == csm->getCurrentState(stt, p)) {
+        _DBG("%s NO ACTIVE STATEMACHINE(\"%s\":%d)",fname,
+             csm->getName().c_str(), csm->getValue());
+        return 0;
+    }
+    int r = 0;
+    int sz = stt.size();
+    for (int i = 0; i < sz; i++) {
+        if ( r >= (int)arysz ) {
+            r = -1;
+            break;                      // break of for i<sz
+        }
+        if (true == value) {
+            X[r] = stt[i]->getValue();  // set state-object value
+            r++;
+        }
+        else {
+            X[r] = getObjSTT2ID(stt[i]); // set state-object C-wrapper local ID
+            if (0 != X[r]) {
+                r++;
+            }
+        }
+    }
+    if (0 == r) {
+        sttmerr = STTMNOTFIND;
+        _DBG("%s get size %d -> %d",fname, sz, r);
+        return 0;
+    }
+    return r;
+}
+int ico_sttm_getActiveState_NX(int smCWId, const char* X[], size_t arysz,
+                             CicoStateCore::E_GetPolicy p, const char* fname)
+{
+    CicoStateMachine* csm;
+    csm = ico_sttm_getStateMachineX(smCWId, fname);
+    if ((CicoStateMachine*)0 == csm) {
+        return 0;
+    }
+    std::vector<const CicoState*> stt;
+    if (false == csm->getCurrentState(stt, p)) {
+        _DBG("%s NO ACTIVE STATEMACHINE(\"%s\":%d)",fname,
+             csm->getName().c_str(), csm->getValue());
+        return 0;
+    }
+    int r = 0;
+    int sz = stt.size();
+    for (int i = 0; i < sz; i++) {
+        if ( r >= (int)arysz ) {
+            r = -1;
+            break;                      // break of for i<sz
+        }
+        X[r] = stt[i]->getName().c_str(); // set state-object name
+        r++;
+    }
+    if (0 == r) {
+        sttmerr = STTMNOTFIND;
+        _DBG("%s get size %d -> %d",fname, sz, r);
+        return 0;
+    }
+    return r;
+}
+
+
+/**
+ * @brief get state-object running true
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param sCWIds[] Enter the active state-objects(c-wrapper local ID)
+ * @param values[] Enter the active state-objects value
+ * @param names[] Enter the active state-objects names
+ * @param size of array sCWIds or values or names
+ * @return Number of registered sCWIds
+ * @       -1:size over
+ */
+extern "C" int ico_sttm_getActiveState(int smCWId, int sCWIds[], size_t sz)
+{
+    sttmerr = STTMNOERROR;
+    return ico_sttm_getActiveStateX(smCWId, sCWIds, sz, false,
+                                    CicoStateCore::ELvlBttm,
+                                    "ico_sttm_getActiveState");
+}
+
+extern "C" int ico_sttm_getActiveState_V(int smCWId, int values[], size_t sz)
+{
+    sttmerr = STTMNOERROR;
+    return ico_sttm_getActiveStateX(smCWId, values, sz, true,
+                                    CicoStateCore::ELvlBttm,
+                                    "ico_sttm_getActiveState_V");
+}
+
+extern "C" int ico_sttm_getActiveStateVV(int smVal, int values[], size_t sz)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_getActiveStateVV >>%d<<, ., %d", smVal, sz);
+        return 0;
+    }
+    return ico_sttm_getActiveStateX(id, values, sz, true,
+                                    CicoStateCore::ELvlBttm,
+                                    "ico_sttm_getActiveStateVV");
+}
+
+extern "C" int ico_sttm_getActiveState_N(int smCWId, const char* names[],
+                                           size_t sz)
+{
+    sttmerr = STTMNOERROR;
+    return ico_sttm_getActiveState_NX(smCWId, names, sz,
+                                    CicoStateCore::ELvlBttm,
+                                    "ico_sttm_getActiveState_N");
+}
+
+extern "C" int ico_sttm_getActiveStateNN(const char* smNm, const char* names[],
+                                         size_t sz)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_getActiveStateNN >>%s<<, ., %d", smNm, sz);
+        return 0;
+    }
+    return ico_sttm_getActiveState_NX(id, names, sz,
+                                    CicoStateCore::ELvlBttm,
+                                    "ico_sttm_getActiveStateNN");
+}
+
+/**
+ * @brief get state-object running directly under
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param sCWIds[] Enter the active state-objects(c-wrapper local ID)
+ * @param values[] Enter the active state-objects value
+ * @param names[] Enter the active state-objects names
+ * @param size of array sCWIds or values or names
+ * @return Number of registered sCWIds
+ * @       -1:size over
+ */
+extern "C" int ico_sttm_getActiveStateDirectlyUnder(int smCWId, int sCWIds[],
+                                                    size_t sz)
+{
+    sttmerr = STTMNOERROR;
+    return ico_sttm_getActiveStateX(smCWId, sCWIds, sz, false,
+                                    CicoStateCore::ELvlTop,
+                                    "ico_sttm_getActiveStateDirectlyUnder");
+}
+extern "C" int ico_sttm_getActiveStateDirectlyUnder_V(int smCWId, 
+                                                         int values[],
+                                                         size_t sz)
+{
+    sttmerr = STTMNOERROR;
+    return ico_sttm_getActiveStateX(smCWId, values, sz, true,
+                                    CicoStateCore::ELvlTop,
+                                    "ico_sttm_getActiveStateDirectlyUnder_V");
+}
+
+extern "C" int ico_sttm_getActiveStateDirectlyUnderVV(int smVal, int values[],
+                                           size_t sz)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_getActiveStateDirectlyUnderVV >>%d<<, ., %d",
+             smVal, sz);
+        return 0;
+    }
+    return ico_sttm_getActiveStateX(id, values, sz, true,
+                                    CicoStateCore::ELvlTop,
+                                    "ico_sttm_getActiveStateDirectlyUnderVV");
+}
+
+extern "C" int ico_sttm_getActiveStateDirectlyUnder_N(int smCWId,
+                                                        const char* names[],
+                                                        size_t sz)
+{
+    sttmerr = STTMNOERROR;
+    return ico_sttm_getActiveState_NX(smCWId, names, sz,
+                                    CicoStateCore::ELvlTop,
+                                    "ico_sttm_getActiveStateDirectlyUnder_N");
+}
+
+extern "C" int ico_sttm_getActiveStateDirectlyUnderNN(const char* smNm, 
+                                                      const char* names[],
+                                                      size_t sz)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_getActiveStateDirectlyUnderNN >>%s<<, ., %d", smNm, sz);
+        return 0;
+    }
+    return ico_sttm_getActiveState_NX(id, names, sz,
+                                    CicoStateCore::ELvlTop,
+                                    "ico_sttm_getActiveStateDirectlyUnderNN");
+}
+
+/**
+ * @brief get state-object running all
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param smNm stateMachine-object Identification name
+ * @param sCWIds[] Enter the active state-objects(c-wrapper local ID)
+ * @param values[] Enter the active state-objects value
+ * @param names[] Enter the active state-objects names
+ * @param size of array sCWIds or values or names
+ * @return Number of registered sCWIds
+ * @       -1:size over
+ */
+extern "C" int ico_sttm_getActiveStateAll(int smCWId, int sCWIds[], size_t sz)
+{
+    sttmerr = STTMNOERROR;
+    return ico_sttm_getActiveStateX(smCWId, sCWIds, sz, false,
+                                    CicoStateCore::ELvlAll,
+                                    "ico_sttm_getActiveStateAll");
+}
+
+extern "C" int ico_sttm_getActiveStateAll_V(int smCWId, int values[],
+                                            size_t sz)
+{
+    sttmerr = STTMNOERROR;
+    return ico_sttm_getActiveStateX(smCWId, values, sz, true,
+                                    CicoStateCore::ELvlAll,
+                                    "ico_sttm_getActiveStateAll_V");
+}
+
+extern "C" int ico_sttm_getActiveStateAllVV(int smVal, int values[],
+                                            size_t sz)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_getActiveStateAllVV >>%d<<, ., %d", smVal, sz);
+        return 0;
+    }
+    return ico_sttm_getActiveStateX(id, values, sz, true,
+                                    CicoStateCore::ELvlAll,
+                                    "ico_sttm_getActiveStateAllVV");
+}
+
+extern "C" int ico_sttm_getActiveStateAll_N(int smCWId, const char* names[],
+                                              size_t sz)
+{
+    sttmerr = STTMNOERROR;
+    return ico_sttm_getActiveState_NX(smCWId, names, sz,
+                                    CicoStateCore::ELvlAll,
+                                    "ico_sttm_getActiveStateAll_N");
+}
+
+extern "C" int ico_sttm_getActiveStateAllNN(const char* smNm,
+                                            const char* names[], size_t sz)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_getActiveStateAllNN >>%s<<, ., %d", smNm, sz);
+        return 0;
+    }
+    return ico_sttm_getActiveState_NX(id, names, sz,
+                                    CicoStateCore::ELvlAll,
+                                    "ico_sttm_getActiveStateAllNN");
+}
+
+/**
+ * @brief get name value
+ * @param CWId stateMachine-object/state-object ID no.(c-wrapper local ID)
+ * @return name
+ */
+extern "C" const char* ico_sttm_getName(int CWId)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateCore* cscTarget = getID2ObjSTT(CWId); // CWId to state-object
+    if ((CicoStateCore*)0 == cscTarget) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_getName >>%d<<", CWId);
+        return 0;
+    }
+    return cscTarget->getName().c_str();
+}
+
+/**
+ * @brief get value
+ * @param CWId stateMachine-object/state-object ID no.(c-wrapper local ID)
+ * @return value
+ */
+extern "C" int ico_sttm_getValue(int CWId)
+{
+    sttmerr = STTMNOERROR;
+    CicoStateCore* cscTarget = getID2ObjSTT(CWId); // ID to state-object
+    if ((CicoStateCore*)0 == cscTarget) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_getValue >>%d<<", CWId);
+        return 0;
+    }
+    return cscTarget->getValue();
+}
+
+/**
+ * @brief get error code
+ * @return error code
+ */
+StateMachineCWrapperErr_E ico_sttm_errcode()
+{
+    return sttmerr;
+}
+
+/**
+ * @breif get operation state
+ * @param smCWId ID no. to eb registered stateMachine-object(c-wrapper local ID)
+ * @param sCWId ID no. to be registered(c-wrapper local ID)
+ * @param value value is state-object identification number
+ * @param name  name is state-object Identification name
+ * @return OPERATION_STATE_E
+ */
+extern "C" OPERATION_STATE_E ico_sttm_isActiveSttM(int smCWId)
+{
+    return ico_sttm_isActiveStt(smCWId);
+}
+
+/**
+ *
+ */
+extern "C" OPERATION_STATE_E ico_sttm_isActiveStt(int sCWId)
+{
+    sttmerr = STTMNOERROR;
+    int sz = stateObjects.size();
+    if ((0 < sCWId) && (sCWId <= sz)) {
+        if (true == stateObjects[sCWId-1]->isActive()) {
+            return E_STT_ACTIVE;
+        }
+    }
+    else {
+        sttmerr = STTMPARAMERR;
+    }
+    return E_STT_INACTIVE;
+}
+
+extern "C" OPERATION_STATE_E ico_sttm_isActive_V(int smCWId, int value)
+{
+    sttmerr = STTMNOERROR;
+    int lid = ico_sttm_retrieveSVal(smCWId, value);
+    if (0 != lid) {
+        return ico_sttm_isActiveStt(lid);
+    }
+    else {
+        sttmerr = STTMNOTFIND;
+    }
+    return E_STT_INACTIVE;
+}
+
+extern "C" OPERATION_STATE_E ico_sttm_isActiveVV(int smVal, int value)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMVal(smVal);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_isActiveVV >>%d<<, %d", smVal, value);
+        return E_STT_INACTIVE;
+    }
+    return ico_sttm_isActive_V(id, value);
+}
+
+extern "C" OPERATION_STATE_E ico_sttm_isActive_N(int smCWId, const char* name)
+{
+    sttmerr = STTMNOERROR;
+    int lid = ico_sttm_retrivevSName(smCWId, name);
+    if (0 != lid) {
+        return ico_sttm_isActiveStt(lid);
+    }
+    else {
+        sttmerr = STTMNOTFIND;
+    }
+    return E_STT_INACTIVE;
+}
+
+extern "C" OPERATION_STATE_E ico_sttm_isActiveNN(const char* smNm,
+                                                 const char* name)
+{
+    sttmerr = STTMNOERROR;
+    int id = ico_sttm_retrieveMName(smNm);
+    if (0 == id) {
+        sttmerr = STTMNOTFIND;
+        _DBG("ico_sttm_isActiveNN >>%s<<, %s", smNm, name);
+        return E_STT_INACTIVE;
+    }
+    return ico_sttm_isActive_N(id, name);
+}
diff --git a/lib/misc/state-machine/ico_StateMachine_CWrapper.h b/lib/misc/state-machine/ico_StateMachine_CWrapper.h
new file mode 100644 (file)
index 0000000..88abc01
--- /dev/null
@@ -0,0 +1,742 @@
+/*
+ * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
+ *
+ * Contact: 
+ *
+ * Licensed under the Apache License, Version 2.0 (the License){}
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+#ifndef __ICO_STATEMACHIN_CWRAPPER_H__
+#define __ICO_STATEMACHIN_CWRAPPER_H__
+
+/**
+ * stateMachine-c++ objects to  C
+ * C Wrapper functions
+ * @author m.kamoshida
+ * @version 0.1
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * STATE MACHINE C-WAPPER ERROR CODE
+ * 
+ */
+typedef enum E_StateMachineCWrapperErr {
+    STTMNOERROR = 0,            // No error
+    STTMNOTFIND = 1,            // state-object not find
+    STTMTYPEMISMATCH,           // state-object type mismatch
+    STTMCREATEERR,              // CREATE ERROR
+    STTMNEWERR,                 // new ERROR
+    STTMEVNOTFIND,              // eventinfo-object not find
+    STTMPARAMERR                // PARAMETER MISMATCH
+} StateMachineCWrapperErr_E;
+
+/**
+ * enum of history type
+ */
+typedef enum E_HISTORY_TYPE
+{
+    E_UNKOWNHISTORYTYPE = 0,
+    E_SHALLOW = 1,              // Shallow history
+    E_DEEP                      // Deep history
+} HISTORY_TYPE_E;
+
+/**
+ * enum of join logical operator
+ */
+typedef enum E_GC_JOIN
+{
+    E_GC_AND = 1,
+    E_GC_OR
+} GC_JOIN_E;
+
+/**
+ * enum of value type
+ */
+typedef enum E_EV_VAL_KIND
+{
+    E_NONE = 0,
+    E_NUMBER,
+    E_DOUBLE,
+    E_STRING
+} EV_VAL_KIND_E;
+
+/**
+ * enum of guard condition operate
+ */
+typedef enum E_GC_OP_KIND
+{
+    GC_OP_NON = 0,
+    GC_OP_EQ = 1,                       // "="   Guard condition is equal to
+    GC_OP_NE,                           // "!="  Guard condition is not equal to
+    GC_OP_LT,                           // "<"   Guard condition is less than
+    GC_OP_LE,                           // "<="  Guard condition is less than or equal
+    GC_OP_GT,                           // ">"   Guard condition is greater than
+    GC_OP_GE,                           // ">="  Guard condition is greater than or equal
+    GC_OP_IN,                           // "in"  Guard condition is the state of the state-object
+    GC_OP_NOT                           // "not" Guard condition is the state of the state-object
+} GC_OP_KIND_E;
+
+
+typedef enum E_OPERATION_STATE          // state-object operation state
+{
+    E_STT_INACTIVE =0,                  // INACTIVE
+    E_STT_ACTIVE                        // ACTIVE
+} OPERATION_STATE_E;
+
+/**
+ * call back infomation parameter
+ * Where entry-action and exit-action, do-action use call back
+ */
+typedef struct
+{
+    unsigned short  ev;                 // event no.
+    EV_VAL_KIND_E   uk;                 // union 'u' kind
+    union {                             //
+        int             i;              // Used if the uk == E_NUMBER
+        double          d;              // Used if the uk == E_DOUBLE
+        const char*     s;              // Used if the uk == E_STRING
+    }               u;                  //
+    void*           v;                  // Additional information user
+} st_event;
+
+/**
+ * @brief Create an stateMachine-object and state-object with the specified file
+ * @param file faile path pseudo-json
+ * @return not 0:stateMachine-object Id no.(c-wrapper local ID)
+ * @       0:create error
+ */
+int ico_sttm_createStateMachineFile(const char* file);
+
+/**
+ * @brief Create an stateMachine-object and state-object with the specified text
+ * @param buff text pseudo-json
+ * @return not 0:stateMachine-object ID no.(c-wrapper local ID)
+ * @       0:create error
+ */
+int ico_sttm_createStateMachineText(const char* buff);
+
+/**
+ * @brief Create stateMachine-object
+ * @param name stateMachine-object identification name
+ * @param value stateMachine-object identification number.
+ * @return not 0:stateMachine-object ID no.(c-wrapper local ID)
+ * @       0:create error
+ */
+int ico_sttm_createStateMachine(const char* name, int value);
+
+/**
+ * @brief Create state-object
+ * @param parent parent ID no.(c-wrapper local ID)
+ * @param name state-object identification name
+ * @param value state-object identification number
+ * @return not 0:state-object ID no.(c-wrapper local ID)
+ * @       0:create faile
+ */
+int ico_sttm_createState(int parent, const char* name, int value);
+
+
+/**
+ * @brief Create historyState-object
+ * @param parent parent ID no.(c-wrapper local ID)
+ * @param name historyState-object identification name
+ * @param value historyState-object identification number
+ * @param type Shallow/Deep history type
+ * @return not 0:historyState-object ID no.(c-wrapper local ID)
+ * @       0:create error
+ */
+int ico_sttm_createHState(int parent, const char* name, int value,
+                      HISTORY_TYPE_E type);
+
+
+/**
+ * @brief Create finalState-object
+ * @param parent parent ID no.(c-wrapper local ID)
+ * @param name finalState-object identification name
+ * @param value finalState-object identification number
+ * @return not 0:finalState-object ID no.(c-wrapper local ID)
+ * @       0:create error
+ */
+int ico_sttm_createFState(int parent, const char* name, int value);
+
+
+/**
+ * @brief Registration of transition events
+ * @param sCWId ID no. to be registered(c-wrapper local ID)
+ * @param evname event identification name
+ * @param ev event no.(Use the 1000-65535) identification number
+ * @param trCWId of transition destination(c-wrapper local ID)
+ * @return not 0:ID no. of the event to register(c-wrapper local ID)
+ * @       0:added error
+ */
+/* Please try a unique name in the naming event since the search key */
+int ico_sttm_addTransition(int sCWId,
+                           const char* evname, unsigned short ev,
+                           int trCWId);
+
+
+/**
+ * @brief Registration of transition events
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param value value is state-object identification number
+ * @param evname event name
+ * @param ev event no.(Use the 1000-65535)
+ * @param trVal state-object identification value destination
+ * @param trCWId of transition destination(c-wrapper local ID)
+ * @return not 0:ID no. of the event to register(c-wrapper local ID)
+ * @       0:added error
+ */
+int ico_sttm_addTransitionVVV(int smVal, int value,
+                              const char* evname, unsigned short ev,
+                              int trVal);
+
+/**
+ * @brief Registration of transition events
+ * @param smNm stateMachine-object identification name
+ * @param name state-object identification name
+ * @param evname event name
+ * @param ev event no.(Use the 1000-65535)
+ * @param namTrns state-object Identification name destination
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param trCWId of transition destination(c-wrapper local ID)
+ * @return not 0:ID no. of the event to register(c-wrapper local ID)
+ * @       0:added error
+ */
+int ico_sttm_addTransitionNNN(const char* smNm, const char* name,
+                              const char* evname, unsigned short ev,
+                              const char* trNm);
+
+/**
+ * @brief Registration of transition events
+ * @param sCWId state-object ID no.(c-wrapper local ID)
+ * @param evname event name 
+ * @param ev event no.(Use the 1000-65535)
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @param trCWId destination(c-wrapper local ID)
+ * @return not 0:ID no. of the event to register(c-wrapper local event-ID)
+ * @       0:added error
+ */
+/* Please try a unique name in the naming event since the search key */
+int ico_sttm_addTransitionGCI(int sCWId,
+                              const char* evname, unsigned short ev,
+                              GC_OP_KIND_E gce, int gcv,
+                              int trCWId);
+
+int ico_sttm_addTransitionGCD(int sCWId,
+                              const char* evname, unsigned short ev,
+                              GC_OP_KIND_E gce, double gcv,
+                              int trCWId);
+
+int ico_sttm_addTransitionGCS(int sCWId,
+                              const char* evname, unsigned short ev,
+                              GC_OP_KIND_E gce, const char* gcv,
+                              int trCWId);
+
+/**
+ * @brief Registration of transition events
+ * @param smVal value is stateMachine-object identification number
+ * @param value value is state-object identification number
+ * @param evname event name
+ * @param ev event no.(Use the 1000-65535)
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @param trVl value is state-object identification number transition, destination
+ * @return not 0:ID no. of the event to register(c-wrapper local event-ID)
+ * @       0:added error
+ */
+int ico_sttm_addTransGCIVVV(int smVal, int value,
+                            const char* evname, unsigned short ev,
+                            GC_OP_KIND_E gce, int gcv, int trVl);
+
+int ico_sttm_addTransGCDVVV(int smVal, int value,
+                            const char* evname, unsigned short ev,
+                            GC_OP_KIND_E gce, double gcv, int trVl);
+
+int ico_sttm_addTransGCSVVV(int smVal, int value,
+                            const char* evname, unsigned short ev,
+                            GC_OP_KIND_E gce, const char* gcv, int trVl);
+
+/**
+ * @brief Registration of transition events
+ * @param smNm stateMachine-object Identification name
+ * @param name  name is state-object Identification name
+ * @param evname event name 
+ * @param ev event no.(Use the 1000-65535)
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @param trNm name is state-object Identification name destination
+ * @return not 0:ID no. of the event to register(c-wrapper local event-ID)
+ * @       0:added error
+ * construction ico_sttm_createStateMachineFile or ico_sttm_createStateMachineText
+ * it can not be used
+ */
+int ico_sttm_addTransGCINNN(const char* smNm, const char* name,
+                            const char* evname, unsigned short ev,
+                            GC_OP_KIND_E gce, int gcv,
+                            const char* trNm);
+
+int ico_sttm_addTransGCDNNN(const char* smNm, const char* name,
+                            const char* evname, unsigned short ev,
+                            GC_OP_KIND_E gce, double gcv,
+                            const char* trNm);
+
+int ico_sttm_addTransGCSNNN(const char* smNm, const char* name, 
+                            const char* evname, unsigned short ev,
+                            GC_OP_KIND_E gce, const char* gcv,
+                            const char* trNm);
+
+
+/**
+ * @brief add guard condition
+ * @param evId ID no. to be registered(c-wrapper local event-ID)
+ * @param j logical operator
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @return not 0:Success
+ * @       0:added failure
+ * construction ico_sttm_createStateMachineFile or ico_sttm_createStateMachineText
+ * it can not be used
+ */
+int ico_sttm_addGCI(int evId, GC_JOIN_E j, GC_OP_KIND_E gc, int gcv);
+int ico_sttm_addGCD(int evId, GC_JOIN_E j, GC_OP_KIND_E gc, double gcv);
+int ico_sttm_addGCS(int evId, GC_JOIN_E j, GC_OP_KIND_E gc, const char* gcv);
+
+/**
+ * @brief add guard condition
+ * @param smVal value is stateMachine-object identification number
+ * @param value value is state-object identification number
+ * @param evname event name 
+ * @param ev event no.(Use the 1000-65535)
+ * @param j logical operator
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @return not 0:Success
+ * @       0:added failure
+ */
+int ico_sttm_addGCIVV(int smVal, int value,
+                      const char* evname, unsigned short ev,
+                      GC_JOIN_E j, GC_OP_KIND_E gc, int gcv);
+int ico_sttm_addGCDVV(int smVal, int value,
+                      const char* evname, unsigned short ev,
+                      GC_JOIN_E j, GC_OP_KIND_E gc, double gcv);
+int ico_sttm_addGCSVV(int smVal, int value,
+                      const char* evname, unsigned short ev,
+                      GC_JOIN_E j, GC_OP_KIND_E gc, const char* gcv);
+
+/**
+ * @brief add guard condition
+ * @param smNm stateMachine-object Identification name
+ * @param name name is state-object Identification name
+ * @param evname event name 
+ * @param ev event no.(Use the 1000-65535)
+ * @param j logical operator
+ * @param gce operator of guard condition
+ * @param gcv Comparison value of guard condition
+ * @return not 0:Success
+ * @       0:added failure
+ */
+int ico_sttm_addGCINN(const char* smNm, const char* name,
+                      const char* evname, unsigned short ev,
+                      GC_JOIN_E j, GC_OP_KIND_E gc, int gcv);
+
+int ico_sttm_addGCDNN(const char* smNm, const char* name,
+                      const char* evname, unsigned short ev,
+                      GC_JOIN_E j, GC_OP_KIND_E gc, double gcv);
+
+int ico_sttm_addGCSNN(const char* smNm, const char* name,
+                      const char* evname, unsigned short ev,
+                      GC_JOIN_E j, GC_OP_KIND_E gc, const char* gcv);
+
+
+/**
+ * @brief Callback registration
+ * @param sCWId ID no. to be registered(c-wrapper local ID)
+ * @param fanc callback function
+ * @return not 0:Success 
+ * @       0:added Failure
+ */
+int ico_sttm_addEntryAction(int sCWId, void (*fnc)(st_event* ev, int sCWId));
+int ico_sttm_addExitAction(int sCWId, void (*fnc)(st_event* ev, int sCWId));
+int ico_sttm_addDoAction(int sCWId, void (*fnc)(st_event* ev, int sCWId));
+
+
+/**
+ * @brief Callback registration
+ * @param smVal value is stateMachine-object identification number
+ * @param value value is state-object identification number
+ * @param fanc callback function
+ * @return not 0:Success 
+ * @       0:added Failure
+ */
+int ico_sttm_addEntryActionVV(int smVal, int value,
+                              void (*fnc)(st_event* ev, int sCWId));
+int ico_sttm_addExitActionVV(int smVal, int value,
+                             void (*fnc)(st_event* ev, int sCWId));
+int ico_sttm_addDoActionVV(int smVal, int value,
+                           void (*fnc)(st_event* ev, int sCWId));
+
+/**
+ * @brief Callback registration
+ * @param smNm stateMachine-object Identification name
+ * @param name  name is state-object Identification name
+ * @param fanc callback function
+ * @return not 0:Success 
+ * @       0:added Failure
+ */
+int ico_sttm_addEntryActionNN(const char* smNm, const char* name,
+                              void (*fnc)(st_event* ev, int sCWId));
+
+int ico_sttm_addExitActionNN(const char* smNm, const char* name,
+                             void (*fnc)(st_event* ev, int sCWId));
+
+int ico_sttm_addDoActionNN(const char* smNm, const char* name,
+                           void (*fnc)(st_event* ev, int sCWId));
+
+
+/**
+ * @brief Registration at the time of termination detection transition destination
+ * @param sCWId ID no. to be registered(c-wrapper local ID)
+ * @param trCWId finish transition destination(c-wrapper local ID)
+ * @return not 0:Success
+ * @       0:set Failure
+ */
+int ico_sttm_setFinishTransition(int sCWId, int trCWId);
+
+/**
+ * @brief Registration at the time of termination detection transition destination
+ * @param smVal value is stateMachine-object identification number
+ * @param value value is state-object identification number
+ * @param trVl value is state-object identification number transition destination
+ * @return not 0:Success
+ * @       0:set Failure
+ */
+int ico_sttm_setFinishTransitionVVV(int smVal, int value, int trVl);
+
+/**
+ * @brief Registration at the time of termination detection transition destination
+ * @param smNm stateMachine-object Identification name
+ * @param name  name is state-object Identification name
+ * @return not 0:Success
+ * @       0:set Failure
+ */
+int ico_sttm_setFinishTransitionNNN(const char* smNm, const char* name, 
+                                    const char* trNm);
+
+/**
+ * @brief Registration of default history state-objectss
+ * @param sCWId ID no. to be registered(c-wrapper local ID)
+ * @param dfCWId  default transition destination(c-wrapper local ID)
+ * @return not 0:Success
+ * @       0:added Failure
+ */
+int ico_sttm_addDefault(int sCWId, int dfCWId);
+
+
+/**
+ * @brief Registration of default history state-objectss
+ * @param value value is state-object identification number
+ * @param dfVal value is state-object identification number
+ * @return not 0:Success
+ * @       0:added Failure
+ */
+int ico_sttm_addDefaultVVV(int smVal, int value, int dfVal);
+
+/**
+ * @brief Registration of default history state-objectss
+ * @param smNm stateMachine-object Identification name
+ * @param name  name is state-object Identification name
+ * @param dfNm  name is state-object Identification name
+ * @return not 0:Success
+ * @       0:added Failure
+ */
+int ico_sttm_addDefaultNNN(const char* smNm, const char* name,
+                           const char* dfNm);
+
+/**
+ * @breif Registration of start position state-objects
+ * @param ID stateMachine-object/state-object ID no.(c-wrapper local ID)
+ * @param sCWId start position state-object ID no.(c-wrapper local ID)
+ * @return not 0:Success
+ * @       0:set failure
+ */
+int ico_sttm_addStartPosition(int CWId, int sCWId);
+
+
+/**
+ * @breif Registration of start position state-objects
+ * @param smVal value is stateMachine-object identification number
+ * @param value value is state-object identification number
+ * @param value spVal is state-object identification number
+ * @return not 0:Success
+ * @       0:set failure
+ */
+int ico_sttm_addStartPositionSMVV(int smVal, int spVal);
+
+int ico_sttm_addStartPositionVVV(int smVal, int value, int spVal);
+
+
+/**
+ * @breif Registration of start position state-objects
+ * @param smNm stateMachine-object Identification name
+ * @param name  name is state-object Identification name
+ * @param name  spNm is state-object Identification name
+ * @return not 0:Success
+ * @       0:set failure
+ */
+int ico_sttm_addStartPositionSMNN(const char* smNm, const char* spNm);
+
+int ico_sttm_addStartPositionNNN(const char* smNm, const char* name,
+                                 const char* spNm);
+
+
+/**
+ * @breif start stateMachine
+ * @param smCWId stateMachine-object ID no. to be registered(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param smNm stateMachine-object Identification name
+ * @return not 0:Success
+ * @       0:start Failure
+ */
+int ico_sttm_startV(int smVal);
+
+int ico_sttm_startN(const char* smNm);
+
+int ico_sttm_start(int smCWId);
+
+
+/**
+ * @breif stop stateMachine
+ * @param smCWId stateMachine-object ID no. to be registered(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param smNm stateMachine-object Identification name
+ * @return not 0:Success
+ * @       0:stop Failure
+ */
+int ico_sttm_stopV(int smVal);
+
+int ico_sttm_stopN(const char* smNm);
+
+int ico_sttm_stop(int smCWId);
+
+
+/**
+ * @brief Issue an event
+ * @param smCWId stateMachine-object ID no. to be registered(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param smNm stateMachine-object Identification name
+ * @param ev event No.(Use the 1000-65535)
+ * @param gcv Comparison value of guard condition
+ * @param info Additional information user
+ * @return not 0:Success on Transition
+ * @       0: none Transition
+ */
+int ico_sttm_eventV(int smVal, unsigned short ev, void* info);
+int ico_sttm_eventGCIV(int smVal, unsigned short ev, int gcv, void* info);
+int ico_sttm_eventGCDV(int smVal, unsigned short ev, double gcv, void* info);
+int ico_sttm_eventGCSV(int smVal, unsigned short ev, const char* gcv,
+                       void* info);
+
+int ico_sttm_eventN(const char* smNm, unsigned short ev, void* info);
+int ico_sttm_eventGCIN(const char* smNm, unsigned short ev, int gcv,
+                       void* info);
+int ico_sttm_eventGCDN(const char* smNm, unsigned short ev, double gcv,
+                       void* info);
+int ico_sttm_eventGCSN(const char* smNm, unsigned short ev, const char* gcv,
+                       void* info);
+
+int ico_sttm_event(int smCWId, unsigned short ev, void* info);
+int ico_sttm_eventGCI(int smCWId, unsigned short ev, int gcv, void* info);
+int ico_sttm_eventGCD(int smCWId, unsigned short ev, double gcv, void* info);
+int ico_sttm_eventGCS(int smCWId, unsigned short ev, const char* gcv,
+                      void* info);
+
+/**
+ * @brief Test of the transition
+ * @param smCWId stateMachine-object ID no. to be registered(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param smNm stateMachine-object Identification name
+ * @param ev event No.(Use the 1000-65535)
+ * @param gcv Comparison value of guard condition
+ * @param info Additional information user
+ * @return not 0:Success on Transition
+ * @       0: none Transition
+ */
+int ico_sttm_eventTestV(int smVal, unsigned short ev);
+int ico_sttm_eventTestGCIV(int smVal, unsigned short ev, int gcv);
+int ico_sttm_eventTestGCDV(int smVal, unsigned short ev, double gcv);
+int ico_sttm_eventTestGCSV(int smVal, unsigned short ev, const char* gcv);
+
+int ico_sttm_eventTestN(const char* smNm, unsigned short ev);
+int ico_sttm_eventTestGCIN(const char* smNm, unsigned short ev, int gcv);
+int ico_sttm_eventTestGCDN(const char* smNm, unsigned short ev, double gcv);
+int ico_sttm_eventTestGCSN(const char* smNm, unsigned short ev,
+                           const char* gcv);
+
+int ico_sttm_eventTest(int smCWId, unsigned short ev);
+int ico_sttm_eventTestGCI(int smCWId, unsigned short ev, int gcv);
+int ico_sttm_eventTestGCD(int smCWId, unsigned short ev, double gcv);
+int ico_sttm_eventTestGCS(int smCWId, unsigned short ev, const char* gcv);
+
+/**
+ * @brief retrieve stateMachine-object
+ * @param value/name  stateMachine-object ID no. / name
+ * @return not 0:stateMachine-object ID no.(c-wrapper local ID)
+ * @       0:not find
+ */
+int ico_sttm_retrieveMVal(int value);
+int ico_sttm_retrieveMName(const char* name);
+
+
+/**
+ * @brief retrieve state-object(state/historyState/finalState)
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param value/name  state(state/historyState/finalState)-object ID no. / name
+ * @return not 0:state-object ID no.(c-wrapper local ID)
+ * @       0:not find
+ */
+int ico_sttm_retrieveSVal(int smCWId, int value);
+int ico_sttm_retrivevSName(int smCWId, const char* name);
+
+
+/**
+ * @brief object check
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @return not 0:stateMachine-object
+ * @           0:no stateMachine-object
+ */
+int ico_sttm_isStateMachine(int smCWId);
+
+/**
+ * @brief object check
+ * @param sCWId state-object ID no.(c-wrapper local ID)
+ * @return not 0:state-object
+ * @       0:no state-object
+ */
+int ico_sttm_isState(int sCWId);
+
+/**
+ * @brief object check
+ * @param sCWId historyState-object ID no.(c-wrapper local ID)
+ * @return not 0:state-object
+ * @       0:no state-object
+ */
+int ico_sttm_isHistoryState(int sCWId);
+
+/**
+ * @brief object check
+ * @param sCWId finalState-object ID no.(c-wrapper local ID)
+ * @return not 0:state-object
+ * @       0:no state-object
+ */
+int ico_sttm_isFinalState(int sCWId);
+
+/**
+ * @brief get state-object running true
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param smNm stateMachine-object Identification name
+ * @param sCWIds[] Enter the active state-objects(c-wrapper local ID)
+ * @param values[] Enter the active state-objects identification number
+ * @param names[] Enter the active state-objects identification name
+ * @param size of array sCWIds or values or names
+ * @return Number of registered sCWIds
+ * @       -1:size over
+ */
+int ico_sttm_getActiveState(int smCWId, int sCWIds[], size_t sz);
+
+int ico_sttm_getActiveStateVV(int smVal, int values[], size_t sz);
+
+int ico_sttm_getActiveStateNN(const char* smNm, const char* names[],
+                              size_t sz);
+
+/**
+ * @brief get state-object running directly under
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param smNm stateMachine-object Identification name
+ * @param sCWIds[] Enter the active state-objects(c-wrapper local ID)
+ * @param values[] Enter the active state-objects value
+ * @param names[] Enter the active state-objects names
+ * @param size of array sCWIds or values or names
+ * @return Number of registered sCWIds
+ * @       -1:size over
+ */
+int ico_sttm_getActiveStateDirectlyUnder(int smCWId, int sCWIds[], size_t sz);
+
+int ico_sttm_getActiveStateDirectlyUnderVV(int smval, int values[], size_t sz);
+
+int ico_sttm_getActiveStateDirectlyUnderNN(const char* smNm,
+                                           const char* names[], size_t sz);
+
+/**
+ * @brief get state-object running all
+ * @param smCWId stateMachine-object ID no.(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param smNm stateMachine-object Identification name
+ * @param sCWIds[] Enter the active state-objects(c-wrapper local ID)
+ * @param values[] Enter the active state-objects value
+ * @param names[] Enter the active state-objects names
+ * @param size of array sCWIds or values or names
+ * @return Number of registered sCWIds
+ * @       -1:size over
+ */
+int ico_sttm_getActiveStateAll(int smCWId, int sCWIds[], size_t sz);
+
+int ico_sttm_getActiveStateAllVV(int smVal, int values[], size_t sz);
+
+int ico_sttm_getActiveStateAllNN(const char* smNm, const char* names[],
+                                 size_t sz);
+
+/**
+ * @brief get name value
+ * @param CWId stateMachine-object/state-object ID no.(c-wrapper local ID)
+ * @return not 0:identification name  0:get fail
+ */
+const char* ico_sttm_getName(int CWId);
+
+
+/**
+ * @brief get name value
+ * @param CWId stateMachine-object/state-object ID no.(c-wrapper local ID)
+ * @return not 0:identification value  0:get fail
+ */
+int ico_sttm_getValue(int CWId);
+
+
+/**
+ * @breif get operation state
+ * @param smCWId ID no. to eb registered stateMachine-object(c-wrapper local ID)
+ * @param sCWId ID no. to be registered(c-wrapper local ID)
+ * @param smVal value is stateMachine-object identification number
+ * @param smNm stateMachine-object Identification name
+ * @param value value is state-object identification number
+ * @param name  name is state-object Identification name
+ * @return OPERATION_STATE_E
+ */
+OPERATION_STATE_E ico_sttm_isActiveSttM(int smCWId);
+
+OPERATION_STATE_E ico_sttm_isActiveStt(int sCWId);
+
+OPERATION_STATE_E ico_sttm_isActiveVV(int smVal, int value);
+
+OPERATION_STATE_E ico_sttm_isActiveNN(const char* smNm, const char* name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* end of __ICO_STATEMACHIN_CWRAPPER_H__ */
diff --git a/lib/misc/state-machine/ico_log.c b/lib/misc/state-machine/ico_log.c
new file mode 100644 (file)
index 0000000..fad8324
--- /dev/null
@@ -0,0 +1,241 @@
+/*
+ * 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
new file mode 100644 (file)
index 0000000..3b5e224
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * 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/misc/state-machine/picojson.h b/lib/misc/state-machine/picojson.h
new file mode 100644 (file)
index 0000000..751748b
--- /dev/null
@@ -0,0 +1,815 @@
+/* Copyright 2009 Cybozu Labs, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CYBOZU LABS, INC. ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL CYBOZU LABS, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are
+ * those of the authors and should not be interpreted as representing official
+ * policies, either expressed or implied, of Cybozu Labs, Inc.
+ *
+ */
+#ifndef picojson_h
+#define picojson_h
+
+#include <cassert>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <iostream>
+#include <iterator>
+#include <map>
+#include <string>
+#include <vector>
+
+#ifdef _MSC_VER
+    #define SNPRINTF _snprintf_s
+    #pragma warning(push)
+    #pragma warning(disable : 4244) // conversion from int to char
+#else
+    #define SNPRINTF snprintf
+#endif
+
+namespace picojson {
+  enum {
+    null_type,
+    boolean_type,
+    number_type,
+    string_type,
+    array_type,
+    object_type
+  };
+  struct null {};
+  class value {
+  public:
+    typedef std::vector<value> array;
+    typedef std::map<std::string, value> object;
+  protected:
+    int type_;
+    union {
+      bool boolean_;
+      double number_;
+      std::string* string_;
+      array* array_;
+      object* object_;
+    };
+  public:
+    value();
+    value(int type, bool);
+    explicit value(bool b);
+    explicit value(double n);
+    explicit value(const std::string& s);
+    explicit value(const array& a);
+    explicit value(const object& o);
+    ~value();
+    value(const value& x);
+    value& operator=(const value& x);
+    template <typename T> bool is() const;
+    template <typename T> const T& get() const;
+    template <typename T> T& get();
+    operator bool() const;
+    const value& get(size_t idx) const;
+    const value& get(const std::string& key) const;
+    std::string to_str() const;
+    template <typename Iter> void serialize(Iter os) const;
+    std::string serialize() const;
+  };
+  typedef value::array array;
+  typedef value::object object;
+  inline value::value() : type_(null_type) {}
+  inline value::value(int type, bool) : type_(type) {
+    switch (type) {
+#define INIT(p, v) case p##type: p = v; break
+      INIT(boolean_, false);
+      INIT(number_, 0.0);
+      INIT(string_, new std::string());
+      INIT(array_, new array());
+      INIT(object_, new object());
+#undef INIT
+    default: break;
+    }
+  }
+  inline value::value(bool b) : type_(boolean_type) {
+    boolean_ = b;
+  }
+  inline value::value(double n) : type_(number_type) {
+    number_ = n;
+  }
+  inline value::value(const std::string& s) : type_(string_type) {
+    string_ = new std::string(s);
+  }
+  inline value::value(const array& a) : type_(array_type) {
+    array_ = new array(a);
+  }
+  inline value::value(const object& o) : type_(object_type) {
+    object_ = new object(o);
+  }
+  inline value::~value() {
+    switch (type_) {
+#define DEINIT(p) case p##type: delete p; break
+      DEINIT(string_);
+      DEINIT(array_);
+      DEINIT(object_);
+#undef DEINIT
+    default: break;
+    }
+  }
+  inline value::value(const value& x) : type_(x.type_) {
+    switch (type_) {
+#define INIT(p, v) case p##type: p = v; break
+      INIT(boolean_, x.boolean_);
+      INIT(number_, x.number_);
+      INIT(string_, new std::string(*x.string_));
+      INIT(array_, new array(*x.array_));
+      INIT(object_, new object(*x.object_));
+#undef INIT
+    default: break;
+    }
+  }
+  inline value& value::operator=(const value& x) {
+    if (this != &x) {
+      this->~value();
+      new (this) value(x);
+    }
+    return *this;
+  }
+#define IS(ctype, jtype)                             \
+  template <> inline bool value::is<ctype>() const { \
+    return type_ == jtype##_type;                    \
+  }
+  IS(null, null)
+  IS(bool, boolean)
+  IS(int, number)
+  IS(double, number)
+  IS(std::string, string)
+  IS(array, array)
+  IS(object, object)
+#undef IS
+#define GET(ctype, var)                                       \
+  template <> inline const ctype& value::get<ctype>() const { \
+    return var;                                               \
+  }                                                           \
+  template <> inline ctype& value::get<ctype>() {             \
+    return var;                                               \
+  }
+  GET(bool, boolean_)
+  GET(double, number_)
+  GET(std::string, *string_)
+  GET(array, *array_)
+  GET(object, *object_)
+#undef GET
+  inline value::operator bool() const {
+    switch (type_) {
+    case null_type:
+      return false;
+    case boolean_type:
+      return boolean_;
+    case number_type:
+      return number_ != 0;
+    case string_type:
+      return ! string_->empty();
+    default:
+      return true;
+    }
+  }
+  inline const value& value::get(size_t idx) const {
+    static value s_null;
+    assert(is<array>());
+    return idx < array_->size() ? (*array_)[idx] : s_null;
+  }
+
+  inline const value& value::get(const std::string& key) const {
+    static value s_null;
+    assert(is<object>());
+    object::const_iterator i = object_->find(key);
+    return i != object_->end() ? i->second : s_null;
+  }
+  inline std::string value::to_str() const {
+    switch (type_) {
+    case null_type:      return "null";
+    case boolean_type:   return boolean_ ? "true" : "false";
+    case number_type:    {
+      char buf[256];
+      SNPRINTF(buf, sizeof(buf), "%f", number_);
+      return buf;
+    }
+    case string_type:    return *string_;
+    case array_type:     return "array";
+    case object_type:    return "object";
+    default:             assert(0);
+#ifdef _MSC_VER
+      __assume(0);
+#endif
+    }
+  }
+  template <typename Iter> void copy(const std::string& s, Iter oi) {
+    std::copy(s.begin(), s.end(), oi);
+  }
+  template <typename Iter> void serialize_str(const std::string& s, Iter oi) {
+    *oi++ = '"';
+    for (std::string::const_iterator i = s.begin(); i != s.end(); ++i) {
+      switch (*i) {
+#define MAP(val, sym) case val: copy(sym, oi); break
+        MAP('"', "\\\"");
+        MAP('\\', "\\\\");
+        MAP('/', "\\/");
+        MAP('\b', "\\b");
+        MAP('\f', "\\f");
+        MAP('\n', "\\n");
+        MAP('\r', "\\r");
+        MAP('\t', "\\t");
+#undef MAP
+      default:
+        if ((unsigned char)*i < 0x20 || *i == 0x7f) {
+          char buf[7];
+          SNPRINTF(buf, sizeof(buf), "\\u%04x", *i & 0xff);
+          copy(buf, buf + 6, oi);
+          } else {
+          *oi++ = *i;
+        }
+        break;
+      }
+    }
+    *oi++ = '"';
+  }
+  template <typename Iter> void value::serialize(Iter oi) const {
+    switch (type_) {
+    case string_type:
+      serialize_str(*string_, oi);
+      break;
+    case array_type: {
+      *oi++ = '[';
+      for (array::const_iterator i = array_->begin(); i != array_->end(); ++i) {
+        if (i != array_->begin()) {
+          *oi++ = ',';
+        }
+        i->serialize(oi);
+      }
+      *oi++ = ']';
+      break;
+    }
+    case object_type: {
+      *oi++ = '{';
+      for (object::const_iterator i = object_->begin();
+           i != object_->end();
+           ++i) {
+        if (i != object_->begin()) {
+          *oi++ = ',';
+        }
+        serialize_str(i->first, oi);
+        *oi++ = ':';
+        i->second.serialize(oi);
+      }
+      *oi++ = '}';
+      break;
+    }
+    default:
+      copy(to_str(), oi);
+      break;
+    }
+  }
+  inline std::string value::serialize() const {
+    std::string s;
+    serialize(std::back_inserter(s));
+    return s;
+  }
+  template <typename Iter> class input {
+  protected:
+    Iter cur_, end_;
+    int last_ch_;
+    bool ungot_;
+    int line_;
+  public:
+    input(const Iter& first, const Iter& last) : cur_(first), end_(last), last_ch_(-1), ungot_(false), line_(1) {}
+    int getc() {
+      if (ungot_) {
+        ungot_ = false;
+        return last_ch_;
+      }
+      if (cur_ == end_) {
+        last_ch_ = -1;
+        return -1;
+      }
+      if (last_ch_ == '\n') {
+        line_++;
+      }
+      last_ch_ = *cur_++ & 0xff;
+      return last_ch_;
+    }
+    void ungetc() {
+      if (last_ch_ != -1) {
+        assert(! ungot_);
+        ungot_ = true;
+      }
+    }
+    Iter cur() const { return cur_; }
+    int line() const { return line_; }
+    void skip_ws() {
+      while (1) {
+        int ch = getc();
+        if (! (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r')) {
+          ungetc();
+          break;
+        }
+      }
+    }
+    int expect(int expect) {
+      skip_ws();
+      if (getc() != expect) {
+        ungetc();
+        return false;
+      }
+      return true;
+    }
+    bool match(const std::string& pattern) {
+      for (std::string::const_iterator pi(pattern.begin());
+           pi != pattern.end();
+           ++pi) {
+        if (getc() != *pi) {
+          ungetc();
+          return false;
+        }
+      }
+      return true;
+    }
+  };
+  template<typename Iter> inline int _parse_quadhex(input<Iter> &in) {
+    int uni_ch = 0, hex;
+    for (int i = 0; i < 4; i++) {
+      if ((hex = in.getc()) == -1) {
+        return -1;
+      }
+      if ('0' <= hex && hex <= '9') {
+        hex -= '0';
+      } else if ('A' <= hex && hex <= 'F') {
+        hex -= 'A' - 0xa;
+      } else if ('a' <= hex && hex <= 'f') {
+        hex -= 'a' - 0xa;
+      } else {
+        in.ungetc();
+        return -1;
+      }
+      uni_ch = uni_ch * 16 + hex;
+    }
+    return uni_ch;
+  }
+  template<typename Iter> inline bool _parse_codepoint(std::string& out, input<Iter>& in) {
+    int uni_ch;
+    if ((uni_ch = _parse_quadhex(in)) == -1) {
+      return false;
+    }
+    if (0xd800 <= uni_ch && uni_ch <= 0xdfff) {
+      if (0xdc00 <= uni_ch) {
+        // a second 16-bit of a surrogate pair appeared
+        return false;
+      }
+      // first 16-bit of surrogate pair, get the next one
+      if (in.getc() != '\\' || in.getc() != 'u') {
+        in.ungetc();
+        return false;
+      }
+      int second = _parse_quadhex(in);
+      if (! (0xdc00 <= second && second <= 0xdfff)) {
+        return false;
+      }
+      uni_ch = ((uni_ch - 0xd800) << 10) | ((second - 0xdc00) & 0x3ff);
+      uni_ch += 0x10000;
+    }
+    if (uni_ch < 0x80) {
+      out.push_back(uni_ch);
+    } else {
+      if (uni_ch < 0x800) {
+        out.push_back(0xc0 | (uni_ch >> 6));
+      } else {
+        if (uni_ch < 0x10000) {
+          out.push_back(0xe0 | (uni_ch >> 12));
+        } else {
+          out.push_back(0xf0 | (uni_ch >> 18));
+          out.push_back(0x80 | ((uni_ch >> 12) & 0x3f));
+        }
+        out.push_back(0x80 | ((uni_ch >> 6) & 0x3f));
+      }
+      out.push_back(0x80 | (uni_ch & 0x3f));
+    }
+    return true;
+  }
+  template<typename Iter> inline bool _parse_string(value& out, input<Iter>& in) {
+    // gcc 4.1 cannot compile if the below two lines are merged into one :-(
+    out = value(string_type, false);
+    std::string& s = out.get<std::string>();
+    while (1) {
+      int ch = in.getc();
+      if (ch < ' ') {
+        in.ungetc();
+        return false;
+      } else if (ch == '"') {
+        return true;
+      } else if (ch == '\\') {
+        if ((ch = in.getc()) == -1) {
+          return false;
+        }
+        switch (ch) {
+#define MAP(sym, val) case sym: s.push_back(val); break
+          MAP('"', '\"');
+          MAP('\\', '\\');
+          MAP('/', '/');
+          MAP('b', '\b');
+          MAP('f', '\f');
+          MAP('n', '\n');
+          MAP('r', '\r');
+          MAP('t', '\t');
+#undef MAP
+        case 'u':
+          if (! _parse_codepoint(s, in)) {
+            return false;
+          }
+          break;
+        default:
+          return false;
+        }
+      } else {
+        s.push_back(ch);
+      }
+    }
+    return false;
+  }
+  template <typename Iter> inline bool _parse_array(value& out, input<Iter>& in) {
+    out = value(array_type, false);
+    array& a = out.get<array>();
+    if (in.expect(']')) {
+      return true;
+    }
+    do {
+      a.push_back(value());
+      if (! _parse(a.back(), in)) {
+        return false;
+      }
+    } while (in.expect(','));
+    return in.expect(']');
+  }
+  template <typename Iter> inline bool _parse_object(value& out, input<Iter>& in) {
+    out = value(object_type, false);
+    object& o = out.get<object>();
+    if (in.expect('}')) {
+      return true;
+    }
+    do {
+      value key, val;
+      if (in.expect('"')
+          && _parse_string(key, in)
+          && in.expect(':')
+          && _parse(val, in)) {
+        o[key.to_str()] = val;
+      } else {
+        return false;
+      }
+    } while (in.expect(','));
+    return in.expect('}');
+  }
+  template <typename Iter> inline bool _parse_number(value& out, input<Iter>& in) {
+    std::string num_str;
+    while (1) {
+      int ch = in.getc();
+      if (('0' <= ch && ch <= '9') || ch == '+' || ch == '-' || ch == '.'
+          || ch == 'e' || ch == 'E') {
+        num_str.push_back(ch);
+      } else {
+        in.ungetc();
+        break;
+      }
+    }
+    char* endp;
+    out = value(strtod(num_str.c_str(), &endp));
+    return endp == num_str.c_str() + num_str.size();
+  }
+  template <typename Iter> inline bool _parse(value& out, input<Iter>& in) {
+    in.skip_ws();
+    int ch = in.getc();
+    switch (ch) {
+#define IS(ch, text, val) case ch: \
+      if (in.match(text)) { \
+        out = val; \
+        return true; \
+      } else { \
+        return false; \
+      }
+      IS('n', "ull", value());
+      IS('f', "alse", value(false));
+      IS('t', "rue", value(true));
+#undef IS
+    case '"':
+      return _parse_string(out, in);
+    case '[':
+      return _parse_array(out, in);
+    case '{':
+      return _parse_object(out, in);
+    default:
+      if (('0' <= ch && ch <= '9') || ch == '-') {
+        in.ungetc();
+        return _parse_number(out, in);
+      }
+      break;
+    }
+    in.ungetc();
+    return false;
+  }
+  // obsolete, use the version below
+  template <typename Iter> inline std::string parse(value& out, Iter& pos, const Iter& last) {
+    std::string err;
+    pos = parse(out, pos, last, &err);
+    return err;
+  }
+  template <typename Iter> inline Iter parse(value& out, const Iter& first, const Iter& last, std::string* err) {
+    input<Iter> in(first, last);
+    if (! _parse(out, in) && err != NULL) {
+      char buf[64];
+      SNPRINTF(buf, sizeof(buf), "syntax error at line %d near: ", in.line());
+      *err = buf;
+      while (1) {
+        int ch = in.getc();
+        if (ch == -1 || ch == '\n') {
+          break;
+        } else if (ch >= ' ') {
+          err->push_back(ch);
+        }
+      }
+    }
+    return in.cur();
+  }
+  inline std::string parse(value& out, std::istream& is) {
+    std::string err;
+    parse(out, std::istreambuf_iterator<char>(is.rdbuf()),
+          std::istreambuf_iterator<char>(), &err);
+    return err;
+  }
+  template <typename T> struct last_error_t {
+    static std::string s;
+  };
+  template <typename T> std::string last_error_t<T>::s;
+  inline void set_last_error(const std::string& s) {
+    last_error_t<bool>::s = s;
+  }
+  inline const std::string& get_last_error() {
+    return last_error_t<bool>::s;
+  }
+
+  inline bool operator==(const value& x, const value& y) {
+    if (x.is<null>())
+      return y.is<null>();
+#define PICOJSON_CMP(type)                                      \
+    if (x.is<type>())                                           \
+      return y.is<type>() && x.get<type>() == y.get<type>()
+    PICOJSON_CMP(bool);
+    PICOJSON_CMP(double);
+    PICOJSON_CMP(std::string);
+    PICOJSON_CMP(array);
+    PICOJSON_CMP(object);
+#undef PICOJSON_CMP
+    assert(0);
+#ifdef _MSC_VER
+    __assume(0);
+#endif
+    return false;
+  }
+  inline bool operator!=(const value& x, const value& y) {
+    return ! (x == y);
+  }
+}
+
+inline std::istream& operator>>(std::istream& is, picojson::value& x)
+{
+  picojson::set_last_error(std::string());
+  std::string err = picojson::parse(x, is);
+  if (! err.empty()) {
+    picojson::set_last_error(err);
+    is.setstate(std::ios::failbit);
+  }
+  return is;
+}
+
+inline std::ostream& operator<<(std::ostream& os, const picojson::value& x)
+{
+  x.serialize(std::ostream_iterator<char>(os));
+  return os;
+}
+#ifdef _MSC_VER
+    #pragma warning(pop)
+#endif
+
+#endif
+#ifdef TEST_PICOJSON
+#ifdef _MSC_VER
+    #pragma warning(disable : 4127) // conditional expression is constant
+#endif
+
+using namespace std;
+static void plan(int num)
+{
+  printf("1..%d\n", num);
+}
+
+static void ok(bool b, const char* name = "")
+{
+  static int n = 1;
+  printf("%s %d - %s\n", b ? "ok" : "ng", n++, name);
+}
+
+template <typename T> void is(const T& x, const T& y, const char* name = "")
+{
+  if (x == y) {
+    ok(true, name);
+  } else {
+    ok(false, name);
+  }
+}
+
+#include <algorithm>
+
+int main(void)
+{
+  plan(61);
+#define TEST(in, type, cmp, serialize_test) {                           \
+    picojson::value v;                                                  \
+    const char* s = in;                                                 \
+    string err = picojson::parse(v, s, s + strlen(s));                  \
+    ok(err.empty(), in " no error");                                    \
+    ok(v.is<type>(), in " check type");                                 \
+    is(v.get<type>(), cmp, in " correct output");                       \
+    is(*s, '\0', in " read to eof");                                    \
+    if (serialize_test) {                                               \
+      is(v.serialize(), string(in), in " serialize");                   \
+    }                                                                   \
+  }
+  TEST("false", bool, false, true);
+  TEST("true", bool, true, true);
+  TEST("90.5", double, 90.5, false);
+  TEST("\"hello\"", string, string("hello"), true);
+  TEST("\"\\\"\\\\\\/\\b\\f\\n\\r\\t\"", string, string("\"\\/\b\f\n\r\t"),
+       true);
+  TEST("\"\\u0061\\u30af\\u30ea\\u30b9\"", string,
+       string("a\xe3\x82\xaf\xe3\x83\xaa\xe3\x82\xb9"), false);
+  TEST("\"\\ud840\\udc0b\"", string, string("\xf0\xa0\x80\x8b"), false);
+#undef TEST
+
+#define TEST(type, expr) {                                             \
+    picojson::value v;                                                 \
+    const char *s = expr;                                              \
+    string err = picojson::parse(v, s, s + strlen(s));                 \
+    ok(err.empty(), "empty " #type " no error");                       \
+    ok(v.is<picojson::type>(), "empty " #type " check type");          \
+    ok(v.get<picojson::type>().empty(), "check " #type " array size"); \
+  }
+  TEST(array, "[]");
+  TEST(object, "{}");
+#undef TEST
+  {
+    picojson::value v;
+    const char *s = "[1,true,\"hello\"]";
+    string err = picojson::parse(v, s, s + strlen(s));
+    ok(err.empty(), "array no error");
+    ok(v.is<picojson::array>(), "array check type");
+    is(v.get<picojson::array>().size(), size_t(3), "check array size");
+    ok(v.get(0).is<double>(), "check array[0] type");
+    is(v.get(0).get<double>(), 1.0, "check array[0] value");
+    ok(v.get(1).is<bool>(), "check array[1] type");
+    ok(v.get(1).get<bool>(), "check array[1] value");
+    ok(v.get(2).is<string>(), "check array[2] type");
+    is(v.get(2).get<string>(), string("hello"), "check array[2] value");
+  }
+  {
+    picojson::value v;
+    const char *s = "{ \"a\": true }";
+    string err = picojson::parse(v, s, s + strlen(s));
+    ok(err.empty(), "object no error");
+    ok(v.is<picojson::object>(), "object check type");
+    is(v.get<picojson::object>().size(), size_t(1), "check object size");
+    ok(v.get("a").is<bool>(), "check property exists");
+    is(v.get("a").get<bool>(), true,
+       "check property value");
+    is(v.serialize(), string("{\"a\":true}"), "serialize object");
+  }
+
+#define TEST(json, msg) do {                            \
+    picojson::value v;                                  \
+    const char *s = json;                               \
+    string err = picojson::parse(v, s, s + strlen(s));  \
+    is(err, string("syntax error at line " msg), msg);  \
+  } while (0)
+  TEST("falsoa", "1 near: oa");
+  TEST("{]", "1 near: ]");
+  TEST("\n\bbell", "2 near: bell");
+  TEST("\"abc\nd\"", "1 near: ");
+#undef TEST
+  {
+    picojson::value v1, v2;
+    const char *s;
+    string err;
+    s = "{ \"b\": true, \"a\": [1,2,\"three\"], \"d\": 2 }";
+    err = picojson::parse(v1, s, s + strlen(s));
+    s = "{ \"d\": 2.0, \"b\": true, \"a\": [1,2,\"three\"] }";
+    err = picojson::parse(v2, s, s + strlen(s));
+    ok((v1 == v2), "check == operator in deep comparison");
+  }
+
+  {
+    picojson::value v1, v2;
+    const char *s;
+    string err;
+    s = "{ \"b\": true, \"a\": [1,2,\"three\"], \"d\": 2 }";
+    err = picojson::parse(v1, s, s + strlen(s));
+    s = "{ \"d\": 2.0, \"a\": [1,\"three\"], \"b\": true }";
+    err = picojson::parse(v2, s, s + strlen(s));
+    ok((v1 != v2), "check != operator for array in deep comparison");
+  }
+
+  {
+    picojson::value v1, v2;
+    const char *s;
+    string err;
+    s = "{ \"b\": true, \"a\": [1,2,\"three\"], \"d\": 2 }";
+    err = picojson::parse(v1, s, s + strlen(s));
+    s = "{ \"d\": 2.0, \"a\": [1,2,\"three\"], \"b\": false }";
+    err = picojson::parse(v2, s, s + strlen(s));
+    ok((v1 != v2), "check != operator for object in deep comparison");
+  }
+
+  {
+    picojson::value v1, v2;
+    const char *s;
+    string err;
+    s = "{ \"b\": true, \"a\": [1,2,\"three\"], \"d\": 2 }";
+    err = picojson::parse(v1, s, s + strlen(s));
+    picojson::object& o = v1.get<picojson::object>();
+    o.erase("b");
+    picojson::array& a = o["a"].get<picojson::array>();
+    picojson::array::iterator i;
+    i = std::remove(a.begin(), a.end(), picojson::value(std::string("three")));
+    a.erase(i, a.end());
+    s = "{ \"a\": [1,2], \"d\": 2 }";
+    err = picojson::parse(v2, s, s + strlen(s));
+    ok((v1 == v2), "check erase()");
+  }
+
+  return 0;
+}
+
+#endif
diff --git a/lib/system-controller/CicoLog.h b/lib/system-controller/CicoLog.h
new file mode 100644 (file)
index 0000000..e93b991
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * 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 __CICO_LOG_H__
+#define __CICO_LOG_H__
+
+#include "ico_log.h"
+
+#endif  // __CICO__LOG_H__
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/lib/system-controller/CicoSCAilItems.cpp b/lib/system-controller/CicoSCAilItems.cpp
new file mode 100644 (file)
index 0000000..78cde86
--- /dev/null
@@ -0,0 +1,753 @@
+/*
+ * 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
+ *
+ */
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <vector>
+#include <utility>
+#include <cstdlib>
+
+#include "CicoSCAilItems.h"
+#include "CicoSCConf.h"
+#include "CicoSCSystemConfig.h"
+#include "CicoLog.h"
+
+using namespace std;
+
+void split(const string &s, char d, vector<string> &e)
+{
+    stringstream ss(s);
+    string it;
+    while(getline(ss, it, d)) {
+        e.push_back(it);
+    }
+    return;
+}
+
+/**
+ * @brief constructor
+ */
+CicoSCAilItems::CicoSCAilItems()
+{
+    ICO_TRA("start");
+    init();
+    ICO_TRA("end");
+}
+
+/**
+ * @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 cateforys environ file data
+ */
+CicoSCAilItems::CicoSCAilItems(const char* pkg, const char* icon,
+                               const char* nam, const char* ctgry,
+                               const char* typ, const char* exe,
+                               const std::string categorys, bool ndisp)
+{
+    ICO_TRA("start");
+    init();
+    setup(pkg, icon, nam, ctgry, typ, exe, categorys, ndisp);
+    ICO_TRA("end");
+}
+
+CicoSCAilItems::CicoSCAilItems(const CicoSCAilItems &s)
+{
+    m_appid = s.m_appid;    // PACKAGE NAME
+    m_icon = s.m_icon;  // ICON
+    m_name = s.m_name;  // NAME
+    m_execPath = s.m_execPath;  // EXEC
+    m_type = s.m_type;  // TYPE
+
+    m_categories = s.m_categories; // CATEGORIES
+
+    m_nodeID = s.m_nodeID;  // "run=xxx" xxx change to id
+    m_kindID = s.m_kindID;  // "kind=xxx" xxx change to id
+    m_categoryID = s.m_categoryID;  // "category=xxx" xxx change to id
+
+    m_display = s.m_display; //
+    m_layer = s.m_layer;
+    m_displayZone = s.m_displayZone; // display zone number
+    m_soundZone = s.m_soundZone;  // sound zone number
+    m_sound = s.m_sound;
+    m_inputDev = s.m_inputDev;   // input device number
+    m_switch = s.m_switch;
+    m_noIcon = s.m_noIcon;
+    m_animation = s.m_animation;
+    m_animationTime = s.m_animationTime;
+    m_invisibleCPU = s.m_invisibleCPU;
+    m_memnuOverlap = s.m_memnuOverlap;
+    m_autoStart = s.m_autoStart; // auto start flag
+
+    m_group = s.m_group;
+    m_location = s.m_location;
+    m_resumeShow = s.m_resumeShow;
+}
+
+/**
+ * @brief
+ */
+CicoSCAilItems::~CicoSCAilItems()
+{
+    ICO_TRA("start");
+    ICO_TRA("end");
+}
+/**
+ * @brief init member 
+ */
+void CicoSCAilItems::init()
+{
+    
+    m_appid.clear();      // PACKAGE NAME
+    m_icon.clear();       // ICON
+    m_name.clear();       // NAME
+    m_execPath.clear();   // EXEC
+    m_type.clear();       // TYPE
+
+    m_categories.clear(); // CATEGORIES
+
+    const CicoSCDefaultConf* oCSCDC;
+    oCSCDC = CicoSCSystemConfig::getInstance()->getDefaultConf();
+    if (NULL != oCSCDC) {
+        ICO_TRA("CicoSCAilItems::init base CicoSCDefaultConf");
+        m_nodeID      = oCSCDC->node;
+        m_kindID      = oCSCDC->appkind;
+        m_categoryID  = oCSCDC->category;
+
+        m_display     = oCSCDC->display;
+        m_layer       = oCSCDC->layer;
+        m_displayZone = oCSCDC->displayzone;
+
+        m_sound       = oCSCDC->sound;
+        m_soundZone   = oCSCDC->soundzone;
+
+        m_inputDev    = oCSCDC->inputdev;
+        m_switch      = oCSCDC->inputsw;
+    }
+    else {
+        ICO_TRA("CicoSCAilItems::init base define");
+        m_nodeID      = DINITm_nodeID; // "run=xxx" xxx change to id
+        m_kindID      = DINITm_kindID; // "kind=xxx" xxx change to id
+        m_categoryID  = DINITm_categoryID; // "category=xxx" xxx change to id
+
+        m_display     = DINITm_display; //
+        m_layer       = DINITm_layer;
+        m_displayZone = DINITm_displayZone; // display zone
+
+        m_soundZone   = DINITm_soundZone; // sound zone
+        m_sound       = DINITm_sound;
+
+        m_inputDev    = DINITm_inputDev; // input device
+        m_switch      = DINITm_switch;
+    }
+
+    m_noIcon = false;
+    m_animation.clear();
+    m_animationTime = DINITm_animationTime;
+    m_invisibleCPU = DINITm_invisibleCPU;
+    m_memnuOverlap = false;
+    m_autoStart = false; // auto start flag
+
+    m_group.clear();
+    m_location.clear();
+    m_resumeShow = false;
+}
+
+/**
+ * @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 cateforys environ file data
+ */
+void CicoSCAilItems::setup(const char* pkg, const char* icon,
+                           const char* nam, const char* ctgry,
+                           const char* typ, const char* exe,
+                           std::string categorys, bool ndisp)
+{
+    ICO_TRA("start");
+    m_appid.assign(pkg);
+
+    m_noIcon = ndisp;
+    if (NULL != icon) {
+        m_icon.assign(icon);
+    }
+
+    if (NULL != nam) {
+        m_name.assign(nam);
+    }
+
+    if (NULL != exe) {
+        m_execPath.assign(exe);
+    }
+
+    if (NULL != typ) {
+        m_type.assign(typ);
+    }
+
+    categoryParse(categorys);
+    ICO_TRA("end");
+}
+
+const string s_run("run");
+const string s_kind("kind");
+const string s_category("category");
+const string s_display("display");
+const string s_layer("layer");
+const string s_dispzone("dispzone");
+const string s_sound("sound");
+const string s_input("input");
+const string s_NoDisplay("NoDisplay");
+const string s_Animation("Animation");
+const string s_invisiblecpu("invisiblecpu");
+const string s_noconfigure("noconfigure");
+const string s_menuoverlap("menuoverlap");
+const string s_auto("auto");
+const string s_noauto("noauto");
+
+const string s_soundzone("soundzone");
+const string s_Animation_time("Animation_time");
+
+/**
+ * @brief category string parse
+ * @parm category string data split code ";"
+ */
+void CicoSCAilItems::categoryParse(const std::string categorys)
+{
+    ICO_TRA("start");
+    if (categorys.empty()) {
+        ICO_TRA("end no category");
+        return;
+    }
+    vector<string> x;
+    split(categorys, ';', x);
+    vector<string>::iterator it = x.begin(); // iterator
+    string displayName;
+    string layerName;
+    string dispZoneName;
+    string soundName;
+    string soundZoneName;
+    string inputDevName;
+    string switchName;
+
+    displayName.clear();
+    layerName.clear();
+    dispZoneName.clear();
+    soundName.clear();
+    soundZoneName.clear();
+    inputDevName.clear();
+    switchName.clear();
+
+    ICO_DBG("category def size = %d", x.size());
+    for (it = x.begin(); it != x.end(); it++) {
+
+        // run
+        if (0 == strncasecmp(it->c_str(), s_run.c_str(), s_run.size())) {
+            if (true == categoryParseRun(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // kind
+        if (0 == strncasecmp(it->c_str(), s_kind.c_str(), s_kind.size())) {
+            if (true == categoryParseKind(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // category
+        if (0 == strncasecmp(it->c_str(), s_category.c_str(),
+                             s_category.size())) {
+            if (true == categoryParseCategory(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // display
+        if (0 == strncasecmp(it->c_str(), s_display.c_str(),
+                             s_display.size())) {
+            if (true == categoryParseGetValue(*it, s_display, displayName)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // layer
+        if (0 == strncasecmp(it->c_str(), s_layer.c_str(), s_layer.size())) {
+            if (true == categoryParseGetValue(*it, s_layer, layerName)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // dispzone
+        if (0 == strncasecmp(it->c_str(), s_dispzone.c_str(),
+                             s_dispzone.size())) {
+            if (true == categoryParseGetValue(*it, s_dispzone, dispZoneName)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // sound / soundzone
+        if (0 == strncasecmp(it->c_str(), s_soundzone.c_str(),
+                             s_soundzone.size())) {
+            if (true == categoryParseGetValue(*it, s_soundzone,
+                                              soundZoneName)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+        if (0 == strncasecmp(it->c_str(), s_sound.c_str(), s_sound.size())) {
+            if (true == categoryParseGetValue(*it, s_sound, soundName)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // input
+        if (0 == strncasecmp(it->c_str(), s_input.c_str(), s_input.size())) {
+            if (true == categoryParseGetValue(*it, s_input, inputDevName)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+// TODO mk_k not get switchName
+//     switchName
+// TODO mk_k not get switchName
+
+        // NoDisplay
+        if (0 == strncasecmp(it->c_str(), s_NoDisplay.c_str(),
+                             s_NoDisplay.size())) {
+            if (true == categoryParseNodisplay(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // Animation / Animation_time
+        if (0 == strncasecmp(it->c_str(), s_Animation.c_str(),
+                             s_Animation.size())) {
+            if (true == categoryParseAnimation(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // invisiblecpu
+        if (0 == strncasecmp(it->c_str(), s_invisiblecpu.c_str(),
+                             s_invisiblecpu.size())) {
+            if (true == categoryParseInvisiblecpu(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // noconfigure
+        if (0 == strncasecmp(it->c_str(), s_noconfigure.c_str(),
+                             s_noconfigure.size())) {
+            if (true == categoryParseNoconfigure(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // menuoverlap
+        if (0 == strncasecmp(it->c_str(), s_menuoverlap.c_str(),
+                             s_menuoverlap.size())) {
+            if (true == categoryParseMenuoverlap(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // auto
+        if (0 == strncasecmp(it->c_str(), s_auto.c_str(), s_auto.size())) {
+            if (true == categoryParseAuto(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // noauto
+        if (0 == strncasecmp(it->c_str(), s_noauto.c_str(),
+                             s_noauto.size())) {
+            if (true == categoryParseNoauto(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+        ICO_DBG("Parse UNKOWN %s", it->c_str());
+    }
+    categoryGetDisplay(displayName, layerName, dispZoneName);
+    categoryGetSound(soundName, soundZoneName);
+    categoryGetInput(inputDevName, switchName);
+    ICO_TRA("end");
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseRun(const string& s)
+{
+    ICO_TRA("start");
+    const char* ps = s.c_str();
+    int c = s_run.size();
+    if ('=' != ps[c]) {
+        ICO_TRA("end");
+        return false;
+    }
+    // "run=xxx"
+// TODO mk_k START getHostID(..) request order
+    CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
+    int nodeID = CSCSC->getNodeIdbyName(&ps[c+1]);
+// TODO mk_k int nodeID = -1;
+// TODO mk_k int nodeID = CSCSC->getHostID(&ps[c+1]);
+// TODO mk_k END getHostID(..) request order
+    if (nodeID==-1) {
+        ICO_TRA("end");
+        return false;
+    }
+    m_nodeID = nodeID;
+    ICO_TRA("end %d", m_nodeID);
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseKind(const string& s)
+{
+    ICO_TRA("start");
+    const char* ps = s.c_str();
+    int c = s_kind.size();
+    if ('=' != ps[c]) {
+        ICO_TRA("end");
+        return false;
+    }
+    // "kind=xxx" xxx change to id
+    CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
+    int kindID = CSCSC->getAppKindIdbyName(&ps[c+1]);
+    if (kindID==-1) {
+        ICO_TRA("end");
+        return false;
+    }
+    m_kindID = kindID;
+    ICO_TRA("end %d", m_kindID);
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseCategory(const string& s)
+{
+    ICO_TRA("start");
+    const char* ps = s.c_str();
+    int c = s_category.size();
+    if ('=' != ps[c]) {
+        ICO_TRA("end");
+        return false;  // not "category=xxx"
+    }
+    // "category=xxx" xxx change to id
+    CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
+    int categoryID = CSCSC->getCategoryIdbyName(&ps[c+1]);
+    if (categoryID==-1) {
+        ICO_TRA("end");
+        return false; // unkown category xxx
+    }
+    m_categoryID = categoryID;
+    ICO_TRA("end");
+    return true;
+}
+
+/**
+ * @brief value get
+ * @param s "key=value" string
+ * @param k key string
+ * @param val store value
+ * @retval true get value success
+ * @retval false get not good
+ */
+bool CicoSCAilItems::categoryParseGetValue(const std::string& s,
+                                           const std::string& k,
+                                           std::string val)
+{
+    ICO_TRA("start, %s, %s", s.c_str(), k.c_str());
+    const char* ps = s.c_str();
+    int c = k.size();
+    int c2;
+#if 0 // TODO mk_k x!?
+    int x = -1;
+#endif // TODO mk_k x!?
+    if ('=' == ps[c]) {
+#if 0 // TODO mk_k x!?
+        x = 0;
+#endif // TODO mk_k x!?
+        c2 = c+1;
+    }
+#if 0 // TODO mk_k .[0-9] !?
+    else if (('.' == ps[c]) &&
+             (0 != isdigit((int)ps[c+1])) &&
+             ('=' == ps[c+2])) {
+        x = (int) ps[c+1] - '0';
+        c2 = c+3;
+
+    }
+#endif // TODO mk_k .[0-9] !?
+    else {
+        ICO_TRA("end NG");
+        return false;
+    }
+    val = ps[c2];
+    ICO_TRA("end %s", val.c_str());
+    return true;
+}
+    
+/**
+ * @brief get
+ * @param disp display key name
+ * @param layer display layer key name
+ * @param zone display zone key name
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryGetDisplay(const string& disp,
+                                        const string& layer,
+                                        const string& zone)
+{
+    ICO_TRA("start");
+    if (true == disp.empty()) {
+        ICO_TRA("end not get display's data");
+        return false;
+    }
+
+    CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
+    m_display = CSCSC->getDisplayIdbyName(disp);
+    ICO_DBG("display %s->%d", disp.c_str(), m_display);
+    if (false == layer.empty()) {
+        m_layer = CSCSC->getLayerIdfbyName(disp, layer);
+        ICO_DBG("layer %s, %s->%d", disp.c_str(), layer.c_str(), m_layer);
+    }
+    if (false == zone.empty()) {
+        m_displayZone = CSCSC->getDizplayZoneIdbyName(disp, zone);
+        ICO_DBG("zone %s, %s->%d", disp.c_str(), zone.c_str(), m_displayZone);
+    }
+    ICO_TRA("end d:%d l:%d z:%d", m_display, m_layer, m_displayZone);
+    return true;
+}
+
+/**
+ * @brief get sound config data
+ * @param sound name key
+ * @param soundZone name key
+ * @retval true get data
+ * @retval false param fail
+ */
+bool CicoSCAilItems::categoryGetSound(const string& sound, const string& zone)
+{
+    ICO_TRA("start");
+    if (true == sound.empty()) {
+        ICO_TRA("end not get sound's data");
+        return false;
+    }
+
+    CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
+    m_sound = CSCSC->getSoundIdbyName(sound);
+    ICO_DBG("sound %s->%d", sound.c_str(), m_sound);
+    if (false == zone.empty()) {
+        m_soundZone = CSCSC->getSoundZoneIdbyName(sound, zone);
+        ICO_DBG("zone %s, %s->%d", sound.c_str(), zone.c_str(), m_soundZone);
+    }
+    ICO_TRA("end s:%d z:%d", m_sound, m_soundZone);
+    return true;
+}
+
+bool CicoSCAilItems::categoryGetInput(const string& inputDev,
+                                      const string& sw)
+{
+    ICO_TRA("start");
+    if (true == inputDev.empty()) {
+        ICO_TRA("end not get input Device's data");
+        return false;
+    }
+
+    CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
+    m_sound = CSCSC->getInputDevIdbyName(inputDev);
+    ICO_DBG("sound %s->%d", inputDev.c_str(), m_sound);
+    if (false == sw.empty()) {
+        m_switch = CSCSC->getSwitchIdbyName(inputDev, sw);
+        ICO_DBG("switch %s, %s->%d", inputDev.c_str(), sw.c_str(), m_switch);
+    }
+    ICO_TRA("end idev:%d i:%d", m_inputDev, m_switch);
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseNodisplay(const string& s)
+{
+    ICO_TRA("start");
+    const char* ps = s.c_str();
+    int c = s_NoDisplay.size();
+    if ('=' != ps[c]) {
+        ICO_TRA("end");
+        return false;  // not "NoDisplay=true/false"
+    }
+    if (0 == strcasecmp(&ps[c+1], "false")) {
+        m_noIcon = false;
+    }
+    else {
+        m_noIcon = true;
+    }
+    ICO_TRA("end");
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseAnimation(const string& s)
+{
+    ICO_TRA("start");
+    const char* ps = s.c_str();
+    int c = s_Animation_time.size();
+    bool b_at = false;  // animation time flag off
+    if (0 == strncasecmp(ps, s_Animation_time.c_str(), c)) {
+        b_at = true;    // flag on
+    }
+    else {
+        c = s_Animation.size(); // not Animation_time
+    }
+    if ('=' != ps[c]) {
+        ICO_TRA("end");
+        return false;  // not "Animation=xxx" / "Animation_time=xxx"
+    }
+    if (true == b_at) {
+        // Animation_time
+        m_animationTime = (int)strtol(&ps[c+1], (char **)0, 0);
+    }
+    else {
+        // Animation
+        m_animation = &ps[c+1];
+    }
+    ICO_TRA("end");
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseInvisiblecpu(const string& s)
+{
+    ICO_TRA("start");
+    const char* ps = s.c_str();
+    int c = s_invisiblecpu.size();
+    if ('=' != ps[c]) {
+        ICO_TRA("end");
+        return false;  // not "invisibluecpu=xxx"
+    }
+    if (0 == strcasecmp(&ps[c+1], "yes")) {
+        m_invisibleCPU = 100;
+    }
+    else if (0 != strcasecmp(&ps[c+1], "no")) {
+        m_invisibleCPU = (int)strtol(&ps[c+1], (char **)0, 0);
+    }
+    else { // "no"
+        m_invisibleCPU = 0;
+    }
+    ICO_TRA("end %s,%d", &ps[c+1], m_invisibleCPU);
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseNoconfigure(const string&)
+{
+// TODO mk_k
+    ICO_TRA("start");
+//    m_noconfigure = true;
+    ICO_TRA("end");
+//    return true;
+    return false;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseMenuoverlap(const string&)
+{
+    ICO_TRA("start");
+    m_memnuOverlap = true;
+    ICO_TRA("end");
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseAuto(const string&)
+{
+    ICO_TRA("start");
+    m_autoStart = true;
+    ICO_TRA("end");
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseNoauto(const string&)
+{
+    ICO_TRA("start");
+    m_autoStart = false;
+    ICO_TRA("end");
+    return true;
+}
+
diff --git a/lib/system-controller/CicoSCAilItems.h b/lib/system-controller/CicoSCAilItems.h
new file mode 100644 (file)
index 0000000..f6cbde2
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * 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
+ *
+ */
+#ifndef CICOSCAILITEMS_H
+#define CICOSCAILITEMS_H
+#include <glib.h>
+#include <string>
+#include <vector>
+
+
+#define DINITm_nodeID -1
+#define DINITm_kindID -1
+#define DINITm_categoryID -1
+#define DINITm_display -1
+#define DINITm_layer -1
+#define DINITm_displayZone -1
+#define DINITm_soundZone -1
+#define DINITm_sound -1
+#define DINITm_inputDev -1
+#define DINITm_switch -1
+#define DINITm_animationTime 0
+#define DINITm_invisibleCPU 0
+
+/**
+ * @brief AIL infomation data class
+ *
+ */
+
+class CicoSCAilItems {
+public: // member method
+    CicoSCAilItems();
+    CicoSCAilItems(const char* pkg, const char* icon, const char* nam,
+                   const char* ctgry, const char* typ, const char* exe,
+                   std::string categorys, bool ndisp);
+    CicoSCAilItems(const CicoSCAilItems& rAilItems);
+    ~CicoSCAilItems();
+
+    void init();
+    void setup(const char* pkg, const char* icon, const char* nam,
+               const char* ctgry, const char* typ, const char* exe,
+               std::string categorys, bool ndisp);
+
+    const CicoSCAilItems* p() const;
+
+protected: // member method
+    void categoryParse(const std::string categorys);
+    bool categoryParseRun(const std::string& s);
+    bool categoryParseKind(const std::string& s);
+    bool categoryParseCategory(const std::string& s);
+    bool categoryParseGetValue(const std::string& s, const std::string& k,
+                               std::string val);
+    bool categoryGetDisplay(const std::string& disp, const std::string& layer,
+                            const std::string& zone);
+    bool categoryGetSound(const std::string& sound, const std::string& zone);
+    bool categoryGetInput(const std::string& inputDev,
+                          const std::string& sw);
+    bool categoryParseNodisplay(const std::string& s);
+    bool categoryParseAnimation(const std::string& s);
+    bool categoryParseInvisiblecpu(const std::string& s);
+    bool categoryParseNoconfigure(const std::string& s);
+    bool categoryParseMenuoverlap(const std::string& s);
+    bool categoryParseAuto(const std::string& s);
+    bool categoryParseNoauto(const std::string& s);
+
+private: // member method
+
+public: // member aria
+    std::string m_appid;      // PACKAGE NAME
+    std::string m_icon;       // ICON
+    std::string m_name;       // NAME
+    std::string m_execPath;   // EXEC
+    std::string m_type;       // TYPE
+
+    std::string m_categories; // CATEGORIES
+
+    int  m_nodeID;      // "run=xxx" xxx change to id
+    int  m_kindID;      // "kind=xxx" xxx change to id
+    int  m_categoryID;  // "category=xxx" xxx change to id
+
+    int  m_display;   //
+    int  m_layer;
+    int  m_displayZone; // display zone
+    int  m_soundZone;  // sound zone
+    int  m_sound;
+    int  m_inputDev;   // input device
+    int  m_switch;
+    bool m_noIcon;
+    std::string m_animation;
+    int  m_animationTime;
+    int  m_invisibleCPU;
+    bool m_memnuOverlap;
+    bool m_autoStart; // auto start flag
+
+
+    std::string m_group;
+    std::string m_location;
+    bool m_resumeShow;
+};
+
+inline const CicoSCAilItems* CicoSCAilItems::p() const
+{
+    return this;
+}
+
+#endif // CICOAILITEMS_H
diff --git a/lib/system-controller/CicoSCAulItems.cpp b/lib/system-controller/CicoSCAulItems.cpp
new file mode 100644 (file)
index 0000000..47e998c
--- /dev/null
@@ -0,0 +1,204 @@
+/*
+ * 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
+ *
+ */
+#include <iostream>
+#include <string>
+#include <fstream>
+#include <vector>
+#include <memory>
+#include <cstdio>
+#include <cstdlib>
+#include <string.h>
+#include <aul/aul.h>
+
+#include "CicoLog.h"
+#include "CicoSCAulItems.h"
+#include "CicoSCAilItems.h"
+#include "CicoSCConf.h"
+#include "CicoSCSystemConfig.h"
+
+using namespace std;
+
+/**
+ * @brief AUL Items class constructor
+ */
+CicoSCAulItems::CicoSCAulItems()
+{
+    ICO_TRA("CicoSCAulItems::CicoSCAulItems");
+    m_appid.clear(); // appid
+    m_pid = 0; // pid
+    m_category = DINITm_categoryID;
+    m_cpucgroup = -1;
+    m_memcgroup = -1;
+    m_defCgrpCpu.clear();
+    m_defCgrpMem.clear();
+}
+
+/**
+ * @brief AUL Items class constructor
+ */
+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");
+    enterWindow(obj);
+    getPidCgroupInfo(pid, m_defCgrpMem, m_defCgrpCpu);
+    m_cpucgroup = -1;
+    m_memcgroup = -1;
+    if (DINITm_categoryID == m_category) {
+        CicoSCSystemConfig* conf = CicoSCSystemConfig::getInstance();
+        const CicoSCCategoryConf* obj = 
+            conf->getCategoryObjbyCaategoryID(m_category);
+        if (NULL != obj) {
+            m_cpucgroup = obj->rctrl;
+        }
+    }
+}
+
+/**
+ * @brief AUL Items class constructor
+ */
+CicoSCAulItems::CicoSCAulItems(const CicoSCAulItems& s)
+{
+    m_appid = s.m_appid;
+    m_pid = s.m_pid;
+    m_category = s.m_category;
+    m_cpucgroup = s.m_cpucgroup;
+    m_memcgroup = s.m_memcgroup;
+#if 1 // TODO mk_k
+    m_CSCWptrs = s.m_CSCWptrs;
+#else
+    int sz = s.m_CSCWptrs.size();
+    for (int i = 0; i < sz; i++) {
+        m_CSCWptrs.push_back(s.m_CSCWptrs[i]);
+    }
+#endif
+    m_defCgrpCpu = s.m_defCgrpCpu;
+    m_defCgrpMem = s.m_defCgrpMem;
+}
+
+/**
+ * @brief AUL Items class destructor
+ */
+CicoSCAulItems::~CicoSCAulItems()
+{
+    ICO_TRA("CicoSCAulItems::~CicoSCAulItems");
+    m_CSCWptrs.clear();
+}
+
+/**
+ * @brief CicoSCWindow pointer entry
+ * @param obj entry pointer
+ */
+void CicoSCAulItems::enterWindow(const CicoSCWindow* obj)
+{
+    ICO_TRA("CicoSCAulItems::enterWindow %x", obj);
+    if ((NULL == obj) || (0 == obj)) {
+        ICO_TRA("CicoSCAulItems::enterWindow");
+        return;
+    }
+    bool bingo = false; // Registered flag off
+#if 1 // TODO mk_k
+    vector<const CicoSCWindow*>::iterator it = m_CSCWptrs.begin();
+    vector<const CicoSCWindow*>::iterator theEnd = m_CSCWptrs.end();
+    for(; it != theEnd; ++it) {
+        if (obj == *it) { // if Registered ?
+            bingo = true; // Registered flag on
+            break; // break of for
+        }
+    }
+#else
+    int sz = m_CSCWptrs.size();
+    for (int i = 0; i < sz; i++) {
+        if (obj == m_CSCWptrs[i]) {
+            bingo = true;
+            break; // break of for
+        }
+    }
+#endif
+    if (false == bingo) {
+        ICO_TRA("add window pointer");
+        m_CSCWptrs.push_back(obj);
+    }
+    ICO_TRA("CicoSCAulItems::enterWindow");
+    return;
+}
+
+/**
+ * @breif removw CicoSCWindow pointer
+ * @param obj remove target
+ */
+void CicoSCAulItems::rmWindow(const CicoSCWindow* obj)
+{
+    ICO_TRA("CicoSCAulItems::rmWindow %x", obj);
+    vector<const CicoSCWindow*>::iterator it = m_CSCWptrs.begin();
+    vector<const CicoSCWindow*>::iterator theEnd = m_CSCWptrs.end();
+    for(; it != theEnd; ++it) {
+        if (obj == *it) {
+            ICO_TRA("CicoSCAulItems::rmWindow");
+            m_CSCWptrs.erase(it);
+            break; // break of for
+        }
+    }
+    ICO_TRA("CicoSCAulItems::rmWindow");
+    return;
+}
+
+/**
+ * @breif get cgroup data by /proc/[pid]/cgroup file
+ * @parm pid target pid number
+ * @param m store cgroup memory directory data
+ * @param c store cgroup cpu,cpuacct directory data
+ */
+static const char* g_procPidCgroupFileFmt="/proc/%d/cgroup";
+static const char* g_cpuWord = "cpuacct,cpu:";
+static const char* g_memWord = "memory:";
+bool CicoSCAulItems::getPidCgroupInfo(int pid, string& m, string& c)
+{
+    ICO_TRA("CicoSCAulItems::getPidCgroupInfo");
+    char fn[64];
+    sprintf(fn, g_procPidCgroupFileFmt, pid);
+    const size_t cpuWdSz = strlen(g_cpuWord);
+    const size_t memWdSz = strlen(g_memWord);
+    string tmp;
+    ifstream ifs(fn);
+    bool bR = false;
+    const char* pC = 0;
+    const char* pM = 0;
+    while (ifs >> tmp) {
+        if (true == tmp.empty()) {
+            continue;
+        }
+        const char* pT = tmp.c_str();
+        const char* pS = pT;
+        for (;pS != '\0'; pS++) {
+            if (':' == *pS) {
+                pS++;
+                if (0 == strncmp(pS, g_cpuWord, cpuWdSz)) { //cpu
+                    pC = pS + cpuWdSz; // get cgroup cpu directory
+                }
+                else if (0 == strncmp(pS, g_memWord, memWdSz)) { // memory
+                    pM = pS + memWdSz; // get cgroup memory directory
+                }
+                break; // break of for
+            }
+        }
+        if ((0 != pC) && (0 != pM)) {
+            ICO_DBG("CicoSCAulItems::getPidCgroupInfo m=%s, c=%s", pM, pC);
+            m = pM;
+            c = pC;
+            bR = true;
+            break;  // break of while
+        }
+    }
+    ifs.close();
+    ICO_TRA("CicoSCAulItems::getPidCgroupInfo %s", bR? "true": "false");
+    return bR;
+}
+
diff --git a/lib/system-controller/CicoSCAulItems.h b/lib/system-controller/CicoSCAulItems.h
new file mode 100644 (file)
index 0000000..7880220
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * 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
+ *
+ */
+#ifndef CICOSCAULITEMS_H
+#define CICOSCAULITEMS_H
+
+#include <string>
+#include <vector>
+
+#ifndef __CICO_SC_WINDOW_H__
+class CicoSCWindow;
+#endif
+
+
+/**
+ * @brief System controller unit
+ *        application life cycle infomation data
+ *
+ */
+
+class CicoSCAulItems {
+public: // member method
+    CicoSCAulItems();
+    CicoSCAulItems(const char* appid, int pid, int ctgry,
+                   const CicoSCWindow* obj=NULL);
+    CicoSCAulItems(const CicoSCAulItems& raul);
+    ~CicoSCAulItems();
+
+    const CicoSCAulItems* p() const;
+    void enterWindow(const CicoSCWindow* obj);
+    void rmWindow(const CicoSCWindow* obj);
+protected: // member method
+    bool getPidCgroupInfo(int pid, std::string& m, std::string& c);
+private: // member method
+
+public: // member aria
+    std::string m_appid; // appid
+    int m_pid; // pid
+    int m_category; //
+    int m_cpucgroup;
+    int m_memcgroup;
+    std::vector<const CicoSCWindow*> m_CSCWptrs;
+
+protected: // member aria
+    std::string m_defCgrpCpu;
+    std::string m_defCgrpMem;
+
+#if 0 // TODO mk_k
+//    std::string m_icon; // icon file path
+    bool m_active; //
+    bool m_supend; //
+    std::string m_group;
+    int  m_nodeID;
+    std::string m_location;
+    std::string m_animation;
+    int m_animationTime;
+    bool m_autoStart; // auto start flag
+    bool m_memnuOverlap;
+    int  m_invisibleCPU;
+    int  m_kindID;
+    int  m_categoryID;
+    int  m_displayZoneNum; // display zone number
+    int  m_soundZoneNum;  // sound zone number
+    int  m_inputDevNum;   // input device number
+    int  m_display;
+    int  m_sound;
+    int  m_input;
+
+
+
+    std::string m_name;
+    std::string m_execPath;
+    std::string m_type;
+    bool m_resumeShow
+#endif
+};
+
+inline const CicoSCAulItems* CicoSCAulItems::p() const
+{
+    return this;
+}
+
+#endif // CICOSCAULITEMS_H
diff --git a/lib/system-controller/CicoSCCommandParser.cpp b/lib/system-controller/CicoSCCommandParser.cpp
new file mode 100644 (file)
index 0000000..23a1b9b
--- /dev/null
@@ -0,0 +1,312 @@
+/*
+ * 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
new file mode 100644 (file)
index 0000000..57e7c16
--- /dev/null
@@ -0,0 +1,184 @@
+/*
+ * 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:
diff --git a/lib/system-controller/CicoSCConf.h b/lib/system-controller/CicoSCConf.h
new file mode 100644 (file)
index 0000000..bee360f
--- /dev/null
@@ -0,0 +1,421 @@
+/*
+ * 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   CicoSCConf.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+#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 "CicoLog.h"
+   
+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_e;
+
+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_display_type_e;
+
+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_e;
+
+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_e;
+
+#define ICO_SYC_CONFIG_APPATTR  "app_attr.conf"
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCNodeConf
+{
+public:
+    CicoSCNodeConf()
+        : id(-1), name(""), address(""), type(-1) { }
+
+    void dumpConf(void)
+    {
+        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
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCLayerConf
+{
+public:
+    CicoSCLayerConf()
+        : id(-1), name(""), type(-1), menuoverlap(false) {}
+    void dumpConf(void)
+    {
+        ICO_DBG("\tlayer : 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
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCDisplayZoneConf
+{
+public:
+    CicoSCDisplayZoneConf()
+        : id(-1), name(""), fullname(""), x(-1), y(-1), w(-1), h(-1){}
+    void dumpConf(void)
+    {
+        ICO_DBG("\tdisplay 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;
+
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCDisplayConf
+{
+public:
+    CicoSCDisplayConf()
+        : id(-1), name(""), node(-1), no(-1),
+          type(-1), width(-1), height(-1), inch(-1){}
+    void dumpConf(void)
+    {
+        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;
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCSoundZoneConf
+{
+public:
+    CicoSCSoundZoneConf()
+        : id(-1), name(""){}
+    void dumpConf(void)
+    {
+        ICO_DBG("\tsound zone : id(%d) name(%s)", id, name.c_str());
+    }
+    int    id;
+    string name;
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCSoundConf
+{
+public:
+    CicoSCSoundConf()
+        : id(-1), name(""), no(-1){}
+    void dumpConf(void)
+    {
+        ICO_DBG("sound : id(%d) name(%s) no(%d)", id, name.c_str(), no);
+    }
+    int    id;
+    string name;
+    int    no;
+    vector<CicoSCSoundZoneConf*>  zoneConfList;
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCCategoryConf
+{
+public:
+    CicoSCCategoryConf()
+        : id(-1), name(""), type(""),
+          view(-1), sound(-1), input(-1), priority(0), rctrl(-1){}
+    void dumpConf(void)
+    {
+        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 */
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCAppKindConf
+{
+public:
+    CicoSCAppKindConf()
+        : id(-1), name(""), privilege(-1), priority(0){}
+    void dumpConf(void)
+    {
+        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;
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCSwitchConf
+{
+public:
+    CicoSCSwitchConf()
+        : id(-1), name(""), appid(""), keycode(0){}
+    void dumpConf(void)
+    {
+        ICO_DBG("\tswitch : id(%d) name(%s) appid(%s)",
+                 id, name.c_str(), appid.c_str());
+    }
+    int    id;
+    string name;
+    string appid;
+    int    keycode;
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCInputDevConf
+{
+public:
+    CicoSCInputDevConf()
+        : id(-1), name(""){}
+    void dumpConf(void)
+    {
+        ICO_DBG("inputdev : id(%d) name(%s)", id, name.c_str());
+    }
+    int id;
+    string name;
+    vector<CicoSCSwitchConf*> switchConfList;
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCDefaultConf
+{
+public:
+    CicoSCDefaultConf()
+        : topdir(""), confdir(""),
+          node(-1), appkind(-1), category(-1), display(-1), 
+          layer(-1), displayzone(-1), sound(-1), soundzone(-1),
+          inputdev(-1), inputsw(-1) {};
+    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);
+    }
+    string topdir;
+    string confdir;
+    int node;
+    int appkind;
+    int category;
+    int display;
+    int layer;
+    int displayzone;
+    int sound;
+    int soundzone;
+    int inputdev;
+    int inputsw;
+};
+
+//==========================================================================
+/**
+ *  @brief  CPU resouce control group data
+ */
+//==========================================================================
+class CicoSCCpuResourceGrp
+{
+public:
+    CicoSCCpuResourceGrp()
+        :m_id(-1), m_bDoIt(false), m_grpNm(""){};
+#if 0
+    void getDumpStr(string& s)
+    {
+        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];
+        }
+        strm << "], L[";
+        for (int i = 0; i < m_low.size(); << i++) {
+            if (i != 0) strm << ", ";
+            strm << m_low[i];
+        }
+        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
+    };
+
+public:
+    int   m_id;
+    bool  m_bDoIt;
+    string m_grpNm;
+    vector<int> m_hight;
+    vector<int> m_low;
+};
+
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCResourceConf
+{
+public:
+    CicoSCResourceConf()
+        :m_bDoIt(false), m_bLog(false), m_cpuCGRPPath(""), m_sampling(-1) {};
+    void dumpConf(void)
+    {
+        ICO_DBG("monstt:%s, log:%s, dir:%s, smpl:%d sz:%d",
+                m_bDoIt? "true": "false", m_bLog? "true": "false",
+                m_cpuCGRPPath.c_str(), m_sampling, m_cpuCtrl.size());
+    }
+public:
+    bool m_bDoIt;
+    bool m_bLog;
+    string m_cpuCGRPPath;
+    int  m_sampling;
+    vector<CicoSCCpuResourceGrp*> m_cpuCtrl;
+};
+
+#endif  // __CICO_SC_CONF_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCDisplay.cpp b/lib/system-controller/CicoSCDisplay.cpp
new file mode 100644 (file)
index 0000000..4ac4dc0
--- /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
+ *
+ */
+
+/*========================================================================*/
+/**
+ *  @file   CicoSCDisplay.h
+ *
+ *  @brief  
+ */
+/*========================================================================*/
+
+#include "CicoSCDisplay.h"
+#include "CicoSCLayer.h"
+#include "CicoLog.h"
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
+CicoSCDisplay::CicoSCDisplay()
+    : displayid(-1),
+      type(-1),
+      nodeid(-1),
+      displayno(-1),
+      width(-1),
+      height(-1),
+      inch(-1),
+      pWidth(-1),
+      pHeight(-1),
+      orientation(ORIENTATION_HORIZONTAL),
+      name("")
+{
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
+CicoSCDisplay::~CicoSCDisplay()
+{
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  dump log CicoSCDisplay member variables
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCDisplay::dump(void)
+{
+    ICO_DBG("CicoSCDisplay: displayid=%d type=%d nodeid=%d displayno=%d "
+            "width=%d height=%d inch=%d pWidth=%d pHeight=%d "
+            "orientation =%d name=%s",
+            displayid, type, nodeid, displayno, width, height, inch,
+            pWidth, pHeight, orientation, name.c_str());
+    vector<CicoSCLayer*>::iterator itr;
+    itr = layerList.begin();
+    for (; itr != layerList.end(); ++itr) {
+        const_cast<CicoSCLayer*>(*itr)->dump();
+    }
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCDisplay.h b/lib/system-controller/CicoSCDisplay.h
new file mode 100644 (file)
index 0000000..d304d41
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * 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   CicoSCDisplay.h
+ *
+ *  @brief  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
+//==========================================================================
+class CicoSCLayer;
+class CicoSCDisplayZone;
+
+//==========================================================================
+/**
+ *  @brief  display information
+ */
+//==========================================================================
+class CicoSCDisplay
+{
+public:
+    // default constructor
+    CicoSCDisplay();
+
+    // destructor
+    ~CicoSCDisplay();
+
+    // dump log CicoSCDisplay member variables
+    void dump(void);
+
+private:
+    // assignment operator
+    CicoSCDisplay& operator=(const CicoSCDisplay &object);
+
+    // copy constructor
+    CicoSCDisplay(const CicoSCDisplay &object);
+
+public:
+    // definition value of horizontal
+    const static int ORIENTATION_HORIZONTAL = 0;    
+    // definition value of vartical
+    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
+};
+#endif // __CICO_SC_DISPLAY_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCDisplayZone.cpp b/lib/system-controller/CicoSCDisplayZone.cpp
new file mode 100644 (file)
index 0000000..938d379
--- /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   CicoSCDisplayZone.h
+ *
+ *  @brief  
+ */
+/*========================================================================*/
+
+#include "CicoSCDisplayZone.h"
+#include "CicoLog.h"
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
+CicoSCDisplayZone::CicoSCDisplayZone()
+    : zoneid(-1), x(-1), y(-1), width(-1), height(-1)
+{
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
+CicoSCDisplayZone::~CicoSCDisplayZone()
+{
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  dump log CicoSCDisplayZone member variables
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCDisplayZone::dump(void)
+{
+    ICO_DBG("CicoSCDisplayZone: zoneid=%d x=%d y=%d width=%d height=%d",
+            zoneid, x, y, width, height);
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCDisplayZone.h b/lib/system-controller/CicoSCDisplayZone.h
new file mode 100644 (file)
index 0000000..992f406
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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   CicoSCDisplayZone.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+#ifndef __CICO_SC_DISPLAYZONE_H__
+#define __CICO_SC_DISPLAYZONE_H__
+
+//==========================================================================
+/**
+ *  @brief  display zone information
+ */
+//==========================================================================
+class CicoSCDisplayZone
+{
+public:
+    // default constructor
+    CicoSCDisplayZone();
+
+    // destructor
+    virtual ~CicoSCDisplayZone();
+
+    // dump log CicoSCDisplay member variables
+    void dump(void);
+
+private:
+    // assignment operator
+    CicoSCDisplayZone& operator=(const CicoSCDisplayZone &object);
+
+    // copy constructor
+    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
+};
+#endif // __CICO_SC_DISPLAYZONE_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCInputController.cpp b/lib/system-controller/CicoSCInputController.cpp
new file mode 100644 (file)
index 0000000..e8ef5b9
--- /dev/null
@@ -0,0 +1,413 @@
+/*
+ * 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   CicoSCInputController.cpp
+ *
+ *  @brief  
+ */
+//==========================================================================
+
+#include "CicoSCInputController.h"
+#include "CicoSCWayland.h"
+#include "CicoLog.h"
+#include "CicoSCSwitch.h"
+#include "CicoSCInputDev.h"
+#include "ico_syc_error.h"
+#include "ico_syc_msg_cmd_def.h"
+#include "CicoSCSystemConfig.h"
+#include "CicoSCConf.h"
+#include "CicoSCCommandParser.h"
+
+CicoSCInputController::CicoSCInputController()
+{
+    CicoSCWayland* wayland = CicoSCWayland::getInstance();
+    wayland->addWaylandIF(ICO_WL_INPUT_MGR_CTRL_IF, this);
+    wayland->addWaylandIF(ICO_WL_EXINPUT_IF, this);
+    wayland->addWaylandIF(ICO_WL_INPUT_MGR_DEV_IF, this);
+
+}
+
+CicoSCInputController::~CicoSCInputController()
+{
+}
+
+#if 0
+int
+initDB(void)
+{
+    const vector<CicoSCInputDevConf*>& inputDevConfList =
+        CicoSCSystemConfig::getInstance()->getInputDevConfList();
+    vector<CicoSCInputDevConf*>::const_iterator itr;
+    itr = inputDevConfList.begin();
+    for (; itr != inputDevConfList.end(); ++itr) {
+        const CicoSCInputDevConf *iconf = const_cast<CicoSCInputDevConf*>(*itr);
+        CicoSCInputDev *device = new CicoSCInputDev();
+
+        device->devcie = iconf->name;
+
+        vector<CicoSCSwitchConf*>::const_iterator itr2;
+        itr2 = iconf->switchConfList.begin();
+        for (; itr2 != dconf->switchConfList.end(); ++itr2) {
+            const CicoSCSwitchConf *sconf = const_cast<CicoSCSwitchConf*>(*itr2);
+
+            CicoSCSwitch *sw = new CicoSCSwitch();
+            sw->swname = sconf->name;
+            sw->input  = sconf->id;
+            devcie->switchList.push_back(sw);
+        }
+
+
+
+
+    }
+
+}
+#endif
+
+void
+CicoSCInputController::handleCommand(const CicoSCCommand *cmd)
+{
+    ICO_DBG("CicoSCInputController::handleCommand Enter"
+            "(cmdid=%08X)", cmd->cmdid);
+
+    CicoSCCmdInputDevCtrlOpt *opt;
+    CicoSCCmdInputDevSettingOpt *set_opt; 
+
+    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);
+        break;
+    case MSG_CMD_DEL_INPUT:
+        opt = static_cast<CicoSCCmdInputDevCtrlOpt*>(cmd->opt);
+        delInputApp(cmd->appid, opt->device, opt->inputNum);
+        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);
+        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);
+        break;
+    case MSG_CMD_UNSET_REGION:
+        set_opt = static_cast<CicoSCCmdInputDevSettingOpt*>(cmd->opt);
+        resetInputRegion(set_opt->surfaceid, set_opt->x, set_opt->y,
+                         set_opt->width, set_opt->height);
+        break;
+    default:
+        ICO_WRN("Unknown Command(0x%08x)", cmd->cmdid);
+        break;
+    }
+
+    ICO_DBG("CicoSCInputController::handleCommand Leave");
+}
+
+int
+CicoSCInputController::addInputApp(const string &appid,
+                                   const string &device,
+                                   int          input,
+                                   int          fix,
+                                   int          keycode)
+{
+    ICO_DBG("CicoSCInputController::addInputApp Enter"
+            "(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);
+
+    ICO_DBG("CicoSCInputController::addInputApp Leave");
+    return ICO_SYC_EOK;
+}
+
+int
+CicoSCInputController::delInputApp(const string &appid,
+                                   const string &device,
+                                   int          input)
+{
+    ICO_DBG("CicoSCInputController::delInputApp Enter"
+            "(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);
+
+    ICO_DBG("CicoSCInputController::delInputApp Leave");
+    return ICO_SYC_EOK;
+}
+
+int
+CicoSCInputController::sendInputEvent(const string &appid,
+                                      int          surfaceid,
+                                      int          type,
+                                      int          deviceno,
+                                      int          code,
+                                      int          value)
+{
+    ICO_DBG("CicoSCInputController::sendInputEvent Enter"
+            "(appid=%s surfaceid=%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");
+    return ICO_SYC_EOK;
+}
+
+int
+CicoSCInputController::setInputRegion(int surfaceid,
+                                      int x,
+                                      int y,
+                                      int width,
+                                      int height,
+                                      int attr)
+{
+    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");
+    return ICO_SYC_EOK;
+}
+
+int
+CicoSCInputController::resetInputRegion(int surfaceid,
+                                        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");
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCInputController::capabilitiesCB(void               *data,
+                                      struct ico_exinput *ico_exinput,
+                                      const char         *device,
+                                      int32_t            type,
+                                      const char         *swname,
+                                      int32_t            input,
+                                      const char         *codename,
+                                      int32_t            code)
+{
+    ICO_DBG("CicoSCInputController::capabilitiesCB Enter",
+            "device=%s type=%s swname=%s input=%s codename=%s code=%d",
+            device, type, swname, input, codename, code);
+
+    // create CicoSCInputDev object
+    CicoSCInputDev *inputdev = findInputDev(device);
+    if (NULL == inputdev) {
+        inputdev = new CicoSCInputDev();
+        inputdev->device = device;
+        inputdev->type   = type;
+    }
+
+    CicoSCSwitch *sw = findInputSwitch(device, input);
+    if (NULL == sw) {
+        sw = new CicoSCSwitch();
+        sw->input   = input;
+        sw->code.push_back(code);
+        sw->codename.push_back(codename);
+    }
+    else {
+        sw->input   = input;
+    }
+
+    CicoSCSystemConfig *sysConf = CicoSCSystemConfig::getInstance();
+    const CicoSCSwitchConf *swconf = NULL;
+    swconf = sysConf->findSwitchConfbyName(device, swname);
+    if (NULL != swconf) {
+        if (false == swconf->appid.empty()) {
+            addInputApp(swconf->appid, inputdev->device,
+                        input,CicoSCSwitch::SWITCH_FIX, swconf->keycode);
+            sw->fix = true;
+        }
+    }
+
+    ICO_DBG("CicoSCInputController::capabilitiesCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCInputController::codeCB(void               *data,
+                              struct ico_exinput *ico_exinput,
+                              const char         *device,
+                              int32_t            input,
+                              const char         *codename,
+                              int32_t            code)
+{
+    ICO_DBG("CicoSCInputController::codeCB Enter"
+            "(device=%s input=%d codename=%s code=%d",
+            device, input, codename, code);
+
+    CicoSCSwitch *sw = findInputSwitch(device, input);
+    if (NULL != sw) {
+        ICO_ERR("codeCB: device=%s input=%d not found.");
+        return;
+    }
+
+    if (sw->code.size() >= CicoSCSwitch::SWITCH_CODE_MAX) {
+        ICO_ERR("codeCB: device=%s input=%d number of codes overflow.");
+        return;
+    }
+
+    for (unsigned int i = 0; i < sw->code.size(); ++i) {
+        if (sw->code[i] == code) {
+            ICO_WRN("codeCB: device=%s input=%d code=%d already exist.");
+           return;
+        }
+    }
+
+    sw->code.push_back(code);
+    sw->codename.push_back(codename);
+
+    ICO_DBG("CicoSCInputController::codeCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCInputController::inputCB(void               *data,
+                               struct ico_exinput *ico_exinput,
+                               uint32_t           time,
+                               const char         *device,
+                               int32_t            input,
+                               int32_t            code,
+                               int32_t            state)
+{
+    ICO_DBG("CicoSCInputController::inputCB Enter"
+            "time=%d device=%s input=%d code=%d state=%d",
+            time, device, input, code, state);
+
+    // TODO send message
+#if 0
+    CicoSCMessage message;
+    message.addElement("commnd", ICO_SYC_EV_WIN_CREATE);
+    message.addElement("appid", TODO);
+    message.addElement("arg.device", device);
+    message.addElement("arg.input", input);
+    message.addElement("arg.code", code);
+    message.addElement("arg.state", state);
+    CicoSCServer::getInstance()->sendMessage(message);
+#endif
+
+    ICO_DBG("CicoSCInputController::inputCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCInputController::regionCB(void                        *data,
+                                struct ico_input_mgr_device *ico_input_mgr_dev,
+                                struct wl_array             *region)
+{
+    ICO_DBG("CicoSCInputController::regionCB Enter");
+    ICO_DBG("CicoSCInputController::regionCB Leave");
+}
+
+CicoSCInputDev*
+CicoSCInputController::findInputDev(const char *device)
+{
+    vector<CicoSCInputDev*>::iterator itr;
+    itr = m_inputDevList.begin();
+    for (; itr != m_inputDevList.end(); ++itr) {
+        CicoSCInputDev* inputdev = const_cast<CicoSCInputDev*>(*itr);
+        if (inputdev->device == device) {
+            return inputdev;
+        }
+    }
+    return NULL;
+}
+
+CicoSCSwitch*
+CicoSCInputController::findInputSwitch(const char *device, int input)
+{
+    const CicoSCInputDev *inputdev = findInputDev(device);
+    if (NULL == inputdev) {
+        return NULL;
+    }
+
+    vector<CicoSCSwitch*>::const_iterator itr;
+    itr = inputdev->switchList.begin();
+    for (; itr != inputdev->switchList.end(); ++itr) {
+        CicoSCSwitch* sw = const_cast<CicoSCSwitch*>(*itr);
+        if (sw->input == input) {
+            return sw;
+        }
+    }
+    return NULL;
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCInputController.h b/lib/system-controller/CicoSCInputController.h
new file mode 100644 (file)
index 0000000..9f03f06
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * 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   CicoSCInputController.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+#ifndef __CICO_SC_INPUT_CONTROLLER_H__
+#define __CICO_SC_INPUT_CONTROLLER_H__
+
+#include <vector>
+using namespace std;
+
+#include "CicoSCWlInputMgrIF.h"
+
+//==========================================================================
+//  Forward declaration
+//==========================================================================
+class CicoSCCommand;
+class CicoSCInputDev;
+class CicoSCSwitch;
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  input device controller
+ */
+//--------------------------------------------------------------------------
+class CicoSCInputController : public CicoSCWlInputMgrIF
+{
+public:
+    // default constructor
+    CicoSCInputController();
+
+    // destructor
+    ~CicoSCInputController();
+
+    int initDB(void);
+
+    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,
+                       int x,
+                       int y,
+                       int width,
+                       int height,
+                       int attr);
+
+    int resetInputRegion(int surfaceid,
+                         int x,
+                         int y,
+                         int width,
+                         int height);
+
+    void capabilitiesCB(void               *data,
+                        struct ico_exinput *ico_exinput,
+                        const char         *device,
+                        int32_t            type,
+                        const char         *swname,
+                        int32_t            input,
+                        const char          *codename,
+                        int32_t            code);
+
+    void codeCB(void               *data,
+                struct ico_exinput *ico_exinput,
+                const char         *device,
+                int32_t            input,
+                const char         *codename,
+                int32_t            code);
+
+    void inputCB(void               *data,
+                 struct ico_exinput *ico_exinput,
+                 uint32_t           time,
+                 const char         *device,
+                 int32_t            input,
+                 int32_t            code,
+                 int32_t            state);
+
+    void regionCB(void                        *data,
+                  struct ico_input_mgr_device *ico_input_mgr_device,
+                  struct wl_array             *region);
+
+protected:
+    // assignment operator
+    CicoSCInputController& operator=(const CicoSCInputController &object);
+
+    // copy constructor
+    CicoSCInputController(const CicoSCInputController &object);
+
+private:
+    CicoSCInputDev* findInputDev(const char *device);
+
+    CicoSCSwitch* findInputSwitch(const char *device, int input);
+
+private:
+    //
+    vector<CicoSCInputDev*> m_inputDevList;
+};
+#endif // __CICO_SC_INPUT_CONTROLLER_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCInputDev.cpp b/lib/system-controller/CicoSCInputDev.cpp
new file mode 100644 (file)
index 0000000..db219ce
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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   CicoSCInputDev.cpp
+ *
+ *  @brief  
+ */
+//==========================================================================
+
+#include "CicoSCInputDev.h"
+#include "CicoLog.h"
+
+// default constructor
+CicoSCInputDev::CicoSCInputDev()
+    : device("")
+{
+}
+
+// destructor
+CicoSCInputDev::~CicoSCInputDev()
+{
+}
+
+// dump log CicoSCInputDev member variables
+void
+CicoSCInputDev::dump(void)
+{
+    ICO_DBG("CicoSCInputDev: device=%d", device.c_str());
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCInputDev.h b/lib/system-controller/CicoSCInputDev.h
new file mode 100644 (file)
index 0000000..aa15e9f
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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   CicoSCInputDev.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+#ifndef __CICO_SC_INPUT_DEV_H__
+#define __CICO_SC_INPUT_DEV_H__
+
+#include <string>
+#include <vector>
+using namespace std;
+
+//==========================================================================
+//  Forward declaration
+//==========================================================================
+class CicoSCSwitch;
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  input device information
+ */
+//--------------------------------------------------------------------------
+class CicoSCInputDev
+{
+public:
+    // default constructor
+    CicoSCInputDev();
+
+    // destructor
+    virtual ~CicoSCInputDev();
+
+    // dump log CicoSCInputDev member variables
+    void dump(void);
+
+private:
+    // assignment operator
+    CicoSCInputDev& operator=(const CicoSCInputDev &object);
+
+    // copy constructor
+    CicoSCInputDev(const CicoSCInputDev &object);
+
+public:
+    string device;  //!< input device name
+    int    type;    //!< type
+
+    vector<CicoSCSwitch*> switchList;   //!< switch list
+};
+#endif // __CICO_SC_INPUT_DEV_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCLayer.cpp b/lib/system-controller/CicoSCLayer.cpp
new file mode 100644 (file)
index 0000000..3efde68
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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   CicoSCLayer.h
+ *
+ *  @brief  
+ */
+/*========================================================================*/
+
+#include "CicoSCLayer.h"
+#include "CicoLog.h"
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
+CicoSCLayer::CicoSCLayer()
+{
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
+CicoSCLayer::~CicoSCLayer()
+{
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  dump log CicoSCLayer member variables
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCLayer::dump(void)
+{
+    ICO_DBG("CicoSCLayer: layerid=%d type=%d width=%d height=%d "
+            "displayid =%d menuoverlap=%s",
+            layerid, type, width, height, displayid,
+            menuoverlap ? "true" : "false");
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCLayer.h b/lib/system-controller/CicoSCLayer.h
new file mode 100644 (file)
index 0000000..6db38c7
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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   CicoSCLayer.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+#ifndef __CICO_SC_LAYER_H__
+#define __CICO_SC_LAYER_H__
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  layer information
+ */
+//--------------------------------------------------------------------------
+class CicoSCLayer
+{
+public:
+    // default constructor
+    CicoSCLayer();
+
+    // destructor
+    virtual ~CicoSCLayer();
+
+    // dump log CicoSCLayer member variables
+    void dump(void);
+
+private:
+    // assignment operator
+    CicoSCLayer& operator=(const CicoSCLayer &object);
+
+    // copy constructor
+    CicoSCLayer(const CicoSCLayer &object);
+
+public:
+    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__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCLifeCycleController.cpp b/lib/system-controller/CicoSCLifeCycleController.cpp
new file mode 100644 (file)
index 0000000..656dba5
--- /dev/null
@@ -0,0 +1,916 @@
+/*
+ * 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
+ *
+ */
+
+#include <string>
+#include <vector>
+#include <cstdio>
+#include <cstdlib>
+#include <glib.h>
+#include <ail.h>
+#include <aul/aul.h>
+#include <sys/stat.h>
+
+#include "ico_syc_error.h"
+#include "CicoLog.h"
+#include "CicoSCAulItems.h"
+#include "CicoSCAilItems.h"
+#include "CicoSCLifeCycleController.h"
+#include "CicoSCConf.h"
+#include "CicoSCSystemConfig.h"
+#include "CicoSCSysResourceController.h"
+
+using namespace std;
+
+
+CicoSCLifeCycleController* CicoSCLifeCycleController::ms_myInstance = NULL;
+
+const char* DAilTypeFilPrm_Menu="menu";
+const char* DAilTypeFilPrm_App="Application";
+const char* DNil = "(nil)";
+const char* sectAppAttr = "app-attributes";
+const char* DNull = "(null)";
+
+#define APP_CONF_AIL_NULL_STR   DNull
+
+/**
+ * @brief
+ * @param req_id
+ * @param pkg_type
+ * @param pkg_name package name
+ * @param key "start"/"end"/"install_percent"/"command" strings
+ * @param val "ok"/"error"/"0.000000"-"100.000000" strings
+ * @param pmsg pkgmgr message 
+ * @param data user data
+ */
+static int CSCLCCpkgmgr_handler(int req_id, const char *pkg_type,
+                                const char *pkg_name, const char *key,
+                                const char *val, const void *pmsg, void *data)
+{
+    CicoSCLifeCycleController* x = (CicoSCLifeCycleController*)data;
+    return
+        CSCLCCpkgmgr_handlerX(req_id, pkg_type, pkg_name, key, val, pmsg, x);
+}
+
+/**
+ * @brief ail_filter_list_appinfo_foreach callback function
+ * @param appinfo appinfo_h the appinfo's handle
+ * @param data user data
+ * @retval AIL_CB_RET_CONTINUE return if you continue iteration
+ * @retval AIL_CB_RET_CANCEL return if you cancel iteration
+ */
+static ail_cb_ret_e CSCLCCail_list_appinfo_cb(const ail_appinfo_h appinfo,
+                                              void *data)
+{
+    CicoSCLifeCycleController* x = (CicoSCLifeCycleController*)data;
+    return CSCLCCail_list_appinfo_cbX(appinfo, x);
+}
+
+/**
+ * @brief applications are launched. callback function
+ * @param pid
+ * @param data user data
+ */
+static int CSCLCCapp_launch_handler(int pid, void *data)
+{
+    CicoSCLifeCycleController* x = (CicoSCLifeCycleController*)data;
+    return CSCLCCapp_launch_handlerX(pid, x);
+}
+
+/**
+ * @brief applications die. callback function
+ * @param pid
+ * @param data user data
+ */
+static int CSCLCCapp_dead_handler(int pid, void *data)
+{
+    CicoSCLifeCycleController* x = (CicoSCLifeCycleController*)data;
+    return CSCLCCapp_dead_handlerX(pid, x);
+}
+
+
+/**
+ * @brief contractor
+ */
+CicoSCLifeCycleController::CicoSCLifeCycleController()
+{
+    m_gconf = (GKeyFile*)NULL;
+    m_pc = (pkgmgr_client*)NULL;
+    m_RC = new CicoSCSysResourceController;
+    initAIL();
+    initAUL();
+}
+
+/**
+ * @brief destructor
+ */
+CicoSCLifeCycleController::~CicoSCLifeCycleController()
+{
+    delete m_RC;
+}
+
+CicoSCLifeCycleController*
+CicoSCLifeCycleController::getInstance(void)
+{
+    if (NULL == ms_myInstance) {
+        ms_myInstance = new CicoSCLifeCycleController();
+    }
+    return ms_myInstance;
+}
+
+/**
+ * @brief application launch
+ * @param appid application id
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::launch(const char* appid)
+{
+    ICO_TRA("start %s", appid);
+    // appid check AIL table exist
+    if (NULL == findAIL(appid)) {
+        ICO_TRA("not find");
+        return ICO_SYC_ENOSYS;
+    }
+    int r = aul_launch_app(appid, NULL);
+    if (0 > r) {
+        ICO_TRA("aul_launch_app NG %d", r);
+        return ICO_SYC_ENOSYS;
+    }
+    ICO_TRA("launch success");
+    return ICO_SYC_EOK;
+}
+
+/**
+ * @brief application launch
+ * @param appid application id
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::launch(const std::string& appid)
+{
+    return launch((const char*)appid.c_str());
+}
+
+/**
+ * @brief application terminate
+ * @param appid application id
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::terminate(const char* appid)
+{
+    ICO_TRA("CicoSCLifeCycleController::terminate %s", appid);
+    int r = ICO_SYC_EOK;
+    vector<int> pids;
+    if (true == getPIDs(appid, pids)) {
+        vector<int>::iterator it;
+        for(it = pids.begin(); it != pids.end(); ++it) {
+            int tr = terminateR(*it);
+            if (ICO_SYC_EOK != tr) {
+                r = tr;
+            }
+        }
+    }
+    else {
+        ICO_TRA("end ICO_SYC_EPERM");
+        return ICO_SYC_EPERM;
+    }
+    ICO_TRA("end %d", r);
+    return r;
+}
+
+/**
+ * @brief application terminate
+ * @param appid application id
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::terminate(const std::string& appid)
+{
+    return terminate((const char*)appid.c_str());
+}
+
+/**
+ * @brief application terminate
+ * @param pid
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::terminate(int pid)
+{
+    ICO_TRA("CicoSCLifeCycleController::terminate %d", pid);
+    const CicoSCAulItems* t = findAUL(pid);
+    if ((NULL == t) || (0 == t)) {
+        ICO_TRA("not find");
+        return ICO_SYC_EPERM;
+    }
+    return terminateR(pid);
+}
+
+/**
+ * @brief application terminate
+ * @param pid
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ENOSYS error
+ */
+int CicoSCLifeCycleController::terminateR(int pid)
+{
+    ICO_TRA("CicoSCLifeCycleController::terminateR %d", pid);
+    int r = aul_terminate_pid(pid);
+    if (r < 0) {
+        ICO_DBG("terminate error pid:%d, r:%d", pid, r);
+        return ICO_SYC_ENOSYS;
+    }
+    return ICO_SYC_EOK;
+}
+
+/**
+ * @brief application suspend
+ * @param appid application id
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::suspend(const char* appid)
+{
+    int r = ICO_SYC_EOK;
+    vector<int> pids;
+    if (true == getPIDs(appid, pids)) {
+        vector<int>::iterator it;
+        for(it = pids.begin(); it != pids.end(); ++it) {
+            int tr = suspend(*it);
+            if (ICO_SYC_EOK != tr) {
+                r = tr;
+            }
+        }
+    }
+    else {
+        ICO_TRA("end ICO_SYC_EPERM");
+        return ICO_SYC_EPERM;
+    }
+    ICO_TRA("end %d", r);
+    return r;
+}
+
+/**
+ * @brief application suspend
+ * @param appid application id
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::suspend(const std::string& appid)
+{
+    return suspend((const char*)appid.c_str());
+}
+
+/**
+ * @brief application suspend
+ * @param pid
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::suspend(int pid)
+{
+// TODO mk_k Not currently supported
+// TODO mk_k What do I do now?
+    return ICO_SYC_EPERM;
+}
+
+/**
+ * @brief appid is runnning check
+ * @param appid package
+ * @return running status
+ * @retval true is runnning
+ * @retval false not runnning
+ */
+bool CicoSCLifeCycleController::isRunning(const char* appid) const
+{
+    ICO_TRA("start %s", appid);
+    bool r = false;
+#if 0 // TODO mk_k
+    vector<CicoSCAulItems>::iterator it;
+    for (it = m_aul.begin(); it != m_aul.end(); ++it) {
+        if (0 == strcasecmp(it->m_appid.c_str(), appid)) {
+            r = true;
+            break;
+        }
+    }
+#else
+    int sz = m_aul.size();
+    for (int i = 0; i < sz; i++) {
+        if (0 == strcasecmp(m_aul[i].m_appid.c_str(), appid)) {
+            r = true;
+            break;
+        }
+    }
+#endif
+    ICO_TRA("end %s", r? "true": "false");
+    return r;
+}
+
+/**
+ * @brief appid is runnning check
+ * @param appid package
+ * @return running status
+ * @retval true is runnning
+ * @retval false not runnning
+ */
+bool CicoSCLifeCycleController::isRunning(const std::string& appid) const
+{
+    return isRunning((const char*)appid.c_str());
+}
+
+/**
+ * @brief find ail data
+ * @param appid find key
+ * @return CicoSCAilItems class pointer
+ * @retval NULL is not find
+ */
+const CicoSCAilItems* CicoSCLifeCycleController::findAIL(const char* appid) const
+{
+    ICO_TRA("start");
+    const CicoSCAilItems* r = NULL;
+    int sz = m_ail.size();
+    for (int i = 0; i < sz; i++) {
+        if (0 == strcasecmp(m_ail[i].m_appid.c_str(), appid)) {
+            r = m_ail[i].p();
+            break; // break of for
+        }
+    }
+    ICO_TRA("end %x", r);
+    return r;
+}
+
+/**
+ * @brief find ail data
+ * @param appid find key
+ * @return CicoSCAilItems class pointer
+ * @retval NULL is not find
+ */
+const CicoSCAilItems* CicoSCLifeCycleController::findAIL(const std::string& appid) const
+{
+    ICO_TRA("call findAIL(const chr*)");
+    return findAIL((const char*)appid.c_str());
+}
+
+/**
+ * @brief get launched apprication pid
+ * @param appid target application appid
+ * @return pid
+ */
+bool CicoSCLifeCycleController::getPIDs(const char* appid, std::vector<int>& pids) const
+{
+    ICO_TRA("start %s", appid);
+    bool r = false;
+#if 0 // TODO mk_k
+    vector<CicoSCAulItems>::iterator it;
+    for (it = m_aul.begin(); it != m_aul.end(); ++it) {
+        if (0 == strcasecmp(it->m_appid.c_str(), appid)) {
+            pids.push_back(it->m_pid);
+            r = true;
+        }
+    }
+#else
+    int sz = m_aul.size();
+    for (int i = 0; i < sz; i++) {
+        const CicoSCAulItems* t = m_aul[i].p();
+        if (0 == strcasecmp(t->m_appid.c_str(), appid)) {
+            pids.push_back(t->m_pid);
+            r = true;
+        }
+    }
+#endif
+    ICO_TRA("end %d %s", pids.size(), r? "true": "false");
+    return r;
+}
+
+/**
+ * @brief get launched apprication pid
+ * @param appid target application appid
+ * @return pid
+ */
+bool CicoSCLifeCycleController::getPIDs(std::string& appid, std::vector<int>& pids) const
+{
+    return getPIDs((const char*)appid.c_str(), pids);
+}
+
+/**
+ * @brief get launched apprication pid
+ * @param appid target application appid
+ * @return pid
+ */
+const CicoSCAulItems* CicoSCLifeCycleController::findAUL(int pid) const
+{
+    ICO_TRA("start %d", pid);
+    const CicoSCAulItems* r = NULL;
+    int sz = m_aul.size();
+    for (int i = 0; i < sz; i++) {
+        const CicoSCAulItems* t = m_aul[i].p();
+        if (t->m_pid == pid) {
+            r = t;
+            ICO_DBG("find %d -> %s", pid, t->m_appid.c_str());
+            break; // break of for
+        }
+    }
+    ICO_TRA("end %x", r);
+    return r;
+}
+
+
+/**
+ * @brief ail infomation data initialization
+ */
+void CicoSCLifeCycleController::initAIL()
+{
+    ICO_TRA("start");
+    createAilItems();
+    if ((pkgmgr_client*)NULL == m_pc) {
+        m_pc = pkgmgr_client_new(PC_LISTENING);
+        int r = pkgmgr_client_listen_status(m_pc, CSCLCCpkgmgr_handler,
+                                            (void*)this);
+        if (PKGMGR_R_OK != r) {
+            pkgmgr_client_free(m_pc);
+            m_pc = NULL;
+        }
+    }
+    ICO_TRA("end");
+}
+
+/**
+ * @brief
+ */
+int CSCLCCpkgmgr_handlerX(int req_id, const char *pkg_type, const char *pkg_name, 
+                         const char *key, const char *val, const void *pmsg,
+                         CicoSCLifeCycleController* x)
+{
+// TODO mk_k packages install/uninstall handler Determination of the result undecided
+    ICO_TRA("pkgmgr t:%s, n:%s, k:%s, v:%s, m:%s",pkg_type, pkg_name, key,
+            val, pmsg);
+    if ((NULL == x) || (0 == x)) {
+        ICO_TRA("end user data none");
+        return -1;
+    }
+    if (strcasecmp(key, "end") == 0) {
+        if (strcasecmp(val, "ok") == 0) {
+            ICO_DBG("receive end:ok");
+            x->renewAIL();
+        }
+    }
+    ICO_TRA("end");
+    return 0;
+// TODO mk_k packages install/uninstall handler Determination of the result undecided
+}
+
+/**
+ * @brief AIL list renew
+ */
+void CicoSCLifeCycleController::renewAIL()
+{
+    ICO_TRA("start");
+    vector<CicoSCAilItems> old = m_ail;
+    m_ail.clear();
+    int cnt =0;
+    while (true == createAilItems()) {
+        if (cnt > 500) {
+            m_ail.clear();
+            m_ail = old;
+            break;
+        }
+        cnt++;
+        usleep(10000);
+    }
+    if (cnt > 500) {
+        ICO_TRA("end error AIL I/F");
+        return ;
+    }
+#if 0 // TODO mk_k I do not know unnecessary
+    vector<string> add_appid;
+    vector<string> remove_appid;
+
+    vector<CicoSCAulItems>::iterator it_n;
+    vector<CicoSCAulItems>::iterator it_o;
+    for(it_n = m_aul.begin(); it_n != m_aul.end(); ++it_n) {
+        bool bingo = false;
+        for(it_o = old.begin(); it_o != old.end(); ++it_o) {
+            if (it_n->m_appid.compaire(it_o->m_appid)) {
+                bingo = true;
+            }
+        }
+        if (false == bingo) {
+            add_appid.push_back(it_n->m_appid);
+        }
+    }
+    for(it_o = old.begin(); it_o != old.end(); ++it_o) {
+        bool bingo = false;
+        for(it_n = m_aul.begin(); it_n != m_aul.end(); ++it_n) {
+            if (it_o->m_appid.compaire(it_n->m_appid)) {
+                bingo = true;
+            }
+        }
+        if (false == bingo) {
+            remove_appid.push_back(it_o->m_appid);
+        }
+    }
+
+    if (0 != add_appid.size()) {
+// TODO mk_k install
+    }
+    if (0 != remove_appid.size()) {
+// TODO mk_k uninstall
+    }
+#endif
+    old.clear();
+    ICO_TRA("end");
+    return;
+}
+
+/**
+ * @brief ail_filter_list_appinfo_foreach callback function
+ * @param appinfo appinfo_h the appinfo's handle
+ * @param x CicoSCLifeCycleController class pointer
+ * @retval AIL_CB_RET_CONTINUE return if you continue iteration
+ * @retval AIL_CB_RET_CANCEL return if you cancel iteration
+ *
+ */
+ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
+                                        CicoSCLifeCycleController* x)
+{
+    ICO_TRA("start");
+    if ((NULL == x) || (0 == x)) {
+        ICO_TRA("end bad end")
+        return AIL_CB_RET_CANCEL;
+    }
+    char   *pkg;
+    char   *icn;
+    char   *nm;
+    char   *ctgry;
+    char   *typ;
+    char   *exe;
+    bool   bndsp = false;
+    /* get package name for appid */
+    ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &pkg);
+    if (strcmp(pkg, APP_CONF_AIL_NULL_STR) == 0) {
+        pkg = NULL;
+    }
+    /* get icon path */
+    ail_appinfo_get_str(appinfo, AIL_PROP_ICON_STR, &icn);
+    if (strcmp(icn, APP_CONF_AIL_NULL_STR) == 0) {
+        icn = NULL;
+    }
+    else if (icn != NULL) {
+        struct stat buff;
+        /* file check */
+        memset(&buff, 0, sizeof(buff));
+        if (stat(icn, &buff) == 0) {
+            if (S_ISDIR(buff.st_mode)) {
+                /* is directory */
+                ICO_DBG("%s is directory", icn);
+                icn = NULL;
+            }
+        }
+        else {
+            /* is not exist */
+            icn = NULL;
+        }
+    }
+    /* get name */
+    ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &nm);
+    if (strcmp(nm, APP_CONF_AIL_NULL_STR) == 0) {
+        nm = NULL;
+    }
+    /* get category */
+    ail_appinfo_get_str(appinfo, AIL_PROP_CATEGORIES_STR, &ctgry);
+    if (strcmp(ctgry, APP_CONF_AIL_NULL_STR) == 0) {
+        ctgry = NULL;
+    }
+    /* get type */
+    ail_appinfo_get_str(appinfo, AIL_PROP_TYPE_STR, &typ);
+    if (strcmp(typ, APP_CONF_AIL_NULL_STR) == 0) {
+        typ = NULL;
+    }
+    /* get exec */
+    ail_appinfo_get_str(appinfo, AIL_PROP_EXEC_STR, &exe);
+    if (strcmp(exe, APP_CONF_AIL_NULL_STR) == 0) {
+        exe = NULL;
+    }
+    ail_appinfo_get_bool(appinfo, AIL_PROP_NODISPLAY_BOOL, &bndsp);
+    ICO_DBG("pkg:%s icn:%s nm:%s ctg:%s ty:%s exe:%s ds:%s", pkg? pkg:DNil,
+            icn? icn:DNil, nm? nm:DNil, ctgry? ctgry:DNil, typ? typ:DNil,
+            exe? exe:DNil, bndsp? "true":"false");
+    if (false == x->addAIL(pkg, icn, nm, ctgry, typ, exe, bndsp)) {
+        ICO_TRA("end bad end")
+        return AIL_CB_RET_CANCEL;
+    }
+    ICO_TRA("end")
+    return AIL_CB_RET_CONTINUE;
+}
+
+/**
+ * @brief create infomation ail data
+ * @retval true success
+ * @retval false fail create
+ */
+bool CicoSCLifeCycleController::createAilItems()
+{
+    ICO_TRA("start");
+    m_ail.clear(); // clear items
+    if (NULL == m_gconf) {
+        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);
+        GError  *gerr = NULL;
+        int flg;
+        flg = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS;
+        if (!g_key_file_load_from_file(m_gconf, gsfp->str, (GKeyFileFlags)flg, &gerr)) {
+            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);
+    }
+    int r;
+    ail_filter_h fil;
+    ail_filter_new(&fil);
+    r = ail_filter_add_str(fil, AIL_PROP_TYPE_STR, DAilTypeFilPrm_Menu);
+    r = ail_filter_list_appinfo_foreach(fil, CSCLCCail_list_appinfo_cb,
+                                        (void*)this);
+    ail_filter_destroy(fil);
+    if (r != AIL_ERROR_OK) {
+        if (m_gconf) {
+            g_key_file_free(m_gconf);
+            m_gconf = NULL;
+        }
+        ICO_TRA("end menu read NG(AIL)=%d", r);
+        return false;
+    }
+
+    ail_filter_new(&fil);
+    r = ail_filter_add_str(fil, AIL_PROP_TYPE_STR, DAilTypeFilPrm_App);
+    r = ail_filter_list_appinfo_foreach(fil, CSCLCCail_list_appinfo_cb,
+                                        (void*)this);
+    ail_filter_destroy(fil);
+    if (r != AIL_ERROR_OK) {
+        if (m_gconf) {
+            g_key_file_free(m_gconf);
+            m_gconf = NULL;
+        }
+        ICO_TRA("end Application read NG(AIL)=%d", r);
+        return false;
+    }
+    if (m_gconf) {
+        g_key_file_free(m_gconf);
+        m_gconf = NULL;
+    }
+    ICO_TRA("end");
+    return true;
+}
+
+/**
+ * @brief ail infomation data add one item
+ * @param sPkg string package (appid)
+ * @param sIco string icon full path
+ * @param sNm string name
+ * @param sCtg string categoies
+ * @param sTyp string type
+ * @param sExe string exec name
+ * @param bndsp bool nodisplay value
+ * @return method status
+ * @retval true success added item
+ * @retval false fail added item
+ */
+bool CicoSCLifeCycleController::addAIL(const char* sPkg, const char* sIco,
+                                       const char* sNm, const char* sCtg,
+                                       const char* sTyp, const char* sExe,
+                                       bool bndsp)
+{
+    ICO_TRA("start pkg(%s)", sPkg? sPkg: "(NULL)");
+    string category;
+    getCategory(sPkg, sNm, sCtg, category);
+    CicoSCAilItems CSCAI(sPkg, sIco, sNm, sCtg, sTyp, sExe, category, bndsp);
+    m_ail.push_back(CSCAI);
+    ICO_TRA("end");
+    return true;
+}
+
+/**
+ * @brief get category data
+ * @param sPkg ail package(appid) (get key)
+ * @param sNm ail name (get key)
+ * @param sCtg ail categories (get key)
+ * @param category read config file category string define
+ */
+void CicoSCLifeCycleController::getCategory(const char* sPkg, const char* sNm,
+                                            const char* sCtg,
+                                            std::string& category)
+{
+    ICO_TRA("start pkg(%s)", sPkg? sPkg: "(NULL)");
+    category.clear();
+    GError *gerr;
+    char *appCtgry;
+    int  appCtgryType;
+    char addCtgry[400];
+    int  addCtgryLen;
+    char work[80];
+
+    /* get default category of this application */
+    addCtgry[0] = 0;
+    gerr = NULL;
+    appCtgry = g_key_file_get_string(m_gconf, sectAppAttr, sPkg, &gerr);
+    if (gerr == NULL)  {
+        appCtgryType = 0;
+    }
+    else {
+        g_clear_error(&gerr);
+        gerr = NULL;
+        appCtgry = g_key_file_get_string(m_gconf, sectAppAttr, sNm, &gerr);
+        if (gerr == NULL) {
+            appCtgryType = 1;
+        }
+    }
+    addCtgryLen = 0;
+    if (gerr != NULL) {
+        g_clear_error(&gerr);
+    }
+    else {
+        for (int i = 1;; i++) {
+            strncpy(&addCtgry[addCtgryLen],
+            appCtgry, sizeof(addCtgry)-addCtgryLen-2);
+            addCtgry[sizeof(addCtgry)-2] = 0;
+            addCtgryLen = strlen(addCtgry);
+            if (addCtgryLen > 0) {
+                if (addCtgry[addCtgryLen-1] != ';') {
+                    strcpy(&addCtgry[addCtgryLen++], ";");
+                }
+            }
+            snprintf(work, sizeof(work)-1, "%s.%d",
+                     appCtgryType == 0 ? sPkg : sNm, i);
+            gerr = NULL;
+            appCtgry = g_key_file_get_string(m_gconf, sectAppAttr, work, &gerr);
+            if (gerr != NULL) {
+                g_clear_error(&gerr);
+                break;
+            }
+        }
+    }
+    g_clear_error(&gerr);
+
+    /* get category */
+    if (NULL != sCtg) {
+        strncpy(&addCtgry[addCtgryLen], sCtg, sizeof(addCtgry)-addCtgryLen-1);
+        addCtgry[sizeof(addCtgry)-1] = 0;
+    }
+    if (addCtgry[0]) {
+         category.assign(addCtgry);
+        ICO_DBG("category=%s", category.c_str());
+    }
+    ICO_TRA("end");
+}
+
+/**
+ * @brief aul infomation data initialization
+ */
+void CicoSCLifeCycleController::initAUL()
+{
+    ICO_TRA("start");
+    aul_listen_app_launch_signal(CSCLCCapp_launch_handler, (void*)this);
+    aul_listen_app_dead_signal(CSCLCCapp_dead_handler, (void*)this);
+    ICO_TRA("end");
+}
+
+/**
+ * @brief
+ */
+void CicoSCLifeCycleController::enterAUL(const char* appid, int pid,
+                                         const CicoSCWindow* obj)
+{
+    ICO_TRA("start");
+    bool bPushBack = true;
+    int sz = m_aul.size();
+    for (int i = 0; i < sz; i++) {
+        CicoSCAulItems* t = (CicoSCAulItems*)m_aul[i].p();
+        if (t->m_pid == pid) {
+            bPushBack = false;  // push_back flag off
+            if (NULL == obj) {
+                // Do not replace to NULL
+                ICO_DBG("Do not replace to NULL %d", t->m_CSCWptrs.size());
+                break; // break of for
+            }
+            else {
+                ICO_DBG("add window info. %d, %x", t->m_CSCWptrs.size(), obj);
+                t->enterWindow(obj);
+                break; // break of for
+            }
+        }
+    }
+    if (true == bPushBack) { // push back flag on?
+        // AUL list Unregistered
+        ICO_DBG("push_back(AUL(%s, %d, %x))", appid, pid, obj);
+        int ctgry = DINITm_categoryID;
+        const CicoSCAilItems* ailObj = findAIL(appid);
+        if ((NULL != ailObj) && (0 != ailObj)) {
+            ctgry = ailObj->m_categoryID;
+        }
+        CicoSCAulItems entryAUL(appid, pid, ctgry, obj);
+        m_aul.push_back(entryAUL);
+        if (-1 != entryAUL.m_cpucgroup) {
+            m_RC->entryCgroupCPU(pid, entryAUL.m_cpucgroup);
+        }
+    }
+    ICO_TRA("end");
+}
+
+/**
+ * @brief
+ */
+bool CicoSCLifeCycleController::removeAUL(int pid)
+{
+    ICO_TRA("start %d", pid);
+    bool r = false;
+    vector<CicoSCAulItems>::iterator it;
+    for(it = m_aul.begin(); it != m_aul.end(); ++it) {
+        if (pid == it->m_pid) {
+            ICO_DBG("erase appid=%s", it->m_appid.c_str());
+            m_aul.erase(it);
+            r = true;
+            break;
+        }
+    }
+    ICO_TRA("end %s", r? "true":"false");
+    return r;
+}
+
+/**
+ * @brief 
+ * @param x CicoSCLifeCycleController class pointer
+ */
+int CSCLCCapp_launch_handlerX(int pid, CicoSCLifeCycleController* x)
+{
+    ICO_TRA("start");
+    if ((NULL == x) || (0 == x)) {
+        ICO_TRA("end user data is NULL");
+        return -1;
+    }
+    char appid[255];
+    memset(appid, 0, sizeof(appid));
+    aul_app_get_appid_bypid(pid, appid, sizeof(appid)); // pid to appid
+    ICO_DBG("added %s, %d", appid, pid);
+    x->enterAUL(appid,pid);
+    ICO_TRA("end %s %d", appid, pid);
+    return 0;
+}
+
+
+/**
+ * @brief applications die. callback function
+ * @param pid
+ * @param data user data
+ * @param x CicoSCLifeCycleController class pointer
+ */
+int CSCLCCapp_dead_handlerX(int pid, CicoSCLifeCycleController* x)
+{
+    ICO_TRA("start");
+    if ((NULL == x) || (0 == x)) {
+        ICO_TRA("end user data is NULL");
+        return -1;
+    }
+    if (false == x->removeAUL(pid)) {
+        ICO_TRA("end dead %d fail", pid);
+        return -1;
+    }
+    ICO_TRA("end dead %d success", pid);
+    return 0;
+}
+
diff --git a/lib/system-controller/CicoSCLifeCycleController.h b/lib/system-controller/CicoSCLifeCycleController.h
new file mode 100644 (file)
index 0000000..3928d11
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * 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
+ *
+ */
+#ifndef CICOSCLIFECYCLECONTROLLER_H
+#define CICOSCLIFECYCLECONTROLLER_H
+#include <glib.h>
+#include <vector>
+#include <map>
+#include <ail.h>
+#include <package-manager.h>
+
+#include "CicoSCAilItems.h"
+#include "CicoSCAulItems.h"
+
+
+#ifndef __CICO_SC_WINDOW_H__
+class CicoSCWindow;
+#endif
+
+#ifndef CICOSCSYSRESOURCECONTROLLER_H
+class CicoSCSysResourceController;
+#endif
+
+class CicoSCLifeCycleController {
+public:
+    CicoSCLifeCycleController();
+    ~CicoSCLifeCycleController();
+
+       static CicoSCLifeCycleController* getInstance(void);
+
+    // Starting application
+    int launch(const char* appid);
+    int launch(const std::string& appid);
+    // Stopping application
+    int terminate(const char* appid);
+    int terminate(const std::string& appid);
+    int terminate(int pid);
+    // suspend application
+    int suspend(const char* appid);
+    int suspend(const std::string& appid);
+    int suspend(int pid);
+    // run application check
+    bool isRunning(const char* appid) const;
+    bool isRunning(const std::string& appid) const;
+
+    const std::vector<CicoSCAilItems>& getAilList() const;
+    const CicoSCAilItems* findAIL(const char* appid) const;
+    const CicoSCAilItems* findAIL(const std::string& appid) const;
+
+    const std::vector<CicoSCAulItems>& getAulList() const;
+// TODO mk_k Should I think about the multiple return values start
+/*
+    const CicoSCAulItems* findAUL(const char* appid) const;
+    const CicoSCAulItems* findAUL(const std::string& appid) const;
+*/
+    const CicoSCAulItems* findAUL(int pid) const;
+    bool getPIDs(const char* appid, std::vector<int>& pids) const;
+    bool getPIDs(std::string& appid, std::vector<int>& pids) const;
+    void enterAUL(const char* appid, int pid, const CicoSCWindow* obj=NULL);
+
+
+protected:
+    void initAIL();
+    friend ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
+                                                   CicoSCLifeCycleController* x);
+    bool createAilItems();
+
+    friend 
+        int CSCLCCpkgmgr_handlerX(int req_id, const char *pkg_type,
+                                 const char *pkg_name, const char *key,
+                                 const char *val, const void *pmsg,
+                                 CicoSCLifeCycleController *x);
+    void renewAIL();
+    void initAUL();
+    friend int CSCLCCapp_launch_handlerX(int pid,
+                                         CicoSCLifeCycleController *x);
+    friend int CSCLCCapp_dead_handlerX(int pid, CicoSCLifeCycleController *x);
+
+    int terminateR(int pid);
+    void getCategory(const char* sPkg, const char* sNm, const char* sCtg,
+                     std::string& category);
+    bool addAIL(const char* sPkg, const char* sIco, const char* sNm,
+                const char* sCtg, const char* sTyp, const char* sExe,
+                bool bndsp);
+    bool removeAUL(int pid);
+private:
+       static CicoSCLifeCycleController* ms_myInstance;
+
+protected:
+    std::vector<CicoSCAilItems> m_ail;
+    std::vector<CicoSCAulItems> m_aul;
+    GKeyFile* m_gconf;
+    pkgmgr_client* m_pc;
+    CicoSCSysResourceController* m_RC;
+};
+
+/**
+ * @brief AIL infomaton list
+ * @return AIL infomation item list Container
+ */
+inline
+const std::vector<CicoSCAilItems>& CicoSCLifeCycleController::getAilList() const
+{
+    return m_ail;
+}
+
+
+/**
+ * @brief AUL infomaton list
+ * @return AUL infomation item list Container
+ */
+inline
+const std::vector<CicoSCAulItems>& CicoSCLifeCycleController::getAulList() const
+{
+    return m_aul;
+}
+
+
+
+#endif // CICOSCLIFECYCLECONTROLLER_H
diff --git a/lib/system-controller/CicoSCMessage.cpp b/lib/system-controller/CicoSCMessage.cpp
new file mode 100644 (file)
index 0000000..e4eb5a5
--- /dev/null
@@ -0,0 +1,267 @@
+/*
+ * 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   CicoSCMessage.cpp
+ *
+ *  @brief  Implementation of CicoSCMessage class
+ */
+//==========================================================================
+#include <limits.h>
+
+#include "CicoSCMessage.h"
+#include "CicoLog.h"
+
+//==========================================================================    
+//  private static variable
+//==========================================================================    
+unsigned int CicoSCMessage::ms_counter = 0;
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
+CicoSCMessage::CicoSCMessage()
+{
+    if (ms_counter == UINT_MAX) {
+        ms_counter = 0;
+    }
+    m_id = ++ms_counter;
+    m_generator = json_generator_new();
+    m_root      = json_node_new(JSON_NODE_OBJECT);
+    m_rootObj   = json_object_new();
+    m_argObj    = json_object_new();
+    m_array     = json_array_new();
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
+CicoSCMessage::~CicoSCMessage()
+{
+    ICO_DBG("CicoSCMessage::~CicoSCMessage Entry");
+    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");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get message id
+ *
+ *  @return id of message
+ */
+//--------------------------------------------------------------------------
+unsigned int
+CicoSCMessage::getId(void)
+{
+    return m_id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  add root object for char pointer type
+ *
+ *  @param [in] key     key name of object
+ *  @param [in] value   value of object for char pointer type
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCMessage::addRootObject(const char * key, const char * value)
+{
+    ICO_DBG("json_object_set_string_member(%s, %s) called.", key, value);
+    json_object_set_string_member(m_rootObj, key, value);
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  add root object for string type
+ *
+ *  @param [in] key     keyname of object
+ *  @param [in] value   value of object for string type
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCMessage::addRootObject(const char * key, const std::string & value)
+{
+    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());
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  add root object for integer type
+ *
+ *  @param [in] key     key name of object
+ *  @param [in] value   value of object for integer type
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCMessage::addRootObject(const char * key, int value)
+{
+    ICO_DBG("json_object_set_int_member(%s, %d) called.", key, value);
+    json_object_set_int_member(m_rootObj, key, value);
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  add argument object for char pointer type
+ *
+ *  @param [in] key     key name of object
+ *  @param [in] value   value of object for char pointer type
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCMessage::addArgObject(const char * key, const char * value)
+{
+    ICO_DBG("json_object_set_string_member(%s, %s) called.", key, value);
+    json_object_set_string_member(m_argObj, key, value);
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  add argument object for string type
+ *
+ *  @param [in] key     key name of object
+ *  @param [in] value   value of object for string type
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCMessage::addArgObject(const char * key, const std::string & value)
+{
+    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());
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  add argument object for integer type
+ *
+ *  @param [in] key     key name of object
+ *  @param [in] value   value of object for integer type
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCMessage::addArgObject(const char * key, int value)
+{
+    ICO_DBG("json_object_set_int_member(%s, %d) called.", key, value);
+    json_object_set_int_member(m_argObj, key, value);
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  add argument object for array type
+ *
+ *  @param [in] key     key name of array
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCMessage::addArgObject(const char * key)
+{
+    // count up reference
+    json_array_ref(m_array);
+
+    ICO_DBG("json_object_set_array_member(%s) called.", key);
+    json_object_set_array_member(m_argObj, key, m_array);
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  add array element for char pointer type
+ *
+ *  @param [in] value   value of object for char pointer type
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCMessage::addElmArray(const char * value)
+{
+    ICO_DBG("json_array_add_string_element(%s) called.", value);
+    json_array_add_string_element(m_array, value);
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  add array element for string type
+ *
+ *  @param [in] value   value of object for string type
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCMessage::addElmArray(const std::string & value)
+{
+    ICO_DBG("json_array_add_string_element(%s) called.", value.c_str());
+    json_array_add_string_element(m_array, value.c_str());
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get destination handle 
+ *
+ *  @return pointer of destination handle
+ */
+//--------------------------------------------------------------------------
+CicoSCUwsHandle*
+CicoSCMessage::getHandle(void)
+{
+    return m_uwsHandle;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  set destination handle 
+ *
+ *  @param [in]  handle destination handle
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCMessage::setHandle(CicoSCUwsHandle* handle)
+{
+    m_uwsHandle = handle;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get message data
+ *
+ *  @return pointer of message data
+ */
+//--------------------------------------------------------------------------
+const char*
+CicoSCMessage::getData(void)
+{
+    // count up reference
+    json_object_ref(m_rootObj);
+    json_object_ref(m_argObj);
+
+    json_object_set_object_member(m_rootObj, "arg", m_argObj);
+    json_node_take_object(m_root, m_rootObj);
+    json_generator_set_root(m_generator, m_root);
+    gsize len = 0;
+    return json_generator_to_data(m_generator, &len);
+}
+
+const std::string &
+CicoSCMessage::getSendToAppid(void)
+{
+    return m_toAppid;
+}
+
+void
+CicoSCMessage::setSendToAppid(const std::string & appid)
+{
+    m_toAppid = appid;
+}
+// vim:set expandtab ts=4 sw=4:
\ No newline at end of file
diff --git a/lib/system-controller/CicoSCMessage.h b/lib/system-controller/CicoSCMessage.h
new file mode 100644 (file)
index 0000000..aea28a2
--- /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
+ *
+ */
+
+//==========================================================================
+/**
+ *  @file   CicoSCMessage.h
+ *
+ *  @brief  Definition of CicoSCMessage class
+ */
+//==========================================================================
+#ifndef __CICO_SC_MESSAGE_H__
+#define __CICO_SC_MESSAGE_H__
+
+#include <string>
+
+#include <json-glib/json-glib.h>
+
+//==========================================================================
+//  forward declaration
+//==========================================================================
+class CicoSCUwsHandle;
+
+//==========================================================================
+/**
+ *  @brief  communication message representation
+ */
+//==========================================================================
+class CicoSCMessage
+{
+public:
+    // default constructor
+    CicoSCMessage();
+
+    // destructor
+    ~CicoSCMessage();
+
+    // get message id
+    unsigned int getId(void);
+
+    // add root object for char pointer type
+    void addRootObject(const char * key, const char * value);
+
+    // add root object for string type
+    void addRootObject(const char * key, const std::string & value);
+
+    // add root object for integer type
+    void addRootObject(const char * key, int value);
+
+    // add argument object for char pointer type
+    void addArgObject(const char * key, const char * value);
+
+    // add argument object for string type
+    void addArgObject(const char * key, const std::string & value);
+
+    // add argument object for integer type
+    void addArgObject(const char * key, int value);
+
+    // add argument object for array type
+    void addArgObject(const char * key);
+
+    // add element to array for char pointer type
+    void addElmArray(const char * value);
+
+    // add element to array for string type
+    void addElmArray(const std::string & value);
+
+    // get destination handle 
+    CicoSCUwsHandle* getHandle(void);
+
+    // set destination handle 
+    void setHandle(CicoSCUwsHandle* handle);
+
+    // get message data
+    const char* getData(void);
+
+    void setSendToAppid(const std::string & appid);
+
+    const std::string & getSendToAppid(void);
+
+private:
+    // assignment operator
+    CicoSCMessage& operator=(const CicoSCMessage &object);
+
+    // copy constructor
+    CicoSCMessage(const CicoSCMessage &object);
+
+private:
+    static unsigned int ms_counter;     //!< meesage id counter
+    int                 m_id;           //!< message id
+    CicoSCUwsHandle     *m_uwsHandle;   //!< communication handller
+    JsonGenerator       *m_generator;   //!< json generator
+    JsonNode            *m_root;        //!< json root node
+    JsonObject          *m_rootObj;     //!< json root objects
+    JsonObject          *m_argObj;      //!< json arg objects
+    JsonArray           *m_array;       //!< json array
+    std::string         m_toAppid;      //!< send to appid
+};
+#endif  // __CICO_SC_MESSAGE_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCPolicyManager.cpp b/lib/system-controller/CicoSCPolicyManager.cpp
new file mode 100644 (file)
index 0000000..e11bcac
--- /dev/null
@@ -0,0 +1,602 @@
+/*
+ * 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   CicoSCPolicyManager.cpp
+ *
+ *  @brief 
+ */
+//==========================================================================
+#include <Ecore.h>
+
+#include "CicoStateMachine.h"
+#include "CicoState.h"
+#include "CicoHistoryState.h"
+#include "CicoStateMachineCreator.h"
+#include "CicoSCPolicyManager.h"
+#include "CicoSCResourceManager.h"
+#include "CicoLog.h"
+#include "ico_syc_error.h"
+
+//==========================================================================
+//  define
+//==========================================================================
+
+// Defines of D-Bus target.
+#define DBUS_SERVICE    "org.automotive.message.broker"
+#define DBUS_INTERFACE  "org.freedesktop.DBus.Properties"
+#define DBUS_METHOD     "Get"
+
+// Defines of Muximum 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_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     */
+    const char    *path;      /* D-Bus path name         */
+    const char    *interface; /* D-Bus interface name    */
+} vhcl_info_prop_t;
+
+// structure of Vehicle information data.
+typedef struct _vehicle_info_data {
+    int             key;    /* Vehicle Information key */
+    DBusPendingCall *pending;
+    int             request;
+    double          val;
+} _vhcldata_t;
+
+_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
+ */
+/*========================================================================*/    
+/*
+ *
+ */
+static const vhcl_info_prop_t apf_vhcl_info[] = {
+    { AMB_VHCL_SPEED,
+      "VehicleSpeed",
+      "/org/automotive/runningstatus/VehicleSpeed",
+      "org.automotive.VehicleSpeed"
+    },
+    { AMB_SHIFT_POSITION,
+      "ShiftPosition",
+      "/org/automotive/runningstatus/Transmission",
+      "org.automotive.Transmission"
+    },
+    { AMB_WINKER,
+      "Winker",
+      "\0",
+      "\0" },
+    { 0, "\0", "\0", "\0" }
+};
+
+/*
+ *  Ecore/D-Bus static variables
+ */
+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_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);
+}
+
+CicoSCPolicyManager::~CicoSCPolicyManager()
+{
+}
+
+int
+CicoSCPolicyManager::initialize(void)
+{
+    ICO_DBG("CicoSCPolicyManager::initialize Enter");
+
+    int ret = ICO_SYC_EOK;
+    ret = initAMB();
+    if (ICO_SYC_EOK != ret) {
+        return ret;
+    }
+
+    ret = initStateMachine();
+    if (ICO_SYC_EOK != ret) {
+        return ret;
+    }
+
+    ICO_DBG("CicoSCPolicyManager::initialize Leave");
+    return ret;
+}
+  
+void
+CicoSCPolicyManager::terminate(void)
+{
+    ICO_DBG("CicoSCPolicyManager::terminate Enter");
+    ICO_DBG("CicoSCPolicyManager::terminate Leave");
+}
+
+int
+CicoSCPolicyManager::initAMB(void)
+{
+    ICO_DBG("CicoSCPolicyManager::initAMB Enter");
+
+    int ret = 0;
+    DBusError dbus_error;
+
+    if (true == m_initialized) {
+        ICO_DBG("CicoSCPolicyManager::initAMB Leave(EOK)");
+        return ICO_SYC_EOK;
+    }
+
+    /* Zero clear vhcl_data */
+    memset(vhcl_data, 0, sizeof(vhcl_data));
+
+    /* Reset D-Bus error */
+    dbus_error_init(&dbus_error);
+
+    /* Get D-Bus connection */
+    dbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &dbus_error);
+    if (! dbus_connection) {
+        ICO_ERR("dbus_bus_get failed.");
+        ICO_ERR("CicoSCPolicyManager::initAMB Leave(EIO)");
+        return ICO_SYC_EIO;
+    }
+
+    /* send request to AMB */
+    sendAMBRequest();
+
+    /* recv response from AMB timer start */
+    ret = ecore_init();
+    if (ret == 0) {
+        ICO_ERR("ecore_init");
+        ICO_ERR("CicoSCPolicyManager::initAMB Leave(ENOSYS)");
+        return ICO_SYC_ENOSYS;
+    }
+
+    vehicle_timer = ecore_timer_add(1,//TODO
+                                    CicoSCPolicyManager::ecoreTimerCB,
+                                    this);
+    if (! vehicle_timer)    {
+        ICO_ERR("ecore_timer_add failed.");
+        ICO_ERR("CicoSCPolicyManager::initAMB Leave(ENOSYS)");
+        return ICO_SYC_ENOSYS;
+    }
+
+    m_initialized = true;
+
+    ICO_DBG("CicoSCPolicyManager::initAMB Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+int
+CicoSCPolicyManager::sendAMBRequest(void)
+{
+//    ICO_DBG("CicoSCPolicyManager::sendAMBRequest Enter");
+
+    DBusMessage *dbus_message = NULL;
+    int     idx;
+    int     ret = ICO_SYC_EOK;
+
+    for (idx = 0; apf_vhcl_info[idx].key; idx++) {
+        /* set vehicle info key */
+        vhcl_data[idx].key = apf_vhcl_info[idx].key;
+
+        /* status is pending ? */
+        if (vhcl_data[idx].pending)  {
+            ICO_WRN("(%s) not complete", apf_vhcl_info[idx].property);
+            continue;
+        }
+
+        if (apf_vhcl_info[idx].path[0] == 0) {
+            /* currently not support this vehicle information */
+            continue;
+        }
+
+        /* Create send message */
+        dbus_message = dbus_message_new_method_call(DBUS_SERVICE,
+                                                    apf_vhcl_info[idx].path,
+                                                    DBUS_INTERFACE,
+                                                    DBUS_METHOD);
+        if (! dbus_message) {
+            ICO_ERR("dbus_message_new_method_call");
+            ret = ICO_SYC_EIO;
+        }
+        /* Set parameters into message */
+        else if (! dbus_message_append_args(dbus_message,
+                                            DBUS_TYPE_STRING,
+                                            &apf_vhcl_info[idx].interface,
+                                            DBUS_TYPE_STRING,
+                                            &apf_vhcl_info[idx].property,
+                                            DBUS_TYPE_INVALID)) {
+            ICO_ERR("dbus_message_append_args");
+            ret = ICO_SYC_EIO;
+        }
+        /* Set destination */
+        else if (! dbus_message_set_destination(dbus_message, 
+                                                DBUS_SERVICE)) {
+            ICO_ERR("dbus_message_set_destination");
+            ret = ICO_SYC_EIO;
+        }
+        /* Send message */
+        else if (! dbus_connection_send_with_reply(dbus_connection, 
+                                                   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);
+        }
+
+        if (dbus_message) {
+            /* Release message */
+            dbus_message_unref(dbus_message);
+        }
+    }
+
+    /* dispatch if data queue exist */
+    do  {
+        dbus_connection_read_write_dispatch(dbus_connection, 0);
+    } while (dbus_connection_get_dispatch_status(dbus_connection)
+             == DBUS_DISPATCH_DATA_REMAINS);
+
+//    ICO_DBG("CicoSCPolicyManager::sendAMBRequest Leave");
+    return ret;
+}
+
+int
+CicoSCPolicyManager::getVehicleInfo(void)
+{
+    DBusMessage *dbus_message = NULL;
+    DBusMessageIter iter_head;
+    DBusMessageIter iter;
+    int         idx;
+    char        type;
+    int32_t     i32;
+    int16_t     i16;
+    uint32_t    u32;
+    uint16_t    u16;
+    dbus_bool_t b;
+    uint8_t     u8;
+    double      d64;
+
+    /* dispatch if data queue exist */
+    do {
+        dbus_connection_read_write_dispatch(dbus_connection, 0);
+    } while (dbus_connection_get_dispatch_status(dbus_connection)
+             == DBUS_DISPATCH_DATA_REMAINS);
+
+    /* analize reply datas */
+    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);
+            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);
+            continue;
+        }
+
+        if (dbus_message_get_type(dbus_message) == DBUS_MESSAGE_TYPE_ERROR) {
+            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);
+            continue;
+        }
+
+        dbus_message_iter_init(dbus_message, &iter_head);
+        dbus_message_iter_recurse(&iter_head, &iter);
+
+        type = dbus_message_iter_get_arg_type(&iter);
+        switch (type)   {
+        case DBUS_TYPE_INT32:
+            dbus_message_iter_get_basic(&iter, &i32);
+            vhcl_data[idx].val = (double)i32;
+            break;
+        case DBUS_TYPE_INT16:
+            dbus_message_iter_get_basic(&iter, &i16);
+            vhcl_data[idx].val = (double)i16;
+            break;
+        case DBUS_TYPE_UINT32:
+            dbus_message_iter_get_basic(&iter, &u32);
+            break;
+        case DBUS_TYPE_UINT16:
+            dbus_message_iter_get_basic(&iter, &u16);
+            vhcl_data[idx].val = (double)u16;
+            break;
+        case DBUS_TYPE_BOOLEAN:
+            dbus_message_iter_get_basic(&iter, &b);
+            if (b)      vhcl_data[idx].val = (double)1.0;
+            else        vhcl_data[idx].val = (double)0.0;
+            break;
+        case DBUS_TYPE_BYTE:
+            dbus_message_iter_get_basic(&iter, &u8);
+            vhcl_data[idx].val = (double)u8;
+            break;
+        case DBUS_TYPE_DOUBLE:
+            dbus_message_iter_get_basic(&iter, &d64);
+            vhcl_data[idx].val = (double)d64;
+            break;
+        default:
+            ICO_ERR("(%s) illegal data type(0x%02x)",
+                    apf_vhcl_info[idx].property, ((int)type) & 0x0ff);
+            break;
+        }
+        ICO_DBG("REQUEST ans (%s) = %.2f",
+                apf_vhcl_info[idx].property, vhcl_data[idx].val);
+
+        /* free message and pending */
+        dbus_message_unref(dbus_message);
+        dbus_pending_call_cancel(vhcl_data[idx].pending);
+        vhcl_data[idx].pending = NULL;
+    };
+
+    return ICO_SYC_EOK;
+}
+
+Eina_Bool
+CicoSCPolicyManager::ecoreTimerCB(void *user_data)
+{
+    CicoSCPolicyManager *policyMgr =
+        static_cast<CicoSCPolicyManager*>(user_data);
+    policyMgr->recvAMBVehicleInfo();
+
+    return ECORE_CALLBACK_RENEW;
+}
+
+void
+CicoSCPolicyManager::recvAMBVehicleInfo(void)
+{
+//    ICO_DBG("CicoSCPolicyManager::recvAMBVehicleInfo Enter");
+
+    int idx = 0;
+    int key = 0;
+    bool chgDrvState = false;
+    bool chgShiftPosState = false;
+    bool chgWinkerState = false;
+
+    getVehicleInfo();
+
+    /* get vehicle info values  */
+    for (idx = 0; idx < AMB_MAX_VHCLINFO; idx++)   {
+        if (vhcl_data[idx].key == 0) break;
+        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);
+            break;
+        case AMB_SHIFT_POSITION:
+            chgShiftPosState = sendSMEvent(EVID_SHIFTPOS,
+                                           (int)vhcl_data[idx].val);
+            break;
+        case AMB_WINKER:
+            chgWinkerState = sendSMEvent(EVID_WINKER,
+                                         (int)vhcl_data[idx].val);
+            break;
+        default:
+            ICO_WRN("not such key (%d)", key);
+            break;
+        }
+    }
+
+    if (true == chgDrvState) {
+        bool chg = sendSMEvent(EVID_DRVREGULATION);
+        if (true == chg) {
+            // notify changed state to resource manager
+            CicoState* state =
+                (CicoState*)m_stateMachine->getState(STID_DRVREGULATION);
+            vector<const CicoState*> currents;
+            if ((NULL != state) && (0 != currents.size())) {
+                state->getCurrentState(currents, CicoStateCore::ELvlTop);
+                ICO_DBG("current=%s", currents[0]->getName().c_str());
+                notifyChangedState(currents[0]->getValue());
+            }
+        }
+    }
+    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);
+            vector<const CicoState*> currents;
+            if ((NULL != state) && (0 != currents.size())) {
+                state->getCurrentState(currents, CicoStateCore::ELvlTop);
+                ICO_DBG("current=%s", currents[0]->getName().c_str());
+                notifyChangedState(currents[0]->getValue());
+            }
+        }
+    }
+        
+    /* send request to AMB */
+    sendAMBRequest();
+
+//    ICO_DBG("CicoSCPolicyManager::recvAMBVehicleInfo Leave");
+}
+
+int
+CicoSCPolicyManager::initStateMachine(void)
+{
+    ICO_DBG("CicoSCPolicyManager::initStateMachine Enter");
+
+    CicoStateMachineCreator creator;
+
+    m_stateMachine = creator.createFile("/usr/apps/org.tizen.ico.system-controller/res/config/policy.json");
+    if (NULL == m_stateMachine) {
+        ICO_ERR("CicoStateMachineCreator::createFile failed.");
+        return ICO_SYC_ENOSYS;
+    }
+
+    int ret = m_stateMachine->start();
+    if (ret == 0) {
+        ICO_ERR("CicoStateMachine::start faile.");
+        return ICO_SYC_ENOSYS;
+    }
+
+    ICO_DBG("CicoSCPolicyManager::initStateMachine Leave");
+    return ICO_SYC_EOK;
+}
+
+bool
+CicoSCPolicyManager::testSMEvent(unsigned short event_id)
+{
+    CicoEvent event(event_id);
+    return m_stateMachine->eventTest(event);
+}
+
+bool
+CicoSCPolicyManager::testSMEvent(unsigned short event_id, int value)
+{
+    CicoEvent event(event_id, value);
+    return m_stateMachine->eventTest(event);
+}
+
+bool
+CicoSCPolicyManager::sendSMEvent(unsigned short event_id)
+{
+    CicoEvent event(event_id);
+    return m_stateMachine->eventEntry(event);
+}
+
+bool
+CicoSCPolicyManager::sendSMEvent(unsigned short event_id, int value)
+{
+    CicoEvent event(event_id, value);
+    return m_stateMachine->eventEntry(event);
+}
+
+bool
+CicoSCPolicyManager::acquireDisplayResource(int zoneid, int category)
+{
+    ICO_DBG("CicoSCPolicyManager::acquireDisplayResource Enter"
+            "(zoneid=%d category=%d)", zoneid, category);
+    bool ret = sendSMEvent(m_acquireDispResEventTable[zoneid], category);
+    ICO_DBG("CicoSCPolicyManager::acquireDisplayResource Leave(%s)",
+            ret ? "true" : "false");
+    return ret;
+}
+
+bool
+CicoSCPolicyManager::releaseDisplayResource(int zoneid, int category)
+{
+    return true;
+}
+
+bool
+CicoSCPolicyManager::acquireInputResource(int zoneid, int category)
+{
+    return sendSMEvent(m_acquireDispResEventTable[zoneid], category);
+}
+
+bool
+CicoSCPolicyManager::releaseInputResource(int zoneid, int category)
+{
+    return true;
+}
+
+void
+CicoSCPolicyManager::notifyChangedState(int state)
+{
+    m_resourceMgr->receiveChangedState(state);
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCPolicyManager.h b/lib/system-controller/CicoSCPolicyManager.h
new file mode 100644 (file)
index 0000000..9838751
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * 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   CicoSCPolicyManager.h
+ *
+ *  @brief 
+ */
+//==========================================================================
+#ifndef __CICO_SC_POLICY_MANAGER_H__
+#define __CICO_SC_POLICY_MANAGER_H__
+
+#include <vector>
+using namespace std;
+
+#include <Eina.h>
+#include <dbus/dbus.h>
+
+class CicoStateMachine;
+class CicoSCResourceManager;
+
+class CicoSCPolicyManager
+{
+public:
+    // constructor
+    CicoSCPolicyManager(CicoSCResourceManager* resourceMgr=NULL);
+
+    // destructor
+    ~CicoSCPolicyManager();
+
+    // initialize resource manager
+    int initialize(void);
+
+    // terminate resource manager
+    void terminate(void);
+
+    bool acquireDisplayResource(int zoneid, int category);
+    bool releaseDisplayResource(int zoneid, int category);
+    bool acquireInputResource(int zoneid, int category);
+    bool releaseInputResource(int zoneid, int category);
+
+    bool testSMEvent(unsigned short event_id);
+    bool testSMEvent(unsigned short event_id, int value);
+
+    bool sendSMEvent(unsigned short event_id);
+    bool sendSMEvent(unsigned short event_id, int value);
+
+    void notifyChangedState(int state);
+
+    void recvAMBVehicleInfo(void);
+
+private:
+    // default constructor
+    CicoSCPolicyManager();
+
+    // assignment operator
+    CicoSCPolicyManager& operator=(const CicoSCPolicyManager &object);
+
+    // copy constructor
+    CicoSCPolicyManager(const CicoSCPolicyManager &object);
+
+    // initialize amb connection
+    int initAMB(void);
+
+    // send request to amb
+    int sendAMBRequest(void);
+
+    // get vehicle information
+    int getVehicleInfo(void);
+
+    static Eina_Bool ecoreTimerCB(void *user_data);
+
+    int initStateMachine(void);
+
+private:
+    bool m_initialized;
+
+    CicoStateMachine *m_stateMachine;
+
+    CicoSCResourceManager *m_resourceMgr;
+
+    vector<int> m_acquireDispResEventTable;
+    vector<int> m_releaseDispResEventTable;
+};
+#endif  // __CICO_SC_POLICY_MANAGER_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCResourceManager.cpp b/lib/system-controller/CicoSCResourceManager.cpp
new file mode 100644 (file)
index 0000000..f847287
--- /dev/null
@@ -0,0 +1,332 @@
+/*
+ * 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   CicoSCResourceManager.cpp
+ *
+ *  @brief 
+ */
+//==========================================================================
+#include "CicoSCResourceManager.h"
+#include "CicoLog.h"
+#include "ico_syc_error.h"
+#include "ico_syc_mrp_resource_private.h"
+
+#include "ico_syc_msg_cmd_def.h"
+#include "CicoSCSystemConfig.h"
+#include "CicoSCCommandParser.h"
+#include "CicoSCPolicyManager.h"
+#include "CicoSCLifeCycleController.h"
+#include "CicoSCAilItems.h"
+#include "CicoSCWindowController.h"
+#include "CicoSCInputController.h"
+
+CicoSCResourceManager::CicoSCResourceManager()
+    : m_winCtrl(NULL), m_inputCtrl(NULL)
+{
+    m_policyMgr = new CicoSCPolicyManager(this);
+}
+
+CicoSCResourceManager::~CicoSCResourceManager()
+{
+    delete m_policyMgr;
+}
+
+int
+CicoSCResourceManager::initialize(void)
+{
+    ICO_DBG("CicoSCResourceManager::initialize Enter");
+
+    int ret = ICO_SYC_EOK;
+
+    ret = ico_syc_mrp_init(enforceDisplay, enforceSound, enforceInput, this);
+    if (ICO_SYC_EOK != ret) {
+        return ret;
+    }
+
+    ret = m_policyMgr->initialize();
+    if (ICO_SYC_EOK != ret) {
+        return ret;
+    }
+
+    ICO_DBG("CicoSCResourceManager::initialize Leave");
+    return ret;
+}
+  
+void
+CicoSCResourceManager::terminate(void)
+{
+    ICO_DBG("CicoSCResourceManager::terminate Enter");
+    m_policyMgr->terminate();
+    ICO_DBG("CicoSCResourceManager::terminate Leave");
+}
+
+void
+CicoSCResourceManager::handleCommand(const CicoSCCommand &cmd,
+                                     bool internal)
+{
+    ICO_DBG("CicoSCResourceManager::handleCommand Enter"
+            "(cmdid=%08X)", cmd.cmdid);
+
+    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 (true == opt->displayres) {
+            resource_request_t *req = newResourceRequest(RESID_KIND_DISPLAY,
+                                                         reqtype,
+                                                         cmd);
+            acquireDisplayResource(req, 0);
+        }
+        if (true == opt->soundres) {
+            resource_request_t *req = newResourceRequest(RESID_KIND_SOUND,
+                                                         reqtype,
+                                                         cmd);
+            acquireSoundResource(req, 0);
+        }
+        if (true == opt->inputres) {
+            resource_request_t *req = newResourceRequest(RESID_KIND_INPUT,
+                                                         reqtype,
+                                                         cmd);
+            acquireInputResource(req, 0);
+        }
+    }
+    else if (MSG_CMD_RELEASE_RES == cmd.cmdid) {
+
+        if (true == opt->displayres) {
+            resource_request_t *req = newResourceRequest(RESID_KIND_DISPLAY,
+                                                         reqtype,
+                                                         cmd);
+            releaseDisplayResource(req);
+        }
+        if (true == opt->soundres) {
+            resource_request_t *req = newResourceRequest(RESID_KIND_SOUND,
+                                                         reqtype,
+                                                         cmd);
+            releaseSoundResource(req);
+        }
+        if (true == opt->inputres) {
+            resource_request_t *req = newResourceRequest(RESID_KIND_INPUT,
+                                                         reqtype,
+                                                         cmd);
+            releaseInputResource(req);
+        }
+    }
+    else {
+        ICO_WRN("Unknown command");
+    }
+
+    ICO_DBG("CicoSCResourceManager::handleCommand Leave");
+}
+
+void
+CicoSCResourceManager::setWindowController(CicoSCWindowController *winCtrl)
+{
+    m_winCtrl = winCtrl;
+}
+
+void
+CicoSCResourceManager::setInputController(CicoSCInputController *inputCtrl)
+{
+    m_inputCtrl = inputCtrl;
+}
+
+bool
+CicoSCResourceManager::acquireDisplayResource(resource_request_t *req,
+                                              int addprio)
+{
+    bool state = m_policyMgr->acquireDisplayResource(req->dispzoneid,
+                                                     req->category);
+    if (true == state) {
+        if (NULL != m_winCtrl) {
+            //m_winCtrl->show(req->surfaceid, NULL, 0);
+        }
+    }
+    return true;
+}
+
+bool
+CicoSCResourceManager::releaseDisplayResource(resource_request_t *req)
+                                                 
+{
+    return ico_syc_mrp_release_display_resource(req);
+}
+
+bool
+CicoSCResourceManager::acquireSoundResource(resource_request_t *req,
+                                            int addprio)
+{
+    return ico_syc_mrp_acquire_sound_resource(req, addprio);
+}
+
+bool
+CicoSCResourceManager::releaseSoundResource(resource_request_t *req)
+{
+    return ico_syc_mrp_release_sound_resource(req);
+}
+
+bool
+CicoSCResourceManager::acquireInputResource(resource_request_t *req,
+                                            int addprio)
+{
+    return ico_syc_mrp_acquire_input_resource(req, addprio);
+}
+
+bool
+CicoSCResourceManager::releaseInputResource(resource_request_t *req)
+{
+    return ico_syc_mrp_release_input_resource(req);
+}
+
+resource_request_t *
+CicoSCResourceManager::newResourceRequest(int resid,
+                                          int reqtype,
+                                          const CicoSCCommand &cmd)
+{
+    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;
+
+    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;
+    }
+    req->released = 0;
+
+    /* set resource id */
+    req->resid = RESID_TYPE_BASIC;
+    if (1 == opt->type) {
+        req->resid = RESID_TYPE_INTERRUPT;
+    }
+    req->resid |= resid;
+
+    req->resid |= RESID_CMD_RELEASE;
+    if (MSG_CMD_ACQUIRE_RES == cmd.cmdid) {
+        req->resid |= RESID_CMD_ACQUIRE;
+    }
+
+    /* set application infomartion */
+    req->appid = strdup(cmd.appid.c_str());
+    req->pid   = cmd.pid;
+    req->state = ICO_APF_RESOURCE_STATE_WAITTING;
+
+    if (resid == RESID_KIND_DISPLAY) {
+        req->dispzone   = strdup(opt->displayZone.c_str());
+        req->dispzoneid = systemConfig->getDizplayZoneIdbyFullName(req->dispzone);
+        req->winname    = strdup(opt->windowName.c_str());
+        req->surfaceid  = opt->surfaceid;
+        req->id         = opt->surfaceid;;
+    }
+    else if (resid == RESID_KIND_SOUND) {
+        req->soundzone   = strdup(opt->soundZone.c_str());
+        req->soundzoneid = systemConfig->getSoundZoneIdbyFullName(req->soundzone);
+        req->sooudname   = strdup(opt->soundName.c_str());
+        req->soundid     = opt->soundid;
+        req->soundadjust = opt->adjust;
+        req->id          = opt->soundid;
+    }
+    else if (resid == RESID_KIND_INPUT) {
+        req->device = strdup(opt->device.c_str());
+        req->input  = opt->input;
+        req->id     = opt->input;
+    }
+
+    return req;
+}
+
+void
+CicoSCResourceManager::delResourceRequest(resource_request_t *req)
+{
+    if (NULL == req) return;
+
+    if (NULL != req->appid)     free(req->appid);
+    if (NULL != req->dispzone)  free(req->dispzone);
+    if (NULL != req->winname)   free(req->winname);
+    if (NULL != req->soundzone) free(req->soundzone);
+    if (NULL != req->sooudname) free(req->sooudname);
+    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,
+                                    void *user_data)
+{
+    ICO_DBG("CicoSCResourceManager::enforceSound Enter");
+    /* NOP */
+    ICO_DBG("CicoSCResourceManager::enforceSound Leave");
+}
+            
+void
+CicoSCResourceManager::enforceInput(unsigned short state,
+                                    const char *appid,
+                                    const char *device,
+                                    void *user_data)
+{
+    ICO_DBG("CicoSCResourceManager::enforceInput Enter");
+#if 0
+    ico_apc_inputsw_t *czone;
+    int i;
+
+    for (i = 0; i < ninputsw; i++) {
+        if (strcasecmp(inputsw[i].inputsw->swname, device) == 0)  break;
+    }
+
+    if (i >= ninputsw) {
+        i = confsys->misc.default_inputswId;
+    }
+    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");
+    }
+#endif
+    ICO_DBG("CicoSCResourceManager::enforceInput Leave");
+}
+
+// receive changed state
+void
+CicoSCResourceManager::receiveChangedState(int state)
+{
+    ICO_DBG("CicoSCResourceManager::receiveChanagedState Enter");
+    ICO_DBG("CicoSCResourceManager::receiveChanagedState Leave");
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCResourceManager.h b/lib/system-controller/CicoSCResourceManager.h
new file mode 100644 (file)
index 0000000..9b72106
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * 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   CicoSCResourceManager.h
+ *
+ *  @brief 
+ */
+//==========================================================================
+#ifndef __CICO_SC_RESOURCE_MANAGER_H__
+#define __CICO_SC_RESOURCE_MANAGER_H__
+
+#include <list>
+using namespace std;
+
+#include "ico_syc_mrp_resource_private.h"
+
+class CicoSCCommand;
+class CicoSCPolicyManager;
+class CicoSCWindowController;
+class CicoSCInputController;
+
+class CicoSCResourceManager
+{
+public:
+    // default constructor
+    CicoSCResourceManager();
+
+    // destructor
+    ~CicoSCResourceManager();
+
+    // initialize resource manager
+    int initialize(void);
+  
+    // terminate resource manager
+    void terminate(void);
+    // handling command
+    void handleCommand(const CicoSCCommand &cmd, bool internal=false);
+
+    // set CicoSCWindowController instance
+    void setWindowController(CicoSCWindowController *winCtrl);
+
+    // set CicoSCInputController instance
+    void setInputController(CicoSCInputController *inputCtrl);
+
+    // receive changed state
+    void receiveChangedState(int state);
+
+private:
+    // assignment operator
+    CicoSCResourceManager& operator=(const CicoSCResourceManager &object);
+
+    // copy constructor
+    CicoSCResourceManager(const CicoSCResourceManager &object);
+
+    bool acquireDisplayResource(resource_request_t *req, int addprio);
+    bool releaseDisplayResource(resource_request_t *req);
+
+    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);
+
+
+    resource_request_t* newResourceRequest(int resid,
+                                           int reqtype,
+                                           const CicoSCCommand &cmd);
+
+    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,
+                             void *user_data);
+
+    static void enforceInput(unsigned short state,
+                             const char *appid,
+                             const char *device,
+                             void *user_data);
+
+private:
+    CicoSCPolicyManager    *m_policyMgr;
+    CicoSCWindowController *m_winCtrl;
+    CicoSCInputController  *m_inputCtrl;
+
+    list<list<resource_request_t*> > m_dispReqQueue;
+    list<list<resource_request_t*> > m_soundReqQueue;
+    list<list<resource_request_t*> > m_inputReqQueue;
+};
+#endif  // __CICO_SC_RESOURCE_MANAGER_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCServer.cpp b/lib/system-controller/CicoSCServer.cpp
new file mode 100644 (file)
index 0000000..6252e56
--- /dev/null
@@ -0,0 +1,476 @@
+/*
+ * 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   library to communicate with outer process
+ *
+ * @date    Feb-15-2013
+ */
+
+#include <sstream>
+using namespace std;
+
+#include "CicoSCServer.h"
+#include "CicoSCCommandParser.h"
+#include "CicoSCMessage.h"
+#include "CicoLog.h"
+#include "ico_syc_error.h"
+#include "ico_syc_msg_cmd_def.h"
+#include "CicoSCWindowController.h"
+#include "CicoSCInputController.h"
+#include "CicoSCUserManager.h"
+#include "CicoSCUser.h"
+#include "CicoSCResourceManager.h"
+
+class CicoSCUwsHandle
+{
+public:
+    CicoSCUwsHandle()
+        : 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",
+                uwsContext, fd, serviceFlag ? "true" : "false",
+                ecoreFdHandler, appid.c_str());
+    }
+    struct ico_uws_context *uwsContext;
+    void* id;
+    int fd;
+    bool serviceFlag;
+    Ecore_Fd_Handler *ecoreFdHandler;
+    string appid;
+};
+
+CicoSCServer* CicoSCServer::ms_myInstance = NULL;
+
+CicoSCServer::CicoSCServer()
+    : m_uwsContext(NULL), m_windowCtrl(NULL),
+      m_inputCtrl(NULL) , m_userMgr(NULL)
+{
+}
+
+CicoSCServer::~CicoSCServer()
+{
+}
+
+CicoSCServer*
+CicoSCServer::getInstance(void)
+{
+       if (NULL == ms_myInstance) {
+               ms_myInstance = new CicoSCServer();
+       }
+
+       return ms_myInstance;
+}
+
+void
+CicoSCServer::setWindowCtrl(CicoSCWindowController *windowCtrl)
+{
+    m_windowCtrl = windowCtrl;
+}
+
+void
+CicoSCServer::setInputCtrl(CicoSCInputController *inputCtrl)
+{
+    m_inputCtrl= inputCtrl;
+}
+
+void
+CicoSCServer::setUserMgr(CicoSCUserManager *userMgr)
+{
+    m_userMgr = userMgr;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   startup server
+ *
+ *  @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)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCServer::setResourceMgr(CicoSCResourceManager *resourceMgr)
+{
+    m_resourceMgr = resourceMgr;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   startup server
+ *
+ *  @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)
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCServer::startup(int port, const char *protocol)
+{
+    /* create uir string ":PORT" */
+    stringstream uri;
+    uri << ":" << port;
+
+    /* create context */
+    ICO_DBG("ico_uws_create_context(%s,%s) called.",
+            uri.str().c_str(), protocol);
+    m_uwsContext = ico_uws_create_context(uri.str().c_str(), protocol);
+    if (NULL == m_uwsContext) {
+        ICO_ERR("ico_uws_create_context() failed.");
+        return ICO_SYC_ENOSYS;
+    }
+    ico_uws_service(m_uwsContext);
+
+    /* set callback */
+    int ret = ico_uws_set_event_cb(m_uwsContext, uwsCallback, (void *)this);
+    if (ret != ICO_UWS_ERR_NONE) {
+        ICO_ERR("ico_uws_set_event_cb() failed(%d).", ret);
+        return ICO_SYC_ENOSYS;
+    }
+    ico_uws_service(m_uwsContext);
+
+    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;
+}
+
+void
+CicoSCServer::addPollFd(CicoSCUwsHandle *handle)
+{
+    ICO_DBG("CicoSCServer::addPollFd Enter(fd=%d)", handle->fd);
+    Ecore_Fd_Handler_Flags flags = (Ecore_Fd_Handler_Flags)(ECORE_FD_READ | ECORE_FD_ERROR);
+
+    handle->ecoreFdHandler = ecore_main_fd_handler_add(handle->fd, flags,
+                                                       ecoreFdCallback,
+                                                       this, NULL, NULL);
+    ICO_DBG("CicoSCServer::addPollFd Leave");
+}
+
+void
+CicoSCServer::delPollFd(CicoSCUwsHandle *handle)
+{
+    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
+
+    CicoSCUwsHandle *handle = NULL;
+    handle =  static_cast<CicoSCServer*>(data)->findUwsHandler(handler);
+    if (NULL != handle) {
+        static_cast<CicoSCServer*>(data)->dispatch(handle, fdFlags);
+    }
+
+    ICO_DBG("CicoSCServer::ecoreFdCallback Leave");
+    return ECORE_CALLBACK_RENEW;
+}
+
+void
+CicoSCServer::dispatch(const CicoSCUwsHandle *handle, int flags)
+{
+    ICO_DBG("CicoSCServer::dispatch Enter");
+
+    if (NULL == handle) {
+        ICO_WRN("handle is null");
+        ICO_DBG("CicoSCServer::dispatch Leave");
+        return;
+    }
+    handle->dump(); //TODO
+
+    ico_uws_service(handle->uwsContext);
+
+    list<CicoSCCommand*>::iterator itr;
+    itr = m_recvCmdQueue.begin();
+    while(itr != m_recvCmdQueue.end()) {
+        ICO_DBG("Deque 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");
+            m_windowCtrl->handleCommand(cmd);
+            break;
+        case 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");
+            m_userMgr->handleCommand(cmd);
+            break;
+        case MSG_CMD_TYPE_RESOURCEMGR:
+            ICO_DBG("command : MSG_CMD_TYPE_RESOURCEMGR");
+            m_resourceMgr->handleCommand(*cmd);
+            break;
+        default:
+            ICO_DBG("command : unknown");
+            break;
+        }
+        delete cmd;
+    }
+
+    if (NULL == handle->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);
+    if (EINA_TRUE == flag) {
+        ICO_DBG("start send message");
+        list<CicoSCMessage*>::iterator send_itr;
+        send_itr = m_sendMsgQueue.begin();
+        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) {
+                ++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,
+                             (unsigned char *)msg->getData(),
+                             strlen(msg->getData()));
+
+                delete msg;
+
+                usleep(200);
+            }
+        }
+        ecore_main_fd_handler_active_set(handle->ecoreFdHandler,
+            (Ecore_Fd_Handler_Flags)(ECORE_FD_READ | ECORE_FD_ERROR));
+    }
+
+    ICO_DBG("CicoSCServer::dispatch Leave");
+}
+
+int
+CicoSCServer::sendMessage(const string & appid, CicoSCMessage* msg)
+{
+    ICO_DBG("CicoSCServer::sendMessage Enter(appid=%s, msg=%s)",
+            appid.c_str(), msg->getData());
+
+    msg->setSendToAppid(appid);
+    ICO_DBG("Enque 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);
+    }
+
+    ICO_DBG("CicoSCServer::sendMessage Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+int
+CicoSCServer::sendMessageToHomeScreen(CicoSCMessage* msg)
+{
+    const CicoSCUser *loginUser = m_userMgr->getLoginUser();
+    if (NULL == loginUser) {
+        ICO_WRN("homescree unknow");
+        return ICO_SYC_ENOENT;
+    }
+    return sendMessage(loginUser->homescreen, msg);
+}
+
+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)
+{
+    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;
+    }
+
+    switch (event) {
+    case ICO_UWS_EVT_OPEN:
+    {
+        ICO_DBG(">>>RECV ICO_UWS_EVT_OPEN(id=%08x)", (int)id); 
+        break;
+    }
+    case ICO_UWS_EVT_CLOSE:
+        ICO_DBG(">>>RECV ICO_UWS_EVT_CLOSE(id=%08x)", (int)id);
+        m_uwsContext = NULL;
+        break;
+    case ICO_UWS_EVT_RECEIVE:
+       {
+        ICO_DBG(">>>RECV ICO_UWS_EVT_RECEIVE(id=%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);
+
+        // update handle 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));
+
+            break;
+        }
+        
+        // Enqueue command
+        ICO_DBG("Enque 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)", 
+                (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)",
+                    (int)id, detail->_ico_uws_fd.fd);
+        handle->fd = detail->_ico_uws_fd.fd;
+        addPollFd(handle);
+
+        break;
+    case ICO_UWS_EVT_DEL_FD:
+        ICO_DBG(">>>RECV ICO_UWS_EVT_DEL_FD(id=%d, fd=%d)",
+                    (int)id, detail->_ico_uws_fd.fd);
+        delPollFd(handle);
+               delete handle;
+        break;
+    default:
+        break;
+    }
+    ICO_DBG("CicoSCServer::uwsCallbackImpl Leave");
+}
+
+/*--------------------------------------------------------------------------*/
+/*
+ * @brief   callback_uws
+ *          callback function from UWS
+ *
+ * @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
+ */
+/*--------------------------------------------------------------------------*/
+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)
+{
+    ICO_DBG("callback_uws: context=%08x id=%08x", (int)context, (int)id);
+
+       CicoSCServer* server = static_cast<CicoSCServer*>(user_data);
+    server->uwsCallbackImpl(context, event, id, detail, user_data);
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCServer.h b/lib/system-controller/CicoSCServer.h
new file mode 100644 (file)
index 0000000..cbbe2ca
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * 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   CicoSCServer.h
+ *
+ *  @brief 
+ */
+//==========================================================================
+#ifndef __CICO_SC_SERVER_H__
+#define __CICO_SC_SERVER_H__
+
+#include <list>
+using namespace std;
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <string.h>
+#include <math.h>
+#include <stdbool.h>
+#include <sys/epoll.h>
+
+#include <getopt.h>
+
+#include <Ecore.h>
+#include <Eina.h>
+
+#include <ico_uws.h>
+
+//==========================================================================
+//  forward declaration
+//==========================================================================
+class CicoSCUwsHandle;
+class CicoSCMessage;
+class CicoSCCommand;
+class CicoSCWindowController;
+class CicoSCInputController;
+class CicoSCUserManager;
+class CicoSCResourceManager;
+
+//==========================================================================
+/**
+ *  @brief  communication server
+ */
+//==========================================================================
+class CicoSCServer
+{
+public:
+    static CicoSCServer* getInstance();
+
+    void setWindowCtrl(CicoSCWindowController* windowCtrl);
+    void setInputCtrl(CicoSCInputController* inputCtrl);
+    void setUserMgr(CicoSCUserManager* userMgr);
+    void setResourceMgr(CicoSCResourceManager* resourceMgr);
+
+       int startup(int port, const char *protocol);
+
+    void addPollFd(CicoSCUwsHandle *handle);
+    void delPollFd(CicoSCUwsHandle *handle);
+    void dispatch(const CicoSCUwsHandle *handle, int flags);
+    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);
+
+
+private:
+    CicoSCServer();
+    ~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);
+
+    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);
+private:
+    static CicoSCServer* ms_myInstance;
+
+    struct ico_uws_context *m_uwsContext; // TODO init
+
+    CicoSCWindowController *m_windowCtrl;
+    CicoSCInputController  *m_inputCtrl;
+    CicoSCUserManager      *m_userMgr;
+    CicoSCResourceManager  *m_resourceMgr;
+
+    list<CicoSCUwsHandle*> m_uwsHandlerList;
+    list<CicoSCMessage*>   m_sendMsgQueue;
+    list<CicoSCCommand*>   m_recvCmdQueue;
+};
+#endif  // __CICO_SC_SERVER_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCSwitch.cpp b/lib/system-controller/CicoSCSwitch.cpp
new file mode 100644 (file)
index 0000000..f9c8888
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * 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   CicoSCSwitch.cpp
+ *
+ *  @brief  
+ */
+//==========================================================================
+
+#include "CicoSCSwitch.h"
+#include "CicoLog.h"
+
+// default constructor
+CicoSCSwitch::CicoSCSwitch()
+    : swname(""), input(-1), fix(false)
+{
+}
+
+// destructor
+CicoSCSwitch::~CicoSCSwitch()
+{
+}
+
+// dump log CicoSCSwitch member variables
+void
+CicoSCSwitch::dump(void)
+{
+    ICO_DBG("CicoSCSwitch: swname=%s input=%d fix=%d numCode=%d",
+            swname.c_str(), input, fix);
+    for (unsigned int i = 0; i < code.size(); ++i) {
+        ICO_DBG("CicoSCSwitch: [%d] code=%d codename=%s",
+                i, code[i], codename[i].c_str());
+    }
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCSwitch.h b/lib/system-controller/CicoSCSwitch.h
new file mode 100644 (file)
index 0000000..d0c9221
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * 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   CicoSCSwitch.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+#ifndef __CICO_SC_SWITCH_H__
+#define __CICO_SC_SWITCH_H__
+
+#include <vector>
+#include <string>
+using namespace std;
+
+//==========================================================================
+/**
+ *  @brief  input device switch information
+ */
+//==========================================================================
+class CicoSCSwitch
+{
+public:
+    // default constructor
+    CicoSCSwitch();
+
+    // destructor
+    virtual ~CicoSCSwitch();
+
+    // dump log CicoSCSwitch member variables
+    void dump(void);
+
+private:
+    // assignment operator
+    CicoSCSwitch& operator=(const CicoSCSwitch &object);
+
+    // copy constructor
+    CicoSCSwitch(const CicoSCSwitch &object);
+
+public:
+    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
+};
+#endif // __CICO_SC_SWITCH_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCSysResourceController.cpp b/lib/system-controller/CicoSCSysResourceController.cpp
new file mode 100644 (file)
index 0000000..a7f6dce
--- /dev/null
@@ -0,0 +1,669 @@
+/*
+ * 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
+ *
+ */
+#include <memory>
+#include <iostream>
+#include <fstream>
+#include <cstdlib>
+#include <cstdio>
+
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "CicoLog.h"
+#include "CicoEvent.h"
+#include "CicoEventInfo.h"
+#include "CicoStateCore.h"
+#include "CicoState.h"
+#include "CicoHistoryState.h"
+#include "CicoFinalState.h"
+#include "CicoStateMachine.h"
+#include "CicoStateMachineCreator.h"
+#include "CicoSCSysResourceMonitor.h"
+#include "CicoSCLifeCycleController.h"
+#include "CicoSCSysResourceController.h"
+#include "CicoSCConf.h"
+#include "CicoSCSystemConfig.h"
+#include <Ecore.h>
+//#include <Ecore_Evas.h>
+
+const int gEV1000 = 1000; // CPU event
+const int gEV1001 = 1001; // MEMORY event
+
+const string gstrSRCCPU_LOW  = "SRCCPU_LOW";
+const string gstrSRCCPU_HIGH = "SRCCPU_HIGH";
+const string gstrSRCMEM_LOW  = "SRCMEM_LOW";
+const string gstrSRCMEM_HIGH = "SRCMEM_HIGH";
+
+static const string gstrStateMachineFileName = "CicoSCSysResourceSM.json";
+
+bool g_RC_LOG = false;
+int  g_samplingWaitTimer = 200;
+
+Ecore_Timer* g_SCResourceWatch = 0;
+static Eina_Bool ico_SCResourceWatch(void *data)
+{
+    if (g_RC_LOG) ICO_TRA("start data(%x)", data);
+    if ((NULL == data) || (0 == data)) {
+        if (g_RC_LOG) ICO_TRA("end");
+        return ECORE_CALLBACK_RENEW;
+    }
+    CicoSCSysResourceController* oCSCSRC = (CicoSCSysResourceController*)data;
+    oCSCSRC->watch();
+//    double tVal = (double)g_samplingWaitTimer / 100;
+//    ecore_timer_add(g_samplingWaitTimer, ico_SCResourceWatch, data);
+    if (g_RC_LOG) ICO_TRA("end");
+    return ECORE_CALLBACK_RENEW;
+}
+
+
+/**
+ * @brief constractor
+ */
+CicoSCSysResourceController::CicoSCSysResourceController()
+{
+    ICO_TRA("start");
+    m_cgrpCPU = 0;
+    m_cgrpMEM = 0;
+    m_cpu = -1;
+    m_mem = -1;
+    m_rConf = CicoSCSystemConfig::getInstance()->getResourceConf();
+    if (0 != m_rConf) {
+        g_RC_LOG = m_rConf->m_bLog;
+        if (-1 != m_rConf->m_sampling) {
+            g_samplingWaitTimer = m_rConf->m_sampling;
+        }
+    }
+    // cpu,cpuacct cgroup init
+    init_cgroup();  // cgroup 
+    m_monitor = new CicoSCSysResourceMonitor();
+    CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
+    string filePath(CSCSC->getDefaultConf()->confdir);
+    filePath += string("/");
+    filePath += gstrStateMachineFileName;
+
+    CicoStateMachineCreator csmc;
+    m_stt = csmc.createFile(filePath);
+    if ((CicoStateMachine*)0 == m_stt) {
+        ICO_ERR("state machine create error(%s)", filePath.c_str());
+        return;
+    }
+
+    m_SRCCPU_LOW  = new CicoSRCCPU_LOW(this);
+    m_SRCCPU_HIGH = new CicoSRCCPU_HIGH(this);
+    m_SRCMEM_LOW  = new CicoSRCMEM_LOW(this);
+    m_SRCMEM_HIGH = new CicoSRCMEM_HIGH(this);
+
+    CicoState* s = (CicoState*)m_stt->getState(gstrSRCCPU_LOW);
+    if ((CicoState*)0 != s) {
+        s->addEntryAction(m_SRCCPU_LOW);
+        s->addDoAction(m_SRCCPU_LOW);
+    }
+    s = (CicoState*)m_stt->getState(gstrSRCCPU_HIGH);
+    if ((CicoState*)0 != s) {
+        s->addEntryAction(m_SRCCPU_HIGH);
+        s->addDoAction(m_SRCCPU_HIGH);
+    }
+    s = (CicoState*)m_stt->getState(gstrSRCMEM_LOW);
+    if ((CicoState*)0 != s) {
+        s->addEntryAction(m_SRCMEM_LOW);
+        s->addDoAction(m_SRCMEM_LOW);
+    }
+    s = (CicoState*)m_stt->getState(gstrSRCMEM_HIGH);
+    if ((CicoState*)0 != s) {
+        s->addEntryAction(m_SRCMEM_HIGH);
+        s->addDoAction(m_SRCMEM_HIGH);
+    }
+    m_stt->start();
+    double tVal = (double)g_samplingWaitTimer / 100;
+#if 1
+    ICO_TRA("ECORE_TIMER(%f)", tVal);
+    g_SCResourceWatch = ecore_timer_add(tVal, ico_SCResourceWatch, this);
+#else
+    ICO_TRA("ECORE_TIMER(%f)", tVal);
+    g_SCResourceWatch = ecore_timer_add(tVal, ico_SCResourceWatch, 0);
+#endif
+    ICO_TRA("end");
+}
+
+/**
+ * @brief destructor
+ */
+CicoSCSysResourceController::~CicoSCSysResourceController()
+{
+    ICO_TRA("start");
+    if (0 != g_SCResourceWatch) {
+        ecore_timer_del(g_SCResourceWatch);
+    }
+
+    if ((CicoStateMachine*)0 != m_stt) {
+        m_stt->stop();
+        delete m_stt;
+        m_stt = (CicoStateMachine*)0;
+        ICO_TRA("delete CicoStateMachine");
+    }
+
+    if ((CicoSRCCPU_LOW*)0 != m_SRCCPU_LOW) {
+        delete m_SRCCPU_LOW;
+        m_SRCCPU_LOW = (CicoSRCCPU_LOW*)0;
+        ICO_TRA("delete CicoSRCCPU_LOW");
+    }
+
+    if ((CicoSRCCPU_HIGH*)0 != m_SRCCPU_HIGH) {
+        delete m_SRCCPU_HIGH;
+        m_SRCCPU_HIGH = (CicoSRCCPU_HIGH*)0;
+        ICO_TRA("delete CicoSRCCPU_HIGH");
+    }
+
+    if ((CicoSRCMEM_LOW*)0 != m_SRCMEM_LOW) {
+        delete m_SRCMEM_LOW;
+        m_SRCMEM_LOW = (CicoSRCMEM_LOW*)0;
+        ICO_TRA("delete CicoSRCMEM_LOW");
+    }
+
+    if ((CicoSRCMEM_HIGH*)0 != m_SRCMEM_HIGH) {
+        delete m_SRCMEM_HIGH;
+        m_SRCMEM_HIGH = (CicoSRCMEM_HIGH*)0;
+        ICO_TRA("delete CicoSRCMEM_HIGH");
+    }
+
+    if ((CicoSCSysResourceMonitor*)0 != m_monitor) {
+        delete m_monitor;
+        m_monitor = (CicoSCSysResourceMonitor*)0;
+        ICO_TRA("delete CicoSCSysResourceMonitor");
+    }
+    ICO_TRA("end");
+}
+
+/**
+ * @brief watch
+ * @return true:change level false:no change
+ */
+bool CicoSCSysResourceController::watch()
+{
+    if (g_RC_LOG) ICO_TRA("start");
+    if ((CicoSCSysResourceMonitor*)0 == m_monitor) {
+        if (g_RC_LOG) ICO_TRA("end false");
+        return false;
+    }
+    bool r = false;
+    m_monitor->monitoring();
+    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);
+        m_cpu = cpu;
+        r = true;
+    }
+    int mem = m_monitor->getUsageFreeMem(); // free memory
+    if (-1 != mem) {
+        mem = (10000 - mem)/100;  // free->used memory calc
+        CicoEvent ev(gEV1001, mem);
+        m_stt->eventEntry(ev);
+        m_mem = mem;
+        r = true;
+    }
+    if (g_RC_LOG) ICO_TRA("end %s", r? "true": "false");
+    return r;
+}
+
+/**
+ * @brief CPU share control request
+ * @param pulus true:level up / false level down
+ */
+void CicoSCSysResourceController::resourceControlCPUShares(bool bHight)
+{
+    ICO_TRA("start %s",
+            bHight? "true": "false");
+    if ((NULL == m_rConf) || (false == m_rConf->m_bDoIt)) {
+        ICO_TRA("end");
+        return;
+    }
+    if (true == m_rConf->m_cpuCtrl.empty()) {
+        ICO_TRA("end");
+        return;
+    }
+    int newCgrpCPU = -1;
+    int sz = m_rConf->m_cpuCtrl.size();
+    for (int i = 0; i < sz; i++) {
+        if (true == m_RCCpuShares[i].empty()) { // write target none
+            continue; // next target
+        }
+        int sharesVal = -1; // initialize cpu.shares value
+        if (true == bHight) {
+            if (m_cgrpCPU < (int)m_rConf->m_cpuCtrl[i]->m_hight.size()) {
+                sharesVal = m_rConf->m_cpuCtrl[i]->m_hight[m_cgrpCPU];
+                newCgrpCPU = m_cgrpCPU + 1;
+                ICO_DBG("m_hight[%d]=%d", m_cgrpCPU, sharesVal);
+            }
+        }
+        else {
+            if (0 != m_cgrpCPU) {
+                int tmp = m_cgrpCPU - 1;
+                if (tmp < (int)m_rConf->m_cpuCtrl[i]->m_low.size()) {
+                    sharesVal = m_rConf->m_cpuCtrl[i]->m_low[tmp];
+                    newCgrpCPU = tmp;
+                    ICO_DBG("m_low[%d]=%d", tmp, sharesVal);
+                }
+            }
+        }
+        if (0 <= sharesVal) {
+            replaceCgroupFile(m_RCCpuShares[i], sharesVal);
+        }
+//        else if (-9 == sharesVal) {
+//        }
+    }
+    if (-1 != newCgrpCPU) { // control level value check
+        ICO_DBG("control level %d -> %d", m_cgrpCPU, newCgrpCPU);
+        m_cgrpCPU = newCgrpCPU; // set next control level
+    }
+    ICO_TRA("end");
+}
+
+bool CicoSCSysResourceController::replaceCgroupFile(const std::string& tgt,
+                                                    int val)
+{
+    char sv[64];
+    sprintf(sv, "%d", val);
+    return replaceCgroupFile(tgt, sv);
+}
+
+bool CicoSCSysResourceController::replaceCgroupFile(const std::string& tgt,
+                                                    const char* val)
+{
+    ICO_TRA("start");
+    if (true == tgt.empty()) {
+        ICO_TRA("end");
+        return false;
+    }
+    FILE *fp = fopen(tgt.c_str(), "wt");
+    if (0 == fp) {
+        ICO_TRA("end open error %s", tgt.c_str());
+        return false;
+    }
+    fprintf(fp, val);
+    fclose(fp);
+    ICO_TRA("end Cmd(echo %s > %s", val, tgt.c_str());
+    return true;
+}
+
+/**
+ * @brief memory limit control request
+ * @param pulus true:level up / false level down
+ */
+void CicoSCSysResourceController::resourceControlMemLimit(bool bHight)
+{
+    ICO_TRA("start");
+    if ((NULL == m_rConf) || (false == m_rConf->m_bDoIt)) {
+        ICO_TRA("end");
+        return;
+    }
+    // TODO mk_k coming soon
+    if (true == bHight) {
+        // coming soon
+        ICO_TRA("hight (true)");
+    }
+    else {
+        // coming soon
+        ICO_TRA("low (false)");
+    }
+//    m_cgrpMEM++;
+    ICO_TRA("end");
+}
+
+
+
+/**
+ * @breif
+ *
+ */
+bool CicoSCSysResourceController::entryCgroupCPU(int pid, int grpNo)
+{
+    ICO_TRA("start pid(%d), cgrpNo(%d)", pid, grpNo);
+    if ((0 > grpNo) || ((int)m_RCCpuTasks.size() <= grpNo)) {
+        ICO_TRA("end %d", m_RCCpuTasks.size());
+        return false;
+    }
+#if 1
+    struct stat statbuf;
+    char procdir[128];
+    sprintf(procdir, "/proc/%d/task", pid);
+    if (0 != stat(procdir, &statbuf)) {
+        ICO_TRA("end %s ng dir", procdir);
+        return false;
+    }
+    DIR *dp;
+    dp = opendir(procdir);
+    if(dp == NULL) {
+        ICO_TRA("end opendir error");
+        return false;
+    }
+    struct dirent *ent;
+    while((ent = readdir(dp)) != NULL){
+        if (0 != isdigit(ent->d_name[0])) {
+            ICO_DBG("echo %s > %s", ent->d_name, m_RCCpuTasks[grpNo].c_str());
+            replaceCgroupFile(m_RCCpuTasks[grpNo], ent->d_name);
+        }
+    }
+    closedir(dp);
+    ICO_TRA("end");
+    return true;
+#else
+    return replaceCgroupFile(m_RCCpuTasks[grpNo], pid);
+#endif
+}
+
+/**
+ * @breif initialize cgroup 
+ */
+void CicoSCSysResourceController::init_cgroup()
+{
+    ICO_TRA("start");
+    init_cgroup_cpu();
+    // memory cgroup directory get
+    init_cgroup_memory();
+    ICO_TRA("end");
+}
+
+/**
+ * @breif initialize cgroup cpu
+ */
+void CicoSCSysResourceController::init_cgroup_cpu()
+{
+    ICO_TRA("start");
+    if (NULL == m_rConf) {
+        ICO_TRA("end");
+        return;
+    }
+    string ss("/");
+    string sTasks("tasks");
+    string sShares("cpu.shares");
+    string t1(m_rConf->m_cpuCGRPPath);
+    if ('/' != t1[t1.size()-1]) {
+        t1 += ss;
+    }
+    vector<string> d;
+    d.push_back(m_rConf->m_cpuCGRPPath);
+    int sz = m_rConf->m_cpuCtrl.size();
+    for (int i = 0; i < sz; i++) {
+        CicoSCCpuResourceGrp* obj = m_rConf->m_cpuCtrl[i];
+        string t2;
+        if (0 != obj) {
+            t2 = t1;
+            t2 += obj->m_grpNm;
+        }
+        else {
+            t2.clear();
+        }
+        d.push_back(t2);
+        string t3(t2);
+        string t4(t2);
+        if (false == t2.empty()) {
+            if ('/' != t2[t2.size()-1]) {
+                t3 += ss;
+                t4 += ss;
+            }
+            t3 += sTasks;
+            t4 += sShares;
+        }
+        m_RCCpuTasks.push_back(t3);
+        m_RCCpuShares.push_back(t4);
+    }
+    make_directorys(d);
+    ICO_TRA("end");
+    return;
+}
+
+/**
+ * @breif initialize cgroup memory
+ */
+void CicoSCSysResourceController::init_cgroup_memory()
+{
+    ICO_TRA("start");
+    if (NULL == m_rConf) {
+        ICO_TRA("end error config class");
+        return;
+    }
+    // Coming Soon
+    ICO_TRA("end");
+    return;
+}
+
+/**
+ * @breif make directory
+ * @param d create directory target
+ */
+void CicoSCSysResourceController::make_directorys(std::vector<std::string> dir)
+{
+    ICO_TRA("start");
+    int sz = dir.size();
+    for (int i = 0; i < sz; i++) {
+        if (true == dir[i].empty()) {
+            continue;
+        }
+        const char* dpath = dir[i].c_str();
+        struct stat stat_buf;
+        if (0 != stat(dpath, &stat_buf)) {
+            // drwxr-xr-x
+            int r = mkdir(dpath, S_IRUSR| S_IWUSR| S_IXUSR| S_IRGRP|
+                          S_IXGRP| S_IROTH| S_IXOTH);
+            ICO_DBG("%s create status(%d)", dpath, r);
+        }
+    }
+    ICO_TRA("end");
+}
+
+/**
+ * @brief Class ico System Resource Controller CPU LOW level
+ *        constructor
+ */
+CicoSRCCPU_LOW::CicoSRCCPU_LOW(CicoSCSysResourceController* obj):
+    m_cntlr(obj)
+{
+    ICO_TRA("constructor");
+    m_val = -1;      // cpu or memory usage value
+    m_baseVal = -1;  // cpu or memory base usage value
+}
+
+/**
+ * @brief Class ico System Resource Controller CPU LOW level
+ *        destructor
+ */
+CicoSRCCPU_LOW::~CicoSRCCPU_LOW()
+{
+    ICO_TRA("destructor");
+    m_cntlr = NULL;
+}
+
+/**
+ * @brief resource control entry state
+ * @param ev event data
+ * @param stt state object
+ */
+void CicoSRCCPU_LOW::onEnttry(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();
+    m_val = m_baseVal;
+}
+
+/**
+ * @brief cpu usage low resource control
+ * @param ev event data
+ * @param stt state object
+ */
+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) {
+        // When the value is greater than the previous
+        ICO_TRA("end n(%d) >= o(%d)", 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);
+        m_baseVal = valN;
+    }
+    m_val = valN;
+    ICO_TRA("end");
+}
+
+
+/**
+ * @brief resource control exit state
+ * @param ev event data
+ * @param stt state object
+ */
+void CicoSRCCPU_LOW::onExit(const CicoEvent&, const CicoState*, int)
+{
+    ICO_TRA("start");
+    m_baseVal = -1;
+    m_val = -1;
+    ICO_TRA("end");
+}
+
+/**
+ * @brief Class ico System Resource Controller CPU HIGH level
+ *        constructor
+ */
+CicoSRCCPU_HIGH::CicoSRCCPU_HIGH(CicoSCSysResourceController* obj):
+        CicoSRCCPU_LOW(obj)
+{
+    ICO_TRA("constructor");
+}
+
+/**
+ * @brief Class ico System Resource Controller CPU HIGH level
+ *        destructor
+ */
+CicoSRCCPU_HIGH::~CicoSRCCPU_HIGH()
+{
+    ICO_TRA("destructor");
+}
+
+/**
+ * @brief cpu usage high resource control
+ * @param ev event data
+ * @param stt state object
+ */
+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 (valN <= m_val) {
+        // When the value is less than the previous
+        ICO_TRA("end n(%d)<=o(%d)", 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);
+        m_baseVal = valN;
+    }
+    m_val = valN;
+    ICO_TRA("end");
+}
+
+/**
+ * @brief Class ico System Resource Controller MEMory LOW level
+ *        constructor
+ */
+CicoSRCMEM_LOW::CicoSRCMEM_LOW(CicoSCSysResourceController* obj):
+        CicoSRCCPU_LOW(obj)
+{
+    ICO_TRA("constructor");
+}
+
+/**
+ * @brief Class ico System Resource Controller MEMory LOW level
+ *        constructor
+ */
+CicoSRCMEM_LOW::~CicoSRCMEM_LOW()
+{
+    ICO_TRA("destructor");
+}
+
+/**
+ * @brief memory usage low resource control
+ * @param ev event data
+ * @param stt state object
+ */
+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 (valN >= m_val) {
+        // When the value is greater than the previous
+        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);
+        m_baseVal = valN;
+    }
+    m_val = valN;
+    ICO_TRA("end");
+
+}
+
+/**
+ * @brief Class ico System Resource Controller MEMory HIGH level
+ *        constructor
+ */
+CicoSRCMEM_HIGH::CicoSRCMEM_HIGH(CicoSCSysResourceController* obj):
+    CicoSRCCPU_LOW(obj)
+{
+    ICO_TRA("constructor");
+}
+
+/**
+ * @brief Class ico System Resource Controller MEMory HIGH level
+ *        destructor
+ */
+CicoSRCMEM_HIGH::~CicoSRCMEM_HIGH()
+{
+    ICO_TRA("destructor");
+}
+
+/**
+ * @brief memory usage high resource control
+ * @param ev event data
+ * @param stt state object
+ */
+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 (valN <= m_val) {
+        // When the value is less than the previous
+        ICO_TRA("end");
+        return;
+    }
+    // When the value is greater than the previous
+    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);
+        m_baseVal = valN;
+    }
+    m_val = valN;
+    ICO_TRA("end");
+}
diff --git a/lib/system-controller/CicoSCSysResourceController.h b/lib/system-controller/CicoSCSysResourceController.h
new file mode 100644 (file)
index 0000000..c4587a9
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * 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   CicoSCSysResourceController
+ *          SystemController resource watcher
+ *          CPU/FreeMemory monitoring
+ *
+ * @date    Aug-05-2013 create start
+ */
+
+#ifndef CICOSCSYSRESOURCECONTROLLER_H
+#define CICOSCSYSRESOURCECONTROLLER_H
+#include <cstddef>
+
+#include "CicoStateAction.h"
+
+#ifndef CICOSTATEMACHINE_H
+class CicoStateMachine;
+#endif
+
+#ifndef CICOSCSYSRESOURCEMONITOR_H
+class CicoSCSysResourceMonitor;
+#endif
+
+#ifndef __CICO_SC_CONF_H__
+class CicoSCResourceConf;
+#endif
+
+class CicoSCSysResourceController;
+
+/**
+ * @brief Class ico System Resource Controller CPU LOW level
+ */
+class CicoSRCCPU_LOW : public CicoStateAction
+{
+public: // member method
+    CicoSRCCPU_LOW(CicoSCSysResourceController* obj);
+    virtual ~CicoSRCCPU_LOW();
+
+    virtual void onEnttry(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
+    CicoSCSysResourceController* m_cntlr;
+};
+
+/**
+ * @brief Class ico System Resource Controller CPU HIGH level
+ */
+class CicoSRCCPU_HIGH : public CicoSRCCPU_LOW
+{
+public: // member method
+    CicoSRCCPU_HIGH(CicoSCSysResourceController* obj);
+    virtual ~CicoSRCCPU_HIGH();
+    void onDo(const CicoEvent& ev, const CicoState* stt, int addval);
+
+protected: // member Variable
+};
+
+/**
+ * @brief Class ico System Resource Controller MEMory LOW level
+ */
+class CicoSRCMEM_LOW : public CicoSRCCPU_LOW
+{
+public: // member method
+    CicoSRCMEM_LOW(CicoSCSysResourceController* obj);
+    virtual ~CicoSRCMEM_LOW();
+    void onDo(const CicoEvent& ev, const CicoState* stt, int addval);
+protected: // member Variable
+};
+
+/**
+ * @brief Class ico System Resource Controller MEMory HIGH level
+ */
+class CicoSRCMEM_HIGH : public CicoSRCCPU_LOW
+{
+public: // member method
+    CicoSRCMEM_HIGH(CicoSCSysResourceController* obj);
+    virtual ~CicoSRCMEM_HIGH();
+    void onDo(const CicoEvent& ev, const CicoState* stt, int addval);
+protected: // member Variable
+};
+
+/**
+ * @brief System Controller System Resource Controller class
+ */
+class CicoSCSysResourceController
+{
+public:
+    CicoSCSysResourceController();
+    ~CicoSCSysResourceController();
+
+    bool isWactchAllReady() const;
+
+    bool watch();   // watch request (please interval call)
+    const CicoSCSysResourceMonitor& getMonitor() const;
+    int getCpuUsge() const;
+    int getMemoryUsge() const;
+
+    void resourceControlCPUShares(bool bHight);
+    void resourceControlMemLimit(bool bHight);
+    bool entryCgroupCPU(int pid, int grpNo);
+protected:
+    void init_cgroup();
+    void init_cgroup_cpu();
+    void init_cgroup_memory();
+    void make_directorys(std::vector<std::string> dir);
+    bool replaceCgroupFile(const std::string& tgt, int val);
+    bool replaceCgroupFile(const std::string& tgt, const char* val);
+
+private:
+    CicoSCSysResourceMonitor* m_monitor;
+    const CicoSCResourceConf* m_rConf;
+    CicoStateMachine* m_stt;
+
+    CicoSRCCPU_LOW* m_SRCCPU_LOW;
+    CicoSRCCPU_HIGH* m_SRCCPU_HIGH;
+    CicoSRCMEM_LOW* m_SRCMEM_LOW;
+    CicoSRCMEM_HIGH* m_SRCMEM_HIGH;
+
+    int m_cpu;
+    int m_mem;
+    std::vector<std::string> m_RCCpuTasks;
+    std::vector<std::string> m_RCCpuShares;
+    int m_cgrpCPU;
+    int m_cgrpMEM;
+
+};
+
+/**
+ * @brief
+ * @return
+ */
+inline
+bool CicoSCSysResourceController::isWactchAllReady() const
+{
+    if ((-1 != m_cpu) && (-1 != m_mem)) {
+        return true;
+    }
+    return false;
+}
+
+/**
+ * @brief get monitor class
+ * return monitor class
+ */
+inline const CicoSCSysResourceMonitor&
+    CicoSCSysResourceController::getMonitor() const
+{
+    return *m_monitor;
+}
+
+/**
+ * @brief get CPU usage
+ * @return CPU usage
+ */
+inline int CicoSCSysResourceController::getCpuUsge() const
+{
+    return m_cpu;
+}
+
+/**
+ * @brief get CPU usage
+ * @return CPU usage
+ */
+inline int CicoSCSysResourceController::getMemoryUsge() const
+{
+    return m_mem;
+}
+
+#endif // CICOSCSYSRESOURCECONTROLLER_H
diff --git a/lib/system-controller/CicoSCSysResourceMonitor.cpp b/lib/system-controller/CicoSCSysResourceMonitor.cpp
new file mode 100644 (file)
index 0000000..dac9148
--- /dev/null
@@ -0,0 +1,380 @@
+/*
+ * 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
+ *
+ */
+
+#include <iostream>
+#include <string>
+#include <fstream>
+#include <memory>
+#include <cstdlib>
+#include <cstring>
+#include "CicoLog.h"
+#include "CicoSCSysResourceMonitor.h"
+using namespace std;
+extern bool g_RC_LOG;
+
+const char* rdTgtCPU = "/proc/stat";
+const char sP1C = 'c';
+const char sP2P = 'p';
+const char sP3U = 'u';
+const int nDmyCpuCnt = 17;   // CPU(16) + Total(1)
+
+const double dCarryUp = 10000;
+
+const char* rdTgtMEM = "/proc/meminfo";
+const string rdMEMTag1 = "MemFree:";
+const string rdMEMTag2 = "MemTotal:";
+
+/**
+ * @brief Constructor
+ */
+CicoSCSysResourceMonitor::CicoSCSysResourceMonitor()
+{
+    ICO_TRA("start constructor");
+    m_CPUcnt = 0;
+    m_old = (stat_data_t*)0;
+    m_current = (stat_data_t*)0;
+    m_calc = (stat_data_t*)0;
+    m_totalMem = 0;
+    m_freeMem = 0;
+    m_usageFreeMem = -1;
+    m_allready = false;
+    ICO_TRA("end constructor");
+}
+
+/**
+ * @brief destructor
+ */
+CicoSCSysResourceMonitor::~CicoSCSysResourceMonitor()
+{
+    ICO_TRA("start destructor");
+    if ((stat_data_t*)0 != m_old) {
+        delete[] m_old;
+        m_old = (stat_data_t*)0;
+    }
+    if ((stat_data_t*)0 != m_current) {
+        delete[] m_current;
+        m_current = (stat_data_t*)0;
+    }
+    if ((stat_data_t*)0 != m_calc) {
+        delete[] m_calc;
+        m_calc = (stat_data_t*)0;
+    }
+    ICO_TRA("end destructor");
+}
+
+/**
+ * @breif 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
+ */
+int CicoSCSysResourceMonitor::getCPUtime(E_USAGETYPE e, int cpu) const
+{
+    if (g_RC_LOG) ICO_TRA("start %d, %d", e, cpu);
+    if (false == isAllReady()) {
+        ICO_TRA("is no ready!");
+        return -1;
+    }
+    int n = cpu + 1;
+    if ((0 > n) || (m_CPUcnt <= n)) {
+        if (g_RC_LOG) ICO_TRA("end cpu count error %d, %d", n, m_CPUcnt);
+        return -1;
+    }
+    int r = -1;
+    switch(e) {
+    case E_user:       // 1) Time spent in user mode.
+        r = m_calc[n].user;
+        break;
+    case E_nice:       // 2) Time spent in user mode with low priority (nice).
+        r = m_calc[n].nice;
+        break;
+    case E_system:     // 3) Time spent in system mode.
+        r = m_calc[n].system;
+        break;
+    case E_idle:       // 4) Time spent in the idle task.
+        r = m_calc[n].idle;
+        break;
+    case E_iowait:     // 5) Time waiting for I/O to complete.
+        r = m_calc[n].iowait;
+        break;
+    case E_irq:        // 6) Time servicing interrupts.
+        r = m_calc[n].irq;
+        break;
+    case E_softirq:    // 7) Time servicing softirqs.
+        r = m_calc[n].softirq;
+        break;
+    case E_steal:      // 8) Time stolen
+        r = m_calc[n].steal;
+        break;
+    case E_guest:      // 9) Time Guest OS
+        r = m_calc[n].guest;
+        break;
+    case E_guest_nice: // 10) Time guest OS(nice)
+        r = m_calc[n].guest_nice;
+        break;
+    default:
+        break;
+    }
+    if (g_RC_LOG) ICO_TRA("end success ret(%d)", r);
+    return r;
+}
+
+/**
+ * @brief monitorring
+ */
+void CicoSCSysResourceMonitor::monitoring()
+{
+    if (g_RC_LOG) ICO_TRA("call getResource");
+    getResource();
+}
+
+/**
+ * @brief getResource
+ *        CPU usage and free memory size get
+ */
+void CicoSCSysResourceMonitor::getResource()
+{
+    if (g_RC_LOG) ICO_TRA("call get resource CPU,MEM");
+    getResourceCPU();
+    getResourceMEM();
+}
+
+/**
+ * @brief getResourceCPU
+ */
+void CicoSCSysResourceMonitor::getResourceCPU()
+{
+    if (0 == m_CPUcnt) {
+        m_CPUcnt = createCurrentCPU();
+        size_t sz = m_CPUcnt + 1;
+        if (0 == m_old) {
+            m_old = new stat_data_t[sz];
+        }
+        if (0 == m_calc) {
+            m_calc = new stat_data_t[sz];
+        }
+        ICO_DBG("cpu count is %d", m_CPUcnt);
+        return;
+    }
+    if (((stat_data_t*)0 == m_old) || ((stat_data_t*)0 == m_current) || 
+        ((stat_data_t*)0 == m_calc)) {
+        ICO_DBG("error none new area");
+        return;
+    }
+    // set old value
+    size_t sz = m_CPUcnt + 1;
+    memcpy(m_old, m_current, sizeof(stat_data_t)*sz);
+    // read current value
+    readCurrentCPU();
+    // calc CPU usage
+    for (size_t i=0; i < sz; i++) {
+        usageCalcCPU(m_old[i], m_current[i], m_calc[i]);
+    }
+    m_allready = true;
+    if (g_RC_LOG) ICO_TRA("calc");
+}
+
+/**
+ * @brief CPU usage first read
+ *        area allocation and read
+ *        CPU core count
+ * @return CPU core count
+ */
+int CicoSCSysResourceMonitor::createCurrentCPU()
+{
+    if (0 != m_current) {
+        ICO_TRA("ret(0) current is zero!");
+        return 0;
+    }
+    int cnt = 0;
+    stat_data_t tmp[nDmyCpuCnt];
+    memset(tmp, 0, sizeof(tmp));
+    cnt = readProcStatCPU(tmp, nDmyCpuCnt-1);
+    if (0 == cnt) {
+        ICO_TRA("ret(0) cnt iz zero!");
+        return 0;
+    }
+    size_t sz = cnt + 1;
+    m_current = new stat_data_t[sz];
+    memcpy(m_current, tmp, sizeof(stat_data_t)*sz);
+    ICO_TRA("ret cpu core count(%d)", cnt);
+    return cnt;
+}
+
+/**
+ * @brief CPU usage read
+ */
+void CicoSCSysResourceMonitor::readCurrentCPU()
+{
+    readProcStatCPU(m_current, m_CPUcnt);
+}
+
+/**
+ * @brief read /proc/stat CPU infomation
+ * @param sdtp destination read value
+ * @param cpucnt CPU core count
+ * @return read CPU count
+ */
+int CicoSCSysResourceMonitor::readProcStatCPU(stat_data_t* sdtp, const int cpucnt)
+{
+    int r = 0;
+    int sztmp = cpucnt;
+    string tag;
+    ifstream ifs(rdTgtCPU);
+    while(ifs >> tag) {
+        int tgt=-1;
+        const char* tags = tag.c_str();
+        if ((sP1C == tags[0]) && (sP2P == tags[1]) && (sP3U == tags[2])) {
+            if ('\0' == tags[3]) { // "cpu"
+                tgt = 0;
+            }
+            else { // "cpuX" X = 0 - 9
+                if (0 != isdigit(tags[3])) {
+                    int tmp_tgt = atoi(&tags[3]);
+                    if ((0 <= tmp_tgt) && (tmp_tgt < cpucnt)) {
+                        tgt = tmp_tgt + 1;
+                    }
+                }
+            }
+        }
+        if (-1 != tgt) {
+            // get now value
+            ifs >> sdtp[tgt].user;
+            ifs >> sdtp[tgt].nice;
+            ifs >> sdtp[tgt].system;
+            ifs >> sdtp[tgt].idle;
+            ifs >> sdtp[tgt].iowait;
+            ifs >> sdtp[tgt].irq;
+            ifs >> sdtp[tgt].softirq;
+            ifs >> sdtp[tgt].steal;
+            ifs >> sdtp[tgt].guest;
+            ifs >> sdtp[tgt].guest_nice;
+            if (0 != tgt) {
+                sztmp--;
+                r++;
+            }
+        }
+        if (0==sztmp) {
+            break;    // break of while
+        }
+    }
+    ifs.close();
+    if (g_RC_LOG) ICO_TRA("ret(%d)", r);
+    return r;
+}
+
+/**
+ * @brief CPU usage calc
+ * @param old previous value
+ * @param current value of this time
+ * @param calc distnation calculated value
+ * @return true:calc success false:calc fail
+ */
+bool CicoSCSysResourceMonitor::usageCalcCPU(const stat_data_t& old,
+                                     const stat_data_t& current,
+                                     stat_data_t& calc)
+{
+    if (g_RC_LOG) ICO_TRA("start");
+    double ttl = 0;
+    double duser = current.user - old.user;
+    ttl += duser;
+    double dnice = current.nice - old.nice;
+    ttl += dnice;
+    double dsystem = current.system - old.system;
+    ttl += dsystem;
+    double didle = current.idle - old.idle;
+    ttl += didle;
+    double diowait = current.iowait - old.iowait;
+    ttl += diowait;
+    double dirq = current.irq - old.irq;
+    ttl += dirq;
+    double dsoftirq = current.softirq - old.softirq;
+    ttl += dsoftirq;
+    double dsteal = current.steal - old.steal;
+    ttl += dsteal;
+    double dguest = current.guest - old.guest;
+    ttl += dguest;
+    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!?");
+        return false;
+    }
+    calc.user = (int)(duser / ttl * dCarryUp);
+    calc.nice = (int)(dnice / ttl * dCarryUp);
+    calc.system = (int)(dsystem / ttl * dCarryUp);
+    calc.idle = (int)(didle / ttl * dCarryUp);
+    calc.iowait = (int)(diowait / ttl * dCarryUp);
+    calc.irq = (int)(dirq / ttl * dCarryUp);
+    calc.softirq = (int)(dsoftirq / ttl * dCarryUp);
+    calc.steal = (int)(dsteal / ttl * dCarryUp);
+    calc.guest = (int)(dguest / ttl * dCarryUp);
+    calc.guest_nice = (int)(dguest_nice / ttl * dCarryUp);
+    if (g_RC_LOG) ICO_TRA("end");
+    return true;
+}
+
+/**
+ * @brief get resource free memory
+ */
+void CicoSCSysResourceMonitor::getResourceMEM()
+{
+    if (g_RC_LOG) ICO_TRA("start");
+    if (0 >= m_totalMem) {
+        readProcMeminfo(true);
+    }
+    else {
+        readProcMeminfo();
+    }
+    if (g_RC_LOG) ICO_TRA("end");
+}
+
+/**
+ * @brief read /proc/meminfo
+ * @param ttlMem total memory read flag
+ */
+void CicoSCSysResourceMonitor::readProcMeminfo(bool ttlMem)
+{
+#if 0
+    if (g_RC_LOG) ICO_TRA("start %s", ttlMem? "true": "false");
+    string tag;
+    ifstream ifs(rdTgtMEM);
+    bool tgt1 = false;
+    bool tgt2 = ttlMem;       // total memory get flag set
+    while(ifs >> tag) {
+        if (true == tgt2) {   // flag on
+            if (rdMEMTag2 == tag) { // is total memory tag?
+                ifs >> m_totalMem; // total memory size get
+                tgt2 = false; // flag off
+            }
+        }
+        if (rdMEMTag1 == tag) { // is free memory tag
+            ifs >> m_freeMem; // get free memory size
+            tgt1 = true;  // get flag on
+        }
+        if ((true == tgt1) && (false == tgt2)) {
+            break;   // break of while
+        }
+    }
+    ifs.close();
+    if (0 != m_totalMem) {
+        if (true == tgt1) {
+            m_usageFreeMem = (int)
+                (((double)m_freeMem / (double)m_totalMem) * 10000);
+        }
+    }
+    else {
+        m_usageFreeMem = -1;
+    }
+    if (g_RC_LOG) ICO_TRA("end usage free mem st.(%d)", m_usageFreeMem);
+#else 
+    m_usageFreeMem = -1;
+    return;
+#endif
+}
diff --git a/lib/system-controller/CicoSCSysResourceMonitor.h b/lib/system-controller/CicoSCSysResourceMonitor.h
new file mode 100644 (file)
index 0000000..2cd1107
--- /dev/null
@@ -0,0 +1,223 @@
+/*
+ * 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   CicoSCSysResourceMonitor
+ *          SystemController resource monitor
+ *          CPU/FreeMemory monitoring
+ *
+ * @date    Jul-02-2013 create start
+ */
+
+#ifndef CICOSCSYSRESOURCEMONITOR_H
+#define CICOSCSYSRESOURCEMONITOR_H
+
+#include <sys/types.h>
+#include <vector>
+
+
+/**
+ * /proc/stat cpu/cpuX data struct type
+ */
+typedef struct t_stat_data {
+    int user;    // 1) Time spent in user mode.
+    int nice;    // 2) Time spent in user mode with low priority (nice).
+    int system;  // 3) Time spent in system mode.
+    int idle;    // 4) Time spent in the idle task.
+                 // This value should be USER_HZ times the second entry
+                 // in the /proc/uptime pseudo-file.
+    int iowait;  // 5) Time waiting for I/O to complete.
+    int irq;     // 6) Time servicing interrupts.
+    int softirq; // 7) Time servicing softirqs.
+    int steal;   // 8) Time stolen
+                 // 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 {
+public: // member method
+    CicoSCSysResourceMonitorP(pid_t pid);
+    CicoSCSysResourceMonitorP(const CicoSCSysResourceMonitorP& s);
+
+
+
+
+
+public: // member Variable
+    pid_t m_pid;
+    int m_utime_o;
+    int m_stime_o;
+    int m_vsize_o;
+/*
+
+  /proc/[pid]/stat
+  01)pid, 02)comm, 03)state, 04)ppid, 05)pgrp, 06)session, 07)tty_nr, 08)tpgid
+  09)flags, 10)minflt, 11)cminflt, 12)majflt, 13)cmajflt, 14)utime, 15)stime
+  16)cutime, 17)cstime, 18)priority, 19)nice, 20)num_threads, 21)itrealvalue
+  22)starttime, 23)vsize, 24)rss, 25)rsslim, 26)startcode, 27)endcode
+  28)startstack, 29)kstkesp, 30)kstkeip, 31)signal, 32)blocked, 33)sigignore
+  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の仮想メモリのサイズを取得します。
+*/
+};
+
+
+
+
+
+/**
+ * @brief Resource monitoring
+ */
+class CicoSCSysResourceMonitor {
+public:
+    CicoSCSysResourceMonitor();
+    ~CicoSCSysResourceMonitor();
+
+    enum E_USAGETYPE{
+        E_user = 0,  //  1) Time spent in user mode.
+        E_nice,      //  2) Time spent in user mode with low priority (nice).
+        E_system,    //  3) Time spent in system mode.
+        E_idle,      //  4) Time spent in the idle task.
+        E_iowait,    //  5) Time waiting for I/O to complete.
+        E_irq,       //  6) Time servicing interrupts.
+        E_softirq,   //  7) Time servicing softirqs.
+        E_steal,     //  8) Time stolen
+        E_guest,     //  9) Time Guest OS
+        E_guest_nice // 10) Time guest OS(nice)
+    };
+    bool isAllReady() const;
+    // cpu
+    int  getCPUCount() const; // get number of cpu cores
+
+                   // @param cpu -1:total 0:cpu0 1:cpu1 n:cpuN
+                   // @retval 0 - 10000(retval/100 = 0.00 - 100.00%)
+    int getCPUuser(int cpu=-1) const;
+    int getCPUsystem(int cpu=-1) const;
+    int getCPUtime(E_USAGETYPE e, int cpu=-1) const;
+
+    // memory
+    unsigned int getFreeMemSize() const; // free memory size maybe kB
+    unsigned int getTotalMemSize() const; // total memory size maybe kB
+    int getUsageFreeMem() const; // usage free memory
+
+    // controller
+    void monitoring();
+
+    // process monitoring entry and remove
+    void addTarget(pid_t pid);
+    void removeTarget(pid_t pid);
+//    std::vector<Xxxxx>& get
+protected:
+    void getResource();
+    void getResourceCPU();
+    void getResourceMEM();
+private:
+    int createCurrentCPU();
+    void readCurrentCPU();
+    int readProcStatCPU(stat_data_t* sdtp, const int cpucnt);
+    bool usageCalcCPU(const stat_data_t& old, const stat_data_t& current,
+                      stat_data_t& calc);
+    void readProcMeminfo(bool ttlMem=false);
+protected:
+    int m_CPUcnt; // CPU core count
+    stat_data_t* m_old; // CPU time of previous value
+    stat_data_t* m_current; // CPU time of this time
+    stat_data_t* m_calc; // usage CPU time
+    unsigned int m_totalMem; // total memory size maybe kB
+    unsigned int m_freeMem; // free memory size maybe kB
+    int m_usageFreeMem;  // usage free memory
+private:
+    bool m_allready;
+};
+
+/**
+ * @brief monitoring all ready
+ * @return true:ok false:not good
+ */
+inline bool CicoSCSysResourceMonitor::isAllReady() const
+{
+    return m_allready;
+}
+
+/**
+ * @brief cpu core count
+ * @return cpum_usageFreeMem core count
+ */
+inline int CicoSCSysResourceMonitor::getCPUCount() const
+{
+    return m_CPUcnt;
+}
+
+/**
+ * @brief user usage
+ * @param cpu core cpu position -1:all 0-n:cpu position
+ * @return cpu usage
+ * @retval 0 - 10000 (value/100 = 0.00 - 100.00%)
+ * @retval -1:get fail
+ */
+inline int CicoSCSysResourceMonitor::getCPUuser(int cpu) const
+{
+    return getCPUtime(E_user,cpu);
+}
+
+/**
+ * @brief system usage
+ * @param cpu core cpu position -1:all 0-n:cpu position
+ * @return cpu usage
+ * @retval 0 - 10000 (value/100 = 0.00 - 100.00%)
+ * @retval -1:get fail
+ */
+inline int CicoSCSysResourceMonitor::getCPUsystem(int cpu) const
+{
+    return getCPUtime(E_system,cpu);
+}
+
+/**
+ * @brief free memory size
+ * @return free memory size maybe(kB)
+ */
+inline unsigned int CicoSCSysResourceMonitor::getFreeMemSize() const
+{
+    return m_freeMem;
+}
+
+/**
+ * @brief total memory size
+ * @return free memory size maybe(kB)
+ */
+inline unsigned int CicoSCSysResourceMonitor::getTotalMemSize() const
+{
+    return m_totalMem;
+}
+
+/**
+ * @brief usage free memory
+ * @return usage
+ * @retval -1:during measurement
+ * @retval 0 - 10000(value / 100 = 0.00% - 100.00%)
+ */
+inline int CicoSCSysResourceMonitor::getUsageFreeMem() const // usage free memory
+{
+    return m_usageFreeMem;
+}
+
+#endif // CICOSCSYSRESOURCEMONITOR_H
diff --git a/lib/system-controller/CicoSCSystemConfig.cpp b/lib/system-controller/CicoSCSystemConfig.cpp
new file mode 100644 (file)
index 0000000..ae6e02f
--- /dev/null
@@ -0,0 +1,1712 @@
+/*
+ * 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   CicoSCSystemConfig.cpp
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+#include "CicoSCSystemConfig.h"
+#include "CicoSCConf.h"
+
+//==========================================================================    
+//  private static variable
+//==========================================================================    
+CicoSCSystemConfig* CicoSCSystemConfig::ms_myInstance = NULL;
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
+CicoSCSystemConfig::CicoSCSystemConfig()
+{
+    m_typeTable[""]          = ICO_NODETYPE_CENTER;
+    m_typeTable["center"]    = ICO_NODETYPE_CENTER;
+    m_typeTable["meter"]     = ICO_NODETYPE_METER;
+    m_typeTable["remote"]    = ICO_NODETYPE_REMOTE;
+    m_typeTable["passenger"] = ICO_NODETYPE_PASSENGER;
+    m_typeTable["rear"]      = ICO_NODETYPE_REAR;
+    m_typeTable["rearleft"]  = ICO_NODETYPE_REARLEFT;
+    m_typeTable["rearright"] = ICO_NODETYPE_REARRIGHT;
+
+    m_displayTypeTable[""]          = ICO_DISPLAYTYPE_CENTER;
+    m_displayTypeTable["center"]    = ICO_DISPLAYTYPE_CENTER;
+    m_displayTypeTable["meter"]     = ICO_DISPLAYTYPE_METER;
+    m_displayTypeTable["remote"]    = ICO_DISPLAYTYPE_REMOTE;
+    m_displayTypeTable["passenger"] = ICO_DISPLAYTYPE_PASSENGER;
+    m_displayTypeTable["rear"]      = ICO_DISPLAYTYPE_REAR;
+    m_displayTypeTable["rearleft"]  = ICO_DISPLAYTYPE_REARLEFT;
+    m_displayTypeTable["rearright"] = ICO_DISPLAYTYPE_REARRIGHT;
+
+    // 
+    m_categoryTalbe[""]              = ICO_POLICY_ALWAYS;
+    m_categoryTalbe["alway"]         = ICO_POLICY_ALWAYS;
+    m_categoryTalbe["run"]           = ICO_POLICY_RUNNING;
+    m_categoryTalbe["park"]          = ICO_POLICY_PARKED;
+    m_categoryTalbe["shift_park"]    = ICO_POLICY_SHIFT_PARKING;
+    m_categoryTalbe["shift_back"]    = ICO_POLICY_SHIFT_REVERSES;
+    m_categoryTalbe["shift_rev"]     = ICO_POLICY_SHIFT_REVERSES;
+    m_categoryTalbe["blinker_left"]  = ICO_POLICY_BLINKER_LEFT;
+    m_categoryTalbe["blinker_right"] = ICO_POLICY_BLINKER_RIGHT;
+
+    //
+    m_privilegeTable["almighty"]       = ICO_PRIVILEGE_ALMIGHTY;
+    m_privilegeTable["system"]         = ICO_PRIVILEGE_SYSTEM;
+    m_privilegeTable["system.audio"]   = ICO_PRIVILEGE_SYSTEM_AUDIO;
+    m_privilegeTable["system.visible"] = ICO_PRIVILEGE_SYSTEM_VISIBLE;
+    m_privilegeTable["maker"]          = ICO_PRIVILEGE_MAKER;
+    m_privilegeTable["certificate"]    = ICO_PRIVILEGE_CERTIFICATE;
+    m_privilegeTable["none"]           = ICO_PRIVILEGE_NONE;
+    m_privilegeTable[""]               = ICO_PRIVILEGE_NONE;
+    m_resourceConf = NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
+CicoSCSystemConfig::~CicoSCSystemConfig()
+{
+    // TODO
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Get instance of CicoSCSystemConfig
+ *
+ *  @return  pointer of CicoSCSystemConfig object
+ */
+//--------------------------------------------------------------------------
+CicoSCSystemConfig*
+CicoSCSystemConfig::getInstance(void)
+{
+    if (NULL == ms_myInstance) {
+        ms_myInstance = new CicoSCSystemConfig();
+    }
+    return ms_myInstance;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Get instance of CicoSCSystemConfig
+ *
+ *  @param  [IN]    confFile    config file name
+ *  @return 0 on success, other on error
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::load(const string & confFile)
+{
+    ptree root;
+    read_xml(confFile, root);
+
+    createNodeConfList(root);
+    createDisplayConfList(root);
+    createSoundConfList(root);
+    createPortConf(root);
+    createCategoryConf(root);
+    createAppKindConf(root);
+    createInputDevList(root);
+    createDefaultConf(root);
+    createLogConf(root);
+    createResourceConf(root);
+
+    return 0;   //TODO
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const vector<CicoSCDisplayConf*>&
+CicoSCSystemConfig::getDisplayConfList(void) const
+{
+    return m_displayConfList;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createNodeConfList(const ptree & root)
+{
+    //<nodes>
+//    if (root.not_found() == root.find("systemconfig")) {
+//        ICO_ERR("nodes element not found");
+//        return;
+//    }
+    ptree nodes = root.get_child("systemconfig.nodes");
+
+    BOOST_FOREACH (const ptree::value_type& child, nodes) {
+        if (0 != strcmp(child.first.data(),"node")) {
+            ICO_ERR("unknown element(%s)", child.first.data());
+        }
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        optional<string> type;
+        optional<string> address;
+
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            ICO_ERR("node.id attr not found");
+            continue;
+        }
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            ICO_ERR("node.name attr not found");
+            continue;
+        }
+        type = child.second.get_optional<string>("type");
+        if (false == type.is_initialized()) {
+            ICO_ERR("node.type element not found");
+            continue;
+        }
+        address = child.second.get_optional<string>("ipaddress");
+        if (false == address.is_initialized()) {
+            ICO_ERR("node.address element not found");
+            continue;
+        }
+
+        CicoSCNodeConf* nodeConf = new CicoSCNodeConf;
+        nodeConf->id      = id.get();
+        nodeConf->name    = name.get();
+        nodeConf->type    = m_typeTable[type.get()];
+        nodeConf->address = address.get();
+        m_nodeConfList.push_back(nodeConf);
+
+        nodeConf->dumpConf();
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createDisplayConfList(const ptree & root)
+{
+    //<displays>
+//    if (root.not_found() != root.find("systemconfi.displays")) {
+//        ICO_ERR("displays element not found");
+//        return;
+//    }
+
+    ptree displays = root.get_child("systemconfig.displays");
+    BOOST_FOREACH (const ptree::value_type& child, displays) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        optional<string> node;
+        optional<int> no = optional<int>(-1);
+        optional<string> wayland;
+        optional<string> type;
+        optional<int> width = optional<int>(-1);
+        optional<int> height = optional<int>(-1);
+        optional<int> inch = optional<int>(-1);
+
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            ICO_ERR("display.id attr not found");
+            continue;
+        }
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            ICO_ERR("display.name attr not found");
+            continue;
+        }
+        node = child.second.get_optional<string>("node");
+        if (false == node.is_initialized()) {
+            ICO_ERR("display.node attr not found");
+            continue;
+        }
+        no = child.second.get_optional<int>("no");
+        if (false == no.is_initialized()) {
+            ICO_ERR("display.no element not found");
+            continue;
+        }
+        wayland = child.second.get_optional<string>("wayland");
+        if (false == wayland.is_initialized()) {
+            ICO_ERR("display.wayland element not found");
+            continue;
+        }
+        type = child.second.get_optional<string>("type");
+        if (false == type.is_initialized()) {
+            ICO_ERR("display.type element not found");
+            continue;
+        }
+        width = child.second.get_optional<int>("width");
+        if (false == width.is_initialized()) {
+            ICO_ERR("display.width element not found");
+            continue;
+        }
+        height = child.second.get_optional<int>("height");
+        if (false == height.is_initialized()) {
+            ICO_ERR("display.height element not found");
+            continue;
+        }
+        inch = child.second.get_optional<int>("inch");
+        if (false == inch.is_initialized()) {
+            ICO_ERR("display.inch element not found");
+            continue;
+        }
+
+        CicoSCDisplayConf* displayConf = new CicoSCDisplayConf();
+        displayConf->id     = id.get();
+        displayConf->name   = name.get();
+        displayConf->node   = getNodeIdbyName(node.get());
+        displayConf->no     = no.get();
+        displayConf->type   = m_displayTypeTable[type.get()];
+        displayConf->width  = width.get();
+        displayConf->height = height.get();
+        displayConf->inch   = inch.get();
+
+        displayConf->dumpConf();
+
+        createLayerConf(child, displayConf);
+        createDisplayZoneConf(child, displayConf);
+
+        // TODO overlap to zoneid
+        vector<CicoSCDisplayZoneConf*>::iterator itr;
+        itr = displayConf->zoneConfList.begin();
+        for (; itr != displayConf->zoneConfList.end(); ++itr) {
+        }
+
+        m_displayConfList.push_back(displayConf);
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createLayerConf(const ptree::value_type & child,
+                                    CicoSCDisplayConf* displayConf)
+{
+    ptree layers = child.second.get_child("layers");
+    BOOST_FOREACH (const ptree::value_type& layer, layers) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        optional<int> type = optional<int>(-1);
+        optional<bool> overlap = optional<bool>(false);
+
+        id = layer.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            ICO_ERR("disply.layer.id attr not found");
+            continue;
+        }
+        name = layer.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            ICO_ERR("disply.layer.name attr not found");
+            continue;
+        }
+        type = layer.second.get_optional<int>("type");
+        if (false == type.is_initialized()) {
+            ICO_ERR("disply.layer.type element not found");
+            continue;
+        }
+        overlap = layer.second.get_optional<bool>("menuoverlap");
+        if (false == overlap.is_initialized()) {
+            ICO_ERR("disply.layer.overlap element not found");
+            continue;
+        }
+
+        CicoSCLayerConf* layerConf = new CicoSCLayerConf();
+        layerConf->id          = id.get();
+        layerConf->name        = name.get();
+        layerConf->type        = type.get();
+        layerConf->menuoverlap = overlap.get();
+
+        displayConf->layerConfList.push_back(layerConf);
+
+        layerConf->dumpConf();
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createDisplayZoneConf(const ptree::value_type & child,
+                                          CicoSCDisplayConf* displayConf)
+{
+    ptree zones = child.second.get_child("zones");
+    BOOST_FOREACH (const ptree::value_type& zone, zones) {
+        optional<int>    id = optional<int>(-1);
+        optional<string> name;
+        optional<string> x;
+        optional<string> y;
+        optional<string> w;
+        optional<string> h;
+        optional<string> overlap;
+
+        id = zone.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            ICO_WRN("zone.id.attr not found");
+            continue;
+        }
+        name = zone.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            ICO_WRN("zone.name.attr not found");
+            continue;
+        }
+        x = zone.second.get_optional<string>("geometry.<xmlattr>.x");
+        if (false == x.is_initialized()) {
+            ICO_WRN("zone.geometry.x attr not found");
+            continue;
+        }
+        y = zone.second.get_optional<string>("geometry.<xmlattr>.y");
+        if (false == y.is_initialized()) {
+            ICO_WRN("zone.geometry.y attr not found");
+            continue;
+        }
+        w = zone.second.get_optional<string>("geometry.<xmlattr>.w");
+        if (false == w.is_initialized()) {
+            ICO_WRN("zone.geometry.w attr not found");
+            continue;
+        }
+        h = zone.second.get_optional<string>("geometry.<xmlattr>.h");
+        if (false == h.is_initialized()) {
+            ICO_WRN("zone.geometry.h attr not found");
+            continue;
+        }
+        overlap = zone.second.get_optional<string>("overlap");
+        if (false == overlap.is_initialized()) {
+            ICO_WRN("zone.overlap element not found");
+            overlap = optional<string>("");
+        }
+
+        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->overlapStr = overlap.get();
+        displayConf->zoneConfList.push_back(zoneConf);
+
+        zoneConf->dumpConf();
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createSoundConfList(const ptree & root)
+{
+    //<sound>
+    ptree sounds = root.get_child("systemconfig.sounds");
+    BOOST_FOREACH (const ptree::value_type& child, sounds) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        optional<int> no = optional<int>(-1);
+
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            continue;
+        }
+
+        no = child.second.get_optional<int>("no");
+        if (false == no.is_initialized()) {
+            continue;
+        }
+
+        CicoSCSoundConf* soundConf = new CicoSCSoundConf();
+        soundConf->id   = id.get();
+        soundConf->name = name.get();
+        soundConf->no   = no.get();
+
+        soundConf->dumpConf();
+
+        createSoundZoneConf(child, soundConf);
+
+        m_soundConfList.push_back(soundConf);
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createSoundZoneConf(const ptree::value_type & child,
+                                        CicoSCSoundConf* soundConf)
+{
+    //<sound>
+    //  <zone>
+    //      ...
+    ptree zones = child.second.get_child("zones");
+    BOOST_FOREACH (const ptree::value_type& zone, zones) {
+        optional<int>    id = optional<int>(-1);
+        optional<string> name;
+
+        id = zone.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+        name = zone.second.get_optional<string>("<xmlattr>.name");
+        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();
+        soundConf->zoneConfList.push_back(zoneConf);
+
+        zoneConf->dumpConf();
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createPortConf(const ptree & root)
+{
+    // <ports>
+    ptree ports = root.get_child("systemconfig.ports");
+    BOOST_FOREACH (const ptree::value_type& child, ports) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            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
+            m_sysconPort = atoi(child.second.data().c_str());
+            break;
+        case 1:
+            m_soundPluginPort = atoi(child.second.data().c_str());
+            break;
+        default:
+            break;
+        }
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createCategoryConf(const ptree & root)
+{
+    //<category>
+    ptree categorys = root.get_child("systemconfig.categorys");
+    BOOST_FOREACH (const ptree::value_type& child, categorys) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        optional<string> type;
+        optional<string> view;
+        optional<string> sound;
+        optional<string> input;
+        optional<int> priority = optional<int>(-1);
+        optional<int> r_ctrl = optional<int>(-1);
+        
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            continue;
+        }
+        type = child.second.get_optional<string>("type");
+        if (false == type.is_initialized()) {
+            continue;
+        }
+        view = child.second.get_optional<string>("view");
+        if (false == view.is_initialized()) {
+            continue;
+        }
+        sound = child.second.get_optional<string>("sound");
+        if (false == sound.is_initialized()) {
+            continue;
+        }
+        input= child.second.get_optional<string>("input");
+        if (false == sound.is_initialized()) {
+            continue;
+        }
+        priority = child.second.get_optional<int>("priority");
+        if (false == priority.is_initialized()) {
+            continue;
+        }
+        r_ctrl = child.second.get_optional<int>("r_ctrl");
+        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();
+        categoryConf->name     = name.get();
+        categoryConf->type     = type.get();
+        categoryConf->view     = m_categoryTalbe[view.get()];
+        categoryConf->sound    = m_categoryTalbe[sound.get()];
+        categoryConf->input    = m_categoryTalbe[input.get()];
+        categoryConf->priority = priority.get();
+        categoryConf->rctrl    = r_ctrl.get();
+        m_categoryConfList.push_back(categoryConf);
+        categoryConf->dumpConf();
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createAppKindConf(const ptree & root)
+{
+    // <appkinds>
+    ptree appkinds = root.get_child("systemconfig.appkinds");
+    BOOST_FOREACH (const ptree::value_type& child, appkinds) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        optional<string> privilege;
+        optional<int> priority = optional<int>(-1);
+
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            continue;
+        }
+
+        privilege = child.second.get_optional<string>("privilege");
+        if (false == name.is_initialized()) {
+            continue;
+        }
+
+        priority = child.second.get_optional<int>("priority");
+        if (false == priority.is_initialized()) {
+            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();
+        appKindConf->privilege = m_privilegeTable[privilege.get()];
+        appKindConf->priority  = priority.get();
+        m_appKindConfList.push_back(appKindConf);
+        appKindConf->dumpConf();
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createInputDevList(const ptree & root)
+{
+    //<inputs>
+    ptree inputs = root.get_child("systemconfig.inputs");
+    BOOST_FOREACH (const ptree::value_type& child, inputs) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        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();
+        inputDevConf->name = name.get();
+        inputDevConf->dumpConf();
+
+        createSwitchList(child, inputDevConf);
+        m_inputDevConfList.push_back(inputDevConf);
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createSwitchList(const ptree::value_type & child,
+                                     CicoSCInputDevConf* inputDevConf)
+{
+    ptree switchs = child.second.get_child("switchs");
+    BOOST_FOREACH (const ptree::value_type& zone, switchs) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        optional<string> appid;
+
+        id = zone.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+
+        name = zone.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            continue;
+        }
+
+        appid = zone.second.get_optional<string>("<xmlattr>.appid");
+        if (false == appid.is_initialized()) {
+            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();
+        switchConf->appid = appid.get();
+        switchConf->dumpConf();
+        inputDevConf->switchConfList.push_back(switchConf);
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createDefaultConf(const ptree & root)
+{
+    // <default>
+    ptree defaults = root.get_child("systemconfig.default");
+
+    optional<string> node;
+    optional<string> appkind;
+    optional<string> category;
+    optional<string> display;
+    optional<string> layer;
+    optional<string> displayzone;
+    optional<string> sound;
+    optional<string> soundzone;
+    optional<string> inputdev;
+    optional<string> inputsw;
+
+    node = defaults.get_optional<string>("node");
+    if (false == node.is_initialized()) {
+        ICO_WRN("default.node element not found");
+    }
+
+    appkind = defaults.get_optional<string>("appkind");
+    if (false == appkind.is_initialized()) {
+        ICO_WRN("default.appkind element not found");
+    }
+
+    category = defaults.get_optional<string>("category");
+    if (false == category.is_initialized()) {
+        ICO_WRN("default.category element not found");
+    }
+
+    display = defaults.get_optional<string>("display");
+    if (false == display.is_initialized()) {
+        ICO_WRN("default.display element not found");
+    }
+
+    layer = defaults.get_optional<string>("layer");
+    if (false == layer.is_initialized()) {
+        ICO_WRN("default.layer element not found");
+    }
+
+    displayzone = defaults.get_optional<string>("displayzone");
+    if (false == displayzone.is_initialized()) {
+        ICO_WRN("default.displayzone element not found");
+    }
+
+    sound = defaults.get_optional<string>("sound");
+    if (false == sound.is_initialized()) {
+        ICO_WRN("default.sound element not found");
+    }
+
+    soundzone = defaults.get_optional<string>("soundzone");
+    if (false == soundzone.is_initialized()) {
+        ICO_WRN("default.soundzone element not found");
+    }
+
+    inputdev = defaults.get_optional<string>("inputdev");
+    if (false == inputdev.is_initialized()) {
+        ICO_WRN("default.inputdev element not found");
+    }
+
+    inputsw = defaults.get_optional<string>("inputsw");
+    if (false == inputsw.is_initialized()) {
+        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());
+    m_defaultConf->appkind     = getAppKindIdbyName(appkind.get());
+    m_defaultConf->category    = getCategoryIdbyName(category.get());
+    m_defaultConf->display     = getDisplayIdbyName(display.get());
+    m_defaultConf->layer       = getLayerIdfbyName(display.get(), layer.get());
+    m_defaultConf->displayzone = getDizplayZoneIdbyName(display.get(),
+                                                      displayzone.get());
+    m_defaultConf->sound       = getSoundIdbyName(sound.get());
+    m_defaultConf->soundzone   = getSoundZoneIdbyName(sound.get(),
+                                                    soundzone.get());
+    m_defaultConf->inputdev    = getInputDevIdbyName(inputdev.get());
+    m_defaultConf->inputsw     = getSwitchIdbyName(inputdev.get(),
+                                                 inputsw.get());
+
+//TODO
+#define ICO_SYC_TOP_EVN     (char*)"SYSCON_TOPDIR"
+#define ICO_SYC_TOP_DIR     (char*)"/usr/apps/org.tizen.ico.system-controller"
+    /* decide top directory in all configurations       */
+    char *topdir = getenv(ICO_SYC_TOP_EVN);
+    if (NULL ==  topdir) {
+        topdir = ICO_SYC_TOP_DIR;
+    }
+    m_defaultConf->topdir = topdir;
+    
+//TODO
+#define ICO_SYC_CONFIG_ENV  (char*)"SYSCON_CONFDIR"
+#define ICO_SYC_CONFIG_DIR  (char*)"res/config"
+    /* decide top directory in configuration file's     */
+    char *confdir = getenv(ICO_SYC_CONFIG_ENV);
+    if (NULL != confdir) {
+        m_defaultConf->confdir = confdir;
+    }
+    else {
+        m_defaultConf->confdir = m_defaultConf->topdir;
+        m_defaultConf->confdir.append("/");
+        m_defaultConf->confdir.append(ICO_SYC_CONFIG_DIR);
+    }
+
+    m_defaultConf->dumpConf();
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createLogConf(const ptree & root)
+{
+    // <log>
+    // </log>
+    ptree logNode = root.get_child("systemconfig.log");
+    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;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  resource config class object create
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void getArray(ptree& t, vector<int>& vec);
+static const char* g_resource_cpu = "systemconfig.resource_cpu_control";
+void
+CicoSCSystemConfig::createResourceConf(const ptree & root)
+{
+    m_resourceConf = new CicoSCResourceConf;
+    ptree rc = root.get_child(g_resource_cpu);
+    bool b = false;
+    optional<string> opts = rc.get_optional<string>("do_it");
+    if (true == opts.is_initialized()) {
+        string v = opts.get();
+        if (0 == v.compare("yes")) {
+            b = true;
+        }
+    }
+    m_resourceConf->m_bDoIt = b;
+    if (false == b) {
+        return;
+    }
+
+    string dirnm;
+    optional<string> opts2 = rc.get_optional<string>("ctrl_dir_path");
+    if (true == opts2.is_initialized()) {
+        dirnm = opts2.get();
+    }
+    else {
+        dirnm = "/sys/fs/cgroup/cpu,cpuacct/SCprivate";
+    }
+    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()) {
+        string v = opts.get();
+        if (0 == v.compare("true")) {
+            m_resourceConf->m_bLog = true;
+        }
+    }
+    
+
+    BOOST_FOREACH(ptree::value_type& child, rc) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            continue;
+        }
+        ptree pth = child.second.get_child("hight_array");
+        ptree ptl = child.second.get_child("low_array");
+
+        CicoSCCpuResourceGrp* obj = new CicoSCCpuResourceGrp;
+        obj->m_id    = id.get();
+        obj->m_bDoIt = b;
+        obj->m_grpNm = name.get();
+        getArray(pth, obj->m_hight);
+        getArray(ptl, obj->m_low);
+        m_resourceConf->m_cpuCtrl.push_back(obj);
+    }
+    m_resourceConf->dumpConf();
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::calcGeometryExpr(const string & expr,
+                                     CicoSCDisplayConf* conf)
+{
+    int     val = 0;
+    int     wval;
+    int     i, j, sign;
+    char    word[32];
+
+    j = 0;
+    sign = 0;
+    for (i = 0; ; i++)  {
+        if (expr[i] == ' ')  continue;
+        if ((expr[i] == 0) || (expr[i] == '+') || (expr[i] == '-') ||
+            (expr[i] == '*') || (expr[i] == '-') || (expr[i] == '/'))  {
+            if (j > 0)  {
+                word[j] = 0;
+                if ((strcasecmp(word, "dispw") == 0) ||
+                    (strcasecmp(word, "width") == 0))   {
+                    wval = conf->width;
+                }
+                else if ((strcasecmp(word, "disph") == 0) ||
+                         (strcasecmp(word, "heigh") == 0))  {
+                    wval = conf->height;
+                }
+                else    {
+                    wval = strtol(word, (char **)0, 0);
+                }
+                j = 0;
+                if (sign >= 10) {
+                    wval = 0 - wval;
+                }
+                switch (sign % 10)  {
+                case 0:                     /* assign       */
+                    val = wval;
+                    break;
+                case 1:                     /* '+'          */
+                    val += wval;
+                    break;
+                case 2:                     /* '-'          */
+                    val -= wval;
+                    break;
+                case 3:                     /* '*'          */
+                    val *= wval;
+                    break;
+                case 4:                     /* '/'          */
+                    val /= wval;
+                    break;
+                default:
+                    break;
+                }
+                sign = 0;
+                if (expr[i] == '+')      sign = 1;
+                else if (expr[i] == '-') sign = 2;
+                else if (expr[i] == '*') sign = 3;
+                else if (expr[i] == '/') sign = 4;
+                else                    sign = 0;
+            }
+            else    {
+                if ((sign > 0) && (expr[i] == '-'))  {
+                    sign += 10;
+                }
+                else    {
+                    if (expr[i] == '+')      sign = 1;
+                    else if (expr[i] == '-') sign = 2;
+                    else if (expr[i] == '*') sign = 3;
+                    else if (expr[i] == '/') sign = 4;
+                    else                     sign = 0;
+                }
+            }
+            if (expr[i] == 0)    break;
+        }
+        else    {
+            if (j < ((int)sizeof(word)-1))  {
+                word[j++] = expr[i];
+            }
+        }
+    }
+    return val;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCNodeConf*
+CicoSCSystemConfig::findNodeConfbyName(const string & name)
+{
+    vector<CicoSCNodeConf*>::iterator itr;
+    itr = m_nodeConfList.begin();
+    for (; itr != m_nodeConfList.end(); ++itr) {
+        const CicoSCNodeConf* conf = const_cast<CicoSCNodeConf*>(*itr);
+        if (name == conf->name) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCDisplayConf*
+CicoSCSystemConfig::findDisplayConfbyName(const string & name)
+{
+    vector<CicoSCDisplayConf*>::iterator itr;
+    itr = m_displayConfList.begin();
+    for (; itr != m_displayConfList.end(); ++itr) {
+        const CicoSCDisplayConf* conf = NULL;
+        conf = const_cast<CicoSCDisplayConf*>(*itr);
+        if (name == conf->name) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCLayerConf*
+CicoSCSystemConfig::findLayerConfbyName(const string & displayName,
+                                        const string & layerName)
+{
+    const CicoSCDisplayConf* displayConf = NULL;
+    displayConf = findDisplayConfbyName(displayName);
+    if (NULL == displayConf) {
+        return NULL;
+    }
+
+    vector<CicoSCLayerConf*>::const_iterator itr;
+    itr = displayConf->layerConfList.begin();
+    for (; itr != displayConf->layerConfList.end(); ++itr) {
+        const CicoSCLayerConf* conf = NULL;
+        conf = const_cast<CicoSCLayerConf*>(*itr);
+        if (layerName == conf->name) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCDisplayZoneConf*
+CicoSCSystemConfig::findDisplayZoneConfbyName(const string & displayName,
+                                              const string & zoneName)
+{
+    ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Enter"
+            "(displayName=%s zoneNmae=%s)",
+            displayName.c_str(), zoneName.c_str());
+
+    const CicoSCDisplayConf* displayConf = NULL;
+    displayConf = findDisplayConfbyName(displayName);
+    if (NULL == displayConf) {
+        ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Leave(NULL)");
+        return NULL;
+    }
+
+    vector<CicoSCDisplayZoneConf*>::const_iterator itr;
+    itr = displayConf->zoneConfList.begin();
+    for (; itr != displayConf->zoneConfList.end(); ++itr) {
+        const CicoSCDisplayZoneConf* conf = NULL;
+        conf = const_cast<CicoSCDisplayZoneConf*>(*itr);
+        if (zoneName == conf->name) {
+            ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Leave"
+                    "(0x%08X)", conf);
+            return conf;
+        }
+    }
+
+    ICO_DBG("CicoSCSystemConfig::findDisplayZoneConfbyName Leave(NULL)");
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCSoundConf*
+CicoSCSystemConfig::findSoundConfbyName(const string & name)
+{
+    vector<CicoSCSoundConf*>::iterator itr;
+    itr = m_soundConfList.begin();
+    for (; itr != m_soundConfList.end(); ++itr) {
+        const CicoSCSoundConf* conf = NULL;
+        conf = const_cast<CicoSCSoundConf*>(*itr);
+        if (name == conf->name) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCSoundZoneConf*
+CicoSCSystemConfig::findSoundZoneConfbyName(const string & soundName,
+                                            const string & zoneName)
+{
+    const CicoSCSoundConf* soundConf = NULL;
+    soundConf = findSoundConfbyName(soundName);
+    if (NULL == soundConf) {
+        return NULL;
+    }
+
+    vector<CicoSCSoundZoneConf*>::const_iterator itr;
+    itr = soundConf->zoneConfList.begin();
+    for (; itr != soundConf->zoneConfList.end(); ++itr) {
+        const CicoSCSoundZoneConf* conf = NULL;
+        conf = const_cast<CicoSCSoundZoneConf*>(*itr);
+        if (zoneName == conf->name) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCInputDevConf*
+CicoSCSystemConfig::findInputDevConfbyName(const string & name)
+{
+    vector<CicoSCInputDevConf*>::iterator itr;
+    itr = m_inputDevConfList.begin();
+    for (; itr != m_inputDevConfList.end(); ++itr) {
+        const CicoSCInputDevConf* conf = NULL;
+        conf = const_cast<CicoSCInputDevConf*>(*itr);
+        if (name == conf->name) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCSwitchConf*
+CicoSCSystemConfig::findSwitchConfbyName(const string & inputDevName,
+                                         const string & switchName)
+{
+    const CicoSCInputDevConf* inputDevConf = NULL;
+    inputDevConf = findInputDevConfbyName(inputDevName);
+    if (NULL == inputDevConf) {
+        ICO_WRN("name(%s) input device config not found.",
+                 inputDevName.c_str());
+        return NULL;
+    }
+
+    vector<CicoSCSwitchConf*>::const_iterator itr;
+    itr = inputDevConf->switchConfList.begin();
+    for (; itr != inputDevConf->switchConfList.end(); ++itr) {
+        const CicoSCSwitchConf* conf = NULL;
+        conf = const_cast<CicoSCSwitchConf*>(*itr);
+        if (switchName == conf->name) {
+            return conf;
+        }
+    }
+
+    ICO_WRN("name(%s) switch config not found.", switchName.c_str());
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCAppKindConf*
+CicoSCSystemConfig::findAppKindConfbyName(const string & name)
+{
+    vector<CicoSCAppKindConf*>::iterator itr;
+    itr = m_appKindConfList.begin();
+    for (; itr != m_appKindConfList.end(); ++itr) {
+        const CicoSCAppKindConf* conf = NULL;
+        conf = const_cast<CicoSCAppKindConf*>(*itr);
+        if (name == conf->name) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCCategoryConf*
+CicoSCSystemConfig::findCategoryConfbyName(const string & name)
+{
+    vector<CicoSCCategoryConf*>::iterator itr;
+    itr = m_categoryConfList.begin();
+    for (; itr != m_categoryConfList.end(); ++itr) {
+        const CicoSCCategoryConf* conf = NULL;
+        conf = const_cast<CicoSCCategoryConf*>(*itr);
+        if (name == conf->name) {
+            //return const_cast<CicoSCCategoryConf*>(itr->pointer);
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCCategoryConf*
+CicoSCSystemConfig::findCategoryConfbyId(int id)
+{
+    vector<CicoSCCategoryConf*>::iterator itr;
+    itr = m_categoryConfList.begin();
+    for (; itr != m_categoryConfList.end(); ++itr) {
+        const CicoSCCategoryConf* conf = NULL;
+        conf = const_cast<CicoSCCategoryConf*>(*itr);
+        if (id == conf->id) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCDefaultConf*
+CicoSCSystemConfig::getDefaultConf(void)
+{
+    return m_defaultConf;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getNodeIdbyName(const string & name)
+{
+    const CicoSCNodeConf* conf = NULL;
+    conf = findNodeConfbyName(name);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getDisplayIdbyName(const string & name)
+{
+    const CicoSCDisplayConf* conf = NULL;
+    conf = findDisplayConfbyName(name);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getLayerIdfbyName(const string & displayName,
+                                      const string & layerName)
+{
+    const CicoSCLayerConf* conf = NULL;
+    conf = findLayerConfbyName(displayName, layerName);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getDizplayZoneIdbyName(const string & displayName,
+                                           const string & zoneName)
+{
+    const CicoSCDisplayZoneConf* conf = NULL;
+    conf = findDisplayZoneConfbyName(displayName, zoneName);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getDizplayZoneIdbyFullName(const string & zoneFullName)
+{
+    string::size_type index = zoneFullName.find(".", 0);
+    if (string::npos == index) {
+        return -1;
+    }
+    string displayName = zoneFullName.substr(0, index);
+    string zoneName    = zoneFullName.substr(index+1);
+
+    const CicoSCDisplayZoneConf* conf = NULL;
+    conf = findDisplayZoneConfbyName(displayName, zoneName);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getSoundIdbyName(const string & name)
+{
+    const CicoSCSoundConf* conf = NULL;
+    conf = findSoundConfbyName(name);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getSoundZoneIdbyName(const string & soundName,
+                                         const string & zoneName)
+{
+    const CicoSCSoundZoneConf* conf = NULL;
+    conf = findSoundZoneConfbyName(soundName, zoneName);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getSoundZoneIdbyFullName(const string & zoneFullName)
+{
+    string::size_type index = zoneFullName.find(".", 0);
+    if (string::npos == index) {
+        return -1;
+    }
+    string soundName = zoneFullName.substr(0, index);
+    string zoneName  = zoneFullName.substr(index);
+
+    const CicoSCSoundZoneConf* conf = NULL;
+    conf = findSoundZoneConfbyName(soundName, zoneName);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getInputDevIdbyName(const string & name)
+{
+    const CicoSCInputDevConf* conf = NULL;
+    conf = findInputDevConfbyName(name);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getSwitchIdbyName(const string & inputDevName,
+                                      const string & switchName)
+{
+    const CicoSCSwitchConf* conf = NULL;
+    conf = findSwitchConfbyName(inputDevName, switchName);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getAppKindIdbyName(const string & name)
+{
+    const CicoSCAppKindConf* conf = NULL;
+    conf = findAppKindConfbyName(name);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getCategoryIdbyName(const string & name)
+{
+    const CicoSCCategoryConf* conf = NULL;
+    conf = findCategoryConfbyName(name);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  get category config object class
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCCategoryConf*
+CicoSCSystemConfig::getCategoryObjbyCaategoryID(int id)
+{
+    if (-1 == id) {
+        return NULL;
+    }
+    vector<CicoSCCategoryConf*>::iterator itr;
+    itr = m_categoryConfList.begin();
+    for (; itr != m_categoryConfList.end(); ++itr) {
+        const CicoSCCategoryConf* conf = NULL;
+        conf = const_cast<CicoSCCategoryConf*>(*itr);
+        if (id == conf->id) {
+            //return const_cast<CicoSCCategoryConf*>(itr->pointer);
+            return conf;
+        }
+    }
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  array xml tree to vector<int>
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void getArray(ptree& t, vector<int>& vec)
+{
+    vec.clear();
+    BOOST_FOREACH (const ptree::value_type& child, t) {
+        const int value = lexical_cast<int>(child.second.data());
+        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:
diff --git a/lib/system-controller/CicoSCSystemConfig.h b/lib/system-controller/CicoSCSystemConfig.h
new file mode 100644 (file)
index 0000000..bab05ea
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * 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   CicoSCSystemConfig.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+#ifndef __CICO_SC_SYSTEM_CONFIG_H__
+#define __CICO_SC_SYSTEM_CONFIG_H__
+
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/xml_parser.hpp>
+#include <boost/foreach.hpp>
+#include <boost/lexical_cast.hpp>
+
+#include <string>
+#include <map>
+#include <vector>
+using namespace std;
+using namespace boost;
+using namespace boost::property_tree;
+    
+#ifndef __CICO_SC_CONF_H__
+class CicoSCNodeConf;
+class CicoSCLayerConf;
+class CicoSCDisplayZoneConf;
+class CicoSCDisplayConf;
+class CicoSCSoundZoneConf;
+class CicoSCSoundConf;
+class CicoSCCategoryConf;
+class CicoSCAppKindConf;
+class CicoSCSwitchConf;
+class CicoSCInputDevConf;
+class CicoSCDefaultConf;
+class CicoSCResourceConf;
+#endif
+
+class CicoSCSystemConfig 
+{
+public:
+    static CicoSCSystemConfig* getInstance(void);
+
+    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 CicoSCNodeConf* findNodeConfbyName(const string & name);
+    const CicoSCDisplayConf* findDisplayConfbyName(const string & name);
+    const CicoSCLayerConf* findLayerConfbyName(const string & displayName,
+                                               const string & layerName);
+    const CicoSCDisplayZoneConf* findDisplayZoneConfbyName(const string & displayName,
+                                                       const string & zoneName);
+    const CicoSCSoundConf* findSoundConfbyName(const string & name);
+    const CicoSCSoundZoneConf* findSoundZoneConfbyName(const string & soundName,
+                                                       const string & zoneName);
+    const CicoSCInputDevConf* findInputDevConfbyName(const string & name);
+    const CicoSCSwitchConf* findSwitchConfbyName(const string & inputDevName,
+                                                 const string & switchName);
+
+    const CicoSCAppKindConf* findAppKindConfbyName(const string & name);
+    const CicoSCCategoryConf* findCategoryConfbyName(const string & name);
+
+    const CicoSCCategoryConf* findCategoryConfbyId(int id);
+
+    const CicoSCDefaultConf* getDefaultConf(void);
+
+    int getNodeIdbyName(const string & name);
+    int getDisplayIdbyName(const string & name);
+    int getLayerIdfbyName(const string & displayName,
+                          const string & layerName);
+    int getDizplayZoneIdbyName(const string & displayName,
+                               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);
+    int getInputDevIdbyName(const string & name);
+    int getSwitchIdbyName(const string & inputDevName,
+                          const string & switchName);
+    int getAppKindIdbyName(const string & name);
+    int getCategoryIdbyName(const string & name);
+    const CicoSCResourceConf* getResourceConf() const
+    {
+        return m_resourceConf;
+    };
+    const CicoSCCategoryConf* getCategoryObjbyCaategoryID(int id);
+
+private:
+    // default constructor
+    CicoSCSystemConfig();
+
+    // destructor
+    ~CicoSCSystemConfig();
+
+    // assignment operator
+    CicoSCSystemConfig& operator=(const CicoSCSystemConfig &object);
+
+    // copy constructor
+    CicoSCSystemConfig(const CicoSCSystemConfig &object);
+
+    void createNodeConfList(const ptree & root);
+    void createDisplayConfList(const ptree & root);
+    void createLayerConf(const ptree::value_type & child,
+                         CicoSCDisplayConf* displayConf);
+    void createDisplayZoneConf(const ptree::value_type & child,
+                               CicoSCDisplayConf* displayConf);
+
+    void createSoundConfList(const ptree & root);
+    void createSoundZoneConf(const ptree::value_type & child,
+                             CicoSCSoundConf* soundConf);
+    void createPortConf(const ptree & root);
+    void createCategoryConf(const ptree & root);
+    void createAppKindConf(const ptree & root);
+    void createInputDevList(const ptree & root);
+    void createSwitchList(const ptree::value_type & child,
+                          CicoSCInputDevConf* inputDevConf);
+    void createDefaultConf(const ptree & root);
+    void createLogConf(const ptree & root);
+    void createResourceConf(const ptree & root);
+
+    int calcGeometryExpr(const string & expr, CicoSCDisplayConf* conf);
+
+private:
+    static CicoSCSystemConfig* ms_myInstance;
+    string m_confFile;
+    map<string,int> m_typeTable;
+    map<string,int> m_displayTypeTable;
+    map<string,int> m_categoryTalbe;
+    map<string,int> m_privilegeTable;
+    vector<CicoSCNodeConf*> m_nodeConfList;
+    vector<CicoSCDisplayConf*> m_displayConfList;
+    vector<CicoSCSoundConf*> m_soundConfList;
+    vector<CicoSCInputDevConf*> m_inputDevConfList;
+    vector<CicoSCCategoryConf*> m_categoryConfList;
+    vector<CicoSCAppKindConf*> m_appKindConfList;
+    int m_sysconPort;
+    int m_soundPluginPort;
+    int m_loglevel;
+    bool  m_logflush;
+    CicoSCDefaultConf *m_defaultConf;
+    CicoSCResourceConf *m_resourceConf;
+};
+#endif  // __CICO_SC_SYSTEM_CONFIG_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCUser.cpp b/lib/system-controller/CicoSCUser.cpp
new file mode 100644 (file)
index 0000000..6cbf343
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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   CicoSCUser.cpp
+ *
+ *  @brief  
+ */
+/*========================================================================*/
+
+#include "CicoSCUser.h"
+#include "CicoLog.h"
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
+CicoSCUser::CicoSCUser()
+{
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
+CicoSCUser::~CicoSCUser()
+{
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  dump log CicoSCUser member variables
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCUser::dump(void)
+{
+    ICO_DBG("user name=%s, pass=%s, homescreen=%s",
+            name.c_str(), passwd.c_str(), homescreen.c_str());
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCUser.h b/lib/system-controller/CicoSCUser.h
new file mode 100644 (file)
index 0000000..438f557
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * 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   CicoSCUser.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+#ifndef __CICO_SC_USER_H__
+#define __CICO_SC_USER_H__
+
+#include <string>
+using namespace std;
+
+class CicoSCUser
+{
+public:
+    // default constructor
+    CicoSCUser();
+
+    // destructor
+    virtual ~CicoSCUser();
+
+    // dump log CicoSCUser member variables
+    void dump(void);
+
+private:
+    // assignment operator
+    CicoSCUser& operator=(const CicoSCUser &object);
+
+    // copy constructor
+    CicoSCUser(const CicoSCUser &object);
+
+public:
+    string     name;        //!< user name
+    string     passwd;      //!< password
+    string     homescreen;  //!< application ID of user uses homescreen
+};
+#endif // __CICO_SC_USER_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCUserManager.cpp b/lib/system-controller/CicoSCUserManager.cpp
new file mode 100644 (file)
index 0000000..274ca99
--- /dev/null
@@ -0,0 +1,607 @@
+/*
+ * 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   CicoSCUserManager.cpp
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+#include "ico_syc_error.h"
+#include "ico_syc_msg_cmd_def.h"
+
+#include "CicoLog.h"
+
+#include "CicoSCCommandParser.h"
+#include "CicoSCLifeCycleController.h"
+#include "CicoSCMessage.h"
+#include "CicoSCServer.h"
+#include "CicoSCUserManager.h"
+
+//==========================================================================    
+//
+//  private static variable
+//
+//==========================================================================    
+CicoSCUserManager* CicoSCUserManager::ms_myInstance = NULL;
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
+CicoSCUserManager::CicoSCUserManager()
+{
+    m_defaultUser = NULL;
+    m_lastUser = NULL;
+    m_loginUser = NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
+CicoSCUserManager::~CicoSCUserManager()
+{
+    ICO_DBG("CicoSCUserManager::~CicoSCUserManager() Enter");
+
+    delete m_defaultUser;
+
+    m_homescreenList.clear();
+
+    vector<CicoSCUser*>::iterator itr;
+    itr = m_userList.begin();
+    for (; itr != m_userList.end(); ++itr) {
+        delete *itr;
+    }
+    m_userList.clear();
+
+    ICO_DBG("CicoSCUserManager::~CicoSCUserManager() Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Get instance of CicoSCUserManager
+ *
+ *  @return  pointer of CicoSCUserManager object
+ */
+//--------------------------------------------------------------------------
+CicoSCUserManager*
+CicoSCUserManager::getInstance(void)
+{
+    if (NULL == ms_myInstance) {
+        ms_myInstance = new CicoSCUserManager();
+    }
+    return ms_myInstance;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Handle command
+ *
+ *  @param  [IN] cmd            control command
+ *  @return none
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCUserManager::handleCommand(const CicoSCCommand * cmd)
+{
+    ICO_DBG("CicoSCUserManager::handleCommand Enter (%d)", cmd->cmdid);
+
+    CicoSCCmdUserMgrOpt *opt = static_cast<CicoSCCmdUserMgrOpt*>(cmd->opt);
+
+    switch (cmd->cmdid) {
+    case MSG_CMD_CHANGE_USER:
+        // change user
+        changeUser(opt->user, opt->pass);
+        break;
+    case MSG_CMD_GET_USERLIST:
+        // get userlist
+        userlistCB(cmd->appid);
+        break;
+    default:
+        ICO_WRN("Unknown Command(0x%08x)", cmd->cmdid);
+        break;
+    }
+
+    ICO_DBG("CicoSCUserManager::handleCommand Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Load configuration file
+ *
+ *  @param  [IN] confFile       configuration file path
+ *  @return 0 on success, other on error
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCUserManager::load(const string & confFile)
+{
+    ICO_DBG("CicoSCUserManager::load Enter (%s)", confFile.c_str());
+
+    ptree root;
+    // read config file (xml)
+    read_xml(confFile, root);
+
+    // create lists
+    createUserList(root);
+    createHomeScreenList(root);
+    // set default user
+    setDefaultUser(root);
+
+    ICO_DBG("CicoSCUserManager::load Leave");
+
+    // always success
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Initialize CicoSCUserManager
+ *          This API must call after load() API
+ *
+ *  @return 0 on success, other on error
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCUserManager::initialize(void)
+{
+// TODO
+    ICO_DBG("CicoSCUserManager::initialize Enter");
+
+    const CicoSCUser *user = NULL;
+
+    if (NULL != m_lastUser) {
+        user = m_lastUser;
+    }
+    else if (NULL != m_defaultUser) {
+        user = m_defaultUser;
+    }
+    else {
+        ICO_ERR("last user and default user are null");
+        return ICO_SYC_ENXIO;
+    }
+
+    // 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());
+
+    ICO_DBG("CicoSCUserManager::initialize Leave");
+
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Get default user information
+ *
+ *  @return pointer of CicoSCUser
+ */
+//--------------------------------------------------------------------------
+const CicoSCUser*
+CicoSCUserManager::getDefaultUser(void)
+{
+    return m_defaultUser;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Get last user information
+ *
+ *  @return pointer of CicoSCUser
+ */
+//--------------------------------------------------------------------------
+const CicoSCUser*
+CicoSCUserManager::getLastUser(void)
+{
+    return m_lastUser;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Get login user information
+ *
+ *  @return pointer of CicoSCUser
+ */
+//--------------------------------------------------------------------------
+const CicoSCUser*
+CicoSCUserManager::getLoginUser(void)
+{
+    return m_loginUser;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Get userlist
+ *
+ *  @return pointer of userlist
+ */
+//--------------------------------------------------------------------------
+const vector<CicoSCUser*>&
+CicoSCUserManager::getUserList(void)
+{
+    return m_userList;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Get homescreen list
+ *
+ *  @return pointer of homescreen list
+ */
+//--------------------------------------------------------------------------
+const vector<string>&
+CicoSCUserManager::getHomeScreenList(void)
+{
+    return m_homescreenList;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Change login user
+ *
+ *  @param  [IN] name           user name
+ *  @param  [IN] passwd         password
+ *  @return none
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCUserManager::changeUser(const string & name, const string & passwd)
+{
+    ICO_DBG("CicoSCUserManager::changeUser Enter"
+            "(user=%s pass=%s)", name.c_str(), passwd.c_str());
+
+    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());
+        return;
+    }
+
+    // check password
+    if (passwd != conf->passwd) {
+        ICO_ERR("user \"%s\" invalid password", name.c_str());
+        return;
+    }
+
+    // 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());
+
+    // set lastUser
+    m_lastUser = const_cast<CicoSCUser*>(conf);
+    ICO_DBG("last user changed (user=%s)", name.c_str());
+
+    ICO_DBG("CicoSCUserManager::changeUser Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  dump log m_userList member variables
+ *
+ *  @return none
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCUserManager::dumpUserList(void)
+{
+    vector<CicoSCUser*>::iterator itr;
+    itr = m_userList.begin();
+    for (; itr != m_userList.end(); ++itr) {
+        const CicoSCUser* conf = const_cast<CicoSCUser*>(*itr);
+        ICO_DBG("user name=%s, pass=%s, homescreen=%s",
+                (conf->name).c_str(), (conf->passwd).c_str(),
+                (conf->homescreen).c_str());
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  dump log m_homescreenList member variables
+ *
+ *  @return none
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCUserManager::dumpHomeScreenList(void)
+{
+    vector<string>::iterator itr;
+    itr = m_homescreenList.begin();
+    for (; itr != m_homescreenList.end(); ++itr) {
+        ICO_DBG("homescreen=%s", (*itr).c_str());
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Callback of "get userlist"
+ *
+ *  @param  [IN] appid          application id to send message
+ *
+ *  @return none
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCUserManager::userlistCB(const string & appid)
+{
+    ICO_DBG("CicoSCUserManager::userlistCB Enter");
+
+    // send message
+    CicoSCMessage *message = new CicoSCMessage();
+    message->addRootObject("command", MSG_CMD_GET_USERLIST);
+    message->addRootObject("appid", appid);
+    // set number of user
+    message->addArgObject("user_num", m_userList.size());
+    // set user list
+    vector<CicoSCUser*>::iterator itr;
+    itr = m_userList.begin();
+    for (; itr != m_userList.end(); ++itr) {
+        const CicoSCUser* conf = const_cast<CicoSCUser*>(*itr);
+        message->addElmArray(conf->name);
+    }
+    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);
+    }
+
+    CicoSCServer::getInstance()->sendMessage(appid, message);
+
+    ICO_DBG("CicoSCUserManager::userlistCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Set default user information
+ *
+ *  @param  [IN] root           pointer of ptree object
+ *  @return none
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCUserManager::setDefaultUser(const ptree & root)
+{
+    ICO_DBG("CicoSCUserManager::setDefaultUser Enter");
+
+    if (NULL == m_defaultUser) {
+        m_defaultUser = new CicoSCUser();
+    }
+
+    ptree default_user = root.get_child("userconfig.default");
+
+    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_defaultUser->name = name.get();
+    }
+
+    /* 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;
+        }
+    }
+
+    /* 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;
+    }
+
+    // dump data
+    m_defaultUser->dump();
+
+    ICO_DBG("CicoSCUserManager::setDefaultUser Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Set last user information
+ *
+ *  @param  [IN] root           pointer of ptree object
+ *  @return none
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCUserManager::setLastUser(const ptree & root)
+{
+// TODO
+    ICO_DBG("CicoSCUserManager::setLastUser Enter");
+
+    if (NULL == m_lastUser) {
+        m_lastUser = m_defaultUser;
+    }
+
+    // dump data
+    //m_lastUser->dump();
+
+    ICO_DBG("CicoSCUserManager::setLastUser Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Set login user information
+ *
+ *  @param  [IN] user           pointer of CicoSCUser
+ *  @return none
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCUserManager::setLoginUser(const CicoSCUser * user)
+{
+// TODO
+    ICO_DBG("CicoSCUserManager::setLoginUser Enter");
+
+    if (NULL == user) {
+        m_loginUser = m_defaultUser;
+    }
+    else {
+        m_loginUser = const_cast<CicoSCUser*>(user);
+    }
+    // dump data
+    m_loginUser->dump();
+
+    ICO_DBG("CicoSCUserManager::setLoginUser Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Create userlist
+ *
+ *  @param  [IN] root           pointer of ptree object
+ *  @return none
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCUserManager::createUserList(const ptree & root)
+{
+    ICO_DBG("CicoSCUserManager::createUserList Enter");
+
+    ptree homescreens = root.get_child("userconfig.users");
+
+    BOOST_FOREACH (const ptree::value_type& child, homescreens) {
+        if (0 != strcmp(child.first.data(), "user")) {
+            ICO_ERR("unknown element (%s)", child.first.data());
+        }
+
+        // get value
+        optional<string> name;
+        optional<string> passwd;
+        optional<string> homescreen;
+
+        name = child.second.get_optional<string>("name");
+        if (false == name.is_initialized()) {
+            ICO_ERR("user.name element not found");
+            continue;
+        }
+        passwd = child.second.get_optional<string>("passwd");
+        if (false == passwd.is_initialized()) {
+            ICO_ERR("user.passwd element not found");
+            continue;
+        }
+        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();
+        // dump data
+        userConf->dump();
+
+        // add object to the list
+        m_userList.push_back(userConf);
+    }
+
+    ICO_DBG("CicoSCUserManager::createUserList Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Create homescreen list
+ *
+ *  @param  [IN] root           pointer of ptree object
+ *  @return none
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCUserManager::createHomeScreenList(const ptree & root)
+{
+    ICO_DBG("CicoSCUserManager::createHomeScreenList Enter");
+
+    ptree homescreens = root.get_child("userconfig.homescreens");
+
+    BOOST_FOREACH (const ptree::value_type& child, homescreens) {
+        if (0 != strcmp(child.first.data(), "homescreen")) {
+            ICO_ERR("unknown element (%s)", child.first.data());
+        }
+        // get value
+        optional<string> name;
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            ICO_ERR("homescreen.name attr not found");
+            continue;
+        }
+        // add value to the list
+        m_homescreenList.push_back(name.get());
+    }
+    // dump data
+    dumpHomeScreenList();
+
+    ICO_DBG("CicoSCUserManager::createHomeScreenList Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Find user configuration by user name
+ *
+ *  @param  [IN] name           user name
+ *  @return pointer of CicoSCUser data on success, NULL on error
+ */
+//--------------------------------------------------------------------------
+const CicoSCUser*
+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");
+            return conf;
+        }
+    }
+
+    ICO_ERR("CicoSCUserManager::findUserConfbyName Leave (NOT find)");
+    return NULL;
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCUserManager.h b/lib/system-controller/CicoSCUserManager.h
new file mode 100644 (file)
index 0000000..755165d
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * 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   CicoSCUserManager.h
+ *
+ * @date    Aug-21-2013
+ */
+
+#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"
+
+class CicoSCUserManager
+{
+public:
+    // get CicoSCUserManager instance
+    static CicoSCUserManager* getInstance(void);
+
+    // handle command
+    void handleCommand(const CicoSCCommand * cmd);
+
+    // load configuration file
+    int load(const 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);
+
+    // change user
+    void changeUser(const string & name, const string & passwd);
+
+    // dump log
+    void dumpUserList(void);
+    void dumpHomeScreenList(void);
+
+private:
+    // default constructor
+    CicoSCUserManager();
+
+    // destructor
+    ~CicoSCUserManager();
+
+    // assignment operator
+    CicoSCUserManager& operator=(const CicoSCUserManager &object);
+
+    // copy constoructor
+    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);
+    // create list from config file
+    void createUserList(const ptree & root);
+    void createHomeScreenList(const ptree & root);
+
+    // find user config by user name
+    const CicoSCUser* findUserConfbyName(const string & name);
+
+private:
+    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
+};
+#endif  // __CICO_SC_USER_MANAGER_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCWayland.cpp b/lib/system-controller/CicoSCWayland.cpp
new file mode 100644 (file)
index 0000000..0928285
--- /dev/null
@@ -0,0 +1,337 @@
+/*
+ * 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   CicoSCWayland.cpp
+ *
+ *  @brief  
+ */
+/*========================================================================*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <errno.h>
+
+
+#include <sys/ioctl.h>
+#include <Ecore.h>
+
+#include <algorithm>
+
+#include "wayland-client.h"
+#include "ico_window_mgr-client-protocol.h"
+#include "CicoSCWayland.h"
+#include "CicoSCWlWinMgrIF.h"
+#include "CicoLog.h"
+
+CicoSCWayland* CicoSCWayland::ms_myInstance = NULL;
+
+CicoSCWayland::CicoSCWayland()
+    : m_wlDisplay(NULL),
+      m_wlOutput(NULL),
+      m_wlFd(-1),
+      m_ecoreFdHandler(NULL)
+{
+}
+
+CicoSCWayland::~CicoSCWayland()
+{
+}
+
+CicoSCWayland*
+CicoSCWayland::getInstance(void)
+{
+       if (NULL == ms_myInstance) {
+               ms_myInstance = new CicoSCWayland();
+       }
+
+       return ms_myInstance;
+}
+
+int
+CicoSCWayland::intialize(void)
+{
+    ICO_DBG("CicoSCWayland::initialize: Enter");
+    // 
+    for (int i = 0; i < (5000/50); ++i)  {
+        m_wlDisplay = wl_display_connect(NULL);
+        if (NULL != m_wlDisplay) {
+            break;
+        }
+        usleep(50*1000);
+    }
+
+    if (NULL == m_wlDisplay) {
+        ICO_ERR("wl_display_connect failed.");
+        return -1; /* TODO */
+    }
+
+    m_wlRegistry = wl_display_get_registry(m_wlDisplay);
+    if (NULL == m_wlRegistry) {
+        ICO_ERR("wl_display_get_registry failed.");
+        return -1; /* TODO */
+    }
+
+    // wayland callbacks
+    struct wl_registry_listener wlListener = {
+        .global        = wlGlobalCB,
+        .global_remove = NULL
+    };
+
+    // add wayland global callbacks
+    wl_registry_add_listener(m_wlRegistry, &wlListener, this);
+
+    // 
+    int initCount = 0;
+    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);
+        wl_display_dispatch(m_wlDisplay);
+        usleep(20*1000);
+    }
+
+    // flush display 
+    wl_display_flush(m_wlDisplay);
+
+    // 
+    ICO_DBG("call wl_display_get_fd(%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 connect OK");
+
+
+    ICO_DBG("CicoSCWayland::initialize: Leave");
+    return 0; // TODO
+}
+
+void CicoSCWayland::flushDisplay(void)
+{
+    if (NULL == m_wlDisplay) {
+        return;
+    }
+    ICO_DBG("call wl_display_flush(%08x)", (int)m_wlDisplay);
+    wl_display_flush(m_wlDisplay);
+}
+
+void CicoSCWayland::dispatchDisplay(void)
+{
+    if (NULL == m_wlDisplay) {
+        return;
+    }
+    ICO_DBG("call wl_display_dispatch(%08x)", (int)m_wlDisplay);
+    wl_display_dispatch(m_wlDisplay);
+}
+
+int CicoSCWayland::getWlFd(void)
+{
+    return m_wlFd;
+}
+
+int
+CicoSCWayland::addEcoreMainWlFdHandler(void)
+{
+    ICO_DBG("waylandFdHandler: Enter");
+    m_ecoreFdHandler = ecore_main_fd_handler_add(m_wlFd, 
+                                                 ECORE_FD_READ,
+                                                 &waylandFdHandler,
+                                                 NULL, /* data */
+                                                 NULL,
+                                                 NULL);
+    ecore_main_loop_iterate();
+    waylandFdHandler(NULL, m_ecoreFdHandler);
+    ICO_DBG("waylandFdHandler: Leave");
+    return 0;
+}
+
+
+void
+CicoSCWayland::addWaylandIF(const char *name, CicoSCWaylandIF* interface)
+{
+    m_wlInterfaceList[name] = interface;
+}
+
+/* wayland standard callback functions      */
+void
+CicoSCWayland::globalCB(void *data,
+                        struct wl_registry *registry,
+                        uint32_t name,
+                        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);
+
+    if (m_wlInterfaceList.end() == itr) {
+        ICO_DBG("skip interface=%s", interface);
+        return;
+    }
+
+    CicoSCWaylandIF *wlIF = itr->second;
+    wlIF->initInterface(data, registry, name, interface, version);
+
+    // flush display 
+    wl_display_flush(m_wlDisplay);
+//    ICO_DBG("globalCB: Leave");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_uxf_wayland_globalcb: wayland global callback(static function)
+ *
+ * @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
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoSCWayland::wlGlobalCB(void       *data,
+                          struct     wl_registry *registry,
+                          uint32_t   name,
+                          const char *interface,
+                          uint32_t   version)
+{
+//    ICO_DBG("wlGlobalCB: Enter(Event=%s DispId=%08x)", interface, name);
+
+    if (NULL == data) {
+        ICO_DBG("data is 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
+
+Eina_Bool
+CicoSCWayland::waylandFdHandler(void *data, Ecore_Fd_Handler *handler)
+{
+    ICO_DBG("waylandFdHandler: Enter");
+
+    int arg = 0;
+
+    CicoSCWayland* scWayland = CicoSCWayland::getInstance();
+    
+    scWayland->flushDisplay();
+
+    if (ioctl(scWayland->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();
+    }
+
+    scWayland->flushDisplay();
+    ICO_DBG("waylandFdHandler: Leave)");
+    return EINA_TRUE;
+}
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/lib/system-controller/CicoSCWayland.h b/lib/system-controller/CicoSCWayland.h
new file mode 100644 (file)
index 0000000..47818c6
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * 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   CicoSCWayland.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+#ifndef __CICO_SC_WAYLAND_H__
+#define __CICO_SC_WAYLAND_H__
+
+#include <vector>
+#include <map>
+using namespace std;
+
+#include <Ecore.h>
+
+#include <wayland-client.h>
+#include <ico_window_mgr-client-protocol.h>
+#include "CicoSCDisplay.h"
+
+class CicoSCWaylandIF;
+
+class CicoSCWayland {
+public:
+    static CicoSCWayland* getInstance();
+
+    int intialize(void);
+
+    void flushDisplay(void);
+    void dispatchDisplay(void);
+    int getWlFd(void);
+    int addEcoreMainWlFdHandler(void);
+    void addWaylandIF(const char *name, CicoSCWaylandIF* interface);
+
+    static Eina_Bool waylandFdHandler(void *data, Ecore_Fd_Handler *handler);
+
+    /* wayland standard callback functions      */
+    void globalCB(void *data,
+                  struct wl_registry *registry,
+                  uint32_t name,
+                  const char *interface,
+                  uint32_t version);
+
+private:
+    static void wlGlobalCB(void       *data,
+                           struct     wl_registry *registry,
+                           uint32_t   name,
+                           const char *interface,
+                           uint32_t   version);
+
+private:
+    // default constructor
+    CicoSCWayland();
+
+    // destructor
+    ~CicoSCWayland();
+
+    // assignment operator
+    CicoSCWayland& operator=(const CicoSCWayland &object);
+
+    // copy constructor
+    CicoSCWayland(const CicoSCWayland &object);
+
+private:
+    /* my instance */
+    static CicoSCWayland *ms_myInstance;
+
+    /* Wayland's display                */
+    struct wl_display *m_wlDisplay;
+
+    struct wl_registry *m_wlRegistry;
+
+    /* Wayland's output describes       */
+    struct wl_output *m_wlOutput;
+
+    /* Wayland's file descriptor        */
+    int m_wlFd;
+
+    Ecore_Fd_Handler         *m_ecoreFdHandler;
+
+    map<string, CicoSCWaylandIF*> m_wlInterfaceList;
+};
+#endif // __CICO_SC_WAYLAND_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCWaylandIF.cpp b/lib/system-controller/CicoSCWaylandIF.cpp
new file mode 100644 (file)
index 0000000..71687b3
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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   CicoSCWaylandIF.cpp
+ *
+ *  @brief  
+ */
+//==========================================================================
+
+#include "CicoSCWaylandIF.h"
+#include "CicoLog.h"
+
+
+const char * CicoSCWaylandIF::ICO_WL_WIN_MGR_IF        = "ico_window_mgr";
+const char * CicoSCWaylandIF::ICO_WL_INPUT_MGR_CTRL_IF = "ico_input_mgr_control";
+const char * CicoSCWaylandIF::ICO_WL_EXINPUT_IF        = "ico_exinput";
+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";
+
+CicoSCWaylandIF::CicoSCWaylandIF()
+      : m_initialized(false)
+{
+}
+
+CicoSCWaylandIF::~CicoSCWaylandIF()
+{
+}
+
+void
+CicoSCWaylandIF::initInterface(void               *data,
+                               struct wl_registry *registry,
+                               uint32_t           name,
+                               const char         *interface,
+                               uint32_t           version)
+{
+    ICO_WRN("CicoSCWaylandIF::initInterface called.");
+}
+
+bool
+CicoSCWaylandIF::isInitialized(void)
+{
+    return m_initialized;
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCWaylandIF.h b/lib/system-controller/CicoSCWaylandIF.h
new file mode 100644 (file)
index 0000000..898ac79
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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   CicoSCWaylandIF.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+#ifndef __CICO_SC_WAYLAND_IF_H__
+#define __CICO_SC_WAYLAND_IF_H__
+
+#include <string>
+#include <wayland-client.h>
+
+using namespace std;
+
+class CicoSCWaylandIF {
+public:
+    // intialize interface
+    virtual void initInterface(void               *data,
+                               struct wl_registry *registry,
+                               uint32_t           name,
+                               const char         *interface,
+                               uint32_t           version);
+    bool isInitialized(void);
+
+protected:
+    // default constructor
+    CicoSCWaylandIF();
+
+    // destructor
+    virtual ~CicoSCWaylandIF();
+
+    // assignment operator
+    CicoSCWaylandIF& operator=(const CicoSCWaylandIF &object);
+
+    // copy constructor
+    CicoSCWaylandIF(const CicoSCWaylandIF &object);
+
+protected:
+    static const char * ICO_WL_WIN_MGR_IF;
+    static const char * ICO_WL_INPUT_MGR_CTRL_IF;
+    static const char * ICO_WL_EXINPUT_IF;
+    static const char * ICO_WL_INPUT_MGR_DEV_IF;
+    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__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCWindow.cpp b/lib/system-controller/CicoSCWindow.cpp
new file mode 100644 (file)
index 0000000..8d7730b
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * 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   CicoSCWindow.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+
+#include "CicoSCWindow.h"
+#include "CicoLog.h"
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
+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),
+      visible(false), raise(false), active(false)
+
+{
+    ICO_DBG("CicoSCWindow::CicoSCWindow Entry");
+    ICO_DBG("CicoSCWindow::CicoSCWindow Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
+CicoSCWindow::~CicoSCWindow()
+{
+    ICO_DBG("CicoSCWindow::~CicoSCWindow Entry");
+    ICO_DBG("CicoSCWindow::~CicoSCWindow Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  dump log CicoSCWindow member variables
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWindow::dump(void)
+{
+    ICO_DBG("CicoSCWindow: surfaceid=%d 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",
+            surfaceid, name.c_str(), appid.c_str(), pid, nodeid, displayid,
+            layerid, zoneid, subwindow, eventmask, x, y, width, height,
+            visible ? "true" : "false", raise ? "true" : "false",
+            active ? "true" : "false");
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCWindow.h b/lib/system-controller/CicoSCWindow.h
new file mode 100644 (file)
index 0000000..1702a31
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * 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   CicoSCWindow.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+#ifndef __CICO_SC_WINDOW_H__
+#define __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_NODEID(surfid)      (((unsigned int)surfid) >> 16)
+#define ICO_SURFACEID_BASE(nodeid)          (((unsigned int)nodeid) << 16)
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief window information class
+ */
+//--------------------------------------------------------------------------
+class CicoSCWindow
+{
+public:
+    // default constructor
+    CicoSCWindow();
+
+    // destructor
+    virtual ~CicoSCWindow();
+
+    // dump log CicoSCWindow member variables
+    void dump(void);
+
+private:
+    // assignment operator
+    CicoSCWindow& operator=(const CicoSCWindow &object);
+
+    // copy constructor
+    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               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
+};
+#endif // __CICO_SC_WINDOW_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCWindowController.cpp b/lib/system-controller/CicoSCWindowController.cpp
new file mode 100644 (file)
index 0000000..55c8032
--- /dev/null
@@ -0,0 +1,1617 @@
+/*
+ * 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   CicoSCWindowController.cpp
+ *
+ *  @brief  
+ */
+//==========================================================================
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+
+#include <vector>
+#include <algorithm>
+using namespace std;
+
+#include "CicoSCWindow.h"
+#include "CicoSCWayland.h"
+#include "CicoSCWindowController.h"
+#include "CicoLog.h"
+
+#include "CicoSCSystemConfig.h"
+#include "CicoSCConf.h"
+#include "CicoSCDisplay.h"
+#include "CicoSCLayer.h"
+#include "CicoSCDisplayZone.h"
+#include "ico_syc_error.h"
+#include "CicoSCCommandParser.h"
+#include "ico_syc_msg_cmd_def.h"
+#include "CicoSCServer.h"
+#include "CicoSCMessage.h"
+#include "CicoSCLifeCycleController.h"
+#include "CicoSCResourceManager.h"
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
+CicoSCWindowController::CicoSCWindowController()
+    : m_resMgr(NULL)
+{
+    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();
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
+CicoSCWindowController::~CicoSCWindowController()
+{
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  initialize display and window database
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWindowController::initDB(void)
+{
+    ICO_DBG("CicoSCWindowController::initDB: Enter");
+
+    const vector<CicoSCDisplayConf*>& displayList =
+            CicoSCSystemConfig::getInstance()->getDisplayConfList();
+    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;
+
+        vector<CicoSCLayerConf*>::const_iterator itr2;
+        itr2 = dconf->layerConfList.begin();
+        for (; itr2 != dconf->layerConfList.end(); ++itr2) {
+            const CicoSCLayerConf *lconf = const_cast<CicoSCLayerConf*>(*itr2);
+
+            CicoSCLayer *layer = new CicoSCLayer();
+            layer->layerid     = lconf->id;
+            layer->type        = lconf->type;
+            layer->width       = display->width;
+            layer->height      = display->height;
+            layer->displayid   = display->displayid;
+            layer->menuoverlap = lconf->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);
+
+            CicoSCDisplayZone *zone = new CicoSCDisplayZone();
+            zone->zoneid = (*itr3)->id;
+            zone->x      = (*itr3)->x;
+            zone->y      = (*itr3)->y;
+            zone->width  = (*itr3)->w;
+            zone->height = (*itr3)->h;
+            display->zoneList.push_back(zone);
+        }
+        display->dump();
+        m_displayList.push_back(display);
+
+        display->dump();
+        m_displayList.push_back(display);
+    }
+
+    ICO_DBG("CicoSCWindowController::initDB: Leave");
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   set resource manager instance
+ *
+ *  @param [in] resMgr  resource manager instance
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWindowController::setResourceManager(CicoSCResourceManager *resMgr)
+{
+    m_resMgr = resMgr;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   show a target window
+ *
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] animation       animation name
+ *  @param [in] animationTime   animation time
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ *  @retval ICO_SYC_EOK         success
+ *  @retval ICO_SYC_ESRCH       error(not initialized)
+ *  @retval ICO_SYC_ENOENT      error(not exist)
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWindowController::show(int        surfaceid,
+                             const char *animation,
+                             int        animationTime)
+{
+    ICO_DBG("CicoSCWindowController::show Enter"
+            "(surfaceid=%08X animation=%s animationTime=%d)",
+            surfaceid, animation, animationTime);
+
+    // find window infomation in window list
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        ICO_WRN("CicoSCWindowController::show Leave(ENOENT)");
+        return ICO_SYC_ENOENT;
+    }
+
+    // update visible attr
+    window->visible = true;
+
+    // set animation request to Multi Window Manager
+    int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
+    int raiseFlag = ICO_WINDOW_MGR_RAISE_RAISE;
+    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);
+        animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
+        raiseFlag = ICO_WINDOW_MGR_V_NOCHANGE;
+    }
+
+    // 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);
+
+    // flush display 
+    CicoSCWayland::getInstance()->flushDisplay();
+
+    ICO_DBG("CicoSCWindowController::show Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   hide a target window
+ *
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] animation       animation name
+ *  @param [in] animationTime   animation time
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ *  @retval ICO_SYC_EOK         success
+ *  @retval ICO_SYC_ESRCH       error(not initialized)
+ *  @retval ICO_SYC_ENOENT      error(not exist)
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWindowController::hide(int        surfaceid,
+                             const char *animation,
+                             int        animationTime)
+{
+    ICO_DBG("CicoSCWindowController::hide Enter"
+            "(surfaceid=%08X animation=%s animationTime=%d)",
+            surfaceid, animation, animationTime);
+
+    // find window infomation in window list
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        ICO_WRN("CicoSCWindowController::hide Leave(ENOENT)");
+        return ICO_SYC_ENOENT;
+    }
+
+    // update window attr
+    window->visible = false;
+
+    // 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);
+        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);
+
+    // flush display 
+    CicoSCWayland::getInstance()->flushDisplay();
+
+    ICO_DBG("CicoSCWindowController::hide Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   resize window(surface) size
+ *
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] w               window width
+ *  @param [in] h               window height
+ *  @param [in] animation       animation name
+ *  @param [in] animationTime   animation time
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ *  @retval ICO_SYC_EOK         success
+ *  @retval ICO_SYC_ESRCH       error(not initialized)
+ *  @retval ICO_SYC_ENOENT      error(window dose not exist)
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWindowController::resize(int        surfaceid,
+                               int        w,
+                               int        h,
+                               const char *animation,
+                               int        animationTime)
+{
+    ICO_DBG("CicoSCWindowController::resize Enter"
+            "(surfaceid=%08X h=%d w=%d animation=%s animationTime=%d)",
+            surfaceid, w, h, animation, animationTime);
+
+    // find window infomation in window list
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        ICO_WRN("CicoSCWindowController::resize Leave(ENOENT)");
+        return ICO_SYC_ENOENT;
+    }
+
+    // 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);
+        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);
+
+    // flush display 
+    CicoSCWayland::getInstance()->flushDisplay();
+
+    ICO_DBG("CicoSCWindowController::resize Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  move window(surface) size 
+ *
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] nodeid          node id
+ *  @param [in] x               window width
+ *  @param [in] y               window height
+ *  @param [in] animation       animation name
+ *  @param [in] animationTime   animation time
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ *  @retval ICO_SYC_EOK         success
+ *  @retval ICO_SYC_ESRCH       error(not initialized)
+ *  @retval ICO_SYC_ENOENT      error(window dose not exist)
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWindowController::move(int        surfaceid,
+                             int        nodeid,
+                             int        x,
+                             int        y,
+                             const char *animation,
+                             int        animationTime)
+{
+    ICO_DBG("CicoSCWindowController::move Enter"
+            "(surfaceid=%08X nodeid=%d x=%d y=%d "
+            "animation=%s animationTime=%d)",
+            surfaceid, nodeid, x, y, animation, animationTime);
+
+    // find window infomation in window list
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        ICO_WRN("CicoSCWindowController::move Leave(ENOENT)");
+        return ICO_SYC_ENOENT;
+    }
+
+    // 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);
+        animaFlag = ICO_WINDOW_MGR_FLAGS_ANIMATION;
+    }
+
+    int moveNodeId = ICO_WINDOW_MGR_V_NOCHANGE;
+    if (nodeid >= 0) {
+        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);
+
+    // flush display 
+    CicoSCWayland::getInstance()->flushDisplay();
+
+    ICO_DBG("CicoSCWindowController::move Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  raise window(surface)
+ *
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] animation       animation name
+ *  @param [in] animationTime   animation time
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ *  @retval ICO_SYC_EOK         success
+ *  @retval ICO_SYC_ESRCH       error(not initialized)
+ *  @retval ICO_SYC_ENOENT      error(layer dose not exist)
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWindowController::raise(int        surfaceid,
+                              const char *animation,
+                              int        animationTime)
+{
+    ICO_DBG("CicoSCWindowController::raise Enter"
+            "(surfaceid=%08X animation=%s animationTime=%d)",
+            surfaceid, animation, animationTime);
+
+    // find window infomation in window list
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        ICO_WRN("CicoSCWindowController::raise Leave(ENOENT)");
+        return ICO_SYC_ENOENT;
+    }
+
+    // update visible attr
+    window->raise = true;
+
+    // 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);
+        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);
+
+    // flush display 
+    CicoSCWayland::getInstance()->flushDisplay();
+
+    ICO_DBG("CicoSCWindowController::raise Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  set window(surface) geometry
+ *
+ *  @param [in] surfaceid           wayland surface id
+ *  @param [in] nodeid              node id
+ *  @param [in] x                   window x position
+ *  @param [in] y                   window y position
+ *  @param [in] w                   window width
+ *  @param [in] h                   window height
+ *  @param [in] resizeAnimation     resize animation name
+ *  @param [in] resizeAnimationTime resize animation time
+ *  @param [in] moveAnimation       move animation name
+ *  @param [in] moveanimationTime   move animation time
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ *  @retval ICO_SYC_EOK         success
+ *  @retval ICO_SYC_ESRCH       error(not initialized)
+ *  @retval ICO_SYC_ENOENT      error(window dose not exist)
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWindowController::setGeometry(int        surfaceid,
+                                    int        nodeid,
+                                    int        x,
+                                    int        y,
+                                    int        w,
+                                    int        h,
+                                    const char *resizeAnimation,
+                                    int        resizeAnimationTime,
+                                    const char *moveAnimation,
+                                    int        moveAnimationTime)
+{
+    ICO_DBG("CicoSCWindowController::setGeometry Enter"
+            "(surfaceid=0x%08X nodeid=%d x=%d y=%d w=%d h=%d "
+            "resizeAnimation=%s resizeAnimationTime=%d "
+            "moveAnimation=%s moveAnimationTime=%d)",
+            surfaceid, nodeid, x, y, w, h,
+            resizeAnimation, resizeAnimationTime,
+            moveAnimation, moveAnimationTime);
+
+    // find window infomation in window list
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        ICO_WRN("CicoSCWindowController::setGeometry Leave(ENOENT)");
+        return ICO_SYC_ENOENT;
+    }
+
+    // set animation request to Multi Window Manager
+    int animaFlag = ICO_WINDOW_MGR_FLAGS_NO_CONFIGURE;
+    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;
+    }
+
+    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;
+    }
+
+    int moveNodeId = ICO_WINDOW_MGR_V_NOCHANGE;
+    if (nodeid >= 0) {
+        moveNodeId = nodeid;
+    }
+    else {
+        moveNodeId = window->nodeid;
+    }
+
+    // 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);
+
+    // flush display 
+    CicoSCWayland::getInstance()->flushDisplay();
+
+    ICO_DBG("CicoSCWindowController::setGeometry Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  lower window(surface)
+ *
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] animation       animation name
+ *  @param [in] animationTime   animation time
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ *  @retval ICO_SYC_EOK         success
+ *  @retval ICO_SYC_ESRCH       error(not initialized)
+ *  @retval ICO_SYC_ENOENT      error(layer dose not exist)
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWindowController::lower(int        surfaceid,
+                              const char *animation,
+                              int        animationTime)
+{
+    ICO_DBG("CicoSCWindowController::lower Enter"
+            "(surfaceid=%08X animation=%s animationTime=%d)",
+            surfaceid, animation, animationTime);
+
+    // find window infomation in window list
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        ICO_WRN("CicoSCWindowController::lower Leave(ENOENT)");
+        return ICO_SYC_ENOENT;
+    }
+
+    // update visible attr
+    window->raise = false;
+
+    // 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);
+        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);
+
+    // flush display 
+    CicoSCWayland::getInstance()->flushDisplay();
+
+    ICO_DBG("CicoSCWindowController::lower Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  set window layer
+ *
+ *  @param [in] surfaceid       wayland surface id
+ *  @param [in] layer           layer id
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ *  @retval ICO_SYC_EOK         success
+ *  @retval ICO_SYC_ESRCH       error(not initialized)
+ *  @retval ICO_SYC_ENOENT      error(window or layer dose not exist)
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWindowController::setWindowLayer(int surfaceid, int layerid)
+{
+    ICO_DBG("CicoSCWindowController::setWindowLayer Enter"
+            "(surfaceid=%08X layerid=%d)", surfaceid, layerid);
+
+    // find window infomation 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
+    CicoSCLayer* layer = findLayer(window->displayid, layerid);
+    if (NULL == layer) {
+        ICO_WRN("CicoSCWindowController::setWindowLayer Leave(ENOENT)");
+        return ICO_SYC_ENOENT;
+    }
+
+    // update window attr
+    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);
+
+    // flush display 
+    CicoSCWayland::getInstance()->flushDisplay();
+
+    ICO_DBG("CicoSCWindowController::setWindowLayer Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   show layer 
+ *
+ *  @param [in] displayid   display id
+ *  @param [in] layerid     layer id
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ *  @retval ICO_SYC_EOK     success
+ *  @retval ICO_SYC_ESRCH   error(not initialized)
+ *  @retval ICO_SYC_ENOENT  error(layer dose not exist)
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWindowController::showLayer(int displayid, int layerid)
+{
+    ICO_DBG("CicoSCWindowController::showLayer Enter"
+            "displayid=%d layerid=%d)", displayid, layerid);
+
+    // find layer infomation 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);
+
+    // flush display 
+    CicoSCWayland::getInstance()->flushDisplay();
+
+    ICO_DBG("CicoSCWindowController::showLayer Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   show layer 
+ *
+ *  @param [in] displayid   display id
+ *  @param [in] layerid     layer id
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ *  @retval ICO_SYC_EOK     success
+ *  @retval ICO_SYC_ESRCH   error(not initialized)
+ *  @retval ICO_SYC_ENOENT  error(layer dose not exist)
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWindowController::hideLayer(int displayid, int layerid)
+{
+    ICO_DBG("CicoSCWindowController::hideLayer Enter"
+            "displayid=%d layerid=%d)",
+            displayid, layerid);
+
+    // find layer infomation 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);
+
+    // flush display 
+    CicoSCWayland::getInstance()->flushDisplay();
+
+    ICO_DBG("CicoSCWindowController::hideVisible Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ *  @param [in] target      target(pointer and/or keyboard)
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ *  @retval ICO_SYC_EOK     success
+ *  @retval ICO_SYC_ESRCH   error(not initialized)
+ *  @retval ICO_SYC_ENOENT  error(layer dose not exist)
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWindowController::active(int surfaceid, int target)
+{
+#if 0
+    Ico_Uxf_Mng_Window  *winmng;
+    Ico_Uxf_Mng_Process *proc;
+    Ico_Uxf_Mng_Process *aproc;
+    int                 hash;
+#endif
+
+    ICO_DBG("CicoSCWindowController::active Enter"
+            "(surfaceid=%08X, target=%08X)", surfaceid, target);
+
+    // find window infomation in window list
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        ICO_WRN("CicoSCWindowController::active Leave(ENOENT)");
+        return ICO_SYC_ENOENT;
+    }
+
+    if (target < 0) {
+        target = ICO_WINDOW_MGR_ACTIVE_POINTER  |
+                 ICO_WINDOW_MGR_ACTIVE_KEYBOARD |
+                 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);
+
+    // flush display 
+    CicoSCWayland::getInstance()->flushDisplay();
+
+    // update active window
+    map<unsigned int, CicoSCWindow*>::iterator itr;
+    itr = m_windowList.begin();
+    for (; itr != m_windowList.end(); ++itr) {
+        CicoSCWindow* window = itr->second;
+        if (window->surfaceid == surfaceid) {
+            window->active = target;
+        }
+        else {
+            if (target == 0) {
+                window->active = 0;
+            }
+            else {
+                window->active &= ~target;
+            }
+        }
+    }
+
+    // TODO update active application
+#if 0
+    /* reset all active application without this application    */
+    aproc = NULL;
+    for (hash = 0; hash < ICO_UXF_MISC_HASHSIZE; hash++)    {
+        proc = gIco_Uxf_Api_Mng.Hash_ProcessId[hash];
+        while (proc)    {
+            if (proc->attr.mainwin.window == window)    {
+                aproc = proc;
+            }
+            else    {
+                if (target == 0)    {
+                    proc->attr.active = 0;
+                }
+                else    {
+                    proc->attr.active &= ~target;
+                }
+            }
+            proc = proc->nextidhash;
+        }
+    }
+    aproc->attr.active = target;
+#endif
+
+    ICO_DBG("CicoSCWindowController::active Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   map surface
+ *
+ *  @param [in] surfaceid   wayland surface id
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ *  @retval ICO_SYC_EOK     success
+ *  @retval ICO_SYC_ESRCH   error(not initialized)
+ *  @retval ICO_SYC_ENOENT  error(layer dose not exist)
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWindowController::mapSurface(int surfaceid, int framerate)
+{
+    ICO_WRN("CicoSCWindowController::mapSurface Enter");
+
+    // find window infomation 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;
+    }
+
+    ICO_DBG("ico_window_mgr_map_surface(%d, %d) called.",
+            surfaceid, framerate);
+    ico_window_mgr_map_surface(m_winmgr, surfaceid, framerate);
+    ICO_DBG("CicoSCWindowController::mapSurface Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief   unmap surface
+ *
+ *  @param [in] surfaceid   wayland surface id
+ *
+ *  @return ICO_SYC_EOK on success, other on error
+ *  @retval ICO_SYC_EOK     success
+ *  @retval ICO_SYC_ESRCH   error(not initialized)
+ *  @retval ICO_SYC_ENOENT  error(layer dose not exist)
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCWindowController::unmapSurface(int surfaceid)
+{
+    ICO_DBG("CicoSCWindowController::unmapSurface Enter");
+
+    // find window infomation 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);
+
+    ICO_DBG("CicoSCWindowController::unmapSurface Leave(EOK)");
+    return ICO_SYC_EOK;
+}
+
+//--------------------------------------------------------------------------
+/** 
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWindowController::createdCB(void                  *data,
+                                  struct ico_window_mgr *ico_window_mgr,
+                                  uint32_t              surfaceid,
+                                  const char            *winname,
+                                  int32_t               pid,
+                                  const char            *appid)
+{
+    ICO_DBG("CicoSCWindowController::createdCB Enter"
+            "(surfaceid=%08X winname=%s pid=%d appid=%s)",
+            surfaceid, winname, pid, appid);
+
+    CicoSCWindow* window = new CicoSCWindow();
+
+    window->surfaceid = surfaceid;
+    window->name      = winname;
+    window->appid     = appid;
+    window->pid       = pid;
+    window->displayid = ICO_SURFACEID_2_NODEID(surfaceid);
+
+    CicoSCLifeCycleController* appctrl;
+    appctrl = CicoSCLifeCycleController::getInstance();
+    const CicoSCAilItems *ailItem = appctrl->findAIL(appid);
+    if (NULL == ailItem) {
+        const CicoSCAulItems* aulitem = appctrl->findAUL(pid);
+        if (NULL != aulitem) {
+            window->appid = aulitem->m_appid;
+            ICO_DBG("appid=%s", window->appid.c_str());
+            ailItem = appctrl->findAIL(window->appid.c_str());
+        }
+        else {
+            ICO_DBG("aulitem 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
+            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{
+        ICO_WRN("ail item not found.");
+        ICO_WRN("CicoSCWindowController::createdCB Leave(ENOENT)");
+        return;
+    }
+
+    appctrl->enterAUL(appid, pid, window);
+
+    // dump log window infomartion
+    window->dump();
+
+    m_windowList[surfaceid] = window;
+
+    // send message
+    CicoSCMessage *message = new CicoSCMessage();
+    message->addRootObject("command", MSG_CMD_CREATE);
+    message->addRootObject("appid", window->appid);
+    message->addArgObject("surface", window->surfaceid);
+    message->addArgObject("winname", window->name);
+    CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
+
+    if (NULL != m_resMgr) {
+        CicoSCCommand cmd;
+        CicoSCCmdResCtrlOpt *opt = new CicoSCCmdResCtrlOpt();
+
+        cmd.cmdid = MSG_CMD_ACQUIRE_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;
+
+        m_resMgr->handleCommand((const CicoSCCommand&)cmd, true);
+    }
+    else {
+        //show(window->surfaceid, NULL, 0);
+    }
+
+    ICO_DBG("CicoSCWindowController::createdCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWindowController::nameCB(void                  *data,
+                               struct ico_window_mgr *ico_window_mgr,
+                               uint32_t              surfaceid,
+                               const char            *winname)
+{
+    ICO_DBG("CicoSCWindowController::nameCB Enter"
+            "(surfaceid=%08X winname=%s)", surfaceid, winname);
+
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        ICO_DBG("CicoSCWindowController::nameCB Leave");
+        return;
+    }
+
+    ICO_DBG("nameCB: Update window name %s=>%s",
+            window->name.c_str(), winname);
+    window->name = winname;
+
+    ICO_DBG("CicoSCWindowController::nameCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wayland surface destroy callback
+ *
+ *  @param [in] data            user data(unused)
+ *  @param [in] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [in] surfaceid       ico_window_mgr surface Id
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWindowController::destroyedCB(void                  *data,
+                                    struct ico_window_mgr *ico_window_mgr,
+                                    uint32_t              surfaceid)
+{
+    ICO_DBG("CicoSCWindowController::destroyedCB Enter");
+
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        ICO_DBG("CicoSCWindowController::destroyedCB Leave");
+        return;
+    }
+
+    // send message
+    CicoSCMessage *message = new CicoSCMessage();
+    message->addRootObject("command", MSG_CMD_DESTROY);
+    message->addRootObject("appid", window->appid);
+    message->addArgObject("surface", window->surfaceid);
+    message->addArgObject("winname", window->name);
+    CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
+
+    // TODO delete window in application
+
+    // delete window in list
+    m_windowList.erase(window->surfaceid);
+    delete(window);
+    ICO_DBG("CicoSCWindowController::destroyedCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ *                              (1=client request(not changed)/0=changed)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWindowController::visibleCB(void                  *data,
+                                  struct ico_window_mgr *ico_window_mgr,
+                                  uint32_t              surfaceid,
+                                  int32_t               visible,
+                                  int32_t               raise,
+                                  int32_t               hint)
+{
+    ICO_DBG("CicoSCWindowController::visibleCB Enter"
+            "(surfaceid=%08X visible=%d raise=%d hint=%d)",
+            surfaceid, visible, raise, hint);
+
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        ICO_DBG("CicoSCWindowController::visibleCB Leave");
+        return;
+    }
+
+    int newVisible = visible;
+    int newRaise   = raise;
+
+    if (visible == ICO_WINDOW_MGR_V_NOCHANGE) {
+        newVisible = window->visible;
+    }
+
+    if (raise == ICO_WINDOW_MGR_V_NOCHANGE) {
+        newVisible = window->raise;
+    }
+
+    if ((window->visible == newVisible) && (window->raise == newRaise) ){
+        ICO_DBG("CicoSCWindowController::visibleCB Leave");
+        return;
+    }
+
+    // notify homescreen
+    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::visibleCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ *                              (1=client request(not changed)/0=changed)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWindowController::configureCB(void                  *data,
+                                    struct ico_window_mgr *ico_window_mgr,
+                                    uint32_t              surfaceid,
+                                    uint32_t              node,
+                                    uint32_t              layer,
+                                    int32_t               x,
+                                    int32_t               y,
+                                    int32_t               width,
+                                    int32_t               height,
+                                    int32_t               hint)
+{
+    ICO_DBG("CicoSCWindowController::configureCB Enter"
+            "surfaceid=%08X node=%d layer=%d x=%d y=%d "
+            "width=%d height=%d hint=%d",
+            surfaceid, node, layer, x, y, width, height, hint);
+
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        ICO_DBG("CicoSCWindowController::visibleCB Leave"
+                "(update window visible failed)");
+        return;
+    }
+
+    if (ICO_WINDOW_MGR_HINT_CHANGE == hint) {
+        window->x      = x;
+        window->y      = y;
+        window->width  = width;
+        window->height = height;
+#if 0
+        if (window->layerid != layer) {
+            window->layerid = layer;
+            layer = findLayer(window->displayid, layer);
+        }
+#endif
+    }
+
+    // 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::configureCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ *                              (1=active/0=not active)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWindowController::activeCB(void                  *data,
+                                 struct ico_window_mgr *ico_window_mgr,
+                                 uint32_t              surfaceid,
+                                 int32_t               active)
+{
+    ICO_DBG("CicoSCWindowController::activeCB Enter"
+            "(surfaceid=%08X active=%d)", surfaceid, active);
+
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        ICO_DBG("CicoSCWindowController::activeCB Leave");
+        return;
+    }
+
+    // send message
+    CicoSCMessage *message = new CicoSCMessage();
+    message->addRootObject("command", MSG_CMD_CHANGE_ACTIVE);
+    message->addRootObject("appid", window->appid);
+    message->addArgObject("surface", window->surfaceid);
+    message->addArgObject("winname", window->name);
+    CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
+
+    ICO_DBG("CicoSCWindowController::activeCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWindowController::layerVisibleCB(void                  *data,
+                                       struct ico_window_mgr *ico_window_mgr,
+                                       uint32_t              layer,
+                                       int32_t               visible)
+{
+    ICO_DBG("CicoSCWindowController::layerVisibleCB Enter"
+            "layer=%d visible=%d)", layer, visible);
+
+    // send message
+    CicoSCMessage *message = new CicoSCMessage();
+    message->addRootObject("command", MSG_CMD_CHANGE_LAYER_ATTR);
+    message->addRootObject("appid", "");
+    message->addArgObject("layer", layer);
+    message->addArgObject("visible", visible);
+    CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
+
+    ICO_DBG("CicoSCWindowController::layerVisibleCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  query applicationsurface 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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWindowController::appSurfacesCB(void                  *data,
+                                      struct ico_window_mgr *ico_window_mgr,
+                                      const char            *appid,
+                                      struct wl_array       *surfaces)
+{
+    ICO_DBG("CicoSCWindowController::appSurfacesCB Enter(appid=%s)", appid);
+
+    //struct wl_array {
+    //  size_t size;
+    //  size_t alloc;
+    //  void *data;
+    //};
+    uint32_t **p;
+    for (p = (uint32_t**)(surfaces)->data;
+         (const char*) p < ((const char*) (surfaces)->data + (surfaces)->size);
+         (p)++) {
+        ICO_DBG("appSurfacesCB: surface=%d", (int)*p);
+    }
+
+    ICO_DBG("CicoSCWindowController::appSurfacesCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWindowController::mapSurfaceCB(void                  *data,
+                                     struct ico_window_mgr *ico_window_mgr,
+                                     int32_t               event,
+                                     uint32_t              surfaceid,
+                                     int32_t               width,
+                                     int32_t               height,
+                                     int32_t               stride,
+                                     int32_t               format)
+{
+    ICO_DBG("CicoSCWindowController::mapSurfaceCB Enter"
+            "(event=%d surface=%d width=%d height=%d stride=%d format=%d)",
+            event, surfaceid, width, height, stride, format);
+
+    CicoSCWindow *window = findWindow(surfaceid);
+    if (NULL == window) {
+        return;
+    }
+
+    // send message
+    CicoSCMessage *message = new CicoSCMessage();
+    message->addRootObject("command", MSG_CMD_MAP_THUMB);
+    message->addRootObject("appid", window->appid);
+    message->addArgObject("surface", window->surfaceid);
+    message->addArgObject("width", width);
+    message->addArgObject("height", height);
+    message->addArgObject("stride", stride);
+    message->addArgObject("format", format);
+    CicoSCServer::getInstance()->sendMessageToHomeScreen(message);
+
+    ICO_DBG("CicoSCWindowController::mapSurfaceCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWindowController::outputGeometryCB(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("CicoSCWlWinMgrIF::outputGeometryCB Enter"
+            "(x=%d y=%d physical_width=%d physical_height=%d "
+            "subpixel=%d make=%s model=%s transform=%d)",
+            x, y, physical_width, physical_height,
+            subpixel, make, model, transform);
+
+    if (0 == m_displayList.size()) {
+        ICO_DBG("CicoSCWlWinMgrIF::outputGeometryCB Leave(display is zero");
+        return;
+    }
+
+    CicoSCDisplay* display = m_displayList.at(0);
+    switch (transform) {
+    case WL_OUTPUT_TRANSFORM_90:
+    case WL_OUTPUT_TRANSFORM_270:
+    case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+    case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+        display->pWidth      = physical_height;
+        display->pHeight     = physical_width;
+        display->orientation = CicoSCDisplay::ORIENTATION_VERTICAL;
+        break;
+    case WL_OUTPUT_TRANSFORM_NORMAL:
+    case WL_OUTPUT_TRANSFORM_180:
+    case WL_OUTPUT_TRANSFORM_FLIPPED:
+    case WL_OUTPUT_TRANSFORM_FLIPPED_180:
+    default:
+        display->pWidth      = physical_width;
+        display->pHeight     = physical_height;
+        display->orientation = CicoSCDisplay::ORIENTATION_HORIZONTAL;
+        break;
+    }
+    display->dump();
+
+    ICO_DBG("CicoSCWlWinMgrIF::outputGeometryCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWindowController::outputModeCB(void             *data,
+                                     struct wl_output *wl_output,
+                                     uint32_t         flags,
+                                     int32_t          width,
+                                     int32_t          height,
+                                     int32_t          refresh)
+{
+    ICO_DBG("CicoSCWlWinMgrIF::outputModeCB Enter"
+            "(flags=%d width=%d height=%d refresh=%d)",
+            flags, width, height, refresh);
+
+    if (0 == m_displayList.size()) {
+        ICO_DBG("CicoSCWlWinMgrIF::outputModeCB Leave(display is zero");
+        return;
+    }
+
+    CicoSCDisplay* display = m_displayList.at(0);
+    if (flags & WL_OUTPUT_MODE_CURRENT) {
+        if (display->orientation == CicoSCDisplay::ORIENTATION_VERTICAL) {
+            display->pWidth  = height;
+            display->pHeight = width;
+        }
+        else {
+            display->pWidth  = width;
+            display->pHeight = height;
+        }
+        display->dump();
+    }
+
+    ICO_DBG("CicoSCWlWinMgrIF::outputModeCB Leave");
+}
+
+//==========================================================================
+// private method
+//==========================================================================
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  find window object by surfaceid
+ *
+ *  @param [in] surfaceid   wayland surface id
+ */
+//--------------------------------------------------------------------------
+CicoSCWindow*
+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);
+        return NULL;
+    }
+
+    return itr->second;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  find window object by surfaceid
+ *
+ *  @param [in] surfaceid   wayland surface id
+ */
+//--------------------------------------------------------------------------
+CicoSCLayer*
+CicoSCWindowController::findLayer(int displayid, int layerid)
+{
+    CicoSCDisplay* display = NULL;
+    CicoSCLayer* layer = NULL;
+    try {
+        display = m_displayList.at(displayid);
+        layer = display->layerList.at(layerid);
+    }
+    catch (const std::exception& e) {
+        ICO_ERR("catch exception %s", e.what());
+        return NULL;
+    }
+    catch (...) {
+        ICO_ERR("catch exception unknown");
+        return NULL;
+    }
+    return layer;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  handle command
+ *
+ *  @param [in] commnad     control commnad
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWindowController::handleCommand(const CicoSCCommand * cmd)
+{
+    ICO_DBG("CicoSCWindowController::handleCommand Enter(%d)", cmd->cmdid);
+
+    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);
+        break;
+    case MSG_CMD_HIDE:
+        ICO_DBG("command: MSG_CMD_HIDE");
+        ret = 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, 
+                          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);
+        break;
+    case MSG_CMD_CHANGE_LAYER:
+        ICO_DBG("command: MSG_CMD_CHANGE_LAYER");
+        ret = setWindowLayer(opt->surfaceid, opt->layerid);
+        break;
+    case MSG_CMD_PREPARE_THUMB:
+        ICO_DBG("command: MSG_CMD_PREPARE_THUMB");
+        ret = mapSurface(opt->surfaceid, opt->framerate);
+        break;
+    case MSG_CMD_UNMAP_THUMB:
+        ICO_DBG("command: MSG_CMD_UNMAP_THUMB");
+        ret = unmapSurface(opt->surfaceid);
+        break;
+    case MSG_CMD_SHOW_LAYER:
+        ICO_DBG("command: MSG_CMD_SHOW_LAYER");
+        ret = showLayer(opt->displayid, opt->layerid);
+        break;
+    case MSG_CMD_HIDE_LAYER:
+        ICO_DBG("command: MSG_CMD_HIDE_LAYER");
+        ret = hideLayer(opt->displayid, opt->layerid);
+        break;
+    default:
+        ICO_WRN("Unknown Commnad(0x%08X)", cmd->cmdid);
+        break;
+    }
+    ICO_DBG("commnd result(%d)", ret);
+
+    ICO_DBG("CicoSCWindowController::handleCommand Leave");
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCWindowController.h b/lib/system-controller/CicoSCWindowController.h
new file mode 100644 (file)
index 0000000..8443292
--- /dev/null
@@ -0,0 +1,210 @@
+/*
+ * 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   CicoSCWindowController.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+#ifndef __CICO_SC_WINDOW_CONTROLLER_H__
+#define __CICO_SC_WINDOW_CONTROLLER_H__
+
+#include <vector>
+#include <map>
+
+using namespace std;
+
+#include "CicoSCWlWinMgrIF.h"
+
+//==========================================================================
+//  Forward declaration
+//==========================================================================
+class CicoSCCommand;
+class CicoSCDisplay;
+class CicoSCLayer;
+class CicoSCWindow;
+class CicoSCResourceManager;
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  window controller
+ */
+//--------------------------------------------------------------------------
+class CicoSCWindowController : public CicoSCWlWinMgrIF
+{
+public:
+    // default constructor
+    CicoSCWindowController();
+
+    // copy constructor
+    virtual ~CicoSCWindowController();
+
+    int initDB(void);
+
+    void handleCommand(const CicoSCCommand * cmd);
+
+    //
+    void setResourceManager(CicoSCResourceManager *resMgr);
+
+    int show(int         surfaceid,
+             const char  *animation,
+             int         animationTime);
+
+    int hide(int         surfaceid,
+             const char  *animation,
+             int         animationTime);
+
+    int resize(int        surfaceid,
+               int        w,
+               int        h,
+               const char *animation,
+               int        animationTime);
+
+    int move(int        surfaceid,
+             int        nodeid,
+             int        x,
+             int        y,
+             const char *animation,
+             int        animationTime);
+
+    int setGeometry(int        surfaceid,
+                    int        nodeid,
+                    int        x,
+                    int        y,
+                    int        w,
+                    int        h,
+                    const char *resizeAnimation,
+                    int        resizeAnimationTime,
+                    const char *moveAnimation,
+                    int        moveAnimationTime);
+
+    int raise(int surfaceid,
+             const char  *animation,
+             int         animationTime);
+
+    int lower(int surfaceid, const char *animation, int animationTime);
+
+    int setWindowLayer(int surfaceid, int layerid);
+
+    int showLayer(int displayid, int layerid);
+
+    int hideLayer(int displayid, int layerid);
+
+    void setLayerVisible(int layerid, int visible);
+
+    int active(int surfaceid, int target);
+
+    int mapSurface(int surfaceid, int framerate);
+
+    int unmapSurface(int surfaceid);
+
+    //
+    virtual void createdCB(void *data,
+                           struct ico_window_mgr *ico_window_mgr,
+                           uint32_t surfaceid,
+                           const char *winname,
+                           int32_t pid,
+                           const char *appid);
+
+    virtual void nameCB(void *data,
+                        struct ico_window_mgr *ico_window_mgr,
+                        uint32_t surfaceid,
+                        const char *winname);
+
+    virtual void destroyedCB(void *data,
+                             struct ico_window_mgr *ico_window_mgr,
+                             uint32_t surfaceid);
+
+    virtual void visibleCB(void *data,
+                           struct ico_window_mgr *ico_window_mgr,
+                           uint32_t surfaceid,
+                           int32_t visible,
+                           int32_t raise,
+                           int32_t hint);
+
+    virtual void configureCB(void *data,
+                             struct ico_window_mgr *ico_window_mgr,
+                             uint32_t surfaceid,
+                             uint32_t node,
+                             uint32_t layer,
+                             int32_t x,
+                             int32_t y,
+                             int32_t width,
+                             int32_t height,
+                             int32_t hint);
+
+    virtual void activeCB(void *data,
+                          struct ico_window_mgr *ico_window_mgr,
+                          uint32_t surfaceid,
+                          int32_t active);
+
+    virtual void layerVisibleCB(void *data,
+                                struct ico_window_mgr *ico_window_mgr,
+                                uint32_t layer,
+                                int32_t visible);
+
+    virtual void appSurfacesCB(void *data,
+                               struct ico_window_mgr *ico_window_mgr,
+                               const char *appid,
+                               struct wl_array *surfaces);
+
+    virtual void mapSurfaceCB(void *data,
+                              struct ico_window_mgr *ico_window_mgr,
+                              int32_t event,
+                              uint32_t surfaceid,
+                              int32_t width,
+                              int32_t height,
+                              int32_t stride,
+                              int32_t format);
+
+    virtual void outputGeometryCB(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);
+
+    virtual void outputModeCB(void *data,
+                              struct wl_output *wl_output,
+                              uint32_t flags,
+                              int32_t width,
+                              int32_t height,
+                              int32_t refresh);
+
+private:
+    // assignment operator
+    CicoSCWindowController& operator=(const CicoSCWindowController &object);
+
+    // copy constructor
+    CicoSCWindowController(const CicoSCWindowController &object);
+
+    // find window obeject by surface id
+    CicoSCWindow* findWindow(int surfaceid);
+
+    // find layer obeject by display id and layer id
+    CicoSCLayer* findLayer(int displayid, int layerid);
+
+private:
+    CicoSCResourceManager *m_resMgr;
+
+    // window obejct list
+    map<unsigned int, CicoSCWindow*> m_windowList;
+
+    // display objet list
+    vector<CicoSCDisplay*>   m_displayList;
+
+};
+#endif // __CICO_SC_WINDOW_CONTROLLER_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCWlInputMgrIF.cpp b/lib/system-controller/CicoSCWlInputMgrIF.cpp
new file mode 100644 (file)
index 0000000..7805cc6
--- /dev/null
@@ -0,0 +1,370 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full tWlExt of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+//==========================================================================
+/**
+ *  @file   CicoSCWlInputMgrIF.cpp
+ *
+ *  @brief  
+ */
+//==========================================================================
+
+#include <cstring>
+#include "CicoSCWlInputMgrIF.h"
+#include "CicoLog.h"
+
+//==========================================================================
+//  static variables
+//==========================================================================
+
+// 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
+};
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
+CicoSCWlInputMgrIF::CicoSCWlInputMgrIF()
+    : m_inputmgr(NULL), m_exinput(NULL), m_inputmgrdev(NULL)
+{
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
+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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlInputMgrIF::initInterface(void               *data,
+                                  struct wl_registry *registry,
+                                  uint32_t           name,
+                                  const char         *interface,
+                                  uint32_t           version)
+{
+    ICO_DBG("CicoSCWlInputMgrIF::initInterface : Enter(interface=%s)",
+            interface);
+
+    if (0 == strcmp(interface, ICO_WL_INPUT_MGR_CTRL_IF)) {
+        // get interface instance
+        void *wlProxy = wl_registry_bind(registry,
+                                         name,
+                                         &ico_input_mgr_control_interface,
+                                         1);
+        if (NULL == wlProxy) {
+            ICO_WRN("initInterface : interface(%s) wl_registry_bind failed.",
+                    interface);
+            ICO_WRN("initInterface : Leave(binding failed");
+            return;
+        }
+
+        m_inputmgr = (struct ico_input_mgr_control*)wlProxy;
+    }
+    else if (0 == strcmp(interface, ICO_WL_EXINPUT_IF)) {
+        // get interface instance
+        void *wlProxy = wl_registry_bind(registry,
+                                         name,
+                                         &ico_exinput_interface,
+                                         1);
+        if (NULL == wlProxy) {
+            ICO_WRN("initInterface : interface(%s) wl_registry_bind failed.",
+                    interface);
+            ICO_WRN("initInterface : Leave(binding failed");
+            return;
+        }
+
+        m_exinput = (struct ico_exinput*)wlProxy;
+        ico_exinput_add_listener(m_exinput,
+                                 &ms_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
+        void *wlProxy = wl_registry_bind(registry,
+                                         name,
+                                         &ico_input_mgr_device_interface,
+                                         1);
+        if (NULL == wlProxy) {
+            ICO_WRN("initInterface : interface(%s) wl_registry_bind failed.",
+                    interface);
+            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,
+                                          this);
+#if 0
+        ico_input_mgr_device_set_user_data(m_inputmgrdev, NULL/*user data*/);
+#endif
+    }
+
+    if ((NULL != m_inputmgrdev) &&
+        (NULL != m_inputmgr) &&
+        (NULL != m_exinput)) {
+        m_initialized = true;
+    }
+    ICO_DBG("CicoSCWlInputMgrIF::initInterface : Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlInputMgrIF::capabilitiesCB(void               *data,
+                                   struct ico_exinput *ico_exinput,
+                                   const char         *device,
+                                   int32_t            type,
+                                   const char         *swname,
+                                   int32_t            input,
+                                   const char         *codename,
+                                   int32_t            code)
+{
+    ICO_WRN("CicoSCWlInputMgrIF::capabilitiesCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlInputMgrIF::codeCB(void               *data,
+                           struct ico_exinput *ico_exinput,
+                           const char         *device,
+                           int32_t            input,
+                           const char         *codename,
+                           int32_t            code)
+{
+    ICO_WRN("CicoSCWlInputMgrIF::codeCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlInputMgrIF::inputCB(void               *data,
+                            struct ico_exinput *ico_exinput,
+                            uint32_t           time,
+                            const char         *device,
+                            int32_t            input,
+                            int32_t            code,
+                            int32_t            state)
+{
+    ICO_WRN("CicoSCWlInputMgrIF::inputCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlInputMgrIF::regionCB(void                        *data,
+                             struct ico_input_mgr_device *ico_input_mgr_dev,
+                             struct wl_array             *region)
+{
+    ICO_WRN("CicoSCWlInputMgrIF::regionCB called.");
+}
+
+//==========================================================================
+// private method
+//==========================================================================
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlInputMgrIF::wlCapabilitiesCB(void               *data,
+                                     struct ico_exinput *ico_exinput,
+                                     const char         *device,
+                                     int32_t            type,
+                                     const char         *swname,
+                                     int32_t            input,
+                                     const char         *codename,
+                                     int32_t            code)
+{
+    ICO_DBG("CicoSCWlInputMgrIF::wlCapabilitiesCB Enter");
+
+    if (NULL == data) {
+        ICO_WRN("wlCapabilitiesCB: data is null");
+        return;
+    }
+    static_cast<CicoSCWlInputMgrIF*>(data)->capabilitiesCB(data, ico_exinput,
+                                                           device, type,
+                                                           swname, input,
+                                                           codename, code);
+    ICO_DBG("CicoSCWlInputMgrIF::wlCapabilitiesCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlInputMgrIF::wlCodeCB(void               *data,
+                             struct ico_exinput *ico_exinput,
+                             const char         *device,
+                             int32_t            input,
+                             const char         *codename,
+                             int32_t            code)
+{
+    ICO_DBG("CicoSCWlInputMgrIF::wlCodeCB Enter");
+
+    if (NULL == data) {
+        ICO_WRN("wlCodeCB: data is null");
+        return;
+    }
+    static_cast<CicoSCWlInputMgrIF*>(data)->codeCB(data, ico_exinput,
+                                                   device, input,
+                                                   codename, code);
+
+    ICO_DBG("CicoSCWlInputMgrIF::wlCodeCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlInputMgrIF::wlInputCB(void               *data,
+                              struct ico_exinput *ico_exinput,
+                              uint32_t           time,
+                              const char         *device,
+                              int32_t            input,
+                              int32_t            code,
+                              int32_t            state)
+{
+    ICO_DBG("CicoSCWlInputMgrIF::wlInputCB Enter");
+
+    if (NULL == data) {
+        ICO_WRN("wlInputCB: data is null");
+        return;
+    }
+    static_cast<CicoSCWlInputMgrIF*>(data)->inputCB(data, ico_exinput,
+                                                    time, device, input,
+                                                    code, state);
+
+    ICO_DBG("CicoSCWlInputMgrIF::wlInputCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlInputMgrIF::wlRegionCB(void                        *data,
+                               struct ico_input_mgr_device *ico_input_mgr_dev,
+                               struct wl_array             *region)
+{
+    ICO_DBG("CicoSCWlInputMgrIF::wlRegionCB Enter");
+
+    if (NULL == data) {
+        ICO_WRN("wlRegionCB: data is null");
+        return;
+    }
+    static_cast<CicoSCWlInputMgrIF*>(data)->regionCB(data, ico_input_mgr_dev,
+                                                     region);
+
+    ICO_DBG("CicoSCWlInputMgrIF::wlRegionCB Leave");
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCWlInputMgrIF.h b/lib/system-controller/CicoSCWlInputMgrIF.h
new file mode 100644 (file)
index 0000000..d578022
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full tWlExt of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+//==========================================================================
+/**
+ *  @file   CicoSCWlInputMgrIF.cpp
+ *
+ *  @brief  
+ */
+//==========================================================================
+#ifndef __CICO_SC_WL_INPUT_MGR_IF_H__
+#define __CICO_SC_WL_INPUT_MGR_IF_H__
+
+#include <ico_input_mgr-client-protocol.h>
+#include "CicoSCWaylandIF.h"
+
+class CicoSCWlInputMgrIF : public CicoSCWaylandIF
+{
+public:
+    void initInterface(void               *data,
+                       struct wl_registry *registry,
+                       uint32_t           name,
+                       const char         *interface,
+                       uint32_t           version);
+
+    void capabilitiesCB(void               *data,
+                        struct ico_exinput *ico_exinput,
+                        const char         *device,
+                        int32_t            type,
+                        const char         *swname,
+                        int32_t            input,
+                        const char          *codename,
+                        int32_t            code);
+
+    void codeCB(void               *data,
+                struct ico_exinput *ico_exinput,
+                const char         *device,
+                int32_t            input,
+                const char         *codename,
+                int32_t            code);
+
+    void inputCB(void               *data,
+                 struct ico_exinput *ico_exinput,
+                 uint32_t           time,
+                 const char         *device,
+                 int32_t            input,
+                 int32_t            code,
+                 int32_t            state);
+
+    void regionCB(void                        *data,
+                  struct ico_input_mgr_device *ico_input_mgr_device,
+                  struct wl_array             *region);
+
+protected:
+    // default constructor
+    CicoSCWlInputMgrIF();
+
+    // destructor
+    ~CicoSCWlInputMgrIF();
+
+    // assignment operator
+    CicoSCWlInputMgrIF& operator=(const CicoSCWlInputMgrIF &object);
+
+    // copy constructor
+    CicoSCWlInputMgrIF(const CicoSCWlInputMgrIF &object);
+
+private:
+    /* ico_input_mgr(Multi Input Manager) callback functions    */
+    static void wlCapabilitiesCB(void               *data,
+                                 struct ico_exinput *ico_exinput,
+                                 const char         *device,
+                                 int32_t            type,
+                                 const char         *swname,
+                                 int32_t            input,
+                                 const char         *codename,
+                                 int32_t            code);
+
+    static void wlCodeCB(void               *data,
+                         struct ico_exinput *ico_exinput,
+                         const char         *device,
+                         int32_t            input,
+                         const char         *codename,
+                         int32_t            code);
+
+    static void wlInputCB(void               *data,
+                          struct ico_exinput *ico_exinput,
+                          uint32_t           time,
+                          const char         *device,
+                          int32_t            input,
+                          int32_t            code,
+                          int32_t            state);
+
+    static void wlRegionCB(void                        *data,
+                           struct ico_input_mgr_device *ico_input_mgr_device,
+                           struct wl_array             *region);
+
+protected:
+    // Input Manager PulgIn interface
+    struct ico_input_mgr_control *m_inputmgr;
+    // extra input event interface
+    struct ico_exinput *m_exinput;
+
+    // Input Manage Device interface
+    struct ico_input_mgr_device *m_inputmgrdev;
+
+private:
+    // ico_exinput listener
+    static struct ico_exinput_listener ms_exInputListener;
+
+    // ico_input_mgr_device listener
+    static struct ico_input_mgr_device_listener ms_devListener;
+
+};
+#endif // __CICO_SC_WL_INPUT_MGR_IF_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCWlWinMgrIF.cpp b/lib/system-controller/CicoSCWlWinMgrIF.cpp
new file mode 100644 (file)
index 0000000..d75b980
--- /dev/null
@@ -0,0 +1,799 @@
+/*
+ * 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   CicoSCWlWinMgrIF.cpp
+ *
+ *  @brief  
+ */
+//==========================================================================
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <cstring>
+
+#include "CicoSCWlWinMgrIF.h"
+#include "CicoLog.h"
+
+//==========================================================================
+//  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)
+{
+       strcpy(m_shmName, "/tmp/ico/thumbnail-shm-XXXXXX");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
+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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::initInterface(void               *data,
+                                struct wl_registry *registry,
+                                uint32_t           name,
+                                const char         *interface,
+                                uint32_t           version)
+{
+    ICO_DBG("CicoSCWlWinMgrIF::initInterface : Enter(interface=%s)", interface);
+
+    // check interface name
+    if (0 == strcmp(interface, ICO_WL_WIN_MGR_IF)) {
+        // get interface instance
+        void *wlProxy = wl_registry_bind(registry,
+                                         name,
+                                         &ico_window_mgr_interface,
+                                         1);
+        if (NULL == wlProxy) {
+            ICO_WRN("initInterface : interface(%s) wl_registry_bind failed.",
+                    interface);
+            ICO_WRN("CicoSCWlWinMgrIF::initInterface : Leave(binding failed)");
+            return;
+        }
+
+
+        m_winmgr = (struct ico_window_mgr *)wlProxy;
+        ico_window_mgr_add_listener(m_winmgr, 
+                                    &ms_listener,
+                                    this);
+#if 0
+        ico_window_mgr_set_user_data(m_winmgr, NULL/*TODO*/);
+#endif
+
+        ICO_DBG("call ico_window_mgr_declare_manager");
+        ico_window_mgr_declare_manager(m_winmgr,
+                                       ICO_WINDOW_MGR_DECLARE_MANAGER_MANAGER);
+
+    }
+    else if (0 == strcmp(interface, ICO_WL_OUTPUT_IF)) {
+        // get interface instance
+        void *wlProxy = wl_registry_bind(registry,
+                                         name,
+                                         &wl_output_interface,
+                                         1);
+        if (NULL == wlProxy) {
+            ICO_WRN("initInterface : interface(%s) wl_registry_bind failed.",
+                    interface);
+            ICO_WRN("CicoSCWlWinMgrIF::initInterface : Leave(binding failed)");
+            return;
+        }
+
+        m_wloutput = (struct wl_output*)wlProxy;
+        wl_output_add_listener(m_wloutput, 
+                               &ms_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)) {
+        m_initialized = true;
+    }
+
+    ICO_DBG("CicoSCWlWinMgrIF::initInterface : Leave");
+}
+
+//--------------------------------------------------------------------------
+/** 
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::createdCB(void                  *data,
+                            struct ico_window_mgr *ico_window_mgr,
+                            uint32_t              surfaceid,
+                            const char            *winname,
+                            int32_t               pid,
+                            const char            *appid)
+{
+    ICO_DBG("CicoSCWlWinMgrIF::createdCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::nameCB(void                  *data,
+                         struct ico_window_mgr *ico_window_mgr,
+                         uint32_t              surfaceid,
+                         const char            *winname)
+{
+    ICO_WRN("CicoSCWlWinMgrIF::nameCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wayland surface destroy callback
+ *
+ *  @param [IN] data            user data(unused)
+ *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [IN] surfaceid       ico_window_mgr surface Id
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::destroyedCB(void                  *data,
+                              struct ico_window_mgr *ico_window_mgr,
+                              uint32_t              surfaceid)
+{
+    ICO_WRN("CicoSCWlWinMgrIF::destroyedCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ *                              (1=client request(not changed)/0=changed)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::visibleCB(void                  *data,
+                            struct ico_window_mgr *ico_window_mgr,
+                            uint32_t              surfaceid,
+                            int32_t               visible,
+                            int32_t               raise,
+                            int32_t               hint)
+{
+    ICO_WRN("CicoSCWlWinMgrIF::visibleCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ *                              (1=client request(not changed)/0=changed)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::configureCB(void                  *data,
+                              struct ico_window_mgr *ico_window_mgr,
+                              uint32_t              surfaceid,
+                              uint32_t              node,
+                              uint32_t              layer,
+                              int32_t               x,
+                              int32_t               y,
+                              int32_t               width,
+                              int32_t               height,
+                              int32_t               hint)
+{
+    ICO_WRN("CicoSCWlWinMgrIF::configureCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wayland surface active callback(static func
+ *
+ *  @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)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::activeCB(void                  *data,
+                           struct ico_window_mgr *ico_window_mgr,
+                           uint32_t              surfaceid,
+                           int32_t               active)
+{
+    ICO_WRN("CicoSCWlWinMgrIF::activeCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wayland layer visible callback(stati
+ *
+ *  @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)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::layerVisibleCB(void                  *data,
+                                 struct ico_window_mgr *ico_window_mgr,
+                                 uint32_t              layer,
+                                 int32_t               visible)
+{
+    ICO_WRN("CicoSCWlWinMgrIF::layerVisibleCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  query applicationsurface 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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::appSurfacesCB(void                  *data,
+                                struct ico_window_mgr *ico_window_mgr,
+                                const char            *appid,
+                                struct wl_array       *surfaces)
+{
+    ICO_WRN("CicoSCWlWinMgrIF::appSurfacesCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::mapSurfaceCB(void                  *data,
+                               struct ico_window_mgr *ico_window_mgr,
+                               int32_t               event,
+                               uint32_t              surfaceid,
+                               uint32_t              type,
+                               uint32_t              target,
+                               int32_t               width,
+                               int32_t               height,
+                               int32_t               stride,
+                               uint32_t              format)
+{
+    ICO_WRN("CicoSCWlWinMgrIF::mapSurfaceCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::outputGeometryCB(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_WRN("CicoSCWlWinMgrIF::outputGeometryCB called.");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::outputModeCB(void             *data,
+                               struct wl_output *wl_output,
+                               uint32_t         flags,
+                               int32_t          width,
+                               int32_t          height,
+                               int32_t          refresh)
+{
+    ICO_WRN("CicoSCWlWinMgrIF::outputModeCB called.");
+}
+
+//==========================================================================
+// private method
+//==========================================================================
+
+//--------------------------------------------------------------------------
+/** 
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::wlCreatedCB(void                  *data,
+                              struct ico_window_mgr *ico_window_mgr,
+                              uint32_t              surfaceid,
+                              const char            *winname,
+                              int32_t               pid,
+                              const char            *appid)
+{
+    ICO_DBG("CicoSCWlWinMgrIF::wlCreatedCB Enter");
+    if (NULL == data) {
+        ICO_WRN("wlCreatedCB : data is null");
+        return;
+    }
+    static_cast<CicoSCWlWinMgrIF*>(data)->createdCB(data, ico_window_mgr,
+                                                    surfaceid, winname,
+                                                    pid, appid);
+    ICO_DBG("CicoSCWlWinMgrIF::wlCreatedCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::wlNameCB(void                  *data,
+                           struct ico_window_mgr *ico_window_mgr,
+                           uint32_t              surfaceid,
+                           const char            *winname)
+{
+    ICO_DBG("CicoSCWlWinMgrIF::wlNameCB Enter");
+
+    if (NULL == data) {
+        ICO_WRN("wlNameCB: data is null");
+        return;
+    }
+    static_cast<CicoSCWlWinMgrIF*>(data)->nameCB(data, ico_window_mgr,
+                                                 surfaceid, winname);
+    ICO_DBG("CicoSCWlWinMgrIF::wlNameCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wayland surface destroy callback
+ *
+ *  @param [IN] data            user data(unused)
+ *  @param [IN] ico_window_mgr  wayland ico_window_mgr plugin interface
+ *  @param [IN] surfaceid       ico_window_mgr surface Id
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::wlDestroyedCB(void                  *data,
+                                struct ico_window_mgr *ico_window_mgr,
+                                uint32_t              surfaceid)
+{
+    ICO_DBG("CicoSCWlWinMgrIF::wlDestroyedCB Enter");
+
+    if (NULL == data) {
+        ICO_WRN("wlDestroyedCB: data is null");
+        return;
+    }
+    static_cast<CicoSCWlWinMgrIF*>(data)->destroyedCB(data, ico_window_mgr,
+                                                      surfaceid);
+    ICO_DBG("CicoSCWlWinMgrIF::wlDestroyedCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ *                              (1=client request(not changed)/0=changed)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::wlVisibleCB(void                  *data,
+                              struct ico_window_mgr *ico_window_mgr,
+                              uint32_t              surfaceid,
+                              int32_t               visible,
+                              int32_t               raise,
+                              int32_t               hint)
+{
+    ICO_DBG("CicoSCWlWinMgrIF::wlVisibleCB Enter");
+
+    if (NULL == data) {
+        ICO_WRN("wlVisibleCB: data is null");
+        return;
+    }
+    static_cast<CicoSCWlWinMgrIF*>(data)->visibleCB(data, ico_window_mgr,
+                                                    surfaceid, visible,
+                                                    raise, hint);
+    ICO_DBG("CicoSCWlWinMgrIF::wlVisibleCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ *                              (1=client request(not changed)/0=changed)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::wlConfigureCB(void                  *data,
+                                struct ico_window_mgr *ico_window_mgr,
+                                uint32_t              surfaceid,
+                                uint32_t              node,
+                                uint32_t              layer,
+                                int32_t               x,
+                                int32_t               y,
+                                int32_t               width,
+                                int32_t               height,
+                                int32_t               hint)
+{
+    ICO_DBG("CicoSCWlWinMgrIF::wlConfigureCB Enter");
+
+    if (NULL == data) {
+        ICO_WRN("wlConfigureCB: data is null");
+        return;
+    }
+    static_cast<CicoSCWlWinMgrIF*>(data)->configureCB(data, ico_window_mgr,
+                                                      surfaceid, node, layer,
+                                                      x, y, width, height,
+                                                      hint);
+    ICO_DBG("CicoSCWlWinMgrIF::wlConfigureCB Leave");
+}
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wayland surface active callback(static func
+ *
+ *  @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)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::wlActiveCB(void                  *data,
+                             struct ico_window_mgr *ico_window_mgr,
+                             uint32_t              surfaceid,
+                             int32_t               active)
+{
+    ICO_DBG("CicoSCWlWinMgrIF::wlActiveCB Enter");
+
+    if (NULL == data) {
+        ICO_WRN("wlActiveCB: data is null");
+        return;
+    }
+    static_cast<CicoSCWlWinMgrIF*>(data)->activeCB(data, ico_window_mgr,
+                                                   surfaceid, active);
+    ICO_DBG("CicoSCWlWinMgrIF::wlActiveCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  wayland layer visible callback(stati
+ *
+ *  @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)
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::wlLayerVisibleCB(void                  *data,
+                                   struct ico_window_mgr *ico_window_mgr,
+                                   uint32_t              layer,
+                                   int32_t               visible)
+{
+    ICO_DBG("CicoSCWlWinMgrIF::wlLayerVisibleCB Enter");
+
+    if (NULL == data) {
+        ICO_WRN("wlLayerVisibleCB: data is null");
+        return;
+    }
+    static_cast<CicoSCWlWinMgrIF*>(data)->layerVisibleCB(data, ico_window_mgr,
+                                                         layer, visible);
+    ICO_DBG("CicoSCWlWinMgrIF::wlLayerVisibleCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  query applicationsurface 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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::wlAppSurfacesCB(void                  *data,
+                                  struct ico_window_mgr *ico_window_mgr,
+                                  const char            *appid,
+                                  struct wl_array       *surfaces)
+{
+    ICO_DBG("CicoSCWlWinMgrIF::wlAppSurfacesCB Enter");
+
+    if (NULL == data) {
+        ICO_WRN("wlAppSurfacesCB: data is null");
+        return;
+    }
+    static_cast<CicoSCWlWinMgrIF*>(data)->appSurfacesCB(data, ico_window_mgr,
+                                                        appid, surfaces);
+    ICO_DBG("CicoSCWlWinMgrIF::wlAppSurfacesCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::wlMapSurfaceCB(void                  *data,
+                                 struct ico_window_mgr *ico_window_mgr,
+                                 int32_t               event,
+                                 uint32_t              surfaceid,
+                                 uint32_t              type,
+                                 uint32_t              target,
+                                 int32_t               width,
+                                 int32_t               height,
+                                 int32_t               stride,
+                                 uint32_t              format)
+{
+    ICO_DBG("CicoSCWlWinMgrIF::wlMapSurfaceCB Enter");
+
+    if (NULL == data) {
+        ICO_WRN("wlMapSurfaceCB: data is null");
+        return;
+    }
+    static_cast<CicoSCWlWinMgrIF*>(data)->mapSurfaceCB(data, ico_window_mgr,
+                                                       event, surfaceid,
+                                                       type, target,
+                                                       width, height,
+                                                       stride, format);
+    ICO_DBG("CicoSCWlWinMgrIF::wlMapSurfaceCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::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("CicoSCWlWinMgrIF::wlOutputGeometryCB Enter");
+
+    if (NULL == data) {
+        ICO_WRN("wlOutputGeometryCB: data is null");
+        return;
+    }
+    static_cast<CicoSCWlWinMgrIF*>(data)->outputGeometryCB(data, wl_output,
+                                                           x, y,
+                                                           physical_width,
+                                                           physical_height,
+                                                           subpixel,
+                                                           make,
+                                                           model,
+                                                           transform);
+    ICO_DBG("CicoSCWlWinMgrIF::wlOutputGeometryCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @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
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCWlWinMgrIF::wlOutputModeCB(void             *data,
+                                 struct wl_output *wl_output,
+                                 uint32_t         flags,
+                                 int32_t          width,
+                                 int32_t          height,
+                                 int32_t          refresh)
+{
+    ICO_DBG("CicoSCWlWinMgrIF::wlOutputModeCB Enter");
+
+    if (NULL == data) {
+        ICO_WRN("wlOutputGeometryCB: data is null");
+        return;
+    }
+    static_cast<CicoSCWlWinMgrIF*>(data)->outputModeCB(data, wl_output, flags,
+                                                       width, height, refresh);
+    ICO_DBG("CicoSCWlWinMgrIF::wlOutputModeCB Leave");
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/CicoSCWlWinMgrIF.h b/lib/system-controller/CicoSCWlWinMgrIF.h
new file mode 100644 (file)
index 0000000..8abec0f
--- /dev/null
@@ -0,0 +1,234 @@
+/*
+ * 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   CicoSCWlWinMgrIF.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+#ifndef __CICO_SC_WL_WINMGR_IF_H__
+#define __CICO_SC_WL_WINMGR_IF_H__
+
+#include <wayland-client.h>
+#include <ico_window_mgr-client-protocol.h>
+
+#include "CicoSCWaylandIF.h"
+
+class CicoSCWlWinMgrIF : public CicoSCWaylandIF {
+public:
+    virtual void initInterface(void               *data,
+                               struct wl_registry *registry,
+                               uint32_t           name,
+                               const char         *interface,
+                               uint32_t           version);
+
+
+    virtual void createdCB(void *data,
+                           struct ico_window_mgr *ico_window_mgr,
+                           uint32_t surfaceid,
+                           const char *winname,
+                           int32_t pid,
+                           const char *appid);
+
+    virtual void nameCB(void *data,
+                        struct ico_window_mgr *ico_window_mgr,
+                        uint32_t surfaceid,
+                        const char *winname);
+
+    virtual void destroyedCB(void *data,
+                             struct ico_window_mgr *ico_window_mgr,
+                             uint32_t surfaceid);
+
+    virtual void visibleCB(void *data,
+                           struct ico_window_mgr *ico_window_mgr,
+                           uint32_t surfaceid,
+                           int32_t visible,
+                           int32_t raise,
+                           int32_t hint);
+
+    virtual void configureCB(void *data,
+                             struct ico_window_mgr *ico_window_mgr,
+                             uint32_t surfaceid,
+                             uint32_t node,
+                             uint32_t layer,
+                             int32_t x,
+                             int32_t y,
+                             int32_t width,
+                             int32_t height,
+                             int32_t hint);
+
+    virtual void activeCB(void *data,
+                          struct ico_window_mgr *ico_window_mgr,
+                          uint32_t surfaceid,
+                          int32_t active);
+
+    virtual void layerVisibleCB(void *data,
+                                struct ico_window_mgr *ico_window_mgr,
+                                uint32_t layer,
+                                int32_t visible);
+
+    virtual void appSurfacesCB(void *data,
+                               struct ico_window_mgr *ico_window_mgr,
+                               const char *appid,
+                               struct wl_array *surfaces);
+
+    virtual void mapSurfaceCB(void *data,
+                              struct ico_window_mgr *ico_window_mgr,
+                              int32_t event,
+                              uint32_t surfaceid,
+                              uint32_t type,
+                              uint32_t target,
+                              int32_t width,
+                              int32_t height,
+                              int32_t stride,
+                              uint32_t format);
+
+    //
+    virtual void outputGeometryCB(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);
+
+    virtual void outputModeCB(void             *data,
+                              struct wl_output *wl_output,
+                              uint32_t         flags,
+                              int32_t          width,
+                              int32_t          height,
+                              int32_t          refresh);
+
+protected:
+    // default constructor
+    CicoSCWlWinMgrIF();
+
+    // destructor
+    virtual ~CicoSCWlWinMgrIF();
+
+    // assignment operator
+    CicoSCWlWinMgrIF& operator=(const CicoSCWlWinMgrIF &object);
+
+    // copy constructor
+    CicoSCWlWinMgrIF(const CicoSCWlWinMgrIF &object);
+
+private:
+    // ico_window_mgr(Multi Window Manager) callback functions
+    static void wlCreatedCB(void                  *data,
+                            struct ico_window_mgr *ico_window_mgr,
+                            uint32_t              surfaceid,
+                            const char            *winname,
+                            int32_t               pid,
+                            const char            *appid);
+
+    static void wlNameCB(void *data,
+                         struct ico_window_mgr *ico_window_mgr,
+                         uint32_t surfaceid,
+                         const char *winname);
+
+    static void wlDestroyedCB(void *data,
+                              struct ico_window_mgr *ico_window_mgr,
+                              uint32_t surfaceid);
+
+    static void wlVisibleCB(void *data,
+                            struct ico_window_mgr *ico_window_mgr,
+                            uint32_t surfaceid,
+                            int32_t visible,
+                            int32_t raise,
+                            int32_t hint);
+
+    static void wlConfigureCB(void *data,
+                              struct ico_window_mgr *ico_window_mgr,
+                              uint32_t surfaceid,
+                              uint32_t node,
+                              uint32_t layer,
+                              int32_t x,
+                              int32_t y,
+                              int32_t width,
+                              int32_t height,
+                              int32_t hint);
+
+    static void wlActiveCB(void *data,
+                           struct ico_window_mgr *ico_window_mgr,
+                           uint32_t surfaceid,
+                           int32_t active);
+
+    static void wlLayerVisibleCB(void *data,
+                                 struct ico_window_mgr *ico_window_mgr,
+                                 uint32_t layer,
+                                 int32_t visible);
+
+    static void wlAppSurfacesCB(void *data,
+                                struct ico_window_mgr *ico_window_mgr,
+                                const char *appid,
+                                struct wl_array *surfaces);
+
+    static void wlMapSurfaceCB(void *data,
+                               struct ico_window_mgr *ico_window_mgr,
+                               int32_t event,
+                               uint32_t surfaceid,
+                               uint32_t type,
+                               uint32_t target,
+                               int32_t width,
+                               int32_t height,
+                               int32_t stride,
+                               uint32_t format);
+
+    //
+    static void 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);
+
+    static void wlOutputModeCB(void             *data,
+                               struct wl_output *wl_output,
+                               uint32_t         flags,
+                               int32_t          width,
+                               int32_t          height,
+                               int32_t          refresh);
+
+protected:
+    // ico_window_mgr listener 
+    static struct ico_window_mgr_listener ms_listener;
+
+    // wayland output listener
+    static struct wl_output_listener ms_wlOutputListener;
+
+    // Wayland's Window Manager PlugIn instance
+    struct ico_window_mgr *m_winmgr;
+
+    // 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__
+// vim:set expandtab ts=4 sw=4:
diff --git a/lib/system-controller/Makefile.am b/lib/system-controller/Makefile.am
new file mode 100644 (file)
index 0000000..432ad3d
--- /dev/null
@@ -0,0 +1,80 @@
+AM_CPPFLAGS = $(GCC_CXXFLAGS)
+
+noinst_LTLIBRARIES =\
+       libico-system-controller.la
+
+#lib_LTLIBRARIES =\
+#      libico-system-controller.la
+
+libico_system_controller_la_SOURCES =  \
+       CicoSCAilItems.cpp                                      \
+       CicoSCAulItems.cpp                                      \
+       CicoSCLifeCycleController.cpp           \
+       ico_log.c                                                       \
+       CicoSCSystemConfig.cpp                          \
+       CicoSCWaylandIF.cpp                                     \
+       CicoSCWayland.cpp                                       \
+       CicoSCWlWinMgrIF.cpp                            \
+       CicoSCWindow.cpp                                        \
+       CicoSCDisplay.cpp                                       \
+       CicoSCLayer.cpp                                         \
+       CicoSCDisplayZone.cpp                           \
+       CicoSCWindowController.cpp                      \
+       CicoSCWlInputMgrIF.cpp                          \
+       CicoSCInputDev.cpp                                      \
+       CicoSCSwitch.cpp                                        \
+       CicoSCInputController.cpp                       \
+       CicoSCServer.cpp                                        \
+       CicoSCCommandParser.cpp                         \
+       CicoSCMessage.cpp                               \
+       CicoSCUser.cpp                                          \
+       CicoSCUserManager.cpp                           \
+       CicoSCSysResourceController.cpp         \
+       CicoSCSysResourceMonitor.cpp            \
+       CicoSCResourceManager.cpp                       \
+       ico_syc_mrp_resource.c                          \
+       CicoSCPolicyManager.cpp
+
+libico_system_controller_la_CPPFLAGS =         \
+       $(GCC_CXXFLAGS)                                         \
+       @ECORE_CFLAGS@                                          \
+       @EINA_CFLAGS@                                           \
+       @GLIB_CFLAGS@                                           \
+       @AIL_CFLAGS@                                            \
+       @BUNDLE_CFLAGS@                                         \
+       @AUL_CFLAGS@                                            \
+       @PKGMGR_CFLAGS@                                         \
+       @WAYLANDCLIENT_CFLAGS@                          \
+       @CAPIAPPFWAPPLICATION_CFLAGS@           \
+       @JSONGLIB_CFLAGS@                                       \
+       @MURPHYCOMMON_CFLAGS@                           \
+       @MURPHYDOMAINCONTROLLER_CFLAGS@         \
+       @MURPHYECORE_CFLAGS@                            \
+       @MURPHYRESOURCE_CFLAGS@                         \
+       -I../../include                                         \
+       -I/usr/include/ico-util                         \
+       -I/usr/include/ico-uxf-weston-plugin \
+       -I../misc/state-machine
+
+libico_system_controller_la_LIBADD =   \
+       @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                                                      \
+       -lico-uxf-weston-plugin                         \
+       -lico-util-com
+
+AM_LDFLAGS = -module -avoid-version -rpath $(libdir)
+
+.FORCE :
diff --git a/lib/system-controller/ico_log.c b/lib/system-controller/ico_log.c
new file mode 100644 (file)
index 0000000..fad8324
--- /dev/null
@@ -0,0 +1,241 @@
+/*
+ * 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
new file mode 100644 (file)
index 0000000..3b5e224
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * 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
new file mode 100644 (file)
index 0000000..7c7a47d
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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: */
diff --git a/lib/system-controller/ico_syc_mrp_resource.c b/lib/system-controller/ico_syc_mrp_resource.c
new file mode 100644 (file)
index 0000000..5883a66
--- /dev/null
@@ -0,0 +1,764 @@
+/*
+ * 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_mrp_resource.c
+ *
+ *  @brief 
+ */
+//==========================================================================
+
+#include <murphy/common.h>
+#include <murphy/common/ecore-glue.h>
+#include <murphy/domain-control/client.h>
+
+#include "ico_log.h"
+#include "ico_syc_error.h"
+#include "ico_syc_mrp_resource_private.h"
+
+
+static void ico_syc_mrp_resource_cb(mrp_res_context_t *ctx,
+                                    const mrp_res_resource_set_t *rs,
+                                    void *userdata);
+
+static void ico_syc_mrp_state_cb(mrp_res_context_t *ctx,
+                                 mrp_res_error_t err,
+                                 void *userdata);
+
+static void ico_syc_mrp_connect_notify(mrp_domctl_t *dc,int connected,
+                                       int errcode, const char *errmsg,
+                                       void *user_data);
+
+static void ico_syc_mrp_data_notify(mrp_domctl_t *dc,
+                                    mrp_domctl_data_t *tables,
+                                    int ntable, void *user_data);
+
+static mrp_res_queue_item_t *
+ico_syc_mrp_create_queue_item(resource_request_t *req, int prio);
+static resource_request_t *
+ico_syc_mrp_find_request(int req_id, char *appid);
+static void ico_syc_mrp_process_input_queue(void);
+static void ico_syc_mrp_process_display_queue(void);
+static void ico_syc_mrp_process_sound_queue(void);
+            
+/* Murphy resource library */ 
+static bool                     mrp_res_connected = FALSE; 
+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; 
+
+
+/*
+ * tables for inserting and reading data from Murphy
+ */
+
+#define ACTIVE_APP_COLUMNS      \
+    "zone       varchar(128),"  \
+    "appid      varchar(128)"
+
+#define ACTIVE_APP_INDEX "zone, appid"
+
+#define DISPLAY_OWNER_SELECT "*"
+#define DISPLAY_OWNER_WHERE  NULL
+
+mrp_domctl_table_t ico_tables[] = {
+    MRP_DOMCTL_TABLE("active_screen",
+                     ACTIVE_APP_COLUMNS,
+                     ACTIVE_APP_INDEX),
+};
+
+mrp_domctl_watch_t ico_watches[] = {
+    MRP_DOMCTL_WATCH("display-owner",
+                     DISPLAY_OWNER_SELECT,
+                     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 void *cb_user_data = NULL;
+
+
+/*-------------------------------------------------------------------------*/
+/*
+ *  pablic 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)
+
+{
+
+    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;
+    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);
+
+    mrp_ml = mrp_mainloop_ecore_get();
+
+    ICO_DBG("mrp_res_connecte() called.");
+    mrp_ctx = mrp_res_create(mrp_ml, ico_syc_mrp_state_cb, NULL);
+
+    if (!mrp_ctx) {
+        ICO_ERR("ico_syc_mrp_init: Leave(mrp_res_create Error)");
+        return ICO_SYC_ENOSYS;
+    }
+
+    ICO_DBG("mrp_domctl_create() called.");
+    mrp_dc = mrp_domctl_create("ico-homescreen", mrp_ml,
+                               ico_tables, MRP_ARRAY_SIZE(ico_tables),
+                               ico_watches, MRP_ARRAY_SIZE(ico_watches),
+                               ico_syc_mrp_connect_notify,
+                               ico_syc_mrp_data_notify, NULL);
+
+    if (mrp_dc == NULL) {
+        ICO_ERR("ico_syc_mrp_init: Leave(mrp_domctl_create Error)");
+        return ICO_SYC_ENOSYS;
+    } 
+
+    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_EOK;
+}
+
+bool
+ico_syc_mrp_acquire_display_resource(resource_request_t *req, int addprio)
+{
+    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;
+
+            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)
+{
+    ICO_DBG("murphy: removed request %p from 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)
+{
+    mrp_res_resource_set_t      *rs;
+
+    if (mrp_ctx) {
+        if (!mrp_res_connected) {
+            mrp_res_queue_item_t *item;
+
+            ICO_DBG("murphy: resource context is not connected yet, queueing");
+
+            item = ico_syc_mrp_create_queue_item(req, addprio);
+            mrp_list_append(&mrp_sound_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 TRUE;
+}
+
+bool
+ico_syc_mrp_release_sound_resource(resource_request_t *req)
+{
+    if (mrp_ctx && req->rset) {
+        if (REQTYPE_APP == req->reqtype) {
+            mrp_res_release_resource_set(mrp_ctx, req->rset);
+            req->released = 1;
+        }
+        else {
+            mrp_res_release_resource_set(mrp_ctx, req->rset);
+            mrp_res_delete_resource_set(mrp_ctx, req->rset);
+            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;
+    }
+
+    return true;
+}
+
+/*-------------------------------------------------------------------------*/
+/*
+ *  private functions
+ */
+/*-------------------------------------------------------------------------*/
+static mrp_res_queue_item_t *
+ico_syc_mrp_create_queue_item(resource_request_t *req, int prio)
+{
+    mrp_res_queue_item_t *item = mrp_allocz(sizeof(mrp_res_queue_item_t));
+    int ret;
+
+    if (NULL == item) {
+        ICO_ERR("mrp_allocz failaed.");
+        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) {
+        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->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);
+        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);
+
+    return item;
+}
+
+static resource_request_t *
+ico_syc_mrp_find_request(int req_id, char *appid)
+{
+    mrp_list_hook_t *p, *n;
+    resource_request_t *req;
+
+    /* go through all mrp_res_queue_item_t structs in the list */
+
+    mrp_list_foreach(&mrp_reqs, p, n) {
+        req = mrp_list_entry(p, typeof(*req), hook);
+
+        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) {
+            return req;
+        }
+    }
+
+    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;
+
+    /* go through all mrp_res_queue_item_t structs in the list */
+
+    mrp_list_foreach(&mrp_input_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);
+        }
+        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_resource_cb(mrp_res_context_t *ctx,
+                        const mrp_res_resource_set_t *rs,
+                        void *userdata)
+{
+    resource_request_t *req = NULL;
+
+    mrp_res_queue_item_t *item = userdata;
+
+    unsigned short state = ICO_APF_RESOURCE_STATE_ACQUIRED;
+
+    ICO_DBG("ico_syc_mrp_resource_cb: Enter"
+            "(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);
+        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!");
+        ICO_DBG("ico_syc_mrp_resource_cb: Leave");
+        return;
+    }
+
+    if (!mrp_res_equal_resource_set(rs, req->rset)) {
+        ICO_DBG("mrp_res_equal_resource_set : not match");
+        ICO_DBG("ico_syc_mrp_resource_cb: Leave");
+        return;
+    }
+
+    /* delete the previous set */
+    mrp_res_delete_resource_set(ctx, req->rset);
+
+    /* copy the new set into place */
+    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;
+        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;
+        }
+        else {
+            state = ICO_APF_RESOURCE_STATE_WAITTING;
+        }
+        break;
+    default:
+        ICO_WRN("ico_syc_mrp_resource_cb: state=UNKNOWN");
+        state = ICO_APF_RESOURCE_STATE_RELEASED;
+        break;
+    }
+
+    /* send decision to client, if needed */
+
+    if (req->reqtype == REQTYPE_APP) {
+        if (req->state != state) {
+// TODO CicoSCServer::sendMessage();
+//            if (ico_apf_resource_send_to_client(
+//                req->appid, state, req->resid, req->device, req->id)
+//                        != ICO_APF_RESOURCE_E_NONE) {
+//                ICO_WRN("murphy: failed to send decision to client (%s)",
+//                        req->appid);
+//            }
+            req->state = state;
+        }
+    }
+
+    /* 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 (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);
+        }
+    }
+    else {
+        ICO_WRN("unknown resource id");
+    }
+
+    ICO_DBG("ico_syc_mrp_resource_cb: Leave");
+}
+                       
+static void
+ico_syc_mrp_state_cb(mrp_res_context_t *ctx,
+                     mrp_res_error_t err,
+                     void *userdata)
+{
+    if (err != MRP_RES_ERROR_NONE) {
+        ICO_DBG("murphy: state callback error");
+        return;
+    }
+
+    switch (ctx->state)
+    {
+        case MRP_RES_CONNECTED:
+            ICO_DBG("murphy: 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");
+            if (ctx) {
+                mrp_res_destroy(ctx);
+                mrp_ctx = NULL;
+            }
+            mrp_res_connected = FALSE;
+            break;
+        default:
+            ICO_DBG("murphy: state error");
+            break;
+    }
+}
+
+static void
+ico_syc_mrp_connect_notify(mrp_domctl_t *dc,int connected,
+                           int errcode, const char *errmsg,
+                           void *user_data)
+{
+}
+
+static void
+ico_syc_mrp_data_notify(mrp_domctl_t *dc,
+                        mrp_domctl_data_t *tables,
+                        int ntable, void *user_data)
+{
+}
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/lib/system-controller/ico_syc_mrp_resource_private.h b/lib/system-controller/ico_syc_mrp_resource_private.h
new file mode 100644 (file)
index 0000000..752d740
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ * 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_mrp_resource_private.h
+ *
+ *  @brief 
+ */
+//==========================================================================
+
+#ifndef __ICO_SYC_MRP_RESOURCE_PRIVATE_H__
+#define __ICO_SYC_MRP_RESOURCE_PRIVATE_H__
+
+#include <murphy/plugins/resource-native/libmurphy-resource/resource-api.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define ICO_APC_REQTYPE_REQUEST 0               /* Request from application         */
+#define ICO_APC_REQTYPE_CREATE  1               /* Request automaticaly             */
+
+// TODO 
+#define REQTYPE_APP             0
+#define REQTYPE_AUTO            1
+
+#define RESID_KIND_DISPLAY      0x00000001  
+#define RESID_KIND_SOUND        0x00000002  
+#define RESID_KIND_INPUT        0x00000004  
+#define RESID_KIND_MASK         0x000000FF  
+                                            
+#define RESID_TYPE_BASIC        0x00000100  
+#define RESID_TYPE_INTERRUPT    0x00000200  
+#define RESID_TYPE_ONSCREEN     0x00000400  
+#define RESID_TYPE_MASK         0x00000F00  
+
+#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 MURPHY_APPID_MAXIMUM_LENGTH 128
+
+typedef struct {
+    int  req_id;
+    char appid[MURPHY_APPID_MAXIMUM_LENGTH];
+    int  res_type;
+    int  zone_idx;
+    int  prio;
+    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  pid;             /* process id     */
+    int  state;           /* request state */
+
+    char *dispzone;       /* area of showing application window */
+    int  dispzoneid;      /* area of showing application window */
+    char *winname;        /* window's surface name */
+    int  surfaceid;       /* window id */
+
+    char *soundzone;      /* area of playing sound */
+    int  soundzoneid;     /* area of playing sound */
+    char *sooudname;      /* sound stream name */
+    int  soundid;         /* sound id */
+    int  soundadjust;     /* adjust action */
+
+    char *device;         /* input device name */
+    int  input;           /* input event id */
+
+    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 */
+    int                         released;
+
+} 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,
+                                            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);
+
+bool ico_syc_mrp_acquire_sound_resource(resource_request_t *req, int addprio);
+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);
+
+#ifdef __cplusplus
+}
+#endif
+#endif  /* __ICO_SYC_MRP_RESOURCE_PRIVATE_H__ */
+/* vim:set expandtab ts=4 sw=4: */
index 7a0031d..f280e67 100644 (file)
@@ -1,3 +1,13 @@
+* Fri Aug 30 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> submit/tizen/20130828.211623@0dc3864
+- 0.9.01 release
+-- This main changes is refactoring. (changed from c to c++ development language)
+-- The orientation of the ui screen changed.  horizon → vertical
+-- Add control bar in bottom of screen.
+-- Menu icon move to  the control bar from the status bar.
+-- Removed home icon on status bar.
+-- The homescreen process was split into system-controler and homescreen process.
+-- This version is not implement feature of running regulation.
+
 * Tue Aug 27 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> submit/tizen/20130823.170014@f9ac279
 - 0.7.03 release.
 -- Correction with the interface change of ico-uxf-weston-plugin.
index 2079a1c..09dc56f 100644 (file)
@@ -1,40 +1,44 @@
 Name:       ico-uxf-homescreen
-Summary:    Sample homescreen
-Version:    0.7.03
-Release:    1.1
-Group:      Graphics & UI Framework/Automotive UI
+Summary:    Sample homescreen and system controller
+Version:    0.9.01
+Release:    1.3
+Group:         Graphics & UI Framework/Automotive UI
 License:    Apache-2.0
 URL:        ""
 Source0:    %{name}-%{version}.tar.bz2
 
 BuildRequires: pkgconfig(wayland-client) >= 1.2
+BuildRequires: ico-uxf-weston-plugin-devel >= 0.7.01
 BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: ico-uxf-weston-plugin-devel >= 0.7.03
+BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(ecore-wayland)
 BuildRequires: pkgconfig(eina)
 BuildRequires: pkgconfig(evas)
 BuildRequires: pkgconfig(eina)
 BuildRequires: pkgconfig(edje)
 BuildRequires: pkgconfig(elementary)
-BuildRequires: pkgconfig(ecore-wayland)
-BuildRequires: pkgconfig(ecore-x)
 BuildRequires: pkgconfig(dbus-1)
 BuildRequires: pkgconfig(json-glib-1.0)
 BuildRequires: pkgconfig(aul)
-BuildRequires: pkgconfig(bundle)
 BuildRequires: pkgconfig(ail)
+BuildRequires: pkgconfig(bundle)
 BuildRequires: pkgconfig(pkgmgr)
+BuildRequires: pkgconfig(capi-appfw-application)
 BuildRequires: pkgconfig(libwebsockets)
-BuildRequires: capi-base-common-devel
-BuildRequires: edje-tools
-BuildRequires: ico-uxf-utilities-devel
-BuildRequires: fdupes
-BuildRequires: systemd
+BuildRequires: pkgconfig(murphy-common)
+BuildRequires: pkgconfig(murphy-domain-controller)
+BuildRequires: pkgconfig(murphy-ecore)
+BuildRequires: pkgconfig(murphy-resource)
+BuildRequires: boost-devel
+BuildRequires: ico-uxf-utilities-devel >= 0.2.01
 Requires: weston >= 1.2
+Requires: ico-uxf-weston-plugin >= 0.7.01
+Requires: ico-uxf-utilities >= 0.2.01
 
 %description
-Sample homescreen application.
+sample homescreen & system controller.
 
-%package devel
+%package system-controller-devel
 Summary:  Development files for %{name}
 Group:    Graphics & UI Framework/Development
 Requires: %{name} = %{version}-%{release}
@@ -46,129 +50,126 @@ Requires: pkgconfig(edje)
 Requires: pkgconfig(elementary)
 Requires: pkgconfig(ecore-wayland)
 Requires: pkgconfig(ecore-x)
-Requires: ico-uxf-utilities-devel
+Requires: pkgconfig(glib-2.0)
 
-%description devel
+%description system-controller-devel
 Development files for application that communicate homescreen.
 
 %prep
 %setup -q -n %{name}-%{version}
 
-%define PREFIX %{_prefix}/apps/
-
 %build
 %autogen
-
-%configure
 make %{?_smp_mflags}
 
-%define ico_unitdir_user %{_libdir}/systemd/user
-
 %install
 rm -rf %{buildroot}
+
 %make_install
 
-mkdir -p %{buildroot}%{_datadir}/applications/
-mkdir -p %{buildroot}%{_datadir}/packages/
-
-# include
-mkdir -p %{buildroot}/%{_includedir}/ico-appfw/
-cp -f include/ico_apf.h %{buildroot}/%{_includedir}/ico-appfw/
-cp -f include/ico_apf_error.h %{buildroot}/%{_includedir}/ico-appfw/
-cp -f include/ico_apf_resource_control.h %{buildroot}/%{_includedir}/ico-appfw/
-cp -f include/ico_apf_ecore.h %{buildroot}/%{_includedir}/ico-appfw/
-cp -f include/ico_apf_log.h %{buildroot}/%{_includedir}/ico-appfw/
-cp -f include/ico_uxf_sysdef.h %{buildroot}/%{_includedir}/ico-appfw/
-
-# homescreen
-%define APP org.tizen.ico.homescreen
-%define APPSDIR %{PREFIX}/%{APP}
-mkdir -p %{buildroot}%{APPSDIR}/bin/
-mkdir -p %{buildroot}%{APPSDIR}/res/edj
-mkdir -p %{buildroot}%{APPSDIR}/res/images
-mkdir -p %{buildroot}%{APPSDIR}/res/config
-cp -rf data/apps/%{APP} %{buildroot}/%{PREFIX}/
-cp -rf res/config %{buildroot}%{APPSDIR}/res/
-cp -rf res/apps/%{APP}/* %{buildroot}%{APPSDIR}/res/config/
-install -m 0755 src/HomeScreen %{buildroot}%{APPSDIR}/bin/
-install -m 0644 src/home_screen_bg.edj %{buildroot}%{APPSDIR}/res/edj
-install -m 0644 src/home_screen_touch.edj %{buildroot}%{APPSDIR}/res/edj
-install -m 0644 res/images/api_all_off.png %{buildroot}%{APPSDIR}/res/images
-install -m 0644 res/images/api_all_on.png %{buildroot}%{APPSDIR}/res/images
-install -m 0644 data/share/applications/%{APP}.desktop %{buildroot}%{_datadir}/applications/
-install -m 0644 data/share/packages/%{APP}.xml %{buildroot}%{_datadir}/packages/
-
-#statusbar
-%define APP org.tizen.ico.statusbar
-%define APPSDIR %{PREFIX}/%{APP}
-mkdir -p %{buildroot}%{APPSDIR}/bin/
-mkdir -p %{buildroot}%{APPSDIR}/res/edj
-mkdir -p %{buildroot}%{APPSDIR}/res/images
-mkdir -p %{buildroot}%{APPSDIR}/res/config
-cp -rf data/apps/%{APP} %{buildroot}/%{PREFIX}/
-cp -rf res/apps/%{APP}/* %{buildroot}%{APPSDIR}/res/config/
-install -m 0755 src/StatusBar %{buildroot}%{APPSDIR}/bin/
-install -m 0644 res/images/time*.png %{buildroot}%{APPSDIR}/res/images/
-install -m 0644 res/images/applist_*.png %{buildroot}%{APPSDIR}/res/images/
-install -m 0644 res/images/home*.png %{buildroot}%{APPSDIR}/res/images/
-install -m 0644 data/share/applications/%{APP}.desktop %{buildroot}%{_datadir}/applications/
-install -m 0644 data/share/packages/%{APP}.xml %{buildroot}%{_datadir}/packages/
-
-#onscreen
-%define APP org.tizen.ico.onscreen
-%define APPSDIR %{PREFIX}/%{APP}
-mkdir -p %{buildroot}%{APPSDIR}/bin/
-mkdir -p %{buildroot}%{APPSDIR}/res/edj
-mkdir -p %{buildroot}%{APPSDIR}/res/images
-mkdir -p %{buildroot}%{APPSDIR}/res/config
-cp -rf data/apps/%{APP} %{buildroot}/%{PREFIX}/
-cp -rf res/apps/%{APP}/* %{buildroot}%{APPSDIR}/res/config/
-install -m 0755 src/OnScreen %{buildroot}%{APPSDIR}/bin/
-install -m 0644 src/appli_list.edj %{buildroot}%{APPSDIR}/res/edj/
-install -m 0644 src/appli_kill.edj %{buildroot}%{APPSDIR}/res/edj/
-install -m 0644 data/share/applications/%{APP}.desktop %{buildroot}%{_datadir}/applications/
-install -m 0644 data/share/packages/%{APP}.xml %{buildroot}%{_datadir}/packages/
-
-#settings
-mkdir -p %{buildroot}/opt/etc/ico/
-install -m 0644 settings/mediation_table.txt  %{buildroot}/opt/etc/ico/
-mkdir -p %{buildroot}%{ico_unitdir_user}/weston.target.wants
-install -m 0644 settings/ico_homescreen.service %{buildroot}%{ico_unitdir_user}
-ln -sf ../ico_homescreen.service %{buildroot}%{ico_unitdir_user}/weston.target.wants/
-
-%fdupes -s %buildroot/%{PREFIX}
-
-# Update the package database (post only).
+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
+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
 
-%postun -p /sbin/ldconfig
+%preun
+
+%postun
+/sbin/ldconfig
+rm -f /usr/share/applications/org.tizen.ico.homescreen.desktop
+rm -f /usr/share/applications/org.tizen.ico.statusbar.desktop
+rm -f /usr/share/applications/org.tizen.ico.system-controller.desktop
+rm -f /home/app/layout.txt
+
+# Update the app database.
+%{_bindir}/pkg_initdb
+%{_bindir}/ail_initdb
 
 %files
 %defattr(-,root,root,-)
-%license LICENSE-2.0
-%{PREFIX}/org.tizen.ico.homescreen
-%{PREFIX}/org.tizen.ico.statusbar
-%{PREFIX}/org.tizen.ico.onscreen
-%{_datadir}/applications/*.desktop
-%{_datadir}/packages/*.xml
-/opt/etc/ico/mediation_table.txt
-%{ico_unitdir_user}/ico_homescreen.service
-%{ico_unitdir_user}/weston.target.wants/ico_homescreen.service
-
-%{_libdir}/*.so.*
-%{_bindir}/ico_*
-
-%files devel
+/usr/apps/org.tizen.ico.homescreen
+/usr/apps/org.tizen.ico.statusbar
+/usr/share/packages/org.tizen.ico.homescreen.xml
+/usr/share/packages/org.tizen.ico.statusbar.xml
+%{_libdir}/libico-appfw.*
+%{_libdir}/libico-state-machine.*
+/usr/apps/org.tizen.ico.system-controller
+/usr/share/packages/org.tizen.ico.system-controller.xml
+/usr/lib/systemd/user/ico-system-controller.service
+/usr/lib/systemd/user/weston.target.wants/ico-system-controller.service
+
+%files system-controller-devel
 %defattr(-,root,root,-)
-%{_includedir}/ico-appfw/ico_apf.h
-%{_includedir}/ico-appfw/ico_apf_error.h
-%{_includedir}/ico-appfw/ico_apf_resource_control.h
-%{_includedir}/ico-appfw/ico_apf_ecore.h
-%{_includedir}/ico-appfw/ico_apf_log.h
-%{_includedir}/ico-appfw/ico_uxf_sysdef.h
-%{_libdir}/*.so
+%{_includedir}/ico-appfw/ico_syc_application.h
+%{_includedir}/ico-appfw/ico_syc_appresctl.h
+%{_includedir}/ico-appfw/ico_syc_common.h
+%{_includedir}/ico-appfw/ico_syc_error.h
+%{_includedir}/ico-appfw/ico_syc_inputctl.h
+%{_includedir}/ico-appfw/ico_syc_private.h
+%{_includedir}/ico-appfw/ico_syc_privilege.h
+%{_includedir}/ico-appfw/ico_syc_type.h
+%{_includedir}/ico-appfw/ico_syc_userctl.h
+%{_includedir}/ico-appfw/ico_syc_winctl.h
+%{_includedir}/ico-state-machine/CicoBlockParser.h
+%{_includedir}/ico-state-machine/CicoEvent.h
+%{_includedir}/ico-state-machine/CicoEventInfo.h
+%{_includedir}/ico-state-machine/CicoFinalState.h
+%{_includedir}/ico-state-machine/CicoHistoryState.h
+%{_includedir}/ico-state-machine/CicoState.h
+%{_includedir}/ico-state-machine/CicoStateAction.h
+%{_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/reload_appcore.sh b/reload_appcore.sh
deleted file mode 100755 (executable)
index 4b085b7..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-#reload AppCore database
-/usr/bin/pkg_initdb
-/usr/bin/ail_initdb
-
diff --git a/res/apps/org.tizen.ico.homescreen/homescreen.conf.VERTICAL b/res/apps/org.tizen.ico.homescreen/homescreen.conf.VERTICAL
deleted file mode 100644 (file)
index 6b26ec8..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-[homescreen]
-#tileinfo_rowcnt=3
-#tileinfo_colcnt=5
-#tileinfo_valid=1;0;1;1;0;0;0;1;1;1;1;1;0;1;0
-#tileinfo_type=22;0;11;12;0;0;0;21;11;11;11;11;0;12;0
-#tileinfo_app0=org.tizen.browser
-#tileinfo_app3=org.tizen.music-player
-#tileinfo_app2=org.tizen.gallery
-#tileinfo_app7=org.tizen.setting
-#tileinfo_app8=org.tizen.calendar
-#tileinfo_app9=org.tizen.dialer
-#tileinfo_app10=org.tizen.calculator
-#tileinfo_app11=org.tizen.memo
-#tileinfo_app13=org.tizen.smartsearch
-#tileinfo_app14=none
-tileinfo_rowcnt=5
-tileinfo_colcnt=3
-tileinfo_valid=1;0;1;0;0;1;1;1;0;1;0;1;1;1;0
-tileinfo_type=22;0;11;0;0;21;11;11;0;12;0;11;11;12;0
-tileinfo_app0=org.tizen.browser
-tileinfo_app2=org.tizen.music-player
-tileinfo_app5=org.tizen.gallery
-tileinfo_app6=org.tizen.setting
-tileinfo_app7=org.tizen.calendar
-#tileinfo_app9=org.tizen.dialer
-tileinfo_app9=AKsMREAjt9
-tileinfo_app11=org.tizen.calculator
-tileinfo_app12=org.tizen.memo
-tileinfo_app13=org.tizen.smartsearch
-tileinfo_app14=none
-
-statusbar=org.tizen.ico.statusbar
-onscreen=org.tizen.ico.onscreen
-
-bgimage=/opt/usr/media/Images/Home_default.jpg
-
-[sound]
-#configuration for sounds
-sound_default=/usr/share/sounds/mm-camcorder/af_succeed.wav
-
diff --git a/res/config/system.conf b/res/config/system.conf
deleted file mode 100644 (file)
index 6208e63..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-## OpenPF System Configurations
-##  /usr/apps/org.tizen.ico.homescreen/res/config/system.conf
-##     May-15-2013
-
-## System ECUs
-[host]
-##      Center Display ECU
-# ECU name
-0=Center
-# ECU type
-0.type=Center
-# IP address(if environment valiable'SYSHOSTIP0' NOT defined)
-0.ip=127.0.0.1
-# This ECU has HomeScreen(null:no, not null:applicationId of HomeScreen)
-0.homescreen=org.tizen.ico.homescreen
-#
-
-## Displays
-[display]
-## Center Display
-# Display name
-0=Center
-# ECU name
-0.host=Center
-# Display Number
-0.displayno=0
-# Wayland connection name(ex.'wayland-0')
-0.wayland=wayland-0
-# Display Type
-0.type=Center
-# Display Size
-0.width=1920
-0.height=1080
-# number of Layers
-0.layer=5
-# inch (in 0.1 inchs)
-0.inch=101
-# Display Layer
-0.layer.0=BackGround
-0.layer.1=HomeScreen
-0.layer.2=Application
-0.layer.3=SoftKeyboard
-0.layer.4=InterruptApp
-0.layer.5=Touch
-0.layer.6=OnScreen;menuoverlap
-# Display Zone
-## id=name;x;y;width;height[;overlap-zone;overlap-zone;...]
-##   if 'id=name', size is all of display, no overlap
-0.zone.0=Base
-0.zone.1=Full;0;64;dispw;disph-64;Upper;Lower;UpperLeft;UpperRight;LowerLeft;LowerRight
-0.zone.2=Upper;0;64;dispw;disph-64/2;Full;UpperLeft;UpperRight
-0.zone.3=Lower;0;heigh-64/2+64;dispw;disph-64/2;Full;LowerLeft;LowerRight
-0.zone.4=UpperLeft;0;64;dispw/2;disph-64/2;Full;Upper
-0.zone.5=UpperRight;dispw/2;64;dispw/2;disph-64/2;Full;Upper
-0.zone.6=LowerLeft;0;heigh-64/2+64;dispw/2;disph-64/2;Full;Lower
-0.zone.7=LowerRight;dispw/2;heigh-64/2+64;dispw/2;disph-64/2;Full;Lower
-0.zone.8=SysApp;0;64;dispw;disph-64
-0.zone.9=SysApp.Left;0;64;dispw/2-140;disph-64
-0.zone.10=SysApp.Right;dispw/2+140;64;dispw/2-140;disph-64
-#
-## Sound
-[sound]
-## Center ECU
-# Sound device name
-0=Center
-# ECU name
-0.host=Center
-# Device Number
-0.soundno=0
-# Sound Zone
-## id=name[;overlap;overlap-zone;overlap-zone;...]
-0.zone.0=Base
-0.zone.1=Full
-0.zone.2=Driver
-
-## Port Numbers
-[port]
-# AppsController Port Number
-appscontrollerport=18081
-# PulseAudio UIFW-PlugIn Port Number
-soundpluginport=8088
-
-## Application Category name
-[category]
-0=Menu
-0.type=system
-0.view=always
-0.sound=always
-0.input=always
-0.priority=4
-1=Message
-1.type=message
-1.view=always
-1.sound=always
-1.input=always
-1.priority=5
-2=Map
-2.type=map
-2.view=always
-2.sound=always
-2.input=always
-2.priority=3
-3=Driving
-3.type=maker
-3.view=run
-3.sound=run
-3.input=run
-3.priority=2
-4=CarSetting
-4.type=maker
-4.view=shift_park
-4.sound=shift_park
-4.input=shift_park
-4.priority=2
-5=Camera.Back
-5.type=maker
-5.view=shift_back
-5.sound=shift_back
-5.input=shift_back
-5.priority=6
-6=Camera.Left
-6.type=maker
-6.view=blinker_left
-6.sound=blinker_left
-6.input=blinker_left
-6.priority=6
-7=Camera.Right
-7.type=maker
-7.view=blinker_right
-7.sound=blinker_right
-7.input=blinker_right
-7.priority=6
-8=Entertainment
-8.type=unknown
-8.view=parked
-8.sound=parked
-8.input=parked
-8.priority=0
-9=Entertainment.audio
-9.type=unknown
-9.view=parked
-9.sound=always
-9.input=always
-9.priority=0
-10=Entertainment.visual
-10.type=unknown
-10.view=always
-10.sound=parked
-10.input=always
-10.priority=0
-#
-## Application Kind
-[kind]
-0=Almighty
-0.privilege=almighty
-0.priority=5
-1=HomeScreen
-1.privilege=system
-1.priority=4
-2=SysApp
-2.privilege=system
-2.priority=3
-3=SysApp.audio
-3.privilege=system.audio
-3.priority=3
-4=SysApp.visual
-4.privilege=system.visible
-4.priority=3
-5=Maker
-5.privilege=maker
-5.priority=2
-6=Certificate
-6.privilege=certificate
-6.priority=1
-7=UnKnown
-7.privilege=none
-7.priority=0
-#
-## Fixed Input Sw
-[input]
-#-.sw.-=switch-name:appid[;keycode]
-0=DrivingForceGT
-0.sw.0=JS_UpDown
-0.sw.1=JS_LR
-0.sw.2=JS_Cross;org.tizen.ico.app-soundsample
-0.sw.3=JS_Square;org.tizen.ico.homescreen;0x0a
-0.sw.4=JS_Circle;org.tizen.ico.app-soundsample
-0.sw.5=JS_Triangle;org.tizen.ico.homescreen
-#
-## Default target
-[default]
-host=Center
-kind=UnKnown
-category=Entertainment.audio
-display=Center
-layer=Application
-displayzone=Full
-sound=Center
-soundzone=Full
-inputdev=DrivingForceGT
-inputsw=JS_UpDown
-#
-## default transition
-[transition]
-transition=none
-#
-## Log
-[log]
-# loglevel:ERROR=4,CRITICAL=8,WARNING=16,INFO=64,DEBUG=128
-loglevel=128
-# log flush on log output
-logflush=yes
-
diff --git a/res/images/applist_off.png b/res/images/applist_off.png
deleted file mode 100755 (executable)
index 5399236..0000000
Binary files a/res/images/applist_off.png and /dev/null differ
@@ -17,7 +17,7 @@ tileinfo_app14=none
 statusbar=org.tizen.ico.statusbar
 onscreen=org.tizen.ico.onscreen
 
-bgimage=/opt/usr/media/Images/image1.jpg
+bgimage=/opt/share/settings/Wallpapers/Home_default.jpg
 
 [sound]
 #configuration for sounds
@@ -1,8 +1,9 @@
 ## onscreen private configration
 [onscreen]
 wsport=10001
-#orientation(1:VERTICAL, 2:HORIZONTAL)
-#orientation=1
+#orientaion(1:VERTICAL, 2:HORIZONTAL)
+#orientaion=2
+
 
 [sound]
 #configuration for sounds
@@ -1,12 +1,11 @@
 ## statusbar private configration
 [statusbar]
 wsport=10001
-#orientation(1:VERTICAL, 2:HORIZONTAL)
-#orientation=1
+##orientaion(1:VERTICAL, 2:HORIZONTAL)
+#orientaion=2
 
 shortcut_app0=org.tizen.ico.app-samplenavi
 shortcut_app1=org.tizen.music-player
-shortcut_app2=AKsMREAjt9
 
 [sound]
 #configuration for sounds
diff --git a/res/org.tizen.ico.homescreen/res/config/app_attr.conf b/res/org.tizen.ico.homescreen/res/config/app_attr.conf
new file mode 100644 (file)
index 0000000..ca28016
--- /dev/null
@@ -0,0 +1,20 @@
+## OpenPF System Configurations
+##  /opt/apps/org.tizen.ico.homescreen/res/config/app_attr.conf
+##     May-15-2013
+
+#
+## default attributes for each application
+[app-attributes]
+# attrinutes of native applictions
+org.tizen.soft-keyboard=Menu;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
+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
+#
+
similarity index 96%
rename from res/config/system.conf.VERTICAL
rename to res/org.tizen.ico.homescreen/res/config/system.conf
index e174d20..51b6ab9 100644 (file)
@@ -1,5 +1,5 @@
 ## OpenPF System Configurations
-##  /usr/apps/org.tizen.ico.homescreen/res/config/system.conf
+##  /opt/apps/org.tizen.ico.homescreen/res/config/system.conf
 ##     May-15-2013
 
 ## System ECUs
@@ -29,6 +29,8 @@
 # Display Type
 0.type=Center
 # Display Size
+#0.width=1920
+#0.height=1080
 0.width=1080
 0.height=1920
 # number of Layers
@@ -176,14 +178,13 @@ soundpluginport=8088
 7.privilege=none
 7.priority=0
 #
-## Fixed Input Sw
+## Input Sw
 [input]
-#-.sw.-=switch-name:appid[;keycode]
 0=DrivingForceGT
 0.sw.0=JS_UpDown
 0.sw.1=JS_LR
 0.sw.2=JS_Cross;org.tizen.ico.app-soundsample
-0.sw.3=JS_Square;org.tizen.ico.homescreen;0x0a
+0.sw.3=JS_Square;org.tizen.ico.homescreen
 0.sw.4=JS_Circle;org.tizen.ico.app-soundsample
 0.sw.5=JS_Triangle;org.tizen.ico.homescreen
 #
diff --git a/res/org.tizen.ico.homescreen/res/images/applist_off.png b/res/org.tizen.ico.homescreen/res/images/applist_off.png
new file mode 100755 (executable)
index 0000000..ba433c8
Binary files /dev/null and b/res/org.tizen.ico.homescreen/res/images/applist_off.png differ
diff --git a/res/org.tizen.ico.homescreen/res/images/bg.png b/res/org.tizen.ico.homescreen/res/images/bg.png
new file mode 100644 (file)
index 0000000..78b6431
Binary files /dev/null and b/res/org.tizen.ico.homescreen/res/images/bg.png differ
diff --git a/res/org.tizen.ico.homescreen/res/images/bg_bk.png b/res/org.tizen.ico.homescreen/res/images/bg_bk.png
new file mode 100644 (file)
index 0000000..da932da
Binary files /dev/null and b/res/org.tizen.ico.homescreen/res/images/bg_bk.png differ
diff --git a/res/org.tizen.ico.homescreen/res/images/button_no.png b/res/org.tizen.ico.homescreen/res/images/button_no.png
new file mode 100644 (file)
index 0000000..282894b
Binary files /dev/null and b/res/org.tizen.ico.homescreen/res/images/button_no.png differ
diff --git a/res/org.tizen.ico.homescreen/res/images/button_really.png b/res/org.tizen.ico.homescreen/res/images/button_really.png
new file mode 100644 (file)
index 0000000..c1b2a06
Binary files /dev/null and b/res/org.tizen.ico.homescreen/res/images/button_really.png differ
diff --git a/res/org.tizen.ico.homescreen/res/images/button_yes.png b/res/org.tizen.ico.homescreen/res/images/button_yes.png
new file mode 100644 (file)
index 0000000..a2ebcfa
Binary files /dev/null and b/res/org.tizen.ico.homescreen/res/images/button_yes.png differ
diff --git a/res/org.tizen.ico.homescreen/res/images/ctrl.png b/res/org.tizen.ico.homescreen/res/images/ctrl.png
new file mode 100644 (file)
index 0000000..71d2843
Binary files /dev/null and b/res/org.tizen.ico.homescreen/res/images/ctrl.png differ
diff --git a/res/org.tizen.ico.homescreen/res/images/pagePointer_n.png b/res/org.tizen.ico.homescreen/res/images/pagePointer_n.png
new file mode 100644 (file)
index 0000000..c3cc73a
Binary files /dev/null and b/res/org.tizen.ico.homescreen/res/images/pagePointer_n.png differ
diff --git a/res/org.tizen.ico.homescreen/res/images/pagePointer_p.png b/res/org.tizen.ico.homescreen/res/images/pagePointer_p.png
new file mode 100644 (file)
index 0000000..4551f00
Binary files /dev/null and b/res/org.tizen.ico.homescreen/res/images/pagePointer_p.png differ
diff --git a/res/org.tizen.ico.homescreen/res/images/termIcon.png b/res/org.tizen.ico.homescreen/res/images/termIcon.png
new file mode 100644 (file)
index 0000000..0de7f07
Binary files /dev/null and b/res/org.tizen.ico.homescreen/res/images/termIcon.png differ
diff --git a/res/org.tizen.ico.system-controller/res/config/CicoSCSysResourceSM.json b/res/org.tizen.ico.system-controller/res/config/CicoSCSysResourceSM.json
new file mode 100644 (file)
index 0000000..e1a7313
--- /dev/null
@@ -0,0 +1,151 @@
+{
+    "stateMachine":{
+        "name":"ResourceControllerStt",
+        "value":10000,
+        "initial":["CpuLow", "MemLow"],
+        "state":{
+            "name":"Cpu",
+            "value":11000,
+            "state":{
+                "name":"CpuLow",
+                "value":11100,
+                "initial":["SRCCPU_LOW"],
+                "event":{
+                    "name":"ev1000",
+                    "value":1000,
+                    "transition":"CpuNoWacth",
+                    "guardCondition":{
+                        "operator":">",
+                        "value":50
+                    }
+                },
+                "state":{
+                    "name":"SRCCPU_LOW",
+                    "value":11101,
+                    "event":{
+                        "name":"ev1000",
+                        "value":1000 ,
+                        "transition":"SRCCPU_LOW"
+                    }
+                }
+            },
+            "state":{
+                "name":"CpuNoWacth",
+                "value":11200,
+                "event":{
+                    "name":"ev1000",
+                    "value":1000,
+                    "transition":"CpuHigh",
+                    "guardCondition":{
+                        "operator":">",
+                        "value":75
+                    }
+                },
+                "event":{
+                    "name":"ev1000",
+                    "value":1000,
+                    "transition":"CpuLow",
+                    "guardCondition":{
+                        "operator":"<",
+                        "value":40
+                    }
+                }
+            },
+            "state":{
+                "name":"CpuHigh",
+                "value":11300,
+                "initial":["SRCCPU_HIGH"],
+                "event":{
+                    "name":"ev1000",
+                    "value":1000,
+                    "transition":"CpuNoWacth",
+                    "guardCondition":{
+                        "operator":"<",
+                        "value":60
+                    }
+                },
+                "state":{
+                    "name":"SRCCPU_HIGH",
+                    "value":11301,
+                    "event":{
+                        "name":"ev1000",
+                        "value":1000 ,
+                        "transition":"SRCCPU_HIGH"
+                    }
+                }
+            }
+        },
+        "state":{
+            "name":"Memory",
+            "value":12000,
+            "state":{
+                "name":"MemLow",
+                "value":12100,
+                "initial":["SRCMEM_LOW"],
+                "event":{
+                    "name":"ev1001",
+                    "value":1001,
+                    "transition":"MemNoWacth",
+                    "guardCondition":{
+                        "operator":">",
+                        "value":50
+                    }
+                },
+                "state":{
+                    "name":"SRCMEM_LOW",
+                    "value":12101,
+                    "event":{
+                        "name":"ev1001",
+                        "value":1001 ,
+                        "transition":"SRCMEM_LOW"
+                    }
+                }
+            },
+            "state":{
+                "name":"MemNoWacth",
+                "value":12200,
+                "event":{
+                    "name":"ev1001",
+                    "value":1001,
+                    "transition":"MemHigh",
+                    "guardCondition":{
+                        "operator":">",
+                        "value":75
+                    }
+                },
+                "event":{
+                    "name":"ev1001",
+                    "value":1001,
+                    "transition":"MemLow",
+                    "guardCondition":{
+                        "operator":"<",
+                        "value":40
+                    }
+                }
+            },
+            "state":{
+                "name":"MemHigh",
+                "value":12300,
+                "initial":["SRCMEM_HIGH"],
+                "event":{
+                    "name":"ev1001",
+                    "value":1001,
+                    "transition":"MemNoWacth",
+                    "guardCondition":{
+                        "operator":"<",
+                        "value":60
+                    }
+                },
+                "state":{
+                    "name":"SRCMEM_HIGH",
+                    "value":12301,
+                    "event":{
+                        "name":"ev1001",
+                        "value":1001 ,
+                        "transition":"SRCMEM_HIGH"
+                    }
+                }
+            }
+        }
+    }
+}
similarity index 67%
rename from res/config/app_attr.conf
rename to res/org.tizen.ico.system-controller/res/config/app_attr.conf
index f9c081c..6e4c97c 100644 (file)
@@ -1,24 +1,14 @@
 ## OpenPF System Configurations
 ##  /usr/apps/org.tizen.ico.homescreen/res/config/app_attr.conf
-##     Jul-26-2013
+##     May-15-2013
 
 #
-## default icon
-[app-icon]
-default-icon=/opt/usr/apps/t8j6HTRpuz/res/wgt/images/tizen_32.png
-
 ## default attributes for each application
 [app-attributes]
-# attributes of HomeScreen
-org.tizen.ico.homescreen=Menu;HomeScreen;run=Center;noauto;type=menu
-org.tizen.ico.onscreen=Menu;HomeScreen;run=Center;noauto;type=menu
-org.tizen.ico.statusbar=Menu;HomeScreen;run=Center;noauto;type=menu
-
 # attrinutes of native applictions
 org.tizen.soft-keyboard=Menu;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
diff --git a/res/org.tizen.ico.system-controller/res/config/policy.json b/res/org.tizen.ico.system-controller/res/config/policy.json
new file mode 100644 (file)
index 0000000..1c8ee69
--- /dev/null
@@ -0,0 +1,728 @@
+"stateMachine":{
+  "name":"Policy",
+  "value":1,
+  "initial":[1001,2001,3001,9100,10100,12100,14100,16100,18100,20100,22100,24100,30100,32100],
+  "state":{
+    "name":"Driving",
+    "value":1000,
+    "state":{
+      "name":"Stopping",
+      "value":1001,
+      "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 }]}
+    }
+  },
+
+  "state":{
+    "name":"ShiftPos",
+    "value":2000,
+    "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}]}
+    },
+    "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}]}
+    },
+    "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 }]}
+    }
+  },
+
+  "state":{
+    "name":"Winker",
+    "value":3000,
+    "state":{
+      "name":"WinkerOff",
+      "value":3001,
+      "event":{ "name":"EV3000","value":3000, "transition":3002, "guardCondition":[{"operator":"=","value":1}]},
+      "event":{ "name":"EV3000","value":3000, "transition":3003, "guardCondition":[{"operator":"=","value":2}]}
+    },
+    "state":{
+      "name":"RightWinker",
+      "value":3002,
+      "event":{ "name":"EV3000","value":3000, "transition":3001, "guardCondition":[{"operator":"=","value":0}]},
+      "event":{ "name":"EV3000","value":3000, "transition":3003, "guardCondition":[{"operator":"=","value":2}]}
+    },
+    "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}]}
+    }
+  },
+
+  "state":{
+    "name":"DrivingRegulation",
+    "value":9000,
+    "state":{
+      "name":"NotRegulating",
+      "value":9100,
+      "event":{ "name":"EV9000","value":9000, "transition":9200, "guardCondition":[{"operator":"in","value":"Running"}]}
+    },
+    "state":{
+      "name":"Regulating",
+      "value":9200,
+      "event":{ "name":"EV9000","value":9000, "transition":9100, "guardCondition":[{"operator":"in","value":"Stopping"}]}
+    }
+  },
+
+  "state":{
+    "name":"Zone1",
+    "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"}]}
+    },
+
+    "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"}]}
+    },
+
+    "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"}]}
+    },
+
+    "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"}]}
+    },
+
+    "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"}]}
+    },
+
+    "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"}]}
+      }
+    },
+
+    "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"}]}
+    },
+
+    "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"}]}
+      }
+    }
+  },
+
+  "state":{
+    "name":"Screen2",
+    "value":12000,
+
+    "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"}]}
+    },
+
+    "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"}]}
+    },
+
+    "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"}]}
+    },
+
+    "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"}]}
+    },
+
+    "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"}]}
+    },
+
+    "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"}]}
+    },
+
+    "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"}]}
+      }
+    }
+  },
+
+  "state":{
+    "name":"OnScreen",
+    "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}]}
+    },
+    "state":{
+      "name":"OnScreen_Warning",
+      "value":14200,
+      "event":{ "name":"EV14001","value":14001, "transition":14100}
+    },
+    "state":{
+      "name":"OnScreen_Attention",
+      "value":14300,
+      "event":{ "name":"EV14001","value":14001, "transition":14100},
+      "event":{ "name":"EV14000","value":14000, "transition":14200, "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}]}
+    }
+  },
+
+  "state":{
+    "name":"IntZone1",
+    "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}]}
+    },
+    "state":{
+      "name":"IntZone1_Priority1",
+      "value":16200,
+      "event":{ "name":"EV16000","value":16001, "transition":16100}
+    },
+    "state":{
+      "name":"IntZone1_Priority2",
+      "value":16300,
+      "event":{ "name":"EV16000","value":16001, "transition":16100},
+      "event":{ "name":"EV16000","value":16000, "transition":16200, "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}]}
+    }
+  },
+  "state":{
+    "name":"IntScreen2",
+    "value":18000,
+    "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}]}
+    },
+    "state":{
+      "name":"IntScreen2_Priority1",
+      "value":18200,
+      "event":{ "name":"EV18000","value":18001, "transition":18100}
+    },
+    "state":{
+      "name":"IntScreen2_Priority2",
+      "value":18300,
+      "event":{ "name":"EV18000","value":18001, "transition":18100},
+      "event":{ "name":"EV18000","value":18000, "transition":18200, "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}]}
+    }
+  },
+  "state":{
+    "name":"AllSpeaker",
+    "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"}]}
+    }
+  },
+  "state":{
+    "name":"IntRightSpeaker",
+    "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}]}
+    },
+    "state":{
+      "name":"IntRightSpeaker_Priority1",
+      "value":22200,
+      "event":{ "name":"EV22001","value":22001, "transition":22100}
+    },
+    "state":{
+      "name":"IntRightSpeaker_Priority2",
+      "value":22300,
+      "event":{ "name":"EV22001","value":22001, "transition":22100},
+      "event":{ "name":"EV22000","value":22000, "transition":22200, "guardCondition":[{"operator":"=","value":1}]}
+    },
+    "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}]}
+    }
+  },
+  "state":{
+    "name":"IntLeftSpeaker",
+    "value":24000,
+    "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}]}
+    },
+    "state":{
+      "name":"IntLeftSpeaker_Priority1",
+      "value":24200,
+      "event":{ "name":"EV24001","value":24001, "transition":24100}
+    },
+    "state":{
+      "name":"IntLeftSpeaker_Priority2",
+      "value":24300,
+      "event":{ "name":"EV24001","value":24001, "transition":24100},
+      "event":{ "name":"EV24000","value":24000, "transition":24200, "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}]}
+    }
+  },
+
+  "state":{
+    "name":"STSW",
+    "value":30000,
+    "state":{
+      "name":"STSW_NotUsing",
+      "value":30100,
+      "event":{ "name":"EV30000","value":30000, "transition":30200}
+    },
+    "state":{
+      "name":"STSW_Using",
+      "value":30200,
+      "event":{ "name":"EV30000","value":30001, "transition":30100}
+    }
+  },
+
+  "state":{
+    "name":"ESW",
+    "value":32000,
+    "state":{
+      "name":"ESW_NotUsing",
+      "value":32100,
+      "event":{ "name":"EV30000","value":32000, "transition":32200}
+    },
+    "state":{
+      "name":"ESW_Using",
+      "value":32200,
+      "event":{ "name":"EV30000","value":32001, "transition":32100}
+    }
+  },
+
+  "finalState":{"name":"TheEnd","value":9999 }
+}
diff --git a/res/org.tizen.ico.system-controller/res/config/system.xml b/res/org.tizen.ico.system-controller/res/config/system.xml
new file mode 100644 (file)
index 0000000..fd35bea
--- /dev/null
@@ -0,0 +1,328 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     OpenPF System Configurations 
+    /opt/apps/org.tizen.ico.homescreen/res/config/system.conf
+-->
+
+<systemconfig>
+<nodes>
+    <node id="0" name="Center">
+        <type>Center</type>
+        <ipaddress>127.0.0.1</ipaddress>
+    </node>
+</nodes>
+
+<displays>
+    <display id="0" name="Center">
+        <node>Center</node>
+        <no>0</no>
+        <wayland>waylnad-0</wayland>
+        <type>center</type>
+        <width>1080</width>
+        <height>1920</height>
+        <inch>101</inch>
+        <layers>
+            <layer id="0" name="BackGround">
+                <!-- type 1: background 2:normal 4:cursor 8:input -->
+                <type>1</type>
+                <menuoverlap>false</menuoverlap>
+            </layer>
+            <layer id="1" name="HomeScreen">
+                <type>2</type>
+                <menuoverlap>false</menuoverlap>
+            </layer>
+            <layer id="2" name="Application">
+                <type>2</type>
+                <menuoverlap>false</menuoverlap>
+            </layer>
+            <layer id="3" name="SoftKeyboard">
+                <type>8</type>
+                <menuoverlap>false</menuoverlap>
+            </layer>
+            <layer id="4" name="InterruptApp">
+                <type>2</type>
+                <menuoverlap>false</menuoverlap>
+            </layer>
+            <layer id="5" name="Touch">
+                <type>8</type>
+                <menuoverlap>false</menuoverlap>
+            </layer>
+            <layer id="6" name="OnScreen">
+                <type>2</type>
+                <menuoverlap>true</menuoverlap>
+            </layer>
+            <layer id="7" name="Cursor">
+                <type>4</type>
+                <menuoverlap>false</menuoverlap>
+            </layer>
+        </layers>
+        <zones>
+            <zone id="0" name="Base">
+                <geometry x="-1" y="-1" w="-1" h="-1"/>
+                <overlap/>
+            </zone>
+            <zone id="1" name="Full">
+                <geometry x="0" y="64" w="dispw" h="disph-64-128"/>
+                <overlap>Upper;Lower;UpperLeft;UpperRight;LowerLeft;LowerRight</overlap>
+            </zone>
+            <zone id="2" name="Upper">
+                <geometry x="0" y="64" w="dispw" h="disph-64-128/2"/>
+                <overlap>Full;UpperLeft;UpperRight</overlap>
+            </zone>
+            <zone id="3" name="Lower">
+                <geometry x="0" y="height-64-128/2+64" w="dispw" h="disph-64-128/2"/>
+                <overlap>Full;LowerLeft;LowerRight</overlap>
+            </zone>
+            <zone id="4" name="UpperLeft">
+                <geometry x="0" y="64" w="dispw/2" h="disph-64-128/2"/>
+                <overlap>Full;Upper</overlap>
+            </zone>
+            <zone id="5" name="UpperRight">
+                <geometry x="dispw/2" y="64" w="dispw/2" h="disph-64-128/2"/>
+                <overlap>Full;Upper</overlap>
+            </zone>
+            <zone id="6" name="LowerLeft">
+                <geometry x="0" y="heigh-64-128/2+64" w="dispw/2" h="disph-64-128/2"/>
+                <overlap>Full;Lower</overlap>
+            </zone>
+            <zone id="7" name="LowerRight">
+                <geometry x="dispw/2" y="heigh-64-128/2+64" w="dispw/2" h="disph-64-128/2"/>
+                <overlap>Full;Lower</overlap>
+            </zone>
+            <zone id="8" name="SysApp">
+                <geometry x="0" y="64" w="dispw" h="disph-64-128"/>
+                <overlap/>
+            </zone>
+            <zone id="9" name="SysApp.Left">
+                <geometry x="0" y="64" w="dispw/2-181" h="disph-64-128"/>
+                <overlap/>
+            </zone>
+            <zone id="10" name="SysApp.Right">
+                <geometry x="dispw/2+181" y="64" w="dispw/2-181" h="disph-64-128"/>
+                <overlap/>
+            </zone>
+        </zones>
+    </display>
+</displays>
+
+<sounds>
+    <sound id="0" name="Center">
+        <node>Center</node>
+        <no>0</no>
+        <zones>
+            <zone id="0" name="Base"/>
+            <zone id="1" name="Full"/>
+            <zone id="2" name="Driver"/>
+        </zones>
+    </sound>
+</sounds>
+
+<ports>
+    <port id="0" name="AppController">18081</port>
+    <port id="1" name="PluseAudio">8088</port>
+</ports>
+
+<!-- Application Category name -->
+<categorys>
+    <category id="0" name="Menu">
+        <type>system</type>
+        <view>always</view>
+        <sound>always</sound>
+        <input>always</input>
+        <priority>4</priority>
+        <r_ctrl>2</r_ctrl>
+    </category>
+    <category id="1" name="Message">
+        <type>message</type>
+        <view>always</view>
+        <sound>always</sound>
+        <input>always</input>
+        <priority>5</priority>
+        <r_ctrl>2</r_ctrl>
+    </category>
+    <category id="2" name="Map">
+        <type>map</type>
+        <view>always</view>
+        <sound>always</sound>
+        <input>always</input>
+        <priority>3</priority>
+        <r_ctrl>0</r_ctrl>
+    </category>
+    <category id="3" name="Driving">
+        <type>maker</type>
+        <view>run</view>
+        <sound>run</sound>
+        <input>run</input>
+        <priority>2</priority>
+        <r_ctrl>0</r_ctrl>
+    </category>
+    <category id="4" name="CarSetting">
+        <type>maker</type>
+        <view>parked</view>
+        <sound>parked</sound>
+        <input>parked</input>
+        <priority>2</priority>
+        <r_ctrl>0</r_ctrl>
+    </category>
+    <category id="5" name="Camera.Back">
+        <type>maker</type>
+        <view>shift_back</view>
+        <sound>shift_back</sound>
+        <input>shift_back</input>
+        <priority>6</priority>
+        <r_ctrl>1</r_ctrl>
+    </category>
+    <category id="6" name="Camera.Left">
+        <type>maker</type>
+        <view>blinker_left</view>
+        <sound>blinker_left</sound>
+        <input>blinker_left</input>
+        <priority>6</priority>
+        <r_ctrl>1</r_ctrl>
+    </category>
+    <category id="7" name="Camera.Right">
+        <type>maker</type>
+        <view>blinker_right</view>
+        <sound>blinker_right</sound>
+        <input>blinker_right</input>
+        <priority>6</priority>
+        <r_ctrl>1</r_ctrl>
+    </category>
+    <category id="8" name="Entertainment">
+        <type>unknown</type>
+        <view>parked</view>
+        <sound>parked</sound>
+        <input>parked</input>
+        <priority>0</priority>
+        <r_ctrl>2</r_ctrl>
+    </category>
+    <category id="9" name="Entertainment.audio">
+        <type>unknown</type>
+        <view>parked</view>
+        <sound>always</sound>
+        <input>always</input>
+        <priority>0</priority>
+        <r_ctrl>1</r_ctrl>
+    </category>
+    <category id="10" name="Entertainment.visiual">
+        <type>unknown</type>
+        <view>always</view>
+        <sound>parked</sound>
+        <input>always</input>
+        <priority>0</priority>
+        <r_ctrl>1</r_ctrl>
+    </category>
+</categorys>
+
+<appkinds>
+    <appkind id="0" name="Almighty">
+        <privilege>almighty</privilege>
+        <priority>5</priority>
+    </appkind>
+    <appkind id="1" name="HomeScreen">
+        <privilege>system</privilege>
+        <priority>4</priority>
+    </appkind>
+    <appkind id="2" name="SysApp">
+        <privilege>system</privilege>
+        <priority>3</priority>
+    </appkind>
+    <appkind id="3" name="SysApp.audio">
+        <privilege>system.audio</privilege>
+        <priority>3</priority>
+    </appkind>
+    <appkind id="4" name="SysApp.visiual">
+        <privilege>system.visible</privilege>
+        <priority>3</priority>
+    </appkind>
+    <appkind id="5" name="Maker">
+        <privilege>maker</privilege>
+        <priority>2</priority>
+    </appkind>
+    <appkind id="6" name="Certificate">
+        <privilege>certificate</privilege>
+        <priority>1</priority>
+    </appkind>
+    <appkind id="7" name="UnKnown">
+        <privilege>none</privilege>
+        <priority>0</priority>
+    </appkind>
+</appkinds>
+
+<inputs>
+    <input id="0" name="DrivingForceGT">
+        <switchs>
+            <switch id="0" name="JS_UpDown" appid=""/>
+            <switch id="1" name="JS_LR" appid=""/>
+            <switch id="2" name="JS_Cross" appid="org.tizen.ico.app-soundsample"/>
+            <switch id="3" name="JS_Square" appid="org.tizen.ico.homescreen"/>
+            <switch id="4" name="JS_Circle" appid="org.tizen.ico.app-soundsample"/>
+            <switch id="5" name="JS_Triangle" appid="org.tizen.ico.homescreen"/>
+        </switchs>
+    </input>
+</inputs>
+
+<resource_cpu_control>
+    <do_it>yes</do_it>
+    <ctrl_dir_path>/sys/fs/cgroup/cpu,cpuacct/SCprivate</ctrl_dir_path>
+    <sampling_wait>300</sampling_wait>
+    <sector id="0" name="groupA">
+        <hight_array>
+            <item>500</item>
+            <item>600</item>
+            <item>700</item>
+        </hight_array>
+        <low_array>
+            <item>1000</item>
+            <item>500</item>
+            <item>600</item>
+        </low_array>
+    </sector>
+    <sector id="1" name="groupB">
+        <hight_array>
+            <item>300</item>
+            <item>250</item>
+            <item>200</item>
+        </hight_array>
+        <low_array>
+            <item>1000</item>
+            <item>300</item>
+            <item>250</item>
+        </low_array>
+    </sector>
+    <sector id="2" name="groupC">
+        <hight_array>
+            <item>200</item>
+            <item>150</item>
+            <item>100</item>
+        </hight_array>
+        <low_array>
+            <item>1000</item>
+            <item>200</item>
+            <item>150</item>
+        </low_array>
+    </sector>
+</resource_cpu_control>
+
+<default>
+    <node>Center</node>
+    <appkind>UnKnown</appkind>
+    <category>Entertainment.audio</category>
+    <display>Center</display>
+    <layer>Application</layer>
+    <displayzone>Full</displayzone>
+    <sound>Center</sound>
+    <soundzone>Full</soundzone>
+    <inputdev>DrivingForceGT</inputdev>
+    <inputsw>JS_UpDown</inputsw>
+</default>
+
+<transition>none</transition>
+
+<log>
+    <!-- loglevel:ERROR=4,CRITICAL=8,WARNING=16,INFO=64,DEBUG=128 -->
+    <loglevel>128</loglevel>
+    <logflush>false</logflush>
+</log>
+</systemconfig>
+<!-- vim:set expandtab ts=4 sw=4: -->
diff --git a/res/org.tizen.ico.system-controller/res/config/user.xml b/res/org.tizen.ico.system-controller/res/config/user.xml
new file mode 100644 (file)
index 0000000..853d8b7
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     OpenPF User Configurations 
+-->
+
+<userconfig>
+<users>
+    <user>
+        <name>Alice</name>
+        <passwd></passwd>
+        <hs>org.tizen.ico.homescreen</hs>
+    </user>
+    <user>
+        <name>Bob</name>
+        <passwd></passwd>
+        <hs>org.tizen.ico.homescreen</hs>
+    </user>
+</users>
+
+<default>
+    <user>
+        <name>Alice</name>
+    </user>
+</default>
+
+<homescreens>
+    <homescreen name="org.tizen.ico.homescreen"/>
+</homescreens>
+</userconfig>
+<!-- vim:set expandtab ts=4 sw=4: -->
diff --git a/settings/ico_homescreen.service b/settings/ico_homescreen.service
deleted file mode 100644 (file)
index 28023dd..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Ico HomeScreen
-Requires=weston.target
-After=weston.target
-
-[Service]
-ExecStart=/usr/bin/launch_app org.tizen.ico.homescreen &
-
-[Install]
-WantedBy=weston.target
diff --git a/settings/ico_homescreen.sh b/settings/ico_homescreen.sh
deleted file mode 100755 (executable)
index bf85b18..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-/usr/bin/echo "launch kick HomeScreen sleeping"
-sleep 20
-/usr/bin/echo "launch kick HomeScreen org.tizen.ico.homescreen"
-/usr/bin/launch_app org.tizen.ico.homescreen &
-/usr/bin/echo "launch end  HomeScreen org.tizen.ico.homescreen"
-
diff --git a/settings/mediation_table.txt b/settings/mediation_table.txt
deleted file mode 100644 (file)
index eb68dfd..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-[sound source]
-HOMESCREEN_BEEP=interrupt;beep;99;mute;non;non
-
-[application name]
-
-[application category]
index ff33a3a..1202654 100644 (file)
@@ -1,49 +1,3 @@
-AM_CFLAGS = $(GCC_CFLAGS)
-AM_CPPFLAGS = $(GCC_CFLAGS)
-
-COMMON_LIBS = -lm -lwebsockets -lico-uxf-weston-plugin
-
-noinst_PROGRAMS   = \
-       HomeScreen              \
-       OnScreen                \
-       StatusBar
-
-
-HomeScreen_SOURCES = \
-       home_screen_main.c              \
-       home_screen_conf.c      \
-       home_screen_parser.c                    \
-       home_screen_lib.c               \
-       home_screen_sound.c             \
-       resource_conf.c
-HomeScreen_CFLAGS = -I../include $(EFL_CFLAGS) $(OPT_CFLAGS) $(WL_CFLAGS) $(AUL_CFLAGS) $(UWS_CFLAGS)
-HomeScreen_LDADD = ../apps_controller/libico_syc-apc.a ../ico-app-framework/.libs/libico-app-fw-efl.so ../ico-app-framework/.libs/libico-app-fw.so $(EFL_LIBS) $(OPT_LIBS) $(WL_LIBS) $(COMMON_LIBS) $(DBUS_LIBS) $(UWS_LIBS)
-
-OnScreen_SOURCES = \
-       on_screen.c             \
-       home_screen_conf.c      \
-       home_screen_sound.c             \
-       resource_conf.c
-OnScreen_CFLAGS = -I../include $(EFL_CFLAGS) $(OPT_CFLAGS) $(WL_CFLAGS) $(AUL_CFLAGS) $(UWS_CFLAGS) -I/usr/include/ico-util
-OnScreen_LDADD = ../apps_controller/libico_syc-apc.a ../ico-app-framework/.libs/libico-app-fw-efl.so ../ico-app-framework/.libs/libico-app-fw.so $(EFL_LIBS) $(OPT_LIBS) $(WL_LIBS) $(COMMON_LIBS) $(AUL_LIBS) $(UWS_LIBS)
-
-StatusBar_SOURCES = \
-       status_bar.c    \
-       home_screen_conf.c      \
-       home_screen_sound.c             \
-       resource_conf.c
-StatusBar_CFLAGS = -I../include $(EFL_CFLAGS) $(OPT_CFLAGS) $(WL_CFLAGS) $(AUL_CFLAGS) $(UWS_CFLAGS)
-StatusBar_LDADD = ../apps_controller/libico_syc-apc.a ../ico-app-framework/.libs/libico-app-fw-efl.so ../ico-app-framework/.libs/libico-app-fw.so $(EFL_LIBS) $(OPT_LIBS) $(WL_LIBS) $(COMMON_LIBS) $(AUL_LIBS) $(UWS_LIBS)
-
-SUFFIXES = .edc .edj
-
-BUILT_SOURCES = \
-       home_screen_bg.edj      \
-       home_screen_touch.edj   \
-       appli_list.edj  \
-       appli_kill.edj
-
-.edc.edj:  
-       edje_cc $< -id ../res/images -fd ../res/images -sd ../res/sounds -o $@
-
-CLEANFILES = $(BUILT_SOURCES)
+SUBDIRS=    \
+   syscond  \
+   homescreen
diff --git a/src/home_screen_lib.c b/src/home_screen_lib.c
deleted file mode 100644 (file)
index efdee62..0000000
+++ /dev/null
@@ -1,1506 +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   library to communicate with outer process
- *
- * @date    Feb-15-2013
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <string.h>
-#include <math.h>
-#include <glib.h>
-#include <stdbool.h>
-#include <sys/epoll.h>
-
-#include <getopt.h>
-
-#include <Eina.h>
-#include <Ecore.h>
-#include <Ecore_Evas.h>
-#include <Edje.h>
-
-#include <ico_uws.h>
-
-#include "ico_uxf.h"
-#include "ico_uxf_conf_common.h"
-
-#include "home_screen_parser.h"
-#include "home_screen.h"
-#include "home_screen_lib.h"
-
-/*============================================================================*/
-/* definition                                                                 */
-/*============================================================================*/
-#define WEBSOCKET_MAX_BUFFER    (4096)
-typedef struct _hs_lib_poll hs_lib_poll_t;
-typedef struct _hs_lib_handle hs_lib_handle_t;
-typedef struct _hs_lib_msg hs_lib_msg_t;
-
-/* management connection */
-struct _hs_lib_handle {
-    hs_lib_handle_t *next; /* next handle                          */
-    int fd;                /* Socket file descriptor               */
-    int service_on;
-    int type;
-    struct ico_uws_context *uws_context;
-    /* Context of libwebsockets             */
-    void *id;              /* id                                   */
-    hs_lib_poll_t *poll;
-    char appid[ICO_UXF_MAX_PROCESS_NAME];
-};
-
-struct _hs_lib_poll {
-    hs_lib_poll_t *next;
-    int fd;
-    int flags;
-    void *user_data;
-    hs_lib_handle_t *handle;
-};
-
-struct _hs_lib_msg {
-    hs_lib_msg_t *next;
-    char *data;
-    int len;
-    int type;
-    hs_lib_handle_t *handle;
-};
-
-/*============================================================================*/
-/* variabe                                                                    */
-/*============================================================================*/
-static struct ico_uws_context *hs_wsicontext = NULL;
-static hs_lib_msg_t *hs_send_msg = NULL;
-static hs_lib_msg_t *hs_recv_msg = NULL;
-static hs_lib_msg_t *hs_free_msg = NULL;
-static hs_lib_handle_t *hs_handles = NULL;
-static hs_lib_handle_t *hs_handles_free = NULL;
-static hs_lib_poll_t *hs_polls = NULL;
-static hs_lib_poll_t *hs_polls_free = NULL;
-
-/*============================================================================*/
-/* Function prototype for static(internal) functions                          */
-/*============================================================================*/
-static hs_lib_handle_t *hs_lib_setup_server(const char *uri, 
-        const char *protocol, ico_uws_evt_cb callback);
-static void hs_lib_callback_uws(const struct ico_uws_context *context,
-                    const ico_uws_evt_e event, const void *id,
-                    const ico_uws_detail *detail, void *data);
-static void hs_lib_handle_command(hs_lib_msg_t *msg);
-static void hs_lib_handle_application(hs_lib_msg_t *msg);
-static void hs_lib_handle_onscreen(hs_lib_msg_t *msg);
-static hs_lib_msg_t *hs_lib_alloc_msg(char *data, int len);
-static void hs_lib_free_msg(hs_lib_msg_t *msg);
-static void hs_lib_free_handle(hs_lib_handle_t *handle);
-static hs_lib_handle_t *hs_lib_alloc_handle(void);
-static void hs_lib_realsend(hs_lib_msg_t *msg);
-static hs_lib_msg_t *hs_lib_get_sendmsg(int type);
-static int hs_lib_put_sendmsg(hs_lib_msg_t *send);
-static hs_lib_msg_t *hs_lib_get_recvmsg(void);
-static void hs_lib_put_recvmsg(hs_lib_msg_t *recv);
-static void hs_lib_com_dispatch(hs_lib_handle_t *_handle, int timeoutms);
-static void hs_lib_poll_fd_event(hs_lib_poll_t *poll, int flags);
-static Eina_Bool hs_lib_ecore_fdevent(void *data, Ecore_Fd_Handler *handler);
-static void hs_lib_control_fd(hs_lib_poll_t *fd_ctl[], const int num_fds);
-static int hs_lib_add_poll_fd(int fd, int flags);
-static void hs_lib_del_poll_fd(int fd);
-static void hs_lib_set_mode_poll_fd(int fd, int flags);
-static void hs_lib_clear_mode_poll_fd(int fd, int flags);
-static char *get_parsed_str(char *in, char *out, int len, int arg_idx);
-static char *getFileName(char *filepath, int len);
-
-/*============================================================================*/
-/* functions                                                                  */
-/*============================================================================*/
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_handle_command
- *          callback at received message from external command tools,
- *          and handle the message.
- *
- * @param[in]   msg                 received message
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_lib_handle_command(hs_lib_msg_t *msg)
-{
-    int cnt = 0;
-    int ret;
-    char buff[ICO_HS_MSG_SIZE];
-    hs_lib_msg_t *send;
-
-    uifw_trace("hs_lib_handle_command: Enter");
-
-    if (strcmp(msg->data, HS_REQ_ANS_HELLO) == 0) {
-        memset(buff, 0, sizeof(buff));
-
-        send = hs_lib_alloc_msg("ANS HELLO", strlen("ANS HELLO"));
-        if (!send) {
-            uifw_warn("hs_lib_handle_command: ERROR(allocate send msg)");
-            return;
-        }
-        send->type = ICO_HS_PROTOCOL_TYPE_CM;
-
-        hs_lib_put_sendmsg(send);
-
-        uifw_trace("hs_lib_handle_command: Leave");
-
-        return;
-    }
-
-    /* data sent by command is parsed and controlled for the window */
-    ret = hs_parse_form(msg->data, msg->len);
-    if (hs_req_touch == ICO_HS_TOUCH_TOBE_HIDE) {
-        hs_show_appscreen(NULL);
-        hs_control_app_screen();
-    }
-    else if (hs_req_touch == ICO_HS_TOUCH_TOBE_SHOW) {
-        hs_get_tilescreendata();
-        hs_dump_app();
-        hs_req_ctlr_tile();
-    }
-
-    /* return message */
-    memset(buff, 0, sizeof(buff));
-    if (ret == 0) {
-        cnt = snprintf(buff, sizeof(buff), "ANS %s OK", msg->data);
-    }
-    else {
-        cnt = snprintf(buff, sizeof(buff), "ERR %s FAILED", msg->data);
-    }
-
-    if (cnt > 0) {
-        send = hs_lib_alloc_msg(buff, cnt);
-        if (!send) {
-            uifw_warn("hs_lib_handle_command: ERROR(allocate send msg)");
-            return;
-        }
-        send->type = ICO_HS_PROTOCOL_TYPE_CM;
-
-        hs_lib_put_sendmsg(send);
-    }
-
-    uifw_trace("hs_lib_handle_command: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_handle_application
- *          callback at received message from a application, and handle the
- *          message.
- *
- * @param[in]   msg                 received message
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_lib_handle_application(hs_lib_msg_t *msg)
-{
-    char *app_id;
-    char msg_data[ICO_HS_MSG_SIZE];
-    char tmp_buf[ICO_HS_MSG_SIZE];
-    char *data = msg->data;
-    hs_lib_msg_t *send;
-
-    uifw_trace("hs_lib_handle_application: Enter");
-
-    if (strncmp("OPEN", data, 4) == 0) {
-        strncpy(msg_data, get_parsed_str(data, tmp_buf, sizeof(tmp_buf), 2),
-                sizeof(msg_data));
-        app_id = msg_data;
-        uifw_trace("hs_lib_callback_app: app_id = %s, msg_data - %s, in - %s",
-                   app_id, msg_data, data);
-        strncpy(hs_active_onscreen, app_id, sizeof(hs_active_onscreen));
-        strncpy(msg->handle->appid, app_id, sizeof(hs_active_onscreen));
-
-        send = hs_lib_alloc_msg(data, msg->len);
-        if (!send) {
-            uifw_warn("hs_lib_callback_app: ERROR(allocate send msg)");
-            return;
-        }
-        send->type = ICO_HS_PROTOCOL_TYPE_OS;
-
-        hs_lib_put_sendmsg(send);
-    }
-    else if (strncmp("CLOSE", data, 5) == 0) {
-        /* native apps only */
-        hs_hide_onscreen();
-        memset(hs_active_onscreen, 0, sizeof(hs_active_onscreen));
-    }
-    uifw_trace("hs_lib_handle_application: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_handle_onscreen
- *          callback at received message from onscreen, and handle the
- *          message.
- *
- * @param[in]   msg                 received message
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_lib_handle_onscreen(hs_lib_msg_t *msg)
-{
-    char msg_buf[ICO_HS_MSG_SIZE];
-    char msg_data[ICO_HS_MSG_SIZE];
-    char tmp_buf[ICO_HS_MSG_SIZE];
-    char *p_msg_data;
-    char *ptr;
-    int ret, idx;
-    const Ico_Uxf_conf_application *appConf = NULL;
-    char *data = msg->data;
-    hs_lib_msg_t *send;
-
-    uifw_trace("hs_lib_handle_onscreen: Enter");
-
-    /* init buffers */
-    memset(msg_data, 0x00, sizeof(msg_data));
-    p_msg_data = &msg_data[0];
-    strncpy(p_msg_data, data, msg->len);
-
-    uifw_trace("hs_lib_handle_onscreen: hs_active_onscreen = %s",
-               hs_active_onscreen);
-    /* parse message from OnScreen */
-    if (strncmp("RESULT", p_msg_data, 6) == 0) {
-        /* get 2nd phrase */
-        ptr = get_parsed_str(p_msg_data, tmp_buf, sizeof(tmp_buf), 1);
-        if (strncmp("SUCCESS", ptr, 7) == 0) {
-            /* loaded edje: success */
-            hs_show_onscreen();
-            send = hs_lib_alloc_msg(data, msg->len);
-            if (!send) {
-                uifw_warn("hs_lib_handle_onscreen: ERROR(allocate send msg)");
-                return;
-            }
-            send->type = ICO_HS_PROTOCOL_TYPE_APP;
-            hs_lib_put_sendmsg(send);
-        }
-        else if (strncmp("FAILED", ptr, 6) == 0) {
-            /* not loaded edje: failed */
-            if (strcmp(hs_active_onscreen, ICO_UXF_PROC_DEFAULT_HOMESCREEN)
-                    == 0) {
-                /* appli_list or appli_kill: raise touch layer */
-                hs_hide_onscreen();
-            }
-            else {
-                /* native apps: raise own */
-                hs_hide_onscreen();
-            }
-            memset(hs_active_onscreen, 0, sizeof(hs_active_onscreen));
-        }
-    }
-    else if (strncmp("TOUCH", data, 5) == 0) {
-        if (strlen(hs_active_onscreen) == 0) {
-            /* do nothing */
-        }
-        else if (strcmp(hs_active_onscreen, ICO_UXF_PROC_DEFAULT_HOMESCREEN)
-                 == 0)  {
-            /* get 2nd phrase */
-            ptr = get_parsed_str(p_msg_data, tmp_buf, sizeof(tmp_buf), 1);
-            if (strncmp(getFileName(ptr, strlen(ptr)),
-                        ICO_HS_ONS_APPLI_LIST_NAME,
-                        sizeof(ICO_HS_ONS_APPLI_LIST_NAME)) == 0) {
-                /* get 3rd phrase */
-                ptr = get_parsed_str(p_msg_data, tmp_buf, sizeof(tmp_buf), 2);
-                appConf = ico_uxf_getAppByAppid(ptr);
-                uifw_trace("hs_lib_handle_onscreen: hs_tile_get_index_app = %08x(%s)",
-                           (int)appConf, ptr);
-                if (appConf != NULL) {
-                    sprintf(msg_buf, "FOCUS %s", ptr);
-                    send = hs_lib_alloc_msg(msg_buf, strlen(msg_buf));
-                    if (!send) {
-                        uifw_warn("hs_lib_handle_onscreen: ERROR(allocate send msg)");
-                        return;
-                    }
-                    send->type = ICO_HS_PROTOCOL_TYPE_CM;
-                    ret = hs_lib_put_sendmsg(send);
-                    if (ret < 0) {
-                        ret = ico_uxf_process_execute(ptr);
-                        hs_hide_onscreen();
-                        if ((ret == ICO_UXF_EOK) || (ret == ICO_UXF_EBUSY)) {
-                            idx = hs_tile_get_index_app(ptr);
-                            if (idx < 0) {
-                                idx = hs_tile_get_minchange();
-                            }
-                            hs_tile_set_app(idx, ptr);
-                        }
-                        hs_tile_show_screen();
-                    }
-                    else {
-                        usleep(100000);
-                        hs_hide_onscreen();
-                    }
-                    memset(hs_active_onscreen, 0, sizeof(hs_active_onscreen));
-                }
-                else {
-                    if (strncmp(ptr, "next_bt", 7) == 0) {
-                        hs_get_ons_edj_path(tmp_buf, sizeof(tmp_buf));
-                        sprintf(msg_buf, "OPEN %s%s %s", tmp_buf,
-                                ICO_HS_ONS_APPLI_LIST_NAME,
-                                ICO_UXF_PROC_DEFAULT_HOMESCREEN);
-                        uifw_trace("send '%s' to onscreen", msg_buf);
-                        send = hs_lib_alloc_msg(msg_buf, strlen(msg_buf));
-                        if (!send) {
-                            uifw_warn(
-                                      "hs_lib_handle_onscreen: ERROR(allocate send msg)");
-                            return;
-                        }
-                        send->type = ICO_HS_PROTOCOL_TYPE_OS;
-                        (void)hs_lib_put_sendmsg(send);
-                    }
-                    else if (strncmp(ptr, "cancel_bt", 8) == 0) {
-                        hs_hide_onscreen();
-                        memset(hs_active_onscreen, 0,
-                               sizeof(hs_active_onscreen));
-                    }
-                    else {
-                        hs_hide_onscreen();
-                        memset(hs_active_onscreen, 0,
-                               sizeof(hs_active_onscreen));
-                    }
-                }
-            }
-            else if (strncmp(getFileName(ptr, strlen(ptr)),
-                             ICO_HS_ONS_APPLI_KILL_NAME,
-                             sizeof(ICO_HS_ONS_APPLI_KILL_NAME)) == 0) {
-                /* get 3rd phrase */
-                ptr = get_parsed_str(p_msg_data, tmp_buf, sizeof(tmp_buf), 2);
-                if (strncmp(ptr, "ok_bt", 5) == 0) {
-                    uifw_trace("%s: ok_bt", ICO_HS_ONS_APPLI_KILL_NAME);
-                    if (strlen(hs_kill_appid) == 0) {
-                        hs_hide_onscreen();
-                        memset(hs_active_onscreen, 0,
-                               sizeof(hs_active_onscreen));
-                        return;
-                    }
-                    sprintf((char *)msg_buf, "FOCUS %s", hs_kill_appid);
-                    uifw_trace("send '%s' to command", msg_buf);
-                    send = hs_lib_alloc_msg(msg_buf, strlen(msg_buf));
-                    if (!send) {
-                        uifw_warn(
-                                  "hs_lib_handle_onscreen: ERROR(allocate send msg)");
-                        return;
-                    }
-                    send->type = ICO_HS_PROTOCOL_TYPE_CM;
-                    ret = hs_lib_put_sendmsg(send);
-                    if (ret < 0) {
-                        hs_hide_onscreen();
-                        hs_tile_kill_app(hs_kill_appid);
-                        hs_tile_show_screen();
-                    }
-                    else {
-                        hs_hide_onscreen();
-                    }
-                }
-                else if (strncmp(ptr, "cancel_bt", 8) == 0) {
-                    uifw_trace("%s: cancel_bt", ICO_HS_ONS_APPLI_KILL_NAME);
-                    hs_hide_onscreen();
-                    hs_tile_show_screen();
-                }
-                else {
-                    uifw_trace("%s: else %s", ICO_HS_ONS_APPLI_KILL_NAME, ptr);
-                    hs_hide_onscreen();
-                }
-                memset(hs_active_onscreen, 0, sizeof(hs_active_onscreen));
-                memset(hs_kill_appid, 0, sizeof(hs_kill_appid));
-            }
-        }
-        else {
-            uifw_trace("send %s to app", data);
-            send = hs_lib_alloc_msg(data, msg->len);
-            if (!send) {
-                uifw_warn("hs_lib_handle_onscreen: ERROR(allocate send msg)");
-                return;
-            }
-            send->type = ICO_HS_PROTOCOL_TYPE_APP;
-            hs_lib_put_sendmsg(send);
-        }
-    }
-
-    uifw_trace("hs_lib_handle_onscreen: Leave");
-}
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_handle_statusbar
- *          callback at received message from statusbar, and handle the
- *          message.
- *
- * @param[in]   msg                 received message
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_lib_handle_statusbar(hs_lib_msg_t *msg)
-{
-    hs_lib_msg_t *send;
-    char tmp_buf[ICO_HS_MSG_SIZE];
-    char *cmd;
-    Ico_Uxf_ProcessWin wins[1];
-    Ico_Uxf_ProcessAttr attr;
-    int ret;
-    int idx;
-    int cnt = 0;
-
-    uifw_trace("hs_lib_handle_statusbar: Enter(%s)", msg->data);
-
-    if (strncmp("CLICK ESCUTCHEON", msg->data, 16) == 0) {
-        /* clicked escutcheon button and send a command to outer commander */
-        hs_click_escutcheon();
-        /* send "Receive OK" message to statusbar */
-        send = hs_lib_alloc_msg("RECEIVE OK", strlen("RECEIVE OK"));
-        if (send) {
-            send->type = ICO_HS_PROTOCOL_TYPE_SB;
-            hs_lib_put_sendmsg(send);
-        }
-    }
-    else if (strncmp("OPEN", msg->data, 4) == 0) {
-        /* forward the message to onscreen */
-        if (hs_click_applist()) {
-            send = hs_lib_alloc_msg(msg->data, msg->len);
-            if (send) {
-                strncpy(hs_active_onscreen, ICO_UXF_PROC_DEFAULT_HOMESCREEN,
-                        sizeof(hs_active_onscreen));
-                send->type = ICO_HS_PROTOCOL_TYPE_OS;
-                hs_lib_put_sendmsg(send);
-            }
-        }
-        /* send "Receive OK" message to statusbar */
-        send = hs_lib_alloc_msg("RECEIVE OK", strlen("RECEIVE OK"));
-        if (send) {
-            send->type = ICO_HS_PROTOCOL_TYPE_SB;
-            hs_lib_put_sendmsg(send);
-        }
-    }
-    else if (strncmp("SHOW", msg->data, 4) == 0) {
-        /* show the application on the application screen */
-        cmd = get_parsed_str(msg->data, tmp_buf, sizeof(tmp_buf), 1);
-        if (cmd) {
-            /* wait for creating the application's window */
-            memset(wins, 0, sizeof(wins));
-            while (wins[0].window <= 0) {
-                ret = ico_uxf_process_window_get(cmd, wins, 1);
-                if (ret > 0) {
-                    ret = ico_uxf_process_attribute_get(cmd, &attr);
-                    if (wins[0].window > 0) {
-                        break;
-                    }
-                    else if ((ret >= 0) && (attr.status != ICO_UXF_PROCSTATUS_RUN)) {
-                        /* launch the application */
-                        ret = ico_uxf_process_execute(cmd);
-                    }
-                }
-                else {
-                    /* unknown application */
-                    break;
-                }
-                usleep(10000);
-                ecore_main_loop_iterate();
-
-                if (cnt > 100) {
-                    break;
-                }
-                else {
-                    cnt++;
-                }
-            }
-            ret = ico_uxf_process_attribute_get(cmd, &attr);
-            if ((ret >= 0) && (attr.status == ICO_UXF_PROCSTATUS_RUN)) {
-                idx = hs_tile_get_index_app(cmd);
-                if (idx < 0) {
-                    idx = hs_tile_get_minchange();
-                }
-                hs_tile_set_app(idx, cmd);
-            }
-
-            /* show the application screen*/
-            hs_show_appscreen(cmd);
-        }
-        /* send "Receive OK" message to statusbar */
-        send = hs_lib_alloc_msg("RECEIVE OK", strlen("RECEIVE OK"));
-        if (send) {
-            send->type = ICO_HS_PROTOCOL_TYPE_SB;
-            hs_lib_put_sendmsg(send);
-        }
-    }
-    uifw_trace("hs_lib_handle_statusbar: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_alloc_msg
- *          Allocate a msg structure
- *
- * @param[in]   data                data
- * @param[in]   len                 data length
- * @return      address
- * @retval      > 0                 success
- * @retval      NULL                error
- */
-/*--------------------------------------------------------------------------*/
-static hs_lib_msg_t *
-hs_lib_alloc_msg(char *data, int len)
-{
-    hs_lib_msg_t *msg;
-
-    if (!hs_free_msg) {
-        msg = malloc(sizeof(hs_lib_msg_t));
-        if (!msg) {
-            return NULL;
-        }
-    }
-    else {
-        msg = hs_free_msg;
-        hs_free_msg = hs_free_msg->next;
-    }
-    memset(msg, 0, sizeof(hs_lib_msg_t));
-
-    msg->len = len;
-    msg->data = strdup(data);
-    if (!msg->data) {
-        free(msg);
-        return NULL;
-    }
-
-    return msg;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_free_msg
- *          free the msg
- *
- * @param[in]   data                data
- * @param[in]   free                data lenght
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_lib_free_msg(hs_lib_msg_t *msg)
-{
-    if (!msg) {
-        return;
-    }
-
-    if (msg->data) {
-        free(msg->data);
-    }
-
-    memset(msg, 0, sizeof(hs_lib_msg_t));
-
-    msg->next = hs_free_msg;
-    hs_free_msg = msg;
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_free_handle
- *          free the indecated handle.
- *
- * @param       handle              handle to free
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_lib_free_handle(hs_lib_handle_t *handle)
-{
-    hs_lib_handle_t *free;
-    hs_lib_handle_t *bfree;
-
-    free = hs_handles;
-    bfree = NULL;
-    while (free) {
-        if (free == handle)
-            break;
-        bfree = free;
-        free = free->next;
-    }
-    if (free) {
-        if (bfree) {
-            bfree->next = free->next;
-        }
-        else {
-            hs_handles = free->next;
-        }
-        free->next = hs_handles_free;
-        hs_handles_free = free;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_alloc_handle
- *          Allocate handle.
- *
- * @param       none
- * @return      address
- * @retval      > 0                 success
- * @retval      NULL                error
- */
-/*--------------------------------------------------------------------------*/
-static hs_lib_handle_t *
-hs_lib_alloc_handle(void)
-{
-    hs_lib_handle_t *handle;
-
-    if (!hs_handles_free) {
-        handle = malloc(sizeof(hs_lib_handle_t));
-        if (!handle) {
-            return NULL;
-        }
-    }
-    else {
-        handle = hs_handles_free;
-        hs_handles_free = hs_handles_free->next;
-    }
-    memset(handle, 0, sizeof(hs_lib_handle_t));
-
-    if (hs_handles) {
-        handle->next = hs_handles;
-    }
-    hs_handles = handle;
-
-    return handle;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_realsend
- *          write send message to websocket actually.
- *
- * @param[in]   msg                 write message
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_lib_realsend(hs_lib_msg_t *msg)
-{
-    uifw_trace("hs_lib_realsend: send(ctx=%x(%d), type=h:%d(m:%d), len=%d, msg=%s)",
-               msg->handle->uws_context, msg->handle->id, 
-               msg->handle->type, msg->type, msg->len, msg->data);
-    ico_uws_send(msg->handle->uws_context, msg->handle->id,
-                 (unsigned char *)msg->data, msg->len);
-
-    hs_lib_free_msg(msg);
-
-    uifw_trace("hs_lib_realsend: Leave");
-
-#if 0               /* no need on websockets 1.2    */
-    usleep(200);
-#endif
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_get_sendmsg
- *          get the send message from the send queue.
- *
- * @param[in]   type                receiver
- * @return      send message address
- * @retval      > 0                 success
- * @retval      NULL                error
- */
-/*--------------------------------------------------------------------------*/
-static hs_lib_msg_t *
-hs_lib_get_sendmsg(int type)
-{
-    hs_lib_msg_t *msg;
-    hs_lib_msg_t *bmsg;
-
-    msg = hs_send_msg;
-    bmsg = NULL;
-    while (msg) {
-        if (msg->type == type) {
-            break;
-        }
-        bmsg = msg;
-        msg = msg->next;
-    }
-    if (msg) {
-        if (!bmsg) {
-            /* top */
-            hs_send_msg = msg->next;
-            msg->next = NULL;
-        }
-        else {
-            bmsg->next = msg->next;
-            msg->next = NULL;
-        }
-    }
-
-    return msg;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_put_sendmsg
- *          put the send message to the send queue end.
- *
- * @param[in]   data                send message
- * @return      result
- * @retval      ICO_HS_OK           success
- * @retval      ICO_HS_ERR          error
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_lib_put_sendmsg(hs_lib_msg_t *send)
-{
-    hs_lib_msg_t *msg;
-    hs_lib_handle_t *handle;
-
-    uifw_trace("hs_lib_put_sendmsg: Enter(%d:%s)", send->type, send->data);
-
-    handle = hs_handles;
-    while (handle) {
-        if (handle->type == send->type) {
-            break;
-        }
-        handle = handle->next;
-    }
-    if (!handle) {
-        uifw_trace("hs_lib_put_sendmsg: Leave(target(type:%d) does not exist", send->type);
-        hs_lib_free_msg(send);
-        return ICO_HS_ERR;
-    }
-
-    msg = hs_send_msg;
-    while (msg) {
-        if (!msg->next) {
-            break;
-        }
-        msg = msg->next;
-    }
-    if (!msg) {
-        hs_send_msg = send;
-    }
-    else {
-        msg->next = send;
-    }
-
-    if (handle) {
-        send->handle = handle;
-        uifw_trace("hs_lib_put_sendmsg: hs_lib_set_mode_poll_fd"
-            "(uws_ctx=%08x, id=%08x", handle->uws_context, handle->id);
-        hs_lib_set_mode_poll_fd(handle->fd, EPOLLOUT);
-
-        hs_lib_com_dispatch(handle, 0);
-    }
-
-    uifw_trace("hs_lib_put_sendmsg: Leave");
-
-    return ICO_HS_OK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_get_recvmsg
- *          get the receive message from the receive queue end.
- *
- * @param       none
- * @return      recv message address
- * @retval      > 0                 success
- * @retval      NULL                error
- */
-/*--------------------------------------------------------------------------*/
-static hs_lib_msg_t *
-hs_lib_get_recvmsg(void)
-{
-    hs_lib_msg_t *msg;
-
-    msg = hs_recv_msg;
-    if (msg) {
-        hs_recv_msg = msg->next;
-        msg->next = NULL;
-    }
-
-    return msg;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_put_recvmsg
- *          put the receive message to the receive queue end.
- *
- * @param[in]   data                receive message
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_lib_put_recvmsg(hs_lib_msg_t *recv)
-{
-    hs_lib_msg_t *msg;
-
-    msg = hs_recv_msg;
-    while (msg) {
-        if (!msg->next) {
-            break;
-        }
-        msg = msg->next;
-    }
-    if (!msg) {
-        hs_recv_msg = recv;
-    }
-    else {
-        msg->next = recv;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_com_dispatch
- *          The accumulated data that transmitted or received is procecssed
- *
- * @param[in]   _handle             connect handle,
- *                                  if NULL target is all connection
- * @param[in]   timeoutms           maximum wait time on miri-sec.
- *                                  0 is no wait, -1 is wait forever.
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_lib_com_dispatch(hs_lib_handle_t *_handle, int timeoutms)
-{
-    hs_lib_handle_t *handle;
-    hs_lib_msg_t *msg;
-
-    if (_handle) {
-        handle = _handle;
-    }
-    else {
-        handle = hs_handles;
-    }
-
-    while (handle) {
-        ico_uws_service(handle->uws_context);
-
-        /* treate received buffer */
-        msg = hs_lib_get_recvmsg();
-        while (msg) {
-            switch (msg->type) {
-            case ICO_HS_PROTOCOL_TYPE_CM:
-                hs_lib_handle_command(msg);
-                break;
-
-            case ICO_HS_PROTOCOL_TYPE_SB:
-                hs_lib_handle_statusbar(msg);
-                break;
-
-            case ICO_HS_PROTOCOL_TYPE_OS:
-                hs_lib_handle_onscreen(msg);
-                break;
-
-            case ICO_HS_PROTOCOL_TYPE_APP:
-                hs_lib_handle_application(msg);
-                break;
-
-            default:
-                break;
-            }
-            hs_lib_free_msg(msg);
-            msg = hs_lib_get_recvmsg();
-        }
-
-        if (_handle)
-            break;
-        handle = handle->next;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_poll_fd_event
- *          Notify the changes of file descriptor's state
- *
- * @param[in]   fd_ctl              The structure of file descriptor's controller
- * @param[in]   flags               Flags
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_lib_poll_fd_event(hs_lib_poll_t *poll, int flags)
-{
-    hs_lib_handle_t *handle = poll->handle;
-    hs_lib_msg_t *msg;
-
-    uifw_trace("hs_lib_poll_fd_event: Enter(handle=%08x, poll=%08x flags=%08x)", 
-                (int)handle, (int)poll, flags);
-
-    /* try to ws service */
-    hs_lib_com_dispatch(handle, 0);
-
-    /* control polling fd's event? */
-    if ((flags & EPOLLOUT) && (handle != NULL)) {
-        hs_lib_realsend(hs_lib_get_sendmsg(handle->type));
-
-        hs_lib_com_dispatch(handle, 0);
-
-        hs_lib_clear_mode_poll_fd(handle->fd, EPOLLOUT);
-        /* check send queue */
-        msg = hs_send_msg;
-        while (msg) {
-            if (msg->handle->fd == handle->fd) {
-                hs_lib_set_mode_poll_fd(handle->fd, EPOLLOUT);
-                break;
-            }
-            msg = msg->next;
-        }
-    }
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_ecore_fdevent
- *          callback function called by Ecore when the websocket's file
- *          descriptor had change
- *
- * @param[in]   data                user data(ico_apf_com_poll_t)
- * @param[in]   handler             Ecore file descriptor handler
- * @return      call back setting
- * @retval      ECORE_CALLBACK_RENEW    set callback
- */
-/*--------------------------------------------------------------------------*/
-static Eina_Bool
-hs_lib_ecore_fdevent(void *data, Ecore_Fd_Handler *handler)
-{
-    int flags;
-
-    uifw_trace("hs_lib_ecore_fdevent: Enter");
-
-    flags = 
-        (ecore_main_fd_handler_active_get(handler, ECORE_FD_READ)) ? EPOLLIN : 0;
-    if (ecore_main_fd_handler_active_get(handler, ECORE_FD_WRITE)) {
-        flags |= EPOLLOUT;
-    }
-    if (ecore_main_fd_handler_active_get(handler, ECORE_FD_ERROR)) {
-        flags |= EPOLLERR;
-    }
-
-    hs_lib_poll_fd_event((hs_lib_poll_t *)data, flags);
-
-    return ECORE_CALLBACK_RENEW;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_control_fd
- *          control file descriptors to add or delete ecore event handler
- *
- * @param[in]   fd_ctl              file descriptors
- * @param[in]   num_fds             number of file descriptors
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_lib_control_fd(hs_lib_poll_t *fd_ctl[], const int num_fds)
-{
-    int ii;
-    Ecore_Fd_Handler_Flags flags;
-
-    for (ii = 0; ii < num_fds; ii++) {
-        uifw_trace("hs_lib_control_fd: (handle=%08x, fd=%d, flg=%08x)",
-                          (int)fd_ctl[ii]->handle, fd_ctl[ii]->fd, fd_ctl[ii]->flags);
-        if (fd_ctl[ii]->flags) {
-            flags = (fd_ctl[ii]->flags & EPOLLIN) ? ECORE_FD_READ : 0;
-            if (fd_ctl[ii]->flags & EPOLLOUT) {
-                flags |= ECORE_FD_WRITE;
-            }
-            if (fd_ctl[ii]->flags & (EPOLLERR | EPOLLPRI)) {
-                flags |= ECORE_FD_ERROR;
-            }
-            if (!fd_ctl[ii]->user_data) {
-                uifw_trace(
-                           "hs_lib_control_fd: ADD(fd=%d, flg=%08x, eflg=%08x)",
-                           fd_ctl[ii]->fd, fd_ctl[ii]->flags, flags);
-                fd_ctl[ii]->user_data
-                        = (void *)ecore_main_fd_handler_add(
-                                                            fd_ctl[ii]->fd,
-                                                            flags,
-                                                            hs_lib_ecore_fdevent,
-                                                            (void *)fd_ctl[ii],
-                                                            NULL, NULL);
-            }
-            else {
-                uifw_trace(
-                           "hs_lib_control_fd: CHANGE(fd=%d, flg=%08x, eflg=%08x)",
-                           fd_ctl[ii]->fd, fd_ctl[ii]->flags, flags);
-                ecore_main_fd_handler_active_set(
-                                                 (Ecore_Fd_Handler *)fd_ctl[ii]->user_data,
-                                                 flags);
-            }
-        }
-        else {
-            /* remove file descriptor */
-            uifw_trace("hs_lib_control_fd: DELL(fd=%d)", fd_ctl[ii]->fd);
-            ecore_main_fd_handler_del((Ecore_Fd_Handler *)fd_ctl[ii]->user_data);
-        }
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_add_poll_fd
- *          add file descriptor of websocket for poll
- *
- * @param[in]   fd                  file descriptor
- * @param[in]   flags               event flag
- * @return      result
- * @retval      ICO_HS_OK           success
- * @retval      ICO_HS_ERR          error
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_lib_add_poll_fd(int fd, int flags)
-{
-    hs_lib_poll_t *poll;
-    hs_lib_poll_t *fds[1];
-    hs_lib_handle_t *handle;
-
-    /* get management table */
-    poll = hs_polls;
-    while (poll) {
-        if (poll->fd == fd) {
-            break;
-        }
-        poll = poll->next;
-    }
-    if (!poll) {
-        if (hs_polls_free) {
-            poll = hs_polls_free;
-            hs_polls_free = poll->next;
-            poll->user_data = NULL;
-        }
-        else {
-            poll = calloc(sizeof(hs_lib_poll_t), 1);
-            if (!poll) {
-                uifw_warn("hs_lib_add_poll_fd: ERR(allocate poll table failed)");
-                return ICO_HS_ERR;
-            }
-        }
-        poll->fd = fd;
-        poll->next = hs_polls;
-        hs_polls = poll;
-    }
-    poll->flags = flags;
-
-    /* if the fd is same as uws_context, set the handle */
-    handle = hs_handles;
-    while (handle) {
-        if (handle->fd == fd)
-            break;
-        handle = handle->next;
-    }
-    if (handle) {
-        poll->handle = handle;
-        handle->poll = poll;
-    }
-    else {
-        poll->handle = NULL;
-    }
-
-    /* control fds */
-    fds[0] = poll;
-    hs_lib_control_fd(fds, 1);
-
-    return ICO_HS_OK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_del_poll_fd
- *          delete file descriptor of websocket for poll
- *
- * @param[in]   fd                  file descriptor
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_lib_del_poll_fd(int fd)
-{
-    hs_lib_poll_t *poll;
-    hs_lib_poll_t *fds[1];
-
-    /* get management table */
-    poll = hs_polls;
-    while (poll) {
-        if (poll->fd == fd) {
-            hs_polls = poll->next;
-
-            /* control fds */
-            poll->flags = 0;
-            fds[0] = poll;
-            hs_lib_control_fd(fds, 1);
-
-            /* add free polls */
-            poll->next = hs_polls_free;
-            hs_polls_free = poll;
-            break;
-        }
-        poll = poll->next;
-    }
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_set_mode_poll_fd
- *          set event to file descriptor of websocket for poll
- *
- * @param[in]   fd                  file descriptor
- * @param[in]   flags               event flag
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_lib_set_mode_poll_fd(int fd, int flags)
-{
-    hs_lib_poll_t *poll;
-    hs_lib_poll_t *fds[1];
-
-    /* get management table */
-    poll = hs_polls;
-    while (poll) {
-        if (poll->fd == fd) {
-uifw_trace("hs_lib_set_mode_poll_fd: fd=%d (%d)", poll->fd, fd);
-            /* control fds */
-            poll->flags |= flags;
-            fds[0] = poll;
-            hs_lib_control_fd(fds, 1);
-        }
-        poll = poll->next;
-    }
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_clear_mode_poll_fd
- *          clear event to file descriptor of websocket for poll
- *
- * @param[in]   fd                  file descriptor
- * @param[in]   flags               event flag
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_lib_clear_mode_poll_fd(int fd, int flags)
-{
-    hs_lib_poll_t *poll;
-    hs_lib_poll_t *fds[1];
-
-    /* get management table */
-    poll = hs_polls;
-    while (poll) {
-        if (poll->fd == fd) {
-            /* control fds */
-            poll->flags &= ~flags;
-            fds[0] = poll;
-            hs_lib_control_fd(fds, 1);
-        }
-        poll = poll->next;
-    }
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   get_parsed_str
- *          extract word by the given arg_idx.
- *
- * @param[in]   in                  source char array
- * @param[in]   out                 char array store word
- * @param[in]   len                 char array length
- * @param[in]   arg_idx             index
- * @return      none
- * @retval      >=0                 pointer to extract word
- */
-/*--------------------------------------------------------------------------*/
-static char *
-get_parsed_str(char *in, char *out, int len, int arg_idx)
-{
-    int ii;
-    char *data;
-
-    uifw_trace("get_parsed_str: %s arg = %d", in, arg_idx);
-
-    memset(out, 0, len);
-    strncpy(out, in, len);
-    data = strtok(out, " ");
-    for (ii = 0; ii < arg_idx; ii++) {
-        data = strtok(NULL, " ");
-    }
-
-    uifw_trace("get_parsed_str data: %s", data);
-
-    return data;
-}
-
-/* get filename from the full path */
-static char *
-getFileName(char *filepath, int len)
-{
-    int ii;
-    char *name = filepath;
-
-    for (ii = 0; ii < len - 1; ii++) {
-        if (filepath[ii] == 0)
-            break;
-        if (filepath[ii] == '/')
-            name = &filepath[ii + 1];
-    }
-
-    uifw_trace("getFileName name: %s", name);
-
-    return name;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_event_message
- *          send message
- *
- * @param[in]   type                receiver
- * @param[in]   fromat              message to send
- * @return      result
- * @retval      ICO_HS_OK           success
- * @retval      ICO_HS_ERR          error
- */
-/*--------------------------------------------------------------------------*/
-int
-hs_lib_event_message(int type, char *format, ...)
-{
-    va_list list;
-    char message[ICO_HS_MSG_SIZE];
-    hs_lib_msg_t *send;
-
-    memset(message, 0, sizeof(message));
-
-    va_start(list, format);
-    vsnprintf(message, sizeof(message), format, list);
-    va_end(list);
-
-    uifw_trace("hs_lib_event_message: message to %d, %s", type, message);
-    send = hs_lib_alloc_msg(message, strlen(message));
-    if (!send) {
-        uifw_warn("hs_lib_event_message: ERROR(allocate send msg)");
-        return ICO_HS_ERR;
-    }
-    send->type = type;
-
-    return hs_lib_put_sendmsg(send);
-}
-
-/*--------------------------------------------------------------------------*/
-/*
- * @brief   hs_lib_callback_uws
- *          callback function from UWS
- *
- * @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
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_lib_callback_uws(const struct ico_uws_context *context,
-                    const ico_uws_evt_e event,
-                    const void *id,
-                    const ico_uws_detail *detail,
-                    void *data)
-{
-    char *in;
-    int len;
-    hs_lib_handle_t *handle;
-    hs_lib_msg_t *msg;
-
-    uifw_trace("hs_lib_callback_uws: context=%08x id=%08x", (int)context, (int)id);
-
-    handle = hs_handles;
-    while (handle) {
-        if (handle->id == id)
-            break;
-        handle = handle->next;
-    }
-    if (!handle) {
-        handle = hs_lib_alloc_handle();
-        if (!handle) {
-            uifw_warn("hs_lib_callback_uws: ERROR(allocate handle)");
-            return;
-        }
-        handle->uws_context = (struct ico_uws_context *)context;
-        handle->id = (void *)id;
-        handle->service_on = 1;
-    }
-
-    switch (event) {
-    case ICO_UWS_EVT_OPEN:
-        uifw_trace("hs_lib_callback_uws: ICO_UWS_EVT_OPEN(id=%08x)", (int)id); 
-        break;
-
-    case ICO_UWS_EVT_CLOSE:
-        uifw_trace("hs_lib_callback_uws: ICO_UWS_EVT_CLOSE(id=%08x)", (int)id);
-        hs_lib_free_handle(handle);
-        break;
-
-    case ICO_UWS_EVT_RECEIVE:
-        uifw_trace("hs_lib_callback_uws: ICO_UWS_EVT_RECEIVE(id=%08x, msg=%s, len=%d)", 
-                   (int)id, (char *)detail->_ico_uws_message.recv_data,
-                   detail->_ico_uws_message.recv_len);
-        in = (char *)detail->_ico_uws_message.recv_data;
-        len = detail->_ico_uws_message.recv_len;
-        if (len < 4) {
-            break;
-        }
-        if (strncmp(in, ICO_HS_MSG_HEAD_CM, 3) == 0) {
-            handle->type = ICO_HS_PROTOCOL_TYPE_CM;
-        }
-        else if (strncmp(in, ICO_HS_MSG_HEAD_OS, 3) == 0) {
-            handle->type = ICO_HS_PROTOCOL_TYPE_OS;
-        }
-        else if (strncmp(in, ICO_HS_MSG_HEAD_SB, 3) == 0) {
-            handle->type = ICO_HS_PROTOCOL_TYPE_SB;
-        }
-        else if (strncmp(in, ICO_HS_MSG_HEAD_APP, 3) == 0) {
-            handle->type = ICO_HS_PROTOCOL_TYPE_APP;
-        }
-        else {
-            uifw_trace("hs_lib_callback_uws: ICO_UWS_EVT_RECEIVE(unknown)"); 
-            break;
-        }
-
-        msg = hs_lib_alloc_msg(&in[4], len - 4);
-        if (!msg) {
-            uifw_trace("hs_lib_callback_uws: cannot allocate msg");
-            break;
-        }
-        msg->type = handle->type;
-        msg->handle = handle;
-
-        hs_lib_put_recvmsg(msg);
-
-        break;
-    
-    case ICO_UWS_EVT_ERROR:
-        uifw_trace("hs_lib_callback_uws: ICO_UWS_EVT_ERROR(id=%08x, err=%d)", 
-                   (int)id, detail->_ico_uws_error.code);
-        break;
-
-    case ICO_UWS_EVT_ADD_FD:
-        uifw_trace("hs_lib_callback_uws: ICO_UWS_EVT_ADD_FD(id=%08x, fd=%d)",
-                    (int)id, detail->_ico_uws_fd.fd);
-        handle->fd = detail->_ico_uws_fd.fd;
-        (void)hs_lib_add_poll_fd(detail->_ico_uws_fd.fd, EPOLLIN);
-        break;
-
-    case ICO_UWS_EVT_DEL_FD:
-        uifw_trace("hs_lib_callback_uws: ICO_UWS_EVT_DEL_FD(id=%d, fd=%d)",
-                    (int)id, detail->_ico_uws_fd.fd);
-        hs_lib_del_poll_fd(detail->_ico_uws_fd.fd);
-        break;
-
-    default:
-        break;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/*
- * @brief   hs_lib_setup_server
- *          setup server
- *
- * @param[in]   uri                 URI
- * @param[in]   protocol            websocket's protocol name
- * @param[in]   callback            callback function
- * @return      handle 
- * @retval      >0                  success
- * @retval      NULL                error
- */
-/*--------------------------------------------------------------------------*/
-static hs_lib_handle_t *
-hs_lib_setup_server(const char *uri, const char *protocol, ico_uws_evt_cb callback)
-{
-    int ret;
-    struct ico_uws_context *context = NULL;
-    hs_lib_handle_t *handle = NULL;
-
-    handle = hs_lib_alloc_handle();
-    if (! handle) {
-        uifw_trace("hs_lib_setup_server: cannot allocate handle");
-        return NULL;
-    }
-
-    /* create context */
-    context = ico_uws_create_context(uri, ICO_HS_PROTOCOL);
-    handle->uws_context = context;
-    if (! context) {
-        uifw_trace("hs_lib_setup_server: cannot create context");
-        hs_lib_free_handle(handle);
-        return NULL;
-    }
-    uifw_trace("hs_lib_setup_server: create ctx=%08x", (int)context);
-    ico_uws_service(context);
-
-    /* set callback */
-    ret = ico_uws_set_event_cb(context, callback, (void *)handle);
-    if (ret != ICO_UWS_ERR_NONE) {
-        uifw_trace("hs_lib_setup_server: cannnot set callback");
-        hs_lib_free_handle(handle);
-        return NULL;
-    }
-
-    return handle;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_lib_main
- *          initialize homescreen lib to connect statusbar and onscreen,
- *          external command tools.
- *
- * @param[in]   port                websocket port
- * @return      result
- * @retval      ICO_HS_OK           success
- * @retval      ICO_HS_ERR          error
- */
-/*--------------------------------------------------------------------------*/
-int
-hs_lib_main(int port)
-{
-    char uri[ICO_HS_TEMP_BUF_SIZE];
-    hs_lib_handle_t *handle = NULL;
-
-    /* set up URI ":PORT" */
-    sprintf(uri, ":%d", port);
-    
-    /* set up server */
-    handle = hs_lib_setup_server(uri, ICO_HS_PROTOCOL, hs_lib_callback_uws);
-    if ((handle == NULL) || (handle->uws_context == NULL)) {
-        uifw_warn("home_screen_lib_main: ERROR(hs_lib_setup_server failed.)");
-        return ICO_HS_ERR;
-    }
-    hs_wsicontext = handle->uws_context;
-
-    ico_uws_service(hs_wsicontext);
-
-    return ICO_HS_OK;
-}
diff --git a/src/home_screen_main.c b/src/home_screen_main.c
deleted file mode 100644 (file)
index 6628ca6..0000000
+++ /dev/null
@@ -1,2093 +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   homescreen application main
- *
- * @date    Feb-15-2013
- */
-
-#include <Eina.h>
-#include <Evas.h>
-#include <Ecore.h>
-#include <Ecore_Evas.h>
-#include <Ecore_Wayland.h>
-#include <Edje.h>
-#include <Elementary.h>
-
-#include <stdio.h>
-#include <pthread.h>
-#include <libwebsockets.h>
-
-#include "ico_apf.h"
-#include "ico_uxf.h"
-#include "ico_uxf_conf.h"
-#include "ico_syc_apc.h"
-#include "ico_uxf_conf_ecore.h"
-
-#include "home_screen_lib.h"
-#include "home_screen_res.h"
-#include "home_screen_conf.h"
-#include "home_screen_parser.h"
-
-/*============================================================================*/
-/* definition                                                                 */
-/*============================================================================*/
-#define ICO_HS_WINDOW_TYPE_BG    (1)
-#define ICO_HS_WINDOW_TYPE_TOUCH (2)
-#define ICO_HS_TOUCH_TIME_OUT    (1.0) /* Long press for timer */
-typedef struct _hs_tile_info hs_tile_info_t;
-typedef struct _hs_tile_hide hs_tile_hide_t;
-
-struct _hs_tile_hide {
-    hs_tile_hide_t *next;               /* next hide app on the same tile */
-    char appid[ICO_UXF_MAX_PROCESS_NAME];
-};
-
-struct _hs_tile_info {
-    hs_tile_hide_t *next;
-    int idx; /* index: 0 to ... */
-    int valid; /* 0: invalid, 1:valid */ /* dont't touch now */
-    char appid[ICO_UXF_MAX_PROCESS_NAME]; /* active app id */
-    int type; /* 11:small, 21:h-wide, 12:v-wide, 22:large, 0:others */
-    int l_press; /* 1: long press */
-    int change;
-    int size_x;
-    int size_y;
-    int coord_x;
-    int coord_y;
-};
-
-#define HS_DISPLAY_HOMESCREEN   0           /* HomeScreen target display Id     */
-#define NUM_ONSCREEN_WINDOWS    10          /* max number of windows in OnScreen*/
-
-#define HS_LAYER_BACKGROUND     0           /* layer of BackGround              */
-#define HS_LAYER_HOMESCREEN     1           /* layer of HomeScreen menu         */
-#define HS_LAYER_APPLICATION    2           /* layer of Application             */
-#define HS_LAYER_SOFTKEYBOARD   3           /* layer of Software Keyboard       */
-#define HS_LAYER_INTERRUPTAPP   4           /* layer of Interrupted Application */
-#define HS_LAYER_TOUCH          5           /* layer of TouchPanel              */
-#define HS_LAYER_ONSCREEN       6           /* layer of OnScreen                */
-
-/*============================================================================*/
-/* static(internal) functions prototype                                       */
-/*============================================================================*/
-static int hs_is_special_app(const char *appid);
-static int hs_is_noicon_app(const char *appid);
-static void hs_set_invisible_all(void);
-static void hs_set_appscreen(const char *appid);
-static void hs_tile_start_apps(void);
-static int hs_tile_init_info(void);
-static void hs_convert_tile_config(char *in, int *out, int cnt, int val);
-static Eina_Bool hs_ecore_uxf_eventfd(void *data, Ecore_Fd_Handler *handler);
-static void hs_uxf_event(int ev, Ico_Uxf_EventDetail dd, int arg);
-static int hs_get_process_window(const char *appid);
-static void hs_display_control(const Ico_Uxf_conf_application *conf, const int show);
-static void hs_sound_control(const Ico_Uxf_conf_application *conf, const int adjust);
-static void hs_input_control(const Ico_Uxf_conf_application *conf, const int inputsw);
-static void *hs_create_window(int type);
-static void hs_touch_up_api_list(void *data, Evas *evas, Evas_Object *obj,
-                                 void *event_info);
-static void hs_touch_down_api_list(void *data, Evas *evas, Evas_Object *obj,
-                                   void *event_info);
-static Eina_Bool hs_ecore_timer_event(void *data);
-static void hs_touch_up_tile(void *data, Evas *evas, Evas_Object *obj, void *event_info);
-static void hs_touch_down_tile(void *data, Evas *evas, Evas_Object *obj, void *event_info);
-static void hs_add_touch_listener(Evas *canvas_fg);
-static void hs_add_bg_image(Evas *canvas_bg);
-static void hs_terminate_all_app(void);
-static void hs_regulation_listener(const int appcategory,
-                                   const ico_apc_reguration_control_t control,
-                                   void *user_data);
-
-/*============================================================================*/
-/* variables and tables                                                       */
-/*============================================================================*/
-char hs_kill_appid[ICO_UXF_MAX_PROCESS_NAME];
-                                         /* set kill 'app id' in touch layer  */
-char hs_active_onscreen[ICO_UXF_MAX_PROCESS_NAME];
-                                         /* stack 'app id' at active onscreen */
-hs_window_data_t hs_command_tile_req[ICO_HS_APP_NUM_MAX];
-hs_window_data_t hs_app_screen_window[ICO_HS_APP_NUM_MAX];
-char hs_name_homescreen[ICO_UXF_MAX_PROCESS_NAME + 1];
-static char gStatusbarName[ICO_UXF_MAX_PROCESS_NAME + 1];
-static char gOnscreenName[ICO_UXF_MAX_PROCESS_NAME + 1];
-static hs_tile_info_t *hs_tile_info;
-static int hs_tile_cnt = 0;
-static int hs_notile_cnt = 0;
-static int hs_regulation_category = 0;
-static int hs_regulation_visible = 1;
-
-/*============================================================================*/
-/* functions                                                                  */
-/*============================================================================*/
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_uxf_event
- *          callback function called by UXF.
- *
- * @param[in]   ev                  event kinds
- * @param[in]   dd                  event detail structure
- * @param[in]   arg                 user data
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_uxf_event(int ev, Ico_Uxf_EventDetail dd, int arg)
-{
-    const Ico_Uxf_conf_application *appConf;
-
-    uifw_trace("... Event=%08x Arg=%d", ev, arg);
-
-    Ico_Uxf_WindowAttr winAttr;
-    int ret;
-    int idx;
-    int dispW, dispH;
-
-    if (ev == ICO_UXF_EVENT_NEWWINDOW) {
-        uifw_trace("  D(Window) ev=%08x disp=%d win=%x x/y=%d/%d w/h=%d/%d v/r/a=%d/%d/%d",
-                   dd.event, dd.window.display, dd.window.window,
-                   dd.window.x, dd.window.y, dd.window.w, dd.window.h,
-                   dd.window.visible, dd.window.raise, dd.window.active);
-        ret = ico_uxf_window_attribute_get(dd.window.window, &winAttr);
-        if (ret == ICO_UXF_EOK) {
-            uifw_trace("  D(Window) appid=%s sub=%d", winAttr.process,
-                       winAttr.subwindow);
-            if (strncmp(winAttr.process, hs_name_homescreen,
-                        ICO_UXF_MAX_PROCESS_NAME) == 0) {
-                ico_uxf_window_screen_size_get(&dispW, &dispH);
-                /* HomeScreen APP: BG or TOUCH */
-                ico_uxf_window_resize(dd.window.window, dispW, dispH
-                        - ICO_HS_SIZE_SB_HEIGHT);
-                ico_uxf_window_move(dd.window.window, 0, ICO_HS_SIZE_SB_HEIGHT, 0);
-                ico_uxf_window_show(dd.window.window);
-                if (winAttr.subwindow > 0) {
-                    /* set layer of HomeScreen TouchPanel window    */
-                    ico_uxf_window_layer(dd.window.window, HS_LAYER_TOUCH);
-                    hs_tile_show_screen();
-                }
-                else    {
-                    /* set layer of HomeScreen BackGround window    */
-                    ico_uxf_window_layer(dd.window.window, HS_LAYER_BACKGROUND);
-                }
-            }
-            else if (strncmp(winAttr.process, gStatusbarName,
-                             ICO_UXF_MAX_PROCESS_NAME) == 0) {
-                /* set layer of StatusBar window                */
-                ico_uxf_window_layer(dd.window.window, HS_LAYER_ONSCREEN);
-                /* show status bar */
-                ico_uxf_window_show(dd.window.window);
-                ico_uxf_window_move(dd.window.window, 0, 0, 0);
-                ico_uxf_window_screen_size_get(&dispW, &dispH);
-                ico_uxf_window_resize(dd.window.window, dispW, ICO_HS_SIZE_SB_HEIGHT);
-            }
-            else if (strncmp(winAttr.process, gOnscreenName,
-                             ICO_UXF_MAX_PROCESS_NAME) == 0) {
-                /* set layer of OnScreen window             */
-                ico_uxf_window_layer(dd.window.window, HS_LAYER_BACKGROUND);
-                ico_uxf_window_visible_raise(dd.window.window, 1, 0);
-            }
-            else {
-                /* other normal application */
-                if (hs_is_special_app(winAttr.process) == FALSE) {
-                    /* set max window size for event to application */
-                    hs_set_appscreen(winAttr.process);
-                    if (hs_is_noicon_app(winAttr.process) != FALSE) {
-                        hs_set_appscreen(winAttr.process);
-                        if (hs_stat_touch == ICO_HS_TOUCH_IN_SHOW) {
-                            hs_tile_show_screen();
-                        }
-                    }
-                    else if (hs_stat_touch == ICO_HS_TOUCH_IN_SHOW) {
-                        /* set layer of Application in HomeScreen menu  */
-                        ico_uxf_window_layer(dd.window.window, HS_LAYER_HOMESCREEN);
-                        hs_tile_show_screen();
-                    }
-                    else if (hs_stat_touch == ICO_HS_TOUCH_IN_HIDE) {
-                        hs_set_appscreen(winAttr.process);
-                    }
-                }
-            }
-        }
-    }
-    else if (ev == ICO_UXF_EVENT_TERMPROCESS) {
-        uifw_trace("hs_uxf_event: ICO_UXF_EVENT_TERMPROCESS");
-
-        if (strlen(dd.process.process) != 0) {
-            idx = hs_tile_get_index_app(dd.process.process);
-            if (idx >= 0) {
-                hs_tile_free_app(idx);
-            }
-            else {
-                hs_tile_delete_hide(dd.process.process);
-            }
-        }
-    }
-    else if (ev == ICO_UXF_EVENT_ACTIVEWINDOW)  {
-        /* set active window                */
-        uifw_trace("hs_uxf_event: window=%08x active=%x", dd.window.window, dd.window.active);
-        if (dd.window.active == ICO_UXF_WINDOW_SELECT)  {
-            if (ico_uxf_window_attribute_get(dd.window.window, &winAttr) == ICO_UXF_EOK)  {
-                if ((strncmp(winAttr.process, hs_name_homescreen, ICO_UXF_MAX_PROCESS_NAME)
-                        != 0) &&
-                    (strncmp(winAttr.process, gStatusbarName, ICO_UXF_MAX_PROCESS_NAME)
-                        != 0) &&
-                    (strncmp(winAttr.process, gOnscreenName, ICO_UXF_MAX_PROCESS_NAME)
-                        != 0))  {
-                    /* if selected application is soft-keyboard, activate only pointer, */
-                    /* other case activate pointer and keyboard                         */
-                    appConf = ico_uxf_getAppByAppid(winAttr.process);
-                    if ((appConf != NULL) &&
-                        (appConf->display[0].layerId == HS_LAYER_SOFTKEYBOARD)) {
-                        ico_uxf_window_active(dd.window.window,
-                                              ICO_UXF_WINDOW_POINTER_ACTIVE);
-                        ico_uxf_window_raise(dd.window.window);
-                    }
-                    else    {
-                        ico_uxf_window_active(dd.window.window,
-                                              ICO_UXF_WINDOW_KEYBOARD_ACTIVE);
-                        ico_uxf_window_raise(dd.window.window);
-                        ico_syc_apc_active(winAttr.process);
-                    }
-                }
-                else    {
-                    ico_uxf_window_active(dd.window.window, ICO_UXF_WINDOW_POINTER_ACTIVE |
-                                                            ICO_UXF_WINDOW_KEYBOARD_ACTIVE);
-                }
-            }
-        }
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_ecore_uxf_eventfd
- *          callback function of wayland fd event that is used in UXF.
- *          if the fd has event, ecore call this function.
- *
- * @param[in]   data                user data
- * @param[in]   handler             handler
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static Eina_Bool
-hs_ecore_uxf_eventfd(void *data, Ecore_Fd_Handler *handler)
-{
-    ico_uxf_main_loop_iterate();
-
-    return EINA_TRUE;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_convert_tile_config
- *          for read configuration.
- *          convert configuration string to integer array.
- *
- * @param[in]   in                  configuration
- * @param[out]  out                 integer array
- * @param[in]   cnt                 count
- * @param[in]   val                 default value
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_convert_tile_config(char *in, int *out, int cnt, int val)
-{
-    int idx;
-    char *tok;
-    char *s = ";";
-
-    for (idx = 0; idx < cnt; idx++) {
-        out[idx] = val;
-    }
-    if (in != NULL) {
-        tok = strtok(in, s);
-        for (idx = 0; idx < cnt; idx++) {
-            out[idx] = atoi(tok);
-            tok = strtok(NULL, s);
-            if (tok == NULL) {
-                break;
-            }
-        }
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_get_index_appscreendata
- *          get applicaton screen data index.
- *
- * @param[in]   appid               application id
- * @return      result
- * @retval      >=0                 app index
- * @retval      -1                  not exist
- */
-/*--------------------------------------------------------------------------*/
-int
-hs_get_index_appscreendata(const char *appid)
-{
-    int idx = -1;
-    int ii;
-
-    for (ii = 0; ii < ICO_HS_APP_NUM_MAX; ii++) {
-        if (hs_app_screen_window[ii].appid[0] == 0) {
-            if (idx == -1) {
-                idx = ii;
-            }
-            continue;
-        }
-        if (strncmp(hs_app_screen_window[ii].appid, appid,
-                    ICO_UXF_MAX_PROCESS_NAME) == 0) {
-            return ii;
-        }
-    }
-
-    if (idx >= 0) {
-        strncpy(hs_app_screen_window[idx].appid, appid,
-                ICO_UXF_MAX_PROCESS_NAME);
-    }
-    return idx;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_set_appscreen
- *          set the application screen's status to the applicaton window,
- *          and visible raise the application window.
- *
- * @param[in]   appid               application id
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_set_appscreen(const char *appid)
-{
-    int idx;
-    int ret;
-    Ico_Uxf_ProcessWin window;
-    const Ico_Uxf_conf_application *appConf;
-    const Ico_Uxf_Sys_Config       *sysConf;
-    Ico_Uxf_conf_display_zone      *zone;
-
-    idx = hs_get_index_appscreendata(appid);
-
-    if (idx < 0) {
-        return;
-    }
-
-    /* visible raise */
-    ret = ico_uxf_process_window_get(hs_app_screen_window[idx].appid, &window, 1);
-    if ((ret > 0) || (ret == ICO_UXF_E2BIG))    {
-        uifw_trace("hs_set_appscreen: app[%d]:visible=%d raise=%d %dx%d(%d,%d)",
-                   idx, hs_app_screen_window[idx].visible, hs_app_screen_window[idx].raise,
-                   hs_app_screen_window[idx].resize_w, hs_app_screen_window[idx].resize_h,
-                   hs_app_screen_window[idx].move_x, hs_app_screen_window[idx].move_y);
-        /* move application window to application layer */
-        appConf = ico_uxf_getAppByAppid(hs_app_screen_window[idx].appid);
-        if (! appConf)  {
-            ico_uxf_window_layer(window.window, HS_LAYER_APPLICATION);
-            /* show application layer                       */
-            ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, HS_LAYER_APPLICATION, 1);
-        }
-        else    {
-            ico_uxf_window_layer(window.window, appConf->display[0].layerId);
-            /* show application layer                       */
-            ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, appConf->display[0].layerId, 1);
-
-            if ((hs_app_screen_window[idx].resize_w <= 0) &&
-                (hs_app_screen_window[idx].resize_h <= 0) &&
-                (hs_app_screen_window[idx].move_x <= 0) &&
-                (hs_app_screen_window[idx].move_y <= 0))    {
-                /* not set size and position, set default(zone size)    */
-                sysConf = ico_uxf_getSysConfig();
-                zone = (Ico_Uxf_conf_display_zone *)&sysConf->
-                           display[appConf->display[0].displayId].
-                               zone[appConf->display[0].zoneId];
-                hs_app_screen_window[idx].resize_w = zone->width;
-                hs_app_screen_window[idx].resize_h = zone->height;
-                hs_app_screen_window[idx].move_x = zone->x;
-                hs_app_screen_window[idx].move_y = zone->y;
-                hs_app_screen_window[idx].visible = 1;
-                hs_app_screen_window[idx].raise = 1;
-            }
-        }
-        ico_uxf_window_move(window.window, hs_app_screen_window[idx].move_x,
-                            hs_app_screen_window[idx].move_y, 0);
-        ico_uxf_window_resize(window.window,
-                              hs_app_screen_window[idx].resize_w,
-                              hs_app_screen_window[idx].resize_h);
-        ico_uxf_window_visible_raise(window.window,
-                                     hs_app_screen_window[idx].visible,
-                                     hs_app_screen_window[idx].raise);
-        /* hide HomeScreen layer                        */
-        ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, HS_LAYER_HOMESCREEN, 0);
-    }
-    ico_uxf_main_loop_iterate();
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_set_invisible_all
- *          set all applicatoin except special applicaion(homescreen
- *          /statusbar/onscreen) in invisible.
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_set_invisible_all(void)
-{
-    uifw_trace("hs_set_invisible_all: Enter");
-
-    /* hide application layer                       */
-    ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, HS_LAYER_APPLICATION, 0);
-    /* hide HomeScreen layer menu                   */
-    ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, HS_LAYER_HOMESCREEN, 0);
-
-    uifw_trace("hs_set_invisible_all: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_show_appscreen
- *          show applicaton screen and raise the indicated application.
- *
- * @param[in]   appid               application id
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-hs_show_appscreen(const char *appid)
-{
-    Ico_Uxf_ProcessWin window;
-    const Ico_Uxf_conf_application *appConf = NULL;
-    int ii, idx;
-    int ret;
-    int dispW, dispH;
-    int sid;
-
-    uifw_trace("hs_show_appscreen: Enter(appid=%s)", appid ? appid : "(NULL)");
-
-    if (hs_stat_touch == ICO_HS_TOUCH_IN_HIDE)  {
-        /* if it is the transition from an application screen to        */
-        /* an other application screen, perform animation at hide screen*/
-        ico_uxf_window_animation_control(0, 1);
-    }
-    else    {
-        /* if it is the transition from menu to an application screen,  */
-        /* do not perform animation at hide appllication screen         */
-        ico_uxf_window_animation_control(0, 0);
-    }
-
-    /* change to noraml mode for AppsControler  */
-    ico_uxf_window_control(NULL, -1, ICO_UXF_APPSCTL_TEMPVISIBLE, 0);
-
-    /* touch to invisible */
-    sid = hs_get_process_window(ICO_HS_APPID_DEFAULT_TOUCH);
-    if (sid >= 0) {
-        ico_uxf_window_hide(sid);
-    }
-    /* all apps invisible */
-    hs_set_invisible_all();
-
-    /* show other apps */
-    for (ii = 0; ii < ICO_HS_APP_NUM_MAX; ii++) {
-        if (hs_app_screen_window[ii].appid[0] == 0)
-            continue;
-        appConf = ico_uxf_getAppByAppid(hs_app_screen_window[ii].appid);
-        if (appConf != NULL) {
-            hs_app_screen_window[ii].category = appConf->categoryId;
-        }
-        if (hs_is_special_app(hs_app_screen_window[ii].appid))
-            continue;
-        if ((appid != NULL) && strncmp(hs_app_screen_window[ii].appid, appid,
-                                       ICO_UXF_MAX_PROCESS_NAME) == 0)
-            continue;
-
-        /* if invisible */
-        ret = ico_uxf_process_window_get(hs_app_screen_window[ii].appid,
-                                         &window, 1);
-        uifw_trace("hs_show_appscreen: window_get app[%s] = %d(visible=%d)",
-                   hs_app_screen_window[ii].appid, ret,
-                   hs_app_screen_window[ii].visible);
-        if ((ret > 0) || (ret == ICO_UXF_E2BIG))    {
-            if (hs_app_screen_window[ii].visible == 0) {
-            }
-            else {
-                uifw_trace("hs_show_appscreen: move %d=%dx%d(%d,%d)", ii,
-                           hs_app_screen_window[ii].resize_w,
-                           hs_app_screen_window[ii].resize_h,
-                           hs_app_screen_window[ii].move_x, hs_app_screen_window[ii].move_y);
-                /* move application window to application layer */
-                ico_uxf_window_resize(window.window,
-                                      hs_app_screen_window[ii].resize_w,
-                                      hs_app_screen_window[ii].resize_h);
-                ico_uxf_window_move(window.window,
-                                    hs_app_screen_window[ii].move_x,
-                                    hs_app_screen_window[ii].move_y, 0);
-                ico_uxf_window_show(window.window);
-                if (! appConf)  {
-                    ico_uxf_window_layer(window.window, HS_LAYER_APPLICATION);
-                    /* show application layer                       */
-                    ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, HS_LAYER_APPLICATION, 1);
-                }
-                else    {
-                    ico_uxf_window_layer(window.window, appConf->display[0].layerId);
-                    /* show application layer                       */
-                    ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN,
-                                          appConf->display[0].layerId, 1);
-                }
-            }
-        }
-    }
-    /* hide HomeScreen layer menu                   */
-    ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, HS_LAYER_HOMESCREEN, 0);
-    /* hide Touch layer                             */
-    ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, HS_LAYER_TOUCH, 0);
-    /* hide OnScreen windows                        */
-    hs_hide_onscreen();
-
-    /* show own apps */
-    if (appid != NULL) {
-        idx = hs_get_index_appscreendata(appid);
-        /* if not set pos, load default */
-        appConf = ico_uxf_getAppByAppid(appid);
-        if (appConf != NULL) {
-            int x, y, width, height;
-            (void)ico_uxf_getAppDisplay(appConf, 0, &x, &y, &width, &height);
-
-            if ((hs_app_screen_window[idx].resize_w == -1)
-                    || (hs_app_screen_window[idx].resize_h == -1)) {
-                hs_app_screen_window[idx].resize_w = width;
-                hs_app_screen_window[idx].resize_h = height;
-            }
-            if ((hs_app_screen_window[idx].move_x == -1)
-                    || (hs_app_screen_window[idx].move_y == -1)) {
-                hs_app_screen_window[idx].move_x = x;
-                hs_app_screen_window[idx].move_y = y;
-            }
-            if ((hs_app_screen_window[idx].resize_w == 0)
-                    && (hs_app_screen_window[idx].resize_h == 0)
-                    && (hs_app_screen_window[idx].move_x == 0)
-                    && (hs_app_screen_window[idx].move_y == 0)) {
-                /* not have manifest, set default */
-                ico_uxf_window_screen_size_get(&dispW, &dispH);
-                hs_app_screen_window[idx].resize_w = dispW;
-                hs_app_screen_window[idx].resize_h = (dispH - ICO_HS_SIZE_SB_HEIGHT) / 2;
-                hs_app_screen_window[idx].move_x = 0;
-                hs_app_screen_window[idx].move_y = ICO_HS_SIZE_SB_HEIGHT;
-            }
-        }
-
-        /* show */
-        ret = ico_uxf_process_window_get(appid, &window, 1);
-        uifw_trace("hs_show_appscreen: window_get app[%s] = %d", appid, ret);
-        if ((ret > 0) || (ret == ICO_UXF_E2BIG))    {
-            uifw_trace("hs_show_appscreen: move %d=%dx%d(%d,%d)", idx,
-                       hs_app_screen_window[idx].resize_w,
-                       hs_app_screen_window[idx].resize_h,
-                       hs_app_screen_window[idx].move_x,
-                       hs_app_screen_window[idx].move_y);
-            /* window hide and resize (for animation)       */
-            ico_uxf_window_hide(window.window);
-            /* move application window to application layer */
-            ico_uxf_window_resize(window.window,
-                                  hs_app_screen_window[idx].resize_w,
-                                  hs_app_screen_window[idx].resize_h);
-            ico_uxf_window_move(window.window,
-                                hs_app_screen_window[idx].move_x,
-                                hs_app_screen_window[idx].move_y, 0);
-            if (! appConf)  {
-                ico_uxf_window_layer(window.window, HS_LAYER_APPLICATION);
-                /* show application layer                       */
-                ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, HS_LAYER_APPLICATION, 1);
-            }
-            else    {
-                ico_uxf_window_layer(window.window, appConf->display[0].layerId);
-                /* show application layer                       */
-                ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN,
-                                      appConf->display[0].layerId, 1);
-            }
-            ico_uxf_window_raise(window.window);
-            /* activate application window                  */
-            if ((appConf != NULL) && (appConf->display[0].layerId == HS_LAYER_SOFTKEYBOARD)) {
-                ico_uxf_window_active(window.window, ICO_UXF_WINDOW_POINTER_ACTIVE);
-            }
-            else    {
-                ico_uxf_window_active(window.window,
-                                          ICO_UXF_WINDOW_KEYBOARD_ACTIVE);
-            }
-            ico_syc_apc_active(appid);
-
-            hs_app_screen_window[idx].visible = 1;
-            /* hide HomeScreen layer                        */
-            ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, HS_LAYER_HOMESCREEN, 0);
-            /* visible application window with animation    */
-            ico_uxf_window_visible_animation(window.window, 1);
-        }
-    }
-    hs_stat_touch = ICO_HS_TOUCH_IN_HIDE;
-    ico_uxf_window_animation_control(0, 1);     /* change hide animation to default */
-    ico_uxf_main_loop_iterate();
-
-    uifw_trace("hs_show_appscreen: Leave");
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_tile_start_apps
- *          launch the default application that indicated by configuration
- *          file.
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_tile_start_apps(void)
-{
-    char cName[ICO_UXF_MAX_PROCESS_NAME + 1];
-    int idx, ret;
-    int idx1, idx2;
-    const char *appName;
-    const Ico_Uxf_App_Config *appConf;
-    hs_tile_info_t *tinfo;
-
-    /* excute applications in tile menu */
-    for (idx = 0; idx < hs_tile_cnt; idx++) {
-        tinfo = &hs_tile_info[idx];
-        if (tinfo->valid == 0) continue;
-        sprintf(cName, ICO_HS_CONFIG_TILE_APP"%d", idx);
-        appName = hs_conf_get_string(ICO_HS_CONFIG_HOMESCREEN, cName, NULL);
-        if ((appName != NULL) && (strcmp(appName, "none") != 0)) {
-            ret = ico_uxf_process_execute(appName);
-            if (ret >= 0) {
-                uifw_trace("hs_tile_start_apps: execute tile[%d]=%s", idx, appName);
-                memset(tinfo->appid, 0, ICO_UXF_MAX_PROCESS_NAME + 1);
-                strncpy(tinfo->appid, appName, ICO_UXF_MAX_PROCESS_NAME);
-            }
-        }
-    }
-
-    /* excute no menu applications      */
-    appConf = ico_uxf_getAppConfig();
-    idx = hs_tile_cnt;
-    for (idx1 = 0; idx1 < appConf->applicationNum; idx1++)  {
-        if (appConf->application[idx1].autostart == 0)  continue;
-        for (idx2 = 0; idx2 < hs_tile_cnt; idx2++)  {
-            if (! strcmp(hs_tile_info[idx2].appid, appConf->application[idx1].appid)) break;
-        }
-        if (idx2 >= hs_tile_cnt)    {
-            ret = ico_uxf_process_execute(appConf->application[idx1].appid);
-            if (ret >= 0) {
-                uifw_trace("hs_tile_start_apps: execute no tile[%d]=%s",
-                           idx, appConf->application[idx1].appid);
-                memset(hs_tile_info[idx].appid, 0, ICO_UXF_MAX_PROCESS_NAME + 1);
-                strncpy(hs_tile_info[idx].appid,
-                        appConf->application[idx1].appid, ICO_UXF_MAX_PROCESS_NAME);
-                idx ++;
-                if ((idx - hs_tile_cnt) >= ICO_HS_NOTILE_APP_MAX)   break;
-            }
-        }
-    }
-    hs_notile_cnt = idx - hs_tile_cnt;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_tile_init_info
- *          initialize tile information.
- *
- * @param       none
- * @return      result
- * @retval      ICO_HS_OK           success
- * @retval      ICO_HS_ERR          err
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_tile_init_info(void)
-{
-    int idx, row, column;
-    char *sValid = NULL;
-    char *sType = NULL;
-    int *valid = NULL;
-    int *type = NULL;
-    int dispW, dispH;
-    int width, height;
-    int mSide, mTop;
-    int colcnt, rowcnt, tilecnt, tilesize;
-    int try = 0;
-    hs_tile_info_t *tinfo;
-
-    /* count tile */
-    colcnt = hs_conf_get_integer(ICO_HS_CONFIG_HOMESCREEN,
-                                 ICO_HS_CONFIG_TILE_COLCNT,
-                                 ICO_HS_CONFIG_TILE_COLCNT_DEFAULT);
-    rowcnt = hs_conf_get_integer(ICO_HS_CONFIG_HOMESCREEN,
-                                 ICO_HS_CONFIG_TILE_ROWCNT,
-                                 ICO_HS_CONFIG_TILE_ROWCNT_DEFAULT);
-    tilecnt = colcnt * rowcnt;
-
-    /* allocate tile info structure */
-    hs_tile_info = malloc(sizeof(hs_tile_info_t) * (tilecnt + ICO_HS_NOTILE_APP_MAX));
-    valid = (int *)malloc(sizeof(int) * (tilecnt + ICO_HS_NOTILE_APP_MAX));
-    type = (int *)malloc(sizeof(int) * (tilecnt + ICO_HS_NOTILE_APP_MAX));
-    if (!hs_tile_info || !valid || !type) {
-        uifw_warn("hs_tile_init_info: Leave(err malloc tile str failed)");
-        return ICO_HS_ERR;
-    }
-    memset(hs_tile_info, 0, sizeof(hs_tile_info_t) * (tilecnt + ICO_HS_NOTILE_APP_MAX));
-
-    /* get screen size */
-    ico_uxf_window_screen_size_get(&dispW, &dispH);
-    while ((dispW < 0) || (dispH < 0)) {
-        ico_uxf_main_loop_iterate();
-        try++;
-        if (try > 10) {
-            uifw_warn("hs_tile_init_info: Leave(cannot get screen size)");
-            return ICO_HS_ERR;
-        }
-        usleep(10000);
-        ico_uxf_window_screen_size_get(&dispW, &dispH);
-    }
-    width = dispW;
-    height = dispH - ICO_HS_SIZE_SB_HEIGHT;
-
-    /* determin tile size (interval the tile is 10 percent of the tile width) */
-    if (((float)width / (float)colcnt) > ((float)height / (float)rowcnt)) {
-        /* tile size based height */
-        tilesize = height / (1.0 * rowcnt + 0.1 * (rowcnt + 1));
-        mSide = (width - (tilesize * colcnt + tilesize * 0.1 * (colcnt + 1)))
-                / 2;
-        mTop = 0;
-    }
-    else {
-        /* tile size based width */
-        tilesize = width / (1.0 * colcnt + 0.1 * (colcnt + 1));
-        mSide = 0;
-        mTop = (height - (tilesize * rowcnt + tilesize * 0.1 * (rowcnt + 1)))
-                / 2;
-    }
-    uifw_trace("hs_tile_init_info: mSide=%d mTop=%d disp(%dx%d)", mSide, mTop,
-               dispW, dispH);
-
-    /* get tile config */
-    sValid = (char *)hs_conf_get_string(ICO_HS_CONFIG_HOMESCREEN,
-                                        ICO_HS_CONFIG_TILE_VALID, NULL);
-    sType = (char *)hs_conf_get_string(ICO_HS_CONFIG_HOMESCREEN,
-                                       ICO_HS_CONFIG_TILE_TYPE, NULL);
-    hs_convert_tile_config(sValid, valid, tilecnt, 1);
-    hs_convert_tile_config(sType, type, tilecnt, ICO_HS_TILE_SMALL);
-
-    /* set tile parameter */
-    for (idx = 0; idx < tilecnt; idx++) {
-        tinfo = &hs_tile_info[idx];
-        row = idx / colcnt;
-        column = idx % colcnt;
-        tinfo->idx = idx;
-        memset(tinfo->appid, 0, ICO_UXF_MAX_PROCESS_NAME + 1);
-        tinfo->valid = valid[idx];
-        tinfo->type = type[idx];
-        if (idx == tilecnt - 1) {
-            tinfo->type = ICO_HS_TILE_OTHERS;
-        }
-        tinfo->l_press = 0;
-        tinfo->change = 0;
-
-        tinfo->coord_x = mSide + tilesize * 0.1 + (tilesize + tilesize * 0.1)
-                * column;
-        tinfo->coord_y = mTop + ICO_HS_SIZE_SB_HEIGHT + tilesize * 0.1 + (tilesize
-                + tilesize * 0.1) * row;
-        switch (tinfo->type) {
-        case ICO_HS_TILE_SMALL:
-            tinfo->size_x = tilesize;
-            tinfo->size_y = tilesize;
-            break;
-        case ICO_HS_TILE_HWIDE:
-            tinfo->size_x = tilesize;
-            tinfo->size_y = tilesize * 2.1;
-            break;
-        case ICO_HS_TILE_VWIDE:
-            tinfo->size_x = tilesize * 2.1;
-            tinfo->size_y = tilesize;
-            break;
-        case ICO_HS_TILE_LARGE:
-            tinfo->size_x = tilesize * 2.1;
-            tinfo->size_y = tilesize * 2.1;
-            break;
-        default:
-            tinfo->size_x = tilesize;
-            tinfo->size_y = tilesize;
-            break;
-        }
-
-        uifw_trace("TILE_INFO:tile[%d]={%d,%d,%s,%d,%d,%d,(%dx%d),(%d,%d)}",
-                   idx, tinfo->idx, tinfo->valid, tinfo->appid, tinfo->type,
-                   tinfo->l_press, tinfo->change, tinfo->size_x, tinfo->size_y,
-                   tinfo->coord_x, tinfo->coord_y);
-    }
-
-    hs_tile_cnt = tilecnt;
-
-    return ICO_HS_OK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_tile_delete_hide
- *          delete hide app information.
- *
- * @param[in]   appid               application id
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-hs_tile_delete_hide(const char *appid)
-{
-    int ii;
-    hs_tile_info_t *tinfo;
-    hs_tile_hide_t *hide, *bhide;
-
-    for (ii = 0; ii < hs_tile_cnt; ii++) {
-        tinfo = &hs_tile_info[ii];
-        hide = tinfo->next;
-        bhide = NULL;
-        while (hide) {
-            if (strcmp(appid, hide->appid) == 0) {
-                if (! bhide) {
-                    tinfo->next = hide->next;
-                }
-                else {
-                    bhide->next = hide->next;
-                }
-                free(hide);
-                break;
-            }
-            bhide = hide;
-            hide = hide->next;
-        }
-    }
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_tile_free_app
- *          delete all information of the indicated tile.
- *
- * @param[in]   idx                 tile index
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-hs_tile_free_app(int idx)
-{
-    hs_tile_info_t *tinfo;
-    hs_tile_hide_t *hide;
-    int win;
-
-    if ((idx >= 0) && (idx < hs_tile_cnt)) {
-        tinfo = &hs_tile_info[idx];
-        if (tinfo->next) {
-            hide = tinfo->next;
-            tinfo->next = hide->next;
-            strncpy(tinfo->appid, hide->appid, ICO_UXF_MAX_PROCESS_NAME);
-            free(hide);
-        }
-        else {
-            memset(tinfo->appid, 0, ICO_UXF_MAX_PROCESS_NAME + 1);
-        }
-    }
-    else {
-        return;
-    }
-
-    if (strlen(hs_active_onscreen) > 0) {
-        return;
-    }
-    if (hs_regulation_visible == 0) {
-        return;
-    }
-
-    if ((hs_stat_touch == ICO_HS_TOUCH_IN_SHOW)
-        && (strlen(tinfo->appid) > 0)) {
-        win = hs_get_process_window(tinfo->appid);
-        if (win > 0) {
-            ico_uxf_window_visible_raise(win, 1, 1);
-        }
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_tile_show_screen
- *          show tile screen again.
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-hs_tile_show_screen(void)
-{
-    Ico_Uxf_ProcessWin window;
-    int ret;
-    int idx, sid;
-    hs_tile_info_t *tinfo;
-
-    if (hs_regulation_visible == 0) {
-        uifw_trace("hs_regulation_visible: regulation, no menu display");
-        return;
-    }
-
-    /* chnage to menu mode for AppsControler        */
-    ico_uxf_window_control(NULL, -1, ICO_UXF_APPSCTL_TEMPVISIBLE, 1);
-
-    /* all apps invisible */
-    /* hide HomeScreen layer menu                   */
-    ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, HS_LAYER_HOMESCREEN, 0);
-
-    /* show application tile */
-    for (idx = 0; idx < hs_tile_cnt; idx++) {
-        tinfo = &hs_tile_info[idx];
-        if (tinfo->appid[0] == 0)
-            continue;
-
-        ret = ico_uxf_process_window_get(tinfo->appid, &window, 1);
-        uifw_trace("hs_tile_show_screen: window_get app[%s] = %d(%08x)",
-                   tinfo->appid, ret, window.window);
-        if (((ret > 0) || (ret == ICO_UXF_E2BIG)) && (window.window != 0))  {
-            uifw_trace("hs_tile_show_screen: move %d=%dx%d(%d,%d)", idx,
-                       tinfo->size_x, tinfo->size_y, tinfo->coord_x, tinfo->coord_y);
-            /* move application window to HomeScreen layer  */
-            ico_uxf_window_layer(window.window, HS_LAYER_HOMESCREEN);
-            ico_uxf_window_resize_flag(window.window, tinfo->size_x, tinfo->size_y, 1);
-            ico_uxf_window_move(window.window, tinfo->coord_x, tinfo->coord_y, 0);
-            ico_uxf_window_visible_raise(window.window, 1, 1);
-        }
-    }
-
-    hs_stat_touch = ICO_HS_TOUCH_IN_SHOW;
-    /* visible and raise touch layer */
-    sid = hs_get_process_window(ICO_HS_APPID_DEFAULT_TOUCH);
-    if (sid >= 0) {
-        ico_uxf_window_visible_raise(sid, 1, 1);
-    }
-    /* show HomeScreen layer menu                   */
-    ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, HS_LAYER_HOMESCREEN, 1);
-    /* show Touch layer                             */
-    ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, HS_LAYER_TOUCH, 1);
-    /* hide application layer                       */
-    ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, HS_LAYER_APPLICATION, 0);
-
-    ico_uxf_main_loop_iterate();
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_tile_get_index_app
- *          Get tile index that has indicated application id.
- *
- * @param[in]   appid               application id
- * @return      result
- * @retval      >=0                 tile index
- * @retval      -1                  not exist
- */
-/*--------------------------------------------------------------------------*/
-int
-hs_tile_get_index_app(const char *appid)
-{
-    int idx;
-    hs_tile_info_t *tinfo;
-
-    for (idx = 0; idx < hs_tile_cnt; idx++) {
-        tinfo = &hs_tile_info[idx];
-        if (strncmp(tinfo->appid, appid, ICO_UXF_MAX_PROCESS_NAME) == 0) {
-            return idx;
-        }
-    }
-
-    return -1;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_tile_get_minchange
- *          Get a application tile index that has no application
- *          or is changed minimum
- *
- * @param       none
- * @return      result
- * @retval      >=                  success(tile index)
- * @retval      < 0                 error
- */
-/*--------------------------------------------------------------------------*/
-int
-hs_tile_get_minchange(void)
-{
-    int ii;
-    int idx = -1;
-    int min = -1;
-    hs_tile_info_t *tinfo;
-
-    for (ii = 0; ii < hs_tile_cnt; ii++) {
-        tinfo = &hs_tile_info[ii];
-        if ((tinfo->type > ICO_HS_TILE_OTHERS) && ((tinfo->change <= min)
-                || (min == -1))) {
-            idx = ii;
-            min = tinfo->change;
-        }
-        if ((tinfo->type > ICO_HS_TILE_OTHERS) && (strlen(tinfo->appid) == 0)) {
-            return ii;
-        }
-    }
-
-    return idx;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_tile_kill_app
- *          terminate the indicated application, and free the tile
- *          that have the application.
- *
- * @param[in]   appid               application id
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-hs_tile_kill_app(const char *appid)
-{
-    int idx, ret;
-
-    idx = hs_tile_get_index_app(appid);
-
-    ret = ico_uxf_process_terminate(appid);
-    if (ret == ICO_UXF_EOK) {
-        if (idx >= 0) {
-            hs_tile_free_app(idx);
-        }
-        else {
-            hs_tile_delete_hide(appid);
-        }
-    }
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_tile_get_index_pos
- *          get the tile index of the position.
- *
- * @param[in]   appid               application id
- * @return      tile index
- * @retval      >=0                 success
- * @retval      ICO_HS_ERR          error
- */
-/*--------------------------------------------------------------------------*/
-int
-hs_tile_get_index_pos(int x, int y, int w, int h)
-{
-    int idx = -1;
-    hs_tile_info_t *tinfo;
-
-    for (idx = 0; idx < hs_tile_cnt; idx++) {
-        tinfo = &hs_tile_info[idx];
-        if ((tinfo->coord_x == x) && (tinfo->coord_y == y) && (tinfo->size_x
-                == w) && (tinfo->size_y == h)) {
-            return idx;
-        }
-    }
-
-    return ICO_HS_ERR;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_tile_set_app
- *          set the applicaton to the tile of the indicated index.
- *
- * @param[in]   idx                 tile index
- * @param[in]   appid               application id
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-hs_tile_set_app(int idx, const char *appid)
-{
-    hs_tile_info_t *tinfo;
-    hs_tile_hide_t *search, *bsearch, *hide = NULL;
-    int ii;
-
-    uifw_trace("hs_tile_set_app: Enter(idx=%d appid=%s)", idx, appid);
-
-    if ((idx < 0) && (idx >= hs_tile_cnt)) {
-        return;
-    }
-
-    /* check whether the app is same as tile one */
-    tinfo = &hs_tile_info[idx];
-    if (strcmp(tinfo->appid, appid) == 0) {
-        return;
-    }
-
-    /* check whether the app is hide */
-    for (ii = 0; ii < hs_tile_cnt; ii++) {
-        tinfo = &hs_tile_info[ii];
-        if (tinfo->valid == 0) continue;
-        search = tinfo->next;
-        bsearch = NULL;
-        while (search) {
-            if (strcmp(search->appid, appid) == 0) {
-                hide = search;
-                if (! bsearch) {
-                    tinfo->next = search->next;
-                }
-                else {
-                    bsearch->next = search->next;
-                }
-                break;
-            }
-            bsearch = search;
-            search = search->next;
-        }
-        if (hide) {
-            break;
-        }
-    }
-
-    /* set */
-    tinfo = &hs_tile_info[idx];
-    if (tinfo->valid > 0) {
-        if (strlen(tinfo->appid) != 0) {
-            int oldwin = hs_get_process_window(tinfo->appid);
-            if (oldwin > 0) {
-                (void) ico_uxf_window_hide(oldwin);
-            }
-
-            if (! hide) {
-                hide = malloc(sizeof(hs_tile_hide_t));
-            }
-            if (! hide) {
-                uifw_warn("hs_tile_set_app: cannot allocate app table");
-            }
-            else {
-                memset(hide, 0, sizeof(hs_tile_hide_t));
-                strncpy(hide->appid, tinfo->appid, ICO_UXF_MAX_PROCESS_NAME);
-                if (tinfo->next) {
-                    hide->next = tinfo->next;
-                }
-                tinfo->next = hide;
-            }
-        }
-        else {
-            free(hide);
-        }
-
-        strncpy(tinfo->appid, appid, ICO_UXF_MAX_PROCESS_NAME);
-        tinfo->change++;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_get_process_window
- *          get window surface from applicatoin id including special id.
- *
- * @param[in]   appid               application id
- * @return      result
- * @retval      >=0                 surface
- * @retval      -1                  not exist
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_get_process_window(const char *appid)
-{
-    Ico_Uxf_ProcessWin wins[2];
-    int ret;
-
-    if (strcmp(appid, ICO_HS_APPID_DEFAULT_TOUCH) == 0) {
-        ret = ico_uxf_process_window_get(hs_name_homescreen, wins, 2);
-        if ((ret > 1) || (ret == ICO_UXF_E2BIG))    {
-            return wins[1].window;
-        }
-    }
-    else {
-        ret = ico_uxf_process_window_get(appid, wins, 1);
-        if ((ret > 0) || (ret == ICO_UXF_E2BIG))    {
-            return wins[0].window;
-        }
-    }
-
-    return -1;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_show_onscreen
- *          set onscreen window to visible.
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-hs_show_onscreen(void)
-{
-    Ico_Uxf_ProcessWin window;
-    int ret;
-
-    ret = ico_uxf_process_window_get(ICO_HS_APPID_DEFAULT_ONS, &window, 1);
-
-    if ((ret > 0) || (ret == ICO_UXF_E2BIG))    {
-        ico_uxf_window_layer(window.window, HS_LAYER_ONSCREEN);
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_hide_onscreen
- *          set onscreen window to invisible.
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-hs_hide_onscreen(void)
-{
-    Ico_Uxf_ProcessWin window;
-    int ret;
-
-    ret = ico_uxf_process_window_get(ICO_HS_APPID_DEFAULT_ONS, &window, 1);
-
-    if ((ret > 0) || (ret == ICO_UXF_E2BIG))    {
-        ico_uxf_window_layer(window.window, HS_LAYER_BACKGROUND);
-        ico_uxf_window_lower(window.window);
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_click_escutcheon
- *          processing when escutcheon button is clicked.
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-hs_click_escutcheon(void)
-{
-    uifw_trace("hs_click_escutcheon: Enter(regulation=%d)", hs_regulation_visible);
-
-    if (strlen(hs_active_onscreen) > 0) {
-        uifw_trace("hs_click_escutcheon: Leave(active=%s)", hs_active_onscreen);
-        return;
-    }
-    if (hs_regulation_visible == 0) {
-        uifw_trace("hs_click_escutcheon: Leave(regulation)");
-        return;
-    }
-
-    if (hs_stat_touch == ICO_HS_TOUCH_IN_SHOW) {
-        hs_snd_play(hs_snd_get_filename(ICO_HS_SND_TYPE_DEFAULT));
-        uifw_trace("hs_click_escutcheon: hs_show_appscreen");
-        hs_show_appscreen(NULL);
-    }
-    else if (hs_stat_touch == ICO_HS_TOUCH_IN_HIDE) {
-        hs_snd_play(hs_snd_get_filename(ICO_HS_SND_TYPE_DEFAULT));
-        uifw_trace("hs_click_escutcheon: hs_tile_show_screen");
-        hs_tile_show_screen();
-    }
-    uifw_trace("hs_click_escutcheon: Leave");
-}
-
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_click_applist
- *          processing when application list button is clicked.
- *
- * @param       none
- * @return      regulation
- * @retval      =0      regulation controlled(no display)
- * @retval      =1      no regulation
- */
-/*--------------------------------------------------------------------------*/
-int
-hs_click_applist(void)
-{
-    uifw_trace("hs_click_applist: Enter(regulation=%d)", hs_regulation_visible);
-
-    if (hs_regulation_visible == 0) {
-        uifw_trace("hs_click_applist: Leave(regulation)");
-        return 0;
-    }
-
-    /* operation sound */
-    hs_snd_play(hs_snd_get_filename(ICO_HS_SND_TYPE_DEFAULT));
-
-    /* show Touch layer                             */
-    ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, HS_LAYER_TOUCH, 1);
-    /* show OnScreen windows                        */
-    hs_show_onscreen();
-
-    uifw_trace("hs_click_applist: Leave");
-    return 1;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_is_special_app
- *          return 1 if the application is special one(homescreen)
- *          /statusbar/onscreen).
- *
- * @param[in]   appid       applicationId
- * @return      special application
- * @retval      1           special application(HomeScreen/StatusBar ... etc)
- * @retval      0           normal application
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_is_special_app(const char *appid)
-{
-    if ((strncmp(appid, hs_name_homescreen, ICO_UXF_MAX_PROCESS_NAME) == 0)
-            || (strncmp(appid, gStatusbarName, ICO_UXF_MAX_PROCESS_NAME) == 0)
-            || (strncmp(appid, gOnscreenName, ICO_UXF_MAX_PROCESS_NAME) == 0)
-            || (strncmp(appid, ICO_HS_APPID_DEFAULT_TOUCH,
-                        ICO_UXF_MAX_PROCESS_NAME) == 0)) {
-        uifw_trace("hs_is_special_app: app(%s) is special", appid);
-        return 1;
-    }
-    uifw_trace("hs_is_special_app: app(%s) is normal", appid);
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_is_noicon_app
- *          return 1 if the application has no menu icon
- *
- * @param[in]   appid       applicationId
- * @return      no need menu
- * @retval      1           no need menu
- * @retval      0           need menu
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_is_noicon_app(const char *appid)
-{
-    const Ico_Uxf_conf_application  *appConf;
-
-    appConf = ico_uxf_getAppByAppid(appid);
-    if (! appConf)  {
-        uifw_trace("hs_is_noicon_app: appid(%s) dose not exist", appid);
-        return 0;
-    }
-
-    if (appConf->noicon)    {
-        uifw_trace("hs_is_noicon_app: appid(%s) has no icon", appid);
-        return 1;
-    }
-    uifw_trace("hs_is_noicon_app: appid(%s) has icon", appid);
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_terminate_all_app
- *          terminate all application that homescreen handled
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_terminate_all_app(void)
-{
-    Ico_Uxf_ProcessAttr procs[ICO_HS_APP_NUM_MAX];
-    int cnt;
-    int ii = 0;
-
-    cnt = ico_uxf_process_query_processes(procs, ICO_HS_APP_NUM_MAX);
-    if (cnt == ICO_UXF_E2BIG)
-        cnt = ICO_HS_APP_NUM_MAX;
-    uifw_trace("hs_terminate_all_app: ico_uxf_process_query_processes() = %d",
-               cnt);
-    for (ii = 0; ii < cnt; ii++) {
-        if (hs_is_special_app(procs[ii].process))
-            continue;
-        uifw_trace("hs_terminate_all_app: terminate(%s)", procs[ii].process);
-        ico_uxf_process_terminate(procs[ii].process);
-    }
-    ico_uxf_process_terminate(gStatusbarName);
-    ico_uxf_process_terminate(gOnscreenName);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_req_ctlr_tile
- *          processing when homescreen received json command from extra
- *          tools.
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-hs_req_ctlr_tile(void)
-{
-    int ii, ret;
-    int idx;
-
-    for (ii = 0; ii < ICO_HS_APP_NUM_MAX; ii++) {
-        if ((hs_command_tile_req[ii].appid[0] == 0)
-                || (hs_is_special_app(hs_command_tile_req[ii].appid) == TRUE)) {
-            continue;
-        }
-
-        idx = hs_tile_get_index_app(hs_command_tile_req[ii].appid);
-
-        /* terminate app */
-        if (hs_command_tile_req[ii].terminate != IGNORE) {
-            ret = ico_uxf_process_terminate(hs_command_tile_req[ii].appid);
-            if (ret == ICO_UXF_EOK) {
-                if (idx >= 0) {
-                    hs_tile_free_app(idx);
-                }
-            }
-        }
-
-        /* execute app */
-        if (strlen(hs_command_tile_req[ii].exe_name) > 0) {
-            ico_uxf_process_execute(hs_command_tile_req[ii].exe_name);
-        }
-    }
-    hs_tile_show_screen();
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_touch_up_api_list
- *          processing when application list button touch up.
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_touch_up_api_list(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
-    int idx = *(int *)data;
-    char buf[ICO_HS_TEMP_BUF_SIZE];
-    char path[ICO_HS_TEMP_BUF_SIZE];
-    hs_tile_info_t *tinfo;
-
-    tinfo = &hs_tile_info[idx];
-
-    /* set the image */
-    hs_get_image_path(path, sizeof(path));
-    sprintf(buf, "%s"fname_api_all_off, path);
-    evas_object_image_file_set(obj, buf, NULL);
-    /* move and resize in the image */
-    evas_object_move(obj, tinfo->coord_x, tinfo->coord_y - ICO_HS_SIZE_SB_HEIGHT);
-    evas_object_resize(obj, tinfo->size_x, tinfo->size_y);
-    /* show the image */
-    evas_object_show(obj);
-
-    uifw_trace("hs_touch_up_api_list: idx=%d", idx);
-    strncpy(hs_active_onscreen, ICO_UXF_PROC_DEFAULT_HOMESCREEN,
-            sizeof(hs_active_onscreen));
-    hs_get_ons_edj_path(path, sizeof(path));
-    sprintf(buf, "OPEN %s%s %s", path, ICO_HS_ONS_APPLI_LIST_NAME,
-            ICO_UXF_PROC_DEFAULT_HOMESCREEN);
-    uifw_trace("send '%s' to onscreen", buf);
-    if (hs_lib_event_message(ICO_HS_PROTOCOL_TYPE_OS, buf) < 0) {
-        memset(hs_active_onscreen, 0, sizeof(hs_active_onscreen));
-    }
-    hs_snd_play(hs_snd_get_filename(ICO_HS_SND_TYPE_DEFAULT));
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_touch_down_api_list
- *          processing when application list button touch down.
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_touch_down_api_list(void *data, Evas *evas, Evas_Object *obj,
-                       void *event_info)
-{
-    int idx = *(int *)data;
-    char buf[ICO_HS_TEMP_BUF_SIZE];
-    char path[ICO_HS_TEMP_BUF_SIZE];
-    hs_tile_info_t *tinfo;
-
-    tinfo = &hs_tile_info[idx];
-
-    /* set the image */
-    hs_get_image_path(path, sizeof(path));
-    sprintf(buf, "%s"fname_api_all_off, path);
-    evas_object_image_file_set(obj, buf, NULL);
-    /* move and resize in the image */
-    evas_object_move(obj, tinfo->coord_x, tinfo->coord_y - ICO_HS_SIZE_SB_HEIGHT);
-    evas_object_resize(obj, tinfo->size_x, tinfo->size_y);
-    /* show the image */
-    evas_object_show(obj);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_ecore_timer_event
- *          handler called when applicaton tile is pushed long term
- *          to terminate application.
- *
- * @param[in]   data                user data
- * @return      result
- * @retval      ECORE_CALLBACK_CANCEL
- *                                  delete this handler
- */
-/*--------------------------------------------------------------------------*/
-static Eina_Bool
-hs_ecore_timer_event(void *data)
-{
-    int idx = *(int *)data;
-    char buf[ICO_HS_TEMP_BUF_SIZE];
-    char tmp[ICO_HS_TEMP_BUF_SIZE];
-    hs_tile_info_t *tinfo;
-
-    tinfo = &hs_tile_info[idx];
-    if (tinfo->l_press == 1) {
-        /* flag reset */
-        tinfo->l_press = 0;
-        /* set terminate app id for onscrAppliKill */
-        if (strlen(tinfo->appid) != 0) {
-            strncpy(hs_kill_appid, tinfo->appid, sizeof(hs_kill_appid));
-            uifw_trace("hs_ecore_timer_event :hs_kill_appid = %s", hs_kill_appid);
-            strncpy(hs_active_onscreen, ICO_UXF_PROC_DEFAULT_HOMESCREEN,
-                    sizeof(hs_active_onscreen));
-            sprintf(buf, "OPEN HomeScreen/src/appli_kill.edj %s",
-                    ICO_UXF_PROC_DEFAULT_HOMESCREEN);
-            hs_get_ons_edj_path(tmp, sizeof(tmp));
-            sprintf(buf, "OPEN %s%s %s", tmp, ICO_HS_ONS_APPLI_KILL_NAME,
-                    ICO_UXF_PROC_DEFAULT_HOMESCREEN);
-            uifw_trace("hs_ecore_timer_event: send %s to onscreen", buf);
-            hs_lib_event_message(ICO_HS_PROTOCOL_TYPE_OS, buf);
-        }
-    }
-    return ECORE_CALLBACK_CANCEL;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_touch_up_tile
- *          processing when application tile button touch up.
- *
- * @param[in]   data                user data
- * @param[in]   obj                 evas object of the button
- * @param[in]   event_info          evas event infomation
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_touch_up_tile(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
-    int idx = *(int *)data;
-    int ret;
-    char buf[64];
-    hs_tile_info_t *tinfo;
-
-    uifw_trace("hs_touch_up_tile: idx=%d", idx);
-
-    if (strlen(hs_active_onscreen) != 0) {
-        uifw_trace("hs_touch_up_tile: active=%s", hs_active_onscreen);
-        return;
-    }
-
-    tinfo = &hs_tile_info[idx];
-    if (tinfo->l_press == 1) {
-        /* flag reset */
-        tinfo->l_press = 0;
-        /* send a message to extra tools */
-        if (strlen(tinfo->appid) != 0) {
-            sprintf(buf, "FOCUS %s", tinfo->appid);
-            uifw_trace("hs_touch_up_tile: send '%s' to extra tools", buf);
-            ret = hs_lib_event_message(ICO_HS_PROTOCOL_TYPE_CM, buf);
-            if (ret < 0) {
-                hs_show_appscreen(tinfo->appid);
-
-                hs_snd_play(hs_snd_get_filename(ICO_HS_SND_TYPE_DEFAULT));
-            }
-        }
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_touch_down_tile
- *          processing when application tile button touch down.
- *
- * @param[in]   data                user data
- * @param[in]   obj                 evas object of the button
- * @param[in]   event_info          evas event infomation
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_touch_down_tile(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
-    int idx = *(int *)data;
-    hs_tile_info_t *tinfo;
-
-    uifw_trace("hs_touch_down_tile: idx=%d", idx);
-
-    tinfo = &hs_tile_info[idx];
-    tinfo->l_press = 1;
-    if (strlen(tinfo->appid) != 0) {
-    }
-
-    if (tinfo->type > ICO_HS_TILE_OTHERS) {
-        /* add timer to detect long push */
-        ecore_timer_add(ICO_HS_TOUCH_TIME_OUT, hs_ecore_timer_event, &tinfo->idx);
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_add_bg_image
- *          add image to background. if config does not have image file or
- *          image file is not exsit, background show default edj.
- *
- * @param[in]   canvas_bg           evas of background
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_add_bg_image(Evas *canvas_bg)
-{
-    char img[ICO_HS_TEMP_BUF_SIZE];
-    char path[ICO_HS_TEMP_BUF_SIZE];
-    char *fname;
-    Evas_Object *canvas;
-    Evas_Load_Error err;
-    int dispW, dispH;
-
-    fname = (char *)hs_conf_get_string(ICO_HS_CONFIG_HOMESCREEN,
-                                       ICO_HS_CONFIG_BG, NULL);
-    if (!fname) {
-        uifw_trace("hs_add_bg_image: backgound config is not exist");
-        return;
-    }
-    if (fname[0] == '/') {
-        snprintf(img, sizeof(img), "%s", fname);
-    }
-    else {
-        hs_get_image_path(path, sizeof(path));
-        snprintf(img, sizeof(img), "%s/%s", path, fname);
-    }
-    uifw_trace("hs_add_bg_image: image path=%s", img);
-
-    ico_uxf_window_screen_size_get(&dispW, &dispH);
-    canvas = evas_object_image_filled_add(canvas_bg);
-    evas_object_image_file_set(canvas, img, NULL);
-    err = evas_object_image_load_error_get(canvas);
-    if (err != EVAS_LOAD_ERROR_NONE) {
-        uifw_warn("hs_add_bg_image: backgound image(%s) is not exist", img);
-    }
-    else {
-        evas_object_image_fill_set(canvas, 0, 0, dispW, dispH - ICO_HS_SIZE_SB_HEIGHT);
-        evas_object_resize(canvas, dispW, dispH - ICO_HS_SIZE_SB_HEIGHT);
-        evas_object_show(canvas);
-    }
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_add_touch_listener
- *          make and add listener to application tile button.
- *
- * @param[in]   canvas_fg           evas of tile screen
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_add_touch_listener(Evas *canvas_fg)
-{
-    int idx;
-    char img[ICO_HS_TEMP_BUF_SIZE];
-    char path[ICO_HS_TEMP_BUF_SIZE];
-    Evas_Object * canvas;
-    hs_tile_info_t *tinfo;
-
-    /* set image path */
-    hs_get_image_path(path, sizeof(path));
-    sprintf(img, "%s"fname_api_all_off, path);
-
-    /* setup tile */
-    for (idx = 0; idx < hs_tile_cnt; idx++) {
-        tinfo = &hs_tile_info[idx];
-        if (tinfo->valid == 0)
-            continue;
-        /* Creates a reclangle */
-        canvas = evas_object_rectangle_add(canvas_fg);
-        /* Set a color or image */
-        evas_object_color_set(canvas, 0, 0, 0, 0);
-        /* Move and resize the rectangle */
-        evas_object_move(canvas, tinfo->coord_x, tinfo->coord_y - ICO_HS_SIZE_SB_HEIGHT);
-        evas_object_resize(canvas, tinfo->size_x, tinfo->size_y);
-        /* add event the rectangle */
-        evas_object_event_callback_add(canvas, EVAS_CALLBACK_MOUSE_UP,
-                                       hs_touch_up_tile, &tinfo->idx);
-        evas_object_event_callback_add(canvas, EVAS_CALLBACK_MOUSE_DOWN,
-                                       hs_touch_down_tile, &tinfo->idx);
-        /* show the rectangle */
-        evas_object_show(canvas);
-    }
-    /* application menu icon */
-    tinfo = &hs_tile_info[hs_tile_cnt - 1];
-    if ((tinfo->valid == 0) && (tinfo->type == ICO_HS_TILE_APPLIST)) {
-        canvas = evas_object_image_filled_add(canvas_fg);
-        evas_object_image_file_set(canvas, img, NULL);
-        evas_object_move(canvas, tinfo->coord_x, tinfo->coord_y - ICO_HS_SIZE_SB_HEIGHT);
-        evas_object_resize(canvas, tinfo->size_x, tinfo->size_y);
-        evas_object_event_callback_add(canvas, EVAS_CALLBACK_MOUSE_UP,
-                                       hs_touch_up_api_list, &tinfo->idx);
-        evas_object_event_callback_add(canvas, EVAS_CALLBACK_MOUSE_DOWN,
-                                       hs_touch_down_api_list, &tinfo->idx);
-        evas_object_show(canvas);
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_create_window
- *          create background and tile screen window of ecore.
- *
- * @param[in]   type                background or tile screen
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void *
-hs_create_window(int type)
-{
-    Evas_Object *edje;
-    Ecore_Evas * window;
-    Evas * canvas;
-    int dispW, dispH;
-    int width, height;
-    char path[ICO_HS_TEMP_BUF_SIZE];
-    char edjfile[ICO_HS_TEMP_BUF_SIZE];
-
-    window = ecore_evas_new(NULL, 0, 0, 1, 1, "frame=0");
-
-    ecore_main_loop_iterate();
-    ico_uxf_window_screen_size_get(&dispW, &dispH);
-    width = dispW;
-    height = dispH - ICO_HS_SIZE_SB_HEIGHT;
-
-    if (!window) {
-        uifw_warn("HomeScreen: could not create window.");
-        return NULL;
-    }
-
-    canvas = ecore_evas_get(window);
-    edje = edje_object_add(canvas);
-    /* NULL is aborted */
-    if (!edje) {
-        uifw_warn("HomeScreen: could not create edje object!");
-        return NULL;
-    }
-
-    hs_get_edj_path(path, sizeof(path));
-
-    if (type == ICO_HS_WINDOW_TYPE_BG) {
-        ecore_evas_move(window, 0, 0);
-        ecore_evas_resize(window, width, height);
-        ecore_evas_show(window);
-        {
-            int err = edje_object_load_error_get(edje);
-            const char *errmsg = edje_load_error_str(err);
-            sprintf(edjfile, "%s/home_screen_bg.edj", path);
-            if (!edje_object_file_set(edje, edjfile, "home_screen_bg")) {
-                uifw_warn(
-                          "HomeScreen: could not load 'home_screen_bg' from %s: %s",
-                          edjfile, errmsg);
-                evas_object_del(edje);
-                return NULL;
-            }
-        }
-        evas_object_move(edje, 0, 0);
-        evas_object_resize(edje, width, height);
-        evas_object_show(edje);
-
-        hs_add_bg_image(canvas);
-    }
-    else {
-        ecore_evas_move(window, 0, 0);
-        ecore_evas_resize(window, width, height);
-        ecore_evas_alpha_set(window, EINA_TRUE);
-        ecore_evas_show(window);
-        {
-            int err = edje_object_load_error_get(edje);
-            const char *errmsg = edje_load_error_str(err);
-            sprintf(edjfile, "%s/home_screen_touch.edj", path);
-            if (!edje_object_file_set(edje, edjfile, "home_screen_touch")) {
-                uifw_warn(
-                          "HomeScreen: could not load 'home_screen_touch' from %s: %s",
-                          edjfile, errmsg);
-                evas_object_del(edje);
-                return NULL;
-            }
-        }
-        evas_object_move(edje, 0, 0);
-        evas_object_resize(edje, width, height);
-        evas_object_show(edje);
-
-        hs_add_touch_listener(canvas);
-    }
-
-    return edje;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_display_control
- *          callback function
- *
- * @param[in]   conf                configuration
- * @param[in]   show                show
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_display_control(const Ico_Uxf_conf_application *conf, const int show)
-{
-    uifw_trace("hs_display_control: app=%s show=%d", conf->appid, show);
-    /* no need, because all control in AppsController       */
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_sound_control
- *          callback function
- *
- * @param[in]   conf                configuration
- * @param[in]   adjust              adjust
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_sound_control(const Ico_Uxf_conf_application *conf, const int adjust)
-{
-    uifw_trace("hs_sound_control: app=%s adjust=%d", conf->appid, adjust);
-    /* no need, because all control in AppsController       */
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_input_control
- *          callback function
- *
- * @param[in]   conf                configuration
- * @param[in]   inputsw             input switch
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_input_control(const Ico_Uxf_conf_application *conf, const int inputsw)
-{
-    uifw_trace("hs_input_control: app=%s inputsw=%d", conf->appid, inputsw);
-    /* no need, because all control in AppsController       */
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_regulation_listener: change regulation callback(static function)
- *
- * @param[in]   appcategory     category Id
- * @param[in]   control         control(display/sound/input active/inactive)
- * @param[in]   user_data       user data(unused)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-hs_regulation_listener(const int appcategory,
-                       const ico_apc_reguration_control_t control, void *user_data)
-{
-    if ((appcategory == hs_regulation_category) &&
-        (control.display != ICO_SYC_APC_REGULATION_NOCHANGE))   {
-        uifw_trace("hs_regulation_listener: Enter(category=%d disp=%d)",
-                   appcategory, control.display);
-
-        if (control.display == ICO_SYC_APC_REGULATION_REGULATION)   {
-            /* Invisible by reguration      */
-            if (hs_regulation_visible)  {
-                hs_regulation_visible = 0;
-                if (hs_stat_touch == ICO_HS_TOUCH_IN_SHOW) {
-                    uifw_trace("hs_regulation_listener: Change to App screen");
-                    hs_show_appscreen(NULL);
-                }
-                hs_hide_onscreen();
-                memset(hs_active_onscreen, 0, sizeof(hs_active_onscreen));
-            }
-        }
-        else    {
-            /* Visible                      */
-            uifw_trace("hs_regulation_listener: Change to ALl screen");
-            hs_regulation_visible = 1;
-        }
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   main
- *          homescreen main. initialize UXF, app manager, and ecore.
- *
- * @param[in]   argc                counts of argment
- * @param[in]   argv                argment
- * @return      result
- * @retval      >=0                 success
- * @retval      -1                  error
- */
-/*--------------------------------------------------------------------------*/
-int
-main(int argc, char *argv[])
-{
-    int ii = 0;
-    int ret;
-    int port;
-
-    /* get pkg name */
-    char *pkg;
-    pkg = getenv("PKG_NAME");
-    memset(hs_name_homescreen, 0, ICO_UXF_MAX_PROCESS_NAME + 1);
-    if (pkg) {
-        strncpy(hs_name_homescreen, pkg, ICO_UXF_MAX_PROCESS_NAME);
-    }
-    else {
-        strncpy(hs_name_homescreen, ICO_UXF_PROC_DEFAULT_HOMESCREEN,
-                ICO_UXF_MAX_PROCESS_NAME);
-    }
-    strncpy(gStatusbarName,
-            (char *)hs_conf_get_string(ICO_HS_CONFIG_HOMESCREEN,
-                                       ICO_HS_CONFIG_SB,
-                                       ICO_HS_APPID_DEFAULT_SB),
-            ICO_UXF_MAX_PROCESS_NAME);
-    strncpy(gOnscreenName,
-            (char *)hs_conf_get_string(ICO_HS_CONFIG_HOMESCREEN,
-                                       ICO_HS_CONFIG_ONS,
-                                       ICO_HS_APPID_DEFAULT_ONS),
-            ICO_UXF_MAX_PROCESS_NAME);
-    hs_snd_init();
-
-    /* init for window mgr */
-    ret = ico_uxf_init(hs_name_homescreen);
-    if (ret != ICO_UXF_EOK) {
-        uifw_error("ico_uxf_init err=%d", ret);
-        exit(8);
-    }
-    ico_uxf_callback_set(ICO_UXF_EVENT_ALL, hs_uxf_event, 0);
-    memset(hs_app_screen_window, 0, sizeof(hs_app_screen_window));
-    for (ii = 0; ii < ICO_HS_APP_NUM_MAX; ii++) {
-        hs_app_screen_window[ii].resize_w = -1;
-        hs_app_screen_window[ii].resize_h = -1;
-        hs_app_screen_window[ii].move_x = -1;
-        hs_app_screen_window[ii].move_y = -1;
-    }
-    ico_uxf_main_loop_iterate();
-
-    /* init tile info */
-    ret = hs_tile_init_info();
-    if (ret < 0) {
-        uifw_warn("hs_tile_init_info err=%d", ret);
-    }
-
-    /* start onscreen & statusbar apps */
-    ret = ico_uxf_process_execute(gOnscreenName);
-    if (ret < 0) {
-        uifw_warn("ico_uxf_process_execute(%s) err=%d", gOnscreenName, ret);
-    }
-    ret = ico_uxf_process_execute(gStatusbarName);
-    if (ret < 0) {
-        uifw_warn("ico_uxf_process_execute(%s) err=%d", gStatusbarName, ret);
-    }
-    ico_uxf_main_loop_iterate();
-
-    /* init EFL */
-    ecore_evas_init();
-    edje_init();
-
-    /* for communicate other process */
-    port = hs_conf_get_integer(ICO_HS_CONFIG_HOMESCREEN,
-                               ICO_HS_CONFIG_WS_PORT,
-                               ICO_HS_WS_PORT);
-    hs_lib_main(port);
-
-    /* initialize Application Controller    */
-    ret = ico_syc_apc_init(hs_display_control, hs_sound_control, hs_input_control);
-    if (ret != ICO_SYC_EOK) {
-        uifw_error("ico_syc_apc_init err=%d", ret);
-    }
-
-    /* start default tile apps */
-    hs_tile_start_apps();
-    ico_uxf_main_loop_iterate();
-
-    /* HomeScreen Menu(background) */
-    hs_create_window(ICO_HS_WINDOW_TYPE_BG);
-    /* add callbacks for wayland(wl_window_mgr) */
-    ecore_main_fd_handler_add(ico_uxf_wl_display_fd(), ECORE_FD_READ,
-                              hs_ecore_uxf_eventfd, NULL, /* data */
-                              NULL, NULL);
-    ecore_main_loop_iterate();
-    ico_uxf_main_loop_iterate();
-
-    /* HomeScreen Menu(touch) */
-    hs_create_window(ICO_HS_WINDOW_TYPE_TOUCH);
-
-    /* initiailze regulation control    */
-    hs_regulation_category = ico_uxf_getSysCategoryByName("CarSetting");
-    ico_syc_apc_regulation_listener(hs_regulation_listener, NULL);
-
-    if (hs_regulation_visible)  {
-        uifw_trace("main: no regulation");
-        hs_tile_show_screen();
-    }
-    else    {
-        uifw_trace("main: regulation");
-        hs_show_appscreen(NULL);
-    }
-
-    /* add callback to app configuration */
-    ico_uxf_econf_setAppUpdateCb(NULL);
-
-    /* wait events */
-    ecore_main_loop_begin();
-
-    /* terminate Application Controller */
-    (void) ico_syc_apc_term();
-
-    /* terminate all known application */
-    hs_terminate_all_app();
-
-    /* shutdown EFL */
-    edje_shutdown();
-    ecore_evas_shutdown();
-
-    return 0;
-}
diff --git a/src/home_screen_parser.c b/src/home_screen_parser.c
deleted file mode 100644 (file)
index 505330d..0000000
+++ /dev/null
@@ -1,1333 +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   parser of jason receive from external homescreen tools
- *
- * @date    Feb-15-2013
- */
-
-#include "home_screen_parser.h"
-
-/*============================================================================*/
-/* static(internal) functions prototype                                       */
-/*============================================================================*/
-static int hs_parse_value_string(JsonObject *, char *, char *);
-static int hs_parse_value_integer(JsonObject *, char *, int *);
-static int hs_hs_parse_value_integer2(JsonObject *, char *, int *, int *);
-static int hs_hs_parse_value_integer3(JsonObject *, char *, int *, int *, int *);
-static int hs_parse_program(JsonNode *, int);
-static int hs_parse_input(JsonNode *, int);
-static int hs_parse_window(JsonNode *, int, int);
-static int hs_parse_application(JsonNode *, int);
-
-/*============================================================================*/
-/* variables and tables                                                */
-/*============================================================================*/
-int hs_req_touch = ICO_HS_TOUCH_TOBE_SHOW; /* request about TOUCH */
-int hs_stat_touch = ICO_HS_TOUCH_IN_SHOW; /* status of TOUCH */
-static hs_command_req_t hs_command_req[ICO_HS_APP_NUM_MAX];
-static int hs_command_delay;
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_parse_form
- *          parse json command main
- *
- * @param[in]   data                json data
- * @param[in]   length              json data length
- * @return      result
- * @retval      0                   Success
- * @retval      1                   Failed
- */
-/*--------------------------------------------------------------------------*/
-int
-hs_parse_form(char *data, int length)
-{
-    GError *error;
-
-    int st;
-    int ii, jj;
-    int n;
-    JsonParser *parser;
-    JsonNode *root;
-    JsonObject *object;
-    JsonArray *array;
-    JsonNode *node;
-
-    hs_command_delay = 0;
-    memset(hs_command_req, 0, sizeof(hs_command_req));
-
-    for (ii = 0; ii < ICO_HS_APP_NUM_MAX; ii++) {
-        hs_command_req[ii].program.execute.appid = NULL;
-        hs_command_req[ii].program.terminate.appid = NULL;
-        hs_command_req[ii].program.suspend.appid = NULL;
-        hs_command_req[ii].program.resume.appid = NULL;
-        for (jj = 0; jj < ICO_HS_WINDOW_NUM_MAX; jj++) {
-            hs_command_req[ii].window[jj].status = UNEXECUTED;
-            hs_command_req[ii].window[jj].show.window = IGNORE;
-            hs_command_req[ii].window[jj].hide.window = IGNORE;
-            hs_command_req[ii].window[jj].visible_raise.window = IGNORE;
-            hs_command_req[ii].window[jj].resize.window = IGNORE;
-            hs_command_req[ii].window[jj].resize_tile.window = IGNORE;
-            hs_command_req[ii].window[jj].move.window = IGNORE;
-            hs_command_req[ii].window[jj].move_tile.window = IGNORE;
-            hs_command_req[ii].window[jj].raise.window = IGNORE;
-            hs_command_req[ii].window[jj].lower.window = IGNORE;
-            hs_command_req[ii].window[jj].event_mask.window = IGNORE;
-        }
-        hs_command_req[ii].input.add_app.input = IGNORE;
-        hs_command_req[ii].input.del_app.input = IGNORE;
-    }
-
-    parser = json_parser_new();
-
-    error = NULL;
-    json_parser_load_from_data(parser, data, length, &error);
-    if (error) {
-        uifw_error("json_parser_load_from_data = %s", error->message);
-        g_error_free(error);
-        g_object_unref(parser);
-        return 1;
-    }
-
-    root = json_parser_get_root(parser);
-    if (!root) {
-        uifw_error("json_parser_get_root");
-        g_object_unref(parser);
-        return 1;
-    }
-
-    if (JSON_NODE_TYPE(root) != JSON_NODE_OBJECT) {
-        uifw_error("type error = %d", JSON_NODE_TYPE(root));
-        return 1;
-    }
-
-    object = json_node_get_object(root);
-    if (!object) {
-        uifw_error("json_node_get_object");
-        g_object_unref(parser);
-        return 1;
-    }
-
-    n = json_object_get_size(object);
-    if (n < 1) {
-        uifw_error("json_object_get_size = %d", n);
-        g_object_unref(parser);
-        return 1;
-    }
-    else if (n > 1) {
-        st = hs_parse_value_integer(object, "delay", &hs_command_delay);
-        if (st != 0) {
-            uifw_error("hs_parse_value_integer = %d", st);
-        }
-        uifw_debug("delay = %d", hs_command_delay);
-    }
-
-    node = json_object_get_member(object, "application");
-    if (!node) {
-        uifw_error("json_object_get_member(%s)", "application");
-        g_object_unref(parser);
-        return 1;
-    }
-
-    if (JSON_NODE_TYPE(node) != JSON_NODE_ARRAY) {
-        uifw_error("type error = %d", JSON_NODE_TYPE(node));
-        g_object_unref(parser);
-        return 1;
-    }
-
-    array = json_node_get_array(node);
-    if (!array) {
-        uifw_error("json_node_get_array");
-        g_object_unref(parser);
-        return 1;
-    }
-
-    n = json_array_get_length(array);
-    if (n < 0) {
-        uifw_error("json_array_get_length = %d", n);
-        g_object_unref(parser);
-        return 1;
-    }
-
-    for (ii = 0; ii < n; ii++) {
-        node = json_array_get_element(array, ii);
-        if (!node) {
-            uifw_error("json_array_get_element");
-            g_object_unref(parser);
-            return 1;
-        }
-
-        if (JSON_NODE_TYPE(node) != JSON_NODE_OBJECT) {
-            uifw_error("type error = %d", JSON_NODE_TYPE(node));
-            g_object_unref(parser);
-            return 1;
-        }
-
-        st = hs_parse_application(node, ii);
-        if (st != 0) {
-            uifw_error("hs_parse_application = %d", st);
-            g_object_unref(parser);
-            return 1;
-        }
-    }
-
-    g_object_unref(parser);
-
-    /* get now status of TOUCH */
-    if (hs_stat_touch == ICO_HS_TOUCH_IN_HIDE) {
-        hs_req_touch = ICO_HS_TOUCH_TOBE_HIDE;
-    }
-    else if (hs_stat_touch == ICO_HS_TOUCH_IN_SHOW) {
-        hs_req_touch = ICO_HS_TOUCH_TOBE_SHOW;
-    }
-    /* check if TOUCH is raise or not */
-    for (ii = 0; ii < ICO_HS_APP_NUM_MAX; ii++) {
-        /* is TOUCH? */
-        uifw_debug("hs_parse_form: Appid = %s",
-                   hs_command_req[ii].program.appid);
-        if (strlen(hs_command_req[ii].program.appid) == 0)
-            break;
-        if (strncmp(hs_command_req[ii].program.appid,
-                    ICO_HS_APPID_DEFAULT_TOUCH, ICO_UXF_MAX_PROCESS_NAME) != 0) {
-            continue;
-        }
-
-        if ((hs_command_req[ii].window[0].hide.window != IGNORE)
-                || ((hs_command_req[ii].window[0].visible_raise.window
-                        != IGNORE)
-                        && (hs_command_req[ii].window[0].visible_raise.visible
-                                == 0))) {
-            /* TOUCH is to be hide */
-            hs_req_touch = ICO_HS_TOUCH_TOBE_HIDE;
-        }
-        else if ((hs_command_req[ii].window[0].show.window != IGNORE)
-                || ((hs_command_req[ii].window[0].visible_raise.window
-                        != IGNORE)
-                        && (hs_command_req[ii].window[0].visible_raise.visible
-                                == 1))) {
-            /* TOUCH is to be show */
-            hs_req_touch = ICO_HS_TOUCH_TOBE_SHOW;
-        }
-    }
-
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_control_app_screen
- *          this function is called when received json command, and change
- *          applicatoin window that json command indicate.
- *
- * @param       none
- * @return      result
- * @retval      0                   Success
- * @retval      1                   Failed
- */
-/*--------------------------------------------------------------------------*/
-int
-hs_control_app_screen(void)
-{
-    int ii, jj, ret, winNo, idx;
-    Ico_Uxf_ProcessWin wins[2];
-    Ico_Uxf_ProcessAttr proc;
-    char appid[ICO_UXF_MAX_PROCESS_NAME + 1];
-
-    for (ii = 0; ii < ICO_HS_APP_NUM_MAX; ii++) {
-        if (strlen(hs_command_req[ii].program.appid) == 0)
-            break;
-        memset(appid, 0, sizeof(appid));
-        strncpy(appid, hs_command_req[ii].program.appid,
-                ICO_UXF_MAX_PROCESS_NAME);
-        winNo = 0;
-        if (strncmp(hs_command_req[ii].program.appid,
-                    ICO_HS_APPID_DEFAULT_TOUCH, ICO_UXF_MAX_PROCESS_NAME) == 0) {
-            memset(appid, 0, sizeof(appid));
-            strncpy(appid, hs_name_homescreen, ICO_UXF_MAX_PROCESS_NAME);
-            winNo = 1;
-        }
-        ret = ico_uxf_process_attribute_get(appid, &proc);
-        if (ret < 0)
-            continue;
-        if ((proc.status == ICO_UXF_PROCSTATUS_STOP) || (proc.status
-                == ICO_UXF_PROCSTATUS_TERM)) {
-            if (hs_command_req[ii].program.execute.appid != NULL) {
-                ret = ico_uxf_process_execute(
-                        hs_command_req[ii].program.execute.appid);
-                if (ret >= 0) {
-                    idx = hs_tile_get_minchange();
-                    hs_tile_set_app(idx,
-                                    hs_command_req[ii].program.execute.appid);
-                }
-                uifw_debug("HOMESCREEN excute %s = %d",
-                           hs_command_req[ii].program.execute.appid, 0);
-                if (hs_command_delay > 0)
-                    usleep(hs_command_delay);
-            }
-        }
-
-        /* regist app screen info */
-        idx = hs_get_index_appscreendata(hs_command_req[ii].program.appid);
-        if (idx >= 0) {
-            if (hs_command_req[ii].program.execute.appid != NULL) {
-                strcpy(hs_app_screen_window[idx].exe_name,
-                       hs_command_req[ii].program.execute.appid);
-            }
-            for (jj = 0; jj < ICO_HS_WINDOW_NUM_MAX; jj++) {
-                /* default invisible */
-                if (hs_command_req[ii].window[jj].visible_raise.window
-                        != IGNORE) {
-                    hs_app_screen_window[idx].visible
-                            = hs_command_req[ii].window[jj].visible_raise.visible; /* visible */
-                    hs_app_screen_window[idx].raise
-                            = hs_command_req[ii].window[jj].visible_raise.raise; /* raise */
-                }
-                if (hs_command_req[ii].window[jj].show.window != IGNORE) {
-                    hs_app_screen_window[idx].visible = 1;
-                }
-                if (hs_command_req[ii].window[jj].hide.window != IGNORE) {
-                    hs_app_screen_window[idx].visible = 0;
-                }
-                if (hs_command_req[ii].window[jj].raise.window != IGNORE) {
-                    hs_app_screen_window[idx].raise = 1;
-                }
-                if (hs_command_req[ii].window[jj].lower.window != IGNORE) {
-                    hs_app_screen_window[idx].raise = 0;
-                }
-                if (hs_command_req[ii].window[jj].resize.window != IGNORE) {
-                    hs_app_screen_window[idx].resize_w
-                            = hs_command_req[ii].window[jj].resize.w; /* resize_x */
-                    hs_app_screen_window[idx].resize_h
-                            = hs_command_req[ii].window[jj].resize.h; /* resize_y */
-                }
-                if (hs_command_req[ii].window[jj].move.window != IGNORE) {
-                    hs_app_screen_window[idx].move_x
-                            = hs_command_req[ii].window[jj].move.x; /* move_x */
-                    hs_app_screen_window[idx].move_y
-                            = hs_command_req[ii].window[jj].move.y; /* move_y */
-                }
-            }
-        }
-
-        ret = ico_uxf_process_window_get(appid, wins, 2);
-        if (ret >= 0) {
-            hs_conftrol_form(hs_command_req[ii].program.appid,
-                             wins[winNo].window);
-        }
-    }
-    if (hs_req_touch == ICO_HS_TOUCH_TOBE_SHOW) {
-        hs_stat_touch = ICO_HS_TOUCH_IN_SHOW;
-    }
-    else if (hs_req_touch == ICO_HS_TOUCH_TOBE_HIDE) {
-        hs_stat_touch = ICO_HS_TOUCH_IN_HIDE;
-    }
-
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_conftrol_form
- *          change the application window parameter.
- *
- * @param[in]   process             applicatoin id
- * @return      window              window
- * @retval      0                   Success
- * @retval      1                   Failed
- */
-/*--------------------------------------------------------------------------*/
-int
-hs_conftrol_form(const char *process, int window)
-{
-    int ii, jj, kk, idx;
-    int st = 0;
-
-    uifw_trace("in(%s,%d)", process, window);
-
-    Ico_Uxf_WindowAttr windows[ICO_HS_APP_NUM_MAX];
-    int num = ico_uxf_window_query_windows(ICO_UXF_DISPLAY_DEFAULT, windows,
-                                           ICO_HS_APP_NUM_MAX);
-    int count;
-    int target;
-
-    for (ii = 0; ii < ICO_HS_APP_NUM_MAX; ii++) {
-        if (strncmp(hs_command_req[ii].program.appid, process,
-                    ICO_UXF_MAX_PROCESS_NAME) != 0)
-            continue;
-
-        if (hs_command_req[ii].program.terminate.appid != NULL) {
-            st = ico_uxf_process_terminate(hs_command_req[ii].program.terminate.appid);
-            idx = hs_tile_get_index_app(hs_command_req[ii].program.terminate.appid);
-            if (idx >= 0) {
-                hs_tile_free_app(idx);
-            }
-            else {
-                hs_tile_delete_hide(hs_command_req[ii].program.terminate.appid);
-            }
-            uifw_debug("FORM terminate %s = %d",
-                       hs_command_req[ii].program.terminate.appid, st);
-            if (hs_command_delay > 0)
-                usleep(hs_command_delay);
-        }
-
-        if (window == 0)
-            continue;
-
-        for (jj = 0; jj < ICO_HS_WINDOW_NUM_MAX; jj++) {
-            if (hs_command_req[ii].window[jj].status == EXECUTED)
-                continue;
-
-            if (hs_command_req[ii].window[jj].hide.window != IGNORE) {
-                target = -1;
-                if (hs_command_req[ii].window[jj].hide.window == 0) {
-                    target = window;
-                }
-                else {
-                    count = 0;
-                    for (kk = 0; kk < num; kk++) {
-                        if (process != windows[kk].process)
-                            continue;
-                        if (count == hs_command_req[ii].window[jj].hide.window) {
-                            target = windows[kk].window;
-                            break;
-                        }
-                        count++;
-                    }
-                }
-                if (target >= 0) {
-                    st = ico_uxf_window_hide(target);
-                }
-                uifw_debug("FORM hide %d = %d", target, st);
-                if (hs_command_delay > 0)
-                    usleep(hs_command_delay);
-            }
-
-            if (hs_command_req[ii].window[jj].resize.window != IGNORE) {
-                target = -1;
-                if (hs_command_req[ii].window[jj].resize.window == 0) {
-                    target = window;
-                }
-                else {
-                    count = 0;
-                    for (kk = 0; kk < num; kk++) {
-                        if (process != windows[kk].process)
-                            continue;
-                        if (count == hs_command_req[ii].window[jj].resize.window) {
-                            target = windows[kk].window;
-                            break;
-                        }
-                        count++;
-                    }
-                }
-                if (target >= 0) {
-                    st = ico_uxf_window_resize(target,
-                                    hs_command_req[ii].window[jj].resize.w,
-                                    hs_command_req[ii].window[jj].resize.h);
-                }
-                uifw_debug("FORM resize %d %d %d = %d", target,
-                           hs_command_req[ii].window[jj].resize.w,
-                           hs_command_req[ii].window[jj].resize.h, st);
-                if (hs_command_delay > 0)
-                    usleep(hs_command_delay);
-            }
-
-            if (hs_command_req[ii].window[jj].move.window != IGNORE) {
-                target = -1;
-                if (hs_command_req[ii].window[jj].move.window == 0) {
-                    target = window;
-                }
-                else {
-                    count = 0;
-                    for (kk = 0; kk < num; kk++) {
-                        if (process != windows[kk].process)
-                            continue;
-                        if (count == hs_command_req[ii].window[jj].move.window) {
-                            target = windows[kk].window;
-                            break;
-                        }
-                        count++;
-                    }
-                }
-                if (target >= 0) {
-                    st = ico_uxf_window_move(target,
-                                       hs_command_req[ii].window[jj].move.x,
-                                       hs_command_req[ii].window[jj].move.y, 0);
-                }
-                uifw_debug("FORM move %d %d %d = %d", target,
-                           hs_command_req[ii].window[jj].move.x,
-                           hs_command_req[ii].window[jj].move.y, st);
-                if (hs_command_delay > 0)
-                    usleep(hs_command_delay);
-            }
-
-            if (hs_command_req[ii].window[jj].visible_raise.window != IGNORE) {
-                target = -1;
-                if (hs_command_req[ii].window[jj].visible_raise.window == 0) {
-                    target = window;
-                }
-                else {
-                    count = 0;
-                    for (kk = 0; kk < num; kk++) {
-                        if (process != windows[kk].process)
-                            continue;
-                        if (count == hs_command_req[ii].window[jj].visible_raise.window) {
-                            target = windows[kk].window;
-                            break;
-                        }
-                        count++;
-                    }
-                }
-                if (target >= 0) {
-                    st = ico_uxf_window_visible_raise(target,
-                                  hs_command_req[ii].window[jj].visible_raise.visible,
-                                  hs_command_req[ii].window[jj].visible_raise.raise);
-                }
-                uifw_debug("FORM visible_raise %d %d %d = %d", target,
-                           hs_command_req[ii].window[jj].visible_raise.visible,
-                           hs_command_req[ii].window[jj].visible_raise.raise,
-                           st);
-                if (hs_command_delay > 0)
-                    usleep(hs_command_delay);
-            }
-
-            if (hs_command_req[ii].window[jj].raise.window != IGNORE) {
-                target = -1;
-                if (hs_command_req[ii].window[jj].raise.window == 0) {
-                    target = window;
-                }
-                else {
-                    count = 0;
-                    for (kk = 0; kk < num; kk++) {
-                        if (process != windows[kk].process)
-                            continue;
-                        if (count == hs_command_req[ii].window[jj].raise.window) {
-                            target = windows[kk].window;
-                            break;
-                        }
-                        count++;
-                    }
-                }
-                if (target >= 0) {
-                    st = ico_uxf_window_raise(target);
-                }
-                uifw_debug("FORM raise %d = %d", target, st);
-                if (hs_command_delay > 0)
-                    usleep(hs_command_delay);
-            }
-
-            if (hs_command_req[ii].window[jj].lower.window != IGNORE) {
-                target = -1;
-                if (hs_command_req[ii].window[jj].lower.window == 0) {
-                    target = window;
-                }
-                else {
-                    count = 0;
-                    for (kk = 0; kk < num; kk++) {
-                        if (process != windows[kk].process)
-                            continue;
-                        if (count == hs_command_req[ii].window[jj].lower.window) {
-                            target = windows[kk].window;
-                            break;
-                        }
-                        count++;
-                    }
-                }
-                if (target >= 0) {
-                    st = ico_uxf_window_lower(target);
-                }
-                uifw_debug("FORM lower %d = %d", target, st);
-                if (hs_command_delay > 0)
-                    usleep(hs_command_delay);
-            }
-
-            if (hs_command_req[ii].window[jj].event_mask.window != IGNORE) {
-                target = -1;
-                if (hs_command_req[ii].window[jj].event_mask.window == 0) {
-                    target = window;
-                }
-                else {
-                    count = 0;
-                    for (kk = 0; kk < num; kk++) {
-                        if (process != windows[kk].process)
-                            continue;
-                        if (count == hs_command_req[ii].window[jj].event_mask.window) {
-                            target = windows[kk].window;
-                            break;
-                        }
-                        count++;
-                    }
-                }
-                if (target >= 0) {
-                    st = ico_uxf_window_event_mask(target,
-                                    hs_command_req[ii].window[jj].event_mask.mask);
-                }
-                uifw_debug("FORM event_mask %d %08x = %d", target,
-                           hs_command_req[ii].window[jj].event_mask.mask, st);
-                if (hs_command_delay > 0)
-                    usleep(hs_command_delay);
-            }
-
-            /* last show */
-            if (hs_command_req[ii].window[jj].show.window != IGNORE) {
-                target = -1;
-                if (hs_command_req[ii].window[jj].show.window == 0) {
-                    target = window;
-                }
-                else {
-                    count = 0;
-                    for (kk = 0; kk < num; kk++) {
-                        if (process != windows[kk].process)
-                            continue;
-                        if (count == hs_command_req[ii].window[jj].show.window) {
-                            target = windows[kk].window;
-                            break;
-                        }
-                        count++;
-                    }
-                }
-                if (target >= 0) {
-                    st = ico_uxf_window_show(target);
-                }
-                uifw_debug("FORM show %d = %d", target, st);
-                if (hs_command_delay > 0)
-                    usleep(hs_command_delay);
-            }
-
-            hs_command_req[ii].window[jj].status = EXECUTED;
-        }
-    }
-
-    uifw_debug("out(%d)", st);
-    return st;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_dump_app
- *          dump application window status.
- *
- * @param[in]   none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-void
-hs_dump_app(void)
-{
-    int ii, jj;
-    for (ii = 0; ii < ICO_HS_APP_NUM_MAX; ii++) {
-        if (hs_command_req[ii].program.appid[0] == 0)
-            continue;
-        uifw_debug("id: %s", hs_command_req[ii].program.appid);
-        if (hs_command_req[ii].program.execute.appid != NULL) {
-            uifw_debug(" execute: %s", hs_command_req[ii].program.execute.appid);
-        }
-        if (hs_command_req[ii].program.terminate.appid != NULL) {
-            uifw_debug(" terminate: %s",
-                       hs_command_req[ii].program.terminate.appid);
-        }
-        if (hs_command_req[ii].program.suspend.appid != NULL) {
-            uifw_debug(" suspend: %s", hs_command_req[ii].program.suspend.appid);
-        }
-        if (hs_command_req[ii].program.resume.appid != NULL) {
-            uifw_debug(" resume: %d", hs_command_req[ii].program.resume.appid);
-        }
-        for (jj = 0; jj < ICO_HS_WINDOW_NUM_MAX; jj++) {
-            if (hs_command_req[ii].window[jj].show.window != IGNORE) {
-                uifw_debug(" show: %d",
-                           hs_command_req[ii].window[jj].show.window);
-            }
-            if (hs_command_req[ii].window[jj].hide.window != IGNORE) {
-                uifw_debug(" hide: %d",
-                           hs_command_req[ii].window[jj].hide.window);
-            }
-            if (hs_command_req[ii].window[jj].visible_raise.window != IGNORE) {
-                uifw_debug(" visible_raise: %d %d %d",
-                           hs_command_req[ii].window[jj].visible_raise.window,
-                           hs_command_req[ii].window[jj].visible_raise.visible,
-                           hs_command_req[ii].window[jj].visible_raise.raise);
-            }
-            if (hs_command_req[ii].window[jj].resize.window != IGNORE) {
-                uifw_debug(" resize: %d %d %d",
-                           hs_command_req[ii].window[jj].resize.window,
-                           hs_command_req[ii].window[jj].resize.w,
-                           hs_command_req[ii].window[jj].resize.h);
-            }
-            if (hs_command_req[ii].window[jj].resize_tile.window != IGNORE) {
-                uifw_debug(" resize_tile: %d %d %d",
-                           hs_command_req[ii].window[jj].resize_tile.window,
-                           hs_command_req[ii].window[jj].resize_tile.size_m,
-                           hs_command_req[ii].window[jj].resize_tile.size_n);
-            }
-            if (hs_command_req[ii].window[jj].move.window != IGNORE) {
-                uifw_debug(" move: %d %d %d",
-                           hs_command_req[ii].window[jj].move.window,
-                           hs_command_req[ii].window[jj].move.x,
-                           hs_command_req[ii].window[jj].move.y);
-            }
-            if (hs_command_req[ii].window[jj].move_tile.window != IGNORE) {
-                uifw_debug(" move_tile: %d %d %d",
-                           hs_command_req[ii].window[jj].move_tile.window,
-                           hs_command_req[ii].window[jj].move_tile.m,
-                           hs_command_req[ii].window[jj].move_tile.n);
-            }
-            if (hs_command_req[ii].window[jj].raise.window != IGNORE) {
-                uifw_debug(" raise: %d",
-                           hs_command_req[ii].window[jj].raise.window);
-            }
-            if (hs_command_req[ii].window[jj].lower.window != IGNORE) {
-                uifw_debug(" lower: %d",
-                           hs_command_req[ii].window[jj].lower.window);
-            }
-            if (hs_command_req[ii].window[jj].event_mask.window != IGNORE) {
-                uifw_debug(" event_mask: %d %08x",
-                           hs_command_req[ii].window[jj].event_mask.window,
-                           hs_command_req[ii].window[jj].event_mask.mask);
-            }
-        }
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_get_tilescreendata
- *          check json command for tile screen 
- *
- * @param       none
- * @return      result
- * @retval      0                   Success
- * @retval      1                   Failed
- */
-/*--------------------------------------------------------------------------*/
-void
-hs_get_tilescreendata(void)
-{
-    int ii, jj, idx = -1;
-    memset(hs_command_tile_req, 0x00, sizeof(hs_command_tile_req)); /* init */
-    for (ii = 0; ii < ICO_HS_APP_NUM_MAX; ii++) {
-        if (strlen(hs_command_req[ii].program.appid) == 0)
-            continue;
-        strncpy(hs_command_tile_req[ii].appid,
-                hs_command_req[ii].program.appid, ICO_UXF_MAX_PROCESS_NAME);
-        if (hs_command_req[ii].program.execute.appid != NULL) {
-            strncpy(hs_command_tile_req[ii].exe_name,
-                    hs_command_req[ii].program.execute.appid,
-                    ICO_UXF_MAX_PROCESS_NAME); /* execute name */
-        }
-        hs_command_tile_req[ii].terminate = IGNORE;
-        if (hs_command_req[ii].program.terminate.appid != NULL) {
-            hs_command_tile_req[ii].terminate = EXECUTE; /* terminate id */
-        }
-        for (jj = 0; jj < ICO_HS_WINDOW_NUM_MAX; jj++) {
-            if (hs_command_req[ii].window[jj].visible_raise.window != IGNORE) {
-                hs_command_tile_req[ii].visible
-                        = hs_command_req[ii].window[jj].visible_raise.visible; /* visible */
-                hs_command_tile_req[ii].raise
-                        = hs_command_req[ii].window[jj].visible_raise.raise; /* raise */
-            }
-            if (hs_command_req[ii].window[jj].resize.window != IGNORE) {
-                hs_command_tile_req[ii].resize_w
-                        = hs_command_req[ii].window[jj].resize.w; /* resize_x */
-                hs_command_tile_req[ii].resize_h
-                        = hs_command_req[ii].window[jj].resize.h; /* resize_y */
-            }
-            if (hs_command_req[ii].window[jj].move.window != IGNORE) {
-                hs_command_tile_req[ii].move_x
-                        = hs_command_req[ii].window[jj].move.x; /* move_x */
-                hs_command_tile_req[ii].move_y
-                        = hs_command_req[ii].window[jj].move.y; /* move_y */
-            }
-        }
-
-        /* set app to tile */
-        idx = hs_tile_get_index_app(hs_command_tile_req[ii].appid);
-        if (idx >= 0) {
-            hs_tile_free_app(idx);
-        }
-        if (hs_command_tile_req[ii].terminate == IGNORE) {
-            idx = hs_tile_get_index_pos(hs_command_tile_req[ii].move_x,
-                                        hs_command_tile_req[ii].move_y,
-                                        hs_command_tile_req[ii].resize_w,
-                                        hs_command_tile_req[ii].resize_h);
-            uifw_debug("hs_get_tilescreendata: hs_tile_get_index_pos=%d(%d, %d, %d, %d)",
-                       idx, hs_command_tile_req[ii].move_x,
-                       hs_command_tile_req[ii].move_y,
-                       hs_command_tile_req[ii].resize_w,
-                       hs_command_tile_req[ii].resize_h);
-            if (idx >= 0) {
-                hs_tile_set_app(idx, hs_command_tile_req[ii].appid);
-            }
-        }
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_parse_value_string
- *          read the string value that indicated by the key name
- *
- * @param[in]   object              json data
- * @param[in]   name                key name
- * @param[out]  value               the value stored
- * @return      result
- * @retval      0                   Success
- * @retval      1                   Failed
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_parse_value_string(JsonObject *object, char *name, char *value)
-{
-    JsonNode *node;
-
-    node = json_object_get_member(object, name);
-    if (!node) {
-        return 1;
-    }
-
-    if (JSON_NODE_TYPE(node) != JSON_NODE_VALUE) {
-        uifw_error("type error = %d", JSON_NODE_TYPE(node));
-        return 1;
-    }
-
-    GValue data = G_VALUE_INIT;
-    json_node_get_value(node, &data);
-
-    strcpy(value, g_value_get_string(&data));
-
-    uifw_trace("out");
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_parse_value_integer
- *          read the interger value that indicated by the key name
- *
- * @param[in]   object              json data
- * @param[in]   name                key name
- * @param[out]  value               the value stored
- * @return      result
- * @retval      0                   Success
- * @retval      1                   Failed
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_parse_value_integer(JsonObject *object, char *name, int *value)
-{
-    JsonNode *node;
-    node = json_object_get_member(object, name);
-    if (!node) {
-        return 1;
-    }
-
-    if (JSON_NODE_TYPE(node) != JSON_NODE_VALUE) {
-        uifw_error("type error = %d", JSON_NODE_TYPE(node));
-        return 1;
-    }
-
-    GValue data = G_VALUE_INIT;
-    json_node_get_value(node, &data);
-
-    char temp[ICO_HS_TEMP_BUF_SIZE];
-
-    strcpy(temp, g_value_get_string(&data));
-
-    char *p;
-    p = strtok(temp, ",");
-    if (!p) {
-        uifw_error("strtok error = %s", temp);
-        return 1;
-    }
-
-    if (strncmp(p, "0x", 2) == 0) {
-        *value = strtol(p, NULL, 16);
-    }
-    else {
-        *value = strtol(p, NULL, 10);
-    }
-
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_hs_parse_value_integer2
- *          read the two interger value that indicated by the key name
- *
- * @param[in]   object              json data
- * @param[in]   name                key name
- * @param[out]  value1              the 1st value stored
- * @param[out]  value2              the 2nd value stored
- * @return      result
- * @retval      0                   Success
- * @retval      1                   Failed
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_hs_parse_value_integer2(JsonObject *object, char *name, int *value1,
-                           int *value2)
-{
-    JsonNode *node;
-    node = json_object_get_member(object, name);
-    if (!node) {
-        return 1;
-    }
-
-    if (JSON_NODE_TYPE(node) != JSON_NODE_VALUE) {
-        uifw_error("type error = %d", JSON_NODE_TYPE(node));
-        return 1;
-    }
-
-    GValue data = G_VALUE_INIT;
-    json_node_get_value(node, &data);
-
-    char temp[ICO_HS_TEMP_BUF_SIZE];
-
-    strcpy(temp, g_value_get_string(&data));
-
-    char *p;
-    p = strtok(temp, ",");
-    if (!p) {
-        uifw_error("strtok error = %s", temp);
-        return 1;
-    }
-
-    if (strncmp(p, "0x", 2) == 0) {
-        *value1 = strtol(p, NULL, 16);
-    }
-    else {
-        *value1 = strtol(p, NULL, 10);
-    }
-
-    p = strtok(NULL, ",");
-    if (!p) {
-        uifw_error("strtok error = %s", temp);
-        return 1;
-    }
-
-    if (strncmp(p, "0x", 2) == 0) {
-        *value2 = strtol(p, NULL, 16);
-    }
-    else {
-        *value2 = strtol(p, NULL, 10);
-    }
-
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_hs_parse_value_integer3
- *          read the three interger value that indicated by the key name
- *
- * @param[in]   object              json data
- * @param[in]   name                key name
- * @param[out]  value1              the 1st value stored
- * @param[out]  value2              the 2nd value stored
- * @param[out]  value3              the 3rd value stored
- * @return      result
- * @retval      0                   Success
- * @retval      1                   Failed
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_hs_parse_value_integer3(JsonObject *object, char *name, int *value1,
-                           int *value2, int *value3)
-{
-    JsonNode *node;
-    node = json_object_get_member(object, name);
-    if (!node) {
-        return 1;
-    }
-
-    if (JSON_NODE_TYPE(node) != JSON_NODE_VALUE) {
-        uifw_error("type error = %d", JSON_NODE_TYPE(node));
-        return 1;
-    }
-
-    GValue data = G_VALUE_INIT;
-    json_node_get_value(node, &data);
-
-    char temp[ICO_HS_TEMP_BUF_SIZE];
-
-    strcpy(temp, g_value_get_string(&data));
-
-    char *p;
-    p = strtok(temp, ",");
-    if (!p) {
-        uifw_error("strtok error = %s", temp);
-        return 1;
-    }
-
-    if (strncmp(p, "0x", 2) == 0) {
-        *value1 = strtol(p, NULL, 16);
-    }
-    else {
-        *value1 = strtol(p, NULL, 10);
-    }
-
-    p = strtok(NULL, ",");
-    if (!p) {
-        uifw_error("strtok error = %s", temp);
-        return 1;
-    }
-
-    if (strncmp(p, "0x", 2) == 0) {
-        *value2 = strtol(p, NULL, 16);
-    }
-    else {
-        *value2 = strtol(p, NULL, 10);
-    }
-
-    p = strtok(NULL, ",");
-    if (!p) {
-        uifw_error("strtok error = %s", temp);
-        return 1;
-    }
-
-    if (strncmp(p, "0x", 2) == 0) {
-        *value3 = strtol(p, NULL, 16);
-    }
-    else {
-        *value3 = strtol(p, NULL, 10);
-    }
-
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_parse_program
- *          parse "program" section
- *
- * @param[in]   node                json node
- * @param[in]   id                  sequence number of the node
- * @return      result
- * @retval      0                   Success
- * @retval      1                   Failed
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_parse_program(JsonNode *node, int id)
-{
-    int st;
-    JsonObject *object;
-    char tmp[ICO_UXF_MAX_PROCESS_NAME + 1];
-
-    object = json_node_get_object(node);
-    if (!object) {
-        uifw_error("json_node_get_object");
-        return 1;
-    }
-
-    st = hs_parse_value_string(object, "id", hs_command_req[id].program.appid);
-    if (st != 0) {
-        uifw_error("hs_parse_value_string = %d", st);
-        memset(hs_command_req[id].program.appid, 0, ICO_UXF_MAX_PROCESS_NAME
-                + 1);
-        return 1;
-    }
-
-    st = hs_parse_value_string(object, "execute", tmp);
-    if (st != 0) {
-        uifw_error("hs_parse_value_string = %d", st);
-    }
-    else {
-        hs_command_req[id].program.execute.appid
-                = hs_command_req[id].program.appid;
-    }
-
-    st = hs_parse_value_string(object, "terminate", tmp);
-    if (st != 0) {
-        uifw_error("hs_parse_value_string = %d", st);
-    }
-    else {
-        hs_command_req[id].program.terminate.appid
-                = hs_command_req[id].program.appid;
-    }
-
-    st = hs_parse_value_string(object, "suspend", tmp);
-    if (st != 0) {
-        uifw_error("hs_parse_value_string = %d", st);
-    }
-    else {
-        hs_command_req[id].program.suspend.appid
-                = hs_command_req[id].program.appid;
-    }
-
-    st = hs_parse_value_string(object, "resume", tmp);
-    if (st != 0) {
-        uifw_error("hs_parse_value_string = %d", st);
-    }
-    else {
-        hs_command_req[id].program.resume.appid
-                = hs_command_req[id].program.appid;
-    }
-
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_parse_input
- *          parse "input" section
- *
- * @param[in]   node                json node
- * @param[in]   id                  sequence number of the node
- * @return      result
- * @retval      0                   Success
- * @retval      1                   Failed
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_parse_input(JsonNode *node, int id)
-{
-    int st;
-    JsonObject *object;
-    int tmp;
-
-    object = json_node_get_object(node);
-    if (!object) {
-        uifw_error("json_node_get_object");
-        return 1;
-    }
-
-    st = hs_parse_value_integer(object, "add_app", &tmp);
-    if (st != 0) {
-        hs_command_req[id].input.add_app.input = IGNORE;
-    }
-    else {
-        hs_command_req[id].input.add_app.input = tmp;
-    }
-
-    st = hs_parse_value_integer(object, "del_app", &tmp);
-    if (st != 0) {
-        hs_command_req[id].input.del_app.input = IGNORE;
-    }
-    else {
-        hs_command_req[id].input.del_app.input = tmp;
-    }
-
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_parse_window
- *          parse "window" section
- *
- * @param[in]   node                json node
- * @param[in]   id1                 sequence number of the node
- * @param[in]   id2                 sequence number of the window in the node
- * @return      result
- * @retval      0                   Success
- * @retval      1                   Failed
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_parse_window(JsonNode *node, int id1, int id2)
-{
-    int st;
-    JsonObject *object;
-
-    object = json_node_get_object(node);
-    if (!object) {
-        uifw_error("json_node_get_object");
-        return 1;
-    }
-
-    st = hs_parse_value_integer(object, "show",
-                                &hs_command_req[id1].window[id2].show.window);
-    if (st != 0) {
-        hs_command_req[id1].window[id2].show.window = IGNORE;
-    }
-
-    st = hs_parse_value_integer(object, "hide",
-                                &hs_command_req[id1].window[id2].hide.window);
-    if (st != 0) {
-        hs_command_req[id1].window[id2].hide.window = IGNORE;
-    }
-
-    st = hs_hs_parse_value_integer3(object,
-                                    "visible_raise",
-                                    &hs_command_req[id1].window[id2].visible_raise.window,
-                                    &hs_command_req[id1].window[id2].visible_raise.visible,
-                                    &hs_command_req[id1].window[id2].visible_raise.raise);
-    if (st != 0) {
-        hs_command_req[id1].window[id2].visible_raise.window = IGNORE;
-    }
-
-    st = hs_hs_parse_value_integer3(object,
-                                    "resize",
-                                    &hs_command_req[id1].window[id2].resize.window,
-                                    &hs_command_req[id1].window[id2].resize.w,
-                                    &hs_command_req[id1].window[id2].resize.h);
-    if (st != 0) {
-        hs_command_req[id1].window[id2].resize.window = IGNORE;
-    }
-
-    st = hs_hs_parse_value_integer3(object,
-                                    "resize_tile",
-                                    &hs_command_req[id1].window[id2].resize_tile.window,
-                                    &hs_command_req[id1].window[id2].resize_tile.size_m,
-                                    &hs_command_req[id1].window[id2].resize_tile.size_n);
-    if (st != 0) {
-        hs_command_req[id1].window[id2].resize_tile.window = IGNORE;
-    }
-
-    st = hs_hs_parse_value_integer3(object,
-                                    "move",
-                                    &hs_command_req[id1].window[id2].move.window,
-                                    &hs_command_req[id1].window[id2].move.x,
-                                    &hs_command_req[id1].window[id2].move.y);
-    if (st != 0) {
-        hs_command_req[id1].window[id2].move.window = IGNORE;
-    }
-
-    st = hs_hs_parse_value_integer3(object,
-                                    "move_tile",
-                                    &hs_command_req[id1].window[id2].move_tile.window,
-                                    &hs_command_req[id1].window[id2].move_tile.m,
-                                    &hs_command_req[id1].window[id2].move_tile.n);
-    if (st != 0) {
-        hs_command_req[id1].window[id2].move_tile.window = IGNORE;
-    }
-
-    st = hs_parse_value_integer(object, "raise",
-                                &hs_command_req[id1].window[id2].raise.window);
-    if (st != 0) {
-        hs_command_req[id1].window[id2].raise.window = IGNORE;
-    }
-
-    st = hs_parse_value_integer(object, "lower",
-                                &hs_command_req[id1].window[id2].lower.window);
-    if (st != 0) {
-        hs_command_req[id1].window[id2].lower.window = IGNORE;
-    }
-
-    st = hs_hs_parse_value_integer2(object,
-                                    "event_mask",
-                                    &hs_command_req[id1].window[id2].event_mask.window,
-                                    (int *)&hs_command_req[id1].window[id2].event_mask.mask);
-    if (st != 0) {
-        hs_command_req[id1].window[id2].event_mask.window = IGNORE;
-    }
-
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_parse_application
- *          parse "application" section
- *
- * @param[in]   node                json node
- * @param[in]   id                  sequence number of the node
- * @return      result
- * @retval      0                   Success
- * @retval      1                   Failed
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_parse_application(JsonNode *node, int id)
-{
-    int st;
-    int ii;
-    int n;
-    JsonObject *object;
-    JsonNode *program_node;
-    JsonNode *window_node;
-    JsonArray *window_array;
-    JsonNode *input_node;
-
-    object = json_node_get_object(node);
-    if (!object) {
-        uifw_error("json_node_get_object");
-        return 1;
-    }
-
-    program_node = json_object_get_member(object, "program");
-    if (!node) {
-        uifw_error("json_object_get_member(%s)", "program");
-        return 1;
-    }
-
-    if (JSON_NODE_TYPE(program_node) != JSON_NODE_OBJECT) {
-        uifw_error("type error = %d", JSON_NODE_TYPE(program_node));
-        return 1;
-    }
-
-    st = hs_parse_program(program_node, id);
-    if (st != 0) {
-        uifw_error("hs_parse_program = %d", st);
-        return 1;
-    }
-
-    window_node = json_object_get_member(object, "window");
-    if (!node) {
-        uifw_error("json_object_get_member(%s)", "window");
-        return 1;
-    }
-
-    if (JSON_NODE_TYPE(window_node) != JSON_NODE_ARRAY) {
-        uifw_error("type error = %d", JSON_NODE_TYPE(window_node));
-        return 1;
-    }
-
-    window_array = json_node_get_array(window_node);
-    if (!window_array) {
-        uifw_error("json_node_get_array");
-        return 1;
-    }
-
-    n = json_array_get_length(window_array);
-    if (n < 0) {
-        uifw_error("json_array_get_length = %d", n);
-        return 1;
-    }
-
-    for (ii = 0; ii < n; ii++) {
-        window_node = json_array_get_element(window_array, ii);
-        if (!window_node) {
-            uifw_error("json_array_get_element");
-            return 1;
-        }
-
-        if (JSON_NODE_TYPE(window_node) != JSON_NODE_OBJECT) {
-            uifw_warn("type error = %d", JSON_NODE_TYPE(window_node));
-            return 1;
-        }
-
-        st = hs_parse_window(window_node, id, ii);
-        if (st != 0) {
-            uifw_warn("hs_parse_window = %d", st);
-            return 1;
-        }
-    }
-
-    input_node = json_object_get_member(object, "input");
-    if (!input_node) {
-        uifw_error("json_object_get_member(%s)", "input");
-        return 0;
-    }
-
-    if (JSON_NODE_TYPE(input_node) != JSON_NODE_OBJECT) {
-        uifw_debug("type not exist = %d", JSON_NODE_TYPE(input_node));
-        return 0;
-    }
-
-    st = hs_parse_input(input_node, id);
-    if (st != 0) {
-        uifw_error("hs_parse_input = %d", st);
-        return 0;
-    }
-
-    return 0;
-}
-
diff --git a/src/home_screen_sound.c b/src/home_screen_sound.c
deleted file mode 100644 (file)
index 041bd37..0000000
+++ /dev/null
@@ -1,206 +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   sound an operation of homescreen
- *
- * @date    Apr-04-2013
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdbool.h>
-
-#include "ico_uxf.h"
-#include "ico_uxf_conf_def.h"
-#include "home_screen.h"
-#include "home_screen_res.h"
-#include "home_screen_conf.h"
-
-/*============================================================================*/
-/* definition                                                                 */
-/*============================================================================*/
-typedef struct _hs_snd_conf hs_snd_conf_t;
-struct _hs_snd_conf {
-    hs_snd_conf_t *next;
-    int type;                               /* operation type                 */
-    char *file;                             /* sound file name                */
-};
-
-/*============================================================================*/
-/* static(internal) functions prototype                                       */
-/*============================================================================*/
-static hs_snd_conf_t *hs_snd_read_configuration(int type, char *conf_name);
-
-/*============================================================================*/
-/* variabe                                                                    */
-/*============================================================================*/
-static int hs_snd_is_initialize = false;
-static hs_snd_conf_t *hs_sound_files = NULL;
-
-/*============================================================================*/
-/* functions                                                                  */
-/*============================================================================*/
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_snd_play
- *          play the given sound file(.wav).
- *
- * @param[in]   wav_file            wav formated file.
- * @return      result
- * @retval      ICO_HS_OK           success
- * @retval      ICO_HS_ERR          err
- */
-/*--------------------------------------------------------------------------*/
-int
-hs_snd_play(char *wav_file)
-{
-    int pid;
-    int ret;
-    char command[ICO_HS_TEMP_BUF_SIZE];
-    char path[ICO_HS_TEMP_BUF_SIZE];
-
-    if (hs_snd_is_initialize != true) {
-        ret = hs_snd_init();
-        if (ret != ICO_HS_OK) {
-            return ICO_HS_ERR;
-        }
-    }
-
-    if (!wav_file) {
-        uifw_warn("hs_snd_play: Leave(error file name is NULL");
-        return ICO_HS_ERR;
-    }
-
-    if (wav_file[0] == '/') {
-        /* given by full file path */
-        snprintf(command, sizeof(command), 
-                "paplay --stream-name=HOMESCREEN_BEEP %s", wav_file);
-    }
-    else {
-        hs_get_sound_path(path, sizeof(path));
-        snprintf(command, sizeof(command), 
-                "paplay --stream-name=HOMESCREEN_BEEP %s/%s", path, wav_file);
-    }
-
-    uifw_trace("hs_snd_play: system(%s)", command);
-    pid = fork();
-    if (!pid) {
-        system(command);
-        exit(0);
-    }
-
-    return ICO_HS_OK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_snd_init
- *          initialize to sound a operation
- *
- * @param       none
- * @return      result
- * @retval      ICO_HS_OK           success
- * @retval      ICO_HS_ERR          err
- */
-/*--------------------------------------------------------------------------*/
-int
-hs_snd_init(void)
-{
-    if (hs_snd_is_initialize != true) {
-        /* read sound file name from configuration */
-        hs_snd_read_configuration(ICO_HS_SND_TYPE_DEFAULT,
-                                  ICO_HS_SND_CNAME_DEFAULT);
-        hs_snd_is_initialize = true;
-    }
-
-    return ICO_HS_OK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_snd_get_filename
- *          get the file name by given operation type
- *
- * @param[in]   type                operation type
- * @return      pointer to the file name 
- * @retval      >=0                 success
- * @retval      NULL                err
- */
-/*--------------------------------------------------------------------------*/
-char *
-hs_snd_get_filename(int type)
-{
-    hs_snd_conf_t *conf;
-
-    if (hs_snd_is_initialize != true) {
-        hs_snd_init();
-    }
-
-    conf = hs_sound_files;
-    while (conf) {
-        if (conf->type == type) {
-            return conf->file;
-        }
-        conf = conf->next;
-    }
-
-    return NULL;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   hs_snd_read_configuration
- *          read configuration and set
- *
- * @param[in]   type                operation type
- * @param[in]   conf_name           configuration name
- * @return      result 
- * @retval      >=0                 success
- * @retval      NULL                err
- */
-/*--------------------------------------------------------------------------*/
-static hs_snd_conf_t *
-hs_snd_read_configuration(int type, char *conf_name)
-{
-    char *file;
-    hs_snd_conf_t *conf;
-
-    conf = calloc(sizeof(hs_snd_conf_t), 1);
-    if (!conf) {
-        uifw_warn("hs_snd_read_configuration: Leave(fail to alloc memory");
-        return NULL;
-    }
-
-    if (strcmp(conf_name, ICO_HS_SND_CNAME_DEFAULT) == 0) {
-        file = (char *)hs_conf_get_string(ICO_HS_CONFIG_SOUND,
-                                          conf_name,
-                                          ICO_HS_SND_FNAME_DEFAULT);
-    }
-    else {
-        file = (char *)hs_conf_get_string(ICO_HS_CONFIG_HOMESCREEN,
-                                          conf_name,
-                                          NULL);
-    }
-
-    if (!file) {
-        uifw_trace("hs_snd_read_configuration: Leave(given config is not exist");
-        free(conf);
-        return NULL;
-    }
-
-    conf->file = file;
-    conf->type = type;
-
-    conf->next = hs_sound_files;
-    hs_sound_files = conf;
-
-    return conf;
-}
diff --git a/src/homescreen/CicoHSAppInfo.cpp b/src/homescreen/CicoHSAppInfo.cpp
new file mode 100644 (file)
index 0000000..d07c145
--- /dev/null
@@ -0,0 +1,389 @@
+/*
+ * 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 info
+ *
+ * @date    Aug-08-2013
+ */
+#include "CicoHSAppInfo.h"
+
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSAppInfo::CicoHSAppInfo
+ *          Constractor
+ *
+ * @param[in]   appid    application id
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSAppInfo::CicoHSAppInfo(const char *appid)
+{
+    for(int ii = 0;ii < ICO_HS_APP_MAX_WINDOW_NUM;ii++){
+        window_info_i[ii].valid = false;
+    }
+
+    window_num = 0;
+    last_surface = 0;
+    if(appid == NULL){
+        return;
+    } 
+    strncpy(this->appid,appid,ICO_HS_MAX_PROCESS_NAME);
+
+    life_cycle_controller = CicoSCLifeCycleController::getInstance();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSAppInfo::~CicoHSAppInfo
+ *          Destractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSAppInfo::~CicoHSAppInfo(void)
+{
+
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSAppInfo::GetAppId
+ *          get application id
+ *
+ * @param[in]   none
+ * @return      application id
+ */
+/*--------------------------------------------------------------------------*/
+char*
+CicoHSAppInfo::GetAppId(void)
+{
+    return appid;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSAppInfo::SetWindowInfo
+ *          set window information
+ *
+ * @param[in]   idx              index
+ * @param[in]   window info      window information
+ * @return      void
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoHSAppInfo::SetWindowInfo(ico_hs_window_info *hs_window_info,ico_syc_win_info_t *window_info)
+{
+    hs_window_info->showed = false;
+    if(window_info->appid != NULL){
+        strncpy(hs_window_info->appid,window_info->appid,
+                ICO_HS_MAX_PROCESS_NAME);
+    }
+    if(window_info->name != NULL){
+        strncpy(hs_window_info->name,window_info->name,
+                ICO_HS_MAX_WINDOW_NAME);
+    }
+    hs_window_info->surface = window_info->surface;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSAppInfo::GetFreeWindowInfoBuffer
+ *          get internal window info buffer
+ *
+ * @param[in]   none
+ * @return      buffer
+ */
+/*--------------------------------------------------------------------------*/
+ico_hs_window_info *
+CicoHSAppInfo::GetFreeWindowInfoBuffer(void)
+{
+    ico_hs_window_info *tmp_win_info;
+    for(int ii = 0;ii < ICO_HS_APP_MAX_WINDOW_NUM;ii++){
+        if(window_info_i[ii].valid == false){
+           tmp_win_info = &window_info_i[ii];
+           tmp_win_info->valid = true;
+           return tmp_win_info;
+        }
+    }
+    return NULL;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSAppInfo::FreeWindowInfoBuffer
+ *          get internal window info buffer
+ *
+ * @param[in]   name          window name
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSAppInfo::FreeWindowInfo(const char *name)
+{
+    for(std::vector<ico_hs_window_info*>::iterator it_window_info = 
+                 window_info.begin();
+        it_window_info != window_info.end();
+        it_window_info++){
+        if((strncmp(name,(*it_window_info)->name,
+            ICO_HS_MAX_WINDOW_NAME) == 0)){
+            (*it_window_info)->valid = false;
+            window_info.erase(it_window_info);
+            --window_num;
+            break;
+        }
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSAppInfo::SetWindowAttr
+ *          set window attribute
+ *
+ * @param[in]   idx              index
+ * @param[in]   window_attr      window attribute
+ * @return      void
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoHSAppInfo::SetWindowAttr(ico_hs_window_info *hs_window_info,ico_syc_win_attr_t *window_attr)
+{
+    if(window_attr->appid != NULL){
+        strncpy(hs_window_info->appid,window_attr->appid,
+                ICO_HS_MAX_PROCESS_NAME);
+    }
+    if(window_attr->name != NULL){ 
+        strncpy(hs_window_info->name,window_attr->name,
+                ICO_HS_MAX_WINDOW_NAME);
+    }
+    hs_window_info->surface = window_attr->surface;
+    hs_window_info->nodeid = window_attr->nodeid;
+    hs_window_info->layer = window_attr->layer;
+    hs_window_info->pos_x = window_attr->pos_x;
+    hs_window_info->pos_y = window_attr->pos_y;
+    hs_window_info->width = window_attr->width;
+    hs_window_info->height = window_attr->height;
+    hs_window_info->raise = window_attr->raise;
+    hs_window_info->visible = window_attr->visible;
+    hs_window_info->active = window_attr->active;
+
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSAppInfo::SetWindowAttr
+ *          set window attribute
+ *
+ * @param[in]   window_attr      window information
+ * @return      OK or ERROR
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHSAppInfo::AddWindowAttr(ico_syc_win_attr_t *window_attr)
+{
+    for(std::vector<ico_hs_window_info*>::iterator it_window_info = 
+                 window_info.begin();
+        it_window_info != window_info.end();
+        it_window_info++){
+        if((strncmp(window_attr->name,(*it_window_info)->name,
+            ICO_HS_MAX_WINDOW_NAME) == 0)){
+            /*update*/
+            SetWindowAttr(*it_window_info,window_attr);
+            return ICO_OK;
+        }
+    }
+
+    ico_hs_window_info *tmp_win_info = GetFreeWindowInfoBuffer();
+    if(tmp_win_info == NULL){
+        return ICO_ERROR;
+    }   
+    SetWindowAttr(tmp_win_info,window_attr);
+    window_info.push_back(tmp_win_info);
+    ++window_num;
+  
+    return ICO_OK;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSAppInfo::SetWindowInfo
+ *          set window information
+ *
+ * @param[in]   window info      window information
+ * @return      OK or ERROR
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHSAppInfo::AddWindowInfo(ico_syc_win_info_t *window_info)
+{
+    for(std::vector<ico_hs_window_info*>::iterator it_window_info 
+                 = this->window_info.begin();
+        it_window_info != this->window_info.end();
+        it_window_info++){
+        if((strncmp(window_info->name,(*it_window_info)->name,
+            ICO_HS_MAX_WINDOW_NAME) == 0)){
+            /*update*/
+            SetWindowInfo(*it_window_info,window_info);
+            return ICO_OK;
+        }
+    }
+    
+    ico_hs_window_info *tmp_win_info = GetFreeWindowInfoBuffer();
+    if(tmp_win_info == NULL){
+        return ICO_ERROR;
+    }   
+    SetWindowInfo(tmp_win_info,window_info);
+    this->window_info.push_back(tmp_win_info);
+    ++window_num;
+
+    return ICO_OK;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSAppInfo::GetWindowNum
+ *          get number of window 
+ *
+ * @param[in]   none
+ * @return      window num
+ */
+/*--------------------------------------------------------------------------*/
+int 
+CicoHSAppInfo::GetWindowNum(void)
+{
+    return window_num;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSAppInfo::GetWindowInfo
+ *          get window information 
+ *
+ * @param[in]   idx index
+ * @return      window information
+ */
+/*--------------------------------------------------------------------------*/
+ico_hs_window_info*
+CicoHSAppInfo::GetWindowInfo(const char* name)
+{
+    for(std::vector<ico_hs_window_info*>::iterator it_window_info 
+                = window_info.begin();
+        it_window_info != window_info.end();
+        it_window_info++){
+        if((strncmp(name,(*it_window_info)->name,ICO_HS_MAX_WINDOW_NAME) == 0)){
+            return *it_window_info;
+        }
+    }
+    return NULL;  
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSAppInfo::SetShowed
+ *          set showing status;          
+ *
+ * @param[in]   showed     showing status 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSAppInfo::SetShowed(ico_hs_window_info *info,bool showed)
+{
+    info->showed = showed;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSAppInfo::GetShowed
+ *          get showing status;          
+ *
+ * @param[in]    none
+ * @return      showing status 
+ */
+/*--------------------------------------------------------------------------*/
+bool
+CicoHSAppInfo::GetShowed(ico_hs_window_info *info)
+{
+    return info->showed;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSAppInfo::Execute
+ *          execute application 
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHSAppInfo::Execute(void)
+{
+    /*call execute api*/
+    int ret = life_cycle_controller->launch(appid);    
+    if(ret < 0){
+        return ret;
+    }
+  
+    return ret;
+}
+
+/*--------------------------------------------------------------------------*/
+/*
+ * @brief   CicoHSAppInfo::Terminate
+ *          terminate application 
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHSAppInfo::Terminate(void)
+{
+    /*call Terminate api*/
+    int ret = life_cycle_controller->terminate(appid);    
+    if(ret < 0){
+        return ret;
+    }
+
+   return ret;
+}
+
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSAppInfo::GetStatus
+ *          get status 
+ *
+ * @param[in]   none
+ * @return      status
+ */
+/*--------------------------------------------------------------------------*/
+bool 
+CicoHSAppInfo::GetStatus(void)
+{
+    return life_cycle_controller->isRunning(appid);
+}
+
+
+void 
+CicoHSAppInfo::SetLastSurface(int last_surface)
+{
+    this->last_surface = last_surface;
+}
+
+int 
+CicoHSAppInfo::GetLastSurface(void)
+{
+    return last_surface;
+}
diff --git a/src/homescreen/CicoHSAppInfo.h b/src/homescreen/CicoHSAppInfo.h
new file mode 100644 (file)
index 0000000..77bb3cf
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * 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 info
+ *
+ * @date    Aug-08-2013
+ */
+#ifndef __CICO_HS_APP_INFO_H__
+#define __CICO_HS_APP_INFO_H__
+#include <stdio.h>
+#include <pthread.h>
+#include <libwebsockets.h>
+#include <string.h>
+#include <vector>
+
+#include "ico_syc_common.h"
+#include "ico_syc_winctl.h"
+
+#include "CicoHomeScreenCommon.h"
+#include "CicoSCLifeCycleController.h"
+
+#define ICO_HS_APPLICATION_FULL_SCREEN_POS_X 0
+#define ICO_HS_APPLICATION_FULL_SCREEN_POS_Y 64
+#define ICO_HS_APPLICATION_FULL_SCREEN_WIDTH 1080
+#define ICO_HS_APPLICATION_FULL_SCREEN_HEIGHT 1728
+
+#define ICO_HS_MAX_WINDOW_NAME 64
+
+typedef struct _ico_hs_window_info{
+    bool valid;
+    bool showed;
+    char appid[ICO_HS_MAX_PROCESS_NAME];
+    char name[ICO_HS_MAX_WINDOW_NAME];
+    int  surface;
+    int  nodeid;
+    int  layer;
+    int  pos_x;
+    int  pos_y;
+    int  width;
+    int  height;
+    int  raise;
+    int  visible;
+    int  active;
+}ico_hs_window_info;
+
+class CicoHSAppInfo
+{
+  public:
+    CicoHSAppInfo(const char *appid);
+    ~CicoHSAppInfo(void);
+    char *GetAppId(void);
+    ico_hs_window_info* GetWindowInfo(const char* name);
+    void SetWindowInfo(ico_hs_window_info *hs_window_info,
+                       ico_syc_win_info_t *window_info);
+    void SetWindowAttr(ico_hs_window_info *hs_window_info,
+                       ico_syc_win_attr_t *window_info);
+    void FreeWindowInfo(const char *name);
+    int AddWindowInfo(ico_syc_win_info_t *window_info);
+    int AddWindowAttr(ico_syc_win_attr_t *window_info);
+    int GetWindowNum(void);
+    void SetShowed(ico_hs_window_info *info,bool showed);
+    bool GetShowed(ico_hs_window_info *info);
+    
+    int Execute(void);
+    int Terminate(void);
+    bool GetStatus(void);
+   
+    void SetLastSurface(int last_surface);
+    int GetLastSurface(void);
+  private:
+    ico_hs_window_info *GetFreeWindowInfoBuffer(void);
+
+    char appid[ICO_HS_MAX_PROCESS_NAME];
+    int category;
+    int window_num;
+    int last_surface;
+    ico_hs_window_info window_info_i[ICO_HS_APP_MAX_WINDOW_NUM];
+    std::vector<ico_hs_window_info *> window_info;
+    CicoSCLifeCycleController *life_cycle_controller;
+   
+  protected:
+    CicoHSAppInfo operator=(const CicoHSAppInfo&);
+    CicoHSAppInfo(const CicoHSAppInfo&);
+};
+#endif
+
diff --git a/src/homescreen/CicoHSBackWindow.cpp b/src/homescreen/CicoHSBackWindow.cpp
new file mode 100644 (file)
index 0000000..fb4cba0
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * 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   Back Screen
+ *
+ * @date    Aug-08-2013
+ */
+#include "CicoHSBackWindow.h"
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSBackWindow::CicoHSBackWindow
+ *          Constractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSBackWindow::CicoHSBackWindow(void)
+{
+    evas = NULL;
+
+    CicoHomeScreenResourceConfig::GetImagePath(img_dir_path,ICO_HS_MAX_PATH_BUFF_LEN);
+
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSBackWindow::~CicoHSBackWindow
+ *          Destractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSBackWindow::~CicoHSBackWindow(void)
+{
+    /* Do not somthing to do */
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSBackWindow::CreateBackWindow
+ *          create window (back)
+ *
+ * @param[in]   pos_x    position x
+ * @param[in]   pos_y    position y
+ * @param[in]   width    width
+ * @param[in]   height   height
+ * @return      OK or ERRROR
+ */
+/*--------------------------------------------------------------------------*/
+int 
+CicoHSBackWindow::CreateBackWindow(int pos_x,int pos_y,int width,int height)
+{
+    int ret;
+    char img_path[ICO_HS_MAX_PATH_BUFF_LEN];
+
+    /*create window*/
+    ret = CreateWindow(ICO_HS_BACK_WINDOW_TITLE,pos_x,pos_y,width,height,EINA_TRUE);
+    if(ret != ICO_OK){
+       return ret;
+    }
+   
+    /* evas get */
+    evas = ecore_evas_get(window);
+    if (!evas) {
+        ICO_ERR("CicoHSBackWindow::CreateBackWindow: could not get evas.");
+        return ICO_ERROR;
+    }
+
+    /* set back */
+    /* image file name*/
+    snprintf(img_path,sizeof(img_path),ICO_HS_BACK_WINDOW_IMAGE_FILE_PATH);
+  
+    /* set object*/
+    canvas = evas_object_image_filled_add(evas);
+    evas_object_image_file_set(canvas, img_path, NULL);
+    int err = evas_object_image_load_error_get(canvas);
+    if (err != EVAS_LOAD_ERROR_NONE) {
+        ICO_ERR("CicoHSBackWindow::CreateBackWindow: backgound image is not exist");
+        evas_object_del(canvas);
+        FreeWindow();
+        return ICO_ERROR;
+    }
+    evas_object_image_fill_set(canvas, pos_x, pos_y, width, height);
+    evas_object_resize(canvas, width,height);
+    evas_object_show(canvas);
+
+    return ICO_OK;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSBackWindow::FreeBackWindow
+ *          free window (back)
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSBackWindow::FreeBackWindow(void)
+{
+    evas_object_del(canvas);    
+    FreeWindow();
+}
+
+
diff --git a/src/homescreen/CicoHSBackWindow.h b/src/homescreen/CicoHSBackWindow.h
new file mode 100644 (file)
index 0000000..c5fbf89
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * 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   Back Screen
+ *
+ * @date    Aug-08-2013
+ */
+#ifndef __CICO_HS_BACK_WINDOW_H__
+#define __CICO_HS_BACK_WINDOW_H__
+#include <stdio.h>
+#include <pthread.h>
+#include <libwebsockets.h>
+
+#include "ico_syc_common.h"
+#include "ico_syc_winctl.h"
+
+#include <unistd.h>
+#include <Eina.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#include <Ecore_Evas.h>
+#include <Edje.h>
+
+#include "CicoHomeScreenCommon.h"
+#include "CicoHomeScreenConfig.h"
+#include "CicoHSWindow.h"
+
+class CicoHSBackWindow :public CicoHSWindow
+{
+  public:
+    CicoHSBackWindow(void);
+    ~CicoHSBackWindow(void);
+    int Initialize(void);
+    void Finalize(void);
+    int CreateBackWindow(int pos_x,int pos_y,int width,int height);
+    void FreeBackWindow(void);
+  
+  private:
+    char img_dir_path[ICO_HS_MAX_PATH_BUFF_LEN];
+    Evas *evas;         /* evas object */
+    Evas_Object *canvas;
+  
+  protected:
+    CicoHSBackWindow operator=(const CicoHSBackWindow&);
+    CicoHSBackWindow(const CicoHSBackWindow&);
+};
+#endif
+
diff --git a/src/homescreen/CicoHSControlBarTouch.cpp b/src/homescreen/CicoHSControlBarTouch.cpp
new file mode 100644 (file)
index 0000000..0848de4
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * 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   touch action of control bar
+ *
+ * @date    Aug-08-2013
+ */
+#include "CicoHSControlBarTouch.h"
+
+/*============================================================================*/
+/* static members                                                             */
+/*============================================================================*/
+CicoHSControlBarWindow* CicoHSControlBarTouch::ctl_bar_window;
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSControlBarTouch::Initialize
+ *          Initialize
+ *
+ * @param[in]   ctl_bar_window    instance of control bar window
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSControlBarTouch::Initialize(CicoHSControlBarWindow* ctl_bar_window)
+{
+    CicoHSControlBarTouch::ctl_bar_window = ctl_bar_window;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSControlBarTouch::Finalize
+ *          Finalize
+ *
+ * @param[in]   void
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSControlBarTouch::Finalize(void)
+{
+  /*nothing to do*/
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSControlBarTouch::TouchDownControlBar
+ *          touch down action at control bar
+ *
+ * @param[in]   data    data
+ * @param[in]   evas    evas
+ * @param[in]   obj     object
+ * @param[in]   event_info    event information
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSControlBarTouch::TouchDownControlBar(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+   Evas_Event_Mouse_Down *info;
+   int button_id;
+
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSControlBarTouch::TouchUpControlBar
+ *          touch up action at control bar
+ *
+ * @param[in]   data    data
+ * @param[in]   evas    evas
+ * @param[in]   obj     object
+ * @param[in]   event_info    event information
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSControlBarTouch::TouchUpControlBar(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+   Evas_Event_Mouse_Up *info;
+   int sub = 0;
+   ICO_DBG("CicoHSControlBarTouch::TouchUpControlBar start");  
+   if(data == NULL){
+        ctl_bar_window->TouchHome();
+   }else{
+     
+   }
+   ICO_DBG("CicoHSControlBarTouch::TouchUpControlBar end");  
+}
diff --git a/src/homescreen/CicoHSControlBarTouch.h b/src/homescreen/CicoHSControlBarTouch.h
new file mode 100644 (file)
index 0000000..6ecd9b9
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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   touch action of control bar
+ *
+ * @date    Aug-08-2013
+ */
+#ifndef __CICO_HS_CONTROLBAR_TOUCH_H__
+#define __CICO_HS_CONTROLBAR_TOUCH_H__
+#include <stdio.h>
+#include <pthread.h>
+#include <libwebsockets.h>
+
+#include <unistd.h>
+#include "CicoHSControlBarWindow.h"
+
+class CicoHSControlBarTouch
+{
+  public:
+    static void Initialize(CicoHSControlBarWindow* ctl_bar_window);
+    static void Finalize(void);
+    static void TouchDownControlBar(void *data, Evas *evas, Evas_Object *obj, void *event_info); 
+    static void TouchUpControlBar(void *data, Evas *evas, Evas_Object *obj, void *event_info); 
+  private:
+    static CicoHSControlBarWindow* ctl_bar_window;
+
+  protected:
+    CicoHSControlBarTouch operator=(const CicoHSControlBarTouch&);
+    CicoHSControlBarTouch(const CicoHSControlBarTouch&);
+};
+
+#endif
+
diff --git a/src/homescreen/CicoHSControlBarWindow.cpp b/src/homescreen/CicoHSControlBarWindow.cpp
new file mode 100644 (file)
index 0000000..638486c
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ * 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   control bar window
+ *
+ * @date    Aug-08-2013
+ */
+#include "CicoHSControlBarWindow.h"
+#include "CicoHSControlBarTouch.h"
+#include "CicoHomeScreen.h"
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSControlBarWindow::CicoHSControlBarWindow
+ *          Constractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSControlBarWindow::CicoHSControlBarWindow(void)
+{
+    evas = NULL;
+
+    CicoHomeScreenResourceConfig::GetImagePath(img_dir_path,
+        ICO_HS_MAX_PATH_BUFF_LEN);
+
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSControlBarWindow::~CicoHSControlBarWindow
+ *          Destractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSControlBarWindow::~CicoHSControlBarWindow(void)
+{
+    /* not somthing to do */
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSControlBarWindow::CreateControlBarWindow
+ *          crate window (control bar)
+ *
+ * @param[in]   pos_x    position x
+ * @param[in]   pos_y    position y
+ * @param[in]   width    width
+ * @param[in]   height   height
+ * @return      OK or ERRROR
+ */
+/*--------------------------------------------------------------------------*/
+int 
+CicoHSControlBarWindow::CreateControlBarWindow(int pos_x,int pos_y,int width,int height)
+{
+    int ret;
+    char img_path[ICO_HS_MAX_PATH_BUFF_LEN];
+    
+    /*create window*/
+    ret = CreateWindow(ICO_HS_CONTROL_BAR_WINDOW_TITLE,pos_x,pos_y,width,height,EINA_TRUE);
+    if(ret != ICO_OK){
+       return ret;
+    }
+       
+    /* get evas */
+    evas = ecore_evas_get(window);
+    if (!evas) {
+        ICO_DBG("CicoHSControlBarWindow::CreateControlBarWindow: could not get evas.");
+        return ICO_ERROR;
+    }
+
+    /*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);
+
+
+    /*home button*/
+    /* image file name*/
+    snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,ICO_HS_IMAGE_FILE_CONTROL_BAR_BUTTON);
+
+    /* 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,
+                                   CicoHSControlBarTouch::TouchDownControlBar,NULL);
+    evas_object_event_callback_add(home_button, EVAS_CALLBACK_MOUSE_UP,
+                                   CicoHSControlBarTouch::TouchUpControlBar,NULL);
+    evas_object_show(home_button);    
+    return ICO_OK;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSControlBarWindow::FreeControlBarWindow
+ *          free window (control bar)
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSControlBarWindow::FreeControlBarWindow(void)
+{
+    evas_object_del(home_button);
+    evas_object_del(canvas);
+    FreeWindow();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSControlBarWindow::TouchHome
+ *          touch home button
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoHSControlBarWindow::TouchHome(void)
+{
+    CicoHomeScreen::ChangeMode(ICO_HS_SHOW_HIDE_PATTERN_SLIDE);
+}
diff --git a/src/homescreen/CicoHSControlBarWindow.h b/src/homescreen/CicoHSControlBarWindow.h
new file mode 100644 (file)
index 0000000..467c896
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * 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   control bar window
+ *
+ * @date    Aug-08-2013
+ */
+#ifndef __CICO_HS_CONTROLBAR_WINDOW_H__
+#define __CICO_HS_CONTROLBAR_WINDOW_H__
+#include <stdio.h>
+#include <pthread.h>
+#include <libwebsockets.h>
+
+#include <unistd.h>
+#include <Eina.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#include <Ecore_Evas.h>
+#include <Edje.h>
+
+#include "CicoHomeScreenCommon.h"
+#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
+
+class CicoHSControlBarWindow :public CicoHSWindow
+{
+  public:
+    CicoHSControlBarWindow(void);
+    ~CicoHSControlBarWindow(void);
+    int Initialize(void);
+    void Finalize(void);
+    int CreateControlBarWindow(int pos_x,int pos_y,int width,int height);
+    void FreeControlBarWindow(void);
+    
+    void TouchHome(void);
+
+  private:
+    char img_dir_path[ICO_HS_MAX_PATH_BUFF_LEN];
+    Evas *evas;         /* evas object */
+    Evas_Object *canvas;
+    Evas_Object *home_button;
+
+  protected:
+    CicoHSControlBarWindow operator=(const CicoHSControlBarWindow&);
+    CicoHSControlBarWindow(const CicoHSControlBarWindow&);
+};
+#endif
+
diff --git a/src/homescreen/CicoHSMenuTile.cpp b/src/homescreen/CicoHSMenuTile.cpp
new file mode 100644 (file)
index 0000000..f166fd1
--- /dev/null
@@ -0,0 +1,445 @@
+/*
+ * 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   tile in menu
+ *
+ * @date    Aug-08-2013
+ */
+#include "CicoHSMenuTile.h"
+#include "CicoHSMenuTouch.h"
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::CicoHSMenuTile
+ *          Constractor
+ *
+ * @param[in]   appid
+ * @param[in]   icon_image_path
+ * @param[in]   page
+ * @param[in]   position
+ * @param[in]   width
+ * @param[in]   height
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSMenuTile::CicoHSMenuTile(const char *appid,
+      const char *icon_image_path,int page,int position,int width,int height)
+{
+    thumbnail = NULL;
+    if(appid != NULL){
+        strncpy(this->appid,appid,ICO_HS_MAX_PROCESS_NAME);
+    }
+    if((icon_image_path != NULL) && (strlen(icon_image_path) != 0) ){
+        strncpy(this->icon_image_path,icon_image_path,ICO_HS_MAX_PATH_BUFF_LEN);
+    }else{
+        strncpy(this->icon_image_path,ICO_HS_MENUTILE_DEFAULT_ICON_PATH
+               ,ICO_HS_MAX_PATH_BUFF_LEN);
+    }
+    ICO_DBG("CicoHSMEnutTile::CicoHSMenuTile:image_path %s:%s",appid,this->icon_image_path);
+    this->page = page;
+    this->position = position;
+    this->width = width;
+    this->height = height;
+    pos_x = GetPositionX();
+    pos_y = GetPositionY();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::CicoHSMenuTile
+ *          Destractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSMenuTile::~CicoHSMenuTile(void)
+{
+
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::CreateObject
+ *          create tile object
+ *
+ * @param[in]   evas
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuTile::CreateObject(Evas *evas)
+{
+    /*tile*/
+    tile = evas_object_image_filled_add(evas);
+    evas_object_image_file_set(tile,icon_image_path, NULL);
+    evas_object_move(tile,pos_x,pos_y);
+    evas_object_resize(tile, width, height);
+    evas_object_event_callback_add(tile, EVAS_CALLBACK_MOUSE_DOWN,
+                                       CicoHSMenuTouch::TouchDownMenu,appid);
+    evas_object_event_callback_add(tile, EVAS_CALLBACK_MOUSE_UP,
+                                       CicoHSMenuTouch::TouchUpMenu,appid);
+    evas_object_show(tile);
+
+    /*term Icon*/
+    term_icon = evas_object_image_filled_add(evas);
+    evas_object_image_file_set(term_icon,ICO_HS_MENUTILE_TERM_ICON_PATH, NULL);
+    evas_object_move(term_icon,pos_x + width - ICO_HS_MENUTILE_TERM_ICON_WIDTH
+                     ,pos_y);
+    evas_object_resize(term_icon, ICO_HS_MENUTILE_TERM_ICON_WIDTH,
+                       ICO_HS_MENUTILE_TERM_ICON_HEIGHT);
+    evas_object_event_callback_add(term_icon, EVAS_CALLBACK_MOUSE_UP,
+                                       CicoHSMenuTouch::TouchUpTerm,appid);
+
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::ShowTermIcon
+ *          showing term icon
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuTile::ShowTermIcon()
+{
+    evas_object_show(term_icon);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::HideTermIcon
+ *          hiding term icon
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuTile::HideTermIcon(void)
+{
+    evas_object_hide(term_icon);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::FreeObject
+ *          free tile object
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuTile::FreeObject(void)
+{
+    if(tile != NULL){
+       evas_object_del(tile);
+    }
+    if(term_icon != NULL){
+       evas_object_del(term_icon);
+    }
+    
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::Resize
+ *          resize tile 
+ *
+ * @param[in]   width         width
+ * @param[in]   height        height
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuTile::Resize(int width,int height)
+{
+    this->width = width;
+    this->height = height;
+    evas_object_resize(tile, width, height);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::MovePosition
+ *          move tile base position
+ *
+ * @param[in]   page        page
+ * @param[in]   position    position of tile
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoHSMenuTile::MovePosition(int page,int position)
+{
+    this->page = page;
+    this->position= position;
+    pos_x = GetPositionX();
+    pos_y = GetPositionY();
+
+    evas_object_move(tile,pos_x,pos_y);
+    evas_object_move(term_icon,pos_x + width - ICO_HS_MENUTILE_TERM_ICON_WIDTH,pos_y);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::OffsetMove
+ *          move from base position
+ *
+ * @param[in]   offset_x    offset_x from base position
+ * @param[in]   offset_y    offset_y from base position
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoHSMenuTile::OffsetMove(int offset_x,int offset_y)
+{
+    pos_x = GetPositionX() + offset_x;
+    pos_y = GetPositionY() + offset_y;
+
+    evas_object_move(tile,pos_x,pos_y);
+    evas_object_move(term_icon,pos_x + width - ICO_HS_MENUTILE_TERM_ICON_WIDTH,pos_y);
+}
+
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::GetImagePath
+ *          get icon image path
+ *
+ * @param[in]   none
+ * @return      icon image path
+ */
+/*--------------------------------------------------------------------------*/
+const char*
+CicoHSMenuTile::GetImagePath(void)
+{
+    return icon_image_path;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::GetAppId
+ *          get application id
+ *
+ * @param[in]   none
+ * @return      application id
+ */
+/*--------------------------------------------------------------------------*/
+const char*
+CicoHSMenuTile::GetAppId(void)
+{
+    return appid;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::GetWidth
+ *          get width
+ *
+ * @param[in]   none
+ * @return      width
+ */
+/*--------------------------------------------------------------------------*/
+int 
+CicoHSMenuTile::GetWidth(void)
+{
+    return width;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::GetHeight
+ *          get height
+ *
+ * @param[in]   none
+ * @return      height
+ */
+/*--------------------------------------------------------------------------*/
+int 
+CicoHSMenuTile::GetHeight(void)
+{
+    return height;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::GetPosition
+ *          get position
+ *
+ * @param[in]   none
+ * @return      position
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHSMenuTile::GetPosition(void)
+{
+    return position;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::GetPage
+ *          get page
+ *
+ * @param[in]   none
+ * @return      page
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHSMenuTile::GetPage(void)
+{
+    return page;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::GetPositionX
+ *          get position x
+ *
+ * @param[in]   none
+ * @return      position x
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHSMenuTile::GetPositionX(void)
+{
+    int ret = 0;
+
+    if((position == ICO_HS_MENUTILE_POSITION_0) ||
+       (position == ICO_HS_MENUTILE_POSITION_3) ||
+       (position == ICO_HS_MENUTILE_POSITION_6) ||
+       (position == ICO_HS_MENUTILE_POSITION_9)){
+        ret = ICO_HS_MENUTILE_START_POS_X;
+    }
+    else if((position == ICO_HS_MENUTILE_POSITION_1) ||
+       (position == ICO_HS_MENUTILE_POSITION_4) ||
+       (position == ICO_HS_MENUTILE_POSITION_7) ||
+       (position == ICO_HS_MENUTILE_POSITION_10)){
+        ret = ICO_HS_MENUTILE_START_POS_X + 
+            (ICO_HS_MENUTILE_WIDTH + ICO_HS_MENUTILE_SPACE_TILE_AND_TILE);
+    }
+    else if((position == ICO_HS_MENUTILE_POSITION_2) ||
+       (position == ICO_HS_MENUTILE_POSITION_5) ||
+       (position == ICO_HS_MENUTILE_POSITION_8) ||
+       (position == ICO_HS_MENUTILE_POSITION_11)){
+        ret = ICO_HS_MENUTILE_START_POS_X + 
+            ((ICO_HS_MENUTILE_WIDTH + ICO_HS_MENUTILE_SPACE_TILE_AND_TILE) * 2);
+    }
+    return ret;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::GetPositionY
+ *          get position y
+ *
+ * @param[in]   none
+ * @return      position y
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHSMenuTile::GetPositionY(void)
+{
+    int ret = 0;
+
+    if((position == ICO_HS_MENUTILE_POSITION_0) ||
+       (position == ICO_HS_MENUTILE_POSITION_1) ||
+       (position == ICO_HS_MENUTILE_POSITION_2)){
+        ret = ICO_HS_MENUTILE_START_POS_Y;
+    }
+    else if((position == ICO_HS_MENUTILE_POSITION_3) ||
+       (position == ICO_HS_MENUTILE_POSITION_4) ||
+       (position == ICO_HS_MENUTILE_POSITION_5)){
+        ret = ICO_HS_MENUTILE_START_POS_Y + 
+              (ICO_HS_MENUTILE_HEIGHT + ICO_HS_MENUTILE_SPACE_TILE_AND_TILE);
+    }
+    else if((position == ICO_HS_MENUTILE_POSITION_6) ||
+       (position == ICO_HS_MENUTILE_POSITION_7) ||
+       (position == ICO_HS_MENUTILE_POSITION_8)){
+        ret = ICO_HS_MENUTILE_START_POS_Y + 
+              ((ICO_HS_MENUTILE_HEIGHT + ICO_HS_MENUTILE_SPACE_TILE_AND_TILE) * 2);
+    }
+    else if((position == ICO_HS_MENUTILE_POSITION_9) ||
+       (position == ICO_HS_MENUTILE_POSITION_10) ||
+       (position == ICO_HS_MENUTILE_POSITION_11)){
+        ret = ICO_HS_MENUTILE_START_POS_Y + 
+              ((ICO_HS_MENUTILE_HEIGHT + ICO_HS_MENUTILE_SPACE_TILE_AND_TILE) * 3);
+    }
+    return ret;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::ValidMenuIcon(
+ *          tile is icon
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuTile::ValidMenuIcon(void)
+{
+    evas_object_image_file_set(tile,icon_image_path, NULL);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::ValidThumbnail(
+ *          tile is thumbnail
+ *
+ * @param[in]   surface   surface
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuTile::ValidThumbnail(int surface)
+{
+    if(thumbnail != NULL){
+        ico_syc_unmap_thumb(thumb_surface);
+        thumbnail = NULL;
+    }
+    ico_syc_prepare_thumb(surface,0);
+    thumb_surface = surface;
+
+    ICO_DBG("CicoHSMenuTile::ValidThumbnail: prepare thumbnail 0x%d",surface);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTile::SetThumbnail
+ *          tile is thumbnail
+ *
+ * @param[in]   surface   surface
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuTile::SetThumbnail(int surface)
+{
+    if(thumb_surface != 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);
+
+}
diff --git a/src/homescreen/CicoHSMenuTile.h b/src/homescreen/CicoHSMenuTile.h
new file mode 100644 (file)
index 0000000..82e3f47
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * 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   tile in menu
+ *
+ * @date    Aug-08-2013
+ */
+#ifndef __CICO_HS_MENU_TILE_H__
+#define __CICO_HS_MENU_TILE_H__
+
+#include <stdio.h>
+#include <string.h>
+
+#include <Eina.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#include <Ecore_Evas.h>
+#include <Edje.h>
+
+#include "ico_syc_common.h"
+#include "ico_syc_winctl.h"
+
+#include "CicoHomeScreenCommon.h"
+
+/*1920 * 1080 display*/
+/*orientation is vertical*/
+/* max is (4 * 3)*/
+/*it can't use all height 1920 ,it needs deduct ControlBar 128 and StatusBar 64*/
+/*home screen use 1728 * 1080*/
+/*one rectangle size is 340 * 340 and space = 15*/
+/**/
+/*raw is four */
+
+/*** position       ***/
+/***+---+---+---+******/
+/***+ 0 + 1 + 2 +******/
+/***+ 3 + 4 + 5 +******/
+/***+ 6 + 7 + 8 +******/
+/***+ 9 +10 +11 +******/
+/***+---+---+---+******/
+
+#define ICO_HS_MENUTILE_ROW 3
+#define ICO_HS_MENUTILE_COLUMN 4 
+#define ICO_HS_MENUTILE_NUM (ICO_HS_MENUTILE_COLUMN * ICO_HS_MENUTILE_ROW)
+#define ICO_HS_MENUTILE_POSITION_0 0
+#define ICO_HS_MENUTILE_POSITION_1 1
+#define ICO_HS_MENUTILE_POSITION_2 2
+#define ICO_HS_MENUTILE_POSITION_3 3
+#define ICO_HS_MENUTILE_POSITION_4 4
+#define ICO_HS_MENUTILE_POSITION_5 5
+#define ICO_HS_MENUTILE_POSITION_6 6
+#define ICO_HS_MENUTILE_POSITION_7 7
+#define ICO_HS_MENUTILE_POSITION_8 8
+#define ICO_HS_MENUTILE_POSITION_9 9
+#define ICO_HS_MENUTILE_POSITION_10 10
+#define ICO_HS_MENUTILE_POSITION_11 11
+#define ICO_HS_MENUTILE_POSITION_RESERVE 0xFFFF
+
+#define ICO_HS_MENUTILE_WIDTH 290
+#define ICO_HS_MENUTILE_HEIGHT 290
+#define ICO_HS_MENUTILE_SPACE_TILE_AND_TILE 25
+
+#define ICO_HS_MENUTILE_START_POS_X 80
+#define ICO_HS_MENUTILE_START_POS_Y 210
+
+#define ICO_HS_MENUTILE_WIDTH_DOUBLE (ICO_HS_MENUTILE_WIDTH * 2) + ICO_HS_MENUTILE_SPACE_TILE_AND_TILE
+#define ICO_HS_MENUTILE_HEIGHT_DOUBLE (ICO_HS_MENUTILE_HEIGHT * 2) + ICO_HS_MENUTILE_SPACE_TILE_AND_TILE
+
+#define ICO_HS_MENUTILE_TERM_ICON_PATH "/usr/apps/org.tizen.ico.homescreen/res/images/termIcon.png"
+#define ICO_HS_MENUTILE_DEFAULT_ICON_PATH "/usr/apps/org.tizen.ico.homescreen/res/images/tizen_32.png"
+#define ICO_HS_MENUTILE_TERM_ICON_WIDTH 64
+#define ICO_HS_MENUTILE_TERM_ICON_HEIGHT 64
+
+class CicoHSMenuTile
+{
+  public:
+    CicoHSMenuTile(const char *appid,const char *icon_image_path
+        ,int page,int position,int width,int height);
+    ~CicoHSMenuTile(void);
+    void CreateObject(Evas *evas);
+    void FreeObject(void);
+    void Resize(int width,int height);
+    void MovePosition(int page,int poisition);
+    void OffsetMove(int offset_x,int offset_y);
+    const char* GetImagePath(void);
+    int GetWidth(void);
+    int GetHeight(void);
+    int GetPosition(void);
+    int GetPage(void);
+    int GetPositionX(void);
+    int GetPositionY(void);
+    int GetAppIdx(void);
+    const char* GetAppId(void);
+    void ShowTermIcon(void);
+    void HideTermIcon(void);
+    void ValidMenuIcon(void);   
+    void ValidThumbnail(int surface);
+    void SetThumbnail(int surface);
+
+  private:
+    char appid[ICO_HS_MAX_PROCESS_NAME];
+    char icon_image_path[ICO_HS_MAX_PATH_BUFF_LEN];
+    int page;
+    int position;
+    int width;
+    int height;
+    int pos_x;
+    int pos_y;
+    Evas_Object *tile;
+    Evas_Object *term_icon;
+    int                   thumb_surface;
+    ico_syc_thumb_data_t *thumbnail;
+
+  protected:
+    CicoHSMenuTile operator=(const CicoHSMenuTile&);
+    CicoHSMenuTile(const CicoHSMenuTile&);
+};
+
+#endif
diff --git a/src/homescreen/CicoHSMenuTouch.cpp b/src/homescreen/CicoHSMenuTouch.cpp
new file mode 100644 (file)
index 0000000..54d43f7
--- /dev/null
@@ -0,0 +1,228 @@
+/*
+ * 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   touch action of menu
+ *
+ * @date    Aug-08-2013
+ */
+#include "CicoHSMenuTouch.h"
+
+/*============================================================================*/
+/* static members                                                             */
+/*============================================================================*/
+char CicoHSMenuTouch::terminate_appid[ICO_HS_MAX_PROCESS_NAME];
+int CicoHSMenuTouch::touch_state_b_x;
+int CicoHSMenuTouch::touch_state_b_y;
+int CicoHSMenuTouch::touch_state_a_x;
+int CicoHSMenuTouch::touch_state_a_y;
+
+Ecore_Timer *CicoHSMenuTouch::timer;
+bool CicoHSMenuTouch::long_act;
+
+CicoHSMenuWindow* CicoHSMenuTouch::menu_window;
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTouch::Initialize
+ *          Initialize
+ *
+ * @param[in]   menu_window    instance of menu window
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuTouch::Initialize(CicoHSMenuWindow* menu_window)
+{
+    timer = NULL;
+    long_act = false;
+
+    CicoHSMenuTouch::menu_window = menu_window;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTouch::Finalize
+ *          Finalize
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuTouch::Finalize(void)
+{
+  /*nothing to do*/
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTouch::TouchDownMenu
+ *          touch down action at menu
+ *
+ * @param[in]   data    data
+ * @param[in]   evas    evas
+ * @param[in]   obj     object
+ * @param[in]   event_info    event information
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuTouch::TouchDownMenu(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+    Evas_Event_Mouse_Down *info;
+
+    info = reinterpret_cast<Evas_Event_Mouse_Down*>(event_info);
+    touch_state_b_x = info->output.x;
+    touch_state_b_y = info->output.y;
+
+    char *appid = reinterpret_cast<char*>(data);
+    
+    if(appid == NULL){
+        return;
+    }
+
+    long_act = false;
+    timer = ecore_timer_add(ICO_HS_MENU_TOUCH_LONG_PUSH_THREASHOLD_TIME_SECONDS,
+                           LongPushed,NULL);    
+}
+
+Eina_Bool
+CicoHSMenuTouch::LongPushed(void *data)
+{
+   long_act = true;
+   ecore_timer_del(timer);
+   timer = NULL;
+
+   /*stop select*/
+   menu_window->ChangeTerminateMode();
+
+   return EINA_TRUE;
+}
+
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTouch::TouchUpMenu
+ *          touch up action at menu
+ *
+ * @param[in]   data    data
+ * @param[in]   evas    evas
+ * @param[in]   obj     object
+ * @param[in]   event_info    event information
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuTouch::TouchUpMenu(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+    Evas_Event_Mouse_Up *info;
+    char *appid = reinterpret_cast<char*>(data);
+    int sub = 0;
+
+    if(timer != NULL){
+        ecore_timer_del(timer);
+        timer = NULL;
+    }
+    /* long push*/
+    if(long_act == true){
+        long_act = false;
+        return;
+    }
+
+    info = reinterpret_cast<Evas_Event_Mouse_Up*>(event_info);
+    touch_state_a_x = info->output.x;
+    touch_state_a_y = info->output.y;
+    sub = touch_state_a_x - touch_state_b_x;
+
+    /* menu slide*/
+    if( sub > ICO_HS_MENU_TOUCH_FLICK_THREASHOLD_DISTANCE){
+        menu_window->GoBackMenu();
+        touch_state_b_x = 0;
+        touch_state_b_y = 0;
+        return;
+    }else if(sub < (-1 * ICO_HS_MENU_TOUCH_FLICK_THREASHOLD_DISTANCE)){
+        menu_window->GoNextMenu();
+        touch_state_b_x = 0;
+        touch_state_b_y = 0;
+        return;
+    }
+
+    /*execute application*/
+    if(appid != NULL){
+        menu_window->ExecuteApp(appid);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTouch::TouchUpTerm
+ *          touch up action at menu
+ *
+ * @param[in]   data    data
+ * @param[in]   evas    evas
+ * @param[in]   obj     object
+ * @param[in]   event_info    event information
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuTouch::TouchUpTerm(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+    Evas_Event_Mouse_Up *info;
+    int sub = 0;
+
+    char *appid = reinterpret_cast<char*>(data);
+
+    strncpy(terminate_appid,appid,ICO_HS_MAX_PROCESS_NAME);
+
+    menu_window->ShowTerminateButton();
+#if 0
+    if(appid != NULL){
+        menu_window->TerminateApp(appid);
+    }
+#endif
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTouch::TouchUpTeminateYes
+ *          touch up action at menu
+ *
+ * @param[in]   data    data
+ * @param[in]   evas    evas
+ * @param[in]   obj     object
+ * @param[in]   event_info    event information
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuTouch::TouchUpTerminateYes(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+    menu_window->TerminateApp(terminate_appid);
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuTouch::TouchUpTerminateNo
+ *          touch up action at menu
+ *
+ * @param[in]   data    data
+ * @param[in]   evas    evas
+ * @param[in]   obj     object
+ * @param[in]   event_info    event information
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuTouch::TouchUpTerminateNo(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+    menu_window->TerminateApp(NULL);
+}
diff --git a/src/homescreen/CicoHSMenuTouch.h b/src/homescreen/CicoHSMenuTouch.h
new file mode 100644 (file)
index 0000000..0245d09
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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   touch action of menu
+ *
+ * @date    Aug-08-2013
+ */
+#ifndef __CICO_HS_MENU_TOUCH_H__
+#define __CICO_HS_MENU_TOUCH_H__
+#include <stdio.h>
+#include <pthread.h>
+#include <libwebsockets.h>
+
+
+#include <unistd.h>
+#include "CicoHSMenuWindow.h"
+
+#define ICO_HS_MENU_TOUCH_FLICK_THREASHOLD_DISTANCE 100
+#define ICO_HS_MENU_TOUCH_FLICK_THREASHOLD_TIME_MSECONDS 1000
+#define ICO_HS_MENU_TOUCH_LONG_PUSH_THREASHOLD_TIME_SECONDS 3
+
+class CicoHSMenuTouch
+{
+  public:
+    static void Initialize(CicoHSMenuWindow* menu_window);
+    static void Finalize(void);
+    static void TouchDownMenu(void *data, Evas *evas, Evas_Object *obj, void *event_info); 
+    static void TouchUpMenu(void *data, Evas *evas, Evas_Object *obj, void *event_info);
+
+    static void TouchDownTerm(void *data, Evas *evas, Evas_Object *obj, void *event_info); 
+    static void TouchUpTerm(void *data, Evas *evas, Evas_Object *obj, void *event_info);
+
+    static void TouchUpTerminateYes(void *data, Evas *evas, Evas_Object *obj, void *event_info);
+    static void TouchUpTerminateNo(void *data, Evas *evas, Evas_Object *obj, void *event_info);
+    static Eina_Bool LongPushed(void *data);
+
+  private:
+    static char terminate_appid[ICO_HS_MAX_PROCESS_NAME];
+    static CicoHSMenuWindow* menu_window;
+    
+    static int touch_state_b_x;
+    static int touch_state_b_y;
+    static int touch_state_a_x;
+    static int touch_state_a_y;
+
+    static Ecore_Timer *timer;
+    static bool long_act;
+
+  protected:
+    CicoHSMenuTouch operator=(const CicoHSMenuTouch&);
+    CicoHSMenuTouch(const CicoHSMenuTouch&);
+};
+
+#endif
diff --git a/src/homescreen/CicoHSMenuWindow.cpp b/src/homescreen/CicoHSMenuWindow.cpp
new file mode 100644 (file)
index 0000000..809c169
--- /dev/null
@@ -0,0 +1,975 @@
+/*
+ * 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   Menu Window class
+ *
+ * @date    Aug-08-2013
+ */
+#include "CicoHSMenuWindow.h"
+#include "CicoHSMenuTouch.h"
+#include "CicoHomeScreen.h"
+#include <stdio.h>
+
+/*============================================================================*/
+/* static members                                                             */
+/*============================================================================*/
+CicoHSMenuWindow *CicoHSMenuWindow::menu_window_instance;
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::CicoHSMenuWindo
+ *          Constractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSMenuWindow::CicoHSMenuWindow(void)
+{
+    /*initialzie values*/
+    terminate_mode = false;
+
+    current_page = 0;
+    all_tile_num = 0;
+    all_page_num = 0;
+
+    evas = NULL;
+    canvas = NULL;
+    rectangle = NULL;
+
+    for(int ii = 0;ii < ICO_HS_MENU_MAX_TILE_NUM;ii++){
+        menu_tile[ii] = NULL;
+    }
+    for(int ii = 0;ii < ICO_HS_MENU_MAX_MENU_PAGE_NUM;ii++){
+        page_pointer[ii] = NULL;
+    }
+
+    surface = 0;   
+
+    menu_window_instance = this;
+
+    life_cycle_controller = CicoSCLifeCycleController::getInstance();
+
+    CicoHomeScreenResourceConfig::GetImagePath(img_dir_path,
+                                               ICO_HS_MAX_PATH_BUFF_LEN);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::~CicoHSMenuWindo
+ *          Destractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSMenuWindow::~CicoHSMenuWindow(void)
+{
+    /* Do not somthing to do */
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::SetMenuBack
+ *          create object and show (background of menu)
+ *
+ * @param[in]   none
+ * @return      ERROR or OK
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHSMenuWindow::SetMenuBack(void)
+{
+    char img_path[ICO_HS_MAX_PATH_BUFF_LEN];
+    /* set menu back */
+    /* image file name*/
+    snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,ICO_HS_IMAGE_FILE_MENU_BACK_GROUND);
+
+    /* set object*/ 
+    rectangle = evas_object_rectangle_add(evas);
+    evas_object_color_set(rectangle,0,0,0,178); 
+    evas_object_move(rectangle, 0, 0);
+    evas_object_resize(rectangle, width,height);
+    evas_object_show(rectangle);
+
+    /* set object*/
+    canvas = evas_object_image_filled_add(evas);
+    evas_object_image_file_set(canvas, img_path, NULL);
+    int err = evas_object_image_load_error_get(canvas);
+    if (err != EVAS_LOAD_ERROR_NONE) {
+        ICO_ERR("CicoHSMenuWindow::SetMenuBack: backgound image is not exist");
+        evas_object_del(canvas);
+        return ICO_ERROR;
+    }
+    evas_object_event_callback_add(canvas, EVAS_CALLBACK_MOUSE_DOWN,
+                                       CicoHSMenuTouch::TouchDownMenu,NULL);
+    evas_object_event_callback_add(canvas, EVAS_CALLBACK_MOUSE_UP,
+                                       CicoHSMenuTouch::TouchUpMenu,NULL);
+    evas_object_move(canvas, 0, 0);
+    evas_object_resize(canvas, width,height);
+    evas_object_show(canvas);
+
+    return ICO_OK;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::FreeMenuBack
+ *          free object (background of menu)
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::FreeMenuBack(void)
+{
+    evas_object_del(canvas);
+    evas_object_del(rectangle);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::GetLayout
+ *          read layout file
+ *
+ * @param[in]   filename   layout file name
+ * @param[out]   layout   layout data
+ * @param[out]   num      num of tile
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoHSMenuWindow::GetLayout(const char *filename,CicoLayoutInfo *layout,int *num)
+{
+    int ret;
+    FILE *fp;
+    *num = 0;
+    fp = fopen(filename,"r");
+    if(fp == NULL){
+        return;
+    }
+    int idx =0;
+    while( ( ret = fscanf( fp, "%d,%d,%d,%d,%d", 
+        &layout[idx].appidx, &layout[idx].page, &layout[idx].position,
+        &layout[idx].tile_width, &layout[idx].tile_height ) ) != EOF ){
+        idx++;
+    }
+    *num = idx;
+    fclose(fp);
+   
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::SetLayout
+ *          write layout file
+ *
+ * @param[in]   filename   layout file name
+ * @param[in]   layout   layout data
+ * @param[in]   num      num of tile
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::SetLayout(const char *filename,CicoLayoutInfo *layout,int num)
+{
+    int ret;
+    FILE *fp;
+    
+    fp = fopen(filename,"w+");
+    if(fp == NULL){
+        return;
+    }
+    for(int ii = 0;ii < num;ii++){
+       ret = fprintf(fp,"%d,%d,%d,%d,%d\n",
+                layout[ii].appidx,layout[ii].page,layout[ii].position,
+                layout[ii].tile_width,layout[ii].tile_height);
+       if(ret < 0){
+           break;
+       }
+    }
+    fclose(fp);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::SetAppTiles
+ *          create object and show (tiles)
+ *
+ * @param[in]   none
+ * @return      ERROR or OK
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHSMenuWindow::SetAppTiles(void)
+{
+    int tile_num = 0;
+    current_page = 0;
+    CicoLayoutInfo layout[ICO_HS_MENU_MAX_TILE_NUM];
+   
+    /* get APP information*/
+    std::vector<CicoSCAilItems> aillist = 
+        life_cycle_controller->getAilList();
+
+    GetLayout(ICO_HS_MENU_LAYOUT_FILE_PATH,layout,&tile_num);
+    if(tile_num != 0){
+        /*layout file exist*/
+        all_page_num = 0;
+        for(int ii =0;ii < tile_num;ii++){
+            
+            /*put tile*/
+            menu_tile[ii] = 
+                new CicoHSMenuTile(aillist[layout[ii].appidx].m_appid.c_str(),
+                aillist[layout[ii].appidx].m_icon.c_str(),
+                layout[ii].page,layout[ii].position,
+                layout[ii].tile_width,layout[ii].tile_height);
+            /*update manu num*/
+            if(layout[ii].page >= all_page_num){
+                all_page_num = layout[ii].page + 1;
+            }
+        }
+        /*menu num*/
+        all_tile_num = tile_num;  
+    }
+    else{
+        /*first time layout*/
+        for(unsigned int ii = 0; ii < aillist.size(); ii++) {
+            /*all application num*/
+            if((aillist[ii].m_noIcon) ||
+                    (strcmp(aillist[ii].m_group.c_str(), 
+                     ICO_HS_GROUP_SPECIAL) == 0)) {
+                ICO_DBG("CicoHSMenuWindow::SetAppTiles :ignore app %s %d",
+                        aillist[ii].m_appid.c_str(),aillist[ii].m_noIcon);
+                continue;
+            }         
+            ICO_DBG("CicoHSMenuWindow::SetAppTiles :SetApp %s %d",
+                    aillist[ii].m_appid.c_str(),aillist[ii].m_noIcon);
+            /* put tile */
+            menu_tile[tile_num] = 
+                new CicoHSMenuTile(aillist[ii].m_appid.c_str(),
+                aillist[ii].m_icon.c_str(),
+                tile_num / ICO_HS_MENUTILE_NUM,tile_num % ICO_HS_MENUTILE_NUM,
+                ICO_HS_MENUTILE_WIDTH,ICO_HS_MENUTILE_HEIGHT);
+            /* layout data */
+            layout[tile_num].appidx = ii;
+            layout[tile_num].page = tile_num / ICO_HS_MENUTILE_NUM;
+            layout[tile_num].position = tile_num % ICO_HS_MENUTILE_NUM;
+            layout[tile_num].tile_width = ICO_HS_MENUTILE_WIDTH;
+            layout[tile_num].tile_height = ICO_HS_MENUTILE_HEIGHT;
+             
+            tile_num++;
+        }
+        /*write layout data*/
+        SetLayout(ICO_HS_MENU_LAYOUT_FILE_PATH,layout,tile_num);
+
+        /*menu num*/
+        all_tile_num = tile_num;    
+        all_page_num = all_tile_num / ICO_HS_MENUTILE_NUM;
+        if(all_tile_num % ICO_HS_MENUTILE_NUM){
+           ++all_page_num;
+        }
+    }
+   
+    /*in case of over max num*/
+    if(all_page_num > ICO_HS_MENU_MAX_MENU_PAGE_NUM){
+       all_page_num = ICO_HS_MENU_MAX_MENU_PAGE_NUM;
+    }
+    /*make tiles*/
+    for (int ii = 0; ii < tile_num; ii++) {
+        if(menu_tile[ii] == NULL){
+            continue;
+        }
+        menu_tile[ii]->CreateObject(evas);
+        if(menu_tile[ii]->GetPage() != 0){
+            /*out of window*/
+            menu_tile[ii]->OffsetMove(width,0);
+        }
+    }
+    return ICO_OK;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::FreeAppTiles
+ *          free object (tiles)
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::FreeAppTiles(void)
+{
+    for(int ii = 0; ii < all_tile_num;ii++){
+        if(menu_tile[ii] == NULL){
+            continue;
+        }
+        menu_tile[ii]->FreeObject();
+        delete menu_tile[ii];
+    }
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::SetPagePointer
+ *          create object and show (page pointer)
+ *
+ * @param[in]   none
+ * @return      ERROR or OK
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHSMenuWindow::SetPagePointer(void)
+{
+    /*debug*/
+    for (int ii = 0; ii < all_page_num; ii++) {
+
+        char img_path[ICO_HS_MAX_PATH_BUFF_LEN];
+        /* set menu back */
+        /* image file name*/
+        if(ii == current_page){
+            snprintf(img_path,sizeof(img_path),"%s%s",
+                     img_dir_path,ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_P);
+        }else{
+            snprintf(img_path,sizeof(img_path),"%s%s",
+                     img_dir_path,ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_N);
+        }
+        /* set object*/
+        page_pointer[ii] = evas_object_image_filled_add(evas);
+        evas_object_image_file_set(page_pointer[ii], img_path, NULL);
+        int err = evas_object_image_load_error_get(page_pointer[ii]);
+        if (err != EVAS_LOAD_ERROR_NONE) {
+            ICO_ERR("CicoHSMenuWindow::SetPagePointer: page pointer image is not exist");
+            evas_object_del(page_pointer[ii]);
+            return ICO_ERROR;
+        }
+        evas_object_event_callback_add(page_pointer[ii], 
+                                       EVAS_CALLBACK_MOUSE_DOWN,
+                                       CicoHSMenuTouch::TouchDownMenu,NULL);
+        evas_object_event_callback_add(page_pointer[ii],
+                                       EVAS_CALLBACK_MOUSE_UP,
+                                       CicoHSMenuTouch::TouchUpMenu,NULL);
+
+        int pos_x = ICO_HS_MENU_PAGE_POINTER_START_POS_X + 
+                    (((width - ICO_HS_MENU_PAGE_POINTER_START_POS_X * 2) / 
+                    all_page_num ) * ii) +       
+                    (((width - ICO_HS_MENU_PAGE_POINTER_START_POS_X * 2) / 
+                    all_page_num ) / 2)  -      
+                    (ICO_HS_MENU_PAGE_POINTER_WIDTH / 2);        
+        evas_object_move(page_pointer[ii], pos_x,
+                         ICO_HS_MENU_PAGE_POINTER_START_POS_Y);
+        evas_object_resize(page_pointer[ii],
+                         ICO_HS_MENU_PAGE_POINTER_WIDTH,
+                         ICO_HS_MENU_PAGE_POINTER_HEIGHT);
+        evas_object_show(page_pointer[ii]);
+    }
+     
+    return ICO_OK;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::FreePagePointer
+ *          free object (page pointer)
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::FreePagePointer(void)
+{
+    for (int ii = 0; ii < all_page_num; ii++) {
+        evas_object_del(page_pointer[ii]);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::SetTerminateButton
+ *          create object and show (terminate button)
+ *
+ * @param[in]   none
+ * @return      ERROR or OK
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHSMenuWindow::SetTerminateButton(void)
+{
+    int err;
+    char img_path[ICO_HS_MAX_PATH_BUFF_LEN];
+    /* set menu back */
+    /* image file name*/
+
+    /* set object*/ 
+    terminate_back = evas_object_rectangle_add(evas);
+    evas_object_color_set(terminate_back,0,0,0,178); 
+    evas_object_move(terminate_back, 0, 0);
+    evas_object_resize(terminate_back, width,height);
+
+    /* set object*/
+    snprintf(img_path,sizeof(img_path),"%s%s",
+                     img_dir_path,ICO_HS_IMAGE_FILE_MENU_TERMINATE_YES);
+    terminate_button_yes = evas_object_image_filled_add(evas);
+    evas_object_image_file_set(terminate_button_yes, img_path, NULL);
+    err = evas_object_image_load_error_get(terminate_button_yes);
+    if (err != EVAS_LOAD_ERROR_NONE) {
+        ICO_ERR("CicoHSMenuWindow::SetTerminateButton: image is not exist");
+        evas_object_del(terminate_button_yes);
+        return ICO_ERROR;
+    }
+    evas_object_event_callback_add(terminate_button_yes, EVAS_CALLBACK_MOUSE_UP,
+                                       CicoHSMenuTouch::TouchUpTerminateYes,
+                                       NULL);
+    evas_object_move(terminate_button_yes, width / 2  - 100 - 64,
+                                           height / 2 + 100);
+    evas_object_resize(terminate_button_yes,100,64);
+
+    /* set object*/
+    snprintf(img_path,sizeof(img_path),"%s%s",
+                     img_dir_path, ICO_HS_IMAGE_FILE_MENU_TERMINATE_NO);
+    terminate_button_no = evas_object_image_filled_add(evas);
+    evas_object_image_file_set(terminate_button_no, img_path, NULL);
+    err = evas_object_image_load_error_get(terminate_button_no);
+    if (err != EVAS_LOAD_ERROR_NONE) {
+        ICO_ERR("CicoHSMenuWindow::SetTerminateButton: image is not exist");
+        evas_object_del(terminate_button_no);
+        return ICO_ERROR;
+    }
+    evas_object_event_callback_add(terminate_button_no, EVAS_CALLBACK_MOUSE_UP,
+                                       CicoHSMenuTouch::TouchUpTerminateNo,
+                                       NULL);
+    evas_object_move(terminate_button_no, width / 2  + 64,
+                                           height / 2 + 100);
+    evas_object_resize(terminate_button_no,100,64);
+
+    /* set object*/
+    snprintf(img_path,sizeof(img_path),"%s%s",
+                     img_dir_path,ICO_HS_IMAGE_FILE_MENU_TERMINATE_REALLY);
+    terminate_really = evas_object_image_filled_add(evas);
+    evas_object_image_file_set(terminate_really, img_path, NULL);
+    err = evas_object_image_load_error_get(terminate_really);
+    if (err != EVAS_LOAD_ERROR_NONE) {
+        ICO_ERR("CicoHSMenuWindow::SetTerminateButton: image is not exist");
+        evas_object_del(terminate_really);
+        return ICO_ERROR;
+    }
+    evas_object_move(terminate_really, width / 2 - 100,
+                                          height / 2 - 100);
+    evas_object_resize(terminate_really,200,64);
+    
+    return ICO_OK;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::FreeTeiminateButton
+ *          free object (terminate button)
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::FreeTerminateButton(void)
+{
+    evas_object_del(terminate_back);
+    evas_object_del(terminate_really);
+    evas_object_del(terminate_button_yes);
+    evas_object_del(terminate_button_no);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::ShowTerminateButton
+ *          show terminate button 
+ *
+ * @param[in]   none
+ * @return      ERROR or OK
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::ShowTerminateButton(void)
+{
+   evas_object_show(terminate_back);
+   evas_object_show(terminate_really);
+   evas_object_show(terminate_button_yes);
+   evas_object_show(terminate_button_no);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::HideTerminateButton
+ *          show terminate button 
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::HideTerminateButton(void)
+{
+   evas_object_hide(terminate_back);
+   evas_object_hide(terminate_really);
+   evas_object_hide(terminate_button_yes);
+   evas_object_hide(terminate_button_no);
+}
+
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::CreateMenuWindow
+ *          Create menu window (page pointer)
+ *
+ * @param[in]   pos_x   window position x
+ * @param[in]   pos_y   window position y
+ * @param[in]   width   window width
+ * @param[in]   height  window height
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+int 
+CicoHSMenuWindow::CreateMenuWindow(int pos_x,int pos_y,int width,int height)
+{
+    int ret;
+    
+    /*create window*/
+    ret = CreateWindow(ICO_HS_MENU_WINDOW_TITLE,
+                       pos_x,pos_y,width,height,EINA_TRUE);
+    if(ret != ICO_OK){
+       return ret;
+    }
+  
+    /*get evas*/     
+    evas = ecore_evas_get(window);
+    if (!evas) {
+        ICO_ERR("CicoHSMenuWindow::CreateMenuWindow: could not get evas.");
+        return ICO_ERROR;
+    }
+
+    /* MenuBack */
+    ret = SetMenuBack();
+    if(ret != ICO_OK){
+        ICO_ERR("CicoHSMenuWindow::CreateMenuWindow: could not make back ground.");
+        FreeWindow();
+        return ICO_ERROR;
+    }
+    /* App tiles*/
+    ret = SetAppTiles();
+    if(ret != ICO_OK){
+        ICO_ERR("CicoHSMenuWindow::CreateMenuWindow: could not make tiles.");
+        FreeMenuBack();
+        FreeWindow();
+        return ICO_ERROR;
+    }
+
+    /* Page Pointer */
+    ret = SetPagePointer();
+    if(ret != ICO_OK){
+        ICO_ERR("CicoHSMenuWindow::CreateMenuWindow: could not make page pointer.");
+        FreeAppTiles();
+        FreeMenuBack();
+        FreeWindow();
+        return ICO_ERROR;
+    }
+
+    /* Page Pointer */
+    ret = SetTerminateButton();
+    if(ret != ICO_OK){
+        ICO_ERR("CicoHSMenuWindow::CreateMenuWindow: could not make teminate button.");
+        FreePagePointer();
+        FreeAppTiles();
+        FreeMenuBack();
+        FreeWindow();
+        return ICO_ERROR;
+    }
+    /* Initialize Action*/ 
+    CicoHSMenuTouch::Initialize(this);
+
+    return ICO_OK;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::FreeMenuWindow
+ *          free menu window
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::FreeMenuWindow(void)
+{
+    FreeTerminateButton();
+    FreePagePointer();
+    FreeAppTiles();
+    FreeMenuBack();
+    FreeWindow();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::MoveToNextAnimation
+ *          animation parts (move to next)
+ *
+ * @param[in]   data    
+ * @param[in]   pos
+ * @return      EINA_TRUE
+ */
+/*--------------------------------------------------------------------------*/
+Eina_Bool
+CicoHSMenuWindow::MoveToNextAnimation(void *data,double pos)
+{
+    int current_page;
+    double frame = ecore_animator_pos_map(pos, ECORE_POS_MAP_LINEAR, 0.5, 1);
+    current_page = reinterpret_cast<int>(data);
+    
+    for(int ii = 0;ii < menu_window_instance->all_tile_num;ii++){
+        if(menu_window_instance->menu_tile[ii] == NULL){
+            continue;
+        }
+        if(menu_window_instance->menu_tile[ii]->GetPage() != current_page -1){
+            continue;
+        }
+        
+        menu_window_instance->menu_tile[ii]->OffsetMove(-1 * 
+                              (menu_window_instance->width * frame),0);
+    } 
+
+    for(int ii = 0;ii < menu_window_instance->all_tile_num;ii++){
+        if(menu_window_instance->menu_tile[ii] == NULL){
+            continue;
+        }
+        if(menu_window_instance->menu_tile[ii]->GetPage()  != current_page){
+            continue;
+        }
+
+        menu_window_instance->menu_tile[ii]->OffsetMove(menu_window_instance->width -
+                                   (menu_window_instance->width * frame),0);
+    }
+    
+    return EINA_TRUE;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::MoveToBackAnimation
+ *          animation parts (move to back)
+ *
+ * @param[in]   data    
+ * @param[in]   pos
+ * @return      EINA_TRUE
+ */
+/*--------------------------------------------------------------------------*/
+Eina_Bool
+CicoHSMenuWindow::MoveToBackAnimation(void *data,double pos)
+{
+
+    int current_page;
+    double frame = ecore_animator_pos_map(pos, ECORE_POS_MAP_LINEAR, 0.5, 1);
+    current_page = reinterpret_cast<int>(data);
+
+    for(int ii = 0;ii < menu_window_instance->all_tile_num;ii++){
+        if(menu_window_instance->menu_tile[ii] == NULL){
+            continue;
+        }
+        if(menu_window_instance->menu_tile[ii]->GetPage()  != current_page){
+            continue;
+        }
+        menu_window_instance->menu_tile[ii]->OffsetMove(-1 * 
+                                 menu_window_instance->width + 
+                                 (menu_window_instance->width * frame),0);
+    }
+    for(int ii = 0;ii < menu_window_instance->all_tile_num;ii++){
+        if(menu_window_instance->menu_tile[ii] == NULL){
+            continue;
+        }
+        if(menu_window_instance->menu_tile[ii]->GetPage()  != current_page + 1){
+            continue;
+        }
+        menu_window_instance->menu_tile[ii]->OffsetMove(menu_window_instance->width * frame,0);
+    }
+
+    return EINA_TRUE;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::GoNextMenu
+ *          menu change to next
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::GoNextMenu(void)
+{
+    char img_path[ICO_HS_MAX_PATH_BUFF_LEN];
+    if(current_page >= all_page_num -1){
+        return;
+    }
+    /*page pointer*/
+    snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_N);
+    evas_object_image_file_set(page_pointer[current_page], img_path, NULL);
+    /* increment*/
+    ++current_page;
+    /*page pointer*/
+    snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_P);
+    evas_object_image_file_set(page_pointer[current_page], img_path, NULL);
+    /*tile*/    
+    ecore_animator_frametime_set(1.0f / 30);
+    ecore_animator_timeline_add(0.4, MoveToNextAnimation,
+                                reinterpret_cast<void*>(current_page));
+
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::GoNextMenu
+ *          menu change to back
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::GoBackMenu(void)
+{
+    char img_path[ICO_HS_MAX_PATH_BUFF_LEN];
+
+    if(current_page <= 0){
+        return;
+    }
+    /*page pointer*/
+    snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_N);
+    evas_object_image_file_set(page_pointer[current_page], img_path, NULL);
+    /*decrement*/
+    --current_page; 
+    /*page pointer*/
+    snprintf(img_path,sizeof(img_path),"%s%s",img_dir_path,ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_P);
+    evas_object_image_file_set(page_pointer[current_page], img_path, NULL);
+    /*tile*/    
+    ecore_animator_frametime_set(1.0f / 30);
+    ecore_animator_timeline_add(0.4, MoveToBackAnimation,
+                                reinterpret_cast<void*>(current_page));
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::SetMenuWindowID
+ *          set appid and surface
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::SetMenuWindowID(const char *appid,int surface)
+{
+    strncpy(this->appid,appid,ICO_HS_MAX_PROCESS_NAME);
+    this->surface = surface;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::Show
+ *          show menu window
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::Show(ico_syc_animation_t *animation)
+{
+    ico_syc_show(appid,surface,animation);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::Hide
+ *          hide menu window
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::Hide(ico_syc_animation_t *animation)
+{ 
+    if(terminate_mode == true){
+        ChangeNormalMode();
+    }
+    ico_syc_hide(appid,surface,animation);
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::ExecuteApp
+ *          execute application
+ *
+ * @param[in]   appid   application id
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::ExecuteApp(const char *appid)
+{
+    if(terminate_mode == true){
+        return;
+    }
+
+    CicoHomeScreen::ExecuteApp(appid);
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::TerminateApp
+ *          teminate application
+ *
+ * @param[in]   appid   application id
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::TerminateApp(const char *appid)
+{
+    CicoHomeScreen::TerminateApp(appid);
+    
+    HideTerminateButton();
+    ChangeNormalMode();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::ChangeTerminateMode
+ *          change to terminate mode
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::ChangeTerminateMode(void)
+{
+    bool check = false;
+    /*check */
+    for (int ii = 0; ii < all_tile_num; ii++) {
+        if(menu_tile[ii] == NULL){
+            continue;
+        }
+        if(CicoHomeScreen::GetAppStatus(menu_tile[ii]->GetAppId()) == true){
+            check = true;
+            break;
+        }
+    }
+    if(check == false){
+        return;
+    }
+
+    /*show term icon*/
+    for (int ii = 0; ii < all_tile_num; ii++) {
+        if(menu_tile[ii] == NULL){
+            continue;
+        }
+        if(CicoHomeScreen::GetAppStatus(menu_tile[ii]->GetAppId()) == false){
+            continue;
+        }
+        menu_tile[ii]->ShowTermIcon();
+    }
+    terminate_mode = true;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::ChangeNormalMode
+ *          change to terminate mode
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSMenuWindow::ChangeNormalMode(void)
+{
+    /*hide term icon*/
+    for (int ii = 0; ii < all_tile_num; ii++) {
+        if(menu_tile[ii] == NULL){
+            continue;
+        }
+        menu_tile[ii]->HideTermIcon();
+    }
+    terminate_mode = false;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::ValidMenuIcon
+ *          tile is icon 
+ *
+ * @param[in]   appid    application ID
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoHSMenuWindow::ValidMenuIcon(const char *appid)
+{
+    for(int ii = 0; ii < all_tile_num; ii++) {
+        if(strncmp(menu_tile[ii]->GetAppId(),appid,ICO_HS_MAX_PROCESS_NAME)==0){
+            menu_tile[ii]->ValidMenuIcon();
+            break;
+        }
+    }
+}   
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::ValidThumbnail
+ *          tile is thumbnail
+ *
+ * @param[in]   appid    application ID
+ * @param[in]   surface  surface 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoHSMenuWindow::ValidThumbnail(const char *appid,int surface)
+{
+    for(int ii = 0; ii < all_tile_num; ii++) {
+        if(strncmp(menu_tile[ii]->GetAppId(),appid,ICO_HS_MAX_PROCESS_NAME)==0){
+            menu_tile[ii]->ValidThumbnail(surface);
+            break;
+        }
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSMenuWindow::SetThumbnail
+ *          tile is thumbnail
+ *
+ * @param[in]   appid    application ID
+ * @param[in]   surface  surface 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoHSMenuWindow::SetThumbnail(const char *appid,int surface)
+{
+    for(int ii = 0; ii < all_tile_num; ii++) {
+        if(strncmp(menu_tile[ii]->GetAppId(),appid,ICO_HS_MAX_PROCESS_NAME)==0){
+            menu_tile[ii]->SetThumbnail(surface);
+            break;
+        }
+    }
+}
+
+
+
diff --git a/src/homescreen/CicoHSMenuWindow.h b/src/homescreen/CicoHSMenuWindow.h
new file mode 100644 (file)
index 0000000..16a06a0
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * 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   Menu Window class
+ *
+ * @date    Aug-08-2013
+ */
+#ifndef __CICO_HS_MENU_WINDOW_H__
+#define __CICO_HS_MENU_WINDOW_H__
+#include <stdio.h>
+#include <pthread.h>
+#include <libwebsockets.h>
+
+#include "ico_syc_common.h"
+#include "ico_syc_winctl.h"
+
+#include <unistd.h>
+#include <Eina.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#include <Ecore_Evas.h>
+#include <Edje.h>
+
+#include "CicoHomeScreenConfig.h"
+#include "CicoHSWindow.h"
+#include "CicoHSMenuTile.h"
+
+#include "CicoHomeScreenCommon.h"
+
+#include "CicoSCAilItems.h"
+#include "CicoSCLifeCycleController.h"
+
+#define ICO_HS_MENU_SHOWING 0
+#define ICO_HS_MENU_HIDING 1
+
+#define ICO_HS_MENU_PAGE_POINTER_START_POS_X 300
+#define ICO_HS_MENU_PAGE_POINTER_START_POS_Y 75
+#define ICO_HS_MENU_PAGE_POINTER_WIDTH 64
+#define ICO_HS_MENU_PAGE_POINTER_HEIGHT 64
+
+#define ICO_HS_MENU_HIDE_ANIMATION_SLIDE "Slide"
+#define ICO_HS_MENU_SHOW_ANIMATION_SLIDE "Slide"
+#define ICO_HS_MENU_HIDE_ANIMATION_FADE "Fade"
+#define ICO_HS_MENU_SHOW_ANIMATION_FADE "Fade"
+#define ICO_HS_MENU_ANIMATION_DURATION 200
+
+typedef struct _CicoLayoutInfo{
+   int appidx;
+   int page;
+   int position;
+   int tile_width;
+   int tile_height;
+}CicoLayoutInfo;
+
+class CicoHSMenuWindow :public CicoHSWindow
+{
+  public:
+    CicoHSMenuWindow();
+    ~CicoHSMenuWindow(void);
+    int Initialize(void);
+    void Finalize(void);
+    void SetMenuWindowID(const char* appid,int sruface);
+    int CreateMenuWindow(int pos_x,int pos_y,int width,int height);
+    void FreeMenuWindow(void);
+    void HSWindowSetting(int orientation);
+    void GoNextMenu(void);
+    void GoBackMenu(void);
+    static Eina_Bool MoveToNextAnimation(void *data,double pos);
+    static Eina_Bool MoveToBackAnimation(void *data,double pos);
+    void Show(ico_syc_animation_t *animation);
+    void Hide(ico_syc_animation_t *animation);
+    void ExecuteApp(const char *appid);
+    void TerminateApp(const char *appid);
+    void ChangeTerminateMode(void);
+    void ChangeNormalMode(void);
+    void ShowTerminateButton(void);
+    void HideTerminateButton(void);
+    void ValidMenuIcon(const char *appid);   
+    void ValidThumbnail(const char *appid,int surface);   
+    void SetThumbnail(const char *appid,int surface);   
+
+    static Eina_Bool MoveDownAnimation(void *data,double pos);
+    static Eina_Bool MoveUpAnimation(void *data,double pos);
+    
+  private:
+    int SetMenuBack(void);
+    void FreeMenuBack(void);
+    int SetAppTiles(void);
+    void FreeAppTiles(void);
+    int SetPagePointer(void);
+    void FreePagePointer(void);
+    int SetTerminateButton(void);
+    void FreeTerminateButton(void);
+    void GetLayout(const char *filename,CicoLayoutInfo *layout,int *num);
+    void SetLayout(const char *filename,CicoLayoutInfo *layout,int num);
+
+    bool terminate_mode;
+    /*for menu control*/
+    int current_page;
+    int all_tile_num;
+    int all_page_num;
+    /* image directory path */
+    char img_dir_path[ICO_HS_MAX_PATH_BUFF_LEN];
+    /* evas object */
+    Evas *evas;         
+    /* menu back */
+    Evas_Object *canvas; 
+    Evas_Object *rectangle; 
+    /* tiles */
+    CicoHSMenuTile *menu_tile[ICO_HS_MENU_MAX_TILE_NUM];
+    /* Page pointer */
+    Evas_Object *page_pointer[ICO_HS_MENU_MAX_MENU_PAGE_NUM]; 
+    /* for window control */
+    char appid[ICO_HS_MAX_PROCESS_NAME];
+    int surface;
+    /*terminate button*/
+    Evas_Object *terminate_back; 
+    Evas_Object *terminate_really; 
+    Evas_Object *terminate_button_yes; 
+    Evas_Object *terminate_button_no; 
+   
+    CicoSCLifeCycleController *life_cycle_controller;
+    /* my instance (for callback) */
+    static CicoHSMenuWindow *menu_window_instance;
+
+  protected:
+    CicoHSMenuWindow operator=(const CicoHSMenuWindow&);
+    CicoHSMenuWindow(const CicoHSMenuWindow&);
+};
+#endif
+
diff --git a/src/homescreen/CicoHSWindow.cpp b/src/homescreen/CicoHSWindow.cpp
new file mode 100644 (file)
index 0000000..8a95d53
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * 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   Window class
+ *
+ * @date    Aug-08-2013
+ */
+#include "CicoHSWindow.h"
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSWindow::CicoHSWindow
+ *          Constractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSWindow::CicoHSWindow(void)
+{
+    window = NULL;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSWindow::~CicoHSWindow
+ *          Destractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSWindow::~CicoHSWindow(void)
+{
+    /* Do not somthing to do */
+    if(window != NULL){
+        FreeWindow();
+    }
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSWindow::CreateWindow
+ *          create new window(ecore evas)
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+int 
+CicoHSWindow::CreateWindow(const char *title,int pos_x,int pos_y,int width,int height,int alpha)
+{
+    this->pos_x = pos_x;
+    this->pos_y = pos_y;
+    this->width = width;
+    this->height = height;
+
+    /* Make a new ecore_evas */
+    window = ecore_evas_new(NULL, pos_x, pos_y, width, height, "frame=0");  
+    /* if do not creted new, enlightenment return NULL */
+    if (!window) {
+        EINA_LOG_CRIT("CicoHSWindow::Initialize: could not create new_window.");
+        return ICO_ERROR;
+    }
+    strncpy(this->title,title,ICO_MAX_TITLE_NAME_LEN);
+    ecore_evas_title_set(window,this->title);
+
+    /* alpha channel is enable*/
+    ecore_evas_alpha_set(window, alpha);
+
+    return ICO_OK;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSWindow::FreeWindow
+ *          Free the window(ecore evas)
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoHSWindow::FreeWindow(void)
+{
+    ecore_evas_free(window);
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSWindow::WindowSetting
+ *          setting to window(ecore evas)
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSWindow::WindowSetting(int pos_x,int pos_y,int width,int height,int alpha)
+{
+    this->pos_x = pos_x;
+    this->pos_y = pos_y;
+    this->width = width;
+    this->height = height;
+
+    /* move */
+    ecore_evas_move(window,pos_x,pos_y);
+    /* resize */
+    ecore_evas_resize(window, width, height);
+    /* alpha channel is enable*/
+    ecore_evas_alpha_set(window, alpha);
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSWindow::ShowWindow
+ *          showing window(ecore evas)
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSWindow::ShowWindow(void)
+{
+    /* showing */
+    ecore_evas_show(window);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSWindow::HideWindow
+ *          hiding window(ecore evas)
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSWindow::HideWindow(void)
+{
+    /* hiding */
+    ecore_evas_hide(window);
+}
+
+
diff --git a/src/homescreen/CicoHSWindow.h b/src/homescreen/CicoHSWindow.h
new file mode 100644 (file)
index 0000000..f981c96
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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   Window class
+ *
+ * @date    Aug-08-2013
+ */
+#ifndef __CICO_HSWINDOW_H__
+#define __CICO_HSWINDOW_H__
+
+#include <stdio.h>
+#include <pthread.h>
+#include <libwebsockets.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <Eina.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#include <Ecore_Evas.h>
+#include <Edje.h>
+
+#include "CicoHomeScreenCommon.h"
+
+#define ICO_ORIENTATION_VERTICAL (1) 
+#define ICO_ORIENTATION_HORIZONTAL (2)
+
+#define ICO_MAX_TITLE_NAME_LEN 64
+
+class CicoHSWindow
+{
+  public:
+    CicoHSWindow(void);
+    ~CicoHSWindow(void);
+    int CreateWindow(const char *title,int pos_x,int pos_y,int width,int height,int alpha);
+    void FreeWindow(void);
+    void WindowSetting(int pos_x,int pos_y,int width,int height,int alpha);
+    void ShowWindow(void);
+    void HideWindow(void);
+  private:
+
+  protected:
+    CicoHSWindow operator=(const CicoHSWindow&);
+    CicoHSWindow(const CicoHSWindow&);
+
+    char title[ICO_MAX_TITLE_NAME_LEN];
+    int pos_x;
+    int pos_y;
+    int width; /*width*/
+    int height; /*height*/
+    Ecore_Evas *window; /* ecore-evas object */
+
+};
+
+#endif
diff --git a/src/homescreen/CicoHSWindowController.cpp b/src/homescreen/CicoHSWindowController.cpp
new file mode 100644 (file)
index 0000000..d9e1678
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * 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   window control
+ *
+ * @date    Aug-08-2013
+ */
+#include "CicoHSWindowController.h"
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSWindowController::Initialize
+ *          Initialize
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSWindowController::Initialize(void)
+{
+    int ret;
+    /* Reset a ecore_evas */
+    ret = ecore_evas_init();
+    ICO_DBG("CicoHSWindowController::Initialize: ecore_evas_init retrun %d",
+            ret);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSWindowController::Finalize
+ *          Finalize
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoHSWindowController::Finalize(void)
+{
+    /* end the ecore_evas */
+    ecore_evas_shutdown();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSWindowController::GetFullScreenSize
+ *          get size of full screen
+ *
+ * @param[in]   orientation    vertial or horizontal
+ * @param[out]   width          width of window
+ * @param[out]   height         heigth of window
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSWindowController::GetFullScreenSize(int orientation,int *width,int *height)
+{
+    int display_width, display_height;
+    Ecore_Evas *window;
+    ICO_DBG("CicoHSWindowController::GetFullScreenSize:ecore_evas_new start");
+    window = ecore_evas_new(NULL,0,0,1,1,"frame=0");
+    ICO_DBG("CicoHSWindowController::GetFullScreenSize: ecore_evas_new return 0x%x",window);
+    /* processing one cycle */
+//    ecore_main_loop_iterate();
+
+    /* getting size of screen */
+    /* home screen size is full of display*/
+    
+    ecore_wl_screen_size_get(&display_width, &display_height);
+    if (orientation == ICO_ORIENTATION_VERTICAL) {
+        *width = display_width > display_height ?
+                                 display_height : display_width;
+        *height = (display_width > display_height ?
+                                 display_width : display_height);
+    }
+    else {
+        *width = display_width < display_height ?
+                                 display_height : display_width;
+        *height = (display_width < display_height ?
+                                   display_width : display_height);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSWindowController::StartEcoreLoop
+ *          start loop
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSWindowController::StartEcoreLoop(void)
+{
+    /* Start main loop */
+    ecore_main_loop_begin();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHSWindowController::QuitEcoreLoop
+ *          quit loop
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHSWindowController::QuitEcoreLoop(void)
+{
+    /* Quit main loop */
+    ecore_main_loop_quit();
+}
+
diff --git a/src/homescreen/CicoHSWindowController.h b/src/homescreen/CicoHSWindowController.h
new file mode 100644 (file)
index 0000000..ad023b5
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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   window control
+ *
+ * @date    Aug-08-2013
+ */
+#ifndef __CICO_HSWINDOW_CONTROLLER_H__
+#define __CICO_HSWINDOW_CONTROLLER_H__
+#include <stdio.h>
+#include <pthread.h>
+#include <libwebsockets.h>
+
+#include <unistd.h>
+#include <Eina.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#include <Ecore_Evas.h>
+#include <Edje.h>
+
+#include "CicoHSWindow.h"
+
+class CicoHSWindowController
+{
+  public:
+    static void Initialize(void);
+    static void Finalize(void);
+    static void GetFullScreenSize(int orientation,int *width,int *height);
+    static void StartEcoreLoop(void);
+    static void QuitEcoreLoop(void);
+  private:
+  protected:
+    CicoHSWindowController operator=(const CicoHSWindowController&);
+    CicoHSWindowController(const CicoHSWindowController&);
+};
+
+#endif
+
diff --git a/src/homescreen/CicoHomeScreen.cpp b/src/homescreen/CicoHomeScreen.cpp
new file mode 100644 (file)
index 0000000..7ce8768
--- /dev/null
@@ -0,0 +1,1079 @@
+/*
+ * 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   Home Screen
+ *
+ * @date    Aug-08-2013
+ */
+#include "CicoHomeScreen.h"
+
+/*============================================================================*/
+/* static members                                                             */
+/*============================================================================*/
+CicoHomeScreen * CicoHomeScreen::hs_instance;
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::CicoHomeScreen
+ *          Constractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHomeScreen::CicoHomeScreen(void)
+{
+    application_num = 0;
+    for(int ii = 0;ii < ICO_HS_MAX_APP_NUM;ii++){
+        apps_info[ii] = NULL;
+    }
+
+    hs_app_info = NULL;
+    sb_app_info = NULL;
+    os_app_info = NULL;
+    full_width = 1;
+    full_height = 1;
+    menu_width = 1;
+    menu_height = 1;
+    bg_width = 1;
+    bg_height = 1;
+    ctl_bar_width = 1;
+    ctl_bar_height = 1;
+
+    menu_window = NULL;
+    back_window = NULL;
+    ctl_bar_window = NULL;
+
+    //mode = ICO_HS_MODE_MENU;
+    mode = ICO_HS_MODE_APPLICATION;
+    config = NULL;
+    hs_instance = NULL;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::~CicoHomeScreen
+ *          Destractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHomeScreen::~CicoHomeScreen(void)
+{
+    /* Do not somthing to do */
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::ShowHomeScreenLayer
+ *          Show Home screen layer
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::ShowHomeScreenLayer(void)
+{
+    /*show home screen layers*/
+    ico_syc_show_layer(HS_LAYER_APPLICATION);
+    ico_syc_show_layer(HS_LAYER_HOMESCREEN);
+    ico_syc_show_layer(HS_LAYER_TOUCH);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::GetHsPackageName
+ *          get HomeScreen package name
+ *
+ * @param[in]   none
+ * @return      package name
+ */
+/*--------------------------------------------------------------------------*/
+char *
+CicoHomeScreen::GetHsPackageName(void)
+{
+    return hs_package_name;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::GetHsPackageName
+ *          get StatusBar package name
+ *
+ * @param[in]   none
+ * @return      package name
+ */
+/*--------------------------------------------------------------------------*/
+char *
+CicoHomeScreen::GetSbPackageName(void)
+{
+    return sb_package_name;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::GetHsPackageName
+ *          get OnScreen package name
+ *
+ * @param[in]   none
+ * @return      package name
+ */
+/*--------------------------------------------------------------------------*/
+char *
+CicoHomeScreen::GetOsPackageName(void)
+{
+    return os_package_name;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::CreateAppInfoList
+ *          create application info list
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::CreateAppInfoList(void)
+{
+    /* get APP information*/
+    std::vector<CicoSCAilItems> aillist = life_cycle_controller->getAilList();
+
+    for(int ii = 0; ii < ICO_HS_MAX_APP_NUM; ii++) {
+        if(apps_info[ii] != NULL){
+            delete apps_info[ii];
+        }
+    }
+
+    /*create instance*/
+    application_num = 0;
+    for(unsigned int ii = 0; 
+        (ii < aillist.size()) && (ii < ICO_HS_MAX_APP_NUM);
+        ii++) {
+        apps_info[ii] = new CicoHSAppInfo(aillist[ii].m_appid.c_str());
+        application_num++;
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::GetAppInfo
+ *          get application info
+ *
+ * @param[in]   appid    application id
+ * @return      Application info
+ */
+/*--------------------------------------------------------------------------*/
+CicoHSAppInfo *
+CicoHomeScreen::GetAppInfo(const char *appid)
+{
+    for(int ii = 0;ii < application_num;ii++){
+        if(strcmp(apps_info[ii]->GetAppId(),appid) == 0){
+            return apps_info[ii];
+        }
+    }
+    return NULL;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::GetAppStatus
+ *          get application status
+ *
+ * @param[in]   appid    application id
+ * @return      Application info
+ */
+/*--------------------------------------------------------------------------*/
+bool
+CicoHomeScreen::GetAppStatus(const char *appid)
+{
+    for(int ii = 0;ii < hs_instance->application_num;ii++){
+        if(strcmp(hs_instance->apps_info[ii]->GetAppId(),appid) == 0){
+            return hs_instance->apps_info[ii]->GetStatus();
+        }
+    }
+    return false;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::GetWindowInfo
+ *          get window info 
+ *
+ * @param[in]   appinfo    application info
+ * @param[in]   window    window name
+ * @return      Window info
+ */
+/*--------------------------------------------------------------------------*/
+ico_hs_window_info *
+CicoHomeScreen::GetWindowInfo(CicoHSAppInfo *appinfo,const char *window)
+{
+    return appinfo->GetWindowInfo(window);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::UpdateTile
+ *          update tile image
+ *
+ * @param[in]   appid    application id
+ * @return      Window info
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::UpdateTile(const char *appid)
+{
+    CicoHSAppInfo *appinfo = GetAppInfo(appid);
+    if(appinfo == NULL){
+        return;
+    }
+    if(appinfo->GetStatus() == false){
+        //show icon
+        menu_window->ValidMenuIcon(appid);
+        ICO_DBG("CicoHomeScreen::UpdateTile: show menuIcon %s",appid);
+    }else{
+        //show thumbnail
+        menu_window->ValidThumbnail(appid,appinfo->GetLastSurface());
+        ICO_DBG("CicoHomeScreen::ExecuteApp_i: raise app %s",appid);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::ExecuteApp_i
+ *          execute and showing application
+ *
+ * @param[in]   appid    application id
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::ExecuteApp_i(const char *appid)
+{
+    CicoHSAppInfo *appinfo = GetAppInfo(appid);
+    if(appinfo == NULL){
+        return;
+    }
+
+    if(appinfo->GetStatus() == false){
+        //execute
+        appinfo->Execute();
+        ICO_DBG("CicoHomeScreen::ExecuteApp_i: execute app %s",appid);
+    }else{
+        //raise
+        RaiseApplicationWindow(appinfo->GetAppId(),appinfo->GetLastSurface());
+        ICO_DBG("CicoHomeScreen::ExecuteApp_i: raise app %s",appid);
+    }
+    /* hide HomeScreen layer                        */
+    if(GetMode() == ICO_HS_MODE_MENU){
+        ChangeMode(ICO_HS_SHOW_HIDE_PATTERN_FADE);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::TerminateApp_i
+ *          teminate application
+ *
+ * @param[in]   appid    application id
+ * @return      none
+ *
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::TerminateApp_i(const char *appid)
+{
+    if(appid != NULL){
+        CicoHSAppInfo *appinfo = GetAppInfo(appid);
+        if(appinfo == NULL){
+            return;
+        }
+
+        //terminate
+        appinfo->Terminate();
+    }
+    /* hide HomeScreen layer                        */
+    if(GetMode() == ICO_HS_MODE_MENU){
+        ChangeMode(ICO_HS_SHOW_HIDE_PATTERN_FADE);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::ShowHomeScreenWindow
+ *          show window (home screen)
+ *
+ * @param[in]   win attr    window attribute
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::ShowHomeScreenWindow(ico_syc_win_attr_t *win_attr)
+{
+    ico_syc_win_move_t move;
+    int layer;
+    move.zone = NULL;
+    move.pos_x = 0;
+    move.width = full_width;
+  
+    if(strncmp(win_attr->name,ICO_HS_BACK_WINDOW_TITLE,
+               ICO_MAX_TITLE_NAME_LEN) == 0){
+        move.pos_y = ICO_HS_STATUSBAR_WINDOW_HEIGHT;
+        move.height = full_height - ICO_HS_STATUSBAR_WINDOW_HEIGHT -
+                      ICO_HS_CONTROLBAR_WINDOW_HEIGHT;
+        layer = HS_LAYER_BACKGROUND;
+    }else if(strncmp(win_attr->name,ICO_HS_CONTROL_BAR_WINDOW_TITLE,
+             ICO_MAX_TITLE_NAME_LEN) == 0){
+        move.pos_y = full_height - ICO_HS_CONTROLBAR_WINDOW_HEIGHT;
+        move.height = ICO_HS_CONTROLBAR_WINDOW_HEIGHT;
+        layer = HS_LAYER_TOUCH;
+    }else if(strncmp(win_attr->name,ICO_HS_MENU_WINDOW_TITLE,
+             ICO_MAX_TITLE_NAME_LEN) == 0){
+        move.pos_y = ICO_HS_STATUSBAR_WINDOW_HEIGHT;
+        move.height = full_height - ICO_HS_STATUSBAR_WINDOW_HEIGHT - 
+                      ICO_HS_CONTROLBAR_WINDOW_HEIGHT;
+        layer = HS_LAYER_HOMESCREEN;
+    }else{
+        /*do nothing*/
+        return;
+    }
+
+    ico_syc_change_layer(win_attr->appid,win_attr->surface,layer);
+    ICO_DBG("CicoHomeScreen::ShowHomeScreenWindow: id(%s) name(%s) surface(%d) pos(%d,%d) size(%d,%d)",win_attr->appid,
+            win_attr->name,win_attr->surface,move.pos_x,move.pos_y,
+            move.width,move.height);
+    ico_syc_move(win_attr->appid,win_attr->surface,&move,NULL);
+    
+    /*first time menu is unvisible*/
+    if((strncmp(win_attr->name,ICO_HS_MENU_WINDOW_TITLE,
+             ICO_MAX_TITLE_NAME_LEN) == 0) && 
+       (GetMode() == ICO_HS_MODE_APPLICATION)){
+        return;
+    }
+
+    ico_syc_show(win_attr->appid, win_attr->surface,NULL);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::ShowStatusBarWindow
+ *          show window (home screen)
+ *
+ * @param[in]   win attr    window attribute
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::ShowStatusBarWindow(ico_syc_win_attr_t *win_attr)
+{
+    ico_syc_win_move_t move;
+    int layer;
+    move.zone = NULL;
+    move.pos_x = 0;
+    move.pos_y = 0;
+    move.width = full_width;
+    move.height = ICO_HS_STATUSBAR_WINDOW_HEIGHT;
+    layer = HS_LAYER_HOMESCREEN;
+
+    ico_syc_change_layer(win_attr->appid,win_attr->surface,layer);
+    ICO_DBG("CicoHomeScreen::ShowStatusBarWindow: id(%s) name(%s) surface(%d) pos(%d,%d) size(%d,%d)",win_attr->appid,
+            win_attr->name,win_attr->surface,move.pos_x,move.pos_y,
+            move.width,move.height);
+    ico_syc_move(win_attr->appid,win_attr->surface,&move,NULL);
+    ico_syc_show(win_attr->appid, win_attr->surface,NULL);
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::ShowApplicationWindow
+ *          show window (application)
+ *
+ * @param[in]   win attr    window attribute
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::ShowApplicationWindow(ico_syc_win_attr_t *win_attr)
+{
+
+    ico_syc_win_move_t move;
+    int layer;
+    move.zone = 0;
+    move.pos_x = 0;
+    move.width = full_width;
+    move.pos_y = ICO_HS_STATUSBAR_WINDOW_HEIGHT;
+    move.height = full_height - ICO_HS_STATUSBAR_WINDOW_HEIGHT -
+                  ICO_HS_CONTROLBAR_WINDOW_HEIGHT;
+    layer = HS_LAYER_APPLICATION;
+    
+    ico_syc_change_layer(win_attr->appid,win_attr->surface,layer);
+    ico_syc_move(win_attr->appid,win_attr->surface,&move,NULL);
+    ico_syc_show(win_attr->appid, win_attr->surface,NULL);
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::RaiseApplicationWindow
+ *          raise window (application)
+ *
+ * @param[in]   appid      application id
+ * @param[in]   surface    surface
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::RaiseApplicationWindow(const char *appid,int surface)
+{
+    ico_syc_show(appid, surface,NULL);
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::EventCallBack
+ *          callback for system controller
+ *
+ * @param[in]   event      kind of event
+ * @param[in]   detail     detail 
+ * @param[in]   user_data  user data
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::EventCallBack(const ico_syc_ev_e event,
+                              const void *detail,void *user_data)
+{
+    ICO_DBG("CicoHomeScreen::EventCallBack: start (event %d)",event);
+    if(event == ICO_SYC_EV_WIN_CREATE){
+        ico_syc_win_info_t *win_info = 
+            reinterpret_cast<ico_syc_win_info_t*>(const_cast<void*>(detail));
+        ICO_DBG("CicoHomeScreen::EventCallBack : win create %s %i",
+                win_info->appid,win_info->surface); 
+        /*only save information*/
+        if(strncmp(win_info->appid, hs_instance->GetHsPackageName(),
+                   ICO_HS_MAX_PROCESS_NAME) == 0){
+           /*Home Screen*/
+           hs_instance->hs_app_info->AddWindowInfo(win_info);
+        }else if(strncmp(win_info->appid, 
+                         hs_instance->GetSbPackageName(),
+                         ICO_HS_MAX_PROCESS_NAME) == 0){
+            /*Status Bar*/
+            hs_instance->sb_app_info->AddWindowInfo(win_info);
+        }else if(strncmp(win_info->appid, 
+                         hs_instance->GetOsPackageName(),
+                         ICO_HS_MAX_PROCESS_NAME) == 0){
+            /*On Screen*/
+            hs_instance->os_app_info->AddWindowInfo(win_info);
+        }else{
+            /*Application*/
+            CicoHSAppInfo *appinfo = 
+                       hs_instance->GetAppInfo(win_info->appid);
+            if(appinfo == NULL){
+                return;
+            }
+            appinfo->AddWindowInfo(win_info);
+        }
+    }
+    else if(event == ICO_SYC_EV_WIN_DESTROY){
+        ico_syc_win_info_t *win_info = 
+            reinterpret_cast<ico_syc_win_info_t*>(const_cast<void*>(detail));
+        ICO_DBG("CicoHomeScreen::EventCallBack : win delete %s %i",
+                win_info->appid,win_info->surface); 
+        /*only save information*/
+        if(strncmp(win_info->appid, hs_instance->GetHsPackageName(),
+                   ICO_HS_MAX_PROCESS_NAME) == 0){
+            hs_instance->hs_app_info->FreeWindowInfo(win_info->name);
+        }else if(strncmp(win_info->appid, 
+                         hs_instance->GetSbPackageName(),
+                         ICO_HS_MAX_PROCESS_NAME) == 0){
+            hs_instance->sb_app_info->FreeWindowInfo(win_info->name);
+        }else if(strncmp(win_info->appid, 
+                         hs_instance->GetOsPackageName(),
+                         ICO_HS_MAX_PROCESS_NAME) == 0){
+            hs_instance->os_app_info->FreeWindowInfo(win_info->name);
+        }else{
+            /*Application*/
+            CicoHSAppInfo *appinfo = 
+                       hs_instance->GetAppInfo(win_info->appid);
+            if(appinfo == NULL){
+                return;
+            }
+            hs_instance->UpdateTile(win_info->appid);
+            appinfo->FreeWindowInfo(win_info->name);
+        }
+    }
+    else if(event == ICO_SYC_EV_WIN_ACTIVE){
+        ico_syc_win_info_t *win_info = 
+            reinterpret_cast<ico_syc_win_info_t*>(const_cast<void*>(detail));
+        /*if application*/ 
+        CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(win_info->appid);
+        if(appinfo == NULL){
+            return;
+        }
+        appinfo->SetLastSurface(win_info->surface);
+    }
+    else if(event == ICO_SYC_EV_WIN_ATTR_CHANGE){
+        ico_syc_win_attr_t *win_attr = 
+            reinterpret_cast<ico_syc_win_attr_t*>(const_cast<void*>(detail));
+        ICO_DBG("CicoHomeScreen::EventCallBack : win attr %s %s %d",
+                win_attr->appid,win_attr->name,win_attr->surface); 
+        if(strncmp(win_attr->appid, hs_instance->GetHsPackageName(),
+                   ICO_HS_MAX_PROCESS_NAME) == 0){
+            /*Home Screen*/
+            hs_instance->hs_app_info->AddWindowAttr(win_attr);
+            /*when Menu window*/
+            if(strncmp(win_attr->name,ICO_HS_MENU_WINDOW_TITLE,
+                       ICO_MAX_TITLE_NAME_LEN) == 0){
+                hs_instance->menu_window->SetMenuWindowID(win_attr->appid,
+                    win_attr->surface);
+            }
+            ico_hs_window_info * l_win_info = 
+                     hs_instance->GetWindowInfo(hs_instance->hs_app_info,
+                                                win_attr->name);
+            if(l_win_info == NULL){
+                return;
+            }
+            if(hs_instance->hs_app_info->GetShowed(l_win_info) == true){
+                return; 
+            }
+            /*show window*/
+            hs_instance->ShowHomeScreenWindow(win_attr);
+            hs_instance->hs_app_info->SetShowed(l_win_info,true);
+        }else if(strncmp(win_attr->appid, hs_instance->GetSbPackageName(),
+                         ICO_HS_MAX_PROCESS_NAME) == 0){
+            /*Status Bar*/
+            hs_instance->sb_app_info->AddWindowAttr(win_attr);
+            ico_hs_window_info * l_win_info = 
+                     hs_instance->GetWindowInfo(hs_instance->sb_app_info,
+                                                win_attr->name);
+            if(l_win_info == NULL){
+                return;
+            }
+            if(hs_instance->sb_app_info->GetShowed(l_win_info) == true){
+                return; 
+            }
+            hs_instance->ShowStatusBarWindow(win_attr);
+            hs_instance->sb_app_info->SetShowed(l_win_info,true);
+        }else if(strncmp(win_attr->appid, hs_instance->GetOsPackageName(),
+                         ICO_HS_MAX_PROCESS_NAME) == 0){
+            /*On Screen*/
+            hs_instance->os_app_info->AddWindowAttr(win_attr);
+        }else{
+            ICO_DBG("CicoHomeScreen::EventCallBack : application window %s %s",
+                win_attr->appid,win_attr->name); 
+            /*Application*/
+            CicoHSAppInfo *appinfo = hs_instance->GetAppInfo(win_attr->appid);
+            if(appinfo == NULL){
+                return;
+            }
+            ico_hs_window_info * l_win_info = 
+                      hs_instance->GetWindowInfo(appinfo,
+                                                win_attr->name);
+            if(l_win_info == NULL){
+                return;
+            }
+            if(appinfo->GetShowed(l_win_info) == true){
+                return; 
+            }
+            
+            appinfo->AddWindowAttr(win_attr);
+            appinfo->SetLastSurface(win_attr->surface);
+            hs_instance->ShowApplicationWindow(win_attr);
+            ico_syc_change_active(win_attr->appid,win_attr->surface);
+            hs_instance->UpdateTile(win_attr->appid);
+            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);
+        if(appinfo == NULL){
+            return;
+        }
+        //show icon
+        hs_instance->menu_window->SetThumbnail(thumb_info->appid,thumb_info->surface);
+    }
+    else if(event == ICO_SYC_EV_LAYER_ATTR_CHANGE){
+   
+    }
+    else if(event == ICO_SYC_EV_USERLIST){
+   
+    }
+    else if(event == ICO_SYC_EV_AUTH_FAIL){
+   
+    }
+    else if(event == ICO_SYC_EV_RES_ACQUIRE){
+   
+    }
+    else if(event == ICO_SYC_EV_RES_DEPRIVE){
+   
+    }
+    else if(event == ICO_SYC_EV_RES_WAITING){
+   
+    }
+    else if(event == ICO_SYC_EV_RES_REVERT){
+   
+    }
+    else if(event == ICO_SYC_EV_RES_RELEASE){
+   
+    }
+    else if(event == ICO_SYC_EV_INPUT_SET){
+   
+    }
+    else if(event == ICO_SYC_EV_INPUT_UNSET){
+   
+    }
+    ICO_DBG("CicoHomeScreen::EventCallBack: end");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::StartRelations
+ *          Execute Onscreen and Statusbar
+ *
+ * @param[in]   none
+ * @return      OK
+ */
+/*--------------------------------------------------------------------------*/
+int 
+CicoHomeScreen::StartRelations(void)
+{
+    int ret; 
+    strncpy(sb_package_name,
+            (char *)config->ConfigGetString(ICO_HS_CONFIG_HOMESCREEN,
+                                             ICO_HS_CONFIG_SB,
+                                             ICO_HS_APPID_DEFAULT_SB),
+            ICO_HS_MAX_PROCESS_NAME);
+    strncpy(os_package_name,
+             (char *)config->ConfigGetString(ICO_HS_CONFIG_HOMESCREEN,
+                                             ICO_HS_CONFIG_ONS,
+                                             ICO_HS_APPID_DEFAULT_ONS),
+            ICO_HS_MAX_PROCESS_NAME);
+    /* start onscreen & statusbar apps */
+#if 0
+    os_app_info = new CicoHSAppInfo(os_package_name);
+    ret = os_app_info->Execute();
+    if (ret < 0) {
+        ICO_WRN("execute failed(%s) err=%d", os_package_name, ret);
+    } 
+#endif
+
+    sb_app_info = new CicoHSAppInfo(sb_package_name); 
+    ret = sb_app_info->Execute();
+    if (ret < 0) {
+        ICO_WRN("execute failed(%s) err=%d", sb_package_name, ret);
+    }
+    return ICO_OK;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::Initialize
+ *          Initialize
+ *
+ * @param[in]   orientation    vertical or horizontal 
+ * @param[in]   config         config 
+ * @return      OK or ERROR
+ */
+/*--------------------------------------------------------------------------*/
+int 
+CicoHomeScreen::Initialize(int orientation,CicoHomeScreenConfig *config)
+{
+    
+    ICO_DBG("CicoHomeScreen::Initialize: start"); 
+    /*save instance pointer */
+    hs_instance = this;
+
+    /*config copy*/
+    this->config = config;
+
+    /* get pkg name (home screen,status bar,on screen)*/
+    char *pkg;
+    ICO_DBG("CicoHomeSceen::Initialize: %s: %s", 
+            getenv("HOME"), getenv("PKG_NAME"));
+    pkg = getenv("PKG_NAME");
+    memset(hs_package_name, 0, ICO_HS_MAX_PROCESS_NAME);
+    if(pkg){
+        strncpy(hs_package_name, pkg, ICO_HS_MAX_PROCESS_NAME);
+    }
+    else{
+        strncpy(hs_package_name, ICO_HS_PROC_DEFAULT_HOMESCREEN,
+                ICO_HS_MAX_PROCESS_NAME);
+    }
+
+    /* Initialize WindowController */
+    CicoHSWindowController::Initialize();
+    ICO_DBG("CicoHomeScreen::Initialize: window controller initialized"); 
+    
+    ICO_DBG("CicoHomeScreen::Initialize: start connect to systemcontroller"); 
+    ico_syc_connect(EventCallBack,NULL);
+    ICO_DBG("CicoHomeScreen::Initialize: end connect to systemcontroller"); 
+    
+    /*init lifecycle controller*/
+    CicoSCSystemConfig::getInstance()->load(ICO_HS_LIFECYCLE_CONTROLLER_SETTING_PATH);
+    life_cycle_controller = CicoSCLifeCycleController::getInstance();
+    
+    /*initialize system controller*/
+    /*my info*/
+    ICO_DBG("CicoHomeScreen::Initialize: get package name %s",hs_package_name); 
+    hs_app_info = new CicoHSAppInfo(hs_package_name); 
+    
+    /*start home statusbar and onscreen*/ 
+    StartRelations();
+    ICO_DBG("CicoHomeScreen::Initialize: start relation apps"); 
+    /* Get screen size */
+    CicoHSWindowController::GetFullScreenSize(orientation,
+                                              &full_width,&full_height);
+
+    ICO_DBG("full screen size x=%d y=%d",full_width,full_height);
+
+    /* MenuScreen Window Size */
+    menu_width = full_width;
+    menu_height = full_height - ICO_HS_STATUSBAR_WINDOW_HEIGHT - 
+                  ICO_HS_CONTROLBAR_WINDOW_HEIGHT;
+
+    /* BackGround Window Size */
+    bg_width = full_width;
+    bg_height = full_height;
+
+    /* Control Bar Window Size */
+    ctl_bar_width = full_width;
+    ctl_bar_height = ICO_HS_CONTROLBAR_WINDOW_HEIGHT;
+
+    ICO_DBG("CicoHomeScreen::Initialize: end"); 
+
+    return ICO_OK;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::Finalize
+ *          Finalize
+ *
+ * @param[in]   none 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoHomeScreen::Finalize(void)
+{
+    /* Finalize WindowController */
+    CicoHSWindowController::Finalize();
+
+    ico_syc_disconnect();
+
+    delete hs_app_info;   
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::CreateMenuWindow
+ *          create menu window
+ *
+ * @param[in]   none 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::CreateMenuWindow(void)
+{
+    /*create window*/
+    menu_window = new CicoHSMenuWindow();
+    menu_window->CreateMenuWindow(ICO_HS_WINDOW_POS_X,ICO_HS_WINDOW_POS_Y,
+                                  menu_width,menu_height);  
+    menu_window->ShowWindow(); 
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::DeleteMenuWindow
+ *          delete menu window
+ *
+ * @param[in]   none 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::DeleteMenuWindow(void)
+{
+    if(menu_window == NULL){
+        return;
+    }
+    menu_window->FreeMenuWindow();
+    delete menu_window;
+
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::UpdateMenuWindow
+ *          update menu window
+ *
+ * @param[in]   none 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::UpDateMenuWindow(void)
+{
+    DeleteMenuWindow();
+    CreateMenuWindow();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::CreateBackWindow
+ *          create back window
+ *
+ * @param[in]   none 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::CreateBackWindow(void)
+{
+    /*create window*/
+    back_window = new CicoHSBackWindow();
+    back_window->CreateBackWindow(ICO_HS_WINDOW_POS_X,ICO_HS_WINDOW_POS_Y,
+                                  bg_width,bg_height);  
+    back_window->ShowWindow(); 
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::CreateBackWindow
+ *          create back window
+ *
+ * @param[in]   none 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::DeleteBackWindow(void)
+{
+    if(back_window == NULL){
+        return;
+    }
+    back_window->FreeBackWindow();
+    delete back_window;
+
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::UpDateBackWindow
+ *          update back window
+ *
+ * @param[in]   none 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::UpDateBackWindow(void)
+{
+    DeleteBackWindow();
+    CreateBackWindow();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::CreateControlBarWindow
+ *          create control bar window
+ *
+ * @param[in]   none 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::CreateControlBarWindow(void)
+{
+    /*create window*/
+    ctl_bar_window = new CicoHSControlBarWindow();
+    ctl_bar_window->CreateControlBarWindow(ICO_HS_MENU_WINDOW_POS_X,bg_height - 
+                                           ctl_bar_height,ctl_bar_width,
+                                           ctl_bar_height);  
+    ctl_bar_window->ShowWindow(); 
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::CreateControlBarWindow
+ *          delete control bar window
+ *
+ * @param[in]   none 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::DeleteControlBarWindow(void)
+{
+    if(ctl_bar_window == NULL){
+        return;
+    }
+    ctl_bar_window->FreeControlBarWindow();
+    delete ctl_bar_window;
+
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::StartLoop
+ *          start ecore loop
+ *
+ * @param[in]   none 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::StartLoop(void)
+{
+    CicoHSWindowController::StartEcoreLoop();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::StartHomeScreen
+ *          start home screen
+ *
+ * @param[in]   none 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::StartHomeScreen()
+{
+    /*Get application info*/
+    CreateAppInfoList();
+
+    /*Create window*/
+    CreateBackWindow();
+
+    /*Create window*/
+    CreateControlBarWindow();
+
+    /*Create window*/
+    CreateMenuWindow();
+
+    /*Show Home Screen*/
+    ShowHomeScreenLayer();
+
+    /* start loop*/
+    StartLoop();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::GetMode
+ *          Get status
+ *
+ * @param[in]   mode status
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHomeScreen::GetMode(void)
+{
+    return mode;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::SetMode
+ *          Set status
+ *
+ * @param[in]   mode status
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::SetMode(int mode)
+{
+    this->mode = mode;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::ChangeMode
+ *          Change status
+ *
+ * @param[in]   none 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::ChangeMode(int pattern)
+{
+    if(hs_instance->menu_window == NULL){
+        return; 
+    }
+
+    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;
+        }else{
+            animation.name = ICO_HS_MENU_HIDE_ANIMATION_FADE;
+        }
+        animation.time = ICO_HS_MENU_ANIMATION_DURATION;
+        hs_instance->menu_window->Hide(&animation);
+        hs_instance->SetMode(ICO_HS_MODE_APPLICATION);
+    }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;
+        }else{
+            animation.name = ICO_HS_MENU_SHOW_ANIMATION_FADE;
+        }
+        animation.time = ICO_HS_MENU_ANIMATION_DURATION;
+        hs_instance->menu_window->Show(&animation);
+        hs_instance->SetMode(ICO_HS_MODE_MENU);
+    }
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::ExecuteApp
+ *          execute application
+ *
+ * @param[in]   appid
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::ExecuteApp(const char*appid)
+{
+    hs_instance->ExecuteApp_i(appid);
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreen::TerminateApp
+ *          teminate application
+ *
+ * @param[in]   appid
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreen::TerminateApp(const char*appid)
+{
+    hs_instance->TerminateApp_i(appid);
+}
+
+
diff --git a/src/homescreen/CicoHomeScreen.h b/src/homescreen/CicoHomeScreen.h
new file mode 100644 (file)
index 0000000..a9857e6
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * 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   Home Screen
+ *
+ * @date    Aug-08-2013
+ */
+#ifndef __CICO_HOME_SCREEN_H__
+#define __CICO_HOME_SCREEN_H__
+#include <stdio.h>
+#include <pthread.h>
+#include <libwebsockets.h>
+#include <vector>
+#include <string>
+
+#include "ico_syc_common.h"
+#include "ico_syc_winctl.h"
+
+#include <unistd.h>
+
+#include "CicoHomeScreenCommon.h"
+
+#include "CicoHomeScreenConfig.h"
+#include "CicoHSMenuWindow.h"
+#include "CicoHSBackWindow.h"
+#include "CicoHSControlBarWindow.h"
+#include "CicoHSWindowController.h"
+#include "CicoHSAppInfo.h"
+
+#include "CicoSCSystemConfig.h"
+#include "CicoSCLifeCycleController.h"
+
+/* display position and size */
+#define ICO_HS_WINDOW_POS_X 0
+#define ICO_HS_WINDOW_POS_Y 0 
+#define ICO_HS_STATUSBAR_WINDOW_HEIGHT 64
+#define ICO_HS_MENU_WINDOW_POS_X ICO_HS_WINDOW_POS_X
+#define ICO_HS_MENU_WINDOW_POS_Y ICO_HS_STATUSBAR_WINDOW_HEIGHT
+#define ICO_HS_CONTROLBAR_WINDOW_POS_X ICO_HS_WINDOW_POS_X
+#define ICO_HS_CONTROLBAR_WINDOW_HEIGHT 128
+
+/*mode*/
+#define ICO_HS_MODE_MENU 0
+#define ICO_HS_MODE_APPLICATION 1
+
+/*hide pattern*/
+#define ICO_HS_SHOW_HIDE_PATTERN_SLIDE 0
+#define ICO_HS_SHOW_HIDE_PATTERN_FADE 1
+
+#define ICO_HS_CONFIG_HOMESCREEN    "homescreen"
+#define ICO_HS_CONFIG_ONSCREEN      "onscreen"
+#define ICO_HS_CONFIG_STATUBAR      "statusbar"
+#define ICO_HS_CONFIG_SOUND         "sound"
+#define ICO_HS_CONFIG_SB            "statusbar"
+#define ICO_HS_CONFIG_ONS           "onscreen"
+#define ICO_HS_APPID_DEFAULT_SB     "org.tizen.ico.statusbar"    /* default status bar appid */
+#define ICO_HS_APPID_DEFAULT_ONS    "org.tizen.ico.onscreen"    /* default on screen appid */
+
+#define ICO_HS_GROUP_SPECIAL        "menu"
+
+#define ICO_HS_APP_STATUS_ERR -1
+
+class CicoHomeScreen
+{
+  public:
+    CicoHomeScreen(void);
+    ~CicoHomeScreen(void);
+    int Initialize(int orientation,CicoHomeScreenConfig *config);
+    void Finalize(void);
+    int StartRelations();
+    void CreateMenuWindow(void);
+    void DeleteMenuWindow(void);
+    void UpDateMenuWindow(void);
+    void CreateBackWindow(void);
+    void DeleteBackWindow(void);
+    void UpDateBackWindow(void);
+    void CreateControlBarWindow(void);
+    void DeleteControlBarWindow(void);
+    void StartLoop(void);
+    char *GetHsPackageName(void);
+    char *GetSbPackageName(void);
+    char *GetOsPackageName(void);
+    void ShowHomeScreenLayer(void);
+    void ShowHomeScreenWindow(ico_syc_win_attr_t *win_attr);
+    void ShowStatusBarWindow(ico_syc_win_attr_t *win_attr);
+    void ShowApplicationWindow(ico_syc_win_attr_t *win_attr);
+    void RaiseApplicationWindow(const char *appid,int surface);
+    static void ChangeMode(int pattern);
+    static void ExecuteApp(const char *appid);
+    static void TerminateApp(const char *appid);
+    static bool GetAppStatus(const char *appid);
+    void SetMode(int mode);
+    int GetMode(void);
+    void StartHomeScreen();
+    void UpdateTile(const char *appid);
+
+  private:
+    int GetProcessWindow(const char *appid);
+    static void EventCallBack(ico_syc_ev_e event,const void* detail,void* user_data);
+    void ExecuteApp_i(const char *appid);
+    void TerminateApp_i(const char *appid);
+    void CreateAppInfoList(void);
+    CicoHSAppInfo *GetAppInfo(const char *appid);
+    ico_hs_window_info *GetWindowInfo(CicoHSAppInfo* appinfo,const char *window);
+
+    /*application control(do not use now)*/
+    int application_num;
+    CicoHSAppInfo *apps_info[ICO_HS_MAX_APP_NUM];
+    /*application info*/
+    CicoHSAppInfo *hs_app_info;
+    CicoHSAppInfo *sb_app_info;
+    CicoHSAppInfo *os_app_info;
+    /*sizes*/
+    int full_width,full_height;
+    int menu_width,menu_height;
+    int bg_width,bg_height;
+    int ctl_bar_width,ctl_bar_height;
+    /*package names*/
+    char hs_package_name[ICO_HS_MAX_PROCESS_NAME];
+    char sb_package_name[ICO_HS_MAX_PROCESS_NAME];
+    char os_package_name[ICO_HS_MAX_PROCESS_NAME];
+    /*Window Instances*/
+    CicoHSMenuWindow* menu_window;
+    CicoHSBackWindow* back_window;
+    CicoHSControlBarWindow* ctl_bar_window; 
+    /*mode*/
+    int mode;
+    /*configuration*/
+    CicoHomeScreenConfig *config;
+    /*my instance for callback*/
+    static CicoHomeScreen *hs_instance;
+
+    CicoSCLifeCycleController* life_cycle_controller;
+
+  protected:
+    CicoHomeScreen operator=(const CicoHomeScreen&);
+    CicoHomeScreen(const CicoHomeScreen&);
+};
+
+#endif
diff --git a/src/homescreen/CicoHomeScreenCommon.h b/src/homescreen/CicoHomeScreenCommon.h
new file mode 100644 (file)
index 0000000..f8f9aaa
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * 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   common value define
+ *
+ * @date    Aug-08-2013
+ */
+#ifndef __CICO_HOMESCREEN_COMMON_H__
+#define __CICO_HOMESCREEN_COMMON_H__
+
+#include "CicoLog.h"
+
+#define ICO_OK 0
+#define ICO_ERROR -1
+
+#define ICO_HS_OK               (0)
+#define ICO_HS_ERR              (-1)
+
+#define ICO_HS_TEMP_BUF_SIZE        (256)
+
+/* max window num*/
+#define ICO_HS_APP_MAX_WINDOW_NUM 32
+
+/* max application num*/
+#define ICO_HS_MAX_APP_NUM 512
+
+/* Maximum length of application name   */
+#define ICO_HS_MAX_PROCESS_NAME 64     
+
+/* HomeScreen default process name   */
+#define ICO_HS_PROC_DEFAULT_HOMESCREEN "org.tizen.ico.homescreen"    
+
+/*app name*/
+#define ICO_HS_APPID_DEFAULT_SB     "org.tizen.ico.statusbar"
+#define ICO_HS_APPID_DEFAULT_ONS    "org.tizen.ico.onscreen"
+
+/* path name max length */
+#define ICO_HS_MAX_PATH_BUFF_LEN 256
+
+/* max number of page in menu*/
+#define ICO_HS_MENU_MAX_MENU_PAGE_NUM 40
+
+/* max number of tile */
+#define ICO_HS_MENU_MAX_TILE_NUM 512
+
+/*window title*/
+#define ICO_HS_MENU_WINDOW_TITLE "ico_hs_menuwindow"
+#define ICO_HS_BACK_WINDOW_TITLE "ico_hs_backwindow"
+#define ICO_HS_CONTROL_BAR_WINDOW_TITLE "ico_hs_controlbarwindow"
+
+/*path of layaout file*/
+#define ICO_HS_MENU_LAYOUT_FILE_PATH "/home/app/layout.txt"
+
+/*path of back window*/
+#define ICO_HS_BACK_WINDOW_IMAGE_FILE_PATH "/opt/usr/media/Images/Home_default.jpg"
+
+/*name of image file (in config image directry)*/
+#define ICO_HS_IMAGE_FILE_MENU_BACK_GROUND "bg.png"
+#define ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_P "pagePointer_p.png"
+#define ICO_HS_IMAGE_FILE_MENU_PAGEPOINTER_N "pagePointer_n.png"
+#define ICO_HS_IMAGE_FILE_MENU_TERMINATE_REALLY "button_really.png"
+#define ICO_HS_IMAGE_FILE_MENU_TERMINATE_YES "button_yes.png"
+#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_LIFECYCLE_CONTROLLER_SETTING_PATH  "/usr/apps/org.tizen.ico.system-controller/res/config/system.xml"
+
+/*config name*/
+#define ICO_HS_CONFIG_HOMESCREEN    "homescreen"
+#define ICO_HS_CONFIG_ONSCREEN      "onscreen"
+#define ICO_HS_CONFIG_STATUBAR      "statusbar"
+#define ICO_HS_CONFIG_SOUND         "sound"
+
+/*misc*/
+#define HS_DISPLAY_HOMESCREEN   0           /* HomeScreen target display Id     */
+
+/*Layer dicralation*/
+#define HS_LAYER_BACKGROUND     0         /* layer of BackGround */
+#define HS_LAYER_APPLICATION    1         /* layer of Application */
+#define HS_LAYER_HOMESCREEN     2         /* layer of HomeScreen menu */
+#define HS_LAYER_SOFTKEYBOARD   3         /* layer of Software Keyboard  */
+#define HS_LAYER_INTERRUPTAPP   4         /* layer of Interrupted Application */
+#define HS_LAYER_TOUCH          5         /* layer of TouchPanel */
+#define HS_LAYER_ONSCREEN       6         /* layer of OnScreen   */
+#define HS_LAYER_CURSOR         7         /* layer of Cursor   */
+
+
+
+#endif
+
similarity index 61%
rename from src/home_screen_conf.c
rename to src/homescreen/CicoHomeScreenConfig.cpp
index e7ac1ac..9e0c163 100644 (file)
  *
  * @date    Feb-15-2013
  */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <glib.h>
-
-#include "ico_uxf_conf.h"
-#include "home_screen_conf.h"
-#include "home_screen.h"
-
-/*============================================================================*/
-/* variables and tables                                                       */
-/*============================================================================*/
-static GKeyFile *hs_config_key = NULL;
-gboolean hs_is_open_config = FALSE;
+#include "CicoHomeScreenConfig.h"
 
 /*============================================================================*/
 /* functions                                                                  */
 /*============================================================================*/
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   initHomeScreenConfig
+ * @brief   CicoHomeScreenConfig::CicoHomeScreenConfig
+ *          Constractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHomeScreenConfig::CicoHomeScreenConfig(void)
+{
+    config_key = NULL;
+    is_open_config = FALSE;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreenConfig::Initialize
  *          read and initialize for homescreen configuration
  *
  * @param[in]   conf                configuration file name
@@ -43,51 +43,50 @@ gboolean hs_is_open_config = FALSE;
  */
 /*--------------------------------------------------------------------------*/
 int
-initHomeScreenConfig(const char *conf)
+CicoHomeScreenConfig::Initialize(const char *conf)
 {
     GError *error = NULL;
     char path[ICO_HS_TEMP_BUF_SIZE];
-    GKeyFile *homescreen;
     GString *filepath;
 
-    uifw_trace("initHomeScreenConfig: open=%d", hs_is_open_config);
-    if (hs_is_open_config == TRUE) {
+    if(is_open_config == TRUE) {
+        /*if initialize was done*/
         return ICO_HS_ERR;
     }
 
-    homescreen = g_key_file_new();
-    hs_config_key = homescreen;
+    config_key = g_key_file_new();
+    
     filepath = g_string_new("test");
-    hs_get_conf_path(path, sizeof(path));
+    CicoHomeScreenResourceConfig::GetConfPath(path, sizeof(path));
     g_string_printf(filepath, "%s/%s", path, conf);
     if (!g_file_test(filepath->str, G_FILE_TEST_IS_REGULAR)) {
-        uifw_warn("%s: config file dose not exist", filepath->str);
         return ICO_HS_ERR;
     }
 
-    g_key_file_load_from_file(homescreen, filepath->str,
-                              G_KEY_FILE_KEEP_COMMENTS
-                                      | G_KEY_FILE_KEEP_TRANSLATIONS, &error);
+    g_key_file_load_from_file(config_key, filepath->str,
+                              static_cast<GKeyFileFlags>(G_KEY_FILE_KEEP_COMMENTS
+                                      | G_KEY_FILE_KEEP_TRANSLATIONS), &error);
     if (error != NULL) {
-        uifw_warn("%s: %s", filepath->str, error->message);
+        ICO_WRN("%s: %s", filepath->str, error->message);
         g_error_free(error);
+        return ICO_HS_ERR;
     }
-    uifw_trace("config file(%s)", filepath->str);
 
     g_string_free(filepath, TRUE);
     if (error != NULL) {
-        uifw_warn("%s: %s", filepath->str, error->message);
+        ICO_WRN("%s: %s", filepath->str, error->message);
         g_error_free(error);
-        hs_is_open_config = TRUE;
+        is_open_config = TRUE;
         return ICO_HS_ERR;
     }
+
     return ICO_HS_OK;
 }
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   hs_conf_get_integer
- *          Return integer value in homescreen configuration file.
+ * @brief   CicoHomeScreenConfig::ConfigGetInteger
+ *          Return integer value in homescreen configuration file. 
  *          If not exist,return defaultvlaue in params.
  *
  * @param[in]   group_name          configuration group name
@@ -97,19 +96,20 @@ initHomeScreenConfig(const char *conf)
  */
 /*--------------------------------------------------------------------------*/
 int
-hs_conf_get_integer(const char *group_name, const char *key, int default_value)
+CicoHomeScreenConfig::ConfigGetInteger(const char *group_name, const char *key, int default_value)
 {
     GError *error = NULL;
 
-    if (hs_config_key == NULL) {
-        if (initHomeScreenConfig(ICO_HOMESCREEN_CONFIG_FILE) != ICO_HS_OK) {
+    if (config_key == NULL) {
+        /* if initialize is didn't yet */
+        if (Initialize(ICO_HOMESCREEN_CONFIG_FILE) != ICO_HS_OK) {
             return default_value;
         }
     }
 
-    int value = g_key_file_get_integer(hs_config_key, group_name, key, &error);
+    int value = g_key_file_get_integer(config_key, group_name, key, &error);
     if (error != NULL) {
-        uifw_warn("%s:%s %s", group_name, key, error->message);
+        ICO_WRN("%s", error->message);
         g_error_free(error);
         return default_value;
     }
@@ -118,8 +118,8 @@ hs_conf_get_integer(const char *group_name, const char *key, int default_value)
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   hs_conf_get_string
- *          Return string value in homescreen configuration file.
+ * @brief   CicoHomeScreenConfig::ConfigGetString
+ *          Return string value in homescreen configuration file. 
  *          If not exist,return defaultvlaue in params.
  *
  * @param[in]   group_name          configuration group name
@@ -129,21 +129,22 @@ hs_conf_get_integer(const char *group_name, const char *key, int default_value)
  */
 /*--------------------------------------------------------------------------*/
 const char *
-hs_conf_get_string(const char *group_name, const char *key,
+CicoHomeScreenConfig::ConfigGetString(const char *group_name, const char *key,
                    const char *default_value)
 {
     GError *error = NULL;
 
-    if (hs_config_key == NULL) {
-        if (initHomeScreenConfig(ICO_HOMESCREEN_CONFIG_FILE) != ICO_HS_OK) {
+     if (config_key == NULL) {
+        /* if initialize is didn't yet */
+        if (Initialize(ICO_HOMESCREEN_CONFIG_FILE) != ICO_HS_OK) {
             return default_value;
         }
     }
 
-    const char *value = g_key_file_get_string(hs_config_key, group_name, key,
+    const char *value = g_key_file_get_string(config_key, group_name, key,
                                               &error);
     if (error != NULL) {
-        uifw_warn("%s:%s %s", group_name, key, error->message);
+        ICO_WRN("%s", error->message);
         g_error_free(error);
         return default_value;
     }
diff --git a/src/homescreen/CicoHomeScreenConfig.h b/src/homescreen/CicoHomeScreenConfig.h
new file mode 100644 (file)
index 0000000..62ad740
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef __CICOHOMESCREENCONFIG_H__
+#define __CICOHOMESCREENCONFIG_H__
+/*
+ * 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   load configuratoin file
+ *
+ * @date    Feb-15-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <glib.h>
+
+#include "CicoHomeScreenCommon.h"
+#include "CicoHomeScreenResourceConfig.h"
+
+/*============================================================================*/
+/* definition                                                                 */
+/*============================================================================*/
+#define ICO_HOMESCREEN_CONFIG_FILE "homescreen.conf"
+#define ICO_ONSCREEN_CONFIG_FILE   "onscreen.conf"
+#define ICO_STATUSBAR_CONFIG_FILE  "statusbar.conf"
+
+/*============================================================================*/
+/* Class Declaration (CicoHomeScreenConfig)                               */
+/*============================================================================*/
+class CicoHomeScreenConfig
+{
+  public:
+    CicoHomeScreenConfig();
+    int Initialize(const char *conf);
+    int ConfigGetInteger(const char *group_name, 
+                         const char *key, int default_value);
+    const char* ConfigGetString(const char *group_name, const char *key,
+                   const char *default_value);
+  private:
+    GKeyFile *config_key;
+    gboolean is_open_config;
+
+  protected:
+    CicoHomeScreenConfig operator = (const CicoHomeScreenConfig&);
+    CicoHomeScreenConfig(const CicoHomeScreenConfig&);
+};
+
+#endif
similarity index 80%
rename from src/resource_conf.c
rename to src/homescreen/CicoHomeScreenResourceConfig.cpp
index 2b3d2dc..9ba32c2 100644 (file)
  * @date    Feb-15-2013
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "ico_uxf_conf_def.h"
-#include "home_screen.h"
-#include "home_screen_res.h"
+#include "CicoHomeScreenResourceConfig.h"
 
 /*============================================================================*/
 /* functions                                                                  */
 /*============================================================================*/
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   hs_get_image_path
+ * @brief   CicoHomeScreenResourceConfig::GetImagePath
  *          set the directory path of the image files.
  *
  * @param[out]  buff                buffer that the pass set
@@ -34,7 +28,7 @@
  */
 /*--------------------------------------------------------------------------*/
 void
-hs_get_image_path(char *buff, int len)
+CicoHomeScreenResourceConfig::GetImagePath(char *buff, int len)
 {
     char *pkg;
 
@@ -44,14 +38,14 @@ hs_get_image_path(char *buff, int len)
         snprintf(buff, len, image_path, pkg);
     }
     else {
-        pkg = getenv(ICO_UXF_TOP_ENV);
+        pkg = getenv(ICO_HS_CONFIG_TOP_ENV);
         snprintf(buff, len, local_image_path, pkg ? pkg : local_top_path);
     }
 }
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   hs_get_sound_path
+ * @brief   CicoHomeScreenResourceConfig::GetSoundPath
  *          set the directory path of the sounds files.
  *
  * @param[out]  buff                buffer that the pass set
@@ -60,7 +54,7 @@ hs_get_image_path(char *buff, int len)
  */
 /*--------------------------------------------------------------------------*/
 void
-hs_get_sound_path(char *buff, int len)
+CicoHomeScreenResourceConfig::GetSoundPath(char *buff, int len)
 {
     char *pkg;
 
@@ -70,14 +64,14 @@ hs_get_sound_path(char *buff, int len)
         snprintf(buff, len, sound_path, pkg);
     }
     else {
-        pkg = getenv(ICO_UXF_TOP_ENV);
+        pkg = getenv(ICO_HS_CONFIG_TOP_ENV);
         snprintf(buff, len, local_sound_path, pkg ? pkg : local_top_path);
     }
 }
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   hs_get_edj_path
+ * @brief   CicoHomeScreenResourceConfig::GetEdjPath
  *          set the directory path of efj files.
  *
  * @param[out]  buff                buffer that the pass set
@@ -86,7 +80,7 @@ hs_get_sound_path(char *buff, int len)
  */
 /*--------------------------------------------------------------------------*/
 void
-hs_get_edj_path(char *buff, int len)
+CicoHomeScreenResourceConfig::GetEdjPath(char *buff, int len)
 {
     char *pkg;
 
@@ -96,23 +90,24 @@ hs_get_edj_path(char *buff, int len)
         snprintf(buff, len, edj_path, pkg);
     }
     else {
-        pkg = getenv(ICO_UXF_TOP_ENV);
+        pkg = getenv(ICO_HS_CONFIG_TOP_ENV);
         snprintf(buff, len, local_edj_path, pkg ? pkg : local_top_path);
     }
 }
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   hs_get_ons_edj_path
+ * @brief   CicoHomeScreenResourceConfig::GetOnscreenEdjPath
  *          set the directory path of edj files for onscreen.
- *
+ *void
+hs_get_image_path(char *buff, int len)
  * @param[out]  buff                buffer that the pass set
  * @param[in]   len                 buffer length
  * @return      none
  */
 /*--------------------------------------------------------------------------*/
 void
-hs_get_ons_edj_path(char *buff, int len)
+CicoHomeScreenResourceConfig::GetOnscreenEdjPath(char *buff, int len)
 {
     char *pkg;
 
@@ -122,14 +117,14 @@ hs_get_ons_edj_path(char *buff, int len)
         snprintf(buff, len, edj_path, ICO_HS_APPID_DEFAULT_ONS);
     }
     else {
-        pkg = getenv(ICO_UXF_TOP_ENV);
+        pkg = getenv(ICO_HS_CONFIG_TOP_ENV);
         snprintf(buff, len, local_edj_path, pkg ? pkg : local_top_path);
     }
 }
 
 /*--------------------------------------------------------------------------*/
 /**
- * @brief   hs_get_conf_path
+ * @brief   CicoHomeScreenResourceConfig::GetConfPath
  *          set the directory path of edj files for onscreen.
  *
  * @param[out]  buff                buffer that the pass set
@@ -138,19 +133,17 @@ hs_get_ons_edj_path(char *buff, int len)
  */
 /*--------------------------------------------------------------------------*/
 void
-hs_get_conf_path(char *buff, int len)
+CicoHomeScreenResourceConfig::GetConfPath(char *buff, int len)
 {
     char *pkg;
 
     memset(buff, 0, len);
     pkg = getenv("PKG_NAME");
     if (pkg) {
-        uifw_trace("hs_get_conf_path: PKG_NAME=%s", pkg);
         snprintf(buff, len, manifest_path, pkg);
     }
     else {
-        pkg = getenv(ICO_UXF_TOP_ENV);
+        pkg = getenv(ICO_HS_CONFIG_TOP_ENV);
         snprintf(buff, len, local_manifest_path, pkg ? pkg : local_top_path);
-        uifw_warn("hs_get_conf_path: no PKG_NAME, path=%s", buff);
     }
 }
diff --git a/src/homescreen/CicoHomeScreenResourceConfig.h b/src/homescreen/CicoHomeScreenResourceConfig.h
new file mode 100644 (file)
index 0000000..4cd87ca
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef __CICOHOMESCREENRESOURCECONFIG_H__
+#define __CICOHOMESCREENRESOURCECONFIG_H__
+/*
+ * 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   configuration of resource path
+ *
+ * @date    Feb-15-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "CicoHomeScreenCommon.h"
+#include "home_screen_res.h"
+
+/* Environment variable for UI-FW top directory             */
+#define ICO_HS_CONFIG_TOP_ENV         "UIFW_TOPDIR"
+/* Default top directory of UI-FW                           */
+#define ICO_HS_CONFIG_TOP_TOPDIR      "/usr/apps/org.tizen.ico.homescreen"
+/* Environment variable for top directory of cconfiguration files   */
+#define ICO_HS_CONFIG_CONFIG_ENV      "UIFW_CONFDIR"
+/* Default top directory of cconfiguration files            */
+#define ICO_HS_CONFIG_CONFIG_DIR      "res/config"
+/* Configuration file names                                 */
+#define ICO_HS_CONFIG_CONFIG_SYSTEM   "system.conf"
+#define ICO_HS_CONFIG_CONFIG_APPATTR  "app_attr.conf"
+/* Directory of application manifest                        */
+#define ICO_HS_CONFIG_CONFIG_APPSDIR  "apps"
+/* Maximum length of the configuration directory name       */
+#define ICO_HS_CONFIG_CONF_DIR_MAX    63
+/* Maximum length of Wayland connection name                */
+#define ICO_UXF_CONF_WAYLAND_NAME   39
+
+/*============================================================================*/
+/* Class Declaration (CicoHomeScreenResourceConfig)                           */
+/*============================================================================*/
+class CicoHomeScreenResourceConfig
+{
+  public:
+    static void GetImagePath(char *buff, int len);
+    static void GetSoundPath(char *buff, int len);
+    static void GetEdjPath(char *buff, int len);
+    static void GetOnscreenEdjPath(char *buff, int len);
+    static void GetConfPath(char *buff, int len);
+  protected:
+    CicoHomeScreenResourceConfig operator =
+        (const CicoHomeScreenResourceConfig&);
+    CicoHomeScreenResourceConfig(const CicoHomeScreenResourceConfig&);
+};
+
+#endif
+
diff --git a/src/homescreen/CicoHomeScreenSound.cpp b/src/homescreen/CicoHomeScreenSound.cpp
new file mode 100644 (file)
index 0000000..8a1d427
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * 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   sound an operation of homescreen
+ *
+ * @date    Apr-04-2013
+ */
+
+#include "CicoHomeScreenSound.h"
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreenSound::ReadSoundConfiguration
+ *          read configuration and set
+ *
+ * @param[in]   homescreen_config   configuration instance
+ * @param[in]   type                operation type
+ * @param[in]   conf_name           configuration name
+ * @return      result 
+ * @retval      >=0                 success
+ * @retval      NULL                err
+ */
+/*--------------------------------------------------------------------------*/
+CicoHomeScreenSoundConfig *
+CicoHomeScreenSound::ReadSoundConfiguration(CicoHomeScreenConfig *homescreen_config,
+                                            int type, char *conf_name)
+{
+    char *file;
+    CicoHomeScreenSoundConfig *sound_config;
+
+    sound_config = new CicoHomeScreenSoundConfig();
+    if (sound_config == NULL) {
+        ICO_WRN("CicoHomeScreenSound::ReadSoundConfiguration: Leave(fail to alloc memory");
+        return NULL;
+    }
+
+    if (strcmp(conf_name, ICO_HS_SND_CNAME_DEFAULT) == 0) {
+        file = (char *)homescreen_config->ConfigGetString(ICO_HS_CONFIG_SOUND,
+                                          conf_name,ICO_HS_SND_FNAME_DEFAULT);
+    }
+    else {
+        file = (char *)homescreen_config->ConfigGetString(ICO_HS_CONFIG_HOMESCREEN,
+                                          conf_name,NULL);
+    }
+
+    if (!file) {
+        ICO_ERR("CicoHomeScreenSound::ReadSoundConfiguration: Leave(given config is not exist");
+        delete sound_config;
+        return NULL;
+    }
+
+    sound_config->SetFile(file);
+    sound_config->SetType(type);
+    sound_config->SetNext(sound_files);
+
+    sound_files = sound_config;
+
+    return sound_config;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreenSound::CicoHomeScreenSound
+ *          constractor
+ *
+ * @param       none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoHomeScreenSound::CicoHomeScreenSound(void){
+    snd_is_initialize = false;
+    sound_files = NULL;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   Initialize
+ *          initialize to sound a operation
+ *
+ * @param[in]   homescreen_config   configuration instance
+ * @return      result
+ * @retval      ICO_HS_OK           success
+ * @retval      ICO_HS_ERR          err
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHomeScreenSound::Initialize(CicoHomeScreenConfig *homescreen_config)
+{
+    if (snd_is_initialize != true) {
+        /* read sound file name from configuration */
+        ReadSoundConfiguration(homescreen_config,ICO_HS_SND_TYPE_DEFAULT,
+                               const_cast<char*>(ICO_HS_SND_CNAME_DEFAULT));
+
+        CicoHomeScreenResourceConfig::GetSoundPath(soundpath, sizeof(soundpath));
+        snd_is_initialize = true;
+    }
+
+    return ICO_HS_OK;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreenSound::PlaySound
+ *          play the given sound file(.wav).
+ *
+ * @param[in]   wav_file            wav formated file.
+ * @return      result
+ * @retval      ICO_HS_OK           success
+ * @retval      ICO_HS_ERR          err
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHomeScreenSound::PlaySound(char *wav_file)
+{
+    int pid;
+    char command[ICO_HS_TEMP_BUF_SIZE];
+    if (snd_is_initialize != true) {
+        return ICO_HS_ERR;
+    }
+
+    if (!wav_file) {
+        ICO_WRN("CicoHomeScreenSound::PlaySound: Leave(error file name is NULL");
+        return ICO_HS_ERR;
+    }
+
+    if (wav_file[0] == '/') {
+        /* given by full file path */
+        snprintf(command, sizeof(command), 
+                "paplay --stream-name=HOMESCREEN_BEEP %s", wav_file);
+    }
+    else {
+        snprintf(command, sizeof(command), 
+                "paplay --stream-name=HOMESCREEN_BEEP %s/%s", soundpath, wav_file);
+    }
+
+    ICO_DBG("CicoHomeScreenSound::PlaySound: system(%s)", command);
+    pid = fork();
+    if (!pid) {
+        system(command);
+        exit(0);
+    }
+
+    return ICO_HS_OK;
+}
+
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   hs_snd_get_filename
+ *          get the file name by given operation type
+ *
+ * @param[in]   type                operation type
+ * @return      pointer to the file name 
+ * @retval      >=0                 success
+ * @retval      NULL                err
+ */
+/*--------------------------------------------------------------------------*/
+char *
+CicoHomeScreenSound::GetSoundFileName(int type)
+{
+    CicoHomeScreenSoundConfig *sound_config;
+
+    if (snd_is_initialize != true) {
+        return NULL;
+    }
+
+    sound_config = sound_files;
+    while (sound_config != NULL) {
+        if (sound_config->GetType() == type) {
+            return sound_config->GetFile();
+        }
+        sound_config = sound_config->GetNext();
+    }
+
+    return NULL;
+}
+
diff --git a/src/homescreen/CicoHomeScreenSound.h b/src/homescreen/CicoHomeScreenSound.h
new file mode 100644 (file)
index 0000000..7d5b68b
--- /dev/null
@@ -0,0 +1,59 @@
+#ifndef __CICOHOMESCREENSOUND_H__
+#define __CICOHOMESCREENSOUND_H__
+/*
+ * 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   sound an operation of homescreen
+ *
+ * @date    Apr-04-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdbool.h>
+
+//#include "ico_uxf.h"
+//#include "ico_uxf_conf_def.h"
+//#include "home_screen.h"
+#include "CicoHomeScreenCommon.h"
+#include "CicoHomeScreenConfig.h"
+#include "CicoHomeScreenResourceConfig.h"
+#include "CicoHomeScreenSoundConfig.h"
+
+/* define for sound configuration */
+#define ICO_HS_SND_TYPE_DEFAULT      (1)
+
+#define ICO_HS_SND_CNAME_DEFAULT     "sound_default"
+#define ICO_HS_SND_FNAME_DEFAULT     "default.wav"
+
+
+/*============================================================================*/
+/* Class Declaration (CicoHomeScreenSound)                                    */
+/*============================================================================*/
+class CicoHomeScreenSound
+{
+  public:
+    CicoHomeScreenSound(void);
+    CicoHomeScreenSoundConfig *ReadSoundConfiguration(CicoHomeScreenConfig *homescreen_config,
+                                                      int type,char *conf_name);
+    int Initialize(CicoHomeScreenConfig *homescreen_config);
+    int PlaySound(char *wav_file);
+    char *GetSoundFileName(int type);
+  private:
+    int snd_is_initialize;
+    CicoHomeScreenSoundConfig *sound_files;
+    char soundpath[ICO_HS_TEMP_BUF_SIZE];
+  protected:
+    CicoHomeScreenSound operator = (const CicoHomeScreenSound&);
+    CicoHomeScreenSound(const CicoHomeScreenSound&);
+};
+
+#endif
diff --git a/src/homescreen/CicoHomeScreenSoundConfig.cpp b/src/homescreen/CicoHomeScreenSoundConfig.cpp
new file mode 100644 (file)
index 0000000..0bda5a6
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * 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   sound an operation of homescreen
+ *
+ * @date    Apr-04-2013
+ */
+
+#include "CicoHomeScreenSoundConfig.h"
+
+/*============================================================================*/
+/* functions                                                                  */
+/*============================================================================*/
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreenSoundConfig::SetFile
+ *          set sound file name
+ *
+ * @param[in]   file_tmp   sound file name
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreenSoundConfig::SetFile(char *file_tmp)
+{
+    file = file_tmp;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreenSoundConfig::GetFile
+ *          get sound file name
+ *
+ * @param[in]   none
+ * @return      sound file name
+ */
+/*--------------------------------------------------------------------------*/
+char*
+CicoHomeScreenSoundConfig::GetFile(void)
+{
+    return file;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreenSoundConfig::SetType
+ *          set sound type
+ *
+ * @param[in]   type_tmp    the value to set type
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreenSoundConfig::SetType(int type_tmp)
+{
+    type = type_tmp;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreenSoundConfig::GetType
+ *          get sound type
+ *
+ * @param[in]   none
+ * @return      type
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoHomeScreenSoundConfig::GetType(void)
+{
+    return type;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreenSoundConfig::SetNext
+ *          set next instance
+ *
+ * @param[in]   next instance
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoHomeScreenSoundConfig::SetNext(CicoHomeScreenSoundConfig *next_tmp)
+{
+    next = next_tmp;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoHomeScreenSoundConfig::GetNext
+ *          get next instance
+ *
+ * @param[in]   none
+ * @return      next instance
+ */
+/*--------------------------------------------------------------------------*/
+CicoHomeScreenSoundConfig*
+CicoHomeScreenSoundConfig::GetNext(void)
+{
+    return next;
+}
+
diff --git a/src/homescreen/CicoHomeScreenSoundConfig.h b/src/homescreen/CicoHomeScreenSoundConfig.h
new file mode 100644 (file)
index 0000000..107f652
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef __HOMESCREENSOUNDCONFIG_H__
+#define __HOMESCREENSOUNDCONFIG_H__
+/*
+ * 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   sound an operation of homescreen
+ *
+ * @date    Apr-04-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdbool.h>
+
+#include "CicoHomeScreenConfig.h"
+#include "CicoHomeScreenResourceConfig.h"
+
+/*============================================================================*/
+/* Class Declaration (CicoHomeScreenSoundConfig)                              */
+/*============================================================================*/
+class CicoHomeScreenSoundConfig
+{
+  public:
+    CicoHomeScreenSoundConfig(){};
+    void SetFile(char *file_tmp);
+    char *GetFile(void);
+    void SetType(int type_tmp);
+    int GetType(void);
+    void SetNext(CicoHomeScreenSoundConfig *next_tmp);
+    CicoHomeScreenSoundConfig *GetNext(void);
+  private:
+    CicoHomeScreenSoundConfig *next;
+    int type;                               /* operation type                 */
+    char *file;                             /* sound file name                */
+  protected:
+    CicoHomeScreenSoundConfig operator=(const CicoHomeScreenSoundConfig&);
+    CicoHomeScreenSoundConfig(const CicoHomeScreenSoundConfig&); 
+};
+
+#endif
diff --git a/src/homescreen/CicoLog.cpp b/src/homescreen/CicoLog.cpp
new file mode 100644 (file)
index 0000000..4e51269
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * 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 <string>
+#include "CicoLog.h"
+
+CicoLog* CicoLog::ms_myInstance = NULL;
+int  CicoLog::m_sTimeZone = 99*60*60;
+
+CicoLog::CicoLog()
+    : m_logLevel(0x7fffffff), m_flushMode(true), m_initialized(false),
+      m_sDbgFd(NULL), m_sDbgLines(0)
+{
+    memset(&m_sDbgProg[0], 0, sizeof(m_sDbgProg));
+}
+
+CicoLog::~CicoLog()
+{
+    closeLog();
+}
+
+CicoLog*
+CicoLog::getInstance(void)
+{
+    if (NULL == ms_myInstance) {
+        ms_myInstance = new CicoLog();
+    }
+    return ms_myInstance;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_apf_log_print: printout log message
+ *
+ * @param[in]   fmt     message format(same as printf)
+ * @param[in]   ...     arguments if need
+ * @return      nothing
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoLog::printLog(int loglevel, const char *fmt, ...)
+{
+    if (m_logLevel < loglevel) {
+        return;
+    }
+    va_list     list;
+
+    if (! m_sDbgFd)   {
+        openLog(NULL);
+    }
+#if ICO_APF_LOG_STDOUT == 0
+    else if (m_sDbgLines >= (ICO_LOG_MAXLINES-2)) {
+        if (m_sDbgLines >= ICO_LOG_MAXLINES)  {
+            closeLog();
+            openLog(m_sDbgProg);
+        }
+        else    {
+            fflush(m_sDbgFd);
+        }
+    }
+#endif /*ICO_APF_LOG_STDOUT*/
+    if (m_sDbgFd) {
+        va_start(list, fmt);
+        vfprintf(m_sDbgFd, fmt, list);
+        va_end(list);
+        if (m_flushMode)  {
+            fflush(m_sDbgFd);
+        }
+    }
+    if (m_sDbgFd != stdout)   {
+        m_sDbgLines ++;
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   open: open log file
+ *
+ * @param[in]   prog    program name
+ * @return      nothing
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoLog::openLog(const char *prog)
+{
+#if ICO_LOG_STDOUT == 0
+    int     idx;
+    char    sPath[128];
+    char    sPath2[128];
+#endif /*ICO_LOG_STDOUT*/
+
+    if (m_sDbgFd) {
+        fflush(m_sDbgFd);
+        if (m_sDbgFd != stdout)   {
+            fclose(m_sDbgFd);
+        }
+    }
+
+    m_sDbgLines = 0;
+
+    if ((! prog) || (*prog == 0))   {
+        m_sDbgFd = stdout;
+        m_sDbgProg[0] = 0;
+        return;
+    }
+    else    {
+        strncpy(m_sDbgProg, prog, sizeof(m_sDbgProg)-1);
+        m_sDbgProg[sizeof(m_sDbgProg)-1] = 0;
+    }
+#if ICO_LOG_STDOUT > 0
+    m_sDbgFd = stdout;
+#else  /*ICO_LOG_STDOUT*/
+    snprintf(sPath, sizeof(sPath)-1, "%s/%s.log%d",
+             ICO_LOG_DIR, m_sDbgProg, 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, m_sDbgProg, idx-1);
+        }
+        else    {
+            snprintf(sPath, sizeof(sPath)-1, "%s/%s.log",
+                     ICO_LOG_DIR, m_sDbgProg);
+        }
+        (void) rename(sPath, sPath2);
+    }
+    m_sDbgFd = fopen(sPath, "w");
+    if (! m_sDbgFd)   {
+        m_sDbgFd = stdout;
+    }
+    else if ((m_initialized == false) &&
+             (m_sDbgFd != stdout) && (m_sDbgFd != stderr))  {
+        m_initialized = true;
+        fflush(stdout);
+        fflush(stderr);
+        stdout = m_sDbgFd;
+        stderr = m_sDbgFd;
+    }
+#endif /*ICO_LOG_STDOUT*/
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   closeLog: close log file
+ *
+ * @param       nothing
+ * @return      nothing
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoLog::closeLog(void)
+{
+#if ICO_LOG_STDOUT == 0
+    if (m_sDbgFd) {
+        fflush(m_sDbgFd);
+        if (m_sDbgFd != stdout)   {
+            fclose(m_sDbgFd);
+        }
+        m_sDbgFd = (FILE *)0;
+    }
+#endif /*ICO_LOG_STDOUT*/
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief  flushLog: flush log file
+ *
+ * @param       nothing
+ * @return      nothing
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoLog::flushLog(void)
+{
+    if ((m_sDbgFd != NULL) && (m_flushMode == 0))   {
+        fflush(m_sDbgFd);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   getStrCurtime: create current time string
+ *
+ * @param[in]   level   log level string(header of log message)
+ * @return      current time string
+ */
+/*--------------------------------------------------------------------------*/
+char *
+CicoLog::getStrCurTime(const char *level)
+{
+    struct timeval  NowTime;
+    extern long     timezone;
+    static char     sBuf[28];
+
+    gettimeofday(&NowTime, (struct timezone *)0);
+    if (m_sTimeZone > (24*60*60)) {
+        tzset();
+        m_sTimeZone = timezone;
+    }
+    NowTime.tv_sec -= m_sTimeZone;
+
+    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   setLogLevel: set log output level
+ *
+ * @param[in]   loglevel    log output level
+ * @return      nothing
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoLog::setLogLevel(const int loglevel)
+{
+    m_logLevel = loglevel & (~(ICO_LOG_FLUSH|ICO_LOG_NOFLUSH));
+
+    if (m_logLevel & (ICO_LOG_FLUSH|ICO_LOG_NOFLUSH))    {
+        if (m_logLevel & ICO_LOG_FLUSH)  {
+            m_flushMode = true;
+        }
+        else    {
+            m_flushMode = false;
+        }
+    }
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/src/homescreen/CicoLog.h b/src/homescreen/CicoLog.h
new file mode 100644 (file)
index 0000000..e93b991
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * 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 __CICO_LOG_H__
+#define __CICO_LOG_H__
+
+#include "ico_log.h"
+
+#endif  // __CICO__LOG_H__
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/src/homescreen/CicoOnScreenAction.cpp b/src/homescreen/CicoOnScreenAction.cpp
new file mode 100644 (file)
index 0000000..2459929
--- /dev/null
@@ -0,0 +1,316 @@
+/*
+ * 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   touch action for onscreen application
+ *
+ * @date    Feb-15-2013
+ */
+#include "CicoOnScreenAction.h"
+
+/*============================================================================*/
+/* Declare static values                                                      */
+/*============================================================================*/
+char CicoOnScreenAction::edje_str[ICO_ONS_BUF_SIZE];
+int CicoOnScreenAction::wait_reply = ICO_ONS_NO_WAIT;
+int CicoOnScreenAction::ws_port;
+CicoOnScreenContext* CicoOnScreenAction::context;
+CicoHomeScreenSound* CicoOnScreenAction::sound;
+
+/*============================================================================*/
+/* Functions Declaration (CicoOnScreenAction)                                 */
+/*============================================================================*/
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenAction::CreateContext
+ *          create context
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void CicoOnScreenAction::CreateContext(void)
+{
+    context = new CicoOnScreenContext(ws_port);
+
+    /* set callback */
+    if(context == NULL){
+        return;
+    }
+    context->SetCallBack(UwsCallBack);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenAction::DeleteContext
+ *          delete context
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void CicoOnScreenAction::DeleteContext(void)
+{
+    if(context == NULL){
+        return;
+    }
+    delete context;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenAction::Initialize
+ *          initialize
+ *
+ * @param[in]   ws_port    port of websocket
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void CicoOnScreenAction::Initialize(CicoHomeScreenConfig *homescreen_config,CicoHomeScreenSound *sound_tmp)
+{
+    
+    wait_reply = ICO_ONS_NO_WAIT;
+
+    ws_port = ICO_HS_WS_PORT;
+  
+    sound = sound_tmp;
+
+    /* copy ws_port */
+    if (homescreen_config != NULL) {
+        ws_port = homescreen_config->ConfigGetInteger(ICO_HS_CONFIG_ONSCREEN,
+                                         ICO_HS_CONFIG_WS_PORT,
+                                         ICO_HS_WS_PORT);
+    }
+
+    /* create context*/
+    CreateContext(); 
+
+    /* ecore timer add*/
+    ecore_timer_add(ICO_ONS_WS_TIMEOUT,EcoreEvent, NULL);
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenAction::Finalize
+ *          finalize
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void CicoOnScreenAction::Finalize(void)
+{
+    /* create context*/
+    DeleteContext(); 
+
+}
+
+/*--------------------------------------------------------------------------*/
+/*
+ * @brief   CicoOnScreenAction::EdjeParseStr
+ *          parse string by " "
+ *
+ * @param[in]   in         text    
+ * @param[in]   arg_num    arg_num
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+char *
+CicoOnScreenAction::EdjeParseStr(void *in, int arg_num)
+{
+    int i;
+    char *data;
+
+    ICO_DBG("CicoOnScreenAction::EdjeParseStr: %s, arg = %d", in, arg_num);
+    data = strtok(reinterpret_cast<char*>(in), " ");
+    /* arg_num : 0 to n */
+    for (i = 0; i < arg_num; i++) {
+        data = strtok(NULL, " ");
+    }
+    ICO_DBG("CicoOnScreenAction::EdjeParseStr: data: %s", data);
+    return data;
+}
+/*--------------------------------------------------------------------------*/
+/*
+ * @brief   CicoOnScreenAction::UwsCallBack
+ *          callback function from UWS
+ *
+ * @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
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoOnScreenAction::UwsCallBack(const struct ico_uws_context *uws_context,
+                const ico_uws_evt_e event, const void *id,
+                const ico_uws_detail *detail, void *data)
+{
+    ICO_DBG("CicoOnScreenAction::UwsCallBack: %p", uws_context);
+    char *in;
+
+    switch (event) {
+    case ICO_UWS_EVT_OPEN:
+        ICO_DBG("CicoOnScreenAction::UwsCallBack: ICO_UWS_EVT_OPEN(id=%d)", 
+                   reinterpret_cast<int>(id));
+        context->SetUwsId(const_cast<void *>(id));
+        context->EventMessage(const_cast<char*>("%s ANS HELLO"), ICO_HS_MSG_HEAD_OS);
+        break;
+
+    case ICO_UWS_EVT_CLOSE:
+        ICO_DBG("CicoOnScreenAction::UwsCallBack: ICO_UWS_EVT_CLOSE(id=%d)",
+                   reinterpret_cast<int>(id));
+        context->CloseUwsContext();
+        context->SetWsConnected(0);
+        context->SetUwsId(NULL);
+        break;
+
+    case ICO_UWS_EVT_RECEIVE:
+        ICO_DBG("CicoOnScreenAction::UwsCallBack: ICO_UWS_EVT_RECEIVE(id=%d, msg=%s, len=%d)",
+                   reinterpret_cast<int>(id), static_cast<char *>(detail->_ico_uws_message.recv_data),
+                   detail->_ico_uws_message.recv_len);
+        in = static_cast<char *>(detail->_ico_uws_message.recv_data);
+
+        if (strlen(in) == 0)
+            break;
+        wait_reply = ICO_ONS_NO_WAIT;
+        /* onscreen activate request */
+        if (strncmp("OPEN", in, 4) == 0) {
+            ICO_DBG("%s", in);
+            strncpy(edje_str, EdjeParseStr(in, 1), sizeof(edje_str));
+            ICO_DBG("CicoOnScreenAction::UwsCallBack: %s", &edje_str[0]);
+            if (CicoOnScreenAppList::LoadIconsEdjeFile(&edje_str[0]) == 0) {
+                context->EventMessage(const_cast<char*>("%s RESULT SUCCESS"), ICO_HS_MSG_HEAD_OS);
+            }
+            else {
+                context->EventMessage(const_cast<char*>("%s RESULT FAILED"), ICO_HS_MSG_HEAD_OS);
+            }
+        }
+        break;
+
+    case ICO_UWS_EVT_ERROR:
+        ICO_DBG("CicoOnScreenAction::UwsCallBack: ICO_UWS_EVT_ERROR(id=%d, err=%d)",
+                   reinterpret_cast<int>(id), detail->_ico_uws_error.code);
+        break;
+
+    case ICO_UWS_EVT_ADD_FD:
+        ICO_DBG("CicoOnScreenAction::UwsCallBack: ICO_UWS_EVT_ADD_FD(id=%d, fd=%d)",
+                   reinterpret_cast<int>(id), detail->_ico_uws_fd.fd);
+        break;
+
+    case ICO_UWS_EVT_DEL_FD:
+        ICO_DBG("CicoOnScreenAction::UwsCallBack: ICO_UWS_EVT_DEL_FD(id=%d, fd=%d)",
+                   reinterpret_cast<int>(id), detail->_ico_uws_fd.fd);
+        break;
+
+    default:
+        break;
+    }
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   OnScreenAction::EcoreEvent
+ *          timer handler, it is called by Ecore.
+ *
+ * @param[in]   data                user data
+ * @return      call back setting
+ * @retval      ECORE_CALLBACK_RENEW    set callback
+ */
+/*--------------------------------------------------------------------------*/
+Eina_Bool 
+CicoOnScreenAction::EcoreEvent(void *data)
+{
+    if (context->GetWsConnected()) {
+        ico_uws_service(context->GetUwsContext());
+    }
+    else {
+        if (context != NULL || context->GetUwsContext() != NULL) {
+            DeleteContext();
+        }
+        CreateContext(); 
+    }
+
+    return ECORE_CALLBACK_RENEW;
+}
+
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenAction::TouchUpEdje
+ *          processing when edje button touch up.
+ *
+ * @param[in]   data                user data
+ * @param[in]   obj                 evas object of the button
+ * @param[in]   event_info          evas event infomation
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoOnScreenAction::TouchUpEdje(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+    if (wait_reply == ICO_ONS_CMD_WAIT){
+        return;
+    } 
+    wait_reply = ICO_ONS_CMD_WAIT;
+
+    /* get name from userdata */
+    if (data != NULL) {
+        ICO_DBG("CicoOnScreenAction::TouchUpEdje: user data is %s", 
+                   static_cast<const char *>(data));
+    }
+    else {
+        ICO_DBG("CicoOnScreenAction::TouchUpEdje: user data is NULL");
+    }
+    context->EventMessage(const_cast<char*>("%s TOUCH %s %s"), ICO_HS_MSG_HEAD_OS, edje_str, data);
+
+    /* operation sound */
+    sound->PlaySound(sound->GetSoundFileName(ICO_HS_SND_TYPE_DEFAULT));
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenAction::TouchUpNext
+ *          processing when next button touch up.
+ *
+ * @param[in]   data                user data
+ * @param[in]   obj                 evas object of the button
+ * @param[in]   event_info          evas event infomation
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoOnScreenAction::TouchUpNext(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+   
+    if (wait_reply == ICO_ONS_CMD_WAIT){
+        return;
+    }
+    wait_reply = ICO_ONS_CMD_WAIT;
+
+    CicoOnScreenAppList::NextList();
+
+    /* get name from userdata */
+    if (data != NULL) {
+        ICO_DBG("CicoOnScreenAction::TouchUpNext: user data is %s", 
+                   static_cast<const char *>(data));
+    }
+    else {
+        ICO_DBG("OCicoOnScreenAction::TouchUpNext: user data is NULL");
+    }
+    context->EventMessage(static_cast<char*>("%s TOUCH %s %s"), ICO_HS_MSG_HEAD_OS, edje_str, data);
+
+    /* operation sound */
+    sound->PlaySound(sound->GetSoundFileName(ICO_HS_SND_TYPE_DEFAULT));
+    
+}
+
+
diff --git a/src/homescreen/CicoOnScreenAction.h b/src/homescreen/CicoOnScreenAction.h
new file mode 100644 (file)
index 0000000..9c8e859
--- /dev/null
@@ -0,0 +1,79 @@
+#ifndef __CICOONSCREENACTION_H__
+#define __CICOONSCREENACTION_H__
+/*
+ * 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   touch action for onscreen application
+ *
+ * @date    Feb-15-2013
+ */
+#include <unistd.h>
+#include <Eina.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#include <Ecore_Evas.h>
+#include <Edje.h>
+
+#include "home_screen.h"
+#include "home_screen_res.h"
+#include "CicoHomeScreenConfig.h"
+#include "CicoHomeScreenSound.h"
+#include "CicoOnScreenAppList.h"
+#include "CicoOnScreenContext.h"
+
+#include <ico_uws.h>
+
+/*============================================================================*/
+/* Define data types                                                          */
+/*============================================================================*/
+#define ICO_ONS_WS_TIMEOUT 0.1
+#define ICO_ONS_BUF_SIZE    (1024)
+
+#define ICO_ONS_CMD_WAIT    (1)
+#define ICO_ONS_NO_WAIT     (2)
+
+/*============================================================================*/
+/* Class Declaration (CicoOnscreenControlContext)                                    */
+/*============================================================================*/
+class CicoOnScreenAction                                                     
+{
+  public:
+    static void Initialize(CicoHomeScreenConfig *homescreen_config,
+                           CicoHomeScreenSound *sound_tmp);
+    static void Finalize(void);
+    static Eina_Bool EcoreEvent(void *data);
+    static void UwsCallBack(const struct ico_uws_context *context,
+                const ico_uws_evt_e event, const void *id,
+                const ico_uws_detail *detail, void *data);
+    static void TouchUpEdje(void *data,
+                            Evas *evas, 
+                            Evas_Object *obj,
+                            void *event_info);
+    static void TouchUpNext(void *data,
+                            Evas *evas,
+                            Evas_Object *obj,
+                            void *event_info);
+  private:
+    static void CreateContext(void);
+    static void DeleteContext(void);
+    static char *EdjeParseStr(void *in, int arg_num);
+   
+    static char edje_str[ICO_ONS_BUF_SIZE];
+    static int wait_reply;
+    static int ws_port;
+    static CicoOnScreenContext* context;
+    static CicoHomeScreenSound* sound;
+  protected:
+    CicoOnScreenAction operator = (const CicoOnScreenAction&);
+    CicoOnScreenAction(const CicoOnScreenAction&);
+};
+
+#endif
+
diff --git a/src/homescreen/CicoOnScreenAppList.cpp b/src/homescreen/CicoOnScreenAppList.cpp
new file mode 100644 (file)
index 0000000..b35709f
--- /dev/null
@@ -0,0 +1,371 @@
+/*
+ * 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   onscreen application
+ *
+ * @date    Feb-15-2013
+ */
+#include "CicoOnScreenAppList.h"
+
+/*============================================================================*/
+/* Declare static values                                                      */
+/*============================================================================*/
+CicoOnScreenControlWindow *CicoOnScreenAppList::control_window;
+int CicoOnScreenAppList::applist_idx; 
+int CicoOnScreenAppList::app_cnt; 
+
+/*============================================================================*/
+/* Functions Declaration (CicoOnScreenAppList)                          */
+/*============================================================================*/
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenAppList::Initialize
+ *          initialize applist
+ *
+ * @param[in]   controlWindow    instance of CicoOnScreenControlWindow
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoOnScreenAppList::Initialize(CicoOnScreenControlWindow *control_window_tmp)
+{
+    control_window = NULL;
+    applist_idx = 0;
+    app_cnt = 0;
+
+    control_window = control_window_tmp;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenAppList::SetConfigCallback
+ *          set callback for config
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoOnScreenAppList::SetConfigCallback(void)
+{
+    ico_uxf_econf_setAppUpdateCb(ConfigEvent);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenAppList::GetAppIndex
+ *          return a application index that to be set indicated index.
+ *
+ * @param[in]   filepath            file path
+ * @return      index or ERROR
+ */
+/*--------------------------------------------------------------------------*/
+int 
+CicoOnScreenAppList::GetAppIndex(int idx)
+{
+    int ii;
+    int appidx = idx + applist_idx * ICO_ONS_APPLI_NUM + 1;
+    int cnt = 0;
+    Ico_Uxf_App_Config *appconf = const_cast<Ico_Uxf_App_Config *>(ico_uxf_getAppConfig());
+
+    ICO_DBG("CicoOnScreenAppList::GetAppIndex: idx=%d appidx=%d appcnt=%d",
+               idx, appidx, app_cnt);
+
+    for (ii = 0; ii < appconf->applicationNum; ii++) {
+        if ((! appconf->application[ii].noicon) &&
+            (strcmp(appconf->application[ii].type, ICO_HS_GROUP_SPECIAL) != 0)) {
+            ++cnt;
+        }
+        if (cnt == appidx) {
+            return ii;
+        }
+    }
+
+    return -1;
+}
+                                                                              
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenAppList::LoadConfig
+ *          load/reload configuration of Application.
+ *          and except special group applications and no icon applications from showing.
+ *
+ * @param       none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoOnScreenAppList::LoadConfig(void)  
+{
+    Ico_Uxf_App_Config *appconf;
+    int appcnt;
+    int appidx, idx, cnt;
+
+    ICO_DBG("CicoOnScreenAppList::LoadConfig: Enter");
+
+    appconf = const_cast<Ico_Uxf_App_Config *>(ico_uxf_getAppConfig());
+    appcnt = appconf->applicationNum;
+    for (appidx = 0; appidx < appconf->applicationNum; appidx++) {
+        if ((appconf->application[appidx].noicon) ||
+            (strcmp(appconf->application[appidx].type, ICO_HS_GROUP_SPECIAL) == 0)) {
+            appcnt--;
+            ICO_DBG("CicoOnScreenAppList::LoadConfig: No Need appid=%s noicon=%d type=%s",
+                       appconf->application[appidx].appid,
+                       appconf->application[appidx].noicon,
+                       appconf->application[appidx].type);
+        }
+    }
+    cnt = 0;
+    for (idx = 0; idx < appcnt; idx++) {
+        appidx = GetAppIndex(idx);
+        if (appidx > 0) {
+            ICO_DBG("CicoOnScreenAppList::LoadConfig: appid=%s seat=%d idx=%d seatcnt=%d",
+                       appconf->application[appidx].appid, cnt
+                               / ICO_ONS_APPLI_NUM, idx - ICO_ONS_APPLI_NUM
+                               * (cnt / ICO_ONS_APPLI_NUM), ((appcnt - 1)
+                               / ICO_ONS_APPLI_NUM) + 1);
+            ++cnt;
+        }
+    }
+
+    app_cnt = appcnt;
+    applist_idx = 0;
+    ICO_DBG("CicoOnScreenAppList::LoadConfig: Leave(appcnt=%d)", appcnt);
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenAppList::ConfigEvent
+ *          This is a callback function called when configurations
+ *          were updated.
+ *
+ * @param[in]   appid               application id
+ * @param[in]   type                event type(install/uninstall)
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoOnScreenAppList::ConfigEvent(const char *appid, int type)
+{
+    ICO_DBG("CicoOnScreenAppList::LoadConfig: Enter(appid=%s, type=%d)", 
+               appid, type);
+
+    LoadConfig();
+
+    ICO_DBG("CicoOnScreenAppList::LoadConfig: Leave");
+
+    return;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenAppList::SetAppIcons
+ *          set App Icon on rect
+ *
+ * @param[in]   part               part
+ * @param[in]   partname           part name
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoOnScreenAppList::SetAppIcons(Evas_Object* part,const char *partname)
+{
+    int idx; /* rect index */
+    int appidx; /* appli index */
+    char imgfile[ICO_ONS_BUF_SIZE];
+    Ico_Uxf_App_Config *appconf;
+    Evas_Object *img = NULL;
+
+    memset(imgfile, 0, sizeof(imgfile));
+    /* check name, if part is rect/next_bt/cancel_bt */
+    if (strncmp(partname, ICO_HS_ONS_PART_RECT_NAME,
+                sizeof(ICO_HS_ONS_PART_RECT_NAME) - 1) == 0) {
+        img = control_window->EvasObjectImageFilledAdd();
+        /* get rect index from partname(rect_01, rect_02, ...) */
+        sscanf(partname, ICO_HS_ONS_PART_RECT_NAME"%d", &idx);
+        idx -= 1;
+
+        appconf = const_cast<Ico_Uxf_App_Config *>(ico_uxf_getAppConfig());
+
+        appidx = GetAppIndex(idx);
+        ICO_DBG("CicoOnScreenAppList::SetAppIcons: idx=%d appidx=%d",
+                   idx, appidx);
+        if ((appidx < 0) || (appidx > appconf->applicationNum)) {
+           control_window->EvasObjectDel(img);
+            return;
+        }
+
+        /* set icon file name */
+        snprintf(imgfile, ICO_ONS_BUF_SIZE, "%s",
+                 appconf->application[appidx].icon_key_name);
+        ICO_DBG("CicoOnScreenAppList::SetAppIcons: set image = %s(%d/%d), app=%s, group=%s",
+                   imgfile, appidx, app_cnt, appconf->application[appidx].appid,
+                   appconf->application[appidx].group);
+        /* set mouse call back function */
+        control_window->EvasObjectEventCallBack(img, EVAS_CALLBACK_MOUSE_UP,
+                                       CicoOnScreenAction::TouchUpEdje,
+                                       appconf->application[appidx].appid);
+    }
+    else if (strcmp(partname, ICO_HS_ONS_PART_NEXT_NAME) == 0) {
+        control_window->EvasObjectEventCallBack(part, EVAS_CALLBACK_MOUSE_UP,
+                                       CicoOnScreenAction::TouchUpNext, 
+                                       static_cast<void*>(const_cast<char*>(partname)));
+    }
+    else if (strcmp(partname, ICO_HS_ONS_PART_CANCEL_NAME) == 0) {
+        control_window->EvasObjectEventCallBack(part, EVAS_CALLBACK_MOUSE_UP,
+                                       CicoOnScreenAction::TouchUpEdje, 
+                                       static_cast<void*>(const_cast<char*>(partname)));
+    }
+    else {
+        return;
+    }
+
+    control_window->UpdateEvasObject(img,imgfile,partname);
+    
+    
+    control_window->EinaListAppend(img);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenAppList::GetFname(
+ *          get filename from the full path
+ *
+ * @param[in]   filepath            file path
+ * @return      filename
+ */
+/*--------------------------------------------------------------------------*/
+const char *
+CicoOnScreenAppList::GetFname(const char *filepath)
+{
+    int ii;
+    const char *name = filepath;
+
+    for (ii = 0; ii < ICO_ONS_BUF_SIZE - 1; ii++) {
+        if (filepath[ii] == 0)
+            break;
+        if (filepath[ii] == '/')
+            name = &filepath[ii + 1];
+    }
+
+    return name;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenAppList::LoadIconsEdjeFile
+ *          loadIcons
+ *
+ * @param[in]   evas               evas
+ * @param[in]   edje               edje
+ * @param[in]   part               part
+ * @param[in]   partname           part name
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoOnScreenAppList::LoadIconsEdjeFile(const char *edje_file)
+{
+    int ret;
+    Evas_Object *part; /* part handle */
+    Eina_List *group; /* edje group list */
+    Eina_List *list; /* part list in edje */
+    int group_count = 0; /* group counter */
+    int name_count = 0; /* name counter */
+  
+    /* init evas (if it doesn't yet) */
+    ret = control_window->InitEvas();
+    if(ret < 0){
+        return -1;
+    }
+
+    /* delete pre image */
+    control_window->DeletePreImage();
+    /* create and show edje*/
+    control_window->CreateAndShowEdje();
+
+    /* get group list */
+    group = control_window->GetEdjeFileCollectionList(edje_file);
+    while (group != NULL) {
+        ret = control_window->SetEdjeFile(group,edje_file);
+        ICO_DBG("CicoOnScreenAppList::LoadIconsEdjeFile: group[%d] data : %s",
+                   group_count,static_cast<const char *>(group->data));
+        /* get list */
+        list = control_window->GetEdjeObjectAccessPartList();
+        while (list != NULL) {
+            ICO_DBG("CicoOnScreenAppList::LoadIconsEdjeFile: list[%d] data : %s",
+                       name_count,static_cast<const char *>(list->data));
+
+            /* set callback for part name */
+            part = control_window->GetEdjeObjectPartObject((const char *)list->data);
+            if (part != NULL) {
+                ICO_DBG("CicoOnScreenAppList::LoadIconsEdjeFile: list[%d] name : %s",
+                           name_count,static_cast<const char *>(list->data));
+
+                /* if not applist */
+                if (strncmp(GetFname(edje_file), ICO_HS_ONS_APPLI_LIST_NAME,
+                            sizeof(ICO_HS_ONS_APPLI_LIST_NAME) - 1) != 0) {
+                    control_window->EvasObjectEventCallBack(part,
+                                                   EVAS_CALLBACK_MOUSE_UP,
+                                                   CicoOnScreenAction::TouchUpEdje,
+                                                   list->data);
+                }
+                /* if applist */
+                else {
+                    SetAppIcons(part, static_cast<const char *>(list->data));
+                }
+            }
+            else {
+                ICO_DBG("CicoOnScreenAppList::LoadIconsEdjeFile: list[%d] is NULL",
+                           name_count);
+            }
+            /* to next list */
+            list = list->next;
+            ++name_count;
+        }
+        /* to next group */
+        group = group->next;
+        ++group_count;
+    }
+    ICO_DBG("CicoOnScreenAppList::LoadIconsEdjeFile: group num is %d", group_count);
+    ICO_DBG("CicoOnScreenAppList::LoadIconsEdjeFile: name num is %d", name_count);
+
+    return 0;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenAppList::NextList
+ *          change to NextList
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void CicoOnScreenAppList::NextList(void){
+    int listcnt;
+    if (app_cnt > 0) {
+        listcnt = ((app_cnt - 1) / ICO_ONS_APPLI_NUM) + 1;
+    }
+    else {
+        listcnt = 1;
+    }
+    applist_idx += 1;
+    if (applist_idx >= listcnt) {
+        applist_idx = 0;
+    }
+}
+
+
diff --git a/src/homescreen/CicoOnScreenAppList.h b/src/homescreen/CicoOnScreenAppList.h
new file mode 100644 (file)
index 0000000..8f56c0f
--- /dev/null
@@ -0,0 +1,65 @@
+#ifndef __CICOONSCREENAPPLIST_H__
+#define __CICOONSCREENAPPLIST_H__
+/*
+ * 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   onscreen application
+ *
+ * @date    Feb-15-2013
+ */
+#include <unistd.h>
+#include <Eina.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#include <Ecore_Evas.h>
+#include <Edje.h>
+
+#include "ico_uxf.h"
+#include "ico_uxf_conf.h"
+#include "ico_uxf_conf_ecore.h"
+
+#include "home_screen.h"
+#include "home_screen_res.h"
+#include "CicoOnScreenControlWindow.h"
+#include "CicoOnScreenAction.h"
+
+/*============================================================================*/
+/* Define data types                                                          */
+/*============================================================================*/
+#define ICO_ONS_BUF_SIZE    (1024)
+#define ICO_ONS_APPLI_NUM    (15)        /* only for applist */
+
+/*============================================================================*/
+/* Class Declaration (CicoOnScreenAppList)                                        */
+/*============================================================================*/
+class CicoOnScreenAppList                                                      
+{
+ public:
+    static void Initialize(CicoOnScreenControlWindow *control_window_tmp);
+    static void LoadConfig(void);
+    static void ConfigEvent(const char *appid, int type);                                             
+    static void SetConfigCallback(void);
+    static int LoadIconsEdjeFile(const char *edje_file);
+    static void NextList(void);                                                                               
+  private:
+    static int GetAppIndex(int idx);                                                                         
+    static void SetAppIcons(Evas_Object *part,const char *partname); 
+    static const char *GetFname(const char *filepath);
+         
+    static CicoOnScreenControlWindow *control_window; 
+    static int applist_idx; /* only for applist, it's index */
+    static int app_cnt; /* only for applist. a number of app to listed */
+  protected:
+    CicoOnScreenAppList operator = (const CicoOnScreenAppList&);
+    CicoOnScreenAppList(const CicoOnScreenAppList&);
+};
+
+#endif
+
diff --git a/src/homescreen/CicoOnScreenContext.cpp b/src/homescreen/CicoOnScreenContext.cpp
new file mode 100644 (file)
index 0000000..2b02327
--- /dev/null
@@ -0,0 +1,189 @@
+/*
+ * 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   onscreen application
+ *
+ * @date    Feb-15-2013
+ */
+#include "CicoOnScreenContext.h"
+
+/*============================================================================*/
+/* Functions Declaration (CicoOnScreenContext)                                */
+/*============================================================================*/
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenContext::CloseUwsContext()
+ *          close context
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void CicoOnScreenContext::CloseUwsContext(void)
+{
+    ico_uws_close(uws_context);
+    uws_context = NULL;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenContext::setUwsId()
+ *          setting id value
+ *
+ * @param[in]   id       setting value
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void CicoOnScreenContext::SetUwsId(void *id)
+{
+    uws_id = id;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenContext::CicoOnScreenContext
+ *          constractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoOnScreenContext::CicoOnScreenContext(int ws_port_tmp)
+{
+   
+    char uri[ICO_HS_TEMP_BUF_SIZE];
+
+    uws_id = NULL;
+    ws_connected = 0;
+    uws_context = NULL;
+
+    /* set up URI "ws://HOST:PORT" */
+    ws_port = ws_port_tmp;
+    sprintf(uri, "ws://%s:%d", ICO_HS_WS_HOST, ws_port);
+
+    /* create context */
+    uws_context = ico_uws_create_context(uri, ICO_HS_PROTOCOL);
+    ICO_DBG("CicoOnScreenContext::CicoOnScreenContext: ctx = %p",
+               uws_context);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenContext::~CicoOnScreenContext
+ *          constractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoOnScreenContext::~CicoOnScreenContext()
+{
+    ico_uws_close(uws_context);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenContext::SetCallBack
+ *          set callback function
+ *
+ * @param[in]   callback    callback function
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoOnScreenContext::SetCallBack(void (*callback)(const ico_uws_context*,
+                                                  ico_uws_evt_e, 
+                                                  const void*, 
+                                                  const ico_uws_detail*, 
+                                                  void*))
+{
+    int ret;
+    /* set callback */
+    ws_connected = 0;
+    
+    if (uws_context == NULL) {
+        ICO_DBG("CicoOnScreenContext::SetCallBack: libwebsocket_create_context failed.");
+    }
+    else {
+        /* set callback */
+        ret = ico_uws_set_event_cb(uws_context,callback, NULL);
+        if (ret != ICO_UWS_ERR_NONE) {
+             ICO_DBG("CicoOnScreenContext::SetCallBack: cannnot set callback");
+        }
+        ws_connected = 1;
+    }
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenContext::EventMessage
+ *          send message
+ *
+ * @param[in]   wsi                 libwebsockets management table to send
+ * @param[in]   format              message to send
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoOnScreenContext::EventMessage(char *format, ...)
+{
+    va_list list;
+    unsigned char message[ICO_HS_TEMP_BUF_SIZE];
+
+    va_start(list, format);
+    vsnprintf(reinterpret_cast<char*>(message), sizeof(message), format, list);
+    va_end(list);
+
+    ICO_DBG("CicoOnScreenContext::EventMessage: ons_event_message %s", message);
+
+    ico_uws_send(uws_context,uws_id, message, strlen(reinterpret_cast<char*>(message)));
+
+    return;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenContext::GetWsConnected
+ *          get current value of ws_connected
+ *
+ * @param[in]   none
+ * @return      ws_connected
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoOnScreenContext::GetWsConnected(void)
+{
+    return ws_connected;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenContext::GetUwsContext
+ *          get current value of uws_context
+ *
+ * @param[in]   none
+ * @return      uws_context
+ */
+/*--------------------------------------------------------------------------*/
+struct ico_uws_context *
+CicoOnScreenContext::GetUwsContext(void)
+{
+    return uws_context;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenContext::SetWsConnected
+ *          set value to ws_connected
+ *
+ * @param[in]   value  value to ws_connected
+ * @return      void
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoOnScreenContext::SetWsConnected(int value)
+{
+   ws_connected = value;
+}
+
diff --git a/src/homescreen/CicoOnScreenContext.h b/src/homescreen/CicoOnScreenContext.h
new file mode 100644 (file)
index 0000000..1978ddb
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef __CICOONSCREENCONTEXT_H__
+#define __CICOONSCREENCONTEXT_H__
+/*
+ * 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   onscreen application
+ *
+ * @date    Feb-15-2013
+ */
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "ico_uxf.h"
+#include "ico_uxf_conf.h"
+#include "ico_uxf_conf_ecore.h"
+
+#include "home_screen.h"
+#include "home_screen_res.h"
+
+
+#include <ico_uws.h>
+
+                                                                        
+/*============================================================================*/
+/* Class Declaration (CicoOnscreenContext)                               */
+/*============================================================================*/
+class CicoOnScreenContext                                                     
+{
+  public:
+    CicoOnScreenContext(int ws_port);
+    ~CicoOnScreenContext(void);
+    void SetUwsId(void *id);
+    int GetWsConnected(void); 
+    struct ico_uws_context *GetUwsContext(void);
+    void CloseUwsContext();
+    void SetWsConnected(int value);
+    void SetCallBack(void (*callback)(const ico_uws_context*,
+                                      ico_uws_evt_e,
+                                      const void*, 
+                                      const ico_uws_detail*,
+                                      void*));
+    void EventMessage(char *format, ...);
+  private:
+    void *uws_id;
+    int ws_port;
+    int ws_connected;
+    struct ico_uws_context *uws_context;
+  protected:
+    CicoOnScreenContext operator = (const CicoOnScreenContext&); 
+    CicoOnScreenContext(const CicoOnScreenContext&); 
+};
+#endif
+
diff --git a/src/homescreen/CicoOnScreenControlWindow.cpp b/src/homescreen/CicoOnScreenControlWindow.cpp
new file mode 100644 (file)
index 0000000..b9197ad
--- /dev/null
@@ -0,0 +1,484 @@
+/*
+ * 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   window control for onscreen application
+ *
+ * @date    Feb-15-2013
+ */
+#include "CicoOnScreenControlWindow.h"
+
+/*============================================================================*/
+/* Functions Declaration (CicoOnscreenControlWindow)                          */
+/*============================================================================*/
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::CicoOnScreenControlWindow
+ *          constractor 
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoOnScreenControlWindow::CicoOnScreenControlWindow()
+{
+    window = NULL;
+    evas = NULL;
+    edje = NULL;
+    img_list = NULL;
+
+    /* Reset a ecore_evas */
+    ecore_evas_init();
+
+    /* Initialize a edje */
+    edje_init();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::~CicoOnScreenControlWindow
+ *          destructor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoOnScreenControlWindow::~CicoOnScreenControlWindow()
+{
+    /* edje shutdown*/
+    edje_shutdown();
+
+    if(window != NULL){
+        ecore_evas_free(window);
+    }
+    /* end the ecore_evas */
+    ecore_evas_shutdown();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::CreateEcoreEvas
+ *          make new ecore_evas 
+ *
+ * @param[in]   none
+ * @return      0:success -1:failed
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoOnScreenControlWindow::CreateEcoreEvas(void)
+{
+    /* Make a new ecore_evas */
+    window = ecore_evas_new(NULL, 0, 0, 1, 1, "frame=0");
+
+    /* if not for a window, return NULL */
+    if (!window) {
+        EINA_LOG_CRIT("OnScreen: could not create ons_window.");
+        return -1;
+    }
+    ecore_evas_callback_delete_request_set(window, QuitEcoreLoop);
+
+    return 0; 
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::ResizeWindow
+ *          resize window 
+ *
+ * @param[in]   configExist     if config is existing this parameter is ICO_HS_OK
+ * @param[in]   orientation     setting ICO_ONS_HORIZONTAL or ICO_ONS_VERTICAL
+ *                              (if config is existing,this value is ignored)
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoOnScreenControlWindow::ResizeWindow(CicoHomeScreenConfig *homescreen_config,int orientation)
+{
+    int width_tmp, height_tmp;
+  
+    /* load configuration */
+    if (homescreen_config != NULL) {
+       orientation = homescreen_config->ConfigGetInteger(ICO_HS_CONFIG_ONSCREEN,
+                                          ICO_HS_CONFIG_ORIENTAION,
+                                          orientation);
+    }
+
+    /* resize window */
+    ecore_main_loop_iterate();
+    ecore_wl_screen_size_get(&width_tmp, &height_tmp); /*getting size of screen*/
+    if (orientation == ICO_ONS_VERTICAL) {
+        width = width_tmp > height_tmp ? height_tmp : width_tmp;
+        height = width_tmp > height_tmp ? width_tmp : height_tmp;
+    }
+    else {
+        width = width_tmp < height_tmp ? height_tmp : width_tmp;
+        height = width_tmp < height_tmp ? width_tmp : height_tmp;
+    }
+    ecore_evas_resize(window, width, height); /*resize*/
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::ShowWindow
+ *          show Window
+ *
+ * @param[in]   void
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoOnScreenControlWindow::ShowWindow(void)
+{
+    ecore_evas_alpha_set(window, EINA_TRUE); 
+    ecore_evas_show(window);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::StartEcoreLoop
+ *          start ecore loop
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoOnScreenControlWindow::StartEcoreLoop(void)
+{
+    /* Start main loop */
+    ecore_main_loop_begin();
+}
+
+/*--------------------------------------------------------------------------*/
+/*
+ * @brief   CicoOnScreenControlWindow::QuitEcoreLoop
+ *          callback function called by EFL when ecore destroyed.
+ *          exit ecore main loop.
+ *
+ * @param[in]   ee                  ecore evas object
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoOnScreenControlWindow::QuitEcoreLoop(Ecore_Evas *ee)
+{
+    uifw_trace("CicoOnScreenControlWindow::QuitEcoreLoop: Enter");
+    ecore_main_loop_quit();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::GetWidth
+ *          width of window
+ *
+ * @param[in]   none
+ * @return      width
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoOnScreenControlWindow::GetWidth(void)
+{
+    return width;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::GetHeight
+ *          height of window
+ *
+ * @param[in]   none
+ * @return      height
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoOnScreenControlWindow::GetHeight(void)
+{
+    return height;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::InitEvas
+ *          initialize evas 
+ *
+ * @param[in]   none
+ * @return      0:OK -1:NG
+ */
+/*--------------------------------------------------------------------------*/
+int 
+CicoOnScreenControlWindow::InitEvas(void)
+{
+    Evas_Object *canvas;
+
+    if (evas) {
+        return 0;
+    }
+
+    evas = ecore_evas_get(window);
+    if (!evas) {
+        uifw_trace("CicoOnScreenControlWindow::InitEvas: could not create evas.");
+        return -1;
+    }
+
+    /* set color */
+    canvas = evas_object_rectangle_add(evas);
+    evas_object_color_set(canvas, 0, 0, 0, 191);
+    evas_object_move(canvas, 0, 0);
+    evas_object_resize(canvas, width, height);
+    evas_object_show(canvas);
+    
+    return 0;
+
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::DeletePreImage
+ *          delete PreImage 
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoOnScreenControlWindow::DeletePreImage(void)
+{
+   Eina_List *l, *l_next;
+   Evas_Object *data;
+   void* vpdata;
+
+   uifw_trace("CicoOnScreenControlWindow::DeletePreImage: img list is %08x",
+              img_list);   
+
+   EINA_LIST_FOREACH_SAFE(img_list, l, l_next,vpdata) {
+        data=static_cast<Evas_Object *>(vpdata);
+        uifw_trace("CicoOnScreenControlWindow::DeletePreImage: del data is %08x",
+                   data);
+        evas_object_del(data);
+        img_list = eina_list_remove_list(img_list, l);
+    }
+
+    /* delete edje */
+    if (edje) {
+        evas_object_del(edje);
+    }
+
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::CreateAndShowEdje
+ *          delete PreImage 
+ *
+ * @param[in]   none
+ * @return      0:OK -1:NG
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoOnScreenControlWindow::CreateAndShowEdje(void)
+{
+    int moveX, moveY; /* move list to center */
+    /* create and add object in canvas from edje */
+    edje = edje_object_add(evas);
+    if (!edje) {
+        uifw_trace("CicoOnScreenControlWindow::CreateAndShowEdje: could not create edje object!");
+        return -1;
+    }
+
+    uifw_trace("CicoOnScreenControlWindow::CreateAndShowEdje: w=%d h=%d",
+               width, height);
+
+    /* calc move */
+    moveX = (width - ICO_HS_SIZE_LAYOUT_WIDTH) / 2;
+    moveY = (height - ICO_HS_SIZE_LAYOUT_HEIGHT) / 2;
+
+    /* Put in the image */
+    evas_object_move(edje, moveX, moveY);
+    /* Resize the image */
+    evas_object_resize(edje, width, height);
+    /* Show the image */
+    evas_object_show(edje);
+
+    return 0;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::GetEdjeFileCollectionList
+ *          get edje file collection list
+ *
+ * @param[in]   edje_file   edje file
+ * @return      EinaList
+ */
+/*--------------------------------------------------------------------------*/
+Eina_List *
+CicoOnScreenControlWindow::GetEdjeFileCollectionList(const char *edje_file)
+{
+    return edje_file_collection_list(edje_file);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::SetEdjeFile
+ *          set edje file
+ *
+ * @param[in]   group     eina listons_wait_reply
+ * @param[in]   edje_file     edje file 
+ * @return      EinaList
+ */
+/*--------------------------------------------------------------------------*/
+int 
+CicoOnScreenControlWindow::SetEdjeFile(Eina_List* group,const char *edje_file)
+{
+    /* Set the edj file */
+    if (!edje_object_file_set(edje, edje_file, static_cast<const char *>(group->data))) {
+        Edje_Load_Error err = edje_object_load_error_get(edje);
+        const char *errmsg = edje_load_error_str(err);
+        uifw_trace("CicoOnScreenControlWindow::SetEdjeFile: could not load %s: %s",
+                   edje_file, errmsg);
+
+        edje_file_collection_list_free(group);
+        evas_object_del(edje);
+        return -1;
+    }
+  
+    return 0;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::GetEdjeObjectAccessPartList
+ *          get edje object access part list
+ *
+ * @param[in]   none
+ * @return      EinaList
+ */
+/*--------------------------------------------------------------------------*/
+Eina_List *
+CicoOnScreenControlWindow::GetEdjeObjectAccessPartList(void)
+{
+    return edje_object_access_part_list_get(edje);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::GetEdjeObjectPartObject
+ *          get edje object part object
+ *
+ * @param[in]   data     data
+ * @return      Evas_Object
+ */
+/*--------------------------------------------------------------------------*/
+Evas_Object *
+CicoOnScreenControlWindow::GetEdjeObjectPartObject(const char * data)
+{
+    return  const_cast<Evas_Object *>(edje_object_part_object_get(edje,data));
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::EvasObjectEventCallBack
+ *          set evas object event callback
+ *
+ * @param[in]   obj         Evas_Ojbect
+ * @param[in]   type        Evas_CallBack_Type
+ * @param[in]   func        callback function 
+ * @param[in]   data        data
+ * @return      Evas_Object
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoOnScreenControlWindow::EvasObjectEventCallBack(Evas_Object *obj,
+                                                   Evas_Callback_Type type,
+                                                   void (*func)(void*,
+                                                       Evas*,
+                                                       Evas_Object*,
+                                                       void*),
+                                                   void *data)
+{
+    evas_object_event_callback_add(obj,type,func,data);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::EvasObjectImageFilledAdd
+ *          evas object image filled add
+ *
+ * @param[in]   none
+ * @return      Evas_Object
+ */
+/*--------------------------------------------------------------------------*/
+Evas_Object * 
+CicoOnScreenControlWindow::EvasObjectImageFilledAdd(void)
+{
+    return evas_object_image_filled_add(evas);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::EvasObjectDel
+ *          delete evas object 
+ *
+ * @param[in]   object    Evas_Object
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoOnScreenControlWindow::EvasObjectDel(Evas_Object * object)
+{
+    evas_object_del(object);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::UpdateEvasObject
+ *          update evas object
+ *
+ * @param[in]   img        Evas_Object
+ * @param[in]   imgfile    img file
+ * @param[in]   partname   part name
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoOnScreenControlWindow::UpdateEvasObject(Evas_Object *img,
+                                            const char *imgfile,
+                                            const char *partname)
+{
+    int x, y, w, h;
+    if (strlen(imgfile) > 0) {
+        /* calculation icon pos */
+        edje_object_part_geometry_get(edje, partname, &x, &y, &w, &h);
+        x += (width - ICO_HS_SIZE_LAYOUT_WIDTH) / 2;
+        y += (height - ICO_HS_SIZE_LAYOUT_HEIGHT) / 2;
+
+        evas_object_image_file_set(img, imgfile, NULL);
+        evas_object_move(img, x, y);
+        evas_object_resize(img, w, h);
+        evas_object_show(img);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoOnScreenControlWindow::EinaListAppend
+ *          eina list append
+ *
+ * @param[in]   img          Evas_Object
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoOnScreenControlWindow::EinaListAppend(Evas_Object *img)
+{
+    img_list = eina_list_append(img_list, img);
+}
+
+
diff --git a/src/homescreen/CicoOnScreenControlWindow.h b/src/homescreen/CicoOnScreenControlWindow.h
new file mode 100644 (file)
index 0000000..10e58c3
--- /dev/null
@@ -0,0 +1,85 @@
+#ifndef __CICOONSCREENCONTROLWINDOW_H_
+#define __CICOONSCREENCONTROLWINDOW_H_
+/*
+ * 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   window control for onscreen application
+ *
+ * @date    Feb-15-2013
+ */
+#include <unistd.h>
+#include <Eina.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#include <Ecore_Evas.h>
+#include <Edje.h>
+
+#include "home_screen.h"
+#include "home_screen_res.h"
+#include "CicoHomeScreenConfig.h"
+#include "CicoHomeScreenSound.h"
+
+/*============================================================================*/
+/* Define data types                                                          */
+/*============================================================================*/
+#define ICO_ONS_VERTICAL    (1)
+#define ICO_ONS_HORIZONTAL  (2)
+
+/*============================================================================*/
+/* Class Declaration (CicoOnScreenControlWindow)                              */
+/*============================================================================*/
+class CicoOnScreenControlWindow                                                     
+{
+ public:
+    CicoOnScreenControlWindow(); /*constractor*/
+    ~CicoOnScreenControlWindow(); /*destractor*/
+
+    int CreateEcoreEvas(void);
+    void ResizeWindow(CicoHomeScreenConfig *homescreen_config,int orientation);
+    void ShowWindow(void);
+    static void StartEcoreLoop(void);
+    static void QuitEcoreLoop(Ecore_Evas*);
+
+    int GetWidth(void);
+    int GetHeight(void);
+    int InitEvas(void);
+    void DeletePreImage(void);
+    int CreateAndShowEdje(void);
+    Eina_List *GetEdjeFileCollectionList(const char *edje_file);
+    int SetEdjeFile(Eina_List*,const char *edje_file);
+    Eina_List *GetEdjeObjectAccessPartList(void);
+    Evas_Object * GetEdjeObjectPartObject(const char * data);
+    void EvasObjectEventCallBack(Evas_Object *obj,
+                                 Evas_Callback_Type type,
+                                 void (*func)(void*,
+                                    Evas*,
+                                    Evas_Object*,
+                                    void*),
+                                 void *data);
+    Evas_Object * EvasObjectImageFilledAdd(void);
+    void EvasObjectDel(Evas_Object * object);
+    void UpdateEvasObject(Evas_Object *img,
+                          const char *imgfile,
+                          const char *partname);
+    void EinaListAppend(Evas_Object *img);
+  private:
+    int width, height;  
+    Ecore_Evas *window; /* ecore-evas object */
+    Evas *evas;         /* evas object */
+    Evas_Object *edje;  /* loaded edje objects */
+    Eina_List *img_list;
+
+  protected:
+    CicoOnScreenControlWindow operator = (const CicoOnScreenControlWindow&); 
+    CicoOnScreenControlWindow(const CicoOnScreenControlWindow&); 
+};
+
+#endif
+
diff --git a/src/homescreen/CicoSCAilItems.cpp b/src/homescreen/CicoSCAilItems.cpp
new file mode 100644 (file)
index 0000000..78cde86
--- /dev/null
@@ -0,0 +1,753 @@
+/*
+ * 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
+ *
+ */
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <vector>
+#include <utility>
+#include <cstdlib>
+
+#include "CicoSCAilItems.h"
+#include "CicoSCConf.h"
+#include "CicoSCSystemConfig.h"
+#include "CicoLog.h"
+
+using namespace std;
+
+void split(const string &s, char d, vector<string> &e)
+{
+    stringstream ss(s);
+    string it;
+    while(getline(ss, it, d)) {
+        e.push_back(it);
+    }
+    return;
+}
+
+/**
+ * @brief constructor
+ */
+CicoSCAilItems::CicoSCAilItems()
+{
+    ICO_TRA("start");
+    init();
+    ICO_TRA("end");
+}
+
+/**
+ * @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 cateforys environ file data
+ */
+CicoSCAilItems::CicoSCAilItems(const char* pkg, const char* icon,
+                               const char* nam, const char* ctgry,
+                               const char* typ, const char* exe,
+                               const std::string categorys, bool ndisp)
+{
+    ICO_TRA("start");
+    init();
+    setup(pkg, icon, nam, ctgry, typ, exe, categorys, ndisp);
+    ICO_TRA("end");
+}
+
+CicoSCAilItems::CicoSCAilItems(const CicoSCAilItems &s)
+{
+    m_appid = s.m_appid;    // PACKAGE NAME
+    m_icon = s.m_icon;  // ICON
+    m_name = s.m_name;  // NAME
+    m_execPath = s.m_execPath;  // EXEC
+    m_type = s.m_type;  // TYPE
+
+    m_categories = s.m_categories; // CATEGORIES
+
+    m_nodeID = s.m_nodeID;  // "run=xxx" xxx change to id
+    m_kindID = s.m_kindID;  // "kind=xxx" xxx change to id
+    m_categoryID = s.m_categoryID;  // "category=xxx" xxx change to id
+
+    m_display = s.m_display; //
+    m_layer = s.m_layer;
+    m_displayZone = s.m_displayZone; // display zone number
+    m_soundZone = s.m_soundZone;  // sound zone number
+    m_sound = s.m_sound;
+    m_inputDev = s.m_inputDev;   // input device number
+    m_switch = s.m_switch;
+    m_noIcon = s.m_noIcon;
+    m_animation = s.m_animation;
+    m_animationTime = s.m_animationTime;
+    m_invisibleCPU = s.m_invisibleCPU;
+    m_memnuOverlap = s.m_memnuOverlap;
+    m_autoStart = s.m_autoStart; // auto start flag
+
+    m_group = s.m_group;
+    m_location = s.m_location;
+    m_resumeShow = s.m_resumeShow;
+}
+
+/**
+ * @brief
+ */
+CicoSCAilItems::~CicoSCAilItems()
+{
+    ICO_TRA("start");
+    ICO_TRA("end");
+}
+/**
+ * @brief init member 
+ */
+void CicoSCAilItems::init()
+{
+    
+    m_appid.clear();      // PACKAGE NAME
+    m_icon.clear();       // ICON
+    m_name.clear();       // NAME
+    m_execPath.clear();   // EXEC
+    m_type.clear();       // TYPE
+
+    m_categories.clear(); // CATEGORIES
+
+    const CicoSCDefaultConf* oCSCDC;
+    oCSCDC = CicoSCSystemConfig::getInstance()->getDefaultConf();
+    if (NULL != oCSCDC) {
+        ICO_TRA("CicoSCAilItems::init base CicoSCDefaultConf");
+        m_nodeID      = oCSCDC->node;
+        m_kindID      = oCSCDC->appkind;
+        m_categoryID  = oCSCDC->category;
+
+        m_display     = oCSCDC->display;
+        m_layer       = oCSCDC->layer;
+        m_displayZone = oCSCDC->displayzone;
+
+        m_sound       = oCSCDC->sound;
+        m_soundZone   = oCSCDC->soundzone;
+
+        m_inputDev    = oCSCDC->inputdev;
+        m_switch      = oCSCDC->inputsw;
+    }
+    else {
+        ICO_TRA("CicoSCAilItems::init base define");
+        m_nodeID      = DINITm_nodeID; // "run=xxx" xxx change to id
+        m_kindID      = DINITm_kindID; // "kind=xxx" xxx change to id
+        m_categoryID  = DINITm_categoryID; // "category=xxx" xxx change to id
+
+        m_display     = DINITm_display; //
+        m_layer       = DINITm_layer;
+        m_displayZone = DINITm_displayZone; // display zone
+
+        m_soundZone   = DINITm_soundZone; // sound zone
+        m_sound       = DINITm_sound;
+
+        m_inputDev    = DINITm_inputDev; // input device
+        m_switch      = DINITm_switch;
+    }
+
+    m_noIcon = false;
+    m_animation.clear();
+    m_animationTime = DINITm_animationTime;
+    m_invisibleCPU = DINITm_invisibleCPU;
+    m_memnuOverlap = false;
+    m_autoStart = false; // auto start flag
+
+    m_group.clear();
+    m_location.clear();
+    m_resumeShow = false;
+}
+
+/**
+ * @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 cateforys environ file data
+ */
+void CicoSCAilItems::setup(const char* pkg, const char* icon,
+                           const char* nam, const char* ctgry,
+                           const char* typ, const char* exe,
+                           std::string categorys, bool ndisp)
+{
+    ICO_TRA("start");
+    m_appid.assign(pkg);
+
+    m_noIcon = ndisp;
+    if (NULL != icon) {
+        m_icon.assign(icon);
+    }
+
+    if (NULL != nam) {
+        m_name.assign(nam);
+    }
+
+    if (NULL != exe) {
+        m_execPath.assign(exe);
+    }
+
+    if (NULL != typ) {
+        m_type.assign(typ);
+    }
+
+    categoryParse(categorys);
+    ICO_TRA("end");
+}
+
+const string s_run("run");
+const string s_kind("kind");
+const string s_category("category");
+const string s_display("display");
+const string s_layer("layer");
+const string s_dispzone("dispzone");
+const string s_sound("sound");
+const string s_input("input");
+const string s_NoDisplay("NoDisplay");
+const string s_Animation("Animation");
+const string s_invisiblecpu("invisiblecpu");
+const string s_noconfigure("noconfigure");
+const string s_menuoverlap("menuoverlap");
+const string s_auto("auto");
+const string s_noauto("noauto");
+
+const string s_soundzone("soundzone");
+const string s_Animation_time("Animation_time");
+
+/**
+ * @brief category string parse
+ * @parm category string data split code ";"
+ */
+void CicoSCAilItems::categoryParse(const std::string categorys)
+{
+    ICO_TRA("start");
+    if (categorys.empty()) {
+        ICO_TRA("end no category");
+        return;
+    }
+    vector<string> x;
+    split(categorys, ';', x);
+    vector<string>::iterator it = x.begin(); // iterator
+    string displayName;
+    string layerName;
+    string dispZoneName;
+    string soundName;
+    string soundZoneName;
+    string inputDevName;
+    string switchName;
+
+    displayName.clear();
+    layerName.clear();
+    dispZoneName.clear();
+    soundName.clear();
+    soundZoneName.clear();
+    inputDevName.clear();
+    switchName.clear();
+
+    ICO_DBG("category def size = %d", x.size());
+    for (it = x.begin(); it != x.end(); it++) {
+
+        // run
+        if (0 == strncasecmp(it->c_str(), s_run.c_str(), s_run.size())) {
+            if (true == categoryParseRun(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // kind
+        if (0 == strncasecmp(it->c_str(), s_kind.c_str(), s_kind.size())) {
+            if (true == categoryParseKind(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // category
+        if (0 == strncasecmp(it->c_str(), s_category.c_str(),
+                             s_category.size())) {
+            if (true == categoryParseCategory(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // display
+        if (0 == strncasecmp(it->c_str(), s_display.c_str(),
+                             s_display.size())) {
+            if (true == categoryParseGetValue(*it, s_display, displayName)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // layer
+        if (0 == strncasecmp(it->c_str(), s_layer.c_str(), s_layer.size())) {
+            if (true == categoryParseGetValue(*it, s_layer, layerName)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // dispzone
+        if (0 == strncasecmp(it->c_str(), s_dispzone.c_str(),
+                             s_dispzone.size())) {
+            if (true == categoryParseGetValue(*it, s_dispzone, dispZoneName)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // sound / soundzone
+        if (0 == strncasecmp(it->c_str(), s_soundzone.c_str(),
+                             s_soundzone.size())) {
+            if (true == categoryParseGetValue(*it, s_soundzone,
+                                              soundZoneName)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+        if (0 == strncasecmp(it->c_str(), s_sound.c_str(), s_sound.size())) {
+            if (true == categoryParseGetValue(*it, s_sound, soundName)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // input
+        if (0 == strncasecmp(it->c_str(), s_input.c_str(), s_input.size())) {
+            if (true == categoryParseGetValue(*it, s_input, inputDevName)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+// TODO mk_k not get switchName
+//     switchName
+// TODO mk_k not get switchName
+
+        // NoDisplay
+        if (0 == strncasecmp(it->c_str(), s_NoDisplay.c_str(),
+                             s_NoDisplay.size())) {
+            if (true == categoryParseNodisplay(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // Animation / Animation_time
+        if (0 == strncasecmp(it->c_str(), s_Animation.c_str(),
+                             s_Animation.size())) {
+            if (true == categoryParseAnimation(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // invisiblecpu
+        if (0 == strncasecmp(it->c_str(), s_invisiblecpu.c_str(),
+                             s_invisiblecpu.size())) {
+            if (true == categoryParseInvisiblecpu(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // noconfigure
+        if (0 == strncasecmp(it->c_str(), s_noconfigure.c_str(),
+                             s_noconfigure.size())) {
+            if (true == categoryParseNoconfigure(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // menuoverlap
+        if (0 == strncasecmp(it->c_str(), s_menuoverlap.c_str(),
+                             s_menuoverlap.size())) {
+            if (true == categoryParseMenuoverlap(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // auto
+        if (0 == strncasecmp(it->c_str(), s_auto.c_str(), s_auto.size())) {
+            if (true == categoryParseAuto(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+
+        // noauto
+        if (0 == strncasecmp(it->c_str(), s_noauto.c_str(),
+                             s_noauto.size())) {
+            if (true == categoryParseNoauto(*it)) {
+                ICO_DBG("Parse OK %s", it->c_str());
+                continue;
+            }
+        }
+        ICO_DBG("Parse UNKOWN %s", it->c_str());
+    }
+    categoryGetDisplay(displayName, layerName, dispZoneName);
+    categoryGetSound(soundName, soundZoneName);
+    categoryGetInput(inputDevName, switchName);
+    ICO_TRA("end");
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseRun(const string& s)
+{
+    ICO_TRA("start");
+    const char* ps = s.c_str();
+    int c = s_run.size();
+    if ('=' != ps[c]) {
+        ICO_TRA("end");
+        return false;
+    }
+    // "run=xxx"
+// TODO mk_k START getHostID(..) request order
+    CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
+    int nodeID = CSCSC->getNodeIdbyName(&ps[c+1]);
+// TODO mk_k int nodeID = -1;
+// TODO mk_k int nodeID = CSCSC->getHostID(&ps[c+1]);
+// TODO mk_k END getHostID(..) request order
+    if (nodeID==-1) {
+        ICO_TRA("end");
+        return false;
+    }
+    m_nodeID = nodeID;
+    ICO_TRA("end %d", m_nodeID);
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseKind(const string& s)
+{
+    ICO_TRA("start");
+    const char* ps = s.c_str();
+    int c = s_kind.size();
+    if ('=' != ps[c]) {
+        ICO_TRA("end");
+        return false;
+    }
+    // "kind=xxx" xxx change to id
+    CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
+    int kindID = CSCSC->getAppKindIdbyName(&ps[c+1]);
+    if (kindID==-1) {
+        ICO_TRA("end");
+        return false;
+    }
+    m_kindID = kindID;
+    ICO_TRA("end %d", m_kindID);
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseCategory(const string& s)
+{
+    ICO_TRA("start");
+    const char* ps = s.c_str();
+    int c = s_category.size();
+    if ('=' != ps[c]) {
+        ICO_TRA("end");
+        return false;  // not "category=xxx"
+    }
+    // "category=xxx" xxx change to id
+    CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
+    int categoryID = CSCSC->getCategoryIdbyName(&ps[c+1]);
+    if (categoryID==-1) {
+        ICO_TRA("end");
+        return false; // unkown category xxx
+    }
+    m_categoryID = categoryID;
+    ICO_TRA("end");
+    return true;
+}
+
+/**
+ * @brief value get
+ * @param s "key=value" string
+ * @param k key string
+ * @param val store value
+ * @retval true get value success
+ * @retval false get not good
+ */
+bool CicoSCAilItems::categoryParseGetValue(const std::string& s,
+                                           const std::string& k,
+                                           std::string val)
+{
+    ICO_TRA("start, %s, %s", s.c_str(), k.c_str());
+    const char* ps = s.c_str();
+    int c = k.size();
+    int c2;
+#if 0 // TODO mk_k x!?
+    int x = -1;
+#endif // TODO mk_k x!?
+    if ('=' == ps[c]) {
+#if 0 // TODO mk_k x!?
+        x = 0;
+#endif // TODO mk_k x!?
+        c2 = c+1;
+    }
+#if 0 // TODO mk_k .[0-9] !?
+    else if (('.' == ps[c]) &&
+             (0 != isdigit((int)ps[c+1])) &&
+             ('=' == ps[c+2])) {
+        x = (int) ps[c+1] - '0';
+        c2 = c+3;
+
+    }
+#endif // TODO mk_k .[0-9] !?
+    else {
+        ICO_TRA("end NG");
+        return false;
+    }
+    val = ps[c2];
+    ICO_TRA("end %s", val.c_str());
+    return true;
+}
+    
+/**
+ * @brief get
+ * @param disp display key name
+ * @param layer display layer key name
+ * @param zone display zone key name
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryGetDisplay(const string& disp,
+                                        const string& layer,
+                                        const string& zone)
+{
+    ICO_TRA("start");
+    if (true == disp.empty()) {
+        ICO_TRA("end not get display's data");
+        return false;
+    }
+
+    CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
+    m_display = CSCSC->getDisplayIdbyName(disp);
+    ICO_DBG("display %s->%d", disp.c_str(), m_display);
+    if (false == layer.empty()) {
+        m_layer = CSCSC->getLayerIdfbyName(disp, layer);
+        ICO_DBG("layer %s, %s->%d", disp.c_str(), layer.c_str(), m_layer);
+    }
+    if (false == zone.empty()) {
+        m_displayZone = CSCSC->getDizplayZoneIdbyName(disp, zone);
+        ICO_DBG("zone %s, %s->%d", disp.c_str(), zone.c_str(), m_displayZone);
+    }
+    ICO_TRA("end d:%d l:%d z:%d", m_display, m_layer, m_displayZone);
+    return true;
+}
+
+/**
+ * @brief get sound config data
+ * @param sound name key
+ * @param soundZone name key
+ * @retval true get data
+ * @retval false param fail
+ */
+bool CicoSCAilItems::categoryGetSound(const string& sound, const string& zone)
+{
+    ICO_TRA("start");
+    if (true == sound.empty()) {
+        ICO_TRA("end not get sound's data");
+        return false;
+    }
+
+    CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
+    m_sound = CSCSC->getSoundIdbyName(sound);
+    ICO_DBG("sound %s->%d", sound.c_str(), m_sound);
+    if (false == zone.empty()) {
+        m_soundZone = CSCSC->getSoundZoneIdbyName(sound, zone);
+        ICO_DBG("zone %s, %s->%d", sound.c_str(), zone.c_str(), m_soundZone);
+    }
+    ICO_TRA("end s:%d z:%d", m_sound, m_soundZone);
+    return true;
+}
+
+bool CicoSCAilItems::categoryGetInput(const string& inputDev,
+                                      const string& sw)
+{
+    ICO_TRA("start");
+    if (true == inputDev.empty()) {
+        ICO_TRA("end not get input Device's data");
+        return false;
+    }
+
+    CicoSCSystemConfig* CSCSC = CicoSCSystemConfig::getInstance();
+    m_sound = CSCSC->getInputDevIdbyName(inputDev);
+    ICO_DBG("sound %s->%d", inputDev.c_str(), m_sound);
+    if (false == sw.empty()) {
+        m_switch = CSCSC->getSwitchIdbyName(inputDev, sw);
+        ICO_DBG("switch %s, %s->%d", inputDev.c_str(), sw.c_str(), m_switch);
+    }
+    ICO_TRA("end idev:%d i:%d", m_inputDev, m_switch);
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseNodisplay(const string& s)
+{
+    ICO_TRA("start");
+    const char* ps = s.c_str();
+    int c = s_NoDisplay.size();
+    if ('=' != ps[c]) {
+        ICO_TRA("end");
+        return false;  // not "NoDisplay=true/false"
+    }
+    if (0 == strcasecmp(&ps[c+1], "false")) {
+        m_noIcon = false;
+    }
+    else {
+        m_noIcon = true;
+    }
+    ICO_TRA("end");
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseAnimation(const string& s)
+{
+    ICO_TRA("start");
+    const char* ps = s.c_str();
+    int c = s_Animation_time.size();
+    bool b_at = false;  // animation time flag off
+    if (0 == strncasecmp(ps, s_Animation_time.c_str(), c)) {
+        b_at = true;    // flag on
+    }
+    else {
+        c = s_Animation.size(); // not Animation_time
+    }
+    if ('=' != ps[c]) {
+        ICO_TRA("end");
+        return false;  // not "Animation=xxx" / "Animation_time=xxx"
+    }
+    if (true == b_at) {
+        // Animation_time
+        m_animationTime = (int)strtol(&ps[c+1], (char **)0, 0);
+    }
+    else {
+        // Animation
+        m_animation = &ps[c+1];
+    }
+    ICO_TRA("end");
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseInvisiblecpu(const string& s)
+{
+    ICO_TRA("start");
+    const char* ps = s.c_str();
+    int c = s_invisiblecpu.size();
+    if ('=' != ps[c]) {
+        ICO_TRA("end");
+        return false;  // not "invisibluecpu=xxx"
+    }
+    if (0 == strcasecmp(&ps[c+1], "yes")) {
+        m_invisibleCPU = 100;
+    }
+    else if (0 != strcasecmp(&ps[c+1], "no")) {
+        m_invisibleCPU = (int)strtol(&ps[c+1], (char **)0, 0);
+    }
+    else { // "no"
+        m_invisibleCPU = 0;
+    }
+    ICO_TRA("end %s,%d", &ps[c+1], m_invisibleCPU);
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseNoconfigure(const string&)
+{
+// TODO mk_k
+    ICO_TRA("start");
+//    m_noconfigure = true;
+    ICO_TRA("end");
+//    return true;
+    return false;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseMenuoverlap(const string&)
+{
+    ICO_TRA("start");
+    m_memnuOverlap = true;
+    ICO_TRA("end");
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseAuto(const string&)
+{
+    ICO_TRA("start");
+    m_autoStart = true;
+    ICO_TRA("end");
+    return true;
+}
+
+/**
+ * @brief category string parse
+ * @param category string
+ * @retval true parse success
+ * @retval false parse fail
+ */
+bool CicoSCAilItems::categoryParseNoauto(const string&)
+{
+    ICO_TRA("start");
+    m_autoStart = false;
+    ICO_TRA("end");
+    return true;
+}
+
diff --git a/src/homescreen/CicoSCAilItems.h b/src/homescreen/CicoSCAilItems.h
new file mode 100644 (file)
index 0000000..f6cbde2
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * 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
+ *
+ */
+#ifndef CICOSCAILITEMS_H
+#define CICOSCAILITEMS_H
+#include <glib.h>
+#include <string>
+#include <vector>
+
+
+#define DINITm_nodeID -1
+#define DINITm_kindID -1
+#define DINITm_categoryID -1
+#define DINITm_display -1
+#define DINITm_layer -1
+#define DINITm_displayZone -1
+#define DINITm_soundZone -1
+#define DINITm_sound -1
+#define DINITm_inputDev -1
+#define DINITm_switch -1
+#define DINITm_animationTime 0
+#define DINITm_invisibleCPU 0
+
+/**
+ * @brief AIL infomation data class
+ *
+ */
+
+class CicoSCAilItems {
+public: // member method
+    CicoSCAilItems();
+    CicoSCAilItems(const char* pkg, const char* icon, const char* nam,
+                   const char* ctgry, const char* typ, const char* exe,
+                   std::string categorys, bool ndisp);
+    CicoSCAilItems(const CicoSCAilItems& rAilItems);
+    ~CicoSCAilItems();
+
+    void init();
+    void setup(const char* pkg, const char* icon, const char* nam,
+               const char* ctgry, const char* typ, const char* exe,
+               std::string categorys, bool ndisp);
+
+    const CicoSCAilItems* p() const;
+
+protected: // member method
+    void categoryParse(const std::string categorys);
+    bool categoryParseRun(const std::string& s);
+    bool categoryParseKind(const std::string& s);
+    bool categoryParseCategory(const std::string& s);
+    bool categoryParseGetValue(const std::string& s, const std::string& k,
+                               std::string val);
+    bool categoryGetDisplay(const std::string& disp, const std::string& layer,
+                            const std::string& zone);
+    bool categoryGetSound(const std::string& sound, const std::string& zone);
+    bool categoryGetInput(const std::string& inputDev,
+                          const std::string& sw);
+    bool categoryParseNodisplay(const std::string& s);
+    bool categoryParseAnimation(const std::string& s);
+    bool categoryParseInvisiblecpu(const std::string& s);
+    bool categoryParseNoconfigure(const std::string& s);
+    bool categoryParseMenuoverlap(const std::string& s);
+    bool categoryParseAuto(const std::string& s);
+    bool categoryParseNoauto(const std::string& s);
+
+private: // member method
+
+public: // member aria
+    std::string m_appid;      // PACKAGE NAME
+    std::string m_icon;       // ICON
+    std::string m_name;       // NAME
+    std::string m_execPath;   // EXEC
+    std::string m_type;       // TYPE
+
+    std::string m_categories; // CATEGORIES
+
+    int  m_nodeID;      // "run=xxx" xxx change to id
+    int  m_kindID;      // "kind=xxx" xxx change to id
+    int  m_categoryID;  // "category=xxx" xxx change to id
+
+    int  m_display;   //
+    int  m_layer;
+    int  m_displayZone; // display zone
+    int  m_soundZone;  // sound zone
+    int  m_sound;
+    int  m_inputDev;   // input device
+    int  m_switch;
+    bool m_noIcon;
+    std::string m_animation;
+    int  m_animationTime;
+    int  m_invisibleCPU;
+    bool m_memnuOverlap;
+    bool m_autoStart; // auto start flag
+
+
+    std::string m_group;
+    std::string m_location;
+    bool m_resumeShow;
+};
+
+inline const CicoSCAilItems* CicoSCAilItems::p() const
+{
+    return this;
+}
+
+#endif // CICOAILITEMS_H
diff --git a/src/homescreen/CicoSCAulItems.cpp b/src/homescreen/CicoSCAulItems.cpp
new file mode 100644 (file)
index 0000000..05f8014
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+ * 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
+ *
+ */
+#include <iostream>
+#include <string>
+#include <fstream>
+#include <vector>
+#include <memory>
+#include <cstdio>
+#include <cstdlib>
+#include <string.h>
+#include <aul/aul.h>
+
+
+#include "CicoLog.h"
+#include "CicoSCAulItems.h"
+
+using namespace std;
+
+/**
+ * @brief AUL Items class constructor
+ */
+CicoSCAulItems::CicoSCAulItems()
+{
+    ICO_TRA("CicoSCAulItems::CicoSCAulItems");
+    m_appid.clear(); // appid
+    m_pid = 0; // pid
+    m_defCgrpCpu.clear();
+    m_defCgrpMem.clear();
+}
+
+/**
+ * @brief AUL Items class constructor
+ */
+CicoSCAulItems::CicoSCAulItems(const char* appid, int pid,
+                               const CicoSCWindow* obj)
+    :m_appid(appid), m_pid(pid)
+{
+    ICO_TRA("CicoSCAulItems::CicoSCAulItems");
+    enterWindow(obj);
+    getPidCgroupInfo(pid, m_defCgrpMem, m_defCgrpCpu);
+}
+
+/**
+ * @brief AUL Items class constructor
+ */
+CicoSCAulItems::CicoSCAulItems(const CicoSCAulItems& s)
+{
+    m_appid = s.m_appid;
+    m_pid = s.m_pid;
+#if 1 // TODO mk_k
+    m_CSCWptrs = s.m_CSCWptrs;
+#else
+    int sz = s.m_CSCWptrs.size();
+    for (int i = 0; i < sz; i++) {
+        m_CSCWptrs.push_back(s.m_CSCWptrs[i]);
+    }
+#endif
+    m_defCgrpCpu = s.m_defCgrpCpu;
+    m_defCgrpMem = s.m_defCgrpMem;
+}
+
+/**
+ * @brief AUL Items class destructor
+ */
+CicoSCAulItems::~CicoSCAulItems()
+{
+    ICO_TRA("CicoSCAulItems::~CicoSCAulItems");
+    m_CSCWptrs.clear();
+}
+
+/**
+ * @brief CicoSCWindow pointer entry
+ * @param obj entry pointer
+ */
+void CicoSCAulItems::enterWindow(const CicoSCWindow* obj)
+{
+    ICO_TRA("CicoSCAulItems::enterWindow %x", obj);
+    if ((NULL == obj) || (0 == obj)) {
+        ICO_TRA("CicoSCAulItems::enterWindow");
+        return;
+    }
+    bool bingo = false; // Registered flag off
+#if 1 // TODO mk_k
+    vector<const CicoSCWindow*>::iterator it = m_CSCWptrs.begin();
+    vector<const CicoSCWindow*>::iterator theEnd = m_CSCWptrs.end();
+    for(; it != theEnd; ++it) {
+        if (obj == *it) { // if Registered ?
+            bingo = true; // Registered flag on
+            break; // break of for
+        }
+    }
+#else
+    int sz = m_CSCWptrs.size();
+    for (int i = 0; i < sz; i++) {
+        if (obj == m_CSCWptrs[i]) {
+            bingo = true;
+            break; // break of for
+        }
+    }
+#endif
+    if (false == bingo) {
+        ICO_TRA("add window pointer");
+        m_CSCWptrs.push_back(obj);
+    }
+    ICO_TRA("CicoSCAulItems::enterWindow");
+    return;
+}
+
+/**
+ * @breif removw CicoSCWindow pointer
+ * @param obj remove target
+ */
+void CicoSCAulItems::rmWindow(const CicoSCWindow* obj)
+{
+    ICO_TRA("CicoSCAulItems::rmWindow %x", obj);
+    vector<const CicoSCWindow*>::iterator it = m_CSCWptrs.begin();
+    vector<const CicoSCWindow*>::iterator theEnd = m_CSCWptrs.end();
+    for(; it != theEnd; ++it) {
+        if (obj == *it) {
+            ICO_TRA("CicoSCAulItems::rmWindow");
+            m_CSCWptrs.erase(it);
+            break; // break of for
+        }
+    }
+    ICO_TRA("CicoSCAulItems::rmWindow");
+    return;
+}
+
+/**
+ * @breif get cgroup data by /proc/[pid]/cgroup file
+ * @parm pid target pid number
+ * @param m store cgroup memory directory data
+ * @param c store cgroup cpu,cpuacct directory data
+ */
+static const char* g_procPidCgroupFileFmt="/proc/%d/cgroup";
+static const char* g_cpuWord = "cpuacct,cpu:";
+static const char* g_memWord = "memory:";
+bool CicoSCAulItems::getPidCgroupInfo(int pid, string& m, string& c)
+{
+    ICO_TRA("CicoSCAulItems::getPidCgroupInfo");
+    char fn[64];
+    sprintf(fn, g_procPidCgroupFileFmt, pid);
+    const size_t cpuWdSz = strlen(g_cpuWord);
+    const size_t memWdSz = strlen(g_memWord);
+    string tmp;
+    ifstream ifs(fn);
+    bool bR = false;
+    const char* pC = 0;
+    const char* pM = 0;
+    while (ifs >> tmp) {
+        if (true == tmp.empty()) {
+            continue;
+        }
+        const char* pT = tmp.c_str();
+        const char* pS = pT;
+        for (;pS != '\0'; pS++) {
+            if (':' == *pS) {
+                pS++;
+                if (0 == strncmp(pS, g_cpuWord, cpuWdSz)) { //cpu
+                    pC = pS + cpuWdSz; // get cgroup cpu directory
+                }
+                else if (0 == strncmp(pS, g_memWord, memWdSz)) { // memory
+                    pM = pS + memWdSz; // get cgroup memory directory
+                }
+                break; // break of for
+            }
+        }
+        if ((0 != pC) && (0 != pM)) {
+            ICO_DBG("CicoSCAulItems::getPidCgroupInfo m=%s, c=%s", pM, pC);
+            m = pM;
+            c = pC;
+            bR = true;
+            break;  // break of while
+        }
+    }
+    ifs.close();
+    ICO_TRA("CicoSCAulItems::getPidCgroupInfo %s", bR? "true": "false");
+    return bR;
+}
+
diff --git a/src/homescreen/CicoSCAulItems.h b/src/homescreen/CicoSCAulItems.h
new file mode 100644 (file)
index 0000000..7d12b2b
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * 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
+ *
+ */
+#ifndef CICOSCAULITEMS_H
+#define CICOSCAULITEMS_H
+
+#include <string>
+#include <vector>
+
+#ifndef __CICO_SC_WINDOW_H__
+class CicoSCWindow;
+#endif
+
+
+/**
+ * @brief System controller unit
+ *        application life cycle infomation data
+ *
+ */
+
+class CicoSCAulItems {
+public: // member method
+    CicoSCAulItems();
+    CicoSCAulItems(const char* appid, int pid, const CicoSCWindow* obj=NULL);
+    CicoSCAulItems(const CicoSCAulItems& raul);
+    ~CicoSCAulItems();
+
+    const CicoSCAulItems* p() const;
+    void enterWindow(const CicoSCWindow* obj);
+    void rmWindow(const CicoSCWindow* obj);
+protected: // member method
+    bool getPidCgroupInfo(int pid, std::string& m, std::string& c);
+private: // member method
+
+public: // member aria
+    std::string m_appid; // appid
+    int m_pid; // pid
+    std::vector<const CicoSCWindow*> m_CSCWptrs;
+
+protected: // member aria
+    std::string m_defCgrpCpu;
+    std::string m_defCgrpMem;
+
+#if 0 // TODO mk_k
+//    std::string m_icon; // icon file path
+    bool m_active; //
+    bool m_supend; //
+    std::string m_group;
+    int  m_nodeID;
+    std::string m_location;
+    std::string m_animation;
+    int m_animationTime;
+    bool m_autoStart; // auto start flag
+    bool m_memnuOverlap;
+    int  m_invisibleCPU;
+    int  m_kindID;
+    int  m_categoryID;
+    int  m_displayZoneNum; // display zone number
+    int  m_soundZoneNum;  // sound zone number
+    int  m_inputDevNum;   // input device number
+    int  m_display;
+    int  m_sound;
+    int  m_input;
+
+
+
+    std::string m_name;
+    std::string m_execPath;
+    std::string m_type;
+    bool m_resumeShow
+#endif
+};
+
+inline const CicoSCAulItems* CicoSCAulItems::p() const
+{
+    return this;
+}
+
+#endif // CICOSCAULITEMS_H
diff --git a/src/homescreen/CicoSCConf.h b/src/homescreen/CicoSCConf.h
new file mode 100644 (file)
index 0000000..1c58ab6
--- /dev/null
@@ -0,0 +1,342 @@
+/*
+ * 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   CicoSCConf.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+#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>
+using namespace std;
+using namespace boost;
+using namespace boost::property_tree;
+
+#include "CicoLog.h"
+   
+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_e;
+
+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_display_type_e;
+
+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_e;
+
+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_e;
+
+#define ICO_SYC_CONFIG_APPATTR  "app_attr.conf"
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCNodeConf
+{
+public:
+    CicoSCNodeConf()
+        : id(-1), name(""), address(""), type(-1) { }
+
+    void dumpConf(void)
+    {
+        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
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCLayerConf
+{
+public:
+    CicoSCLayerConf()
+        : id(-1), name(""), type(-1), menuoverlap(false) {}
+    void dumpConf(void)
+    {
+        ICO_DBG("\tlayer : 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
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCDisplayZoneConf
+{
+public:
+    CicoSCDisplayZoneConf()
+        : id(-1), name(""), x(-1), y(-1), w(-1), h(-1){}
+    void dumpConf(void)
+    {
+        ICO_DBG("\tdisplay zone : id(%d) name(%s) x(%d) y(%d) "
+                 "w(%d) h(%d) overlap(%s)",
+                 id, name.c_str(), x, y, w, h, overlapStr.c_str());
+    }
+    int    id;      //!< display zone id
+    string name;    //!< 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;
+
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCDisplayConf
+{
+public:
+    CicoSCDisplayConf()
+        : id(-1), name(""), node(-1), no(-1),
+          type(-1), width(-1), height(-1), inch(-1){}
+    void dumpConf(void)
+    {
+        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;
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCSoundZoneConf
+{
+public:
+    CicoSCSoundZoneConf()
+        : id(-1), name(""){}
+    void dumpConf(void)
+    {
+        ICO_DBG("\tsound zone : id(%d) name(%s)", id, name.c_str());
+    }
+    int    id;
+    string name;
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCSoundConf
+{
+public:
+    CicoSCSoundConf()
+        : id(-1), name(""), no(-1){}
+    void dumpConf(void)
+    {
+        ICO_DBG("sound : id(%d) name(%s) no(%d)", id, name.c_str(), no);
+    }
+    int    id;
+    string name;
+    int    no;
+    vector<CicoSCSoundZoneConf*>  zoneConfList;
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCCategoryConf
+{
+public:
+    CicoSCCategoryConf()
+        : id(-1), name(""), type(""),
+          view(-1), sound(-1), input(-1), priority(0){}
+    void dumpConf(void)
+    {
+        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;
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCAppKindConf
+{
+public:
+    CicoSCAppKindConf()
+        : id(-1), name(""), privilege(-1), priority(0){}
+    void dumpConf(void)
+    {
+        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;
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCSwitchConf
+{
+public:
+    CicoSCSwitchConf()
+        : id(-1), name(""), appid(""), keycode(0){}
+    void dumpConf(void)
+    {
+        ICO_DBG("\tswitch : id(%d) name(%s) appid(%s)",
+                 id, name.c_str(), appid.c_str());
+    }
+    int    id;
+    string name;
+    string appid;
+    int    keycode;
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCInputDevConf
+{
+public:
+    CicoSCInputDevConf()
+        : id(-1), name(""){}
+    void dumpConf(void)
+    {
+        ICO_DBG("inputdev : id(%d) name(%s)", id, name.c_str());
+    }
+    int id;
+    string name;
+    vector<CicoSCSwitchConf*> switchConfList;
+};
+
+//==========================================================================
+/**
+ *  @brief  
+ */
+//==========================================================================
+class CicoSCDefaultConf
+{
+public:
+    CicoSCDefaultConf()
+        : topdir(""), confdir(""),
+          node(-1), appkind(-1), category(-1), display(-1), 
+          layer(-1), displayzone(-1), sound(-1), soundzone(-1),
+          inputdev(-1), inputsw(-1) {};
+    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);
+    }
+    string topdir;
+    string confdir;
+    int node;
+    int appkind;
+    int category;
+    int display;
+    int layer;
+    int displayzone;
+    int sound;
+    int soundzone;
+    int inputdev;
+    int inputsw;
+};
+#endif  // __CICO_SC_CONF_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/src/homescreen/CicoSCLifeCycleController.cpp b/src/homescreen/CicoSCLifeCycleController.cpp
new file mode 100644 (file)
index 0000000..6b9e326
--- /dev/null
@@ -0,0 +1,914 @@
+/*
+ * 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
+ *
+ */
+
+#include <string>
+#include <vector>
+#include <cstdio>
+#include <cstdlib>
+#include <glib.h>
+#include <ail.h>
+#include <aul/aul.h>
+#include <sys/stat.h>
+
+#include "ico_syc_error.h"
+#include "CicoLog.h"
+#include "CicoSCAulItems.h"
+#include "CicoSCAilItems.h"
+#include "CicoSCLifeCycleController.h"
+#include "CicoSCConf.h"
+#include "CicoSCSystemConfig.h"
+
+using namespace std;
+
+
+#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                 */
+
+
+CicoSCLifeCycleController* CicoSCLifeCycleController::ms_myInstance = NULL;
+
+const char* DAilTypeFilPrm_Menu="menu";
+const char* DAilTypeFilPrm_App="Application";
+const char* DNil = "(nil)";
+const char* sectAppAttr = "app-attributes";
+const char* DNull = "(null)";
+
+#define APP_CONF_AIL_NULL_STR   DNull
+
+/**
+ * @brief
+ * @param req_id
+ * @param pkg_type
+ * @param pkg_name package name
+ * @param key "start"/"end"/"install_percent"/"command" strings
+ * @param val "ok"/"error"/"0.000000"-"100.000000" strings
+ * @param pmsg pkgmgr message 
+ * @param data user data
+ */
+static int CSCLCCpkgmgr_handler(int req_id, const char *pkg_type,
+                                const char *pkg_name, const char *key,
+                                const char *val, const void *pmsg, void *data)
+{
+    CicoSCLifeCycleController* x = (CicoSCLifeCycleController*)data;
+    return
+        CSCLCCpkgmgr_handlerX(req_id, pkg_type, pkg_name, key, val, pmsg, x);
+}
+
+/**
+ * @brief ail_filter_list_appinfo_foreach callback function
+ * @param appinfo appinfo_h the appinfo's handle
+ * @param data user data
+ * @retval AIL_CB_RET_CONTINUE return if you continue iteration
+ * @retval AIL_CB_RET_CANCEL return if you cancel iteration
+ */
+static ail_cb_ret_e CSCLCCail_list_appinfo_cb(const ail_appinfo_h appinfo,
+                                              void *data)
+{
+    CicoSCLifeCycleController* x = (CicoSCLifeCycleController*)data;
+    return CSCLCCail_list_appinfo_cbX(appinfo, x);
+}
+
+/**
+ * @brief applications are launched. callback function
+ * @param pid
+ * @param data user data
+ */
+static int CSCLCCapp_launch_handler(int pid, void *data)
+{
+    CicoSCLifeCycleController* x = (CicoSCLifeCycleController*)data;
+    return CSCLCCapp_launch_handlerX(pid, x);
+}
+
+/**
+ * @brief applications die. callback function
+ * @param pid
+ * @param data user data
+ */
+static int CSCLCCapp_dead_handler(int pid, void *data)
+{
+    CicoSCLifeCycleController* x = (CicoSCLifeCycleController*)data;
+    return CSCLCCapp_dead_handlerX(pid, x);
+}
+
+
+/**
+ * @brief contractor
+ */
+CicoSCLifeCycleController::CicoSCLifeCycleController()
+{
+    m_gconf = (GKeyFile*)NULL;
+    m_pc = (pkgmgr_client*)NULL;
+    initAIL();
+    initAUL();
+}
+
+/**
+ * @brief destructor
+ */
+CicoSCLifeCycleController::~CicoSCLifeCycleController()
+{
+
+}
+
+CicoSCLifeCycleController*
+CicoSCLifeCycleController::getInstance(void)
+{
+       if (NULL == ms_myInstance) {
+               ms_myInstance = new CicoSCLifeCycleController();
+       }
+       return ms_myInstance;
+}
+
+/**
+ * @brief application launch
+ * @param appid application id
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::launch(const char* appid)
+{
+    ICO_TRA("start %s", appid);
+    // appid check AIL table exist
+    if (NULL == findAIL(appid)) {
+        ICO_TRA("not find");
+        return ICO_SYC_ENOSYS;
+    }
+    int r = aul_launch_app(appid, NULL);
+    if (0 > r) {
+        ICO_TRA("aul_launch_app NG %d", r);
+        return ICO_SYC_ENOSYS;
+    }
+    ICO_TRA("launch success");
+    return ICO_SYC_EOK;
+}
+
+/**
+ * @brief application launch
+ * @param appid application id
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::launch(const std::string& appid)
+{
+    return launch((const char*)appid.c_str());
+}
+
+/**
+ * @brief application terminate
+ * @param appid application id
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::terminate(const char* appid)
+{
+    ICO_TRA("CicoSCLifeCycleController::terminate %s", appid);
+    int r = ICO_SYC_EOK;
+    vector<int> pids;
+    if (true == getPIDs(appid, pids)) {
+        vector<int>::iterator it;
+        for(it = pids.begin(); it != pids.end(); ++it) {
+            int tr = terminateR(*it);
+            if (ICO_SYC_EOK != tr) {
+                r = tr;
+            }
+        }
+    }
+    else {
+        ICO_TRA("end ICO_SYC_EPERM");
+        return ICO_SYC_EPERM;
+    }
+    ICO_TRA("end %d", r);
+    return r;
+}
+
+/**
+ * @brief application terminate
+ * @param appid application id
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::terminate(const std::string& appid)
+{
+    return terminate((const char*)appid.c_str());
+}
+
+/**
+ * @brief application terminate
+ * @param pid
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::terminate(int pid)
+{
+    ICO_TRA("CicoSCLifeCycleController::terminate %d", pid);
+    const CicoSCAulItems* t = findAUL(pid);
+    if ((NULL == t) || (0 == t)) {
+        ICO_TRA("not find");
+        return ICO_SYC_EPERM;
+    }
+    return terminateR(pid);
+}
+
+/**
+ * @brief application terminate
+ * @param pid
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ENOSYS error
+ */
+int CicoSCLifeCycleController::terminateR(int pid)
+{
+    ICO_TRA("CicoSCLifeCycleController::terminateR %d", pid);
+    int r = aul_terminate_pid(pid);
+    if (r < 0) {
+        ICO_DBG("terminate error pid:%d, r:%d", pid, r);
+        return ICO_SYC_ENOSYS;
+    }
+    return ICO_SYC_EOK;
+}
+
+/**
+ * @brief application suspend
+ * @param appid application id
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::suspend(const char* appid)
+{
+    int r = ICO_SYC_EOK;
+    vector<int> pids;
+    if (true == getPIDs(appid, pids)) {
+        vector<int>::iterator it;
+        for(it = pids.begin(); it != pids.end(); ++it) {
+            int tr = suspend(*it);
+            if (ICO_SYC_EOK != tr) {
+                r = tr;
+            }
+        }
+    }
+    else {
+        ICO_TRA("end ICO_SYC_EPERM");
+        return ICO_SYC_EPERM;
+    }
+    ICO_TRA("end %d", r);
+    return r;
+}
+
+/**
+ * @brief application suspend
+ * @param appid application id
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::suspend(const std::string& appid)
+{
+    return suspend((const char*)appid.c_str());
+}
+
+/**
+ * @brief application suspend
+ * @param pid
+ * @retval ICO_SYC_EOK   success
+ * @retval ICO_SYC_ESRCH error(not initialized)
+ * @retval ICO_SYC_ENOENT error(does not exist)
+ * @retval ICO_SYC_EBUSY error(already launch)
+ * @retval ICO_SYC_EPERM error(no authority)
+ */
+int CicoSCLifeCycleController::suspend(int pid)
+{
+// TODO mk_k
+// TODO mk_k
+    return ICO_SYC_EPERM;
+}
+
+/**
+ * @brief appid is runnning check
+ * @param appid package
+ * @return running status
+ * @retval true is runnning
+ * @retval false not runnning
+ */
+bool CicoSCLifeCycleController::isRunning(const char* appid) const
+{
+    ICO_TRA("start %s", appid);
+    bool r = false;
+#if 0 // TODO mk_k
+    vector<CicoSCAulItems>::iterator it;
+    for (it = m_aul.begin(); it != m_aul.end(); ++it) {
+        if (0 == strcasecmp(it->m_appid.c_str(), appid)) {
+            r = true;
+            break;
+        }
+    }
+#else
+    int sz = m_aul.size();
+    for (int i = 0; i < sz; i++) {
+        if (0 == strcasecmp(m_aul[i].m_appid.c_str(), appid)) {
+            r = true;
+            break;
+        }
+    }
+#endif
+    ICO_TRA("end %s", r? "true": "false");
+    return r;
+}
+
+/**
+ * @brief appid is runnning check
+ * @param appid package
+ * @return running status
+ * @retval true is runnning
+ * @retval false not runnning
+ */
+bool CicoSCLifeCycleController::isRunning(const std::string& appid) const
+{
+    return isRunning((const char*)appid.c_str());
+}
+
+/**
+ * @brief find ail data
+ * @param appid find key
+ * @return CicoSCAilItems class pointer
+ * @retval NULL is not find
+ */
+const CicoSCAilItems* CicoSCLifeCycleController::findAIL(const char* appid) const
+{
+    ICO_TRA("start");
+    const CicoSCAilItems* r = NULL;
+    int sz = m_ail.size();
+    for (int i = 0; i < sz; i++) {
+        if (0 == strcasecmp(m_ail[i].m_appid.c_str(), appid)) {
+            r = m_ail[i].p();
+            break; // break of for
+        }
+    }
+    ICO_TRA("end %x", r);
+    return r;
+}
+
+/**
+ * @brief find ail data
+ * @param appid find key
+ * @return CicoSCAilItems class pointer
+ * @retval NULL is not find
+ */
+const CicoSCAilItems* CicoSCLifeCycleController::findAIL(const std::string& appid) const
+{
+    ICO_TRA("call findAIL(const chr*)");
+    return findAIL((const char*)appid.c_str());
+}
+
+/**
+ * @brief get launched apprication pid
+ * @param appid target application appid
+ * @return pid
+ */
+bool CicoSCLifeCycleController::getPIDs(const char* appid, std::vector<int>& pids) const
+{
+    ICO_TRA("start %s", appid);
+    bool r = false;
+#if 0 // TODO mk_k
+    vector<CicoSCAulItems>::iterator it;
+    for (it = m_aul.begin(); it != m_aul.end(); ++it) {
+        if (0 == strcasecmp(it->m_appid.c_str(), appid)) {
+            pids.push_back(it->m_pid);
+            r = true;
+        }
+    }
+#else
+    int sz = m_aul.size();
+    for (int i = 0; i < sz; i++) {
+        const CicoSCAulItems* t = m_aul[i].p();
+        if (0 == strcasecmp(t->m_appid.c_str(), appid)) {
+            pids.push_back(t->m_pid);
+            r = true;
+        }
+    }
+#endif
+    ICO_TRA("end %d %s", pids.size(), r? "true": "false");
+    return r;
+}
+
+/**
+ * @brief get launched apprication pid
+ * @param appid target application appid
+ * @return pid
+ */
+bool CicoSCLifeCycleController::getPIDs(std::string& appid, std::vector<int>& pids) const
+{
+    return getPIDs((const char*)appid.c_str(), pids);
+}
+
+/**
+ * @brief get launched apprication pid
+ * @param appid target application appid
+ * @return pid
+ */
+const CicoSCAulItems* CicoSCLifeCycleController::findAUL(int pid) const
+{
+    ICO_TRA("start %d", pid);
+    const CicoSCAulItems* r = NULL;
+    int sz = m_aul.size();
+    for (int i = 0; i < sz; i++) {
+        const CicoSCAulItems* t = m_aul[i].p();
+        if (t->m_pid == pid) {
+            r = t;
+            ICO_DBG("find %d -> %s", pid, t->m_appid.c_str());
+            break; // break of for
+        }
+    }
+    ICO_TRA("end %x", r);
+    return r;
+}
+
+
+/**
+ * @brief ail infomation data initialization
+ */
+void CicoSCLifeCycleController::initAIL()
+{
+    ICO_TRA("start");
+    createAilItems();
+    if ((pkgmgr_client*)NULL == m_pc) {
+        m_pc = pkgmgr_client_new(PC_LISTENING);
+        int r = pkgmgr_client_listen_status(m_pc, CSCLCCpkgmgr_handler,
+                                            (void*)this);
+        if (PKGMGR_R_OK != r) {
+            pkgmgr_client_free(m_pc);
+            m_pc = NULL;
+        }
+    }
+    ICO_TRA("end");
+}
+
+/**
+ * @brief
+ */
+int CSCLCCpkgmgr_handlerX(int req_id, const char *pkg_type, const char *pkg_name, 
+                         const char *key, const char *val, const void *pmsg,
+                         CicoSCLifeCycleController* x)
+{
+// TODO mk_k
+    ICO_TRA("pkgmgr t:%s, n:%s, k:%s, v:%s, m:%s",pkg_type, pkg_name, key,
+            val, pmsg);
+    if ((NULL == x) || (0 == x)) {
+        ICO_TRA("end user data none");
+        return -1;
+    }
+    if (strcasecmp(key, "end") == 0) {
+        if (strcasecmp(val, "ok") == 0) {
+            ICO_TRA("end::ok");
+            x->renewAIL();
+        }
+    }
+    return 0;
+// TODO mk_k
+}
+
+/**
+ * @brief AIL list renew
+ */
+void CicoSCLifeCycleController::renewAIL()
+{
+    vector<CicoSCAilItems> old = m_ail;
+    m_ail.clear();
+    int cnt =0;
+    while (true == createAilItems()) {
+        if (cnt > 500) {
+            m_ail.clear();
+            m_ail = old;
+            break;
+        }
+        cnt++;
+        usleep(10000);
+    }
+    if (cnt > 500) {
+        ICO_TRA("error AIL I/F");
+        return ;
+    }
+#if 0 // TODO mk_k
+    vector<string> add_appid;
+    vector<string> remove_appid;
+
+    vector<CicoSCAulItems>::iterator it_n;
+    vector<CicoSCAulItems>::iterator it_o;
+    for(it_n = m_aul.begin(); it_n != m_aul.end(); ++it_n) {
+        bool bingo = false;
+        for(it_o = old.begin(); it_o != old.end(); ++it_o) {
+            if (it_n->m_appid.compaire(it_o->m_appid)) {
+                bingo = true;
+            }
+        }
+        if (false == bingo) {
+            add_appid.push_back(it_n->m_appid);
+        }
+    }
+    for(it_o = old.begin(); it_o != old.end(); ++it_o) {
+        bool bingo = false;
+        for(it_n = m_aul.begin(); it_n != m_aul.end(); ++it_n) {
+            if (it_o->m_appid.compaire(it_n->m_appid)) {
+                bingo = true;
+            }
+        }
+        if (false == bingo) {
+            remove_appid.push_back(it_o->m_appid);
+        }
+    }
+
+    if (0 != add_appid.size()) {
+// TODO mk_k install
+    }
+    if (0 != remove_appid.size()) {
+// TODO mk_k uninstall
+    }
+#endif
+    old.clear();
+    return;
+}
+
+/**
+ * @brief ail_filter_list_appinfo_foreach callback function
+ * @param appinfo appinfo_h the appinfo's handle
+ * @param x CicoSCLifeCycleController class pointer
+ * @retval AIL_CB_RET_CONTINUE return if you continue iteration
+ * @retval AIL_CB_RET_CANCEL return if you cancel iteration
+ *
+ */
+ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
+                                        CicoSCLifeCycleController* x)
+{
+    ICO_TRA("start");
+    if ((NULL == x) || (0 == x)) {
+        ICO_TRA("end bad end")
+        return AIL_CB_RET_CANCEL;
+    }
+    char   *pkg;
+    char   *icn;
+    char   *nm;
+    char   *ctgry;
+    char   *typ;
+    char   *exe;
+    bool   bndsp = false;
+    /* get package name for appid */
+    ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &pkg);
+    if (strcmp(pkg, APP_CONF_AIL_NULL_STR) == 0) {
+        pkg = NULL;
+    }
+    /* get icon path */
+    ail_appinfo_get_str(appinfo, AIL_PROP_ICON_STR, &icn);
+    if (strcmp(icn, APP_CONF_AIL_NULL_STR) == 0) {
+        icn = NULL;
+    }
+    else if (icn != NULL) {
+        struct stat buff;
+        /* file check */
+        memset(&buff, 0, sizeof(buff));
+        if (stat(icn, &buff) == 0) {
+            if (S_ISDIR(buff.st_mode)) {
+                /* is directory */
+                ICO_DBG("%s is directory", icn);
+                icn = NULL;
+            }
+        }
+        else {
+            /* is not exist */
+            icn = NULL;
+        }
+    }
+    /* get name */
+    ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &nm);
+    if (strcmp(nm, APP_CONF_AIL_NULL_STR) == 0) {
+        nm = NULL;
+    }
+    /* get category */
+    ail_appinfo_get_str(appinfo, AIL_PROP_CATEGORIES_STR, &ctgry);
+    if (strcmp(ctgry, APP_CONF_AIL_NULL_STR) == 0) {
+        ctgry = NULL;
+    }
+    /* get type */
+    ail_appinfo_get_str(appinfo, AIL_PROP_TYPE_STR, &typ);
+    if (strcmp(typ, APP_CONF_AIL_NULL_STR) == 0) {
+        typ = NULL;
+    }
+    /* get exec */
+    ail_appinfo_get_str(appinfo, AIL_PROP_EXEC_STR, &exe);
+    if (strcmp(exe, APP_CONF_AIL_NULL_STR) == 0) {
+        exe = NULL;
+    }
+    ail_appinfo_get_bool(appinfo, AIL_PROP_NODISPLAY_BOOL, &bndsp);
+    ICO_DBG("pkg:%s icn:%s nm:%s ctg:%s ty:%s exe:%s ds:%s", pkg? pkg:DNil,
+            icn? icn:DNil, nm? nm:DNil, ctgry? ctgry:DNil, typ? typ:DNil,
+            exe? exe:DNil, bndsp? "true":"false");
+    if (false == x->addAIL(pkg, icn, nm, ctgry, typ, exe, bndsp)) {
+        ICO_TRA("end bad end")
+        return AIL_CB_RET_CANCEL;
+    }
+    ICO_TRA("end")
+    return AIL_CB_RET_CONTINUE;
+}
+
+/**
+ * @brief create infomation ail data
+ * @retval true success
+ * @retval false fail create
+ */
+bool CicoSCLifeCycleController::createAilItems()
+{
+    ICO_TRA("start");
+    m_ail.clear(); // clear items
+    if (NULL == m_gconf) {
+        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);
+        GError  *gerr = NULL;
+        int flg;
+        flg = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS;
+        if (!g_key_file_load_from_file(m_gconf, gsfp->str, (GKeyFileFlags)flg, &gerr)) {
+            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);
+    }
+
+    int r;
+    ail_filter_h fil;
+    ail_filter_new(&fil);
+    r = ail_filter_add_str(fil, AIL_PROP_TYPE_STR, DAilTypeFilPrm_Menu);
+    r = ail_filter_list_appinfo_foreach(fil, CSCLCCail_list_appinfo_cb,
+                                        (void*)this);
+    ail_filter_destroy(fil);
+    if (r != AIL_ERROR_OK) {
+        if (m_gconf) {
+            g_key_file_free(m_gconf);
+            m_gconf = NULL;
+        }
+        ICO_TRA("end menu read NG(AIL)=%d", r);
+        return false;
+    }
+
+    ail_filter_new(&fil);
+    r = ail_filter_add_str(fil, AIL_PROP_TYPE_STR, DAilTypeFilPrm_App);
+    r = ail_filter_list_appinfo_foreach(fil, CSCLCCail_list_appinfo_cb,
+                                        (void*)this);
+    ail_filter_destroy(fil);
+    if (r != AIL_ERROR_OK) {
+        if (m_gconf) {
+            g_key_file_free(m_gconf);
+            m_gconf = NULL;
+        }
+        ICO_TRA("end Application read NG(AIL)=%d", r);
+        return false;
+    }
+    if (m_gconf) {
+        g_key_file_free(m_gconf);
+        m_gconf = NULL;
+    }
+    ICO_TRA("end");
+    return true;
+}
+
+/**
+ * @brief ail infomation data add one item
+ * @param sPkg string package (appid)
+ * @param sIco string icon full path
+ * @param sNm string name
+ * @param sCtg string categoies
+ * @param sTyp string type
+ * @param sExe string exec name
+ * @param bndsp bool nodisplay value
+ * @return method status
+ * @retval true success added item
+ * @retval false fail added item
+ */
+bool CicoSCLifeCycleController::addAIL(const char* sPkg, const char* sIco,
+                                       const char* sNm, const char* sCtg,
+                                       const char* sTyp, const char* sExe,
+                                       bool bndsp)
+{
+    string category;
+    getCategory(sPkg, sNm, sCtg, category);
+    CicoSCAilItems CSCAI(sPkg, sIco, sNm, sCtg, sTyp, sExe, category, bndsp);
+    m_ail.push_back(CSCAI);
+    return true;
+}
+
+/**
+ * @brief get category data
+ * @param sPkg ail package(appid) (get key)
+ * @param sNm ail name (get key)
+ * @param sCtg ail categories (get key)
+ * @param category read config file category string define
+ */
+void CicoSCLifeCycleController::getCategory(const char* sPkg, const char* sNm,
+                                            const char* sCtg,
+                                            std::string& category)
+{
+    category.clear();
+    GError *gerr;
+    char *appCtgry;
+    int  appCtgryType;
+    char addCtgry[400];
+    int  addCtgryLen;
+    char work[80];
+
+    /* get default category of this application */
+    addCtgry[0] = 0;
+    gerr = NULL;
+    appCtgry = g_key_file_get_string(m_gconf, sectAppAttr, sPkg, &gerr);
+    if (gerr == NULL)  {
+        appCtgryType = 0;
+    }
+    else {
+        g_clear_error(&gerr);
+        gerr = NULL;
+        appCtgry = g_key_file_get_string(m_gconf, sectAppAttr, sNm, &gerr);
+        if (gerr == NULL) {
+            appCtgryType = 1;
+        }
+    }
+    addCtgryLen = 0;
+    if (gerr != NULL) {
+        g_clear_error(&gerr);
+    }
+    else {
+        for (int i = 1;; i++) {
+            strncpy(&addCtgry[addCtgryLen],
+            appCtgry, sizeof(addCtgry)-addCtgryLen-2);
+            addCtgry[sizeof(addCtgry)-2] = 0;
+            addCtgryLen = strlen(addCtgry);
+            if (addCtgryLen > 0) {
+                if (addCtgry[addCtgryLen-1] != ';') {
+                    strcpy(&addCtgry[addCtgryLen++], ";");
+                }
+            }
+            snprintf(work, sizeof(work)-1, "%s.%d",
+                     appCtgryType == 0 ? sPkg : sNm, i);
+            gerr = NULL;
+            appCtgry = g_key_file_get_string(m_gconf, sectAppAttr, work, &gerr);
+            if (gerr != NULL) {
+                g_clear_error(&gerr);
+                break;
+            }
+        }
+    }
+    g_clear_error(&gerr);
+
+    /* get category */
+    if (NULL != sCtg) {
+        strncpy(&addCtgry[addCtgryLen], sCtg, sizeof(addCtgry)-addCtgryLen-1);
+        addCtgry[sizeof(addCtgry)-1] = 0;
+    }
+    if (addCtgry[0]) {
+         category.assign(addCtgry);
+    }
+}
+
+/**
+ * @brief aul infomation data initialization
+ */
+void CicoSCLifeCycleController::initAUL()
+{
+    ICO_TRA("start");
+    aul_listen_app_launch_signal(CSCLCCapp_launch_handler, (void*)this);
+    aul_listen_app_dead_signal(CSCLCCapp_dead_handler, (void*)this);
+    ICO_TRA("end");
+}
+
+/**
+ * @brief
+ */
+void CicoSCLifeCycleController::enterAUL(const char* appid, int pid,
+                                         const CicoSCWindow* obj)
+{
+    ICO_TRA("start");
+    bool bPushBack = true;
+    int sz = m_aul.size();
+    for (int i = 0; i < sz; i++) {
+        CicoSCAulItems* t = (CicoSCAulItems*)m_aul[i].p();
+        if (t->m_pid == pid) {
+            bPushBack = false;  // push_back flag off
+            if (NULL == obj) {
+                // Do not replace to NULL
+                ICO_DBG("Do not replace to NULL %d", t->m_CSCWptrs.size());
+                break; // break of for
+            }
+            else {
+                ICO_DBG("add window info. %d, %x", t->m_CSCWptrs.size(), obj);
+                t->enterWindow(obj);
+                break; // break of for
+            }
+        }
+    }
+    if (true == bPushBack) { // push back flag on?
+        // AUL list Unregistered
+        ICO_DBG("push_back(AUL(%s, %d, %x))", appid, pid, obj);
+        m_aul.push_back(CicoSCAulItems(appid, pid, obj));
+    }
+    ICO_TRA("end");
+}
+
+/**
+ * @brief
+ */
+bool CicoSCLifeCycleController::removeAUL(int pid)
+{
+    ICO_TRA("start %d", pid);
+    bool r = false;
+    vector<CicoSCAulItems>::iterator it;
+    for(it = m_aul.begin(); it != m_aul.end(); ++it) {
+        if (pid == it->m_pid) {
+            ICO_DBG("erase appid=%s", it->m_appid.c_str());
+            m_aul.erase(it);
+            r = true;
+            break;
+        }
+    }
+    ICO_TRA("end %s", r? "true":"false");
+    return r;
+}
+
+/**
+ * @brief 
+ * @param x CicoSCLifeCycleController class pointer
+ */
+int CSCLCCapp_launch_handlerX(int pid, CicoSCLifeCycleController* x)
+{
+    ICO_TRA("start");
+    if ((NULL == x) || (0 == x)) {
+        ICO_TRA("end user data is NULL");
+        return -1;
+    }
+    char appid[255];
+    aul_app_get_appid_bypid(pid, appid, sizeof(appid));
+    ICO_DBG("added %s, %d", appid, pid);
+    x->enterAUL(appid,pid);
+    ICO_TRA("end %s %d", appid, pid);
+    return 0;
+}
+
+
+/**
+ * @brief applications die. callback function
+ * @param pid
+ * @param data user data
+ * @param x CicoSCLifeCycleController class pointer
+ */
+int CSCLCCapp_dead_handlerX(int pid, CicoSCLifeCycleController* x)
+{
+    ICO_TRA("start");
+    if ((NULL == x) || (0 == x)) {
+        ICO_TRA("end user data is NULL");
+        return -1;
+    }
+    if (false == x->removeAUL(pid)) {
+        ICO_TRA("end dead %d fail", pid);
+        return -1;
+    }
+    ICO_TRA("end dead %d success", pid);
+    return 0;
+}
+
diff --git a/src/homescreen/CicoSCLifeCycleController.h b/src/homescreen/CicoSCLifeCycleController.h
new file mode 100644 (file)
index 0000000..b6d7790
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * 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
+ *
+ */
+#ifndef CICOSCLIFECYCLECONTROLLER_H
+#define CICOSCLIFECYCLECONTROLLER_H
+#include <glib.h>
+#include <vector>
+#include <map>
+#include <ail.h>
+#include <package-manager.h>
+
+#include "CicoSCAilItems.h"
+#include "CicoSCAulItems.h"
+
+
+#ifndef __CICO_SC_WINDOW_H__
+class CicoSCWindow;
+#endif
+
+
+class CicoSCLifeCycleController {
+public:
+    CicoSCLifeCycleController();
+    ~CicoSCLifeCycleController();
+
+       static CicoSCLifeCycleController* getInstance(void);
+
+    // Starting application
+    int launch(const char* appid);
+    int launch(const std::string& appid);
+    // Stopping application
+    int terminate(const char* appid);
+    int terminate(const std::string& appid);
+    int terminate(int pid);
+    // suspend application
+    int suspend(const char* appid);
+    int suspend(const std::string& appid);
+    int suspend(int pid);
+    // run application check
+    bool isRunning(const char* appid) const;
+    bool isRunning(const std::string& appid) const;
+
+    const std::vector<CicoSCAilItems>& getAilList() const;
+    const CicoSCAilItems* findAIL(const char* appid) const;
+    const CicoSCAilItems* findAIL(const std::string& appid) const;
+
+    const std::vector<CicoSCAulItems>& getAulList() const;
+// TODO mk_k Should I think about the multiple return values start
+/*
+    const CicoSCAulItems* findAUL(const char* appid) const;
+    const CicoSCAulItems* findAUL(const std::string& appid) const;
+*/
+    const CicoSCAulItems* findAUL(int pid) const;
+    bool getPIDs(const char* appid, std::vector<int>& pids) const;
+    bool getPIDs(std::string& appid, std::vector<int>& pids) const;
+    void enterAUL(const char* appid, int pid, const CicoSCWindow* obj=NULL);
+
+
+protected:
+    void initAIL();
+    friend ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
+                                                   CicoSCLifeCycleController* x);
+    bool createAilItems();
+
+    friend 
+        int CSCLCCpkgmgr_handlerX(int req_id, const char *pkg_type,
+                                 const char *pkg_name, const char *key,
+                                 const char *val, const void *pmsg,
+                                 CicoSCLifeCycleController *x);
+    void renewAIL();
+    void initAUL();
+    friend int CSCLCCapp_launch_handlerX(int pid,
+                                         CicoSCLifeCycleController *x);
+    friend int CSCLCCapp_dead_handlerX(int pid, CicoSCLifeCycleController *x);
+
+    int terminateR(int pid);
+    void getCategory(const char* sPkg, const char* sNm, const char* sCtg,
+                     std::string& category);
+    bool addAIL(const char* sPkg, const char* sIco, const char* sNm,
+                const char* sCtg, const char* sTyp, const char* sExe,
+                bool bndsp);
+    bool removeAUL(int pid);
+private:
+       static CicoSCLifeCycleController* ms_myInstance;
+
+protected:
+    std::vector<CicoSCAilItems> m_ail;
+    std::vector<CicoSCAulItems> m_aul;
+    GKeyFile* m_gconf;
+    pkgmgr_client* m_pc;
+};
+
+/**
+ * @brief AIL infomaton list
+ * @return AIL infomation item list Container
+ */
+inline
+const std::vector<CicoSCAilItems>& CicoSCLifeCycleController::getAilList() const
+{
+    return m_ail;
+}
+
+
+/**
+ * @brief AUL infomaton list
+ * @return AUL infomation item list Container
+ */
+inline
+const std::vector<CicoSCAulItems>& CicoSCLifeCycleController::getAulList() const
+{
+    return m_aul;
+}
+
+
+
+#endif // CICOSCLIFECYCLECONTROLLER_H
diff --git a/src/homescreen/CicoSCSystemConfig.cpp b/src/homescreen/CicoSCSystemConfig.cpp
new file mode 100644 (file)
index 0000000..94a9367
--- /dev/null
@@ -0,0 +1,1493 @@
+/*
+ * 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   CicoSCSystemConfig.cpp
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+#include "CicoSCSystemConfig.h"
+#include "CicoSCConf.h"
+
+//==========================================================================    
+//  private static variable
+//==========================================================================    
+CicoSCSystemConfig* CicoSCSystemConfig::ms_myInstance = NULL;
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  default constructor
+ */
+//--------------------------------------------------------------------------
+CicoSCSystemConfig::CicoSCSystemConfig()
+{
+    m_typeTable[""]          = ICO_NODETYPE_CENTER;
+    m_typeTable["center"]    = ICO_NODETYPE_CENTER;
+    m_typeTable["meter"]     = ICO_NODETYPE_METER;
+    m_typeTable["remote"]    = ICO_NODETYPE_REMOTE;
+    m_typeTable["passenger"] = ICO_NODETYPE_PASSENGER;
+    m_typeTable["rear"]      = ICO_NODETYPE_REAR;
+    m_typeTable["rearleft"]  = ICO_NODETYPE_REARLEFT;
+    m_typeTable["rearright"] = ICO_NODETYPE_REARRIGHT;
+
+    m_displayTypeTable[""]          = ICO_DISPLAYTYPE_CENTER;
+    m_displayTypeTable["center"]    = ICO_DISPLAYTYPE_CENTER;
+    m_displayTypeTable["meter"]     = ICO_DISPLAYTYPE_METER;
+    m_displayTypeTable["remote"]    = ICO_DISPLAYTYPE_REMOTE;
+    m_displayTypeTable["passenger"] = ICO_DISPLAYTYPE_PASSENGER;
+    m_displayTypeTable["rear"]      = ICO_DISPLAYTYPE_REAR;
+    m_displayTypeTable["rearleft"]  = ICO_DISPLAYTYPE_REARLEFT;
+    m_displayTypeTable["rearright"] = ICO_DISPLAYTYPE_REARRIGHT;
+
+    // 
+    m_categoryTalbe[""]              = ICO_POLICY_ALWAYS;
+    m_categoryTalbe["alway"]         = ICO_POLICY_ALWAYS;
+    m_categoryTalbe["run"]           = ICO_POLICY_RUNNING;
+    m_categoryTalbe["park"]          = ICO_POLICY_PARKED;
+    m_categoryTalbe["shift_park"]    = ICO_POLICY_SHIFT_PARKING;
+    m_categoryTalbe["shift_back"]    = ICO_POLICY_SHIFT_REVERSES;
+    m_categoryTalbe["shift_rev"]     = ICO_POLICY_SHIFT_REVERSES;
+    m_categoryTalbe["blinker_left"]  = ICO_POLICY_BLINKER_LEFT;
+    m_categoryTalbe["blinker_right"] = ICO_POLICY_BLINKER_RIGHT;
+
+    //
+    m_privilegeTable["almighty"]       = ICO_PRIVILEGE_ALMIGHTY;
+    m_privilegeTable["system"]         = ICO_PRIVILEGE_SYSTEM;
+    m_privilegeTable["system.audio"]   = ICO_PRIVILEGE_SYSTEM_AUDIO;
+    m_privilegeTable["system.visible"] = ICO_PRIVILEGE_SYSTEM_VISIBLE;
+    m_privilegeTable["maker"]          = ICO_PRIVILEGE_MAKER;
+    m_privilegeTable["certificate"]    = ICO_PRIVILEGE_CERTIFICATE;
+    m_privilegeTable["none"]           = ICO_PRIVILEGE_NONE;
+    m_privilegeTable[""]               = ICO_PRIVILEGE_NONE;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  destructor
+ */
+//--------------------------------------------------------------------------
+CicoSCSystemConfig::~CicoSCSystemConfig()
+{
+    // TODO
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Get instance of CicoSCSystemConfig
+ *
+ *  @return  pointer of CicoSCSystemConfig object
+ */
+//--------------------------------------------------------------------------
+CicoSCSystemConfig*
+CicoSCSystemConfig::getInstance(void)
+{
+    if (NULL == ms_myInstance) {
+        ms_myInstance = new CicoSCSystemConfig();
+    }
+    return ms_myInstance;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  Get instance of CicoSCSystemConfig
+ *
+ *  @param  [IN]    confFile    config file name
+ *  @return 0 on success, other on error
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::load(const string & confFile)
+{
+    ptree root;
+    read_xml(confFile, root);
+
+    createNodeConfList(root);
+    createDisplayConfList(root);
+    createSoundConfList(root);
+    createPortConf(root);
+    createCategoryConf(root);
+    createAppKindConf(root);
+    createInputDevList(root);
+    createDefaultConf(root);
+    createLogConf(root);
+
+    return 0;   //TODO
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const vector<CicoSCDisplayConf*>&
+CicoSCSystemConfig::getDisplayConfList(void) const
+{
+    return m_displayConfList;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createNodeConfList(const ptree & root)
+{
+    //<nodes>
+//    if (root.not_found() == root.find("systemconfig")) {
+//        ICO_ERR("nodes element not found");
+//        return;
+//    }
+    ptree nodes = root.get_child("systemconfig.nodes");
+
+    BOOST_FOREACH (const ptree::value_type& child, nodes) {
+        if (0 != strcmp(child.first.data(),"node")) {
+            ICO_ERR("unknown element(%s)", child.first.data());
+        }
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        optional<string> type;
+        optional<string> address;
+
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            ICO_ERR("node.id attr not found");
+            continue;
+        }
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            ICO_ERR("node.name attr not found");
+            continue;
+        }
+        type = child.second.get_optional<string>("type");
+        if (false == type.is_initialized()) {
+            ICO_ERR("node.type element not found");
+            continue;
+        }
+        address = child.second.get_optional<string>("ipaddress");
+        if (false == address.is_initialized()) {
+            ICO_ERR("node.address element not found");
+            continue;
+        }
+
+        CicoSCNodeConf* nodeConf = new CicoSCNodeConf;
+        nodeConf->id      = id.get();
+        nodeConf->name    = name.get();
+        nodeConf->type    = m_typeTable[type.get()];
+        nodeConf->address = address.get();
+        m_nodeConfList.push_back(nodeConf);
+
+        nodeConf->dumpConf();
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createDisplayConfList(const ptree & root)
+{
+    //<displays>
+//    if (root.not_found() != root.find("systemconfi.displays")) {
+//        ICO_ERR("displays element not found");
+//        return;
+//    }
+
+    ptree displays = root.get_child("systemconfig.displays");
+    BOOST_FOREACH (const ptree::value_type& child, displays) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        optional<string> node;
+        optional<int> no = optional<int>(-1);
+        optional<string> wayland;
+        optional<string> type;
+        optional<int> width = optional<int>(-1);
+        optional<int> height = optional<int>(-1);
+        optional<int> inch = optional<int>(-1);
+
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            ICO_ERR("display.id attr not found");
+            continue;
+        }
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            ICO_ERR("display.name attr not found");
+            continue;
+        }
+        node = child.second.get_optional<string>("node");
+        if (false == node.is_initialized()) {
+            ICO_ERR("display.node attr not found");
+            continue;
+        }
+        no = child.second.get_optional<int>("no");
+        if (false == no.is_initialized()) {
+            ICO_ERR("display.no element not found");
+            continue;
+        }
+        wayland = child.second.get_optional<string>("wayland");
+        if (false == wayland.is_initialized()) {
+            ICO_ERR("display.wayland element not found");
+            continue;
+        }
+        type = child.second.get_optional<string>("type");
+        if (false == type.is_initialized()) {
+            ICO_ERR("display.type element not found");
+            continue;
+        }
+        width = child.second.get_optional<int>("width");
+        if (false == width.is_initialized()) {
+            ICO_ERR("display.width element not found");
+            continue;
+        }
+        height = child.second.get_optional<int>("height");
+        if (false == height.is_initialized()) {
+            ICO_ERR("display.height element not found");
+            continue;
+        }
+        inch = child.second.get_optional<int>("inch");
+        if (false == inch.is_initialized()) {
+            ICO_ERR("display.inch element not found");
+            continue;
+        }
+
+        CicoSCDisplayConf* displayConf = new CicoSCDisplayConf();
+        displayConf->id     = id.get();
+        displayConf->name   = name.get();
+        displayConf->node   = getNodeIdbyName(node.get());
+        displayConf->no     = no.get();
+        displayConf->type   = m_displayTypeTable[type.get()];
+        displayConf->width  = width.get();
+        displayConf->height = height.get();
+        displayConf->inch   = inch.get();
+
+        displayConf->dumpConf();
+
+        createLayerConf(child, displayConf);
+        createDisplayZoneConf(child, displayConf);
+
+        // TODO overlap to zoneid
+        vector<CicoSCDisplayZoneConf*>::iterator itr;
+        itr = displayConf->zoneConfList.begin();
+        for (; itr != displayConf->zoneConfList.end(); ++itr) {
+        }
+
+        m_displayConfList.push_back(displayConf);
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createLayerConf(const ptree::value_type & child,
+                                    CicoSCDisplayConf* displayConf)
+{
+    ptree layers = child.second.get_child("layers");
+    BOOST_FOREACH (const ptree::value_type& layer, layers) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        optional<int> type = optional<int>(-1);
+        optional<bool> overlap = optional<bool>(false);
+
+        id = layer.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            ICO_ERR("disply.layer.id attr not found");
+            continue;
+        }
+        name = layer.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            ICO_ERR("disply.layer.name attr not found");
+            continue;
+        }
+        type = layer.second.get_optional<int>("type");
+        if (false == type.is_initialized()) {
+            ICO_ERR("disply.layer.type element not found");
+            continue;
+        }
+        overlap = layer.second.get_optional<bool>("menuoverlap");
+        if (false == overlap.is_initialized()) {
+            ICO_ERR("disply.layer.overlap element not found");
+            continue;
+        }
+
+        CicoSCLayerConf* layerConf = new CicoSCLayerConf();
+        layerConf->id          = id.get();
+        layerConf->name        = name.get();
+        layerConf->type        = type.get();
+        layerConf->menuoverlap = overlap.get();
+
+        displayConf->layerConfList.push_back(layerConf);
+
+        layerConf->dumpConf();
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createDisplayZoneConf(const ptree::value_type & child,
+                                   CicoSCDisplayConf* displayConf)
+{
+    ptree zones = child.second.get_child("zones");
+    BOOST_FOREACH (const ptree::value_type& zone, zones) {
+        optional<int>    id = optional<int>(-1);
+        optional<string> name;
+        optional<string> x;
+        optional<string> y;
+        optional<string> w;
+        optional<string> h;
+        optional<string> overlap;
+
+        id = zone.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            ICO_WRN("zone.id.attr not found");
+            continue;
+        }
+        name = zone.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            ICO_WRN("zone.name.attr not found");
+            continue;
+        }
+        x = zone.second.get_optional<string>("geometry.<xmlattr>.x");
+        if (false == x.is_initialized()) {
+            ICO_WRN("zone.geometry.x attr not found");
+            continue;
+        }
+        y = zone.second.get_optional<string>("geometry.<xmlattr>.y");
+        if (false == y.is_initialized()) {
+            ICO_WRN("zone.geometry.y attr not found");
+            continue;
+        }
+        w = zone.second.get_optional<string>("geometry.<xmlattr>.w");
+        if (false == w.is_initialized()) {
+            ICO_WRN("zone.geometry.w attr not found");
+            continue;
+        }
+        h = zone.second.get_optional<string>("geometry.<xmlattr>.h");
+        if (false == h.is_initialized()) {
+            ICO_WRN("zone.geometry.h attr not found");
+            continue;
+        }
+        overlap = zone.second.get_optional<string>("overlap");
+        if (false == overlap.is_initialized()) {
+            ICO_WRN("zone.overlap element not found");
+            overlap = optional<string>("");
+        }
+
+        CicoSCDisplayZoneConf* zoneConf = new CicoSCDisplayZoneConf();
+        zoneConf->id   = id.get();
+        zoneConf->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);
+
+        zoneConf->dumpConf();
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createSoundConfList(const ptree & root)
+{
+    //<sound>
+    ptree sounds = root.get_child("systemconfig.sounds");
+    BOOST_FOREACH (const ptree::value_type& child, sounds) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        optional<int> no = optional<int>(-1);
+
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            continue;
+        }
+
+        no = child.second.get_optional<int>("no");
+        if (false == no.is_initialized()) {
+            continue;
+        }
+
+        CicoSCSoundConf* soundConf = new CicoSCSoundConf();
+        soundConf->id   = id.get();
+        soundConf->name = name.get();
+        soundConf->no   = no.get();
+
+        soundConf->dumpConf();
+
+        createSoundZoneConf(child, soundConf);
+
+        m_soundConfList.push_back(soundConf);
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createSoundZoneConf(const ptree::value_type & child,
+                                        CicoSCSoundConf* soundConf)
+{
+    //<sound>
+    //  <zone>
+    //      ...
+    ptree zones = child.second.get_child("zones");
+    BOOST_FOREACH (const ptree::value_type& zone, zones) {
+        optional<int>    id = optional<int>(-1);
+        optional<string> name;
+
+        id = zone.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+        name = zone.second.get_optional<string>("<xmlattr>.name");
+        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();
+        soundConf->zoneConfList.push_back(zoneConf);
+
+        zoneConf->dumpConf();
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createPortConf(const ptree & root)
+{
+    // <ports>
+    ptree ports = root.get_child("systemconfig.ports");
+    BOOST_FOREACH (const ptree::value_type& child, ports) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            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
+            m_sysconPort = atoi(child.second.data().c_str());
+            break;
+        case 1:
+            m_soundPluginPort = atoi(child.second.data().c_str());
+            break;
+        default:
+            break;
+        }
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createCategoryConf(const ptree & root)
+{
+    //<category>
+    ptree categorys = root.get_child("systemconfig.categorys");
+    BOOST_FOREACH (const ptree::value_type& child, categorys) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        optional<string> type;
+        optional<string> view;
+        optional<string> sound;
+        optional<string> input;
+        optional<int> priority = optional<int>(-1);
+        
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            continue;
+        }
+        type = child.second.get_optional<string>("type");
+        if (false == type.is_initialized()) {
+            continue;
+        }
+        view = child.second.get_optional<string>("view");
+        if (false == view.is_initialized()) {
+            continue;
+        }
+        sound = child.second.get_optional<string>("sound");
+        if (false == sound.is_initialized()) {
+            continue;
+        }
+        input= child.second.get_optional<string>("input");
+        if (false == sound.is_initialized()) {
+            continue;
+        }
+        priority = child.second.get_optional<int>("priority");
+        if (false == priority.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;
+#endif
+
+        CicoSCCategoryConf* categoryConf = new CicoSCCategoryConf();
+        categoryConf->id       = id.get();
+        categoryConf->name     = name.get();
+        categoryConf->type     = type.get();
+        categoryConf->view     = m_categoryTalbe[view.get()];
+        categoryConf->sound    = m_categoryTalbe[sound.get()];
+        categoryConf->input    = m_categoryTalbe[input.get()];
+        categoryConf->priority = priority.get();
+        m_categoryConfList.push_back(categoryConf);
+        categoryConf->dumpConf();
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createAppKindConf(const ptree & root)
+{
+    // <appkinds>
+    ptree appkinds = root.get_child("systemconfig.appkinds");
+    BOOST_FOREACH (const ptree::value_type& child, appkinds) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        optional<string> privilege;
+        optional<int> priority = optional<int>(-1);
+
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            continue;
+        }
+
+        privilege = child.second.get_optional<string>("privilege");
+        if (false == name.is_initialized()) {
+            continue;
+        }
+
+        priority = child.second.get_optional<int>("priority");
+        if (false == priority.is_initialized()) {
+            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();
+        appKindConf->privilege = m_privilegeTable[privilege.get()];
+        appKindConf->priority  = priority.get();
+        m_appKindConfList.push_back(appKindConf);
+        appKindConf->dumpConf();
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createInputDevList(const ptree & root)
+{
+    //<inputs>
+    ptree inputs = root.get_child("systemconfig.inputs");
+    BOOST_FOREACH (const ptree::value_type& child, inputs) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+
+        id = child.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+
+        name = child.second.get_optional<string>("<xmlattr>.name");
+        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();
+        inputDevConf->name = name.get();
+        inputDevConf->dumpConf();
+
+        createSwitchList(child, inputDevConf);
+        m_inputDevConfList.push_back(inputDevConf);
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createSwitchList(const ptree::value_type & child,
+                                     CicoSCInputDevConf* inputDevConf)
+{
+    ptree switchs = child.second.get_child("switchs");
+    BOOST_FOREACH (const ptree::value_type& zone, switchs) {
+        optional<int> id = optional<int>(-1);
+        optional<string> name;
+        optional<string> appid;
+
+        id = zone.second.get_optional<int>("<xmlattr>.id");
+        if (false == id.is_initialized()) {
+            continue;
+        }
+
+        name = zone.second.get_optional<string>("<xmlattr>.name");
+        if (false == name.is_initialized()) {
+            continue;
+        }
+
+        appid = zone.second.get_optional<string>("<xmlattr>.appid");
+        if (false == appid.is_initialized()) {
+            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();
+        switchConf->appid = appid.get();
+        switchConf->dumpConf();
+        inputDevConf->switchConfList.push_back(switchConf);
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createDefaultConf(const ptree & root)
+{
+    // <default>
+    ptree defaults = root.get_child("systemconfig.default");
+
+    optional<string> node;
+    optional<string> appkind;
+    optional<string> category;
+    optional<string> display;
+    optional<string> layer;
+    optional<string> displayzone;
+    optional<string> sound;
+    optional<string> soundzone;
+    optional<string> inputdev;
+    optional<string> inputsw;
+
+    node = defaults.get_optional<string>("node");
+    if (false == node.is_initialized()) {
+        ICO_WRN("default.node element not found");
+    }
+
+    appkind = defaults.get_optional<string>("appkind");
+    if (false == appkind.is_initialized()) {
+        ICO_WRN("default.appkind element not found");
+    }
+
+    category = defaults.get_optional<string>("category");
+    if (false == category.is_initialized()) {
+        ICO_WRN("default.category element not found");
+    }
+
+    display = defaults.get_optional<string>("display");
+    if (false == display.is_initialized()) {
+        ICO_WRN("default.display element not found");
+    }
+
+    layer = defaults.get_optional<string>("layer");
+    if (false == layer.is_initialized()) {
+        ICO_WRN("default.layer element not found");
+    }
+
+    displayzone = defaults.get_optional<string>("displayzone");
+    if (false == displayzone.is_initialized()) {
+        ICO_WRN("default.displayzone element not found");
+    }
+
+    sound = defaults.get_optional<string>("sound");
+    if (false == sound.is_initialized()) {
+        ICO_WRN("default.sound element not found");
+    }
+
+    soundzone = defaults.get_optional<string>("soundzone");
+    if (false == soundzone.is_initialized()) {
+        ICO_WRN("default.soundzone element not found");
+    }
+
+    inputdev = defaults.get_optional<string>("inputdev");
+    if (false == inputdev.is_initialized()) {
+        ICO_WRN("default.inputdev element not found");
+    }
+
+    inputsw = defaults.get_optional<string>("inputsw");
+    if (false == inputsw.is_initialized()) {
+        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());
+    m_defaultConf->appkind     = getAppKindIdbyName(appkind.get());
+    m_defaultConf->category    = getCategoryIdbyName(category.get());
+    m_defaultConf->display     = getDisplayIdbyName(display.get());
+    m_defaultConf->layer       = getLayerIdfbyName(display.get(), layer.get());
+    m_defaultConf->displayzone = getDizplayZoneIdbyName(display.get(),
+                                                      displayzone.get());
+    m_defaultConf->sound       = getSoundIdbyName(sound.get());
+    m_defaultConf->soundzone   = getSoundZoneIdbyName(sound.get(),
+                                                    soundzone.get());
+    m_defaultConf->inputdev    = getInputDevIdbyName(inputdev.get());
+    m_defaultConf->inputsw     = getSwitchIdbyName(inputdev.get(),
+                                                 inputsw.get());
+
+//TODO
+#define ICO_SYC_TOP_EVN     (char*)"SYSCON_TOPDIR"
+#define ICO_SYC_TOP_DIR     (char*)"/usr/apps/org.tizen.ico.system-controller"
+    /* decide top directory in all configurations       */
+    char *topdir = getenv(ICO_SYC_TOP_EVN);
+    if (NULL ==  topdir) {
+        topdir = ICO_SYC_TOP_DIR;
+    }
+    m_defaultConf->topdir = topdir;
+    
+//TODO
+#define ICO_SYC_CONFIG_ENV  (char*)"SYSCON_CONFDIR"
+#define ICO_SYC_CONFIG_DIR  (char*)"res/config"
+    /* decide top directory in configuration file's     */
+    char *confdir = getenv(ICO_SYC_CONFIG_ENV);
+    if (NULL != confdir) {
+        m_defaultConf->confdir = confdir;
+    }
+    else {
+        m_defaultConf->confdir = m_defaultConf->topdir;
+        m_defaultConf->confdir.append("/");
+        m_defaultConf->confdir.append(ICO_SYC_CONFIG_DIR);
+    }
+
+    m_defaultConf->dumpConf();
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+void
+CicoSCSystemConfig::createLogConf(const ptree & root)
+{
+    // <log>
+    // </log>
+    ptree logNode = root.get_child("systemconfig.log");
+    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;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::calcGeometryExpr(const string & expr,
+                                     CicoSCDisplayConf* conf)
+{
+    int     val = 0;
+    int     wval;
+    int     i, j, sign;
+    char    word[32];
+
+    j = 0;
+    sign = 0;
+    for (i = 0; ; i++)  {
+        if (expr[i] == ' ')  continue;
+        if ((expr[i] == 0) || (expr[i] == '+') || (expr[i] == '-') ||
+            (expr[i] == '*') || (expr[i] == '-') || (expr[i] == '/'))  {
+            if (j > 0)  {
+                word[j] = 0;
+                if ((strcasecmp(word, "dispw") == 0) ||
+                    (strcasecmp(word, "width") == 0))   {
+                    wval = conf->width;
+                }
+                else if ((strcasecmp(word, "disph") == 0) ||
+                         (strcasecmp(word, "heigh") == 0))  {
+                    wval = conf->height;
+                }
+                else    {
+                    wval = strtol(word, (char **)0, 0);
+                }
+                j = 0;
+                if (sign >= 10) {
+                    wval = 0 - wval;
+                }
+                switch (sign % 10)  {
+                case 0:                     /* assign       */
+                    val = wval;
+                    break;
+                case 1:                     /* '+'          */
+                    val += wval;
+                    break;
+                case 2:                     /* '-'          */
+                    val -= wval;
+                    break;
+                case 3:                     /* '*'          */
+                    val *= wval;
+                    break;
+                case 4:                     /* '/'          */
+                    val /= wval;
+                    break;
+                default:
+                    break;
+                }
+                sign = 0;
+                if (expr[i] == '+')      sign = 1;
+                else if (expr[i] == '-') sign = 2;
+                else if (expr[i] == '*') sign = 3;
+                else if (expr[i] == '/') sign = 4;
+                else                    sign = 0;
+            }
+            else    {
+                if ((sign > 0) && (expr[i] == '-'))  {
+                    sign += 10;
+                }
+                else    {
+                    if (expr[i] == '+')      sign = 1;
+                    else if (expr[i] == '-') sign = 2;
+                    else if (expr[i] == '*') sign = 3;
+                    else if (expr[i] == '/') sign = 4;
+                    else                     sign = 0;
+                }
+            }
+            if (expr[i] == 0)    break;
+        }
+        else    {
+            if (j < ((int)sizeof(word)-1))  {
+                word[j++] = expr[i];
+            }
+        }
+    }
+    return val;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCNodeConf*
+CicoSCSystemConfig::findNodeConfbyName(const string & name)
+{
+    vector<CicoSCNodeConf*>::iterator itr;
+    itr = m_nodeConfList.begin();
+    for (; itr != m_nodeConfList.end(); ++itr) {
+        const CicoSCNodeConf* conf = const_cast<CicoSCNodeConf*>(*itr);
+        if (name == conf->name) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCDisplayConf*
+CicoSCSystemConfig::findDisplayConfbyName(const string & name)
+{
+    vector<CicoSCDisplayConf*>::iterator itr;
+    itr = m_displayConfList.begin();
+    for (; itr != m_displayConfList.end(); ++itr) {
+        const CicoSCDisplayConf* conf = NULL;
+        conf = const_cast<CicoSCDisplayConf*>(*itr);
+        if (name == conf->name) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCLayerConf*
+CicoSCSystemConfig::findLayerConfbyName(const string & displayName,
+                                        const string & layerName)
+{
+    const CicoSCDisplayConf* displayConf = NULL;
+    displayConf = findDisplayConfbyName(displayName);
+    if (NULL == displayConf) {
+        return NULL;
+    }
+
+    vector<CicoSCLayerConf*>::const_iterator itr;
+    itr = displayConf->layerConfList.begin();
+    for (; itr != displayConf->layerConfList.end(); ++itr) {
+        const CicoSCLayerConf* conf = NULL;
+        conf = const_cast<CicoSCLayerConf*>(*itr);
+        if (layerName == conf->name) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCDisplayZoneConf*
+CicoSCSystemConfig::findDisplayZoneConfbyName(const string & displayName,
+                                              const string & zoneName)
+{
+    const CicoSCDisplayConf* displayConf = NULL;
+    displayConf = findDisplayConfbyName(displayName);
+    if (NULL == displayConf) {
+        return NULL;
+    }
+
+    vector<CicoSCDisplayZoneConf*>::const_iterator itr;
+    itr = displayConf->zoneConfList.begin();
+    for (; itr != displayConf->zoneConfList.end(); ++itr) {
+        const CicoSCDisplayZoneConf* conf = NULL;
+        conf = const_cast<CicoSCDisplayZoneConf*>(*itr);
+        if (zoneName == conf->name) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCSoundConf*
+CicoSCSystemConfig::findSoundConfbyName(const string & name)
+{
+    vector<CicoSCSoundConf*>::iterator itr;
+    itr = m_soundConfList.begin();
+    for (; itr != m_soundConfList.end(); ++itr) {
+        const CicoSCSoundConf* conf = NULL;
+        conf = const_cast<CicoSCSoundConf*>(*itr);
+        if (name == conf->name) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCSoundZoneConf*
+CicoSCSystemConfig::findSoundZoneConfbyName(const string & soundName,
+                                            const string & zoneName)
+{
+    const CicoSCSoundConf* soundConf = NULL;
+    soundConf = findSoundConfbyName(soundName);
+    if (NULL == soundConf) {
+        return NULL;
+    }
+
+    vector<CicoSCSoundZoneConf*>::const_iterator itr;
+    itr = soundConf->zoneConfList.begin();
+    for (; itr != soundConf->zoneConfList.end(); ++itr) {
+        const CicoSCSoundZoneConf* conf = NULL;
+        conf = const_cast<CicoSCSoundZoneConf*>(*itr);
+        if (zoneName == conf->name) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCInputDevConf*
+CicoSCSystemConfig::findInputDevConfbyName(const string & name)
+{
+    vector<CicoSCInputDevConf*>::iterator itr;
+    itr = m_inputDevConfList.begin();
+    for (; itr != m_inputDevConfList.end(); ++itr) {
+        const CicoSCInputDevConf* conf = NULL;
+        conf = const_cast<CicoSCInputDevConf*>(*itr);
+        if (name == conf->name) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCSwitchConf*
+CicoSCSystemConfig::findSwitchConfbyName(const string & inputDevName,
+                                         const string & switchName)
+{
+    const CicoSCInputDevConf* inputDevConf = NULL;
+    inputDevConf = findInputDevConfbyName(inputDevName);
+    if (NULL == inputDevConf) {
+        ICO_WRN("name(%s) input device config not found.",
+                 inputDevName.c_str());
+        return NULL;
+    }
+
+    vector<CicoSCSwitchConf*>::const_iterator itr;
+    itr = inputDevConf->switchConfList.begin();
+    for (; itr != inputDevConf->switchConfList.end(); ++itr) {
+        const CicoSCSwitchConf* conf = NULL;
+        conf = const_cast<CicoSCSwitchConf*>(*itr);
+        if (switchName == conf->name) {
+            return conf;
+        }
+    }
+
+    ICO_WRN("name(%s) switch config not found.", switchName.c_str());
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCAppKindConf*
+CicoSCSystemConfig::findAppKindConfbyName(const string & name)
+{
+    vector<CicoSCAppKindConf*>::iterator itr;
+    itr = m_appKindConfList.begin();
+    for (; itr != m_appKindConfList.end(); ++itr) {
+        const CicoSCAppKindConf* conf = NULL;
+        conf = const_cast<CicoSCAppKindConf*>(*itr);
+        if (name == conf->name) {
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCCategoryConf*
+CicoSCSystemConfig::findCategoryConfbyName(const string & name)
+{
+    vector<CicoSCCategoryConf*>::iterator itr;
+    itr = m_categoryConfList.begin();
+    for (; itr != m_categoryConfList.end(); ++itr) {
+        const CicoSCCategoryConf* conf = NULL;
+        conf = const_cast<CicoSCCategoryConf*>(*itr);
+        if (name == conf->name) {
+            //return const_cast<CicoSCCategoryConf*>(itr->pointer);
+            return conf;
+        }
+    }
+
+    return NULL;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+const CicoSCDefaultConf*
+CicoSCSystemConfig::getDefaultConf(void)
+{
+    return m_defaultConf;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getNodeIdbyName(const string & name)
+{
+    const CicoSCNodeConf* conf = NULL;
+    conf = findNodeConfbyName(name);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getDisplayIdbyName(const string & name)
+{
+    const CicoSCDisplayConf* conf = NULL;
+    conf = findDisplayConfbyName(name);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getLayerIdfbyName(const string & displayName,
+                                      const string & layerName)
+{
+    const CicoSCLayerConf* conf = NULL;
+    conf = findLayerConfbyName(displayName, layerName);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getDizplayZoneIdbyName(const string & displayName,
+                                           const string & zoneName)
+{
+    const CicoSCDisplayZoneConf* conf = NULL;
+    conf = findDisplayZoneConfbyName(displayName, zoneName);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getSoundIdbyName(const string & name)
+{
+    const CicoSCSoundConf* conf = NULL;
+    conf = findSoundConfbyName(name);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getSoundZoneIdbyName(const string & soundName,
+                                         const string & zoneName)
+{
+    const CicoSCSoundZoneConf* conf = NULL;
+    conf = findSoundZoneConfbyName(soundName, zoneName);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getInputDevIdbyName(const string & name)
+{
+    const CicoSCInputDevConf* conf = NULL;
+    conf = findInputDevConfbyName(name);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getSwitchIdbyName(const string & inputDevName,
+                                      const string & switchName)
+{
+    const CicoSCSwitchConf* conf = NULL;
+    conf = findSwitchConfbyName(inputDevName, switchName);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getAppKindIdbyName(const string & name)
+{
+    const CicoSCAppKindConf* conf = NULL;
+    conf = findAppKindConfbyName(name);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+//--------------------------------------------------------------------------
+/**
+ *  @brief  
+ *
+ *  @param  [IN]
+ */
+//--------------------------------------------------------------------------
+int
+CicoSCSystemConfig::getCategoryIdbyName(const string & name)
+{
+    const CicoSCCategoryConf* conf = NULL;
+    conf = findCategoryConfbyName(name);
+    if (NULL == conf) {
+        return -1;
+    }
+
+    return conf->id;
+}
+
+#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:
diff --git a/src/homescreen/CicoSCSystemConfig.h b/src/homescreen/CicoSCSystemConfig.h
new file mode 100644 (file)
index 0000000..870e402
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * 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   CicoSCSystemConfig.h
+ *
+ *  @brief  
+ */
+//==========================================================================
+#ifndef __CICO_SC_SYSTEM_CONFIG_H__
+#define __CICO_SC_SYSTEM_CONFIG_H__
+
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/xml_parser.hpp>
+#include <boost/foreach.hpp>
+
+#include <string>
+#include <map>
+#include <vector>
+using namespace std;
+using namespace boost;
+using namespace boost::property_tree;
+    
+class CicoSCNodeConf;
+class CicoSCLayerConf;
+class CicoSCDisplayZoneConf;
+class CicoSCDisplayConf;
+class CicoSCSoundZoneConf;
+class CicoSCSoundConf;
+class CicoSCCategoryConf;
+class CicoSCAppKindConf;
+class CicoSCSwitchConf;
+class CicoSCInputDevConf;
+class CicoSCDefaultConf;
+
+class CicoSCSystemConfig 
+{
+public:
+    static CicoSCSystemConfig* getInstance(void);
+
+    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 CicoSCNodeConf* findNodeConfbyName(const string & name);
+    const CicoSCDisplayConf* findDisplayConfbyName(const string & name);
+    const CicoSCLayerConf* findLayerConfbyName(const string & displayName,
+                                               const string & layerName);
+    const CicoSCDisplayZoneConf* findDisplayZoneConfbyName(const string & displayName,
+                                                       const string & zoneName);
+    const CicoSCSoundConf* findSoundConfbyName(const string & name);
+    const CicoSCSoundZoneConf* findSoundZoneConfbyName(const string & soundName,
+                                                       const string & zoneName);
+    const CicoSCInputDevConf* findInputDevConfbyName(const string & name);
+    const CicoSCSwitchConf* findSwitchConfbyName(const string & inputDevName,
+                                                 const string & switchName);
+
+    const CicoSCAppKindConf* findAppKindConfbyName(const string & name);
+    const CicoSCCategoryConf* findCategoryConfbyName(const string & name);
+
+    const CicoSCDefaultConf* getDefaultConf(void);
+
+    int getNodeIdbyName(const string & name);
+    int getDisplayIdbyName(const string & name);
+    int getLayerIdfbyName(const string & displayName,
+                          const string & layerName);
+    int getDizplayZoneIdbyName(const string & displayName,
+                               const string & zoneName);
+    int getSoundIdbyName(const string & name);
+    
+    int getSoundZoneIdbyName(const string & soundName,
+                             const string & zoneName);
+    int getInputDevIdbyName(const string & name);
+    int getSwitchIdbyName(const string & inputDevName,
+                          const string & switchName);
+    int getAppKindIdbyName(const string & name);
+    int getCategoryIdbyName(const string & name);
+
+
+private:
+    // default constructor
+    CicoSCSystemConfig();
+
+    // destructor
+    ~CicoSCSystemConfig();
+
+    // assignment operator
+    CicoSCSystemConfig& operator=(const CicoSCSystemConfig &object);
+
+    // copy constructor
+    CicoSCSystemConfig(const CicoSCSystemConfig &object);
+
+    void createNodeConfList(const ptree & root);
+    void createDisplayConfList(const ptree & root);
+    void createLayerConf(const ptree::value_type & child,
+                         CicoSCDisplayConf* displayConf);
+    void createDisplayZoneConf(const ptree::value_type & child,
+                               CicoSCDisplayConf* displayConf);
+
+    void createSoundConfList(const ptree & root);
+    void createSoundZoneConf(const ptree::value_type & child,
+                             CicoSCSoundConf* soundConf);
+    void createPortConf(const ptree & root);
+    void createCategoryConf(const ptree & root);
+    void createAppKindConf(const ptree & root);
+    void createInputDevList(const ptree & root);
+    void createSwitchList(const ptree::value_type & child,
+                          CicoSCInputDevConf* inputDevConf);
+    void createDefaultConf(const ptree & root);
+    void createLogConf(const ptree & root);
+
+    int calcGeometryExpr(const string & expr, CicoSCDisplayConf* conf);
+
+private:
+    static CicoSCSystemConfig* ms_myInstance;
+    string m_confFile;
+    map<string,int> m_typeTable;
+    map<string,int> m_displayTypeTable;
+    map<string,int> m_categoryTalbe;
+    map<string,int> m_privilegeTable;
+    vector<CicoSCNodeConf*> m_nodeConfList;
+    vector<CicoSCDisplayConf*> m_displayConfList;
+    vector<CicoSCSoundConf*> m_soundConfList;
+    vector<CicoSCInputDevConf*> m_inputDevConfList;
+    vector<CicoSCCategoryConf*> m_categoryConfList;
+    vector<CicoSCAppKindConf*> m_appKindConfList;
+    int m_sysconPort;
+    int m_soundPluginPort;
+    int m_loglevel;
+    bool  m_logflush;
+    CicoSCDefaultConf *m_defaultConf;
+};
+#endif  // __CICO_SC_SYSTEM_CONFIG_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/src/homescreen/CicoStatusBarControlWindow.cpp b/src/homescreen/CicoStatusBarControlWindow.cpp
new file mode 100644 (file)
index 0000000..f349974
--- /dev/null
@@ -0,0 +1,468 @@
+/*
+ * 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   windows control for statusbar application
+ *
+ * @date    Feb-15-2013
+ */
+#include "CicoStatusBarControlWindow.h"
+
+/*============================================================================*/
+/* Declare static values                                                      */
+/*============================================================================*/
+CicoStatusBarControlWindow* CicoStatusBarControlWindow::instance;
+
+/*============================================================================*/
+/* Functions Declaration (CicoStatusBarControlWindow)                         */
+/*============================================================================*/
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarControlWindow::CicoStatusBarControlWindow
+ *          constractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoStatusBarControlWindow::CicoStatusBarControlWindow()
+{
+    width = 0;
+    moveH = 0;
+    window = NULL;
+    shtct_list = NULL;
+   
+    /* Initialize a new system of Ecore_Evas */
+    ecore_evas_init();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarControlWindow::~CicoStatusBarControlWindow
+ *          destractor
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoStatusBarControlWindow::~CicoStatusBarControlWindow()
+{
+    /* Free an Ecore_Evas */
+    if(window != NULL){
+        ecore_evas_free(window);
+    }
+    /* Shut down the Ecore_Evas system */
+    ecore_evas_shutdown();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarControlWindow::Initialize
+ *          Initialize
+ *
+ * @param[in]   homescreen_config_tmp    pointer to instance of CicoHomeScreenConfig
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoStatusBarControlWindow::Initialize(CicoHomeScreenConfig *homescreen_config_tmp)
+{
+    homescreen_config = homescreen_config_tmp;
+
+    /* get image path*/
+    CicoHomeScreenResourceConfig::GetImagePath(respath, sizeof(respath));
+
+    /*create instances*/
+    time_data[0] = new CicoStatusBarTime(fname_num0);
+    time_data[1] = new CicoStatusBarTime(fname_num1);
+    time_data[2] = new CicoStatusBarTime(fname_num2);
+    time_data[3] = new CicoStatusBarTime(fname_num3);
+    time_data[4] = new CicoStatusBarTime(fname_num4);
+    time_data[5] = new CicoStatusBarTime(fname_num5);
+    time_data[6] = new CicoStatusBarTime(fname_num6);
+    time_data[7] = new CicoStatusBarTime(fname_num7);
+    time_data[8] = new CicoStatusBarTime(fname_num8);
+    time_data[9] = new CicoStatusBarTime(fname_num9);
+    time_data[10] = new CicoStatusBarTime(fname_am);
+    time_data[11] = new CicoStatusBarTime(fname_pm);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarControlWindow::Finalize
+ *          Finalize
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoStatusBarControlWindow::Finalize(void)
+{
+    /*delete instances*/
+    for(int ii = 0;ii < ICO_SB_TIME_IMG_PARTS;ii++){
+        delete time_data[ii];
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarControlWindow::SetInstanceForClock
+ *          seting instance for static method
+ *
+ * @param[in]   instance_tmp    instance of this class
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoStatusBarControlWindow::SetInstanceForClock(CicoStatusBarControlWindow *instance_tmp) 
+{
+    instance = instance_tmp;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarControlWindow::CreateEcoreEvas
+ *          make new ecore_evas 
+ *
+ * @param[in]   none
+ * @return      0:success -1:failed
+ */
+/*--------------------------------------------------------------------------*/
+int
+CicoStatusBarControlWindow::CreateEcoreEvas(void)
+{
+    /* Make a new ecore_evas */
+    window = ecore_evas_new(NULL, 0, 0, 1, 1, "frame=0");
+
+    /* if not for a window, return NULL */
+    if (!window) {
+        EINA_LOG_CRIT("StatusBar: could not create ons_window.");
+        return -1;
+    }
+    ecore_evas_callback_delete_request_set(window,QuitEcoreLoop);
+  
+    return 0; 
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarControlWindow::StartEcoreLoop
+ *          start ecore loop
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoStatusBarControlWindow::StartEcoreLoop(void)
+{
+    /* Start main loop */
+    ecore_main_loop_begin();
+}
+
+/*--------------------------------------------------------------------------*/
+/*
+ * @brief   CicoStatusBarControlWindow::QuitEcoreLoop
+ *          callback function called by EFL when ecore destroyed.
+ *          exit ecore main loop.
+ *
+ * @param[in]   ee                  ecore evas object
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoStatusBarControlWindow::QuitEcoreLoop(Ecore_Evas *ee)
+{
+    ICO_DBG("CicoStatusBarControlWindow::QuitEcoreLoop: Enter");
+    ecore_main_loop_quit();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarControlWindow::ResizeWindow
+ *          resize window 
+ *
+ * @param[in]   orientation     setting ICO_ONS_HORIZONTAL or ICO_ONS_VERTICAL
+ *                              (if config is existing,this value is ignored)
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoStatusBarControlWindow::ResizeWindow(int orientation)
+{
+    int width_tmp, height_tmp;
+  
+    /* load configuration */
+    if (homescreen_config != NULL) {
+       orientation = homescreen_config->ConfigGetInteger(ICO_HS_CONFIG_STATUBAR,
+                                          ICO_HS_CONFIG_ORIENTAION,
+                                          orientation);
+    }
+
+    /* resize window */
+    ecore_main_loop_iterate();
+    ecore_wl_screen_size_get(&width_tmp, &height_tmp);
+    if (orientation == ICO_SB_VERTICAL) {
+        width = width_tmp > height_tmp ? height_tmp : width_tmp;
+        moveH = width - ICO_HS_SIZE_LAYOUT_WIDTH;
+    }
+    else {
+        width = width_tmp < height_tmp ? height_tmp : width_tmp;
+        moveH = width - ICO_HS_SIZE_LAYOUT_WIDTH;
+    }
+
+    /* Set the window size of the maximum and minimum */
+    ecore_evas_size_min_set(window, width, ICO_HS_SIZE_SB_HEIGHT);
+    ecore_evas_size_max_set(window, width, ICO_HS_SIZE_SB_HEIGHT);
+
+    /* Set the title of an Ecore_Evas window */
+    /* ecore_evas_title_set(ee, "Ecore_Evas buffer (image) example"); */
+    ecore_evas_move(window, 0, ICO_SB_POS_Y);
+    ecore_evas_resize(window, width, ICO_HS_SIZE_SB_HEIGHT);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarControlWindow::ShowWindow
+ *          show Window
+ *
+ * @param[in]   void
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoStatusBarControlWindow::ShowWindow(void)
+{
+    ecore_evas_show(window);
+}
+
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarControlWindow::InitEvas
+ *          initialize evas 
+ *
+ * @param[in]   none
+ * @return      0:OK -1:NG
+ */
+/*--------------------------------------------------------------------------*/
+int 
+CicoStatusBarControlWindow::InitEvas(void)
+{
+    Evas_Object *canvas;
+
+    if (evas) {
+        return 0;
+    }
+
+    evas = ecore_evas_get(window);
+    if (!evas) {
+        ICO_DBG("CicoStatusBarControlWindow::InitEvas: could not create evas.");
+        return -1;
+    }
+
+    /* BG color set */
+    canvas = evas_object_rectangle_add(evas);
+    evas_object_color_set(canvas, 0, 0, 0, 255);
+    evas_object_move(canvas, 0, ICO_SB_POS_Y);
+    evas_object_resize(canvas, width, ICO_HS_SIZE_SB_HEIGHT);
+    evas_object_show(canvas);
+   
+    return 0;
+
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarControlWindow::ShowClockHour
+ *          show the clock's hour image on statubar
+ *
+ * @param[in]   tm                  time data
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoStatusBarControlWindow::ShowClockHour(struct tm *t_st)
+{
+    char file[ICO_SB_BUF_SIZE];
+    int ampm_index;
+
+    //AM or PM
+    if (t_st->tm_hour < ICO_SB_TIME_AMPM_THRESHOLD) {
+        ampm_index = ICO_SB_TIME_AM;
+    }
+    else {
+        ampm_index = ICO_SB_TIME_PM;
+    }
+    sprintf(file, "%s%s", respath, 
+                time_data[ampm_index]->GetFileName());
+    evas_object_image_file_set(ampm, file, NULL);
+   
+    //Hour
+    sprintf(file, "%s%s", respath,
+            time_data[(t_st->tm_hour % ICO_SB_TIME_AMPM_THRESHOLD) / 10]->GetFileName());
+    evas_object_image_file_set(hour1, file, NULL);
+    
+    sprintf(file, "%s%s", respath,
+            time_data[(t_st->tm_hour % ICO_SB_TIME_AMPM_THRESHOLD) % 10]->GetFileName());
+    evas_object_image_file_set(hour2, file, NULL);
+  
+    /*Makes the given Evas object visible*/
+    evas_object_show(ampm);
+    evas_object_show(hour1);
+    evas_object_show(hour2);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarControlWindow::ShowClockMinutes
+ *          show the clock's minutes image on statubar
+ *
+ * @param[in]   tm                  time data
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoStatusBarControlWindow::ShowClockMinutes(struct tm *t_st)
+{
+    char file[ICO_SB_BUF_SIZE];
+    //Minute
+    sprintf(file, "%s%s", respath, time_data[t_st->tm_min / 10]->GetFileName());
+    evas_object_image_file_set(min1, file, NULL);
+    sprintf(file, "%s%s", respath, time_data[t_st->tm_min % 10]->GetFileName());
+    evas_object_image_file_set(min2, file, NULL);
+
+    /*Makes the given Evas object visible*/
+    evas_object_show(min1);
+    evas_object_show(min2);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarControlWindow::UpdateTime
+ *          callback function called by Ecore.
+ *          get time data, and show the clock's image on statubar.
+ *
+ * @param[in]   thread_data         user data
+ * @return      call back setting
+ * @retval      ECORE_CALLBACK_RENEW    set callback
+ */
+/*--------------------------------------------------------------------------*/
+Eina_Bool
+CicoStatusBarControlWindow::UpdateTime(void *thread_data)
+{
+    time_t timer;
+    struct tm *t_st, *old_t_st;
+
+    old_t_st = &instance->latest_time;
+
+    /* get time */
+    time(&timer);
+    t_st = localtime(&timer);
+
+    if (old_t_st->tm_hour != t_st->tm_hour) {
+        /* hour file set */
+        instance->ShowClockHour(t_st);
+    }
+    if (old_t_st->tm_min != t_st->tm_min) {
+        /* min file set */
+        instance->ShowClockMinutes(t_st);
+    }
+    memcpy(old_t_st, t_st, sizeof(struct tm));
+
+    return ECORE_CALLBACK_RENEW;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarControlWindow::ShowClock
+ *          show the clock's 
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoStatusBarControlWindow::ShowClock(void)
+{
+    Evas_Object *colon;
+    time_t timer;
+    struct tm *t_st;
+    char file[ICO_SB_BUF_SIZE]; 
+    /* ... */
+    ampm = evas_object_image_filled_add(evas);
+    hour1 = evas_object_image_filled_add(evas);
+    hour2 = evas_object_image_filled_add(evas);
+    min1 = evas_object_image_filled_add(evas);
+    min2 = evas_object_image_filled_add(evas);
+    colon = evas_object_image_filled_add(evas);
+    /* This function will make layout change */
+    evas_object_move(ampm, moveH + ICO_SB_POS_AMPM_X, ICO_SB_POS_AMPM_Y);
+    evas_object_move(hour1, moveH + ICO_SB_POS_HOUR1_X, ICO_SB_POS_HOUR1_Y);
+    evas_object_move(hour2, moveH + ICO_SB_POS_HOUR2_X, ICO_SB_POS_HOUR2_Y);
+    evas_object_move(min1, moveH + ICO_SB_POS_MIN1_X, ICO_SB_POS_MIN1_Y);
+    evas_object_move(min2, moveH + ICO_SB_POS_MIN2_X, ICO_SB_POS_MIN2_Y);
+    evas_object_move(colon, moveH + ICO_SB_POS_COLON_X, ICO_SB_POS_COLON_Y);
+    /* This function will make size change of picture */
+    evas_object_resize(ampm, ICO_SB_SIZE_AMPM_W, ICO_SB_SIZE_AMPM_H);
+    evas_object_resize(hour1, ICO_SB_SIZE_NUM_W, ICO_SB_SIZE_NUM_H);
+    evas_object_resize(hour2, ICO_SB_SIZE_NUM_W, ICO_SB_SIZE_NUM_H);
+    evas_object_resize(min1, ICO_SB_SIZE_NUM_W, ICO_SB_SIZE_NUM_H);
+    evas_object_resize(min2, ICO_SB_SIZE_NUM_W, ICO_SB_SIZE_NUM_H);
+    evas_object_resize(colon, ICO_SB_SIZE_COLON_W, ICO_SB_SIZE_COLON_H);
+    /* Makes the given Evas object visible */
+    evas_object_show(ampm);
+    evas_object_show(hour1);
+    evas_object_show(hour2);
+    evas_object_show(min1);
+    evas_object_show(min2);
+    evas_object_show(colon);
+
+    /*first set*/
+    time(&timer);
+    t_st = localtime(&timer);
+    ShowClockHour(t_st);
+    ShowClockMinutes(t_st);
+  
+    /* Set the image file */
+    for (int ii = 0; ii < ICO_SB_TIME_IMG_PARTS; ii++) {
+        time_data[ii]->SetTimeImg(evas_object_image_filled_add(evas));
+        sprintf(file, "%s%s", respath, time_data[ii]->GetFileName());
+        evas_object_image_file_set(time_data[ii]->GetTimeImg(), file, NULL);
+    }
+    sprintf(file, "%s%s", respath, fname_colon);
+    evas_object_image_file_set(colon, file, NULL);
+
+
+    ecore_timer_add(ICO_SB_TIMEOUT, UpdateTime, NULL);
+
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarControlWindow::EvasObjectImageFileSetAndShow
+ *          set the evas object image file and show it 
+ *
+ * @param[in]   obj    evas object
+ * @param[in]   img    image 
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoStatusBarControlWindow::EvasObjectImageFileSetAndShow(Evas_Object *obj,char *icon)
+{
+    char img[ICO_HS_TEMP_BUF_SIZE];
+
+    sprintf(img, icon, respath);
+    evas_object_image_file_set(obj, img, NULL);
+    evas_object_show(obj);
+}
diff --git a/src/homescreen/CicoStatusBarControlWindow.h b/src/homescreen/CicoStatusBarControlWindow.h
new file mode 100644 (file)
index 0000000..09f6226
--- /dev/null
@@ -0,0 +1,132 @@
+#ifndef __CICOSTATUSBARCONTROLWINDOW_H__
+#define __CICOSTATUSBARCONTROLWINDOW_H__
+/*
+ * 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   window control for statusbar application
+ *
+ * @date    Feb-15-2013
+ */
+#include <stdio.h>
+#include <time.h>
+#include <pthread.h>
+
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#include <Ecore_Evas.h>
+
+
+#include "home_screen_res.h"
+#include "CicoHomeScreenCommon.h"
+#include "CicoHomeScreenConfig.h"
+#include "CicoHomeScreenSound.h"
+#include "CicoStatusBarTime.h"
+
+#define ICO_HS_CONFIG_ORIENTAION    "orientation"
+#define ICO_HS_SIZE_SB_HEIGHT        (64)
+#define ICO_HS_SIZE_LAYOUT_WIDTH     (768)
+#define ICO_HS_SIZE_LAYOUT_HEIGHT    (1024)
+
+/*============================================================================*/
+/* Define data types                                                          */
+/*============================================================================*/
+#define ICO_SB_TIME_AMPM_THRESHOLD (12)
+#define ICO_SB_TIME_AM        (10) /* f_name in sb_time_data */
+#define ICO_SB_TIME_PM        (11) /* f_name in sb_time_data */
+#define ICO_SB_TIME_IMG_PARTS (12) /* total counts of sb_time_data */
+#define ICO_SB_TIMEOUT        (0.2)
+
+#define ICO_SB_BUF_SIZE       (1024)
+#define ICO_SB_VERTICAL       (1)
+#define ICO_SB_HORIZONTAL     (2)
+
+#define ICO_SB_POS_Y          (0)
+#define ICO_SB_POS_COLON_X    (689)
+#define ICO_SB_POS_COLON_Y    (30 + ICO_SB_POS_Y)
+#define ICO_SB_POS_AMPM_X     (582)
+#define ICO_SB_POS_AMPM_Y     (27 + ICO_SB_POS_Y)
+#define ICO_SB_POS_HOUR1_X    (640)
+#define ICO_SB_POS_HOUR1_Y    (18 + ICO_SB_POS_Y)
+#define ICO_SB_POS_HOUR2_X    (662)
+#define ICO_SB_POS_HOUR2_Y    (18 + ICO_SB_POS_Y)
+#define ICO_SB_POS_MIN1_X     (703)
+#define ICO_SB_POS_MIN1_Y     (18 + ICO_SB_POS_Y)
+#define ICO_SB_POS_MIN2_X     (725)
+#define ICO_SB_POS_MIN2_Y     (18 + ICO_SB_POS_Y)
+
+#define ICO_SB_SIZE_SHTCT_W   (ICO_HS_SIZE_SB_HEIGHT)
+
+#define ICO_SB_POS_LIST_X     (ICO_HS_SIZE_SB_HEIGHT * 5)
+#define ICO_SB_POS_SHTCT1_X   (ICO_SB_POS_LIST_X + ICO_HS_SIZE_SB_HEIGHT + ICO_HS_SIZE_SB_HEIGHT * 2 / 2)
+#define ICO_SB_POS_SHTCT2_X   (ICO_SB_POS_SHTCT1_X + ICO_HS_SIZE_SB_HEIGHT + ICO_HS_SIZE_SB_HEIGHT * 1 / 2)
+
+#define ICO_SB_SIZE_COLON_W   (6)
+#define ICO_SB_SIZE_COLON_H   (17)
+#define ICO_SB_SIZE_NUM_W     (20)
+#define ICO_SB_SIZE_NUM_H     (30)
+#define ICO_SB_SIZE_AMPM_W    (47)
+#define ICO_SB_SIZE_AMPM_H    (27)
+
+#define ICO_SB_CHTCT_MAX      (5)
+
+#define ICO_SB_APPLIST_OFFICON "applist_off.png"
+#define ICO_SB_APPLIST_ONICON "applist_on.png"
+#define ICO_SB_HOME_OFFICON "home_off.png"
+#define ICO_SB_HOME_ONICON "home_on.png"
+
+/*============================================================================*/
+/* Class Declaration (CicoStatusBarControlWindow)                             */
+/*============================================================================*/
+class CicoStatusBarControlWindow
+{
+  public:
+    CicoStatusBarControlWindow();
+    ~CicoStatusBarControlWindow();
+
+    void Initialize(CicoHomeScreenConfig *homescreen_config_tmp);
+    void Finalize(void);
+    int CreateEcoreEvas(void);
+    static void StartEcoreLoop(void);
+    static void QuitEcoreLoop(Ecore_Evas *ee);
+    void ResizeWindow(int orientation);
+    void ShowWindow(void);
+    int InitEvas(void);
+    void ShowClock(void);
+    void ShowShortCut(void);
+    void ShowAppListIcon(void);
+    void ShowEscathion(void);
+    void EvasObjectImageFileSetAndShow(Evas_Object *obj,char *icon);
+    static void SetInstanceForClock(CicoStatusBarControlWindow *instance_tmp); 
+
+  private:
+    void ShowClockHour(struct tm *t_st);
+    void ShowClockMinutes(struct tm *t_st);
+    static Eina_Bool UpdateTime(void *thread_data);
+
+    CicoStatusBarTime *time_data[ICO_SB_TIME_IMG_PARTS];
+    static CicoStatusBarControlWindow *instance;
+    int width;
+    int moveH;
+    Ecore_Evas *window;
+    Evas *evas;
+    Eina_List *shtct_list;
+    Evas_Object *ampm;
+    Evas_Object *hour1;
+    Evas_Object *hour2;
+    Evas_Object *min1;
+    Evas_Object *min2;
+    char respath[ICO_SB_BUF_SIZE];
+    struct tm latest_time;
+    CicoHomeScreenConfig *homescreen_config;
+  protected:
+    CicoStatusBarControlWindow operator = (const CicoStatusBarControlWindow&);
+    CicoStatusBarControlWindow(const CicoStatusBarControlWindow&);
+};
+#endif
+
diff --git a/src/homescreen/CicoStatusBarTime.cpp b/src/homescreen/CicoStatusBarTime.cpp
new file mode 100644 (file)
index 0000000..697f473
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * 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   control time image for statusbar application
+ *
+ * @date    Feb-15-2013
+ */
+#include "CicoStatusBarTime.h"
+
+/*============================================================================*/
+/* Functions Declaration (CicoStatusBarTime)                          */
+/*============================================================================*/
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarTime::CicoStatusBarTime
+ *          constractor 
+ *
+ * @param[in]   none
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+CicoStatusBarTime::CicoStatusBarTime(const char *name)
+{
+    strcpy(fname,name);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarTime::SetTimeImg
+ *          set time image
+ *
+ * @param[in]   time_img_tmp    setting value
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoStatusBarTime::SetTimeImg(Evas_Object *time_img_tmp)
+{
+    time_img = time_img_tmp;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarTime::GetTimeImg
+ *          get time image 
+ *
+ * @param[in]   none
+ * @return      time image(Evas_Object)
+ */
+/*--------------------------------------------------------------------------*/
+Evas_Object *
+CicoStatusBarTime::GetTimeImg(void)
+{
+    return time_img;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   CicoStatusBarTime::GetFileName
+ *          get file name
+ *
+ * @param[in]   none
+ * @return      filename
+ */
+/*--------------------------------------------------------------------------*/
+char *
+CicoStatusBarTime::GetFileName(void)
+{
+    return fname;
+}
+
diff --git a/src/homescreen/CicoStatusBarTime.h b/src/homescreen/CicoStatusBarTime.h
new file mode 100644 (file)
index 0000000..c6140f5
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef __CICOSTATUSBARTIME_H__
+#define __CICOSTATUSBARTIME_H__
+/*
+ * 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   statusbar application
+ *
+ * @date    Feb-15-2013
+ */
+#include <stdio.h>
+#include <time.h>
+
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#include <Ecore_Evas.h>
+
+#include <ico_uws.h>
+
+/*============================================================================*/
+/* Define data types                                                          */
+/*============================================================================*/
+#define ICO_SB_IMAGE_FILE_PATH_LENGTH (64)
+
+/*============================================================================*/
+/* Class Declaration (CicoStatusBarTime)                                      */
+/*============================================================================*/
+class CicoStatusBarTime
+{
+  public:
+    CicoStatusBarTime(const char *name);
+    void SetTimeImg(Evas_Object *time_img_tmp);
+    Evas_Object * GetTimeImg(void);
+    char *GetFileName(void);
+  private:
+    char fname[ICO_SB_IMAGE_FILE_PATH_LENGTH];
+    Evas_Object *time_img;
+  protected:
+    CicoStatusBarTime operator = (const CicoStatusBarTime&);
+    CicoStatusBarTime(const CicoStatusBarTime&);
+};
+
+#endif
+
diff --git a/src/homescreen/Makefile.am b/src/homescreen/Makefile.am
new file mode 100644 (file)
index 0000000..15a2700
--- /dev/null
@@ -0,0 +1,119 @@
+AM_CFLAGS = $(GCC_CFLAGS)
+AM_CPPFLAGS = $(GCC_CXXFLAGS)
+AM_CXXFLAGS = $(GCC_CXXFLAGS)
+
+COMMON_LIBS = -lm -lwebsockets -lico-uxf-weston-plugin
+
+noinst_PROGRAMS   = \
+       HomeScreen      \
+       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      \
+       CicoHomeScreenResourceConfig.cpp        \
+       CicoHomeScreenSound.cpp \
+    CicoHomeScreenSoundConfig.cpp
+HomeScreen_CFLAGS= \
+    $(EFL_CFLAGS) \
+    $(OPT_CFLAGS) \
+    $(WL_CFLAGS) \
+    $(AUL_CFLAGS) \
+    $(AIL_CFLAGS) \
+    $(UWS_CFLAGS) \
+    $(PKGMGR_CFLAGS) \
+    -I/usr/include/ico-uxf-weston-plugin \
+    -I/usr/include/ico-util
+HomeScreen_CXXFLAGS= \
+    $(EFL_CFLAGS) \
+    $(OPT_CFLAGS) \
+    $(WL_CFLAGS) \
+    $(AUL_CFLAGS) \
+    $(AIL_CFLAGS) \
+    $(UWS_CFLAGS) \
+    $(PKGMGR_CFLAGS) \
+    -I/usr/include/ico-uxf-weston-plugin \
+    -I/usr/include/ico-util \
+    -I../../include
+HomeScreen_LDADD = \
+    $(EFL_LIBS) \
+    $(OPT_LIBS) \
+    $(WL_LIBS) \
+    $(COMMON_LIBS) \
+    $(UWS_LIBS) \
+    $(AUL_LIBS) \
+    $(AIL_LIBS) \
+    -lico-util-com \
+    -lico-uxf-weston-plugin \
+    /usr/lib/libpkgmgr-client.so \
+       ../../lib/apps-framework/.libs/libico-appfw.so
+
+#OnScreen_SOURCES = \
+#      on_screen.cpp        \
+#    CicoOnScreenAction.cpp  \
+#    CicoOnScreenAppList.cpp  \
+#    CicoOnScreenControlWindow.cpp  \
+#    CicoOnScreenContext.cpp  \
+#      CicoHomeScreenConfig.cpp        \
+#      CicoHomeScreenResourceConfig.cpp        \
+#      CicoHomeScreenSound.cpp \
+#        CicoHomeScreenSoundConfig.cpp
+#OnScreen_CXXFLAGS = -I../include $(EFL_CFLAGS) $(OPT_CFLAGS) $(WL_CFLAGS) $(AUL_CFLAGS) $(UWS_CFLAGS) -I/usr/include/ico-util
+#OnScreen_LDADD = $(EFL_LIBS) $(OPT_LIBS) $(WL_LIBS) $(COMMON_LIBS) $(AUL_LIBS) $(UWS_LIBS) ../apps_controller/libico_syc-apc.a ../ico-app-framework/.libs/libico-app-fw-efl.so ../ico-app-framework/.libs/libico-app-fw.so
+
+StatusBar_SOURCES = \
+       status_bar.cpp  \
+           ico_log.c        \
+        CicoStatusBarControlWindow.cpp \
+        CicoStatusBarTime.cpp \
+       CicoHomeScreenConfig.cpp        \
+       CicoHomeScreenResourceConfig.cpp        \
+       CicoHomeScreenSound.cpp \
+        CicoHomeScreenSoundConfig.cpp
+StatusBar_CFLAGS = \
+            $(EFL_CFLAGS) \
+            $(OPT_CFLAGS) \
+            $(WL_CFLAGS) \
+            $(AUL_CFLAGS) \
+            $(UWS_CFLAGS) 
+StatusBar_CXXFLAGS = \
+            $(EFL_CFLAGS) \
+            $(OPT_CFLAGS) \
+            $(WL_CFLAGS) \
+            $(AUL_CFLAGS) \
+            $(UWS_CFLAGS) 
+StatusBar_LDADD = \
+            $(EFL_LIBS) \
+            $(OPT_LIBS) \
+            $(WL_LIBS) \
+            $(COMMON_LIBS) \
+            $(AUL_LIBS) \
+            $(UWS_LIBS) 
+
+SUFFIXES = .edc .edj
+
+BUILT_SOURCES = \
+       home_screen_bg.edj      \
+       home_screen_touch.edj   \
+       appli_list.edj  \
+       appli_kill.edj
+
+.edc.edj:  
+       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)
diff --git a/src/homescreen/home_screen_main.cpp b/src/homescreen/home_screen_main.cpp
new file mode 100644 (file)
index 0000000..4225ca5
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * 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 main
+ *
+ * @date    Feb-15-2013
+ */
+
+
+#include <home_screen_main.h>
+#include "CicoHomeScreenConfig.h"
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   main
+ *          homescreen main. initialize UXF, app manager, and ecore.
+ *
+ * @param[in]   argc                counts of argment
+ * @param[in]   argv                argment
+ * @return      result
+ * @retval      >=0                 success
+ * @retval      -1                  error
+ */
+/*--------------------------------------------------------------------------*/
+int
+main(int argc, char *argv[])
+{
+    int ret;
+
+    eina_init();
+    eina_log_level_set(EINA_LOG_LEVEL_DBG);
+
+    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");
+    
+    /* init home screen soud */
+    ICO_DBG("main: sound initialize start");
+    CicoHomeScreenSound *sound = new CicoHomeScreenSound();
+    sound->Initialize(config);
+    ICO_DBG("main: sound initialize end");
+    
+    /*create homescreen*/
+    ICO_DBG("main: homescreen initialize start");
+    CicoHomeScreen *home_screen = new CicoHomeScreen();
+    
+    ret = home_screen->Initialize(ICO_ORIENTATION_VERTICAL,config);
+    if(ret != ICO_OK){
+        ICO_ERR("main: homescreen initialize failed");
+        /*clear all classes*/
+        delete home_screen;   
+        delete sound;   
+        delete config;
+        exit(8);
+    }
+    ICO_DBG("main: homescreen initialize end");
+
+    ICO_DBG("main: create homescreen ");
+    
+    /*home screen start and go into main loop*/
+    home_screen->StartHomeScreen();
+  
+    ICO_DBG("main: end homescreen");
+    
+    /* when loop is terminated */
+    /* delete homescreen */
+    home_screen->Finalize();
+    /*clear all classes*/
+    delete home_screen;   
+
+    delete sound;   
+
+    delete config;
+
+    return 0;
+}
diff --git a/src/homescreen/home_screen_main.h b/src/homescreen/home_screen_main.h
new file mode 100644 (file)
index 0000000..a7817d0
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef __HOME_SCREEN_MAIN_H__
+#define __HOME_SCREEN_MAIN_H__
+/*
+ * 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 main
+ *
+ * @date    Feb-15-2013
+ */
+
+#include <stdio.h>
+#include <pthread.h>
+#include <libwebsockets.h>
+
+#include "CicoHomeScreen.h"
+#include "CicoHomeScreenConfig.h"
+#include "CicoHomeScreenSound.h"
+
+#endif
+
diff --git a/src/homescreen/ico_log.c b/src/homescreen/ico_log.c
new file mode 100644 (file)
index 0000000..fad8324
--- /dev/null
@@ -0,0 +1,241 @@
+/*
+ * 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
new file mode 100644 (file)
index 0000000..3b5e224
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * 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/src/homescreen/on_screen.cpp b/src/homescreen/on_screen.cpp
new file mode 100644 (file)
index 0000000..d0ab5a5
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * 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   onscreen application
+ *
+ * @date    Feb-15-2013
+ */
+#include "on_screen.h"
+
+/*--------------------------------------------------------------------------*/
+/*
+ * @brief   onscreen application
+ *          main routine
+ *
+ * @param   main() finction's standard parameter (argc,argv)
+ * @return  result
+ * @retval  0       success
+ * @retval  1       failed
+ */
+/*--------------------------------------------------------------------------*/
+int
+main(int argc, char *argv[])
+{
+    int ret;
+    bundle *b;
+    const char *val;
+//    int orientation = ICO_ONS_HORIZONTAL;
+    int orientation = ICO_ONS_VERTICAL;
+
+    /* log setting */
+    if (getenv("PKG_NAME")) {
+        ico_uxf_log_open(getenv("PKG_NAME"));
+    }
+    else {
+        ico_uxf_log_open(ICO_HS_APPID_DEFAULT_ONS);
+    }
+
+    /* get argment */
+    /* setting horizontal or vartical */
+    b = bundle_import_from_argv(argc, argv);
+    val = bundle_get_val(b, "orientation");
+    if (val != NULL) {
+        if (strcmp(val, "vertical") == 0) {
+            orientation = ICO_ONS_VERTICAL;
+        }
+        else if (strcmp(val, "horizontal") == 0) {
+            orientation = ICO_ONS_HORIZONTAL;
+        }
+    }
+
+    /*HomeScreenConfig*/
+    CicoHomeScreenConfig *homescreen_config = new CicoHomeScreenConfig();
+    homescreen_config->Initialize(ICO_ONSCREEN_CONFIG_FILE);
+
+    /* init home screen soud */
+    CicoHomeScreenSound *sound = new CicoHomeScreenSound();
+    sound->Initialize(homescreen_config);
+
+    /* controlWindow instance */
+    CicoOnScreenControlWindow* control_window = new CicoOnScreenControlWindow();
+
+    /* initialize app list*/ 
+    CicoOnScreenAppList::Initialize(control_window);
+
+    /* load configuration of applications*/
+    CicoOnScreenAppList::LoadConfig();
+
+    /* create new ecore_evas */
+    ret = control_window->CreateEcoreEvas();
+    if(ret < 0){
+        return 1;
+    }
+    /* resize window */
+    control_window->ResizeWindow(homescreen_config,orientation);
+
+    /* show the window */
+    control_window->ShowWindow();
+  
+    /* initialize CicoOnScreenAction */
+    CicoOnScreenAction::Initialize(homescreen_config,sound);
+    
+    /* add callback to app configuration */
+    CicoOnScreenAppList::SetConfigCallback();
+  
+    /* start ecore loop*/
+    control_window->StartEcoreLoop();
+  
+    /* finalize CicoOnScreenAction */
+    CicoOnScreenAction::Finalize();
+    
+    /* end ecore evas*/
+    delete control_window;
+
+    /*delete homescreen sound*/
+    delete sound;
+
+    /*delete homescreen config*/
+    delete homescreen_config;
+    
+    return 0;
+}
+
diff --git a/src/homescreen/on_screen.h b/src/homescreen/on_screen.h
new file mode 100644 (file)
index 0000000..3640be4
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef __ON_SCREEN_H_
+#define __ON_SCREEN_H_
+/*
+ * 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   onscreen application
+ *
+ * @date    Feb-15-2013
+ */
+#include <unistd.h>
+
+#include "ico_uxf.h"
+#include "ico_uxf_conf.h"
+#include "ico_uxf_conf_ecore.h"
+
+#include "home_screen.h"
+#include "home_screen_res.h"
+#include "CicoHomeScreenConfig.h"
+#include "CicoHomeScreenSound.h"
+#include "CicoOnScreenControlWindow.h"
+#include "CicoOnScreenAppList.h"
+#include "CicoOnScreenAction.h"
+
+#include <bundle.h>
+
+#endif
+
diff --git a/src/homescreen/status_bar.cpp b/src/homescreen/status_bar.cpp
new file mode 100644 (file)
index 0000000..96655b7
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * 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   statusbar application
+ *
+ * @date    Feb-15-2013
+ */
+#include "status_bar.h"
+
+/*--------------------------------------------------------------------------*/
+/*
+ * @brief   status bar application
+ *          main routine
+ *
+ * @param   main() finction's standard parameter (argc,argv)
+ * @return  result
+ * @retval  0       success
+ * @retval  1       failed
+ */
+/*--------------------------------------------------------------------------*/
+int
+main(int argc, char *argv[])
+{
+    int orientation = ICO_SB_HORIZONTAL;
+    int ret;
+    bundle *b;
+    const char *val;
+
+    /* log setting */
+    if (getenv("PKG_NAME")) {
+        ico_log_open(getenv("PKG_NAME"));
+    }
+    else {
+        ico_log_open(ICO_HS_APPID_DEFAULT_SB);
+    }
+
+    /* get argment */
+    b = bundle_import_from_argv(argc, argv);
+    val = bundle_get_val(b, "orientation");
+    if (val != NULL) {
+        if (strcmp(val, "vertical") == 0) {
+            orientation = ICO_SB_VERTICAL;
+        }
+        else if (strcmp(val, "horizontal") == 0) {
+            orientation = ICO_SB_HORIZONTAL;
+        }
+    }
+
+    orientation = ICO_SB_VERTICAL;
+
+    /*HomeScreenConfig*/
+    CicoHomeScreenConfig *homescreen_config = new CicoHomeScreenConfig();
+    homescreen_config->Initialize(ICO_STATUSBAR_CONFIG_FILE);
+
+    /* init home screen soud */
+    CicoHomeScreenSound *sound = new CicoHomeScreenSound();
+    sound->Initialize(homescreen_config);
+
+    /* controlWindow instance */
+    CicoStatusBarControlWindow* control_window = 
+                                new CicoStatusBarControlWindow();
+    control_window->Initialize(homescreen_config);
+    CicoStatusBarControlWindow::SetInstanceForClock(control_window);
+
+    ret=control_window->CreateEcoreEvas();
+    if(ret < 0){
+        ICO_WRN("status_bar: error use ecore")
+        return -1;
+    }
+
+    /* resize window*/
+    control_window->ResizeWindow(orientation);  
+   
+    /* show window*/
+    control_window->ShowWindow();
+   
+    /* init evas*/
+    ret  = control_window->InitEvas();
+    if(ret < 0){
+        return -1;
+    }
+
+    /* status bar parts set*/
+    /* clock */
+    control_window->ShowClock();
+
+    /* Init websockets */
+    
+    /* Runs the application main loop */
+    control_window->StartEcoreLoop();
+  
+    /* initialize CicoStatusBarAction */
+    
+    /* delete control window*/
+    control_window->Finalize();
+    delete control_window;
+
+    /*delete homescreen sound*/
+    delete sound;
+
+    /*delete homescreen config*/
+    delete homescreen_config;
+    
+    return 0;
+}
+
diff --git a/src/homescreen/status_bar.h b/src/homescreen/status_bar.h
new file mode 100644 (file)
index 0000000..baad0b7
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef __STATUS_BAR_H__
+#define __STATUS_BAR_H__
+/*
+ * 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   statusbar application
+ *
+ * @date    Feb-15-2013
+ */
+#include <stdio.h>
+#include <time.h>
+#include <pthread.h>
+
+#include <bundle.h>
+
+
+#include "home_screen_res.h"
+#include "CicoLog.h"
+#include "CicoHomeScreenCommon.h"
+#include "CicoHomeScreenConfig.h"
+#include "CicoHomeScreenSound.h"
+#include "CicoStatusBarControlWindow.h"
+
+#endif
+
diff --git a/src/on_screen.c b/src/on_screen.c
deleted file mode 100644 (file)
index 9647c0f..0000000
+++ /dev/null
@@ -1,794 +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   onscreen application
- *
- * @date    Feb-15-2013
- */
-
-#include <unistd.h>
-#include <Eina.h>
-#include <Evas.h>
-#include <Ecore.h>
-#include <Ecore_Wayland.h>
-#include <Ecore_Evas.h>
-#include <Edje.h>
-
-#include "ico_uxf.h"
-#include "ico_uxf_conf.h"
-#include "ico_uxf_conf_ecore.h"
-
-#include "home_screen.h"
-#include "home_screen_res.h"
-#include "home_screen_conf.h"
-
-#include <ico_uws.h>
-
-#include <bundle.h>
-
-/*============================================================================*/
-/* Define data types                                                          */
-/*============================================================================*/
-#define ICO_ONS_WS_TIMEOUT 0.1
-#define ICO_ONS_WS_ADDRESS "127.0.0.1"
-#define ICO_ONS_WS_PROTOCOL_NAME ICO_HS_PROTOCOL_OS
-#define ICO_ONS_BUF_SIZE    (1024)
-#define ICO_ONS_APPLI_NUM    (15)        /* only for applist */
-
-#define ICO_ONS_VERTICAL    (1)
-#define ICO_ONS_HORIZONTAL  (2)
-
-#define ICO_ONS_CMD_WAIT    (1)
-#define ICO_ONS_NO_WAIT     (2)
-
-/*============================================================================*/
-/* static(internal) functions prototype                                       */
-/*============================================================================*/
-static void ons_callback_uws(const struct ico_uws_context *context,
-                const ico_uws_evt_e event, const void *id,
-                const ico_uws_detail *detail, void *data);
-static int ons_loadinons_edje_file(const char *edje_file);
-static void ons_event_message(char *format, ...);
-static char *ons_edje_parse_str(void *in, int arg_num);
-static void ons_create_context(void);
-static Eina_Bool ons_ecore_event(void *data);
-static void ons_on_destroy(Ecore_Evas *ee);
-static void ons_touch_up_edje(void *data, Evas *evas,
-                              Evas_Object *obj, void *event_info);
-static void ons_touch_up_next(void *data, Evas *evas, Evas_Object *obj,
-                              void *event_info);
-static const char *ons_get_fname(const char *filepath);
-static int ons_get_appindex(int idx);
-static void ons_set_appicon(Evas *evas, Evas_Object *edje, Evas_Object* part,
-                            const char *partname);
-static void ons_load_config(void);
-static void ons_config_event(const char *appid, int type);
-
-/*============================================================================*/
-/* variabe & table                                                            */
-/*============================================================================*/
-static int ons_ws_port = ICO_HS_WS_PORT;
-static int ons_ws_connected = 0;
-static struct ico_uws_context *ons_uws_context = NULL;
-static void *ons_uws_id = NULL;
-static char ons_edje_str[ICO_ONS_BUF_SIZE];
-
-static Ecore_Evas *ons_window; /* ecore-evas object */
-static Evas *ons_evas = NULL; /* evas object */
-static Evas_Object *ons_edje = NULL; /* loaded edje objects */
-static Eina_List *ons_img_list = NULL;
-static int ons_width, ons_height;
-static int ons_applist_idx = 0; /* only for applist, it's index */
-static int ons_app_cnt = 0; /* only for applist. a number of app to listed */
-
-static int ons_wait_reply = ICO_ONS_NO_WAIT;
-
-/*============================================================================*/
-/* functions                                                                  */
-/*============================================================================*/
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ons_event_message
- *          send message
- *
- * @param[in]   wsi                 libwebsockets management table to send
- * @param[in]   fromat              message to send
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ons_event_message(char *format, ...)
-{
-    va_list list;
-    unsigned char message[ICO_HS_TEMP_BUF_SIZE];
-
-    va_start(list, format);
-    vsnprintf((char *)message, sizeof(message), format, list);
-    va_end(list);
-
-    uifw_trace("OnScreen: ons_event_message %s", message);
-
-    ico_uws_send(ons_uws_context, ons_uws_id, message, strlen((char *)message));
-
-    return;
-}
-
-static char *
-ons_edje_parse_str(void *in, int arg_num)
-{
-    int i;
-    char *data;
-
-    uifw_trace("ons_edje_parse_str %s, arg = %d", in, arg_num);
-    data = strtok(in, " ");
-    /* arg_num : 0 to n */
-    for (i = 0; i < arg_num; i++) {
-        data = strtok(NULL, " ");
-    }
-    uifw_trace("ons_edje_parse_str data: %s", data);
-    return data;
-}
-
-/*--------------------------------------------------------------------------*/
-/*
- * @brief   ons_callback_uws
- *          callback function from UWS
- *
- * @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
- */
-/*--------------------------------------------------------------------------*/
-static void
-ons_callback_uws(const struct ico_uws_context *context,
-                const ico_uws_evt_e event, const void *id,
-                const ico_uws_detail *detail, void *data)
-{
-    uifw_trace("ons_callback_uws %p", context);
-    char *in;
-
-    switch (event) {
-    case ICO_UWS_EVT_OPEN:
-        uifw_trace("ons_callback_uws: ICO_UWS_EVT_OPEN(id=%d)", (int)id);
-        ons_uws_id = (void *)id;
-        ons_event_message("%s ANS HELLO", ICO_HS_MSG_HEAD_OS);
-        break;
-
-    case ICO_UWS_EVT_CLOSE:
-        uifw_trace("ons_callback_uws: ICO_UWS_EVT_CLOSE(id=%d)", (int)id);
-        ons_uws_context = NULL;
-        ons_ws_connected = 0;
-        ons_uws_id = NULL;
-        break;
-
-    case ICO_UWS_EVT_RECEIVE:
-        uifw_trace("ons_callback_uws: ICO_UWS_EVT_RECEIVE(id=%d, msg=%s, len=%d)",
-                   (int)id, (char *)detail->_ico_uws_message.recv_data,
-                   detail->_ico_uws_message.recv_len);
-        in = (char *)detail->_ico_uws_message.recv_data;
-
-        if (strlen(in) == 0)
-            break;
-        ons_wait_reply = ICO_ONS_NO_WAIT;
-        /* onscreen activate request */
-        if (strncmp("OPEN", in, 4) == 0) {
-            uifw_trace("%s", in);
-            strncpy(ons_edje_str, ons_edje_parse_str(in, 1), sizeof(ons_edje_str));
-            uifw_trace("ons_loadinons_edje_file: %s", &ons_edje_str[0]);
-            if (ons_loadinons_edje_file(&ons_edje_str[0]) == 0) {
-                ons_event_message("%s RESULT SUCCESS", ICO_HS_MSG_HEAD_OS);
-            }
-            else {
-                ons_event_message("%s RESULT FAILED", ICO_HS_MSG_HEAD_OS);
-            }
-        }
-        break;
-
-    case ICO_UWS_EVT_ERROR:
-        uifw_trace("ons_callback_uws: ICO_UWS_EVT_ERROR(id=%d, err=%d)",
-                   (int)id, detail->_ico_uws_error.code);
-        break;
-
-    case ICO_UWS_EVT_ADD_FD:
-        uifw_trace("ons_callback_uws: ICO_UWS_EVT_ADD_FD(id=%d, fd=%d)",
-                   (int)id, detail->_ico_uws_fd.fd);
-        break;
-
-    case ICO_UWS_EVT_DEL_FD:
-        uifw_trace("ons_callback_uws: ICO_UWS_EVT_DEL_FD(id=%d, fd=%d)",
-                   (int)id, detail->_ico_uws_fd.fd);
-        break;
-
-    default:
-        break;
-    }
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ons_create_context
- *          connect to the homescreen using websocket.
- *
- * @param[in]   none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ons_create_context(void)
-{
-    int ret;
-    char uri[ICO_HS_TEMP_BUF_SIZE];
-
-    /* set up URI "ws://HOST:PORT" */
-    sprintf(uri, "ws://%s:%d", ICO_HS_WS_HOST, ons_ws_port);
-
-    /* create context */
-    ons_uws_context = ico_uws_create_context(uri, ICO_HS_PROTOCOL);
-    uifw_trace("ons_create_context: ctx = %p", ons_uws_context);
-
-    ons_ws_connected = 0;
-    if (ons_uws_context == NULL) {
-        uifw_trace("ons_create_context: libwebsocket_create_context failed.");
-    }
-    else {
-        /* set callback */
-        ret = ico_uws_set_event_cb(ons_uws_context, ons_callback_uws, NULL);
-        if (ret != ICO_UWS_ERR_NONE) {
-            uifw_trace("ons_create_context: cannnot set callback");
-        }
-        ons_ws_connected = 1;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ons_ecore_event
- *          timer handler called by Ecore.
- *
- * @param[in]   data                user data
- * @return      call back setting
- * @retval      ECORE_CALLBACK_RENEW    set callback
- */
-/*--------------------------------------------------------------------------*/
-static Eina_Bool
-ons_ecore_event(void *data)
-{
-    if (ons_ws_connected) {
-        ico_uws_service(ons_uws_context);
-    }
-    else {
-        if (ons_uws_context != NULL) {
-            ico_uws_close(ons_uws_context);
-            ons_uws_context = NULL;
-        }
-        ons_create_context();
-    }
-
-    return ECORE_CALLBACK_RENEW;
-}
-
-/*--------------------------------------------------------------------------*/
-/*
- * @brief   ons_on_destroy
- *          callback function called by EFL when ecore destroyed.
- *          exit ecore main loop.
- *
- * @param[in]   ee                  ecore evas object
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ons_on_destroy(Ecore_Evas *ee)
-{
-    uifw_trace("ons_on_destroy: Enter");
-
-    ecore_main_loop_quit();
-    ico_uws_close(ons_uws_context);
-    edje_shutdown();
-}
-
-static void
-ons_touch_up_edje(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
-    if (ons_wait_reply == ICO_ONS_CMD_WAIT) return;
-    ons_wait_reply = ICO_ONS_CMD_WAIT;
-
-    /* get name from userdata */
-    if (data != NULL) {
-        uifw_trace("OnScreen: user data is %s", (const char *)data);
-    }
-    else {
-        uifw_trace("OnScreen: user data is NULL");
-    }
-    ons_event_message("%s TOUCH %s %s", ICO_HS_MSG_HEAD_OS, ons_edje_str, data);
-
-    /* operation sound */
-    hs_snd_play(hs_snd_get_filename(ICO_HS_SND_TYPE_DEFAULT));
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ons_touch_up_next
- *          processing when next button touch up.
- *
- * @param[in]   data                user data
- * @param[in]   obj                 evas object of the button
- * @param[in]   event_info          evas event infomation
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ons_touch_up_next(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
-    int listcnt;
-
-    if (ons_wait_reply == ICO_ONS_CMD_WAIT) return;
-    ons_wait_reply = ICO_ONS_CMD_WAIT;
-
-    if (ons_app_cnt > 0) {
-        listcnt = ((ons_app_cnt - 1) / ICO_ONS_APPLI_NUM) + 1;
-    }
-    else {
-        listcnt = 1;
-    }
-    ons_applist_idx += 1;
-    if (ons_applist_idx >= listcnt) {
-        ons_applist_idx = 0;
-    }
-
-    /* get name from userdata */
-    if (data != NULL) {
-        uifw_trace("OnScreen: user data is %s", (const char *)data);
-    }
-    else {
-        uifw_trace("OnScreen: user data is NULL");
-    }
-    ons_event_message("%s TOUCH %s %s", ICO_HS_MSG_HEAD_OS, ons_edje_str, data);
-
-    /* operation sound */
-    hs_snd_play(hs_snd_get_filename(ICO_HS_SND_TYPE_DEFAULT));
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ons_get_fname
- *          get filename from the full path
- *
- * @param[in]   filepath            file path
- * @return      filename
- */
-/*--------------------------------------------------------------------------*/
-static const char *
-ons_get_fname(const char *filepath)
-{
-    int ii;
-    const char *name = filepath;
-
-    for (ii = 0; ii < ICO_ONS_BUF_SIZE - 1; ii++) {
-        if (filepath[ii] == 0)
-            break;
-        if (filepath[ii] == '/')
-            name = &filepath[ii + 1];
-    }
-
-    return name;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ons_get_appindex
- *          return a application index that to be set indicated index.
- *
- * @param[in]   filepath            file path
- * @return      filename
- */
-/*--------------------------------------------------------------------------*/
-static int
-ons_get_appindex(int idx)
-{
-    int ii;
-    int appidx = idx + ons_applist_idx * ICO_ONS_APPLI_NUM + 1;
-    int cnt = 0;
-    Ico_Uxf_App_Config *appconf = (Ico_Uxf_App_Config *)ico_uxf_getAppConfig();
-
-    uifw_trace("ons_get_appindex: idx=%d appidx=%d appcnt=%d", idx, appidx, ons_app_cnt);
-
-    for (ii = 0; ii < appconf->applicationNum; ii++) {
-        if ((! appconf->application[ii].noicon) &&
-            (strcmp(appconf->application[ii].type, ICO_HS_GROUP_SPECIAL) != 0)) {
-            cnt++;
-        }
-        if (cnt == appidx) {
-            return ii;
-        }
-    }
-
-    return -1;
-}
-
-/* set App Icon on rect */
-static void
-ons_set_appicon(Evas *evas, Evas_Object *edje, Evas_Object* part,
-                const char *partname)
-{
-    int x, y, w, h;
-    int idx; /* rect index */
-    int appidx; /* appli index */
-    char imgfile[ICO_ONS_BUF_SIZE];
-    Ico_Uxf_App_Config *appconf;
-    Evas_Object *img = NULL;
-
-    memset(imgfile, 0, sizeof(imgfile));
-    /* check name, if part is rect/next_bt/cancel_bt */
-    if (strncmp(partname, ICO_HS_ONS_PART_RECT_NAME,
-                sizeof(ICO_HS_ONS_PART_RECT_NAME) - 1) == 0) {
-        img = evas_object_image_filled_add(ons_evas);
-        /* get rect index from partname(rect_01, rect_02, ...) */
-        sscanf(partname, ICO_HS_ONS_PART_RECT_NAME"%d", &idx);
-        idx -= 1;
-
-        appconf = (Ico_Uxf_App_Config *)ico_uxf_getAppConfig();
-
-        appidx = ons_get_appindex(idx);
-        uifw_trace("ons_set_appicon: idx=%d appidx=%d", idx, appidx);
-        if ((appidx < 0) || (appidx > appconf->applicationNum)) {
-            evas_object_del(img);
-            return;
-        }
-
-        /* set icon file name */
-        snprintf(imgfile, ICO_ONS_BUF_SIZE, "%s",
-                 appconf->application[appidx].icon_key_name);
-        uifw_trace("ons_set_appicon: set image = %s(%d/%d), app=%s, group=%s",
-                   imgfile, appidx, ons_app_cnt,
-                   appconf->application[appidx].appid,
-                   appconf->application[appidx].group);
-        /* set mouse call back function */
-        evas_object_event_callback_add(img, EVAS_CALLBACK_MOUSE_UP,
-                                       ons_touch_up_edje,
-                                       appconf->application[appidx].appid);
-    }
-    else if (strcmp(partname, ICO_HS_ONS_PART_NEXT_NAME) == 0) {
-        evas_object_event_callback_add(part, EVAS_CALLBACK_MOUSE_UP,
-                                       ons_touch_up_next, partname);
-    }
-    else if (strcmp(partname, ICO_HS_ONS_PART_CANCEL_NAME) == 0) {
-        evas_object_event_callback_add(part, EVAS_CALLBACK_MOUSE_UP,
-                                       ons_touch_up_edje, partname);
-    }
-    else {
-        return;
-    }
-
-    if (strlen(imgfile) > 0) {
-        /* calculation icon pos */
-        edje_object_part_geometry_get(ons_edje, partname, &x, &y, &w, &h);
-        x += (ons_width - ICO_HS_SIZE_LAYOUT_WIDTH) / 2;
-        y += (ons_height - ICO_HS_SIZE_LAYOUT_HEIGHT) / 2;
-
-        evas_object_image_file_set(img, imgfile, NULL);
-        evas_object_move(img, x, y);
-        evas_object_resize(img, w, h);
-        evas_object_show(img);
-    }
-
-    ons_img_list = eina_list_append(ons_img_list, img);
-}
-
-static int
-ons_loadinons_edje_file(const char *edje_file)
-{
-    Evas_Object *part; /* part handle */
-    Eina_List *group; /* edje group list */
-    Eina_List *list; /* part list in edje */
-    int group_count = 0; /* group counter */
-    int name_count = 0; /* name counter */
-    int moveX, moveY; /* move list to center */
-    Eina_List *l, *l_next;
-    Evas_Object *data;
-    Evas_Object *canvas;
-
-    if (!ons_evas) {
-        ons_evas = ecore_evas_get(ons_window);
-        if (!ons_evas) {
-            uifw_trace("OnScreen: could not create evas.");
-            return -1;
-        }
-        /* set color */
-        canvas = evas_object_rectangle_add(ons_evas);
-        evas_object_color_set(canvas, 0, 0, 0, 191);
-        evas_object_move(canvas, 0, 0);
-        evas_object_resize(canvas, ons_width, ons_height);
-        evas_object_show(canvas);
-    }
-
-    /* delete pre image */
-    uifw_trace("OnScreen: img list is %08x", ons_img_list);
-    EINA_LIST_FOREACH_SAFE(ons_img_list, l, l_next, data) {
-        uifw_trace("OnScreen: del data is %08x", data);
-        evas_object_del(data);
-        ons_img_list = eina_list_remove_list(ons_img_list, l);
-    }
-
-    /* delete edje */
-    if (ons_edje) {
-        evas_object_del(ons_edje);
-    }
-
-    /* create and add object in canvas from edje */
-    ons_edje = edje_object_add(ons_evas);
-    if (!ons_edje) {
-        uifw_trace("OnScreen: could not create edje object!");
-        return -1;
-    }
-
-    uifw_trace("OnScreen: w=%d h=%d", ons_width, ons_height);
-
-    /* calc move */
-    moveX = (ons_width - ICO_HS_SIZE_LAYOUT_WIDTH) / 2;
-    moveY = (ons_height - ICO_HS_SIZE_LAYOUT_HEIGHT) / 2;
-
-    /* Put in the image */
-    evas_object_move(ons_edje, moveX, moveY);
-    /* Resize the image */
-    evas_object_resize(ons_edje, ons_width, ons_height);
-    /* Show the image */
-    evas_object_show(ons_edje);
-
-    /* get group list */
-    group = edje_file_collection_list(edje_file);
-    while (group != NULL) {
-        /* Set the edj file */
-        if (!edje_object_file_set(ons_edje, edje_file, (const char *)group->data)) {
-            int err = edje_object_load_error_get(ons_edje);
-            const char *errmsg = edje_load_error_str(err);
-            uifw_trace("OnScreen: could not load %s: %s", edje_file, errmsg);
-
-            edje_file_collection_list_free(group);
-            evas_object_del(ons_edje);
-            return -1;
-        }
-        uifw_trace("OnScreen: group[%d] data : %s", group_count,
-                   (const char *)group->data);
-
-        /* get list */
-        list = edje_object_access_part_list_get(ons_edje);
-        while (list != NULL) {
-            uifw_trace("OnScreen: list[%d] data : %s", name_count,
-                       (const char *)list->data);
-
-            /* set callback for part name */
-            part = (Evas_Object *)edje_object_part_object_get(ons_edje,
-                                                              (const char *)list->data);
-            if (part != NULL) {
-                uifw_trace("OnScreen: list[%d] name : %s", name_count,
-                           (const char *)list->data);
-
-                /* if not applist */
-                if (strncmp(ons_get_fname(edje_file), ICO_HS_ONS_APPLI_LIST_NAME,
-                            sizeof(ICO_HS_ONS_APPLI_LIST_NAME) - 1) != 0) {
-                    evas_object_event_callback_add(part,
-                                                   EVAS_CALLBACK_MOUSE_UP,
-                                                   ons_touch_up_edje, list->data);
-                }
-                /* if applist */
-                else {
-                    ons_set_appicon(ons_evas, ons_edje, part, (const char *)list->data);
-                }
-            }
-            else {
-                uifw_trace("OnScreen: list[%d] is NULL", name_count);
-            }
-            /* to next list */
-            list = list->next;
-            name_count++;
-        }
-        /* to next group */
-        group = group->next;
-        group_count++;
-    }
-    uifw_trace("OnScreen: group num is %d", group_count);
-    uifw_trace("OnScreen: name num is %d", name_count);
-
-    return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ons_load_config
- *          load/reload configuration.
- *
- * @param       none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ons_load_config(void)
-{
-    Ico_Uxf_App_Config *appconf;
-    int appcnt;
-    int appidx, idx, cnt;
-
-    uifw_trace("ons_load_config: Enter");
-
-    appconf = (Ico_Uxf_App_Config *)ico_uxf_getAppConfig();
-    appcnt = appconf->applicationNum;
-    for (appidx = 0; appidx < appconf->applicationNum; appidx++) {
-        if ((appconf->application[appidx].noicon) ||
-            (strcmp(appconf->application[appidx].type, ICO_HS_GROUP_SPECIAL) == 0)) {
-            appcnt--;
-            uifw_trace("ons_load_config: No Need appid=%s noicon=%d type=%s",
-                       appconf->application[appidx].appid,
-                       appconf->application[appidx].noicon,
-                       appconf->application[appidx].type);
-        }
-    }
-    cnt = 0;
-    for (idx = 0; idx < appcnt; idx++) {
-        appidx = ons_get_appindex(idx);
-        if (appidx > 0) {
-            uifw_trace("ons_load_config: appid=%s seat=%d idx=%d seatcnt=%d",
-                       appconf->application[appidx].appid, cnt
-                               / ICO_ONS_APPLI_NUM, idx - ICO_ONS_APPLI_NUM
-                               * (cnt / ICO_ONS_APPLI_NUM), ((appcnt - 1)
-                               / ICO_ONS_APPLI_NUM) + 1);
-            cnt++;
-        }
-    }
-
-    ons_app_cnt = appcnt;
-    ons_applist_idx = 0;
-
-    uifw_trace("ons_load_config: Leave(appcnt=%d)", appcnt);
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   ons_config_event
- *          This is a callback function called when the configurations
- *          is updata.
- *
- * @param[in]   appid               application id
- * @param[in]   type                event type(install/uninstall)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ons_config_event(const char *appid, int type)
-{
-    uifw_trace("ons_config_event: Enter(appid=%s, type=%d)", appid, type);
-
-    ons_load_config();
-
-    uifw_trace("ons_config_event: Leave");
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/*
- * @brief   onscreen application
- *          main routine
- *
- * @param   main() finction's standard parameter (argc,argv)
- * @return  result
- * @retval  0       success
- * @retval  1       failed
- */
-/*--------------------------------------------------------------------------*/
-int
-main(int argc, char *argv[])
-{
-    int width, height;
-    int orientation = -1;
-    int ret;
-    bundle *b;
-    const char *val;
-
-    /* configure */
-    if (getenv("PKG_NAME")) {
-        ico_uxf_log_open(getenv("PKG_NAME"));
-    }
-    else {
-        ico_uxf_log_open(ICO_HS_APPID_DEFAULT_ONS);
-    }
-
-    /* get argment */
-    b = bundle_import_from_argv(argc, argv);
-    val = bundle_get_val(b, "orientation");
-    if (val != NULL) {
-        if (strcmp(val, "vertical") == 0) {
-            orientation = ICO_ONS_VERTICAL;
-        }
-        else if (strcmp(val, "horizontal") == 0) {
-            orientation = ICO_ONS_HORIZONTAL;
-        }
-    }
-
-    /* load configuration */
-    ret = initHomeScreenConfig(ICO_ONSCREEN_CONFIG_FILE);
-    if (ret == ICO_HS_OK) {
-        ons_ws_port = hs_conf_get_integer(ICO_HS_CONFIG_ONSCREEN,
-                                         ICO_HS_CONFIG_WS_PORT,
-                                         ICO_HS_WS_PORT);
-        if (orientation < 0)    {
-            orientation = hs_conf_get_integer(ICO_HS_CONFIG_ONSCREEN,
-                                              ICO_HS_CONFIG_ORIENTAION,
-                                              -1);
-            if (orientation < 0)    {
-                Ico_Uxf_Sys_Config  *sysconf;
-                sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
-                if (sysconf->display[0].width >= sysconf->display[0].height)    {
-                    orientation = ICO_ONS_HORIZONTAL;
-                }
-                else    {
-                    orientation = ICO_ONS_VERTICAL;
-                }
-            }
-        }
-    }
-    ons_load_config();
-    hs_snd_init();
-
-    /* Reset a ecore_evas */
-    ecore_evas_init();
-
-    /* Initialize a edje */
-    edje_init();
-
-    /* Make a new ecore_evas */
-    ons_window = ecore_evas_new(NULL, 0, 0, 1, 1, "frame=0");
-
-    /* if not for a window, return NULL */
-    if (!ons_window) {
-        EINA_LOG_CRIT("OnScreen: could not create ons_window.");
-        return -1;
-    }
-    ecore_evas_callback_destroy_set(ons_window, ons_on_destroy);
-
-    /* resize window */
-    ecore_main_loop_iterate();
-    ecore_wl_screen_size_get(&width, &height);
-    if (orientation == ICO_ONS_VERTICAL) {
-        ons_width = width > height ? height : width;
-        ons_height = width > height ? width : height;
-    }
-    else {
-        ons_width = width < height ? height : width;
-        ons_height = width < height ? width : height;
-    }
-    ecore_evas_resize(ons_window, ons_width, ons_height);
-
-    /* Show the window */
-    /* evas_output_framespace_set(ecore_evas_get(ons_window), 0, 0, 0, 0);  */
-    ecore_evas_alpha_set(ons_window, EINA_TRUE);
-    ecore_evas_show(ons_window);
-
-    /* Init websockets */
-    ons_create_context();
-    ecore_timer_add(ICO_ONS_WS_TIMEOUT, ons_ecore_event, NULL);
-
-    /* add callback to app configuration */
-    ico_uxf_econf_setAppUpdateCb(ons_config_event);
-
-    /* Start main loop */
-    ecore_main_loop_begin();
-
-    /* end the ecore_evas */
-    ecore_evas_shutdown();
-
-    return 0;
-}
diff --git a/src/status_bar.c b/src/status_bar.c
deleted file mode 100644 (file)
index c35d57e..0000000
+++ /dev/null
@@ -1,899 +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   statusbar application
- *
- * @date    Feb-15-2013
- */
-
-#include <stdio.h>
-#include <time.h>
-#include <pthread.h>
-
-#include <bundle.h>
-
-#include <Ecore.h>
-#include <Ecore_Wayland.h>
-#include <Ecore_Evas.h>
-
-#include <ico_uws.h>
-
-#include "ico_uxf.h"
-#include "ico_uxf_conf.h"
-#include "ico_uxf_conf_ecore.h"
-
-#include "home_screen.h"
-#include "home_screen_res.h"
-#include "home_screen_conf.h"
-
-/*============================================================================*/
-/* Define data types                                                          */
-/*============================================================================*/
-#define ICO_SB_TIME_AM        (10) /* f_name in sb_time_data */
-#define ICO_SB_TIME_PM        (11) /* f_name in sb_time_data */
-#define ICO_SB_TIME_IMG_PARTS (12) /* total counts of sb_time_data */
-#define ICO_SB_TIMEOUT        (0.2)
-
-#define ICO_SB_WS_TIMEOUT     (0.05)
-#define ICO_SB_WS_ADDRESS     "127.0.0.1"
-#define ICO_SB_WS_PROTOCOL_NAME   ICO_HS_PROTOCOL_SB
-#define ICO_SB_BUF_SIZE       (1024)
-#define ICO_SB_VERTICAL       (1)
-#define ICO_SB_HORIZONTAL     (2)
-
-#define ICO_SB_POS_Y          (0)
-#define ICO_SB_POS_COLON_X    (689)
-#define ICO_SB_POS_COLON_Y    (30)
-#define ICO_SB_POS_AMPM_X     (582)
-#define ICO_SB_POS_AMPM_Y     (27)
-#define ICO_SB_POS_HOUR1_X    (640)
-#define ICO_SB_POS_HOUR1_Y    (18)
-#define ICO_SB_POS_HOUR2_X    (662)
-#define ICO_SB_POS_HOUR2_Y    (18)
-#define ICO_SB_POS_MIN1_X     (703)
-#define ICO_SB_POS_MIN1_Y     (18)
-#define ICO_SB_POS_MIN2_X     (725)
-#define ICO_SB_POS_MIN2_Y     (18)
-
-#define ICO_SB_SIZE_SHTCT_W   (ICO_HS_SIZE_SB_HEIGHT)
-
-#define ICO_SB_POS_LIST_X     (ICO_HS_SIZE_SB_HEIGHT * 1)
-#define ICO_SB_POS_SHTCT1_X   (ICO_SB_POS_LIST_X + ICO_HS_SIZE_SB_HEIGHT + ICO_HS_SIZE_SB_HEIGHT * 2 / 2)
-#define ICO_SB_POS_SHTCT2_X   (ICO_SB_POS_SHTCT1_X + ICO_HS_SIZE_SB_HEIGHT + ICO_HS_SIZE_SB_HEIGHT * 1 / 2)
-
-#define ICO_SB_SIZE_COLON_W   (6)
-#define ICO_SB_SIZE_COLON_H   (17)
-#define ICO_SB_SIZE_NUM_W     (20)
-#define ICO_SB_SIZE_NUM_H     (30)
-#define ICO_SB_SIZE_AMPM_W    (47)
-#define ICO_SB_SIZE_AMPM_H    (27)
-
-#define ICO_SB_CHTCT_MAX      (5)
-
-#define ICO_SB_NO_WAIT        (1)
-#define ICO_SB_WAIT_REPLY     (2)
-
-#define ICO_SB_APPLIST_OFFICON "applist_off.png"
-#define ICO_SB_APPLIST_ONICON "applist_on.png"
-#define ICO_SB_HOME_OFFICON "home_off.png"
-#define ICO_SB_HOME_ONICON "home_on.png"
-
-/*============================================================================*/
-/* static(internal) functions prototype                                       */
-/*============================================================================*/
-static void sb_on_destroy(Ecore_Evas *ee);
-static void sb_callback_uws(const struct ico_uws_context *context,
-                            const ico_uws_evt_e event, const void *id,
-                            const ico_uws_detail *detail, void *data);
-static void sb_create_ws_context(void);
-static void sb_time_hour(struct tm *t_st);
-static void sb_time_min(struct tm *t_st);
-static Eina_Bool sb_time_show(void* thread_data);
-static void sb_touch_up_escathion(void *data, Evas *evas, Evas_Object *obj, void *event_info);
-static void sb_touch_down_escathion(void *data, Evas *evas, Evas_Object *obj, void *event_info);
-static void sb_touch_up_applist(void *data, Evas *evas, Evas_Object *obj, void *event_info);
-static void sb_touch_down_applist(void *data, Evas *evas, Evas_Object *obj, void *event_info);
-static void sb_clock_display_fixation(Evas *canvas);
-static void sb_touch_up_shortcut(void *data, Evas *evas, Evas_Object *obj, void *event_info);
-static void sb_config_event(const char *appid, int type);
-static void sb_add_shortcut(Evas *canvas);
-
-/*============================================================================*/
-/* variabe & table                                                            */
-/*============================================================================*/
-static Evas *sb_canvas;
-static Eina_List *sb_shtct_list = NULL;
-static int sb_wait_reply = ICO_SB_NO_WAIT;
-static int sb_ws_port = ICO_HS_WS_PORT;
-static int sb_ws_connected = 0;
-static struct ico_uws_context *sb_uws_context = NULL;
-static void *sb_uws_id = NULL;
-
-static int sb_width = 0;
-static char sb_respath[ICO_SB_BUF_SIZE];
-static struct tm sb_st_buf;
-static Evas_Object *sb_ampm;
-static Evas_Object *sb_hour1;
-static Evas_Object *sb_hour2;
-static Evas_Object *sb_min1;
-static Evas_Object *sb_min2;
-
-struct _sb_time_data {
-    char f_name[64];
-    Evas_Object *time_img;
-};
-
-struct _sb_time_data sb_time_data[ICO_SB_TIME_IMG_PARTS] = {
-       {fname_num0, }, {fname_num1, },
-       {fname_num2, }, {fname_num3, },
-       {fname_num4, }, {fname_num5, },
-       {fname_num6, }, {fname_num7, },
-       {fname_num8, }, {fname_num9, },
-       {fname_am, }, {fname_pm, }
-};
-
-/*============================================================================*/
-/* functions                                                                  */
-/*============================================================================*/
-/*--------------------------------------------------------------------------*/
-/*
- * @brief   sb_on_destroy
- *          callback function called by EFL when ecore destroyed.
- *          exit ecore main loop.
- *
- * @param[in]   ee                  ecore evas object
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-sb_on_destroy(Ecore_Evas *ee)
-{
-    /* Quits the main loop */
-    ecore_main_loop_quit();
-}
-
-/*--------------------------------------------------------------------------*/
-/*
- * @brief   sb_callback_uws
- *          callback function from UWS
- *
- * @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
- */
-/*--------------------------------------------------------------------------*/
-static void
-sb_callback_uws(const struct ico_uws_context *context,
-                const ico_uws_evt_e event, const void *id,
-                const ico_uws_detail *detail, void *data)
-{
-    uifw_trace("sb_callback_uws %p", context);
-    unsigned char msg[ICO_HS_TEMP_BUF_SIZE];
-    char *in;
-    int len;
-
-    switch (event) {
-    case ICO_UWS_EVT_OPEN:
-        uifw_trace("sb_callback_uws: ICO_UWS_EVT_OPEN(id=%d)", (int)id);
-        sb_uws_id = (void *)id;
-        len = sprintf((char *)msg, "%s %s", ICO_HS_MSG_HEAD_SB, "ANS HELLO");
-        ico_uws_send((struct ico_uws_context *)context, (void *)id, msg, len);
-        break;
-
-    case ICO_UWS_EVT_CLOSE:
-        uifw_trace("sb_callback_uws: ICO_UWS_EVT_CLOSE(id=%d)", (int)id);
-        sb_uws_context = NULL;
-        sb_ws_connected = 0;
-        sb_uws_id = NULL;
-        break;
-
-    case ICO_UWS_EVT_RECEIVE:
-        uifw_trace("sb_callback_uws: ICO_UWS_EVT_RECEIVE(id=%d, msg=%s, len=%d)",
-                   (int)id, (char *)detail->_ico_uws_message.recv_data,
-                   detail->_ico_uws_message.recv_len);
-        in = (char *)detail->_ico_uws_message.recv_data;
-        if (strncmp("RECEIVE OK", in, 10) == 0) {
-            sb_wait_reply = ICO_SB_NO_WAIT;
-        }
-        else {
-            len = sprintf((char *)msg, "%s ANS %s OK", ICO_HS_MSG_HEAD_SB, (char *)in);
-            ico_uws_send((struct ico_uws_context *)context, (void *)id, msg, len);
-        }
-        break;
-
-    case ICO_UWS_EVT_ERROR:
-        uifw_trace("sb_callback_uws: ICO_UWS_EVT_ERROR(id=%d, err=%d)",
-                   (int)id, detail->_ico_uws_error.code);
-        break;
-
-    case ICO_UWS_EVT_ADD_FD:
-        uifw_trace("sb_callback_uws: ICO_UWS_EVT_ADD_FD(id=%d, fd=%d)",
-                   (int)id, detail->_ico_uws_fd.fd);
-        break;
-
-    case ICO_UWS_EVT_DEL_FD:
-        uifw_trace("sb_callback_uws: ICO_UWS_EVT_DEL_FD(id=%d, fd=%d)",
-                   (int)id, detail->_ico_uws_fd.fd);
-        break;
-
-    default:
-        break;
-    }
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   sb_create_ws_context
- *          connect to the homescreen using websocket.
- *
- * @param[in]   none
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-sb_create_ws_context(void)
-{
-    int ret;
-    char uri[ICO_HS_TEMP_BUF_SIZE];
-
-    /* set up URI "ws://HOST:PORT" */
-    sprintf(uri, "ws://%s:%d", ICO_HS_WS_HOST, sb_ws_port);
-
-    /* create context */
-    sb_uws_context = ico_uws_create_context(uri, ICO_HS_PROTOCOL);
-    uifw_trace("sb_create_ws_context: ctx = %p", sb_uws_context);
-
-    sb_ws_connected = 0;
-    if (sb_uws_context == NULL) {
-        uifw_trace("sb_create_ws_context: libwebsocket_create_context failed.");
-    }
-    else {
-        /* set callback */
-        ret = ico_uws_set_event_cb(sb_uws_context, sb_callback_uws, NULL);
-        if (ret != ICO_UWS_ERR_NONE) {
-            uifw_trace("sb_create_ws_context: cannnot set callback");
-        }
-        sb_ws_connected = 1;
-    }
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   sb_ecore_event
- *          timer handler called by Ecore.
- *
- * @param[in]   data                user data
- * @return      call back setting
- * @retval      ECORE_CALLBACK_RENEW    set callback
- */
-/*--------------------------------------------------------------------------*/
-static Eina_Bool
-sb_ecore_event(void *data)
-{
-    if (sb_ws_connected) {
-        ico_uws_service(sb_uws_context);
-    }
-    else {
-        if (sb_uws_context != NULL) {
-            ico_uws_close(sb_uws_context);
-            sb_uws_context = NULL;
-        }
-        sb_create_ws_context();
-    }
-
-    return ECORE_CALLBACK_RENEW;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   sb_time_hour
- *          show the clock's hour image on statubar
- *
- * @param[in]   tm                  time data
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-sb_time_hour(struct tm *t_st)
-{
-    char file[ICO_SB_BUF_SIZE];
-    if (t_st->tm_hour < 12) {
-        sprintf(file, "%s%s", sb_respath, sb_time_data[ICO_SB_TIME_AM].f_name);
-        evas_object_image_file_set(sb_ampm, file, NULL);
-        sprintf(file, "%s%s", sb_respath,
-                sb_time_data[t_st->tm_hour / 10].f_name);
-        evas_object_image_file_set(sb_hour1, file, NULL);
-        sprintf(file, "%s%s", sb_respath,
-                sb_time_data[t_st->tm_hour % 10].f_name);
-        evas_object_image_file_set(sb_hour2, file, NULL);
-    }
-    else {
-        sprintf(file, "%s%s", sb_respath, sb_time_data[ICO_SB_TIME_PM].f_name);
-        evas_object_image_file_set(sb_ampm, file, NULL);
-        sprintf(file, "%s%s", sb_respath, sb_time_data[(t_st->tm_hour - 12)
-                / 10].f_name);
-        evas_object_image_file_set(sb_hour1, file, NULL);
-        sprintf(file, "%s%s", sb_respath, sb_time_data[(t_st->tm_hour - 12)
-                % 10].f_name);
-        evas_object_image_file_set(sb_hour2, file, NULL);
-    }
-
-    /*Makes the given Evas object visible*/
-    evas_object_show(sb_ampm);
-    evas_object_show(sb_hour1);
-    evas_object_show(sb_hour2);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   sb_time_hour
- *          show the clock's minite image on statubar
- *
- * @param[in]   tm                  time data
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-sb_time_min(struct tm *t_st)
-{
-    char file[ICO_SB_BUF_SIZE];
-    sprintf(file, "%s%s", sb_respath, sb_time_data[t_st->tm_min / 10].f_name);
-    evas_object_image_file_set(sb_min1, file, NULL);
-    sprintf(file, "%s%s", sb_respath, sb_time_data[t_st->tm_min % 10].f_name);
-    evas_object_image_file_set(sb_min2, file, NULL);
-
-    /*Makes the given Evas object visible*/
-    evas_object_show(sb_min1);
-    evas_object_show(sb_min2);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   sb_time_show
- *          callback function called by Ecore.
- *          get time data, and show the clock's image on statubar.
- *
- * @param[in]   thread_data         user data
- * @return      call back setting
- * @retval      ECORE_CALLBACK_RENEW    set callback
- */
-/*--------------------------------------------------------------------------*/
-static Eina_Bool
-sb_time_show(void *thread_data)
-{
-    time_t timer;
-    struct tm *t_st, *old_t_st;
-
-    old_t_st = &sb_st_buf;
-
-    /* get time */
-    time(&timer);
-    t_st = localtime(&timer);
-
-    if (old_t_st->tm_hour != t_st->tm_hour) {
-        /* hour file set */
-        sb_time_hour(t_st);
-    }
-    if (old_t_st->tm_min != t_st->tm_min) {
-        /* min file set */
-        sb_time_min(t_st);
-    }
-    memcpy(old_t_st, t_st, sizeof(struct tm));
-
-    return ECORE_CALLBACK_RENEW;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   sb_touch_up_shortcut
- *          processing when application button touch up.
- *
- * @param[in]   data                user data
- * @param[in]   evas                evas of the button
- * @param[in]   obj                 evas object of the button
- * @param[in]   event_info          evas event infomation
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-sb_touch_up_shortcut(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
-    unsigned char msg[ICO_HS_TEMP_BUF_SIZE];
-    int len;
-    char *appid = (char *)data;
-
-    uifw_trace("TOUCH UP: SHORTCUT %s", appid);
-
-    if (sb_wait_reply == ICO_SB_NO_WAIT) {
-        if ((sb_uws_id != NULL) && (appid != NULL)) {
-            len = sprintf((char *)msg, "%s SHOW %s %s", ICO_HS_MSG_HEAD_SB, appid, getenv("PKG_NAME"));
-            ico_uws_send(sb_uws_context, sb_uws_id, msg, len);
-            uifw_trace("SB: SHOW %s", appid);
-            sb_wait_reply = ICO_SB_WAIT_REPLY;
-        }
-        /* operation sound */
-        hs_snd_play(hs_snd_get_filename(ICO_HS_SND_TYPE_DEFAULT));
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   sb_touch_down_applist
- *          processing when application button touch down.
- *
- * @param[in]   data                user data
- * @param[in]   evas                evas of the button
- * @param[in]   obj                 evas object of the button
- * @param[in]   event_info          evas event infomation
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-sb_touch_down_applist(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
-    char img[ICO_HS_TEMP_BUF_SIZE];
-    char path[ICO_HS_TEMP_BUF_SIZE];
-
-    uifw_trace("TOUCH DOWN: APPLIST");
-
-    hs_get_image_path(path, sizeof(path));
-    sprintf(img, "%s"ICO_SB_APPLIST_ONICON, path);
-
-    evas_object_image_file_set(obj, img, NULL);
-    evas_object_show(obj);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   sb_touch_up_applist
- *          processing when application button touch up.
- *
- * @param[in]   data                user data
- * @param[in]   evas                evas of the button
- * @param[in]   obj                 evas object of the button
- * @param[in]   event_info          evas event infomation
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-sb_touch_up_applist(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
-    unsigned char msg[ICO_HS_TEMP_BUF_SIZE];
-    int len;
-    char path[ICO_HS_TEMP_BUF_SIZE];
-    char img[ICO_HS_TEMP_BUF_SIZE];
-
-    uifw_trace("TOUCH UP: APPLIST");
-
-    hs_get_image_path(path, sizeof(path));
-    sprintf(img, "%s"ICO_SB_APPLIST_OFFICON, path);
-
-    evas_object_image_file_set(obj, img, NULL);
-    evas_object_show(obj);
-
-    if (sb_wait_reply == ICO_SB_NO_WAIT) {
-        if (sb_uws_id != NULL) {
-            hs_get_ons_edj_path(path, sizeof(path));
-            len = sprintf((char *)msg, "%s OPEN %s%s %s", ICO_HS_MSG_HEAD_SB, path,
-                    ICO_HS_ONS_APPLI_LIST_NAME, getenv("PKG_NAME"));
-            ico_uws_send(sb_uws_context, sb_uws_id, msg, len);
-            uifw_trace("SB: CLICK APPLIST");
-            sb_wait_reply = ICO_SB_WAIT_REPLY;
-        }
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   sb_touch_down_escathion
- *          processing when escathion button touch down.
- *
- * @param[in]   data                user data
- * @param[in]   evas                evas of the button
- * @param[in]   obj                 evas object of the button
- * @param[in]   event_info          evas event infomation
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-sb_touch_down_escathion(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
-    char img[ICO_HS_TEMP_BUF_SIZE];
-    char path[ICO_HS_TEMP_BUF_SIZE];
-
-    uifw_trace("TOUCH DOWN: CHANGE");
-
-    hs_get_image_path(path, sizeof(path));
-    sprintf(img, "%s"ICO_SB_HOME_ONICON, path);
-
-    evas_object_image_file_set(obj, img, NULL);
-    evas_object_show(obj);
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   sb_touch_up_escathion
- *          processing when change button touch up.
- *
- * @param[in]   data                user data
- * @param[in]   evas                evas of the button
- * @param[in]   obj                 evas object of the button
- * @param[in]   event_info          evas event infomation
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-sb_touch_up_escathion(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
-    unsigned char msg[ICO_HS_TEMP_BUF_SIZE];
-    int len;
-    char path[ICO_HS_TEMP_BUF_SIZE];
-    char img[ICO_HS_TEMP_BUF_SIZE];
-
-    uifw_trace("TOUCH UP: CHANGE");
-
-    hs_get_image_path(path, sizeof(path));
-    sprintf(img, "%s"ICO_SB_HOME_OFFICON, path);
-
-    evas_object_image_file_set(obj, img, NULL);
-    evas_object_show(obj);
-
-    if (sb_wait_reply == ICO_SB_NO_WAIT) {
-        if (sb_uws_id != NULL) {
-            len = sprintf((char *)msg, "%s %s", ICO_HS_MSG_HEAD_SB, "CLICK ESCUTCHEON 1");
-            ico_uws_send(sb_uws_context, sb_uws_id, msg, len);
-            uifw_trace("SB: CLICK ESCUTCHEON 1");
-            sb_wait_reply = ICO_SB_WAIT_REPLY;
-        }
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   sb_clock_display_fixation
- *          set up fixed images on status bar
- *
- * @param[in]   canvas              evas to draw
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-sb_clock_display_fixation(Evas *canvas)
-{
-    Evas_Object *tile, *colon;
-    int moveH;
-    int escPosX;
-    char file[ICO_SB_BUF_SIZE];
-    char img[ICO_HS_TEMP_BUF_SIZE];
-    char path[ICO_HS_TEMP_BUF_SIZE];
-
-    moveH = sb_width - ICO_HS_SIZE_LAYOUT_WIDTH;
-    escPosX = sb_width / 2 - ICO_HS_SIZE_SB_HEIGHT / 2;
-
-    /* show escutcheon */
-    hs_get_image_path(path, sizeof(path));
-    sprintf(img, "%s"ICO_SB_HOME_OFFICON, path);
-    tile = evas_object_image_filled_add(canvas);
-    evas_object_image_file_set(tile, img, NULL);
-    evas_object_move(tile, escPosX, ICO_SB_POS_Y);
-    evas_object_resize(tile, ICO_HS_SIZE_SB_HEIGHT, ICO_HS_SIZE_SB_HEIGHT);
-    evas_object_event_callback_add(tile, EVAS_CALLBACK_MOUSE_UP,
-                                  sb_touch_up_escathion, NULL);
-    evas_object_event_callback_add(tile, EVAS_CALLBACK_MOUSE_DOWN,
-                                  sb_touch_down_escathion, NULL);
-    evas_object_show(tile);
-
-    /* show app list */
-    hs_get_image_path(path, sizeof(path));
-    sprintf(img, "%s"ICO_SB_APPLIST_OFFICON, path);
-    tile = evas_object_image_filled_add(canvas);
-    evas_object_image_file_set(tile, img, NULL);
-    evas_object_move(tile, ICO_SB_POS_LIST_X, ICO_SB_POS_Y);
-    evas_object_resize(tile, ICO_HS_SIZE_SB_HEIGHT * 3 / 2, ICO_HS_SIZE_SB_HEIGHT);
-    evas_object_event_callback_add(tile, EVAS_CALLBACK_MOUSE_UP,
-                                  sb_touch_up_applist, NULL);
-    evas_object_event_callback_add(tile, EVAS_CALLBACK_MOUSE_DOWN,
-                                  sb_touch_down_applist, NULL);
-    evas_object_show(tile);
-
-    /* shortcut bottun */
-    sb_add_shortcut(canvas);
-
-    /* show clock's colon */
-    /*Creates a new image object*/
-    colon = evas_object_image_filled_add(canvas);
-    /*Set the image file */
-    sprintf(file, "%s%s", sb_respath, fname_colon);
-    evas_object_image_file_set(colon, file, NULL);
-    /*This function will make layout change*/
-    evas_object_move(colon, moveH + ICO_SB_POS_COLON_X, ICO_SB_POS_COLON_Y);
-    /*This function will make size change of a picture*/
-    evas_object_resize(colon, ICO_SB_SIZE_COLON_W, ICO_SB_SIZE_COLON_H);
-    /*Makes the given Evas object visible*/
-    evas_object_show(colon);
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   sb_add_shortcut
- *          add shurtcut bottun
- *
- * @param[in]   canvas              evas to draw
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-sb_add_shortcut(Evas *canvas)
-{
-    Evas_Object *tile;
-    int escPosX;
-    int x, idx;
-    char config[ICO_UXF_MAX_PROCESS_NAME];
-    const char *appid;
-    const Ico_Uxf_conf_application *appconf;
-    Eina_List *l, *l_next;
-
-    escPosX = sb_width / 2 - ICO_HS_SIZE_SB_HEIGHT / 2;
-
-    /* delete shortcut */
-    EINA_LIST_FOREACH_SAFE(sb_shtct_list, l, l_next, tile) {
-        evas_object_del(tile);
-        sb_shtct_list = eina_list_remove_list(sb_shtct_list, l);
-    }
-
-    /* add shortcut */
-    for (idx = 0; idx < ICO_SB_CHTCT_MAX; idx++) {
-        sprintf(config, ICO_SB_CONFIG_SHTCT_APP"%d", idx);
-        x = ICO_SB_POS_SHTCT1_X + (ICO_SB_SIZE_SHTCT_W + ICO_HS_SIZE_SB_HEIGHT * 1 / 2) * idx;
-        if (x > escPosX) {
-            break;
-        }
-        appid = hs_conf_get_string(ICO_HS_CONFIG_STATUBAR, config, NULL);
-        if ((appid != NULL) && (strcmp(appid, "none") != 0)) {
-            appconf = ico_uxf_getAppByAppid(appid);
-            if (appconf) {
-                tile = evas_object_image_filled_add(canvas);
-                evas_object_image_file_set(tile,
-                        appconf->icon_key_name, NULL);
-                evas_object_move(tile, x, ICO_SB_POS_Y);
-                evas_object_resize(tile, ICO_HS_SIZE_SB_HEIGHT, ICO_HS_SIZE_SB_HEIGHT);
-                evas_object_event_callback_add(tile, EVAS_CALLBACK_MOUSE_UP,
-                                   sb_touch_up_shortcut, appid);
-                evas_object_show(tile);
-                sb_shtct_list = eina_list_append(sb_shtct_list, tile);
-            }
-        }
-    }
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief   sb_config_event
- *          This is a callback function called when the configurations
- *          is updata.
- *
- * @param[in]   appid               application id
- * @param[in]   type                event type(install/uninstall)
- * @return      none
- */
-/*--------------------------------------------------------------------------*/
-static void
-sb_config_event(const char *appid, int type)
-{
-    uifw_trace("sb_config_event: Enter(appid=%s, type=%d)", appid, type);
-
-    sb_add_shortcut(sb_canvas);
-
-    uifw_trace("sb_config_event: Leave");
-
-    return;
-}
-
-/*--------------------------------------------------------------------------*/
-/*
- * @brief   status bar application
- *          main routine
- *
- * @param   main() finction's standard parameter (argc,argv)
- * @return  result
- * @retval  0       success
- * @retval  1       failed
- */
-/*--------------------------------------------------------------------------*/
-int
-main(int argc, char *argv[])
-{
-    time_t timer;
-    struct tm *t_st;
-    Evas_Object *bg;
-    char file[ICO_SB_BUF_SIZE];
-    int width, height;
-    int moveH = 0;
-    int orientation = -1;
-    int ii;
-    int ret;
-    static Ecore_Evas *ee;
-    bundle *b;
-    const char *val;
-
-    /* configure */
-    hs_get_image_path(sb_respath, ICO_SB_BUF_SIZE);
-
-    /* configure */
-    if (getenv("PKG_NAME")) {
-        ico_uxf_log_open(getenv("PKG_NAME"));
-    }
-    else {
-        ico_uxf_log_open(ICO_HS_APPID_DEFAULT_SB);
-
-    }
-
-    /* get argment */
-    b = bundle_import_from_argv(argc, argv);
-    val = bundle_get_val(b, "orientation");
-    if (val != NULL) {
-        if (strcmp(val, "vertical") == 0) {
-            orientation = ICO_SB_VERTICAL;
-        }
-        else if (strcmp(val, "horizontal") == 0) {
-            orientation = ICO_SB_HORIZONTAL;
-        }
-    }
-
-    /* load configuration */
-    ret = initHomeScreenConfig(ICO_STATUSBAR_CONFIG_FILE);
-    if (ret == ICO_HS_OK) {
-        sb_ws_port = hs_conf_get_integer(ICO_HS_CONFIG_STATUBAR,
-                                         ICO_HS_CONFIG_WS_PORT,
-                                         ICO_HS_WS_PORT);
-        if (orientation <= 0)   {
-            orientation = hs_conf_get_integer(ICO_HS_CONFIG_STATUBAR,
-                                              ICO_HS_CONFIG_ORIENTAION,
-                                              -1);
-            if (orientation < 0)    {
-                Ico_Uxf_Sys_Config  *sysconf;
-    
-                sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
-                if (sysconf->display[0].width >= sysconf->display[0].height)    {
-                    orientation = ICO_SB_HORIZONTAL;
-                }
-                else    {
-                    orientation = ICO_SB_VERTICAL;
-                }
-            }
-        }
-    }
-    hs_snd_init();
-
-    /* Initialize a new system of Ecore_Evas */
-    ecore_evas_init();
-
-    /* Generate Ecore_Evas */
-    ee = ecore_evas_new(NULL, 0, 0, 1, 1, "frame=0");
-    if (!ee)
-        goto error;
-
-    ecore_main_loop_iterate();
-    ecore_wl_screen_size_get(&width, &height);
-
-    if (orientation == ICO_SB_VERTICAL) {
-        sb_width = width > height ? height : width;
-        moveH = sb_width - ICO_HS_SIZE_LAYOUT_WIDTH;
-    }
-    else {
-        sb_width = width < height ? height : width;
-        moveH = sb_width - ICO_HS_SIZE_LAYOUT_WIDTH;
-    }
-
-    /* Set the window size of the maximum and minimum */
-    ecore_evas_size_min_set(ee, sb_width, ICO_HS_SIZE_SB_HEIGHT);
-    ecore_evas_size_max_set(ee, sb_width, ICO_HS_SIZE_SB_HEIGHT);
-
-    /* Set a callback for Ecore_Evas delete request events */
-    ecore_evas_callback_delete_request_set(ee, sb_on_destroy);
-
-    /* Set the title of an Ecore_Evas window */
-    /* ecore_evas_title_set(ee, "Ecore_Evas buffer (image) example"); */
-
-    ecore_evas_move(ee, 0, 0);
-    ecore_evas_resize(ee, sb_width, ICO_HS_SIZE_SB_HEIGHT);
-    ecore_evas_show(ee);
-
-    /* Wrapper of Evas */
-    sb_canvas = ecore_evas_get(ee);
-
-    /* BG color set */
-    bg = evas_object_rectangle_add(sb_canvas);
-    evas_object_color_set(bg, 0, 0, 0, 255);
-    evas_object_move(bg, 0, 0);
-    evas_object_resize(bg, sb_width, ICO_HS_SIZE_SB_HEIGHT);
-    evas_object_show(bg);
-
-    /* Call the function */
-    sb_clock_display_fixation(sb_canvas);
-
-    /* ... */
-    sb_ampm = evas_object_image_filled_add(sb_canvas);
-    sb_hour1 = evas_object_image_filled_add(sb_canvas);
-    sb_hour2 = evas_object_image_filled_add(sb_canvas);
-    sb_min1 = evas_object_image_filled_add(sb_canvas);
-    sb_min2 = evas_object_image_filled_add(sb_canvas);
-
-    /* This function will make layout change */
-    evas_object_move(sb_ampm, moveH + ICO_SB_POS_AMPM_X, ICO_SB_POS_AMPM_Y);
-    evas_object_move(sb_hour1, moveH + ICO_SB_POS_HOUR1_X, ICO_SB_POS_HOUR1_Y);
-    evas_object_move(sb_hour2, moveH + ICO_SB_POS_HOUR2_X, ICO_SB_POS_HOUR2_Y);
-
-    /* This function will make size change of picture */
-    evas_object_resize(sb_ampm, ICO_SB_SIZE_AMPM_W, ICO_SB_SIZE_AMPM_H);
-    evas_object_resize(sb_hour1, ICO_SB_SIZE_NUM_W, ICO_SB_SIZE_NUM_H);
-    evas_object_resize(sb_hour2, ICO_SB_SIZE_NUM_W, ICO_SB_SIZE_NUM_H);
-
-    /* Makes the given Evas object visible */
-    evas_object_show(sb_ampm);
-    evas_object_show(sb_hour1);
-    evas_object_show(sb_hour2);
-
-    /* Change default layout of Evas object */
-    evas_object_move(sb_min1, moveH + ICO_SB_POS_MIN1_X, ICO_SB_POS_MIN1_Y);
-    evas_object_move(sb_min2, moveH + ICO_SB_POS_MIN2_X, ICO_SB_POS_MIN2_Y);
-
-    /* Change default size of Evas object */
-    evas_object_resize(sb_min1, ICO_SB_SIZE_NUM_W, ICO_SB_SIZE_NUM_H);
-    evas_object_resize(sb_min2, ICO_SB_SIZE_NUM_W, ICO_SB_SIZE_NUM_H);
-
-    /* Makes the given Evas object visible */
-    evas_object_show(sb_min1);
-    evas_object_show(sb_min2);
-
-    time(&timer);
-    t_st = localtime(&timer);
-    sb_time_hour(t_st);
-    sb_time_min(t_st);
-
-    /* Set the image file */
-    for (ii = 0; ii < ICO_SB_TIME_IMG_PARTS; ii++) {
-        sb_time_data[ii].time_img = evas_object_image_filled_add(sb_canvas);
-        sprintf(file, "%s%s", sb_respath, sb_time_data[ii].f_name);
-        evas_object_image_file_set(sb_time_data[ii].time_img, file, NULL);
-    }
-    ecore_timer_add(ICO_SB_TIMEOUT, sb_time_show, NULL);
-
-    /* Init websockets */
-    sb_create_ws_context();
-    ecore_timer_add(ICO_SB_WS_TIMEOUT, sb_ecore_event, NULL);
-
-    /* add callback to app configuration */
-    ico_uxf_econf_setAppUpdateCb(sb_config_event);
-
-    /* Runs the application main loop */
-    ecore_main_loop_begin();
-    /* Free an Ecore_Evas */
-    ecore_evas_free(ee);
-    /* Shut down the Ecore_Evas system */
-    ecore_evas_shutdown();
-    return 0;
-
-error:
-    uifw_warn("status_bar: error use ecore")
-    ecore_evas_shutdown();
-    return -1;
-}
-
diff --git a/src/syscond/CicoEFLApp.cpp b/src/syscond/CicoEFLApp.cpp
new file mode 100644 (file)
index 0000000..973bf7d
--- /dev/null
@@ -0,0 +1,320 @@
+/*
+ * 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   CicoEFLApp.cpp
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+#include <exception>
+#include <string>
+#include "Ecore.h"
+#include "CicoEFLApp.h"
+#include "CicoLog.h"
+
+/*========================================================================*/    
+app_event_callback_s CicoEFLApp::m_appEventCB = {
+    .create                = CicoEFLApp::app_create,
+    .terminate             = CicoEFLApp::app_terminate,
+    .pause                 = CicoEFLApp::app_pause,
+    .resume                = CicoEFLApp::app_resume,
+    .service               = CicoEFLApp::app_service,
+    .low_memory            = CicoEFLApp::app_low_memory,
+    .low_battery           = CicoEFLApp::app_low_battery,
+    .device_orientation    = CicoEFLApp::app_device_orientation,
+    .language_changed      = CicoEFLApp::app_language_changed,
+    .region_format_changed = CicoEFLApp::app_region_format_changed
+};
+
+/*========================================================================*/    
+/**
+ *  Default Constructor
+ */
+CicoEFLApp::CicoEFLApp()
+{
+    ICO_DBG("CicoEFLApp::CicoEFLApp Enter");
+    ICO_DBG("CicoEFLApp::CicoEFLApp Leave");
+}
+
+/**
+ *  Destructor
+ */
+CicoEFLApp::~CicoEFLApp()
+{
+    ICO_DBG("CicoEFLApp::~CicoEFLApp Enter");
+    ICO_DBG("CicoEFLApp::~CicoEFLApp Leave");
+}
+
+/**
+ *  Start Main Loop
+ */
+int
+CicoEFLApp::start(int argc, char **argv)
+{
+    ICO_DBG("CicoEFLApp::start Enter");
+    return app_efl_main(&argc, &argv, &m_appEventCB, this);
+}
+
+/**
+ *  Stop Main Loop
+ */
+int
+CicoEFLApp::stop(void)
+{
+    return 0;
+}
+
+const char*
+CicoEFLApp::app_error_to_string(int error)
+{
+    switch(error) {
+    case APP_ERROR_NONE:
+        return (const char*)"APP_ERROR_NONE";
+        break;
+    case APP_ERROR_INVALID_PARAMETER:
+        return (const char*)"APP_ERROR_INVALID_PARAMETER";
+        break;
+    case APP_ERROR_OUT_OF_MEMORY:
+        return (const char*)"APP_ERROR_OUT_OF_MEMORY";
+        break;
+    case APP_ERROR_INVALID_CONTEXT:
+        return (const char*)"APP_ERROR_INVALID_CONTEXT";
+        break;
+    case APP_ERROR_NO_SUCH_FILE:
+        return (const char*)"APP_ERROR_NO_SUCH_FILE";
+        break;
+    case APP_ERROR_ALREADY_RUNNING:
+        return (const char*)"APP_ERROR_ALREADY_RUNNING";
+        break;
+    default:
+        break;
+    }
+
+    return (const char*)"TIZEN_ERROR_UNKNOWN";
+}
+
+bool
+CicoEFLApp::onCreate(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onCreate called.");
+    return false;
+}
+
+void
+CicoEFLApp::onTerminate(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onTerminate called.");
+}
+
+void
+CicoEFLApp::onPause(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onPause called.");
+}
+
+void
+CicoEFLApp::onResume(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onResume called.");
+}
+
+void
+CicoEFLApp::onService(service_h service, void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onService called.");
+}
+
+void
+CicoEFLApp::onLowMemory(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onLowMemory called.");
+}
+
+void
+CicoEFLApp::onLowBattery(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onLowBattery called.");
+}
+
+void
+CicoEFLApp::onDeviceOrientation(app_device_orientation_e orientation,
+                                 void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onDeviceOrientation called.");
+}
+
+void
+CicoEFLApp::onLanguageChanged(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onLanguageChanged called.");
+}
+
+void
+CicoEFLApp::onRegionFormatChanged(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onRegionFormatChanged called.");
+}
+
+bool
+CicoEFLApp::app_create(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_create Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_create Leave");
+        return false;
+    }
+    
+    int ret = static_cast<CicoEFLApp*>(user_data)->onCreate(user_data); 
+
+    ICO_DBG("CicoEFLApp::app_create Leave(%d)", ret);
+
+    return ret;
+}
+
+void
+CicoEFLApp::app_terminate(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_terminate Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_terminate Leave");
+        return;
+    }
+    
+    static_cast<CicoEFLApp*>(user_data)->onTerminate(user_data); 
+
+    ICO_DBG("CicoEFLApp::app_terminate Leave");
+}
+
+void
+CicoEFLApp::app_pause(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_pause Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_pause Leave");
+        return;
+    }
+    
+    static_cast<CicoEFLApp*>(user_data)->onPause(user_data); 
+
+    ICO_DBG("CicoEFLApp::app_pause Leave");
+}
+
+void
+CicoEFLApp::app_resume(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_resume Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_resume Leave");
+        return;
+    }
+    
+    static_cast<CicoEFLApp*>(user_data)->onResume(user_data); 
+
+    ICO_DBG("CicoEFLApp::app_resume Leave");
+}
+
+void
+CicoEFLApp::app_service(service_h service, void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_service Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_service Leave");
+        return;
+    }
+    
+    static_cast<CicoEFLApp*>(user_data)->onService(service, user_data); 
+
+    ICO_DBG("CicoEFLApp::app_service Leave");
+}
+
+void
+CicoEFLApp::app_low_memory(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_low_memory Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_low_memory Leave");
+        return;
+    }
+
+    static_cast<CicoEFLApp*>(user_data)->onLowMemory(user_data); 
+    ICO_DBG("CicoEFLApp::app_low_memory Leave");
+}
+
+void
+CicoEFLApp::app_low_battery(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_low_battery Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_low_battery Leave");
+        return;
+    }
+    static_cast<CicoEFLApp*>(user_data)->onLowBattery(user_data); 
+
+    ICO_DBG("CicoEFLApp::app_low_battery Leave");
+}
+
+void
+CicoEFLApp::app_device_orientation(app_device_orientation_e orientation,
+                                   void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_device_orientation Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_device_orientation Leave");
+        return;
+    }
+    static_cast<CicoEFLApp*>(user_data)->onDeviceOrientation(orientation,
+                                                             user_data);
+
+    ICO_DBG("CicoEFLApp::app_device_orientation Leave");
+}
+
+void
+CicoEFLApp::app_language_changed(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_language_changed Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_device_orientation Leave");
+        return;
+    }
+    static_cast<CicoEFLApp*>(user_data)->onLanguageChanged(user_data);
+
+    ICO_DBG("CicoEFLApp::app_language_changed Leave");
+}
+
+void
+CicoEFLApp::app_region_format_changed(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_region_format_changed Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_device_orientation Leave");
+        return;
+    }
+    static_cast<CicoEFLApp*>(user_data)->onRegionFormatChanged(user_data);
+
+    ICO_DBG("CicoEFLApp::app_region_format_changed Leave");
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/src/syscond/CicoEFLApp.h b/src/syscond/CicoEFLApp.h
new file mode 100644 (file)
index 0000000..052e626
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * 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   CicoEFLApp.h
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+#ifndef __CICO_EFL_APP_H__
+#define __CICO_EFL_APP_H__
+
+#include <app.h>
+
+class CicoEFLApp {
+public:
+    //  default constructor
+    CicoEFLApp();
+    /**
+     *  Destructor
+     */
+    virtual ~CicoEFLApp();
+
+    /**
+     *  Start Main Loop
+     */ int start(int argc, char **argv);
+
+    /**
+     *  Stop Main Loop
+     */
+    int stop(void);
+
+    /**
+     *  Convert application error to string
+     */
+    const char* app_error_to_string(int error);
+
+    virtual bool onCreate(void *user_data);
+    virtual void onTerminate(void *user_data);
+    virtual void onPause(void *user_data);
+    virtual void onResume(void *user_data);
+    virtual void onService(service_h service, void *user_data);
+    virtual void onLowMemory(void *user_data);
+    virtual void onLowBattery(void *user_data);
+    virtual void onDeviceOrientation(app_device_orientation_e orientation,
+                                     void *user_data);
+    virtual void onLanguageChanged(void *user_data);
+    virtual void onRegionFormatChanged(void *user_data);
+
+protected:
+    //  assignment operator
+    CicoEFLApp& operator=(const CicoEFLApp &object);
+
+    //  copy constructor
+    CicoEFLApp(const CicoEFLApp &object);
+
+private:
+    static bool app_create(void *user_data);
+    static void app_terminate(void *user_data);
+    static void app_pause(void *user_data);
+    static void app_resume(void *user_data);
+    static void app_service(service_h service, void *user_data);
+    static void app_low_memory(void *user_data);
+    static void app_low_battery(void *user_data);
+    static void app_device_orientation(app_device_orientation_e orientation,
+                                       void *user_data);
+    static void app_language_changed(void *user_data);
+    static void app_region_format_changed(void *user_data);
+
+private:
+    //  application callbacks
+    static app_event_callback_s m_appEventCB;
+};
+#endif  /* __CICO_EFL_APP_H__ */
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/src/syscond/CicoSysConDaemon.cpp b/src/syscond/CicoSysConDaemon.cpp
new file mode 100644 (file)
index 0000000..b3802a5
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * 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   CicoSysConDaemon.cpp
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+#include <exception>
+#include <iostream>
+#include <string>
+
+#include "CicoSysConDaemon.h"
+#include "ico_syc_error.h"
+#include "CicoLog.h"
+#include "CicoSCSystemConfig.h"
+#include "CicoSCServer.h"
+#include "CicoSCWayland.h"
+#include "CicoSCWindowController.h"
+#include "CicoSCInputController.h"
+#include "CicoSCLifeCycleController.h"
+#include "CicoSCUserManager.h"
+#include "CicoSCResourceManager.h"
+
+/**
+ *  Default Constructor
+ */
+CicoSysConDaemon::CicoSysConDaemon()
+{
+    ICO_DBG("CicoSysConDaemon::CicoSysConDaemon Enter");
+    ICO_DBG("CicoSysConDaemon::CicoSysConDaemon Leave");
+}
+
+/**
+ *  Destructor
+ */
+CicoSysConDaemon::~CicoSysConDaemon()
+{
+    ICO_DBG("CicoSysConDaemon::~CicoSysConDaemon Enter");
+    ICO_DBG("CicoSysConDaemon::~CicoSysConDaemon Leave");
+}
+
+bool
+CicoSysConDaemon::onCreate(void *user_data)
+{
+    ICO_DBG("CicoSysConDaemon::onCreate Enter");
+
+    try {
+        int ret = ICO_SYC_EOK;
+        CicoSCSystemConfig::getInstance()->load("/usr/apps/org.tizen.ico.system-controller/res/config/system.xml");
+
+        CicoSCLifeCycleController *lifecycle =
+            CicoSCLifeCycleController::getInstance();
+        CicoSCWindowController *winctrl     = new CicoSCWindowController();
+        CicoSCInputController  *inputctrl   = new CicoSCInputController();
+        CicoSCResourceManager  *resourcemgr = new CicoSCResourceManager();
+
+        ret = resourcemgr->initialize();
+        if (ICO_SYC_EOK != ret) {
+            return false;
+        }
+
+        winctrl->setResourceManager(resourcemgr);
+
+        CicoSCUserManager *usermgr = CicoSCUserManager::getInstance();
+        usermgr->load("/usr/apps/org.tizen.ico.system-controller/res/config/user.xml");
+
+        CicoSCServer *server = CicoSCServer::getInstance();
+        server->setWindowCtrl(winctrl);
+        server->setInputCtrl(inputctrl);
+        server->setUserMgr(usermgr);
+        server->setResourceMgr(resourcemgr);
+
+        server->startup(18081, (const char*)"ico_syc_protocol");
+        ret = CicoSCWayland::getInstance()->intialize();
+        if (ICO_SYC_EOK != ret) {
+            return false;
+        }
+        CicoSCWayland::getInstance()->addEcoreMainWlFdHandler();
+        
+        usermgr->initialize();
+
+
+    }
+    catch (const std::exception& e) {
+        std::cerr << e.what() << std::endl;
+        ICO_ERR("catch exception %s", e.what());
+        ICO_DBG("CicoSysConDaemon::onCreate Leave(false)");
+        return false;
+    }
+    catch (const std::string& str) {
+        std::cerr << str << std::endl;
+        ICO_ERR("catch exception %s", str.c_str());
+        ICO_DBG("CicoSysConDaemon::onCreate Leave(false)");
+        return false;
+    }
+    catch (...) {
+        ICO_ERR("catch exception unknown");
+        ICO_DBG("CicoSysConDaemon::onCreate Leave(false)");
+        return false;
+    }
+
+    ICO_DBG("CicoSysConDaemon::onCreate Leave(true)");
+
+    return true;
+}
+
+#if 0
+void
+CicoSysConDaemon::onTerminate(void *user_data)
+{
+    _DBG("CicoSysConDaemon::onTerminate entry");
+}
+
+void
+CicoSysConDaemon::onPause(void *user_data)
+{
+    _DBG("CicoSysConDaemon::onPause entry");
+}
+
+void
+CicoSysConDaemon::onResume(void *user_data)
+{
+    _DBG("CicoSysConDaemon::onResume entry");
+}
+
+void
+CicoSysConDaemon::onService(service_h service, void *user_data)
+{
+    _DBG("CicoSysConDaemon::onService entry");
+}
+#endif
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/src/syscond/CicoSysConDaemon.h b/src/syscond/CicoSysConDaemon.h
new file mode 100644 (file)
index 0000000..d21e892
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * 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   CicoSysConDaemon.h
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+//#include <app.h>
+#include <stdio.h>
+#include "CicoEFLApp.h"
+
+#ifndef __CICO_UI_SAMPLE_APP_H__
+#define __CICO_UI_SAMPLE_APP_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+class CicoSysConDaemon : public CicoEFLApp {
+public:
+    /**
+     *  Default Constructor
+     */
+    CicoSysConDaemon();
+    
+    /**
+     *  Destructor
+     */
+    virtual ~CicoSysConDaemon();
+
+    /**
+     *
+     */
+    virtual bool onCreate(void *user_data);
+#if 0
+    void onTerminate(void *user_data);
+    void onPause(void *user_data);
+    void onResume(void *user_data);
+    void onService(service_h service, void *user_data);
+#endif
+
+protected:
+    /**
+     *  Assignment Operator
+     */
+    CicoSysConDaemon& operator=(const CicoSysConDaemon &object);
+
+    /**
+     *  Copy Constructor
+     */
+    CicoSysConDaemon(const CicoSysConDaemon &object);
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __CICO_UI_SAMPLE_APP_H__ */
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/src/syscond/Makefile.am b/src/syscond/Makefile.am
new file mode 100644 (file)
index 0000000..c16c941
--- /dev/null
@@ -0,0 +1,74 @@
+AM_CPPFLAGS = $(GCC_CXXFLAGS)
+
+noinst_PROGRAMS   = \
+       IcoSysconDaemon
+
+check_PROGRAMS =       \
+       IcoSysconDaemon
+
+IcoSysconDaemon_SOURCES =      \
+       CicoEFLApp.cpp                  \
+       CicoSysConDaemon.cpp    \
+       main.cpp
+
+IcoSysconDaemon_CPPFLAGS =     \
+       @ECORE_CFLAGS@                  \
+       @EINA_CFLAGS@                   \
+       @GLIB_CFLAGS@                   \
+       @AIL_CFLAGS@                    \
+       @BUNDLE_CFLAGS@                 \
+       @AUL_CFLAGS@                    \
+       @PKGMGR_CFLAGS@                 \
+       @WAYLANDCLIENT_CFLAGS@  \
+       @CAPIAPPFWAPPLICATION_CFLAGS@ \
+       @JSONGLIB_CFLAGS@                                       \
+       @MURPHYCOMMON_CFLAGS@                           \
+       @MURPHYDOMAINCONTROLLER_CFLAGS@         \
+       @MURPHYECORE_CFLAGS@                            \
+       @MURPHYRESOURCE_CFLAGS@                         \
+       -I/usr/include/ico-util                         \
+       -I/usr/include/ico-uxf-weston-plugin \
+    -I../../lib/system-controller
+
+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                          
+
+CLEANFILES = $(BUILT_SOURCES)
+
+install-exec-hook:
+       mkdir -p $(INSTALL_ROOT)/usr/apps/org.tizen.ico.system-controller/bin
+       mkdir -p $(INSTALL_ROOT)/usr/apps/org.tizen.ico.system-controller/res/config
+       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
+       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 -m 0644 $(top_srcdir)/data/lib/systemd/user/ico-system-controller.service $(INSTALL_ROOT)/usr/lib/systemd/user
+       ln -sf ../ico-system-controller.service $(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
diff --git a/src/syscond/main.cpp b/src/syscond/main.cpp
new file mode 100644 (file)
index 0000000..b00308a
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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   main.cpp
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+#include <exception>
+#include <iostream>
+#include <string>
+
+#include "CicoEFLApp.h"
+#include "CicoSysConDaemon.h"
+#include "CicoLog.h"
+#include <Eina.h>
+
+int
+main(int argc, char **argv)
+{
+    eina_init();
+    eina_log_level_set(EINA_LOG_LEVEL_DBG);
+
+    try {
+        printf("=== start IcoSysConDaemon\n");
+        ico_log_open("IcoSysConDaemon"/*TOOD*/);
+
+        int ret = 0;
+        CicoSysConDaemon daemon;
+
+        ret = daemon.start(argc, argv);
+
+        ICO_DBG("ret = %d error=%s\n", ret, daemon.app_error_to_string(ret));
+    }
+    catch (const std::exception& e) {
+        std::cerr << e.what() << std::endl;
+        ICO_ERR("main: catch exception [%s]", e.what());
+    }
+    catch (const std::string& str) {
+        std::cerr << str << std::endl;
+        ICO_ERR("main: catch exception [%s]", str.c_str());
+    }
+    catch (...) {
+        ICO_ERR("main: catch exception unknown");
+    }
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/start_homescreen b/start_homescreen
deleted file mode 100755 (executable)
index 462f865..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-
-# 1. Delete log file
-/bin/mkdir /var/log/ico > /dev/null 2>&1
-/bin/chmod -R 0777 /var/log/ico > /dev/null 2>&1
-/bin/rm -f /var/log/ico/* /var/log/weston.log > /dev/null 2>&1
-/bin/rm -f /opt/share/crash/core.* > /dev/null 2>&1
-
-# 2. Start Device Input Controller for eGalax TouchPanel
-#/usr/bin/ico_ictl-touch_egalax -t
-/usr/bin/ico_ictl-touch_egalax
-sleep 0.3
-
-# 3. Start Weston
-/usr/bin/weston-launch --user app -- -i0 --log=/var/log/ico/weston.log &
-sync;sync
-#sleep 0.8
-#if [ -e $XDG_RUNTIME_DIR/wayland-0 ] ; then
-#      chmod 0777 $XDG_RUNTIME_DIR/wayland-0
-#fi
-
-# 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=3 --log-target=file:/var/log/ico/pulse.log --system -D
-       sleep 0.5
-fi
-
-## if appcore launcher dose not start ... kick launchpad_preloading_preinitializing_daemon
-/bin/ps ax | /bin/grep launchpad_preloading_preinitializing_daemon | /bin/grep -v grep > /dev/null
-if [ "$?" = "1" ] ; then
-       /usr/bin/launchpad_preloading_preinitializing_daemon &
-       sleep 1
-fi
-
-# 5 start homescreen
-export PKG_NAME="org.tizen.ico.homescreen"
-/usr/bin/launch_app org.tizen.ico.homescreen &
-
diff --git a/test/start_hsfork b/test/start_hsfork
deleted file mode 100755 (executable)
index c37f65e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/sh
-
-# 1. Delete log file
-/bin/mkdir /var/log/ico > /dev/null 2>&1
-/bin/chmod -R 0777 /var/log/ico > /dev/null 2>&1
-/bin/rm -f /var/log/ico/* /var/log/weston.log > /dev/null 2>&1
-/bin/rm -f /opt/share/crash/core.* > /dev/null 2>&1
-
-# 2. Weston/Wayland Envionment
-export QT_QPA_PLATFORM=wayland
-export ELM_ENGINE=wayland_egl
-export ECORE_EVAS_ENGINE=wayland_egl
-export XDG_CONFIG_HOME=/etc/xdg/weston
-
-# 3. Start Device Input Controller for eGalax TouchPanel
-#/usr/bin/ico_ictl-touch_egalax -t
-/usr/bin/ico_ictl-touch_egalax
-sleep 0.3
-
-# 4. Start Weston
-ORG_UMASK=`umask`
-umask 000
-/usr/bin/weston --backend=drm-backend.so --idle-time=0 --log=/var/log/ico/weston.log &
-sync;sync
-sleep 0.8
-if [ -f $XDG_RUNTIME_DIR/wayland-0 ] ; then
-       chmod 0777 $XDG_RUNTIME_DIR/wayland-0
-fi
-umask $ORG_UMASK
-
-# 5 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=3 --log-target=file:/var/log/ico/pulse.log --system -D
-       sleep 0.5
-fi
-
-## if appcore launcher dose not start ... kick launchpad_preloading_preinitializing_daemon
-/bin/ps ax | /bin/grep launchpad_preloading_preinitializing_daemon | /bin/grep -v grep > /dev/null
-if [ "$?" = "1" ] ; then
-       /usr/bin/launchpad_preloading_preinitializing_daemon &
-       sleep 1
-fi
-
-# 6 start homescreen
-export PKG_NAME="org.tizen.ico.homescreen"
-/usr/apps/org.tizen.ico.homescreen/bin/HomeScreen &
-
diff --git a/test/start_hsonly b/test/start_hsonly
deleted file mode 100755 (executable)
index c83943f..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-# 1. Weston/Wayland Envionment
-export QT_QPA_PLATFORM=wayland
-export ELM_ENGINE=wayland_egl
-export ECORE_EVAS_ENGINE=wayland_egl
-export XDG_CONFIG_HOME=/etc/xdg/weston
-
-# 2. Start Device Input Controller for eGalax TouchPanel
-#/usr/bin/ico_ictl-touch_egalax -t
-/usr/bin/ico_ictl-touch_egalax
-sleep 0.3
-
-# 3 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=3 --log-target=file:/var/log/ico/pulse.log --system -D
-       sleep 0.5
-fi
-
-## if appcore launcher dose not start ... kick launchpad_preloading_preinitializing_daemon
-/bin/ps ax | /bin/grep launchpad_preloading_preinitializing_daemon | /bin/grep -v grep > /dev/null
-if [ "$?" = "1" ] ; then
-       /usr/bin/launchpad_preloading_preinitializing_daemon &
-       sleep 1
-fi
-
-# 4 start homescreen
-/usr/bin/launch_app org.tizen.ico.homescreen &
-
diff --git a/test/start_weston b/test/start_weston
deleted file mode 100755 (executable)
index 81d7c73..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-# 1. Delete log file
-/bin/mkdir /var/log/ico > /dev/null 2>&1
-/bin/chmod -R 0777 /var/log/ico > /dev/null 2>&1
-/bin/rm -f /var/log/ico/* /var/log/weston.log > /dev/null 2>&1
-/bin/rm -f /opt/share/crash/core.* > /dev/null 2>&1
-
-# 2. Weston/Wayland Envionment
-export QT_QPA_PLATFORM=wayland
-export ELM_ENGINE=wayland_egl
-export ECORE_EVAS_ENGINE=wayland_egl
-export XDG_CONFIG_HOME=/etc/xdg/weston
-
-# 3. Start Weston
-ORG_UMASK=`umask`
-umask 000
-/usr/bin/weston --backend=drm-backend.so --idle-time=0 --log=/var/log/weston.log &
-sync;sync
-sleep 0.8
-if [ -f $XDG_RUNTIME_DIR/wayland-0 ] ; then
-       chmod 0777 $XDG_RUNTIME_DIR/wayland-0
-fi
-umask $ORG_UMASK
-
diff --git a/test/testdata/gui-test.dat b/test/testdata/gui-test.dat
deleted file mode 100644 (file)
index 0d4d30c..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-#wait for starting weston
-sleep 5
-
-#Change button pushed at tile screen
-XY=960,30
-sleep 0.1
-Button=Down
-sleep 0.1
-Button=Up
-sleep 2
-
-#Change button pushed at application screen
-XY=960,30
-sleep 0.1
-Button=Down
-sleep 0.1
-Button=Up
-sleep 2
-
-#Application is selected
-XY=1466,242
-sleep 0.1
-Button=Down
-sleep 0.1
-Button=Up
-sleep 2
-
-#Hide shown application
-XY=960,30
-sleep 0.1
-Button=Down
-sleep 0.1
-Button=Up
-sleep 2
-
-#Holiding down a application tile
-XY=1466,242
-sleep 0.1
-Button=Down
-sleep 3
-Button=Up
-sleep 2
-
-#Cancel selected on confirmation screen
-XY=994,784
-sleep 0.1
-Button=Down
-sleep 0.1
-Button=Up
-sleep 2
-
-#OK selected on confirmation screen
-XY=1466,242
-sleep 0.1
-Button=Down
-sleep 3
-Button=Up
-sleep 2
-XY=669,784
-sleep 0.1
-Button=Down
-sleep 0.1
-Button=Up
-sleep 2
-
-#Application list button is pushed
-XY=1615,898
-sleep 0.1
-Button=Down
-sleep 0.1
-Button=Up
-sleep 2
-
-#Next selected on applicaton list 
-XY=669,900
-sleep 0.1
-Button=Down
-sleep 0.1
-Button=Up
-sleep 2
-
-#Cancel selected on applicaton list 
-XY=994,900
-sleep 0.1
-Button=Down
-sleep 0.1
-Button=Up
-sleep 2
-
-#application icon selected on applicaton list 
-XY=1615,898
-sleep 0.1
-Button=Down
-sleep 0.1
-Button=Up
-sleep 2
-
-
-XY=1410,822
-sleep 0.1
-Button=Down
-sleep 0.1
-Button=Up
-sleep 2
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644 (file)
index 0000000..af6c75d
--- /dev/null
@@ -0,0 +1,6 @@
+#SUBDIRS=\
+#   system-controller    \
+#   homescreen
+
+SUBDIRS=\
+   system-controller
similarity index 84%
rename from test/Makefile.am
rename to tests/homescreen/Makefile.am
index 089cd6f..cc8ee7e 100644 (file)
@@ -12,8 +12,7 @@ check_PROGRAMS =      \
 
 ico_set_vehicleinfo_SOURCES = \
        ico_set_vehicleinfo.c
-ico_set_vehicleinfo_CFLAGS = $(UWS_CFLAGS)
-ico_set_vehicleinfo_LDADD = $(UWS_LIBS) -lwebsockets 
+ico_set_vehicleinfo_LDADD = -lwebsockets 
 
 ico_send_inputevent_SOURCE = \
        ico_send_inputevent.c
similarity index 51%
rename from test/ico_set_vehicleinfo.c
rename to tests/homescreen/ico_set_vehicleinfo.c
index 9e838aa..bdc93d7 100644 (file)
@@ -12,6 +12,9 @@
  * @date    Apr-09-2013
  */
 
+#define MSG_INTERFACE   0               /* 1= Message Queue Interface       */
+#define LWS_INTERFACE   1               /* 1= WebSockets Interface          */
+
 #include    <stdio.h>
 #include    <stdlib.h>
 #include    <unistd.h>
@@ -23,7 +26,9 @@
 #include    <sys/msg.h>
 #include    <sys/time.h>
 #include    <sys/types.h>
-#include    <ico_uws.h>
+#if     LWS_INTERFACE > 0               /* WebSocket Interface              */
+#include    <libwebsockets.h>
+#endif /*LWS_INTERFACE*/                /* WebSocket Interface              */
 
 #define TYPE_NULL   0
 #define TYPE_BOOL   1
 #define TYPE_STRING 8
 #define TYPE_SHIFT  12
 
-#define LWS_DEFAULTIP       "127.0.0.1" /* connection default ip(localhost) */
-#define LWS_DEFAULTPORT     25010       /* connection default port          */
+#if     LWS_INTERFACE > 0               /* WebSocket Interface              */
+#define LWS_DEFAULTIP       "127.0.0.1" /* websockets default ip(localhost) */
+#define LWS_DEFAULTPORT     25010       /* websockets default port          */
 #define LWS_PROTOCOLNAME    "standarddatamessage-only"
-                                        /* connection protocol name         */
+                                        /* websockets protocol name         */
+#endif /*LWS_INTERFACE*/                /* WebSocket Interface              */
+
 static const struct {
     char        *prop;
     char        *eventtype;
@@ -68,6 +76,9 @@ static const struct {
 
 struct KeyDataMsg_t
 {
+#if     MSG_INTERFACE > 0               /* Message Queue Interface      */
+    long mtype;
+#endif /*MSG_INTERFACE*/                /* Message Queue Interface      */
     char KeyEventType[64];
     struct timeval recordtime;
     struct KeyData
@@ -77,52 +88,110 @@ struct KeyDataMsg_t
     } data;
 };
 
-static struct ico_uws_context   *context = NULL;
-                                        /* connection context               */
-static void                     *connect_id = NULL;
-                                        /* connection connection id         */
+#if     MSG_INTERFACE > 0               /* Message Queue Interface      */
+static int  sndqueuekey = 55555;
+static int  sndqueueid = 0;
+
+static int  mqid = -1;
+#endif /*MSG_INTERFACE*/                /* Message Queue Interface      */
+
+#if     LWS_INTERFACE > 0               /* WebSocket Interface              */
+static struct libwebsocket_context  *context = NULL;
+                                        /* websockets context               */
+static struct libwebsocket          *websocket = NULL;
+                                        /* websockets connection            */
 static int  connected = 0;              /* connection flag                  */
 
-static void uws_callback(const struct ico_uws_context *context,
-                         const ico_uws_evt_e reason, const void *id,
-                         const ico_uws_detail *detail, void *user_data);
+static int  lws_callback(struct libwebsocket_context *context, struct libwebsocket *wsi,
+                         enum libwebsocket_callback_reasons reason,
+                         void *user, void *in, size_t len);
+
+static struct libwebsocket_protocols protocols[] = {
+            {LWS_PROTOCOLNAME, lws_callback, 0},
+            {NULL, NULL, -1}
+        };
+#endif /*LWS_INTERFACE*/                /* WebSocket Interface              */
 
+#if     MSG_INTERFACE > 0               /* Message Queue Interface      */
 static void
-uws_callback(const struct ico_uws_context *context, const ico_uws_evt_e reason,
-             const void *id, const ico_uws_detail *detail, void *user_data)
+init_comm(const int mqkey)
 {
-    if (reason == ICO_UWS_EVT_OPEN)  {
-        connect_id = (void *)id;
-        connected = 1;
+    char    dummy[256];
+
+    if (mqkey == 0) {
+        mqid = -1;
     }
-    else if (reason == ICO_UWS_EVT_ERROR)   {
-        fprintf(stderr, "Communication Error[%d]\n", detail->_ico_uws_error.code);
+    else    {
+        mqid = msgget(mqkey, 0);
+        if (mqid < 0)   {
+            mqid = msgget(mqkey, IPC_CREAT);
+        }
+        if (mqid < 0)   {
+            fprintf(stderr, "Can not create message queue(%d(0x%x))[%d]\n",
+                    mqkey, mqkey, errno);
+            return;
+        }
+        while (msgrcv(mqid, dummy, sizeof(dummy)-sizeof(long), 0, IPC_NOWAIT) > 0)  ;
+    }
+}
+#endif /*MSG_INTERFACE*/                /* Message Queue Interface      */
+
+#if     LWS_INTERFACE > 0               /* WebSocket Interface              */
+static int
+lws_callback(struct libwebsocket_context *context, struct libwebsocket *wsi,
+             enum libwebsocket_callback_reasons reason, void *user,
+             void *in, size_t len)
+{
+    if (reason == LWS_CALLBACK_CLIENT_ESTABLISHED)  {
+        connected = 1;
     }
     /* do nothing       */
+    return 0;
 }
 
 static void
 init_comm(const int port, const char *spadr)
 {
     int     rep;
-    char    uri_name[128];
 
-    snprintf(uri_name, sizeof(uri_name), "ws://%s:%d", spadr, port);
-    connected = 0;
-    context = ico_uws_create_context(uri_name, LWS_PROTOCOLNAME);
+    context = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN,
+                                          spadr, protocols,
+                                          libwebsocket_internal_extensions,
+                                          NULL, NULL, -1, -1, 0);
     if (context == NULL)    {
-        fprintf(stderr, "Can not create conextion context(uri=%s port=%d)\n",
-                uri_name, port);
+        fprintf(stderr, "Can not create libwebsockets context(ip=%s port=%d)\n",
+                spadr, port);
         exit(2);
     }
-    ico_uws_set_event_cb(context, uws_callback, NULL);
 
+    connected = 0;
+    websocket = libwebsocket_client_connect(context, spadr, port,
+                                            0, "/", spadr, "websocket",
+                                            protocols[0].name, -1);
+    if (websocket == NULL)  {
+        fprintf(stderr, "Can not connect libwebsockets context(ip=%s port=%d)\n",
+                spadr, port);
+        exit(2);
+    }
     /* wait for connection          */
     for (rep = 0; rep < (2*1000); rep += 50)    {
         if (connected)  break;
-        ico_uws_service(context);
+        libwebsocket_service(context, 50);
     }
 }
+#endif /*LWS_INTERFACE*/                /* WebSocket Interface              */
+
+static void
+init_vehicleinfo(void)
+{
+#if     MSG_INTERFACE > 0               /* Message Queue Interface      */
+    sndqueueid = msgget(sndqueuekey, 0);
+    if (sndqueueid < 0) {
+        fprintf(stderr, "Send Message Queue(%d(0x%x)) dose not exist[%d].\n",
+                sndqueuekey, sndqueuekey, errno);
+    }
+#endif /*MSG_INTERFACE*/                /* Message Queue Interface      */
+}
 
 static void
 set_vehicleinfo(const char *cmd)
@@ -130,9 +199,6 @@ set_vehicleinfo(const char *cmd)
     int     i, j;
     int     idx, key, pt;
     int     msgsize;
-    short   *sp;
-    int     *ip;
-    double  *dp;
     char    prop[64];
     char    value[128];
     int     sec, msec;
@@ -140,6 +206,10 @@ set_vehicleinfo(const char *cmd)
         struct KeyDataMsg_t     msg;
         char    dummy[128];
     }       msg;
+#if     LWS_INTERFACE > 0               /* WebSocket Interface              */
+    unsigned char   buf[LWS_SEND_BUFFER_PRE_PADDING + 512 + LWS_SEND_BUFFER_POST_PADDING];
+    unsigned char   *bufpt = &buf[LWS_SEND_BUFFER_PRE_PADDING];
+#endif /*LWS_INTERFACE*/                /* WebSocket Interface              */
 
     j = 0;
     for (i = 0; cmd[i]; i++)    {
@@ -197,9 +267,17 @@ set_vehicleinfo(const char *cmd)
     }
 
     memset(&msg, 0, sizeof(msg));
+#if     MSG_INTERFACE > 0               /* Message Queue Interface      */
+    msg.msg.mtype = 1;
+#endif /*MSG_INTERFACE*/                /* Message Queue Interface      */
     strcpy(msg.msg.KeyEventType, vehicleinfo_key[key].eventtype);
     gettimeofday(&(msg.msg.recordtime), NULL);
+#if     MSG_INTERFACE > 0               /* Message Queue Interface      */
+    msgsize = sizeof(msg) - 128 - sizeof(long);
+#endif /*MSG_INTERFACE*/                /* Message Queue Interface      */
+#if     LWS_INTERFACE > 0               /* WebSocket Interface              */
     msgsize = sizeof(msg) - 128;
+#endif /*LWS_INTERFACE*/                /* WebSocket Interface              */
 
     i = 0;
     pt = 0;
@@ -248,21 +326,18 @@ set_vehicleinfo(const char *cmd)
                 break;
             case TYPE_INT16:
             case TYPE_UINT16:
-                sp = (short *)&msg.msg.data.status[pt];
-                *sp = strtol(&value[i], (char **)0, 0);
+                *((short *)&msg.msg.data.status[pt]) = strtol(&value[i], (char **)0, 0);
                 pt += sizeof(short);
                 msgsize += sizeof(short);
                 break;
             case TYPE_INT32:
             case TYPE_UINT32:
-                ip = (int *)&msg.msg.data.status[pt];
-                *ip = strtol(&value[i], (char **)0, 0);
+                *((int *)&msg.msg.data.status[pt]) = strtol(&value[i], (char **)0, 0);
                 pt += sizeof(int);
                 msgsize += sizeof(int);
                 break;
             case TYPE_DOUBLE:
-                dp = (double *)&msg.msg.data.status[pt];
-                *dp = strtod(&value[i], (char **)0);
+                *((double *)&msg.msg.data.status[pt]) = strtod(&value[i], (char **)0);
                 pt += sizeof(double);
                 msgsize += sizeof(double);
                 break;
@@ -294,13 +369,29 @@ set_vehicleinfo(const char *cmd)
         }
     }
 
-    ico_uws_send(context, connect_id, (unsigned char *)&msg, msgsize);
+#if     MSG_INTERFACE > 0               /* Message Queue Interface      */
+    if (msgsnd(sndqueueid, &msg, msgsize, 0) < 0)   {
+        fprintf(stderr, "Message Queue(%d(0x%x)) send error[%d].\n",
+                sndqueuekey, sndqueuekey, errno);
+    }
+#endif /*MSG_INTERFACE*/                /* Message Queue Interface      */
+#if     LWS_INTERFACE > 0               /* WebSocket Interface              */
+    memcpy(bufpt, &msg, msgsize);
+    if (libwebsocket_write(websocket, bufpt, msgsize, LWS_WRITE_BINARY) < 0)    {
+        fprintf(stderr, "libwebsockets send error\n"); fflush(stderr);
+    }
+#endif /*LWS_INTERFACE*/                /* WebSocket Interface              */
 }
 
 static void
 usage(const char *prog)
 {
+#if     LWS_INTERFACE > 0               /* WebSocket Interface              */
     fprintf(stderr, "Usage: %s [-port=port] [-ip=ip_addr] [propaty=value] [propaty=value] ...\n", prog);
+#endif /*LWS_INTERFACE*/                /* WebSocket Interface              */
+#if     MSG_INTERFACE > 0               /* Message Queue Interface      */
+    fprintf(stderr, "Usage: %s [-ambkey=key] [-mq[=key]] [propaty=value] [propaty=value] ...\n", prog);
+#endif /*MSG_INTERFACE*/                /* Message Queue Interface      */
     exit(0);
 }
 
@@ -308,15 +399,40 @@ int
 main(int argc, char *argv[])
 {
     int     i, j;
+#if     LWS_INTERFACE > 0               /* WebSocket Interface              */
     int     port = LWS_DEFAULTPORT;
     char    spadr[64];
+#endif /*LWS_INTERFACE*/                /* WebSocket Interface              */
+#if     MSG_INTERFACE > 0               /* Message Queue Interface      */
+    int     mqkey = 0;
+    struct {
+        long    mtype;
+        char    buf[240];
+    }       mqbuf;
+#endif /*MSG_INTERFACE*/                /* Message Queue Interface      */
     char    buf[240];
 
+#if     LWS_INTERFACE > 0               /* WebSocket Interface              */
     strcpy(spadr, LWS_DEFAULTIP);
+#endif /*LWS_INTERFACE*/                /* WebSocket Interface              */
 
     j = 0;
     for (i = 1; i < argc; i++)  {
         if (argv[i][0] == '-')  {
+#if     MSG_INTERFACE > 0               /* Message Queue Interface      */
+            if (strncasecmp(argv[i], "-ambkey=", 8) == 0)   {
+                sndqueuekey = strtoul(&argv[i][8], (char **)0, 0);
+            }
+            else if (strncasecmp(argv[i], "-mq", 3) == 0)  {
+                if (argv[i][3] == '=')  {
+                    mqkey = strtol(&argv[i][4], (char **)0, 0);
+                }
+                else    {
+                    mqkey = 55552;          /* default message queue key    */
+                }
+            }
+#endif /*MSG_INTERFACE*/                /* Message Queue Interface      */
+#if     LWS_INTERFACE > 0               /* WebSocket Interface              */
             if (strncasecmp(argv[i], "-port=", 6) == 0)   {
                 port = strtoul(&argv[i][6], (char **)0, 0);
             }
@@ -324,6 +440,7 @@ main(int argc, char *argv[])
                 memset(spadr, 0, sizeof(spadr));
                 strncpy(spadr, &argv[i][4], sizeof(spadr)-1);
             }
+#endif /*LWS_INTERFACE*/                /* WebSocket Interface              */
             else    {
                 usage(argv[0]);
             }
@@ -333,8 +450,37 @@ main(int argc, char *argv[])
         }
     }
 
+#if     MSG_INTERFACE > 0               /* Message Queue Interface      */
+    init_comm(mqkey);
+#endif /*MSG_INTERFACE*/                /* Message Queue Interface      */
+#if     LWS_INTERFACE > 0               /* WebSocket Interface              */
     init_comm(port, spadr);
+#endif /*LWS_INTERFACE*/                /* WebSocket Interface              */
+
+    init_vehicleinfo();
 
+#if     MSG_INTERFACE > 0               /* Message Queue Interface      */
+    if (mqid >= 0)  {
+        while (1)   {
+            memset(&mqbuf, 0, sizeof(mqbuf));
+            if (msgrcv(mqid, &mqbuf, sizeof(mqbuf)-sizeof(long), 0, 0) < 0) break;
+            k = 0;
+            j = -1;
+            for (i = 0; mqbuf.buf[i]; i++)    {
+                if ((mqbuf.buf[i] == '#') || (mqbuf.buf[i] == '\n')
+                    || (mqbuf.buf[i] == '\r'))    break;
+                if (mqbuf.buf[i] == '\t') buf[k++] = ' ';
+                else                        buf[k++] = mqbuf.buf[i];
+                if ((j < 0) && (mqbuf.buf[i] != ' ')) j = i;
+            }
+            if (j < 0)  continue;
+            buf[k] = 0;
+            set_vehicleinfo(&buf[j]);
+        }
+        msgctl(mqid, IPC_RMID, NULL);
+    }
+    else
+#endif /*MSG_INTERFACE*/                /* Message Queue Interface      */
     if (j <= 0) {
         while (fgets(buf, sizeof(buf), stdin))  {
             j = -1;
@@ -354,10 +500,11 @@ main(int argc, char *argv[])
             set_vehicleinfo(argv[i]);
         }
     }
+#if     LWS_INTERFACE > 0               /* WebSocket Interface              */
     if (context)    {
-        ico_uws_unset_event_cb(context);
-        ico_uws_close(context);
+        libwebsocket_context_destroy(context);
     }
+#endif /*LWS_INTERFACE*/                /* WebSocket Interface              */
 
     exit(0);
 }
diff --git a/tests/system-controller/Makefile.am b/tests/system-controller/Makefile.am
new file mode 100644 (file)
index 0000000..356d3e1
--- /dev/null
@@ -0,0 +1,3 @@
+SUBDIRS=\
+   apps-framework   \
+   test-dummy-hs
diff --git a/tests/system-controller/apps-framework/Makefile.am b/tests/system-controller/apps-framework/Makefile.am
new file mode 100644 (file)
index 0000000..acec0d5
--- /dev/null
@@ -0,0 +1,56 @@
+TESTS_ENVIRONMENT = $(SHELL) $(top_srcdir)/tests/apps-framework/run_test.sh
+
+export abs_builddir
+
+AM_CFLAGS = $(GCC_CFLAGS)
+AM_CPPFLAGS = $(GCC_CFLAGS)
+
+noinst_PROGRAMS =              \
+       tst_common              \
+       tst_appresctl           \
+       tst_appresctl_main  \
+       tst_inputctl            \
+       tst_userctl             \
+    tst_winctl                 \
+       tst_server
+
+check_LTLIBRARIES = $(TESTS)
+check_PROGRAMS = tst_common tst_appresctl tst_appresctl_main tst_inputctl tst_userctl tst_winctl tst_server
+
+test_target_flag = -I../../../include $(AIL_CFLAGS) $(OPT_CFLAGS) \
+                   @ECORE_CFLAGS@ @EINA_CFLAGS@ \
+                   -I/usr/include/ico-uxf-weston-plugin     \
+                   -I/usr/include/ico-util
+test_target_lib = ../../../lib/apps-framework/.libs/libico-appfw.so \
+                   @ECORE_LIBS@ @EINA_LIBS@ \
+                  $(UWS_LIBS) $(OPT_LIBS) $(AIL_LIBS)
+
+tst_common_SOURCES = tst_common.c
+tst_common_CFLAGS = $(test_target_flag)
+tst_common_LDADD = $(test_target_lib)
+
+tst_appresctl_main_SOURCES = tst_appresctl_main.c
+tst_appresctl_main_CFLAGS = $(AIL_CFLAGS)
+tst_appresctl_main_LDADD = $(AIL_LIBS)
+
+tst_appresctl_SOURCES = tst_appresctl.c
+tst_appresctl_CFLAGS = $(test_target_flag)
+tst_appresctl_LDADD = $(test_target_lib)
+
+tst_inputctl_SOURCES = tst_inputctl.c
+tst_inputctl_CFLAGS = $(test_target_flag)
+tst_inputctl_LDADD = $(test_target_lib)
+
+tst_userctl_SOURCES = tst_userctl.c
+tst_userctl_CFLAGS = $(test_target_flag)
+tst_userctl_LDADD = $(test_target_lib)
+
+tst_winctl_SOURCES = tst_winctl.c
+tst_winctl_CFLAGS = $(test_target_flag)
+tst_winctl_LDADD = $(test_target_lib)
+
+tst_server_SOURCES = tst_server.c
+tst_server_CFLAGS = $(test_target_flag)
+tst_server_LDADD = $(test_target_lib)
+
+EXTRA_DIST = run_test.sh
diff --git a/tests/system-controller/apps-framework/data/test.ico.res.app.desktop b/tests/system-controller/apps-framework/data/test.ico.res.app.desktop
new file mode 100644 (file)
index 0000000..dd56e07
--- /dev/null
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=test.ico.res.app
+Type=Application
+Exec=/opt/usr/apps/test.ico.res.app/bin/tst_appresctl
+Icon=
+Categories=Test
+Version=1.0.0
+NoDisplay=true
+X-TIZEN-Removable=False
diff --git a/tests/system-controller/apps-framework/run_test.sh b/tests/system-controller/apps-framework/run_test.sh
new file mode 100755 (executable)
index 0000000..4a86a3e
--- /dev/null
@@ -0,0 +1,129 @@
+#!/bin/sh
+
+########################
+#
+# Setting value
+#
+########################
+# directory to put result
+log_dir="./result"
+# test log tag
+test_tag="TestCase"
+
+# log file name
+date_str=`date '+%Y%m%d'`
+time_str=`date '+%H%M'`
+file_str="${date_str}_${time_str}.txt"
+
+# sample app dir
+app_dir="/opt/usr/apps/test.ico.res.app"
+
+########################
+#
+# Initialize
+#
+########################
+# 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
+if [ ! -e ${app_dir} ]; then
+       mkdir ${app_dir}
+       mkdir ${app_dir}/bin
+fi
+cp tst_appresctl ${app_dir}/bin/
+
+# make directory to put result
+if [ ! -e ${log_dir} ]; then
+       mkdir ${log_dir}
+fi
+
+########################
+#
+# Function
+#
+########################
+print_result()
+{
+       local l_test="$1"
+       local l_log="$2"
+
+       # count OK/NG
+       l_cnt_ok=`grep ${test_tag} ${l_log} | grep " OK" | wc -l`
+       l_cnt_ng=`grep ${test_tag} ${l_log} | grep " NG" | wc -l`
+       echo "## ${l_test}  OK: ${l_cnt_ok}, NG: ${l_cnt_ng}"
+}
+
+kill_server()
+{
+    pids=(`ps -ef | grep tst_server | grep -v grep | awk '{ print $2 }'`)
+    for pid in ${pids[*]}
+    do
+           kill -9 ${pid}
+    done
+    sleep 1
+}
+
+########################
+#
+# Test
+#
+########################
+# kill test server
+kill_server
+
+echo "===== System Controller API Test ====="
+log_server="${log_dir}/server_${file_str}"
+./tst_server >> ${log_server}&
+sleep 2
+
+log_common="${log_dir}/common_${file_str}"
+./tst_common 2>&1 | tee ${log_common}
+sleep 1
+
+log_winctl="${log_dir}/winctl_${file_str}"
+./tst_winctl 2>&1 | tee ${log_winctl}
+sleep 1
+
+log_inputctl="${log_dir}/inputctl_${file_str}"
+./tst_inputctl 2>&1 | tee ${log_inputctl}
+sleep 1
+
+log_userctl="${log_dir}/userctl_${file_str}"
+./tst_userctl 2>&1 | tee ${log_userctl}
+sleep 1
+
+log_appresctl="${log_dir}/appresctl_${file_str}"
+./tst_appresctl_main -add
+${app_dir}/bin/tst_appresctl 2>&1 | tee ${log_appresctl}
+./tst_appresctl_main -del
+sleep 2
+
+echo ""
+echo ""
+echo "<<Results of System Controller API Test>>"
+print_result "Common          API" ${log_common}
+print_result "WindowControl   API" ${log_winctl}
+print_result "InputControl    API" ${log_inputctl}
+print_result "UserControl     API" ${log_userctl}
+print_result "ResourceControl API" ${log_appresctl}
+echo ""
+echo ""
+
+# kill test server
+kill_server
+
+# remove test application
+rm -fr /opt/share/applications/test.ico.*
+rm -fr /opt/apps/test.ico.res.app
diff --git a/tests/system-controller/apps-framework/tst_appresctl.c b/tests/system-controller/apps-framework/tst_appresctl.c
new file mode 100644 (file)
index 0000000..bf0c43f
--- /dev/null
@@ -0,0 +1,323 @@
+/*
+ * 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   test suite for App Resource Control API
+ *
+ * @date    Aug-6-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <Ecore.h>
+#include <Eina.h>
+
+#include "ico_syc_appresctl.h"
+#include "ico_syc_common.h"
+
+#include "tst_common.h"
+
+/* ----------------------------------------------- */
+/* Variable                                        */
+/* ----------------------------------------------- */
+static struct ico_syc_res_context *res_context  = NULL;
+
+/* ----------------------------------------------- */
+/* Define of static function                       */
+/* ----------------------------------------------- */
+static void _check_res_info(const char *ev_name, ico_syc_res_info_t *info);
+static void _check_input_region(const char *ev_name,
+                                ico_syc_input_region_t *region);
+static void _syc_callback(const ico_syc_ev_e event,
+                          const void *detail, void *user_data);
+static void tst_acquire_res(const ico_syc_res_window_t *window,
+                            const ico_syc_res_sound_t *sound,
+                            const ico_syc_res_input_t *input,
+                            int type);
+static void tst_release_res(void);
+static void tst_set_input_region(const ico_syc_input_region_t *region, int attr);
+static void tst_unset_input_region(const ico_syc_input_region_t *region);
+static Eina_Bool ico_syc_appresctl_test(void *data);
+
+/* ----------------------------------------------- */
+/* Public API Test                                 */
+/* ----------------------------------------------- */
+static void
+_check_res_info(const char *ev_name, ico_syc_res_info_t *info)
+{
+    ico_syc_res_window_t *window = NULL;
+    ico_syc_res_sound_t *sound   = NULL;
+    ico_syc_res_input_t *input   = NULL;
+    int check_flag = 0;
+
+    printf("--- %s\n", ev_name);
+
+    window = info->window;
+    sound = info->sound;
+    input = info->input;
+    if (window != NULL) {
+        printf("\t(window zone[%s], name[%s], id[%s]\n",
+                window->zone, window->name, window->id);
+        if (strcmp(window->zone, TST_ZONE_A) != 0
+            || strcmp(window->name, TST_NAME_A) != 0
+            || strcmp(window->id, TST_ID_A) != 0) {
+            check_flag = 1;
+        }
+    }
+    if (sound != NULL) {
+        printf("\t sound zone[%s], name[%s], id[%s], adjust[%d]\n",
+               sound->zone, sound->name, sound->id, sound->adjust);
+        if (strcmp(sound->zone, TST_ZONE_B) != 0
+            || strcmp(sound->name, TST_NAME_B) != 0
+            || strcmp(sound->id, TST_ID_B) != 0
+            || sound->adjust != TST_ADJUST) {
+            check_flag = 1;
+        }
+    }
+    if (input != NULL) {
+        printf("\t input name[%s], event[%d])\n", input->name, input->event);
+        if (strcmp(input->name, TST_NAME_C) != 0
+            || input->event != TST_INPUT_EV) {
+            check_flag = 1;
+        }
+    }
+
+    if (check_flag == 0) {
+        print_ok("callback (%s)", ev_name);
+    }
+    else {
+        print_ng("callback (%s)", ev_name);
+    }
+
+    return;
+}
+
+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
+        && region->pos_x == TST_POS_X && region->pos_y == TST_POS_Y
+        && region->width == TST_REG_WIDTH && region->height == TST_REG_HEIGHT) {
+        print_ok("callback (%s)", ev_name);
+    }
+    else {
+        print_ng("callback (%s)", ev_name);
+    }
+
+    return;
+}
+
+static void
+_syc_callback(const ico_syc_ev_e event,
+              const void *detail, void *user_data)
+{
+    switch (event) {
+    case ICO_SYC_EV_RES_ACQUIRE:
+        _check_res_info("ICO_SYC_EV_RES_ACQUIRE", (ico_syc_res_info_t *)detail);
+        break;
+    case ICO_SYC_EV_RES_DEPRIVE:
+        _check_res_info("ICO_SYC_EV_RES_DEPRIVE", (ico_syc_res_info_t *)detail);
+        break;
+    case ICO_SYC_EV_RES_WAITING:
+        _check_res_info("ICO_SYC_EV_RES_WAITING", (ico_syc_res_info_t *)detail);
+        break;
+    case ICO_SYC_EV_RES_REVERT:
+        _check_res_info("ICO_SYC_EV_RES_REVERT", (ico_syc_res_info_t *)detail);
+        break;
+    case ICO_SYC_EV_RES_RELEASE:
+        _check_res_info("ICO_SYC_EV_RES_RELEASE", (ico_syc_res_info_t *)detail);
+        break;
+    case ICO_SYC_EV_INPUT_SET:
+        _check_input_region("ICO_SYC_EV_INPUT_SET",
+                            (ico_syc_input_region_t *)detail);
+        break;
+    case ICO_SYC_EV_INPUT_UNSET:
+        _check_input_region("ICO_SYC_EV_INPUT_UNSET",
+                            (ico_syc_input_region_t *)detail);
+        break;
+    default:
+        break;
+    }
+
+    return;
+}
+
+/* test acquire resource */
+static void
+tst_acquire_res(const ico_syc_res_window_t *window,
+                const ico_syc_res_sound_t *sound,
+                const ico_syc_res_input_t *input,
+                int type)
+{
+    char *func = "ico_syc_acquire_res";
+
+    res_context = ico_syc_acquire_res(window, sound, input, type);
+    if (res_context == NULL) {
+        print_ng("%s (context is NULL)", func);
+        return;
+    }
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test release resource */
+static void
+tst_release_res(void)
+{
+    int ret;
+    char *func = "ico_syc_release_res";
+
+    ret = ico_syc_release_res(res_context);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    }
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test set input region */
+static void
+tst_set_input_region(const ico_syc_input_region_t *region, int attr)
+{
+    int ret;
+    char *func = "ico_syc_set_input_region";
+
+    ret = ico_syc_set_input_region(region, attr);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    }
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test unset input region */
+static void
+tst_unset_input_region(const ico_syc_input_region_t *region)
+{
+    int ret;
+    char *func = "ico_syc_unset_input_region";
+
+    ret = ico_syc_unset_input_region(region);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    }
+    print_ok("%s", func);
+
+    return;
+}
+
+/* ------------------------ */
+/* test main                */
+/* ------------------------ */
+static 
+Eina_Bool ico_syc_appresctl_test(void *data)
+{
+    printf("\n");
+    printf("##### ico_syc_appresctl API Test Start #####\n");
+
+    /* window/sound resource */
+    ico_syc_res_window_t window;
+    ico_syc_res_sound_t sound;
+    int type            = ICO_SYC_RES_BASIC;
+    /* input resource */
+    ico_syc_res_input_t input;
+    /* input region */
+    ico_syc_input_region_t region;
+    int attr            = 1;
+
+    /* set window resource info */
+    window.zone         = "center";
+    window.name         = "window A";
+    window.id           = "id A";
+    /* set sound resource info */
+    sound.zone          = "all";
+    sound.name          = "sound B";
+    sound.id            = "id B";
+    sound.adjust        = ICO_SYC_SOUND_MUTE;
+    /* set sound resource info */
+    input.name          = "input C";
+    input.event         = 100;
+    /* set input region info */
+    region.surface      = 123;
+    region.pos_x        = 10;
+    region.pos_y        = 10;
+    region.width        = 200;
+    region.height       = 100;
+
+    /* acquire window/sound/input */
+    tst_acquire_res((const ico_syc_res_window_t *)&window,
+                    (const ico_syc_res_sound_t *)&sound,
+                    (const ico_syc_res_input_t *)&input,
+                    type);
+    usleep(5000);
+    /* set input region */
+    tst_set_input_region(&region, attr);
+
+    sleep(2);
+
+    /* release window/sound/input */
+    tst_release_res();
+    usleep(5000);
+    /* unset input region */
+    tst_unset_input_region(&region);
+
+    sleep(3);
+
+    printf("##### ico_syc_appresctl API Test End #####\n");
+    printf("\n");
+
+
+    return ECORE_CALLBACK_CANCEL;
+}
+
+/* ------------------------ */
+/* quit test callback       */
+/* ------------------------ */
+static Eina_Bool
+quit_test(void *data)
+{
+    ico_syc_disconnect();
+    ecore_main_loop_quit();
+
+    return ECORE_CALLBACK_CANCEL;
+}
+
+/* ----------------------------------------------- */
+/* Main                                            */
+/* ----------------------------------------------- */
+/* main */
+int
+main(int argc, char **argv)
+{
+    ecore_init();
+
+    ico_syc_connect(_syc_callback, NULL);
+
+    ecore_timer_add(1, ico_syc_appresctl_test, NULL);
+    ecore_timer_add(5, quit_test, NULL);
+
+    ecore_main_loop_begin();
+    ecore_shutdown();
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/apps-framework/tst_appresctl_main.c b/tests/system-controller/apps-framework/tst_appresctl_main.c
new file mode 100644 (file)
index 0000000..a03df62
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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   test suite for App Resource Control API
+ *
+ * @date    July-31-2013
+ */
+
+#include<string.h>
+
+#include <ail.h>
+
+/* ----------------------------------------------- */
+/* Main                                            */
+/* ----------------------------------------------- */
+int
+main(int argc, char **argv)
+{
+    int id;
+
+    for (id = 0; id < argc; id++) {
+        if (strcmp(argv[id], "-add") == 0) {
+            ail_desktop_add("test.ico.res.app");
+        }
+        else if (strcmp(argv[id], "-del") == 0) {
+            ail_desktop_remove("test.ico.res.app");
+        }
+    }
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/apps-framework/tst_common.c b/tests/system-controller/apps-framework/tst_common.c
new file mode 100644 (file)
index 0000000..1f3ae23
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * 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   test suite for Connect/Disconnect to System Controller API
+ *
+ * @date    Aug-19-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+
+#include "ico_syc_common.h"
+
+#include "tst_common.h"
+
+/* ----------------------------------------------- */
+/* Variable                                        */
+/* ----------------------------------------------- */
+
+/* ----------------------------------------------- */
+/* Define of static function                       */
+/* ----------------------------------------------- */
+static void tst_connect(void);
+static void tst_disconnect(void);
+static int ico_syc_common_test(void);
+
+/* ----------------------------------------------- */
+/* Public API Test                                 */
+/* ----------------------------------------------- */
+/* test connect */
+static void
+tst_connect(void)
+{
+    int ret;
+    char *func = "ico_syc_connect";
+
+    ret = ico_syc_connect(NULL, NULL);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+    }
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test disconnect */
+static void
+tst_disconnect(void)
+{
+    (void)ico_syc_disconnect();
+    print_ok("(void)ico_syc_disconnect");
+
+    return;
+}
+
+/* test main */
+static int
+ico_syc_common_test()
+{
+    tst_connect();
+    sleep(1);
+    tst_disconnect();
+
+    sleep(3);
+
+    return 1;
+}
+
+/* ----------------------------------------------- */
+/* Main                                            */
+/* ----------------------------------------------- */
+static GMainLoop *g_mainloop = NULL;
+
+static gboolean
+exit_program(gpointer data)
+{
+    g_main_loop_quit(g_mainloop);
+
+    return FALSE;
+}
+
+/* main */
+int
+main(int argc, char **argv)
+{
+    g_setenv("PKG_NAME", "org.test.ico.syc_common", 1);
+    g_mainloop = g_main_loop_new(NULL, 0);
+
+    printf("\n");
+    printf("##### ico_syc_common API Test Start #####\n");
+    ico_syc_common_test();
+    printf("##### ico_syc_common API Test End #####\n");
+    printf("\n");
+
+    g_timeout_add_seconds(1, exit_program, NULL);
+    g_main_loop_run(g_mainloop);
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/apps-framework/tst_common.h b/tests/system-controller/apps-framework/tst_common.h
new file mode 100644 (file)
index 0000000..c6ee7f9
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * 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
+ *
+ */
+
+#ifndef __TST_COMMON_H__
+#define __TST_COMMON_H__
+
+#include "ico_syc_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* log macro */
+#define print_ok(fmt, arg...)                   \
+    do {                                        \
+        fprintf(stdout,                         \
+                "[TestCase] " fmt " : OK\n",    \
+                ##arg);                         \
+    } while (0)
+
+#define print_ng(fmt, arg...)                   \
+    do {                                        \
+        fprintf(stdout,                         \
+                "[TestCase] " fmt " : NG\n",    \
+                ##arg);                         \
+    } while (0)
+
+
+/* test server uri */
+#define SRV_URI ":18081"
+
+/* return value */
+#define TST_APPID       (char *)"org.test.syc.app"
+#define TST_WIN_NAME    (char *)"surface A"
+
+#define TST_SURFACE     100
+#define TST_NODE        1
+#define TST_LAYER       2
+#define TST_POS_X       10
+#define TST_POS_Y       20
+#define TST_WIDTH       1024
+#define TST_HEIGHT      768
+#define TST_RAISE       ICO_SYC_WIN_RAISE_RAISE
+#define TST_VISIBLE     ICO_SYC_WIN_VISIBLE_SHOW
+#define TST_INVISIBLE   ICO_SYC_WIN_VISIBLE_HIDE
+#define TST_ACTIVE      ICO_SYC_WIN_ACTIVE_NONE
+#define TST_STRIDE      1
+#define TST_FORMAT      ICO_SYC_THUMB_FORMAT_ARGB
+
+#define TST_ZONE_A      (char *)"zone A"
+#define TST_ZONE_B      (char *)"zone B"
+#define TST_NAME_A      (char *)"name A"
+#define TST_NAME_B      (char *)"name B"
+#define TST_NAME_C      (char *)"name C"
+#define TST_ID_A        (char *)"id A"
+#define TST_ID_B        (char *)"id B"
+
+#define TST_ADJUST      1
+#define TST_INPUT_EV    2
+#define TST_RES_TYPE    0
+#define TST_REG_WIDTH   200
+#define TST_REG_HEIGHT  100
+
+#define TST_USER_A      (char *)"user A"
+#define TST_USER_B      (char *)"User B"
+#define TST_USER_C      (char *)"user c"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TST_COMMON_H__ */
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/apps-framework/tst_inputctl.c b/tests/system-controller/apps-framework/tst_inputctl.c
new file mode 100644 (file)
index 0000000..276a4fd
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ * 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   test suite for Input Control API
+ *
+ * @date    July-31-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <Ecore.h>
+#include <Eina.h>
+
+#include "ico_syc_common.h"
+#include "ico_syc_inputctl.h"
+
+#include "tst_common.h"
+
+/* ----------------------------------------------- */
+/* Variable                                        */
+/* ----------------------------------------------- */
+
+
+/* ----------------------------------------------- */
+/* Define of static function                       */
+/* ----------------------------------------------- */
+static void tst_add_input(const char *appid, const char *device,
+                          int input, int fix, int keycode);
+static void tst_delete_input(const char *appid, const char *device,
+                             int input);
+static void tst_send_input(const char *appid, int surface, int ev_type,
+                           int deviceno, int ev_code, int ev_value);
+static Eina_Bool ico_syc_inputctl_test(void *data);
+
+/* ----------------------------------------------- */
+/* Public API Test                                 */
+/* ----------------------------------------------- */
+/* test add input */
+static void
+tst_add_input(const char *appid, const char *device,
+              int input, int fix, int keycode)
+{
+    int ret;
+    char *func = "ico_syc_add_input";
+
+    ret = ico_syc_add_input(appid, device, input, fix, keycode);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    }
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test delete input */
+static void
+tst_delete_input(const char *appid, const char *device, int input)
+{
+    int ret;
+    char *func = "ico_syc_delete_input";
+
+    ret = ico_syc_delete_input(appid, device, input);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    }
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test send input */
+static void
+tst_send_input(const char *appid, int surface, int ev_type,
+               int deviceno, int ev_code, int ev_value)
+{
+    int ret;
+    char *func = "ico_syc_send_input";
+
+    ret = ico_syc_send_input(appid, surface, ev_type, deviceno,
+                             ev_code, ev_value);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    }
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test main */
+static Eina_Bool
+ico_syc_inputctl_test(void *data)
+{
+    const char *appid   = "org.test.app.testapp";
+    const char *device  = "input.dev";
+    int input           = 100;
+    int fix             = ICO_SYC_INPUT_ALLOC_FIX;
+    int keycode         = 10;
+    int surface         = 12345;
+    int ev_type         = ICO_SYC_INPUT_TYPE_POINTER;
+    int deviceno        = 123;
+    int ev_code         = 1;
+    int ev_value        = 1;
+
+    printf("\n");
+    printf("##### ico_syc_inputctl API Test Start #####\n");
+
+    tst_add_input(appid, device, input, fix, keycode);
+    usleep(5000);
+    tst_delete_input(appid, device, input);
+    usleep(5000);
+    tst_send_input(appid, surface, ev_type, deviceno, ev_code, ev_value);
+
+    printf("##### ico_syc_inputctl API Test End #####\n");
+    printf("\n");
+
+    return ECORE_CALLBACK_CANCEL;
+}
+/* ------------------------ */
+/* quit test callback       */
+/* ------------------------ */
+static Eina_Bool
+quit_test(void *data)
+{
+    ico_syc_disconnect();
+    ecore_main_loop_quit();
+
+    return ECORE_CALLBACK_CANCEL;
+}
+
+/* ----------------------------------------------- */
+/* Main                                            */
+/* ----------------------------------------------- */
+/* main */
+int
+main(int argc, char **argv)
+{
+    ecore_init();
+
+    ico_syc_connect(NULL, NULL);
+
+    ecore_timer_add(1, ico_syc_inputctl_test, NULL);
+    ecore_timer_add(5, quit_test, NULL);
+
+    ecore_main_loop_begin();
+    ecore_shutdown();
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/apps-framework/tst_server.c b/tests/system-controller/apps-framework/tst_server.c
new file mode 100644 (file)
index 0000000..2f85f4c
--- /dev/null
@@ -0,0 +1,616 @@
+/*
+ * 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   test server
+ *
+ * @date    Aug-19-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+#include <ico_uws.h>
+
+#include "ico_syc_msg_cmd_def.h"
+#include "ico_syc_msg.h"
+#include "ico_syc_private.h"
+
+#include "tst_common.h"
+
+/* ----------------------------------------------- */
+/* Define of static variable                       */
+/* ----------------------------------------------- */
+#define ZONE_EXIST      0
+#define ZONE_NO_EXIST   1
+
+static int num_close    = 0;
+
+/* ----------------------------------------------- */
+/* Define of static function                       */
+/* ----------------------------------------------- */
+static int _get_command(const void *data, size_t len);
+static int _check_zone(const void *data, size_t len);
+static msg_t _create_winctl_msg(int cmd);
+static msg_t _create_winctl_attr_msg(int cmd, const char *type);
+static msg_t _create_winctl_move_msg(const void *data, size_t len);
+static msg_t _create_winctl_layer_msg(int cmd);
+static msg_t _create_userctl_msg(int cmd);
+static msg_t _create_resctl_msg(int cmd);
+static msg_t _create_resctl_region_msg(int cmd);
+static msg_t _create_msg(const void *data, size_t len);
+static void tst_uws_callback(const struct ico_uws_context *context,
+                             const ico_uws_evt_e event,
+                             const void *id,
+                             const ico_uws_detail *detail,
+                             void *user_data);
+static int test_server(void);
+
+/* ----------------------------------------------- */
+/* Static function                                 */
+/* ----------------------------------------------- */
+static int
+_get_command(const void *data, size_t len)
+{
+    /* get command from receive data */
+    JsonParser *parser  = NULL;
+    GError *error       = NULL;
+    gboolean gbool      = FALSE;
+    JsonNode *r_root    = NULL;
+    JsonObject *r_obj   = NULL;
+    int cmd             = -1;
+
+    /* get command */
+    parser = json_parser_new();
+    gbool = json_parser_load_from_data(parser, data, len, &error);
+    if (gbool == FALSE) {
+        g_object_unref(parser);
+        return -1;
+    }
+    r_root = json_parser_get_root(parser);
+    if (r_root == NULL) {
+        g_object_unref(parser);
+        return -1;
+    }
+    r_obj = json_node_get_object(r_root);
+    cmd = json_object_get_int_member(r_obj, MSG_PRMKEY_CMD);
+    g_object_unref(parser); 
+
+    return cmd;
+}
+
+static int
+_check_zone(const void *data, size_t len)
+{
+    /* get command from receive data */
+    JsonParser *parser  = NULL;
+    GError *error       = NULL;
+    gboolean gbool      = FALSE;
+    JsonNode *r_root    = NULL;
+    JsonObject *r_obj   = NULL;
+    JsonObject *arg_obj = NULL;
+    int ret             = -1;
+
+    /* get command */
+    parser = json_parser_new();
+    gbool = json_parser_load_from_data(parser, data, len, &error);
+    if (gbool == FALSE) {
+        g_object_unref(parser);
+        return -1;
+    }
+    r_root = json_parser_get_root(parser);
+    if (r_root == NULL) {
+        g_object_unref(parser);
+        return -1;
+    }
+
+    r_obj = json_node_get_object(r_root);
+    arg_obj = json_object_get_object_member(r_obj, MSG_PRMKEY_ARG);
+    if (json_object_has_member(arg_obj, MSG_PRMKEY_ZONE) == TRUE) {
+        ret = ZONE_EXIST;
+    }
+    else {
+        ret = ZONE_NO_EXIST;
+    }
+    g_object_unref(parser); 
+
+    return ret;
+}
+
+static msg_t
+_create_winctl_msg(int cmd)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object and array */
+    obj = json_object_new();
+    argobj = json_object_new();
+    if (obj == NULL || argobj == NULL) {
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, TST_APPID);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
+    json_object_set_string_member(argobj, MSG_PRMKEY_WINNAME, TST_WIN_NAME);
+    json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, TST_SURFACE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_NODE, TST_NODE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_LAYER, TST_LAYER);
+    json_object_set_int_member(argobj, MSG_PRMKEY_POS_X, TST_POS_X);
+    json_object_set_int_member(argobj, MSG_PRMKEY_POS_Y, TST_POS_Y);
+    json_object_set_int_member(argobj, MSG_PRMKEY_WIDTH, TST_WIDTH);
+    json_object_set_int_member(argobj, MSG_PRMKEY_HEIGHT, TST_HEIGHT);
+    json_object_set_int_member(argobj, MSG_PRMKEY_RAISE, TST_RAISE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_VISIBLE, TST_VISIBLE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_ACTIVE, TST_ACTIVE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_STRIDE, TST_STRIDE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_FORMAT, TST_FORMAT);
+
+    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;
+}
+
+static msg_t
+_create_winctl_attr_msg(int cmd, const char *type)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object and array */
+    obj = json_object_new();
+    argobj = json_object_new();
+    if (obj == NULL || argobj == NULL) {
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, TST_APPID);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
+    json_object_set_string_member(argobj, MSG_PRMKEY_WINNAME, type);
+    json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, TST_SURFACE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_NODE, TST_NODE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_LAYER, TST_LAYER);
+    json_object_set_int_member(argobj, MSG_PRMKEY_POS_X, TST_POS_X);
+    json_object_set_int_member(argobj, MSG_PRMKEY_POS_Y, TST_POS_Y);
+    json_object_set_int_member(argobj, MSG_PRMKEY_WIDTH, TST_WIDTH);
+    json_object_set_int_member(argobj, MSG_PRMKEY_HEIGHT, TST_HEIGHT);
+    json_object_set_int_member(argobj, MSG_PRMKEY_RAISE, TST_RAISE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_VISIBLE, TST_VISIBLE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_ACTIVE, TST_ACTIVE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_STRIDE, TST_STRIDE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_FORMAT, TST_FORMAT);
+
+    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;
+}
+
+static msg_t
+_create_winctl_move_msg(const void *data, size_t len)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object and array */
+    obj = json_object_new();
+    argobj = json_object_new();
+    if (obj == NULL || argobj == NULL) {
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, TST_APPID);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_CHANGE_ATTR);
+    json_object_set_string_member(argobj, MSG_PRMKEY_WINNAME, "move");
+    json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, TST_SURFACE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_NODE, TST_NODE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_LAYER, TST_LAYER);
+    if (_check_zone(data, len) == ZONE_EXIST) {
+        json_object_set_int_member(argobj, MSG_PRMKEY_POS_X, 0);
+        json_object_set_int_member(argobj, MSG_PRMKEY_POS_Y, 0);
+    }
+    else {
+        json_object_set_int_member(argobj, MSG_PRMKEY_POS_X, 10);
+        json_object_set_int_member(argobj, MSG_PRMKEY_POS_Y, 10);
+    }
+    json_object_set_int_member(argobj, MSG_PRMKEY_WIDTH, TST_WIDTH);
+    json_object_set_int_member(argobj, MSG_PRMKEY_HEIGHT, TST_HEIGHT);
+    json_object_set_int_member(argobj, MSG_PRMKEY_RAISE, TST_RAISE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_VISIBLE, TST_VISIBLE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_ACTIVE, TST_ACTIVE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_STRIDE, TST_STRIDE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_FORMAT, TST_FORMAT);
+
+    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;
+}
+
+static msg_t
+_create_winctl_layer_msg(int cmd)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object and array */
+    obj = json_object_new();
+    argobj = json_object_new();
+    if (obj == NULL || argobj == NULL) {
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, TST_APPID);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_CHANGE_LAYER_ATTR);
+    json_object_set_int_member(argobj, MSG_PRMKEY_LAYER, TST_LAYER);
+    if (cmd == MSG_CMD_SHOW_LAYER) {
+        json_object_set_int_member(argobj, MSG_PRMKEY_VISIBLE, TST_VISIBLE);
+    }
+    else {
+        json_object_set_int_member(argobj, MSG_PRMKEY_VISIBLE, TST_INVISIBLE);
+    }
+
+    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;
+}
+
+
+static msg_t
+_create_userctl_msg(int cmd)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+    JsonArray *array    = NULL;
+
+    /* create json object and array */
+    obj = json_object_new();
+    argobj = json_object_new();
+    array = json_array_new();
+    if (obj == NULL || argobj == NULL || array == NULL) {
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, TST_APPID);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
+    json_object_set_int_member(argobj, MSG_PRMKEY_USER_NUM, 3);
+
+    json_array_add_string_element(array, TST_USER_A);
+    json_array_add_string_element(array, TST_USER_B);
+    json_array_add_string_element(array, TST_USER_C);
+    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_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;
+}
+
+static msg_t
+_create_resctl_msg(int cmd)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *resobj  = NULL;
+    JsonObject *window_obj  = NULL;
+    JsonObject *sound_obj  = NULL;
+    JsonObject *input_obj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object and array */
+    obj = json_object_new();
+    resobj = json_object_new();
+    window_obj = json_object_new();
+    sound_obj = json_object_new();
+    input_obj = json_object_new();
+    if (obj == NULL || resobj == NULL || window_obj == NULL
+        || sound_obj == NULL || input_obj == NULL) {
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, TST_APPID);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
+
+    /* window */
+    json_object_set_string_member(window_obj, MSG_PRMKEY_RES_ZONE, TST_ZONE_A);
+    json_object_set_string_member(window_obj, MSG_PRMKEY_RES_NAME, TST_NAME_A);
+    json_object_set_string_member(window_obj, MSG_PRMKEY_RES_ID, TST_ID_A);
+    /* sound */
+    json_object_set_string_member(sound_obj, MSG_PRMKEY_RES_ZONE, TST_ZONE_B);
+    json_object_set_string_member(sound_obj, MSG_PRMKEY_RES_NAME, TST_NAME_B);
+    json_object_set_string_member(sound_obj, MSG_PRMKEY_RES_ID, TST_ID_B);
+    json_object_set_int_member(sound_obj, MSG_PRMKEY_RES_ADJUST, TST_ADJUST);
+    /* input */
+    json_object_set_string_member(input_obj, MSG_PRMKEY_RES_NAME, TST_NAME_C);
+    json_object_set_int_member(input_obj, MSG_PRMKEY_RES_EV, TST_INPUT_EV);
+    /* type */
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_TYPE, TST_RES_TYPE);
+
+    /* set object */
+    json_object_set_object_member(resobj, MSG_PRMKEY_RES_WINDOW, window_obj);
+    json_object_set_object_member(resobj, MSG_PRMKEY_RES_SOUND, sound_obj);
+    json_object_set_object_member(resobj, MSG_PRMKEY_RES_INPUT, input_obj);
+    json_object_set_object_member(obj, MSG_PRMKEY_RES, resobj);
+
+    /* 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;
+}
+
+static msg_t
+_create_resctl_region_msg(int cmd)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *resobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object and array */
+    obj = json_object_new();
+    resobj = json_object_new();
+    if (obj == NULL || resobj == NULL) {
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, TST_APPID);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
+
+    /* region */
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_SURFACE, TST_SURFACE);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_POS_X, TST_POS_X);
+    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);
+
+    /* set object */
+    json_object_set_object_member(obj, MSG_PRMKEY_REGION, resobj);
+
+    /* 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;
+}
+
+static msg_t
+_create_msg(const void *data, size_t len)
+{
+    int cmd             = -1;
+    JsonGenerator *gen  = NULL;
+
+    /* get command */
+    cmd = _get_command(data, len);
+    if (cmd < 0) {
+        return NULL;
+    }
+
+    switch (cmd) {
+    case MSG_CMD_CREATE:
+    case MSG_CMD_DESTROY:
+    case MSG_CMD_CHANGE_ACTIVE:
+        gen = _create_winctl_msg(cmd);
+        break;
+    case MSG_CMD_SHOW:
+        gen = _create_winctl_attr_msg(MSG_CMD_CHANGE_ATTR, "show");
+        break;
+    case MSG_CMD_HIDE:
+        gen = _create_winctl_attr_msg(MSG_CMD_CHANGE_ATTR, "hide");
+        break;
+    case MSG_CMD_MOVE:
+        gen = _create_winctl_move_msg(data, len);
+        break;
+    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);
+        break;
+    case MSG_CMD_SHOW_LAYER:
+    case MSG_CMD_HIDE_LAYER:
+        gen = _create_winctl_layer_msg(cmd);
+        break;
+    case MSG_CMD_ADD_INPUT:
+    case MSG_CMD_DEL_INPUT:
+    case MSG_CMD_SEND_INPUT:
+        gen = NULL;
+        break;
+    case MSG_CMD_CHANGE_USER:
+    case MSG_CMD_GET_USERLIST:
+        gen = _create_userctl_msg(cmd);
+        break;
+    case MSG_CMD_ACQUIRE_RES:
+    case MSG_CMD_RELEASE_RES:
+    case MSG_CMD_DEPRIVE_RES:
+    case MSG_CMD_WAITING_RES:
+    case MSG_CMD_REVERT_RES:
+        gen = _create_resctl_msg(cmd);
+        break;
+    case MSG_CMD_SET_REGION:
+    case MSG_CMD_UNSET_REGION:
+        gen = _create_resctl_region_msg(cmd);
+        break;
+    default:
+        gen = NULL;
+        break;
+    }
+
+    return gen;
+}
+
+/* event callback */
+static void
+tst_uws_callback(const struct ico_uws_context *context,
+                 const ico_uws_evt_e event,
+                 const void *id,
+                 const ico_uws_detail *detail,
+                 void *user_data)
+{
+    JsonNode *node  = NULL;
+    msg_t msg       = NULL;
+    msg_str_t data  = NULL;
+    size_t  len     = 0;
+
+    switch (event) {
+    case ICO_UWS_EVT_RECEIVE:
+        msg = _create_msg((const void *)detail->_ico_uws_message.recv_data,
+                          detail->_ico_uws_message.recv_len);
+        if (msg == NULL) break;
+        data = json_generator_to_data(msg, &len);
+        if (data == NULL) break;
+
+        /* send return message */
+        ico_uws_send((struct ico_uws_context *)context,
+                     (void *)id,
+                     (unsigned char *)data, len);
+        printf("send: %s\n", (char *)data);
+        /* free */
+        g_free(data);
+        node = json_generator_get_root(msg);
+        json_object_unref(json_node_get_object(node));
+        json_node_free(node);
+        usleep(50);
+        break;
+    case ICO_UWS_EVT_CLOSE:
+        num_close++;
+        break;
+    case ICO_UWS_EVT_OPEN:
+    case ICO_UWS_EVT_ERROR:
+    case ICO_UWS_EVT_ADD_FD:
+    case ICO_UWS_EVT_DEL_FD:
+    default:
+        /* other event is not test */
+        break;
+    }
+
+    return;
+}
+
+/* test main (server) */
+static int
+test_server(void)
+{
+    struct ico_uws_context *context;
+
+    /* create context */
+    context = ico_uws_create_context(SRV_URI, ICO_SYC_PROTOCOL);
+
+    if (context) {
+        (void)ico_uws_set_event_cb(context, tst_uws_callback, NULL);
+
+        /* service (loop) */
+        while (num_close < 5) {
+            ico_uws_service(context);
+            usleep(50);
+        }
+
+        /* close */
+        ico_uws_close(context);
+    }
+
+    return 1;
+}
+
+/* ----------------------------------------------- */
+/* Main                                            */
+/* ----------------------------------------------- */
+static GMainLoop *g_mainloop = NULL;
+
+static gboolean
+exit_program(gpointer data)
+{
+    g_main_loop_quit(g_mainloop);
+
+    return FALSE;
+}
+
+/* main */
+int
+main(int argc, char **argv)
+{
+    g_setenv("PKG_NAME", "org.test.ico.tst_server", 1);
+    g_mainloop = g_main_loop_new(NULL, 0);
+
+    test_server();
+
+    g_timeout_add_seconds(2, exit_program, NULL);
+    g_main_loop_run(g_mainloop);
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/apps-framework/tst_userctl.c b/tests/system-controller/apps-framework/tst_userctl.c
new file mode 100644 (file)
index 0000000..d7cb237
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * 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   test suite for User Control API
+ *
+ * @date    Aug-6-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <Ecore.h>
+#include <Eina.h>
+
+#include "ico_syc_common.h"
+#include "ico_syc_userctl.h"
+
+#include "tst_common.h"
+
+/* ----------------------------------------------- */
+/* Variable                                        */
+/* ----------------------------------------------- */
+
+/* ----------------------------------------------- */
+/* Define of static function                       */
+/* ----------------------------------------------- */
+static void _check_userlist(const char *ev_name, ico_syc_userlist_t *list);
+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 Eina_Bool  ico_syc_userctl_test(void *data);
+
+/* ----------------------------------------------- */
+/* Public API Test                                 */
+/* ----------------------------------------------- */
+static void
+_check_userlist(const char *ev_name, ico_syc_userlist_t *list)
+{
+    int check_flag = 0;
+    char *name;
+    int id;
+
+    printf("--- %s userlist[%d] (", ev_name, list->user_num);
+    for (id = 0; id < list->user_num; id++) {
+        if (id > 0) printf(", ");
+        name = *(list->userlist);
+        printf("%s", name);
+        if (strcmp(name, TST_USER_A) != 0 && strcmp(name, TST_USER_B) != 0
+            && strcmp(name, TST_USER_C) != 0) {
+            check_flag++;
+        }
+        list->userlist++;
+    }
+    printf("), login[%s]\n", list->user_login);
+
+    if (strcmp(list->user_login, TST_USER_A) != 0) {
+        check_flag++;
+    }
+
+    if (check_flag == 0) {
+        print_ok("callback (%s)", ev_name);
+    }
+    else {
+        print_ng("callback (%s)", ev_name);
+    }
+
+    return;
+}
+
+static void
+_syc_callback(const ico_syc_ev_e event,
+              const void *detail, void *user_data)
+{
+    switch (event) {
+    case ICO_SYC_EV_USERLIST:
+        _check_userlist("ICO_SYC_EV_USERLIST", (ico_syc_userlist_t *)detail);
+        break;
+    case ICO_SYC_EV_AUTH_FAIL:
+        if (detail == NULL) {
+            printf("--- ICO_SYC_EV_AUTH_FAIL (detail is NULL)\n");
+            print_ok("callback (ICO_SYC_EV_AUTH_FAIL)");
+        }
+        else {
+            printf("--- ICO_SYC_EV_AUTH_FAIL (detail is not NULL)\n");
+            print_ng("callback (ICO_SYC_EV_AUTH_FAIL)");
+        }
+        break;
+    default:
+        break;
+    }
+
+    return;
+}
+
+/* test change user */
+static void
+tst_change_user(void)
+{
+    (void)ico_syc_change_user("Alice", "");
+    print_ok("(void)ico_syc_change_user");
+
+    return;
+}
+
+/* test get userlist */
+static void
+tst_get_userlist(void)
+{
+    (void)ico_syc_get_userlist();
+    print_ok("(void)ico_syc_get_userlist");
+
+    return;
+}
+
+/* test main */
+static Eina_Bool 
+ico_syc_userctl_test(void *data)
+{
+    printf("##### ico_syc_userctl API Test Start #####\n");
+    printf("\n");
+
+    tst_change_user();
+    tst_get_userlist();
+
+    printf("##### ico_syc_userctl API Test End #####\n");
+    printf("\n");
+
+    return 1;
+}
+
+/* ------------------------ */
+/* quit test callback       */
+/* ------------------------ */
+static Eina_Bool
+quit_test(void *data)
+{
+    ico_syc_disconnect();
+    ecore_main_loop_quit();
+
+    return ECORE_CALLBACK_CANCEL;
+}
+
+/* ----------------------------------------------- */
+/* Main                                            */
+/* ----------------------------------------------- */
+/* main */
+int
+main(int argc, char **argv)
+{
+    ecore_init();
+
+    ico_syc_connect(_syc_callback, NULL);
+
+    ecore_timer_add(1, ico_syc_userctl_test, NULL);
+    ecore_timer_add(5, quit_test, NULL);
+
+    ecore_main_loop_begin();
+    ecore_shutdown();
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/apps-framework/tst_winctl.c b/tests/system-controller/apps-framework/tst_winctl.c
new file mode 100644 (file)
index 0000000..6cf8c5b
--- /dev/null
@@ -0,0 +1,476 @@
+/*
+ * 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   test suite for Window Control API
+ *
+ * @date    Aug-19-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <Ecore.h>
+#include <Eina.h>
+
+#include "ico_syc_common.h"
+#include "ico_syc_winctl.h"
+
+#include "tst_common.h"
+
+/* ----------------------------------------------- */
+/* Variable                                        */
+/* ----------------------------------------------- */
+
+
+/* ----------------------------------------------- */
+/* Define of static function                       */
+/* ----------------------------------------------- */
+static void _check_win_info(const char *ev_name, ico_syc_win_info_t *info);
+static void _check_win_attr(const char *ev_name, ico_syc_win_attr_t *attr);
+static void _check_thumb_info(const char *ev_name, ico_syc_thumb_info_t *info);
+static void _check_layer_attr(const char *ev_name, ico_syc_layer_attr_t *attr);
+/* callback */
+static void _syc_callback(const ico_syc_ev_e event,
+                          const void *detail, void *user_data);
+/* window */
+static void tst_show(const char *appid, int surface,
+                     ico_syc_animation_t *animation);
+static void tst_hide(const char *appid, int surface,
+                     ico_syc_animation_t *animation);
+static void tst_move(const char *appid, int surface,
+                     ico_syc_win_move_t *move,
+                     ico_syc_animation_t *animation, const char *type);
+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_unmap_thumb(int surface);
+/* layer */
+static void tst_show_layer(int layer);
+static void tst_hide_layer(int layer);
+/* test main */
+static Eina_Bool ico_syc_winctl_test(void *data);
+
+/* ----------------------------------------------- */
+/* Public API Test                                 */
+/* ----------------------------------------------- */
+static void 
+_check_win_info(const char *ev_name, ico_syc_win_info_t *info)
+{
+    printf("--- %s ", ev_name);
+    printf("(appid[%s], name[%s], surface[%d])\n",
+           info->appid, info->name, info->surface);
+
+    if (strcmp(info->appid, TST_APPID) == 0
+        && strcmp(info->name, TST_WIN_NAME) == 0
+        && info->surface == TST_SURFACE) {
+        print_ok("callback (%s)", ev_name);
+    }
+    else {
+        print_ng("callback (%s)", ev_name);
+    }
+
+    return;
+}
+
+static void
+_check_win_attr(const char *ev_name, ico_syc_win_attr_t *attr)
+{
+    printf("--- %s\n", ev_name);
+    printf("\t(appid[%s], name[%s], surface[%d], node[%d], layer[%d],\n",
+           attr->appid, attr->name, attr->surface, attr->nodeid, attr->layer);
+    printf("\t (x,y)[%d, %d], width[%d], height[%d], ",
+           attr->pos_x, attr->pos_y, attr->width, attr->height);
+    printf("raise[%d], visible[%d], active[%d])\n",
+           attr->raise, attr->visible, attr->active);
+
+    // move
+    if (strcmp(attr->name, "move") == 0) {
+        if ((attr->pos_x > 0) && (attr->pos_y > 0)) {
+            print_ok("callback (%s move (pos))", ev_name);
+        }
+        else {
+            print_ok("callback (%s move (zone))", ev_name);
+        }
+        return;
+    }
+
+    // not move
+    if (strcmp(attr->appid, TST_APPID) == 0
+        && attr->surface == TST_SURFACE && attr->nodeid == TST_NODE
+        && attr->layer == TST_LAYER && attr->pos_x == TST_POS_X
+        && attr->pos_y == TST_POS_Y && attr->width == TST_WIDTH
+        && attr->height == TST_HEIGHT && attr->raise == TST_RAISE
+        && attr->visible == TST_VISIBLE && attr->active == TST_ACTIVE) {
+        print_ok("callback (%s %s)", ev_name, attr->name);
+    }
+    else {
+        print_ng("callback (%s %s)", ev_name, attr->name);
+    }
+
+    return;
+}
+
+static void 
+_check_thumb_info(const char *ev_name, ico_syc_thumb_info_t *info)
+{
+    printf("--- %s ", ev_name);
+    printf("\t(appid[%s], surface[%d], width[%d], height[%d], ",
+           info->appid, info->surface, info->width, info->height);
+    printf("stride[%d], format[%d])\n",
+           info->stride, info->format);
+
+    if (strcmp(info->appid, TST_APPID) == 0
+        && info->surface == TST_SURFACE
+        && info->width == TST_WIDTH && info->height == TST_HEIGHT
+        && info->stride == TST_STRIDE && info->format == TST_FORMAT) {
+        print_ok("callback (%s)", ev_name);
+    }
+    else {
+        print_ng("callback (%s)", ev_name);
+    }
+
+    return;
+}
+
+static void 
+_check_layer_attr(const char *ev_name, ico_syc_layer_attr_t *attr)
+{
+    printf("--- %s ", ev_name);
+    printf("(layer[%d], visible[%d])\n",
+           attr->layer, attr->visible);
+
+    if (attr->layer == TST_LAYER && attr->visible == TST_VISIBLE) {
+        print_ok("callback (%s show)", ev_name);
+    }
+    else if (attr->layer == TST_LAYER && attr->visible == TST_INVISIBLE) {
+        print_ok("callback (%s hide)", ev_name);
+    }
+    else {
+        print_ng("callback (%s)", ev_name);
+    }
+
+    return;
+}
+
+static void
+_syc_callback(const ico_syc_ev_e event,
+              const void *detail, void *user_data)
+{
+
+    switch (event) {
+    case ICO_SYC_EV_WIN_CREATE:
+        _check_win_info("ICO_SYC_EV_WIN_CREATE", (ico_syc_win_info_t *)detail);
+        break;
+    case ICO_SYC_EV_WIN_DESTROY:
+        _check_win_info("ICO_SYC_EV_WIN_DESTROY", (ico_syc_win_info_t *)detail);
+        break;
+    case ICO_SYC_EV_WIN_ACTIVE:
+        _check_win_info("ICO_SYC_EV_WIN_ACTIVE", (ico_syc_win_info_t *)detail);
+        break;
+    case ICO_SYC_EV_WIN_ATTR_CHANGE:
+        _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",
+                          (ico_syc_thumb_info_t *)detail);
+        break;
+    case ICO_SYC_EV_THUMB_CHANGE:
+        _check_thumb_info("ICO_SYC_EV_THUMB_CHANGE",
+                          (ico_syc_thumb_info_t *)detail);
+        break;
+    case ICO_SYC_EV_THUMB_UNMAP:
+        _check_thumb_info("ICO_SYC_EV_THUMB_UNMAP",
+                          (ico_syc_thumb_info_t *)detail);
+        break;
+    case ICO_SYC_EV_LAYER_ATTR_CHANGE:
+        _check_layer_attr("ICO_SYC_EV_LAYER_ATTR_CHANGE",
+                          (ico_syc_layer_attr_t *)detail);
+        break;
+    default:
+        break;
+    }
+
+    return;
+}
+
+/* test show window */
+static void
+tst_show(const char *appid, int surface, ico_syc_animation_t *animation)
+{
+    int ret;
+    char *func = "ico_syc_show";
+
+    ret = ico_syc_show(appid, surface, animation);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test hide window */
+static void
+tst_hide(const char *appid, int surface, ico_syc_animation_t *animation)
+{
+    int ret;
+    char *func = "ico_syc_hide";
+
+    ret = ico_syc_hide(appid, surface, animation);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test move window */
+static void
+tst_move(const char *appid, int surface,
+         ico_syc_win_move_t *move,
+         ico_syc_animation_t *animation, const char *type)
+{
+    int ret;
+    char *func = "ico_syc_move";
+
+    ret = ico_syc_move(appid, surface, move, animation);
+    if (ret != 0) {
+        print_ng("%s (%s) (ret: %d)", func, type, ret);
+        return;
+    } 
+    print_ok("%s (%s)", func, type);
+
+    return;
+}
+
+/* test change active window */
+static void
+tst_change_active(const char *appid, int surface)
+{
+    int ret;
+    char *func = "ico_syc_change_active";
+
+    ret = ico_syc_change_active(appid, surface);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test change window layer */
+static void
+tst_change_layer(const char *appid, int surface, int layer)
+{
+    int ret;
+    char *func = "ico_syc_change_layer";
+
+    ret = ico_syc_change_layer(appid, surface, layer);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test prepare thumbnail */
+static void
+tst_prepare_thumb(int surface, int framerate)
+{
+    int ret;
+    char *func = "ico_syc_prepare_thumb";
+
+    ret = ico_syc_prepare_thumb(surface, framerate);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    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)
+{
+    int ret;
+    char *func = "ico_syc_unmap_thumb";
+
+    ret = ico_syc_unmap_thumb(surface);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test show layer */
+static void
+tst_show_layer(int layer)
+{
+    int ret;
+    char *func = "ico_syc_show_layer";
+
+    ret = ico_syc_show_layer(layer);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test hide layer */
+static void
+tst_hide_layer(int layer)
+{
+    int ret;
+    char *func = "ico_syc_hide_layer";
+
+    ret = ico_syc_hide_layer(layer);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    return;
+}
+
+/* ------------------------------- */
+/* test main                       */
+/* ------------------------------- */
+static Eina_Bool
+ico_syc_winctl_test(void *data)
+{
+    const char *appid   = "org.test.app.testapp";
+    int surface         = 98765;
+    int layer           = 5;
+    ico_syc_win_move_t move, move_pos;
+    ico_syc_animation_t animation;
+
+    printf("\n");
+    printf("##### ico_syc_winctl API Test Start #####\n");
+
+    /* set move info (zone) */
+    move.zone = "center:bottom";
+    move.width = ICO_SYC_WIN_NOCHANGE;
+    move.height = 600;
+    /* set move info (position) */
+    move_pos.zone = NULL;
+    move_pos.pos_x = 10;
+    move_pos.pos_y = 20;
+    move_pos.width = 1024;
+    move_pos.height = ICO_SYC_WIN_NOCHANGE;
+
+    /* set animation data */
+    animation.name = "fade";
+    animation.time = 200;
+
+    /* window */
+    tst_show(appid, surface, &animation);
+    usleep(5000);
+    tst_hide(appid, surface, NULL);
+    usleep(5000);
+    tst_move(appid, surface, &move, &animation, "zone");
+    usleep(5000);
+    tst_move(appid, surface, &move_pos, NULL, "pos");
+    usleep(5000);
+    tst_change_active(appid, surface);
+    usleep(5000);
+    tst_change_layer(appid, surface, layer);
+
+    sleep(1);
+
+    /* thumbnail */
+    tst_prepare_thumb(surface, 200);
+    usleep(5000);
+    tst_map_thumb(surface);
+    usleep(5000);
+    tst_unmap_thumb(surface);
+
+    sleep(1);
+
+    /* layer */
+    tst_show_layer(layer);
+    usleep(5000);
+    tst_hide_layer(layer);
+
+    printf("##### ico_syc_winctl API Test End #####\n");
+    printf("\n");
+
+    return ECORE_CALLBACK_CANCEL;
+}
+
+/* ------------------------ */
+/* quit test callback       */
+/* ------------------------ */
+static Eina_Bool
+quit_test(void *data)
+{
+    ico_syc_disconnect();
+    ecore_main_loop_quit();
+
+    return ECORE_CALLBACK_CANCEL;
+}
+
+/* ----------------------------------------------- */
+/* Main                                            */
+/* ----------------------------------------------- */
+/* main */
+int
+main(int argc, char **argv)
+{
+    ecore_init();
+
+    ico_syc_connect(_syc_callback, NULL);
+
+    ecore_timer_add(1, ico_syc_winctl_test, NULL);
+    ecore_timer_add(5, quit_test, NULL);
+
+    ecore_main_loop_begin();
+    ecore_shutdown();
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/CicoBackground.cpp b/tests/system-controller/test-dummy-hs/CicoBackground.cpp
new file mode 100644 (file)
index 0000000..b99f8b2
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * 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   CicoBackground.cpp
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+#include <exception>
+#include <string>
+
+#include "CicoBackground.h"
+#include "CicoLog.h"
+
+/**
+ *  Default Constructor
+ */
+CicoBackground::CicoBackground(const Evas         *parent,
+                               const CicoGeometry &geometry,
+                               const CicoColor    &color)
+    : CicoEvasObject(parent, CicoEvasObject::OBJTYPE_RECTANGLE, geometry),
+      _color(color)
+{
+    ICO_DBG("CicoBackground::CicoBackground entry");
+
+    /* setup attribute background object */
+    /* set color */
+    setColor(color);
+
+    /* show object */
+    show();
+
+    ICO_DBG("CicoBackground::CicoBackground exit");
+}
+
+/**
+ *  Destructor
+ */
+CicoBackground::~CicoBackground()
+{
+    ICO_DBG("CicoBackground::~CicoBackground entry");
+    ICO_DBG("CicoBackground::~CicoBackground exit");
+}
+
+/**
+ *  Set background color
+ */
+void
+CicoBackground::setColor(const CicoColor &color)
+{
+    ICO_DBG("CicoBackground::setColor entry");
+    _color = color;
+    ICO_DBG("color(R:%03d G:%03d B:%03d A:%03d)",
+         _color._r, _color._g,
+         _color._b, _color._a);
+    evas_object_color_set(_object,
+                          _color._r, _color._g,
+                          _color._b, _color._a);
+    ICO_DBG("CicoBackground::setColor exit");
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/CicoBackground.h b/tests/system-controller/test-dummy-hs/CicoBackground.h
new file mode 100644 (file)
index 0000000..d838840
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * 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   CicoBackground.h
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+#include "CicoEvasObject.h"
+#include "CicoColor.h"
+
+#ifndef __CICO_BACKGROUND_H__
+#define __CICO_BACKGROUND_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+class CicoBackground : public CicoEvasObject {
+public:
+    /* Constructor */
+    CicoBackground(const Evas *parent,
+                   const CicoGeometry &geometry,
+                   const CicoColor &color);
+   
+    /* Destructor */
+    virtual ~CicoBackground();
+
+    /* Get this object geometry */
+    void setColor(const CicoColor &color);
+
+protected:
+    /* Default Constructor */
+    CicoBackground();
+    /* Assignment Operator */
+    CicoBackground& operator=(const CicoBackground &object);
+
+    /* Copy Constructor */
+    CicoBackground(const CicoBackground &object);
+
+private:
+    /* color of background object  */
+    CicoColor _color;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __CICO_BACKGROUND_H__ */
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/CicoBaseWin.cpp b/tests/system-controller/test-dummy-hs/CicoBaseWin.cpp
new file mode 100644 (file)
index 0000000..0f06165
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * 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   CicoBaseWin.cpp
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+#include <exception>
+#include <string>
+
+#include "CicoBaseWin.h"
+#include "CicoLog.h"
+//#include "Ecore_Wayland.h"
+//#include "Ecore.h"
+#include "Ecore_X.h"
+
+Ecore_Evas* CicoBaseWin::_window = NULL;
+
+static void
+_object_focus_in_cb(void *data,
+                    Evas *e,
+                    void *event_info)
+{
+    int x, y, w, h;
+    ICO_DBG("#####_object_focus_in_cb() called.");
+    /* show window */
+    ecore_evas_show(CicoBaseWin::_window);
+
+    ecore_evas_geometry_get (CicoBaseWin::_window, &x, &y, &w, &h);
+    ICO_DBG("#####_object_focus_in_cb(x=%d y=%d w=%d h=%d)", x, y, w, h);
+}
+
+static void
+_object_obj_focus_in_cb(void *data,
+                    Evas *e,
+                    void *event_info)
+{
+    ICO_DBG("$$$$$_object_obj_focus_in_cb() called.");
+}
+
+/**
+ *  Default Constructor
+ */
+CicoBaseWin::CicoBaseWin(const char *title,
+                         const CicoGeometry &geometry)
+    : //_window(NULL),
+      _geometry(geometry)
+{
+    ICO_DBG("CicoBaseWin::CicoBaseWin entry");
+
+    /* create window */
+    _window = ecore_evas_new(NULL, _geometry._x, _geometry._y,
+                             _geometry._w, geometry._h, "frame=0");
+    if (NULL == _window) {
+        ICO_ERR("ecore_evas_new() failed.");
+        throw std::string("ecore_evas_new() failed.");
+    }
+
+    /* get display screen size */ 
+//    ecore_main_loop_iterate();
+//    ecore_wl_screen_size_get(&_width, &_height);
+//    EAPI Ecore_X_Screen *screen = ecore_x_default_screen_get();
+//    ecore_x_screen_size_get(screen, &_width, &_height);
+//    _INFO("Display Screen Size(%dx%d)", _width, _height);
+
+    /* set callback on destroy */
+    ecore_evas_callback_destroy_set(_window, CicoBaseWin::onDestroy);
+
+    /* setup attribute window */
+    /* set title */
+    ecore_evas_title_set(_window, title);
+
+    /* enable alpha */
+    ecore_evas_alpha_set(_window, EINA_TRUE);
+
+    /* chanage window size */
+    ecore_evas_resize(_window, _geometry._w, geometry._h);
+
+    evas_event_callback_add(getEvas(), EVAS_CALLBACK_CANVAS_FOCUS_IN,
+                            _object_focus_in_cb, NULL);
+    evas_event_callback_add(getEvas(), EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
+                            _object_obj_focus_in_cb, NULL);
+
+    /* show window */
+    ecore_evas_show(_window);
+
+    ICO_DBG("CicoBaseWin::CicoBaseWin exit");
+}
+
+/**
+ *  Destructor
+ */
+CicoBaseWin::~CicoBaseWin()
+{
+    ICO_DBG("CicoBaseWin::~CicoBaseWin entry");
+    ICO_DBG("CicoBaseWin::~CicoBaseWin exit");
+}
+
+/**
+ *  Show
+ */
+void
+CicoBaseWin::show()
+{
+    ICO_DBG("CicoBaseWin::show entry");
+    ecore_evas_show(_window);
+    ICO_DBG("CicoBaseWin::show exit");
+}
+
+/**
+ * 
+ */
+Ecore_Evas*
+CicoBaseWin::getEcoreEvas(void) const
+{
+    return _window;
+}
+
+/**
+ * 
+ */
+Evas*
+CicoBaseWin::getEvas(void) const
+{
+    return ecore_evas_get(_window);
+}
+
+/**
+ *
+ */
+void CicoBaseWin::onDestroy(Ecore_Evas *window)
+{
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/CicoBaseWin.h b/tests/system-controller/test-dummy-hs/CicoBaseWin.h
new file mode 100644 (file)
index 0000000..5bd25dc
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * 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   CicoBaseWin.h
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+#include <stdio.h>
+#include <Ecore_Evas.h>
+
+#include "CicoGeometry.h"
+
+#ifndef __CICO_BASE_WIN_H__
+#define __CICO_BASE_WIN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+class CicoBaseWin {
+public:
+    // Default Constructor
+    CicoBaseWin(const char *title,
+                const CicoGeometry &geometry);
+    
+    // Destructor
+    virtual ~CicoBaseWin();
+
+    // Show Window
+    void show(void);
+
+    // Get instance of ecore_evas
+    Ecore_Evas* getEcoreEvas(void) const;
+
+    // Get instance of evas
+    Evas* getEvas(void) const;
+
+protected:
+    // Default Constructor
+    CicoBaseWin();
+    // Assignment Operator
+    CicoBaseWin& operator=(const CicoBaseWin &object);
+
+    // Copy Constructor
+    CicoBaseWin(const CicoBaseWin &object);
+
+private:
+    static void onDestroy(Ecore_Evas *window);
+
+
+public:
+    static Ecore_Evas *_window;
+private:
+
+    CicoGeometry _geometry;
+
+//    CicoBackground *_background;
+
+//    CicoImage *_bgImage;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __CICO_BASE_WIN_H__ */
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/CicoColor.cpp b/tests/system-controller/test-dummy-hs/CicoColor.cpp
new file mode 100644 (file)
index 0000000..02c3d5e
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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   CicoColor.cpp
+ *
+ *  @brief  Color Implementaion
+ */
+/*========================================================================*/    
+
+#include "CicoColor.h"
+
+/**
+ *  Default Constructor
+ */
+CicoColor::CicoColor(int r, int g, int b, int a)
+    : _r(r), _g(g), _b(b), _a(a)
+{
+}
+
+/**
+ *  Copy Constructor
+ */
+CicoColor::CicoColor(const CicoColor &object)
+{
+    _r = object._r;
+    _g = object._g;
+    _b = object._b;
+    _a = object._a;
+}
+
+
+/**
+ *  Destructor
+ */
+CicoColor::~CicoColor()
+{
+}
+
+/**
+ *  Assignment Operator
+ */
+CicoColor&
+CicoColor::operator=(const CicoColor& object)
+{
+    _r = object._r;
+    _g = object._g;
+    _b = object._b;
+    _a = object._a;
+
+    return *this;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/CicoColor.h b/tests/system-controller/test-dummy-hs/CicoColor.h
new file mode 100644 (file)
index 0000000..0d1b1ce
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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   CicoColor.h
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+#ifndef __CICO_COLOR_H__
+#define __CICO_COLOR_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+class CicoColor {
+public:
+    /**
+     *  Constructor
+     */
+    CicoColor(int r, int g, int b, int a);
+   
+    /**
+     *  Assignment Operator
+     */
+    CicoColor& operator=(const CicoColor &object);
+
+    /**
+     *  Destructor
+     */
+    ~CicoColor();
+
+    /**
+     *  Copy Constructor
+     */
+    CicoColor(const CicoColor &object);
+
+private:
+    /**
+     *  Default Constructor
+     */
+    CicoColor();
+public:
+    int _r;
+    int _g;
+    int _b;
+    int _a;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __CICO_COLOR_H__ */
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/CicoEFLApp.cpp b/tests/system-controller/test-dummy-hs/CicoEFLApp.cpp
new file mode 100644 (file)
index 0000000..491c14f
--- /dev/null
@@ -0,0 +1,338 @@
+/*
+ * 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   CicoEFLApp.cpp
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+#include <exception>
+#include <string>
+#include "Ecore.h"
+#include "CicoEFLApp.h"
+#include "CicoLog.h"
+
+/*========================================================================*/    
+app_event_callback_s CicoEFLApp::m_appEventCB = {
+    .create                = CicoEFLApp::app_create,
+    .terminate             = CicoEFLApp::app_terminate,
+    .pause                 = CicoEFLApp::app_pause,
+    .resume                = CicoEFLApp::app_resume,
+    .service               = CicoEFLApp::app_service,
+    .low_memory            = CicoEFLApp::app_low_memory,
+    .low_battery           = CicoEFLApp::app_low_battery,
+    .device_orientation    = CicoEFLApp::app_device_orientation,
+    .language_changed      = CicoEFLApp::app_language_changed,
+    .region_format_changed = CicoEFLApp::app_region_format_changed
+};
+
+/*========================================================================*/    
+/**
+ *  Default Constructor
+ */
+CicoEFLApp::CicoEFLApp()
+{
+    ICO_DBG("CicoEFLApp::CicoEFLApp Enter");
+    ICO_DBG("CicoEFLApp::CicoEFLApp Leave");
+}
+
+/**
+ *  Destructor
+ */
+CicoEFLApp::~CicoEFLApp()
+{
+    ICO_DBG("CicoEFLApp::~CicoEFLApp Enter");
+    ICO_DBG("CicoEFLApp::~CicoEFLApp Leave");
+}
+
+/**
+ *  Start Main Loop
+ */
+int
+CicoEFLApp::start(int argc, char **argv)
+{
+    ICO_DBG("CicoEFLApp::start Enter");
+#if 0
+    return app_efl_main(&argc, &argv, &m_appEventCB, this);
+#else
+    /* init ecore*/
+    if (0 == ecore_init()) {
+        ICO_DBG("CIcoUIApp::start Leave");
+        return 0;
+    }
+
+    if (false== onCreate(NULL)) {
+        ICO_DBG("CicoEFLApp::start Leave");
+        return 0;
+    }
+
+    ecore_main_loop_begin();
+    ICO_DBG("CicoEFLApp::start Leave");
+    return 0;
+#endif
+    ICO_DBG("CicoEFLApp::start Leave");
+}
+
+/**
+ *  Stop Main Loop
+ */
+int
+CicoEFLApp::stop(void)
+{
+    return 0;
+}
+
+const char*
+CicoEFLApp::app_error_to_string(int error)
+{
+    switch(error) {
+    case APP_ERROR_NONE:
+        return (const char*)"APP_ERROR_NONE";
+        break;
+    case APP_ERROR_INVALID_PARAMETER:
+        return (const char*)"APP_ERROR_INVALID_PARAMETER";
+        break;
+    case APP_ERROR_OUT_OF_MEMORY:
+        return (const char*)"APP_ERROR_OUT_OF_MEMORY";
+        break;
+    case APP_ERROR_INVALID_CONTEXT:
+        return (const char*)"APP_ERROR_INVALID_CONTEXT";
+        break;
+    case APP_ERROR_NO_SUCH_FILE:
+        return (const char*)"APP_ERROR_NO_SUCH_FILE";
+        break;
+    case APP_ERROR_ALREADY_RUNNING:
+        return (const char*)"APP_ERROR_ALREADY_RUNNING";
+        break;
+    default:
+        break;
+    }
+
+    return (const char*)"TIZEN_ERROR_UNKNOWN";
+}
+
+bool
+CicoEFLApp::onCreate(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onCreate called.");
+    return false;
+}
+
+void
+CicoEFLApp::onTerminate(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onTerminate called.");
+}
+
+void
+CicoEFLApp::onPause(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onPause called.");
+}
+
+void
+CicoEFLApp::onResume(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onResume called.");
+}
+
+void
+CicoEFLApp::onService(service_h service, void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onService called.");
+}
+
+void
+CicoEFLApp::onLowMemory(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onLowMemory called.");
+}
+
+void
+CicoEFLApp::onLowBattery(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onLowBattery called.");
+}
+
+void
+CicoEFLApp::onDeviceOrientation(app_device_orientation_e orientation,
+                                 void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onDeviceOrientation called.");
+}
+
+void
+CicoEFLApp::onLanguageChanged(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onLanguageChanged called.");
+}
+
+void
+CicoEFLApp::onRegionFormatChanged(void *user_data)
+{
+    ICO_WRN("CicoEFLApp::onRegionFormatChanged called.");
+}
+
+bool
+CicoEFLApp::app_create(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_create Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_create Leave");
+        return false;
+    }
+    
+    int ret = static_cast<CicoEFLApp*>(user_data)->onCreate(user_data); 
+
+    ICO_DBG("CicoEFLApp::app_create Leave(%d)", ret);
+
+    return ret;
+}
+
+void
+CicoEFLApp::app_terminate(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_terminate Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_terminate Leave");
+        return;
+    }
+    
+    static_cast<CicoEFLApp*>(user_data)->onTerminate(user_data); 
+
+    ICO_DBG("CicoEFLApp::app_terminate Leave");
+}
+
+void
+CicoEFLApp::app_pause(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_pause Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_pause Leave");
+        return;
+    }
+    
+    static_cast<CicoEFLApp*>(user_data)->onPause(user_data); 
+
+    ICO_DBG("CicoEFLApp::app_pause Leave");
+}
+
+void
+CicoEFLApp::app_resume(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_resume Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_resume Leave");
+        return;
+    }
+    
+    static_cast<CicoEFLApp*>(user_data)->onResume(user_data); 
+
+    ICO_DBG("CicoEFLApp::app_resume Leave");
+}
+
+void
+CicoEFLApp::app_service(service_h service, void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_service Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_service Leave");
+        return;
+    }
+    
+    static_cast<CicoEFLApp*>(user_data)->onService(service, user_data); 
+
+    ICO_DBG("CicoEFLApp::app_service Leave");
+}
+
+void
+CicoEFLApp::app_low_memory(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_low_memory Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_low_memory Leave");
+        return;
+    }
+
+    static_cast<CicoEFLApp*>(user_data)->onLowMemory(user_data); 
+    ICO_DBG("CicoEFLApp::app_low_memory Leave");
+}
+
+void
+CicoEFLApp::app_low_battery(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_low_battery Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_low_battery Leave");
+        return;
+    }
+    static_cast<CicoEFLApp*>(user_data)->onLowBattery(user_data); 
+
+    ICO_DBG("CicoEFLApp::app_low_battery Leave");
+}
+
+void
+CicoEFLApp::app_device_orientation(app_device_orientation_e orientation,
+                                   void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_device_orientation Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_device_orientation Leave");
+        return;
+    }
+    static_cast<CicoEFLApp*>(user_data)->onDeviceOrientation(orientation,
+                                                             user_data);
+
+    ICO_DBG("CicoEFLApp::app_device_orientation Leave");
+}
+
+void
+CicoEFLApp::app_language_changed(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_language_changed Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_device_orientation Leave");
+        return;
+    }
+    static_cast<CicoEFLApp*>(user_data)->onLanguageChanged(user_data);
+
+    ICO_DBG("CicoEFLApp::app_language_changed Leave");
+}
+
+void
+CicoEFLApp::app_region_format_changed(void *user_data)
+{
+    ICO_DBG("CicoEFLApp::app_region_format_changed Enter");
+
+    if (NULL == user_data) {
+        ICO_DBG("CicoEFLApp::app_device_orientation Leave");
+        return;
+    }
+    static_cast<CicoEFLApp*>(user_data)->onRegionFormatChanged(user_data);
+
+    ICO_DBG("CicoEFLApp::app_region_format_changed Leave");
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/CicoEFLApp.h b/tests/system-controller/test-dummy-hs/CicoEFLApp.h
new file mode 100644 (file)
index 0000000..052e626
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * 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   CicoEFLApp.h
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+#ifndef __CICO_EFL_APP_H__
+#define __CICO_EFL_APP_H__
+
+#include <app.h>
+
+class CicoEFLApp {
+public:
+    //  default constructor
+    CicoEFLApp();
+    /**
+     *  Destructor
+     */
+    virtual ~CicoEFLApp();
+
+    /**
+     *  Start Main Loop
+     */ int start(int argc, char **argv);
+
+    /**
+     *  Stop Main Loop
+     */
+    int stop(void);
+
+    /**
+     *  Convert application error to string
+     */
+    const char* app_error_to_string(int error);
+
+    virtual bool onCreate(void *user_data);
+    virtual void onTerminate(void *user_data);
+    virtual void onPause(void *user_data);
+    virtual void onResume(void *user_data);
+    virtual void onService(service_h service, void *user_data);
+    virtual void onLowMemory(void *user_data);
+    virtual void onLowBattery(void *user_data);
+    virtual void onDeviceOrientation(app_device_orientation_e orientation,
+                                     void *user_data);
+    virtual void onLanguageChanged(void *user_data);
+    virtual void onRegionFormatChanged(void *user_data);
+
+protected:
+    //  assignment operator
+    CicoEFLApp& operator=(const CicoEFLApp &object);
+
+    //  copy constructor
+    CicoEFLApp(const CicoEFLApp &object);
+
+private:
+    static bool app_create(void *user_data);
+    static void app_terminate(void *user_data);
+    static void app_pause(void *user_data);
+    static void app_resume(void *user_data);
+    static void app_service(service_h service, void *user_data);
+    static void app_low_memory(void *user_data);
+    static void app_low_battery(void *user_data);
+    static void app_device_orientation(app_device_orientation_e orientation,
+                                       void *user_data);
+    static void app_language_changed(void *user_data);
+    static void app_region_format_changed(void *user_data);
+
+private:
+    //  application callbacks
+    static app_event_callback_s m_appEventCB;
+};
+#endif  /* __CICO_EFL_APP_H__ */
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/CicoEvasObject.cpp b/tests/system-controller/test-dummy-hs/CicoEvasObject.cpp
new file mode 100644 (file)
index 0000000..f50d117
--- /dev/null
@@ -0,0 +1,196 @@
+/*
+ * 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   CicoEvasObject.cpp
+ *
+ *  @brief  Class implemetation of EvasObject Object
+ */
+/*========================================================================*/    
+
+#include <exception>
+#include <string>
+
+#include "CicoEvasObject.h"
+#include "CicoLog.h"
+//#include "Ecore_Wayland.h"
+
+/*------------------------------------------------------------------------*/
+/**
+ *  @brief  Constructor
+ *
+ *  @param  [IN]    parent      parent of this object
+ *  @param  [IN]    geometry    geometry of this object
+ */
+/*------------------------------------------------------------------------*/
+CicoEvasObject::CicoEvasObject(const Evas *parent,
+                               CicoEvasObject::ObjType type,
+                               const CicoGeometry &geometry)
+    : _parent((Evas*)parent),
+      _object(NULL),
+      _geometry(geometry)
+{
+    ICO_DBG("CicoEvasObject::CicoEvasObject Entry");
+
+    if (NULL == _parent) {
+        ICO_ERR("Invalid argument: _window is NULL");
+        throw std::string("_parent is NULL.");
+    }
+
+    /* create object */
+    switch (type) {
+    case OBJTYPE_RECTANGLE:
+        _object = evas_object_rectangle_add(_parent);
+        break;
+    case OBJTYPE_POLYGON:
+        _object = evas_object_polygon_add(_parent);
+        break;
+    case OBJTYPE_LINE:
+        _object = evas_object_line_add(_parent);
+        break;
+    case OBJTYPE_IMAGE:
+        _object = evas_object_image_add(_parent);
+        break;
+    case OBJTYPE_FILLED_IMAGE:
+        _object = evas_object_image_filled_add(_parent);
+        break;
+    case OBJTYPE_TEXT:
+        _object = evas_object_text_add(_parent);
+        break;
+    case OBJTYPE_TEXTBLOCK:
+        _object = evas_object_textblock_add(_parent);
+        break;
+    default:
+        _object = NULL;
+        break;
+    }
+
+    if (NULL == _object) {
+        ICO_ERR("create evas object failed. objtype=%d", type);
+        throw std::string("create evas object failed.");
+    }
+
+    /* setup attribute background object */
+    /* set object position */
+    move(geometry._x, geometry._y);
+
+    /* set object size */
+    resize(geometry._w, geometry._h);
+
+    ICO_DBG("CicoEvasObject::CicoEvasObject exit");
+}
+
+/**
+ *  Destructor
+ */
+CicoEvasObject::~CicoEvasObject()
+{
+    ICO_DBG("CicoEvasObject::~CicoEvasObject entry");
+    if (NULL != _object) {
+        evas_object_del(_object);
+        _object = NULL;
+    }
+    ICO_DBG("CicoEvasObject::~CicoEvasObject exit");
+}
+
+/**
+ *  Show
+ */
+void
+CicoEvasObject::show()
+{
+    ICO_DBG("CicoEvasObject::show entry");
+    evas_object_show(_object);
+    ICO_DBG("CicoEvasObject::show exit");
+}
+
+/**
+ *  Hide Background
+ */
+void
+CicoEvasObject::hide()
+{
+    ICO_DBG("CicoEvasObject::hide entry");
+    evas_object_hide(_object);
+    ICO_DBG("CicoEvasObject::hide exit");
+}
+
+
+/**
+ *  Get visible state
+ */
+bool
+CicoEvasObject::isVisible(void)
+{
+    return evas_object_visible_get(_object);
+}
+
+/**
+ *  Move Background
+ */
+void
+CicoEvasObject::move(int x, int y)
+{
+    ICO_DBG("CicoEvasObject::move entry");
+    evas_object_move(_object, x, y);
+    ICO_DBG("CicoEvasObject::move exit");
+}
+
+/**
+ *  Move Background
+ */
+void
+CicoEvasObject::resize(int w, int h)
+{
+    ICO_DBG("CicoEvasObject::resize entry");
+    evas_object_resize(_object, w, h);
+    ICO_DBG("CicoEvasObject::resize exit");
+}
+
+/**
+ *  Get geometry of this object
+ */
+const CicoGeometry&
+CicoEvasObject::getGeometry(void)
+{
+    ICO_DBG("CicoEvasObject::getGeometryentry entry");
+    evas_object_geometry_get(_object,
+                             &_geometry._x, &_geometry._y, 
+                             &_geometry._w, &_geometry._h);
+    ICO_DBG("CicoEvasObject::getGeometryentry exit");
+    return _geometry;
+}
+
+/* Get this evas object */
+Evas_Object*
+CicoEvasObject::getObject(void) const
+{
+    return _object; 
+}
+
+void
+CicoEvasObject::setClip(Evas_Object *clip)
+{
+    ICO_DBG("CicoEvasObject::getGeometryentry entry");
+    evas_object_clip_set(_object, clip);
+    ICO_DBG("CicoEvasObject::getGeometryentry exit");
+}
+
+/* Set this evas object */
+void
+CicoEvasObject::event_cb(void *data, Evas *evas, 
+                         Evas_Object *obj, void *event_info)
+{
+    ICO_DBG("CicoEvasObject::event_cb entry");
+    int *type = (int*)data;
+    ICO_DBG("event_type = %d", *type);
+    ICO_DBG("CicoEvasObject::event_cb exit");
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/CicoEvasObject.h b/tests/system-controller/test-dummy-hs/CicoEvasObject.h
new file mode 100644 (file)
index 0000000..04bd1b9
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * 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   CicoEvasObject.h
+ *
+ *  @brief  Class definition of evas object
+ */
+/*========================================================================*/    
+
+#include <Ecore_Evas.h>
+
+#include "CicoGeometry.h"
+
+#ifndef __CICO_EVAS_OBJECT_H__
+#define __CICO_EVAS_OBJECT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*------------------------------------------------------------------------*/
+/*
+ * Forward declaration
+ */
+/*------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------*/
+/**
+ *  @class  CiconEvasObject
+ *
+ *  @brief  This class provide common funciton of evas object 
+ */
+/*------------------------------------------------------------------------*/
+class CicoEvasObject {
+public:
+    typedef enum {
+        OBJTYPE_UNKNOWN      = 0,
+        OBJTYPE_RECTANGLE    = 1,
+        OBJTYPE_POLYGON      = 2,
+        OBJTYPE_LINE         = 3,
+        OBJTYPE_IMAGE        = 4,
+        OBJTYPE_FILLED_IMAGE = 5,
+        OBJTYPE_TEXT         = 6,
+        OBJTYPE_TEXTBLOCK    = 7,
+    } ObjType;
+
+public:
+    /* Destructor */
+    virtual ~CicoEvasObject();
+
+    /* Show this object */
+    void show(void);
+
+    /* Hide this object */
+    void hide(void);
+
+    /* Is visible this object */
+    bool isVisible(void);
+
+    /* Move this object */
+    void move(int x, int y);
+
+    /* Resize this object */
+    void resize(int w, int h);
+
+    /* Get this object geometry */
+    const CicoGeometry& getGeometry(void);
+
+    /* Set this object layer */
+    void setLayer(short l);
+
+    /* Get this object layer */
+    short getLayer(void) const;
+
+    /* Get this evas object */
+    Evas_Object* getObject(void) const;
+
+    /* Set this evas object */
+    void setClip(Evas_Object *clip);
+
+    /* Set this evas object */
+    static void event_cb(void *data,
+                         Evas *evas, 
+                         Evas_Object *obj,
+                         void *event_info);
+
+protected:
+    /* Default Constructor */
+    CicoEvasObject();
+    /* Constructor */
+    CicoEvasObject(const Evas *parent,
+                   CicoEvasObject::ObjType type,
+                   const CicoGeometry &geometry);
+
+    /* Assignment Operator */
+    CicoEvasObject& operator=(const CicoEvasObject &object);
+
+    /* Copy Constructor */
+    CicoEvasObject(const CicoEvasObject &object);
+
+protected:
+    /* parent object of this object */
+    Evas *_parent;
+
+    /* instance of this object */
+    Evas_Object *_object;
+
+    /* geometry of this object */
+    CicoGeometry _geometry;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __CICO_EVAS_OBJECT_H__ */
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/CicoGeometry.cpp b/tests/system-controller/test-dummy-hs/CicoGeometry.cpp
new file mode 100644 (file)
index 0000000..290c4c4
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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   CicoGeometry.cpp
+ *
+ *  @brief  Geometry Implementaion
+ */
+/*========================================================================*/    
+
+#include "CicoGeometry.h"
+
+/**
+ *  Default Constructor
+ */
+CicoGeometry::CicoGeometry(int x, int y, int w, int h)
+    : _x(x), _y(y), _w(w), _h(h)
+{
+}
+
+/**
+ *  Copy Constructor
+ */
+CicoGeometry::CicoGeometry(const CicoGeometry& object)
+{
+    _x = object._x;
+    _y = object._y;
+    _w = object._w;
+    _h = object._h;
+}
+
+
+/**
+ *  Destructor
+ */
+CicoGeometry::~CicoGeometry()
+{
+}
+
+/**
+ *  Assignment Operator
+ */
+CicoGeometry&
+CicoGeometry::operator=(const CicoGeometry& object)
+{
+    _x = object._x;
+    _y = object._y;
+    _w = object._w;
+    _h = object._h;
+
+    return *this;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/CicoGeometry.h b/tests/system-controller/test-dummy-hs/CicoGeometry.h
new file mode 100644 (file)
index 0000000..5abfdf2
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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   CicoGeometry.h
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+#ifndef __CICO_GEOMETRY_H__
+#define __CICO_GEOMETRY_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+class CicoGeometry {
+public:
+    /**
+     *  Constructor
+     */
+    CicoGeometry(int x, int y, int w, int h);
+   
+    /**
+     *  Assignment Operator
+     */
+    CicoGeometry& operator=(const CicoGeometry &object);
+
+    /**
+     *  Destructor
+     */
+    ~CicoGeometry();
+
+    /**
+     *  Copy Constructor
+     */
+    CicoGeometry(const CicoGeometry &object);
+
+private:
+    /**
+     *  Default Constructor
+     */
+    CicoGeometry();
+public:
+    int _x;
+    int _y;
+    int _w;
+    int _h;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __CICO_GEOMETRY_H__ */
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/CicoLog.cpp b/tests/system-controller/test-dummy-hs/CicoLog.cpp
new file mode 100644 (file)
index 0000000..4e51269
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * 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 <string>
+#include "CicoLog.h"
+
+CicoLog* CicoLog::ms_myInstance = NULL;
+int  CicoLog::m_sTimeZone = 99*60*60;
+
+CicoLog::CicoLog()
+    : m_logLevel(0x7fffffff), m_flushMode(true), m_initialized(false),
+      m_sDbgFd(NULL), m_sDbgLines(0)
+{
+    memset(&m_sDbgProg[0], 0, sizeof(m_sDbgProg));
+}
+
+CicoLog::~CicoLog()
+{
+    closeLog();
+}
+
+CicoLog*
+CicoLog::getInstance(void)
+{
+    if (NULL == ms_myInstance) {
+        ms_myInstance = new CicoLog();
+    }
+    return ms_myInstance;
+}
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   ico_apf_log_print: printout log message
+ *
+ * @param[in]   fmt     message format(same as printf)
+ * @param[in]   ...     arguments if need
+ * @return      nothing
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoLog::printLog(int loglevel, const char *fmt, ...)
+{
+    if (m_logLevel < loglevel) {
+        return;
+    }
+    va_list     list;
+
+    if (! m_sDbgFd)   {
+        openLog(NULL);
+    }
+#if ICO_APF_LOG_STDOUT == 0
+    else if (m_sDbgLines >= (ICO_LOG_MAXLINES-2)) {
+        if (m_sDbgLines >= ICO_LOG_MAXLINES)  {
+            closeLog();
+            openLog(m_sDbgProg);
+        }
+        else    {
+            fflush(m_sDbgFd);
+        }
+    }
+#endif /*ICO_APF_LOG_STDOUT*/
+    if (m_sDbgFd) {
+        va_start(list, fmt);
+        vfprintf(m_sDbgFd, fmt, list);
+        va_end(list);
+        if (m_flushMode)  {
+            fflush(m_sDbgFd);
+        }
+    }
+    if (m_sDbgFd != stdout)   {
+        m_sDbgLines ++;
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   open: open log file
+ *
+ * @param[in]   prog    program name
+ * @return      nothing
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoLog::openLog(const char *prog)
+{
+#if ICO_LOG_STDOUT == 0
+    int     idx;
+    char    sPath[128];
+    char    sPath2[128];
+#endif /*ICO_LOG_STDOUT*/
+
+    if (m_sDbgFd) {
+        fflush(m_sDbgFd);
+        if (m_sDbgFd != stdout)   {
+            fclose(m_sDbgFd);
+        }
+    }
+
+    m_sDbgLines = 0;
+
+    if ((! prog) || (*prog == 0))   {
+        m_sDbgFd = stdout;
+        m_sDbgProg[0] = 0;
+        return;
+    }
+    else    {
+        strncpy(m_sDbgProg, prog, sizeof(m_sDbgProg)-1);
+        m_sDbgProg[sizeof(m_sDbgProg)-1] = 0;
+    }
+#if ICO_LOG_STDOUT > 0
+    m_sDbgFd = stdout;
+#else  /*ICO_LOG_STDOUT*/
+    snprintf(sPath, sizeof(sPath)-1, "%s/%s.log%d",
+             ICO_LOG_DIR, m_sDbgProg, 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, m_sDbgProg, idx-1);
+        }
+        else    {
+            snprintf(sPath, sizeof(sPath)-1, "%s/%s.log",
+                     ICO_LOG_DIR, m_sDbgProg);
+        }
+        (void) rename(sPath, sPath2);
+    }
+    m_sDbgFd = fopen(sPath, "w");
+    if (! m_sDbgFd)   {
+        m_sDbgFd = stdout;
+    }
+    else if ((m_initialized == false) &&
+             (m_sDbgFd != stdout) && (m_sDbgFd != stderr))  {
+        m_initialized = true;
+        fflush(stdout);
+        fflush(stderr);
+        stdout = m_sDbgFd;
+        stderr = m_sDbgFd;
+    }
+#endif /*ICO_LOG_STDOUT*/
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   closeLog: close log file
+ *
+ * @param       nothing
+ * @return      nothing
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoLog::closeLog(void)
+{
+#if ICO_LOG_STDOUT == 0
+    if (m_sDbgFd) {
+        fflush(m_sDbgFd);
+        if (m_sDbgFd != stdout)   {
+            fclose(m_sDbgFd);
+        }
+        m_sDbgFd = (FILE *)0;
+    }
+#endif /*ICO_LOG_STDOUT*/
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief  flushLog: flush log file
+ *
+ * @param       nothing
+ * @return      nothing
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoLog::flushLog(void)
+{
+    if ((m_sDbgFd != NULL) && (m_flushMode == 0))   {
+        fflush(m_sDbgFd);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief   getStrCurtime: create current time string
+ *
+ * @param[in]   level   log level string(header of log message)
+ * @return      current time string
+ */
+/*--------------------------------------------------------------------------*/
+char *
+CicoLog::getStrCurTime(const char *level)
+{
+    struct timeval  NowTime;
+    extern long     timezone;
+    static char     sBuf[28];
+
+    gettimeofday(&NowTime, (struct timezone *)0);
+    if (m_sTimeZone > (24*60*60)) {
+        tzset();
+        m_sTimeZone = timezone;
+    }
+    NowTime.tv_sec -= m_sTimeZone;
+
+    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   setLogLevel: set log output level
+ *
+ * @param[in]   loglevel    log output level
+ * @return      nothing
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoLog::setLogLevel(const int loglevel)
+{
+    m_logLevel = loglevel & (~(ICO_LOG_FLUSH|ICO_LOG_NOFLUSH));
+
+    if (m_logLevel & (ICO_LOG_FLUSH|ICO_LOG_NOFLUSH))    {
+        if (m_logLevel & ICO_LOG_FLUSH)  {
+            m_flushMode = true;
+        }
+        else    {
+            m_flushMode = false;
+        }
+    }
+}
+// vim:set expandtab ts=4 sw=4:
diff --git a/tests/system-controller/test-dummy-hs/CicoLog.h b/tests/system-controller/test-dummy-hs/CicoLog.h
new file mode 100644 (file)
index 0000000..2c5a52a
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * 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
+ */
+
+#ifndef __CICO_LOG_H__
+#define __CICO_LOG_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>
+
+#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 one log file     */
+#define ICO_LOG_MAXFILES    6       /* Maximum number of the log file           */
+
+/* Log output level             */
+#define ICO_LOG_DEBUG       128     /* Debug write                              */
+#define ICO_LOG_INFO        64      /* Information                              */
+#define ICO_LOG_WARNING     16      /* Warning                                  */
+#define ICO_LOG_CRITICAL    8       /* Critical                                 */
+#define ICO_LOG_ERROR       4       /* 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,...)                                            \
+{                                                                   \
+    CicoLog::getInstance()->printLog(ICO_LOG_DEBUG,                 \
+                                     "%s> " fmt " (%s,%s:%d)\n",    \
+                                     CicoLog::getStrCurTime("DBG"), \
+                                     ##__VA_ARGS__,                 \
+                                     __func__,                      \
+                                     __FILE__,                      \
+                                     __LINE__);                     \
+}
+
+#define ICO_DBG(fmt,...)                                            \
+{                                                                   \
+    CicoLog::getInstance()->printLog(ICO_LOG_DEBUG,                 \
+                                     "%s> " fmt " (%s,%s:%d)\n",    \
+                                     CicoLog::getStrCurTime("DBG"), \
+                                     ##__VA_ARGS__,                 \
+                                     __func__,                      \
+                                     __FILE__,                      \
+                                     __LINE__);                     \
+}
+
+#define ICO_INF(fmt,...)                                            \
+{                                                                   \
+    CicoLog::getInstance()->printLog(ICO_LOG_INFO,                  \
+                                     "%s> " fmt " (%s,%s:%d)\n",    \
+                                     CicoLog::getStrCurTime("INF"), \
+                                     ##__VA_ARGS__,                 \
+                                     __func__,                      \
+                                     __FILE__,                      \
+                                     __LINE__);                     \
+}
+
+#define ICO_WRN(fmt,...)                                            \
+{                                                                   \
+    CicoLog::getInstance()->printLog(ICO_LOG_WARNING,               \
+                                     "%s> " fmt " (%s,%s:%d)\n",    \
+                                     CicoLog::getStrCurTime("WRN"), \
+                                     ##__VA_ARGS__,                 \
+                                     __func__,                      \
+                                     __FILE__,                      \
+                                     __LINE__);                     \
+}
+
+#define ICO_CRI(fmt,...)                                            \
+{                                                                   \
+    CicoLog::getInstance()->printLog(ICO_LOG_CRITICAL,              \
+                                     "%s> " fmt " (%s,%s:%d)\n",    \
+                                     CicoLog::getStrCurTime("CRI"), \
+                                     ##__VA_ARGS__,                 \
+                                     __func__,                      \
+                                     __FILE__,                      \
+                                     __LINE__);                     \
+}
+
+#define ICO_ERR(fmt,...)                                            \
+{                                                                   \
+    CicoLog::getInstance()->printLog(ICO_LOG_ERROR,                 \
+                                     "%s> " fmt " (%s,%s:%d)\n",    \
+                                     CicoLog::getStrCurTime("ERR"), \
+                                     ##__VA_ARGS__,                 \
+                                     __func__,                      \
+                                     __FILE__,                      \
+                                     __LINE__);                     \
+}
+
+class CicoLog
+{
+public:
+    CicoLog();
+
+    ~CicoLog();
+
+    static CicoLog* getInstance(void);
+
+    void printLog(int loglevel, const char *fmt, ...);
+
+    void openLog(const char *prog);
+
+    void closeLog(void);
+
+    void flushLog(void);
+
+    void setLogLevel(const int loglevel);
+
+    static char * getStrCurTime(const char *level);
+
+private:
+    static CicoLog* ms_myInstance;  //!< CicoLog Object
+    static int  m_sTimeZone;               //!< local time difference(sec)
+    int  m_logLevel;                //!< output level debug log
+    bool m_flushMode;               //!< flush mode flag
+    bool m_initialized;             //!< initialized flag
+    FILE *m_sDbgFd;                 //!< file descriptor of output debug log
+    int  m_sDbgLines;               //!< output lines
+    char m_sDbgProg[32];            //!< name of output source module
+};
+#endif  // __CICO_LOG_H__
+// vim:set expandtab ts=4 sw=4:
diff --git a/tests/system-controller/test-dummy-hs/CicoUISample.cpp b/tests/system-controller/test-dummy-hs/CicoUISample.cpp
new file mode 100644 (file)
index 0000000..ecc2aa7
--- /dev/null
@@ -0,0 +1,239 @@
+/*
+ * 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   CicoUISample.cpp
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+#include <exception>
+#include <iostream>
+#include <string>
+
+#include "CicoUISample.h"
+#include "CicoBaseWin.h"
+#include "CicoGeometry.h"
+#include "CicoBackground.h"
+#include "CicoColor.h"
+#include "CicoLog.h"
+#include "ico_syc_common.h"
+#include "ico_syc_privilege.h"
+
+
+CicoBackground* _background = NULL;
+CicoBackground* _controlbar = NULL;
+extern "C" {
+static void
+_syc_callback(const ico_syc_ev_e event,
+              const void *detail, void *user_data)
+{
+    switch (event) {
+    case ICO_SYC_EV_WIN_CREATE:
+    {
+        ICO_DBG("--- ICO_SYC_EV_WIN_CREATE "
+                "(appid[%s], name[%s], surface[%d])",
+               ((ico_syc_win_info_t *)detail)->appid,
+               ((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);
+               }
+
+        break;
+    }
+    case ICO_SYC_EV_WIN_DESTROY:
+        printf("--- ICO_SYC_EV_WIN_DESTROY ");
+        printf("(appid[%s], name[%s], surface[%d])\n",
+               ((ico_syc_win_info_t *)detail)->appid,
+               ((ico_syc_win_info_t *)detail)->name,
+               ((ico_syc_win_info_t *)detail)->surface);
+        break;
+    case ICO_SYC_EV_WIN_ACTIVE:
+        printf("--- ICO_SYC_EV_WIN_ACTIVE ");
+        printf("(appid[%s], name[%s], surface[%d])\n",
+               ((ico_syc_win_info_t *)detail)->appid,
+               ((ico_syc_win_info_t *)detail)->name,
+               ((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])",
+               ((ico_syc_win_attr_t *)detail)->appid,
+               ((ico_syc_win_attr_t *)detail)->name,
+               ((ico_syc_win_attr_t *)detail)->surface,
+               ((ico_syc_win_attr_t *)detail)->nodeid,
+               ((ico_syc_win_attr_t *)detail)->layer,
+               ((ico_syc_win_attr_t *)detail)->pos_x,
+               ((ico_syc_win_attr_t *)detail)->pos_y,
+               ((ico_syc_win_attr_t *)detail)->width,
+               ((ico_syc_win_attr_t *)detail)->height,
+               ((ico_syc_win_attr_t *)detail)->raise,
+               ((ico_syc_win_attr_t *)detail)->visible,
+               ((ico_syc_win_attr_t *)detail)->active);
+        break;
+    case ICO_SYC_EV_THUMB_PREPARE:
+        printf("--- ICO_SYC_EV_THUMB_PREPARE\n");
+        printf("\t(appid[%s], surface[%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)->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);
+        break;
+    case ICO_SYC_EV_THUMB_CHANGE:
+        printf("--- ICO_SYC_EV_THUMB_CHANGE\n");
+        printf("\t(appid[%s], surface[%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)->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);
+        break;
+    case ICO_SYC_EV_THUMB_UNMAP:
+        printf("--- ICO_SYC_EV_THUMB_UNMAP\n");
+        printf("\t(appid[%s], surface[%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)->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);
+        break;
+    case ICO_SYC_EV_LAYER_ATTR_CHANGE:
+        printf("--- ICO_SYC_EV_LAYER_ATTR_CHANGE ");
+        printf("(layer[%d], visible[%d])\n",
+               ((ico_syc_layer_attr_t *)detail)->layer,
+               ((ico_syc_layer_attr_t *)detail)->visible);
+        break;
+    default:
+        printf("--- UNKNOWN");
+        break;
+    }
+
+    return;
+}
+}
+
+/**
+ *  Default Constructor
+ */
+CicoUISample::CicoUISample()
+{
+    ICO_DBG("CicoUISample::CicoUISample Enter");
+    ICO_DBG("CicoUISample::CicoUISample Leave");
+}
+
+/**
+ *  Destructor
+ */
+CicoUISample::~CicoUISample()
+{
+    ICO_DBG("CicoUISample::~CicoUISample Enter");
+    ICO_DBG("CicoUISample::~CicoUISample Leave");
+}
+
+bool
+CicoUISample::onCreate(void *user_data)
+{
+    ICO_DBG("CicoUISample::onCreate Enter");
+
+    try {
+        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));
+        _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));
+    }
+    catch (const std::exception& e) {
+        std::cerr << e.what() << std::endl;
+        ICO_ERR("catch exception %s", e.what());
+        ICO_DBG("CicoUISample::onCreate Leave(false)");
+        return false;
+    }
+    catch (const std::string& str) {
+        std::cerr << str << std::endl;
+        ICO_ERR("catch exception %s", str.c_str());
+        ICO_DBG("CicoUISample::onCreate Leave(false)");
+        return false;
+    }
+    catch (...) {
+        ICO_ERR("catch exception unknown");
+        ICO_DBG("CicoUISample::onCreate Leave(false)");
+        return false;
+    }
+
+    ICO_DBG("CicoUISample::onCreate Leave(true)");
+
+    return true;
+}
+
+#if 0
+void
+CicoUISample::onTerminate(void *user_data)
+{
+    _DBG("CicoUISample::onTerminate entry");
+}
+
+void
+CicoUISample::onPause(void *user_data)
+{
+    _DBG("CicoUISample::onPause entry");
+}
+
+void
+CicoUISample::onResume(void *user_data)
+{
+    _DBG("CicoUISample::onResume entry");
+}
+
+void
+CicoUISample::onService(service_h service, void *user_data)
+{
+    _DBG("CicoUISample::onService entry");
+}
+#endif
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/CicoUISample.h b/tests/system-controller/test-dummy-hs/CicoUISample.h
new file mode 100644 (file)
index 0000000..e9b4ec5
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * 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   CicoUISample.h
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+//#include <app.h>
+#include <stdio.h>
+#include "CicoEFLApp.h"
+
+#ifndef __CICO_UI_SAMPLE_APP_H__
+#define __CICO_UI_SAMPLE_APP_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+class CicoUISample : public CicoEFLApp {
+public:
+    /**
+     *  Default Constructor
+     */
+    CicoUISample();
+    
+    /**
+     *  Destructor
+     */
+    virtual ~CicoUISample();
+
+    /**
+     *
+     */
+    virtual bool onCreate(void *user_data);
+#if 0
+    void onTerminate(void *user_data);
+    void onPause(void *user_data);
+    void onResume(void *user_data);
+    void onService(service_h service, void *user_data);
+#endif
+
+protected:
+    /**
+     *  Assignment Operator
+     */
+    CicoUISample& operator=(const CicoUISample &object);
+
+    /**
+     *  Copy Constructor
+     */
+    CicoUISample(const CicoUISample &object);
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __CICO_UI_SAMPLE_APP_H__ */
+/* vim:set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/Makefile.am b/tests/system-controller/test-dummy-hs/Makefile.am
new file mode 100644 (file)
index 0000000..478d5cc
--- /dev/null
@@ -0,0 +1,53 @@
+AM_CFLAGS = $(GCC_CFLAGS)
+AM_CPPFLAGS = $(GCC_CXXFLAGS)
+
+COMMON_LIBS = -L/usr/local/lib -lm -lwebsockets -lico-uxf-weston-plugin
+
+noinst_PROGRAMS   = \
+       DummyHomeScreen
+
+DummyHomeScreen_SOURCES =      \
+       CicoLog.cpp                             \
+       CicoBackground.cpp              \
+       CicoBaseWin.cpp                 \
+       CicoGeometry.cpp                \
+       CicoColor.cpp                   \
+       CicoEFLApp.cpp                  \
+       CicoEvasObject.cpp              \
+       CicoUISample.cpp                \
+       main.cpp
+
+DummyHomeScreen_CXXFLAGS =     \
+    @ECORE_CFLAGS@                     \
+    @EINA_CFLAGS@                      \
+       @ECOREEVAS_CFLAGS@              \
+       @EVAS_CFLAGS@                   \
+       @GLIB_CFLAGS@                   \
+       @AIL_CFLAGS@                    \
+       @BUNDLE_CFLAGS@                 \
+       @AUL_CFLAGS@                    \
+       @PKGMGR_CFLAGS@                 \
+       @WAYLANDCLIENT_CFLAGS@  \
+       @CAPIAPPFWAPPLICATION_CFLAGS@ \
+       -I/usr/include/ico-util \
+       -I/usr/include/ico-uxf-weston-plugin    \
+       -I../../../include
+
+DummyHomeScreen_LDADD =                \
+    @ECORE_LIBS@                       \
+    @EINA_LIBS@                                \
+       @ECOREEVAS_LIBS@                \
+       @EVAS_LIBS@                             \
+       @GLIB_LIBS@                             \
+       @AIL_LIBS@                              \
+       @BUNDLE_LIBS@                   \
+       @AUL_LIBS@                              \
+       @PKGMGR_LIBS@                   \
+       @WAYLANDCLIENT_LIBS@    \
+       @CAPIAPPFWAPPLICATION_LIBS@ \
+       -L/usr/lib                              \
+    -lico-uxf-weston-plugin \
+       -lico-util-com                  \
+       ../../../lib/apps-framework/libico-appfw.la
+
+CLEANFILES = $(BUILT_SOURCES)
diff --git a/tests/system-controller/test-dummy-hs/main.cpp b/tests/system-controller/test-dummy-hs/main.cpp
new file mode 100644 (file)
index 0000000..4811537
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * 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   main.cpp
+ *
+ *  @brief  
+ */
+/*========================================================================*/    
+
+#include <exception>
+#include <iostream>
+#include <string>
+
+#include "CicoUISample.h"
+#include "CicoLog.h"
+#include <Eina.h>
+
+int
+main(int argc, char **argv)
+{
+    eina_init();
+    eina_log_level_set(EINA_LOG_LEVEL_DBG);
+
+    try {
+        CicoLog::getInstance()->openLog("DummyHomeScreen"/*TOOD*/);
+
+        int ret = 0;
+        CicoUISample uiSample;
+
+        ret = uiSample.start(argc, argv);
+
+        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;
+        ICO_ERR("main: catch exception [%s]", e.what());
+    }
+    catch (const std::string& str) {
+        std::cerr << str << std::endl;
+        ICO_ERR("main: catch exception [%s]", str.c_str());
+    }
+    catch (...) {
+        ICO_ERR("main: catch exception unknown");
+    }
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/system-controller/test-dummy-hs/org.tizen.ico.dummy-homescreen.xml b/tests/system-controller/test-dummy-hs/org.tizen.ico.dummy-homescreen.xml
new file mode 100644 (file)
index 0000000..ff68621
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.dummy-homescreen" version="0.1.0-0" install-location="internal-only">
+       <label>dummy-homescreen</label>
+       <author email="" href=""> </author>
+       <description>ico dummy-homescreen</description>
+       <ui-application appid="org.tizen.ico.dummy-homescreen" exec="/usr/apps/org.tizen.ico.dummy-homescreen/bin/DummyHomeScreen" nodisplay="true" multiple="false" type="capp" taskmanage="false">
+               <label>dummy-homescreen</label>
+               <icon> </icon>
+       </ui-application>
+</manifest>
similarity index 77%
rename from kill_homescreen
rename to tool/kill_syscond.sh
index facbd8e..44feb3b 100755 (executable)
@@ -1,14 +1,13 @@
 #!/bin/sh
 killall ico_ictl-touch_egalax 2> /dev/null
 killall weston 2> /dev/null
-killall org.tizen.ico.homescreen 2> /dev/null
-
-killall HomeScreen 2> /dev/null
+killall IcoSysconDaemon 2> /dev/null
 
 sleep 2
 
-killall -9 org.tizen.ico.homescreen 2> /dev/null
+killall -9 DummyHomeScreen 2> /dev/null
 killall -9 HomeScreen 2> /dev/null
+killall -9 IcoSysconDaemon 2> /dev/null
 killall -9 weston 2> /dev/null
 killall -9 ico_ictl-touch_egalax 2> /dev/null
 
@@ -23,7 +22,11 @@ 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 GV3ySIINq7.GhostCluster 2> /dev/null
+killall -9 t8j6HTRpuz.MediaPlayer 2> /dev/null
+killall -9 WebProcess 2> /dev/null
 killall -9 WebProcess 2> /dev/null
+killall -9 ico-app-login 2> /dev/null
 kill -9 `ps ax | grep wrt_launchpad_daemon_candidate | grep -v grep | cut -c1-6` 2> /dev/null
 killall -9 WebProcess 2> /dev/null
 kill -9 `ps ax | grep wrt_launchpad_daemon_candidate | grep -v grep | cut -c1-6` 2> /dev/null
diff --git a/tool/start_syscond.sh b/tool/start_syscond.sh
new file mode 100755 (executable)
index 0000000..cb88dce
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# 1. Delete log file
+/bin/mkdir /var/log/ico > /dev/null 2>&1
+/bin/mkdir /tmp/ico > /dev/null 2>&1
+/bin/chmod -R 0777 /var/log/ico > /dev/null 2>&1
+/bin/chmod -R 0777 /tmp/ico > /dev/null 2>&1
+/bin/rm -f /var/log/ico/* /var/log/weston.log > /dev/null 2>&1
+/bin/rm -f /tmp/ico/* > /dev/null 2>&1
+/bin/rm -f /opt/share/crash/core.* > /dev/null 2>&1
+/usr/bin/pkg_initdb > /dev/null 2>&1
+/usr/bin/ail_initdb > /dev/null 2>&1
+
+# 2. Start Device Input Controller for eGalax TouchPanel
+#/usr/bin/ico_ictl-touch_egalax -t
+/usr/bin/ico_ictl-touch_egalax
+sleep 0.3
+
+# 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 --log=/var/log/ico/weston.log &
+       sync;sync
+fi
+
+/usr/bin/launch_app org.tizen.ico.system-controller &
diff --git a/update-exec.sh b/update-exec.sh
deleted file mode 100755 (executable)
index de5e05d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-
-#library(libico-app-fw)
-rm -fr /usr/lib/libico-app-fw-efl.*
-cp ico-app-framework/.libs/libico-app-fw-efl.so.0.0.5 /usr/lib
-ln -s /usr/lib/libico-app-fw-efl.so.0.0.5 /usr/lib/libico-app-fw-efl.so.0
-ln -s /usr/lib/libico-app-fw-efl.so.0.0.5 /usr/lib/libico-app-fw-efl.so
-chmod 0755 /usr/lib/libico-app-fw-efl.so.0.0.5
-rm -fr /usr/lib/libico-app-fw.*
-cp ico-app-framework/.libs/libico-app-fw.so.0.0.5 /usr/lib
-ln -s /usr/lib/libico-app-fw.so.0.0.5 /usr/lib/libico-app-fw.so.0
-ln -s /usr/lib/libico-app-fw.so.0.0.5 /usr/lib/libico-app-fw.so
-chmod 0755 /usr/lib/libico-app-fw.so.0.0.5
-
-#test tools
-rm -fr /usr/bin/ico_send_hscommand
-rm -fr /usr/bin/ico_send_inputevent
-rm -fr /usr/bin/ico_set_vehicleinfo
-cp test/ico_send_hscommand /usr/bin
-cp test/ico_send_inputevent /usr/bin
-cp test/ico_set_vehicleinfo /usr/bin
-chmod 0755 /usr/bin/ico_send_hscommand /usr/bin/ico_send_inputevent /usr/bin/ico_set_vehicleinfo
-
-#HomeScreen
-HOMESCREEN=org.tizen.ico.homescreen
-cp src/HomeScreen /usr/apps/$HOMESCREEN/bin/
-
-#StatusBar
-PKGNAME=org.tizen.ico.statusbar
-cp src/StatusBar /usr/apps/$PKGNAME/bin/
-
-#OnScreen
-PKGNAME=org.tizen.ico.onscreen
-cp src/OnScreen /usr/apps/$PKGNAME/bin/
-