aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfukubayashi.akio <fukubayashi.akio@genetec.co.jp>2019-06-03 17:59:13 +0900
committerfukubayashi.akio <fukubayashi.akio@genetec.co.jp>2019-06-03 17:59:13 +0900
commit98006b6538c5be44350746ec3756f004a5c68af8 (patch)
treef76ed8991d3837678c00722a23b779c4e2dcb67b
parentb6644e5cffa84e40d62e38f4ee0c14e64e0faf48 (diff)
Add boot sequence and multi ecu transfer
Signed-off-by: fukubayashi.akio <fukubayashi.akio@genetec.co.jp>
-rw-r--r--CMakeLists.txt31
-rw-r--r--LICENSE.MIT20
-rw-r--r--README.md10
-rwxr-xr-xautobuild/agl/autobuild65
-rwxr-xr-xautobuild/linux/autobuild65
-rwxr-xr-xchange_to_slave_mode.sh5
-rw-r--r--client/README39
-rw-r--r--client/communication.cpp86
-rw-r--r--client/communication.h64
-rw-r--r--client/extra/WindowManagerSampleApp.qml47
-rw-r--r--client/extra/WindowManagerSampleApp.qml.sample252
-rw-r--r--client/main.cpp99
-rw-r--r--client/main.cpp.sample292
-rw-r--r--client/qlibwindowmanager.cpp56
-rw-r--r--client/qlibwindowmanager.h69
-rw-r--r--client/qmlWindowManagerSampleApp.pro20
-rw-r--r--client/sample.qrc5
-rw-r--r--conf/areas.json85
-rw-r--r--conf/layers.json54
-rwxr-xr-xdeploy.sh11
-rw-r--r--doc/ApplicationGuide.md1220
-rw-r--r--doc/api-services-book.yml13
-rw-r--r--doc/parts/change_layout_seq.pngbin34698 -> 0 bytes
-rw-r--r--doc/parts/deactivate_window.pngbin44618 -> 0 bytes
-rw-r--r--doc/parts/example_split.pngbin223071 -> 0 bytes
-rw-r--r--doc/parts/hmi_framework_designed_seq_toyota.pngbin54198 -> 0 bytes
-rw-r--r--doc/parts/request_role.pngbin26503 -> 0 bytes
-rw-r--r--doc/parts/state_change_example.pngbin182038 -> 0 bytes
-rw-r--r--doc/parts/wm_area.pngbin12427 -> 0 bytes
-rw-r--r--doc/parts/wm_change_layout.pngbin86852 -> 0 bytes
-rw-r--r--doc/parts/wm_layer_stack.pngbin33482 -> 0 bytes
-rw-r--r--doc/parts/wm_software_stack.pngbin28935 -> 0 bytes
-rw-r--r--layers.json90
-rw-r--r--package/root/config.xml6
-rw-r--r--policy_manager/CMakeLists.txt18
-rw-r--r--policy_manager/config/layouts.json422
-rw-r--r--policy_manager/config/roles.json (renamed from policy_manager/db/roles.db)14
-rw-r--r--policy_manager/config/roles.json.zipc (renamed from policy_manager/db/roles.db.zipc)2
-rw-r--r--policy_manager/config/roles.json.zipc.split192
-rw-r--r--policy_manager/db/roles.db.zipc.split60
-rw-r--r--policy_manager/db/states.db174
-rw-r--r--policy_manager/policy_manager.cpp529
-rw-r--r--policy_manager/policy_manager.hpp47
-rw-r--r--policy_manager/stm/stm.c83
-rw-r--r--policy_manager/stm/stm.h106
-rw-r--r--policy_manager/stm/stm.h.bak233
-rw-r--r--policy_manager/stm/stub/stm_inner.c34
-rw-r--r--policy_manager/stm/zipc/CMakeLists.txt40
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedal.c117
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedal.h41
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedalState_func.c45
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedalState_func.h14
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_AppsLayer.c53
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_AppsLayer.h2
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_Apps_func.c10
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_Apps_func.h4
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState.c117
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState.h41
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState_func.c45
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState_func.h14
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen.c42
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen.h2
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen_func.c2
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen_func.h2
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrake.c117
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrake.h41
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrakeStatus_func.c45
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrakeStatus_func.h14
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomeScreen_func.c8
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomeScreen_func.h2
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomescreen.c48
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomescreen.h2
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OnScreen_func.c10
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OnScreen_func.h4
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OslMain.c106
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OslMain.h2
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_RelMain.c621
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_RelMain.h2
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_Restriction_func.c10
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_Restriction_func.h4
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode.c79
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode.h9
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode_func.c34
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode_func.h5
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_def.h2
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_func.c243
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_func.h4
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_var.c18
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_var.h10
-rwxr-xr-x[-rw-r--r--]policy_manager/stm/zipc/StateTransitionor/ZST_include.h20
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud.c179
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud.h41
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud_func.c50
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud_func.h14
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left.c179
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left.h41
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left_func.c49
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left_func.h14
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/master/layer/apps/Zmaster_apps_apps_main.c1456
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/master/layer/apps/Zmaster_apps_apps_main.h111
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/master/layer/apps/Zmaster_apps_master_apps_def.h15
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/master/layer/remote/Zmaster_remote_master_remote_def.h15
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/master/layer/remote/Zmaster_remote_remote.c229
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/master/layer/remote/Zmaster_remote_remote.h45
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1.c179
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1.h41
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1_func.c49
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1_func.h14
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2.c179
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2.h41
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2_func.c49
-rwxr-xr-xpolicy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2_func.h14
-rw-r--r--policy_manager/stm/zipc/stm_master_apps.c63
-rw-r--r--policy_manager/stm/zipc/stm_master_apps.h11
-rw-r--r--policy_manager/stm/zipc/stm_master_remote.c29
-rw-r--r--policy_manager/stm/zipc/stm_master_remote.h4
-rw-r--r--src/CMakeLists.txt15
-rw-r--r--src/applist.cpp49
-rw-r--r--src/applist.hpp1
-rw-r--r--src/config/areas.json306
-rw-r--r--src/config/connection.json48
-rw-r--r--src/config/old_roles.json68
-rw-r--r--src/config/timeout.json4
-rw-r--r--src/config/weston.json4
-rw-r--r--src/json_helper.cpp12
-rw-r--r--src/json_helper.hpp2
-rw-r--r--src/low_can_client.cpp187
-rw-r--r--src/low_can_client.hpp113
-rw-r--r--src/main.cpp375
-rw-r--r--src/pm_wrapper.cpp193
-rw-r--r--src/pm_wrapper.hpp3
-rw-r--r--src/request.cpp9
-rw-r--r--src/request.hpp35
-rw-r--r--src/util.cpp55
-rw-r--r--src/util.hpp12
-rw-r--r--src/window_manager.cpp1860
-rw-r--r--src/window_manager.hpp131
-rw-r--r--src/wm_client.cpp255
-rw-r--r--src/wm_client.hpp45
-rw-r--r--src/wm_connection.cpp845
-rw-r--r--src/wm_connection.hpp117
-rw-r--r--src/wm_layer.cpp14
-rw-r--r--src/wm_layer.hpp4
-rw-r--r--src/wm_layer_control.cpp448
-rw-r--r--src/wm_layer_control.hpp38
145 files changed, 11424 insertions, 3204 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a69a43..7cf640f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,6 +26,37 @@ set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE
find_package(PkgConfig REQUIRED)
include(GNUInstallDirs)
+macro(wlproto var_basename proto_xml_basename)
+ if("${WLSCAN}" STREQUAL "")
+ find_program(WLSCAN NAMES wayland-scanner)
+ endif()
+
+ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/protocol)
+ set(proto_dir "${CMAKE_CURRENT_SOURCE_DIR}/protocol")
+ elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../protocol)
+ set(proto_dir "${CMAKE_CURRENT_SOURCE_DIR}/../protocol")
+ else()
+ message(FATAL_ERROR "Could not find ${CMAKE_CURRENT_SOURCE_DIR}/protocol or ${CMAKE_CURRENT_SOURCE_DIR}/../protocol")
+ endif()
+
+ add_custom_command(
+ OUTPUT
+ ${proto_xml_basename}-protocol.c
+ #${proto_xml_basename}-server-protocol.h
+ ${proto_xml_basename}-client-protocol.h
+ MAIN_DEPENDENCY ${proto_dir}/${proto_xml_basename}.xml
+ COMMAND ${WLSCAN} code < ${proto_dir}/${proto_xml_basename}.xml > ${proto_xml_basename}-protocol.c
+ #COMMAND ${WLSCAN} server-header < ${proto_dir}/${proto_xml_basename}.xml > ${proto_xml_basename}-server-protocol.h
+ COMMAND ${WLSCAN} client-header < ${proto_dir}/${proto_xml_basename}.xml > ${proto_xml_basename}-client-protocol.h
+ )
+
+ set(${var_basename}_PROTO ${CMAKE_CURRENT_BINARY_DIR}/${proto_xml_basename}-protocol.c)
+ set(${var_basename}_CLIENT ${CMAKE_CURRENT_BINARY_DIR}/${proto_xml_basename}-client-protocol.h)
+ #set(${var_basename}_SERVER ${CMAKE_CURRENT_BINARY_DIR}/${proto_xml_basename}-server-protocol.h)
+
+ include_directories(${CMAKE_CURRENT_BINARY_DIR})
+endmacro()
+
set(SANITIZER_MODE "none" CACHE STRING "Build using a specific sanitizer (e.g. 'address', 'thread', 'leak', 'undefined'), depends on compiler; default none")
set(LINK_LIBCXX OFF CACHE BOOL "Link against LLVMs libc++")
diff --git a/LICENSE.MIT b/LICENSE.MIT
new file mode 100644
index 0000000..0f2dc0f
--- /dev/null
+++ b/LICENSE.MIT
@@ -0,0 +1,20 @@
+Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
index a52e791..17389a8 100644
--- a/README.md
+++ b/README.md
@@ -2,3 +2,13 @@ This is a WindowManager implementation for the AGL Project.
===========================================================
See http://docs.automotivelinux.org/docs/apis_services/en/dev/
+
+**NOTE**
+This Window Manager is master (meter cluster) mode by default.
+If use slave (IVI) mode, please execute sclipt `change_to_slave_mode.sh` on target as follows:
+```
+$ scp ./change_to_slave_mode.sh root@<target_ip_addr>:~
+$ ssh root@<target_ip_addr>
+# sync
+# ./change_to_slave_mode.sh
+```
diff --git a/autobuild/agl/autobuild b/autobuild/agl/autobuild
deleted file mode 100755
index b7f243c..0000000
--- a/autobuild/agl/autobuild
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/make -f
-# Copyright (C) 2015 - 2018 "IoT.bzh"
-# Author "Romain Forlot" <romain.forlot@iot.bzh>
-#
-# 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.
-
-THISFILE := $(lastword $(MAKEFILE_LIST))
-BUILD_DIR := $(abspath $(dir $(THISFILE))/../../build)
-DEST := ${BUILD_DIR}
-
-.PHONY: all clean distclean configure build package help update
-
-all: help
-
-help:
- @echo "List of targets available:"
- @echo ""
- @echo "- all"
- @echo "- clean"
- @echo "- distclean"
- @echo "- configure"
- @echo "- build: compilation, link and prepare files for package into a widget"
- @echo "- package: output a widget file '*.wgt'"
- @echo "- install: install in your ${CMAKE_INSTALL_DIR} directory"
- @echo ""
- @echo "Usage: ./autobuild/agl/autobuild package DEST=${HOME}/opt"
- @echo "Don't use your build dir as DEST as wgt file is generated at this location"
-
-clean:
- @([ -d ${BUILD_DIR} ] && make -C ${BUILD_DIR} ${CLEAN_ARGS} clean) || echo Nothing to clean
-
-distclean:
- @rm -rf ${BUILD_DIR}
-
-configure:
- @[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR}
- @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake ${CONFIGURE_ARGS} ..)
-
-build: configure
- @cmake --build ${BUILD_DIR} ${BUILD_ARGS} --target all
-
-package: build
- @mkdir -p ${BUILD_DIR}/$@/bin
- @mkdir -p ${BUILD_DIR}/$@/etc
- @mkdir -p ${BUILD_DIR}/$@/lib
- @mkdir -p ${BUILD_DIR}/$@/htdocs
- @mkdir -p ${BUILD_DIR}/$@/var
- @cmake --build ${BUILD_DIR} ${PACKAGE_ARGS} --target package
- @if [ "${DEST}" != "${BUILD_DIR}/$@" ]; then \
- mkdir -p ${DEST} && cp ${BUILD_DIR}/$@/*.wgt ${DEST}; \
- fi
-
-install: build
- @cmake --build ${BUILD_DIR} ${INSTALL_ARGS} --target install
-
diff --git a/autobuild/linux/autobuild b/autobuild/linux/autobuild
deleted file mode 100755
index 88dc032..0000000
--- a/autobuild/linux/autobuild
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/make -f
-# Copyright (C) 2015 - 2018 "IoT.bzh"
-# Author "Romain Forlot" <romain.forlot@iot.bzh>
-#
-# 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.
-
-THISFILE := $(lastword $(MAKEFILE_LIST))
-BUILD_DIR := $(abspath $(dir $(THISFILE))/../../build)
-DEST := ${BUILD_DIR}
-
-.PHONY: all clean distclean configure build package help update
-
-all: help
-
-help:
- @echo "List of targets available:"
- @echo ""
- @echo "- all"
- @echo "- clean"
- @echo "- distclean"
- @echo "- configure"
- @echo "- build: compilation, link and prepare files for package into a widget"
- @echo "- package: output a widget file '*.wgt'"
- @echo "- install: install in your ${CMAKE_INSTALL_DIR} directory"
- @echo ""
- @echo "Usage: ./autobuild/agl/autobuild package DEST=${HOME}/opt"
- @echo "Don't use your build dir as DEST as wgt file is generated at this location"
-
-clean:
- @([ -d ${BUILD_DIR} ] && make -C ${BUILD_DIR} ${CLEAN_ARGS} clean) || echo Nothing to clean
-
-distclean:
- @rm -rf ${BUILD_DIR}
-
-configure:
- @[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR}
- @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake ${CONFIGURE_ARGS} ..)
-
-build: configure
- @cmake --build ${BUILD_DIR} ${BUILD_ARGS} --target all
-
-package: build
- @mkdir -p ${BUILD_DIR}/$@/bin
- @mkdir -p ${BUILD_DIR}/$@/etc
- @mkdir -p ${BUILD_DIR}/$@/lib
- @mkdir -p ${BUILD_DIR}/$@/htdocs
- @mkdir -p ${BUILD_DIR}/$@/var
- @cmake --build ${BUILD_DIR} ${PACKAGE_ARGS} --target package
- @if [ "${DEST}" != "${BUILD_DIR}/$@" ]; then \
- mkdir -p ${DEST} && cp ${BUILD_DIR}/$@/*.wgt ${DEST}; \
- fi
-
-install: build
- @cmake --build ${BUILD_DIR} ${INSTALL_ARGS} --target preinstall
- @cmake -DBUILD_TYPE=Debug ${INSTALL_ARGS} -p ${BUILD_DIR}/cmake_install.cmake
diff --git a/change_to_slave_mode.sh b/change_to_slave_mode.sh
new file mode 100755
index 0000000..32a70ee
--- /dev/null
+++ b/change_to_slave_mode.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+sed -i.orig -e 's/\"mode\": \"master\"/\"mode\": \"slave\"/' /var/local/lib/afm/applications/windowmanager-service-2017/0.1/etc/connection.json
+
+
diff --git a/client/README b/client/README
deleted file mode 100644
index 95ab875..0000000
--- a/client/README
+++ /dev/null
@@ -1,39 +0,0 @@
-= Example Application for TMC AGL WindowManager Client Lib
-This is a example QML application that uses clients of the TMC WindowManager.
-
-== Dependencies
-* Qt5 + QtQuick (QML) with ivi-shell support
-
-== Build instructions
-Inside of an SDK environment run:
-
-----------------
-qmake
-make
-----------------
-
-* The binary should be installed somewhere in $PATH
-
-== Usage
-Run this application like follows:
-
-----------------
-qmlWindowManagerSampleApp $width $height $appLabel $colorName
-----------------
-
-.Note
-****************
-Depending on your environment you will need to set the following
-environment variable to instruct Qt to use the ivi-shell integration:
-`QT_WAYLAND_SHELL_INTEGRATION=ivi-shell`
-****************
-
-Starts the application with a surface the size $width x $height
-the Surface will request the label "$appLabel" and set its surface
-color "$colorName" e.g. red.
-
-Note, that although the application sets an initial window size, the
-window manager will send events to the application that instruct it to
-set the proper, requested size for the layout.
-
-// vim:set tw=72 ft=asciidoc:
diff --git a/client/communication.cpp b/client/communication.cpp
deleted file mode 100644
index 1acfdca..0000000
--- a/client/communication.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- *
- * 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 "communication.h"
-
-#include <QGuiApplication>
-#include <QDebug>
-
-communication::communication(QObject *parent) : QObject(parent)
-{
- this->quit = false;
-}
-
-communication::~communication()
-{
-}
-
-void communication::setWidth(const unsigned int &w)
-{
- this->width = w;
- emit widthChanged();
-}
-
-void communication::setHeight(const unsigned int &h)
-{
- this->height = h;
- emit heightChanged();
-}
-
-void communication::setColor(const QString &c)
-{
- this->color = c;
- emit colorChanged();
-}
-
-void communication::setAppName(const QString &a)
-{
- this->appName = a;
- emit appNameChanged();
-}
-
-void communication::setQuit(const bool &q)
-{
- this->quit = q;
- emit quitChanged();
- if(q)
- exit(EXIT_SUCCESS);
-}
-
-unsigned int communication::getWidth() const
-{
- return this->width;
-}
-
-unsigned int communication::getHeight() const
-{
- return this->height;
-}
-
-QString communication::getColor() const
-{
- return this->color;
-}
-
-QString communication::getAppName() const
-{
- return this->appName;
-}
-
-bool communication::getQuit() const
-{
- return this->quit;
-}
diff --git a/client/communication.h b/client/communication.h
deleted file mode 100644
index fd3072f..0000000
--- a/client/communication.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- *
- * 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 COMMUNICATION_H
-#define COMMUNICATION_H
-
-#include <QObject>
-
-class communication : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(unsigned int width WRITE setWidth READ getWidth NOTIFY widthChanged)
- Q_PROPERTY(unsigned int height WRITE setHeight READ getHeight NOTIFY heightChanged)
- Q_PROPERTY(QString color READ getColor WRITE setColor NOTIFY colorChanged)
- Q_PROPERTY(QString appName READ getAppName WRITE setAppName NOTIFY appNameChanged)
- Q_PROPERTY(bool quit READ getQuit WRITE setQuit NOTIFY quitChanged)
-
-public:
- explicit communication(QObject *parent = 0);
- virtual ~communication();
-
-public slots:
- void setWidth(const unsigned int &);
- void setHeight(const unsigned int &);
- void setColor(const QString&);
- void setAppName(const QString&);
- void setQuit(const bool&);
-
- unsigned int getWidth() const;
- unsigned int getHeight() const;
- QString getColor() const;
- QString getAppName() const;
- bool getQuit() const;
-
-signals:
- void widthChanged();
- void heightChanged();
- void colorChanged();
- void appNameChanged();
- void quitChanged();
-
-private:
- unsigned int width;
- unsigned int height;
- QString color;
- QString appName;
- bool quit;
-};
-
-#endif // COMMUNICATION_H
diff --git a/client/extra/WindowManagerSampleApp.qml b/client/extra/WindowManagerSampleApp.qml
deleted file mode 100644
index 0945af9..0000000
--- a/client/extra/WindowManagerSampleApp.qml
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- *
- * 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.
- */
-
-import QtQuick 2.2
-import QtQuick.Window 2.1
-import QtQuick.Layouts 1.1
-
-Window {
- id: screen
- width: COMM.width
- height: COMM.height
- color: COMM.color
- flags: Qt.FramelessWindowHint
- title: COMM.appName
- opacity: 0.99
- visible: true
-
- Timer {
- id: quitTimer
- interval: 2000
- repeat: false
- triggeredOnStart: false
- onTriggered: COMM.quit = true
- }
-
- Text {
- id: textArea
- color: "black"
- font.bold: true
- font.pointSize: 90
- anchors.centerIn: parent
- text: COMM.appName
- }
-}
diff --git a/client/extra/WindowManagerSampleApp.qml.sample2 b/client/extra/WindowManagerSampleApp.qml.sample2
deleted file mode 100644
index 1ffc071..0000000
--- a/client/extra/WindowManagerSampleApp.qml.sample2
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- *
- * 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.
- */
-
-import QtQuick 2.2
-import QtQuick.Window 2.1
-import QtQuick.Layouts 1.1
-
-Window {
- id: screen
- width: COMM.width
- height: COMM.height
- color: COMM.color
- flags: Qt.FramelessWindowHint
- title: COMM.appName
- opacity: 0.99
- visible: true
- signal created
-
- Timer {
- id: quitTimer
- interval: 2000
- repeat: false
- triggeredOnStart: false
- onTriggered: COMM.quit = true
- }
-
- Text {
- id: textArea
- color: "black"
- font.bold: true
- font.pointSize: 90
- anchors.centerIn: parent
- text: COMM.appName
- }
- onFrameSwapped: {
- created()
- }
-
-}
diff --git a/client/main.cpp b/client/main.cpp
deleted file mode 100644
index 3dc2e42..0000000
--- a/client/main.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- *
- * 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 <QDebug>
-#include <QDir>
-#include <QGuiApplication>
-#include <QQmlApplicationEngine>
-#include <QQmlContext>
-#include <QQuickView>
-#include <QQuickWindow>
-#include "communication.h"
-
-#include "qlibwindowmanager.h"
-
-int main(int argc, char *argv[]) {
- QGuiApplication app(argc, argv);
-
- qDebug() << QCoreApplication::arguments();
-
- if (QCoreApplication::arguments().count() < 5) {
- qWarning() << "Wrong parameters specified for the application. "
- "Please restart with correct parameters:"
- "width, height, name, color [port] [token]:\n\n"
- "/usr/bin/WindowManagerSampleApp/"
- "qmlWindowManagerSampleApp width height name color\n";
- exit(EXIT_FAILURE);
- }
-
- QString label = QCoreApplication::arguments().at(3);
-
- QLibWindowmanager* qwm = new QLibWindowmanager();
-
- QString token = "wm";
- int port = 1700;
- if(QCoreApplication::arguments().count() == 7){
- bool ok;
- port = QCoreApplication::arguments().at(5).toInt(&ok);
- if(ok == false){
- port = 1700;
- }
- else{
- token = QCoreApplication::arguments().at(6);
- }
- }
- const char* ctoken = token.toLatin1().data();
- if (qwm->init(port, ctoken) != 0) {
- exit(EXIT_FAILURE);
- }
-
- if (qwm->requestSurface(
- QCoreApplication::arguments().at(3).toLatin1().data()) != 0) {
- exit(EXIT_FAILURE);
- }
-
- qwm->set_event_handler(QLibWindowmanager::Event_SyncDraw, [qwm](char const *label) {
- fprintf(stderr, "Surface %s got syncDraw!\n", label);
- qwm->endDraw(label);
- });
- qwm->set_event_handler(QLibWindowmanager::Event_Active, [](char const *label) {
- fprintf(stderr, "Surface %s got activated!\n", label);
- });
- qwm->set_event_handler(QLibWindowmanager::Event_Visible, [](char const *label) {
- fprintf(stderr, "Surface %s got visible!\n", label);
- });
- qwm->set_event_handler(QLibWindowmanager::Event_FlushDraw, [](char const *label) {
- fprintf(stderr, "Surface %s got flushDraw!\n", label);
- });
-
- communication comm;
- comm.setWidth(QCoreApplication::arguments().at(1).toUInt());
- comm.setHeight(QCoreApplication::arguments().at(2).toUInt());
- comm.setAppName(label);
- comm.setColor(QCoreApplication::arguments().at(4));
-
- QQmlApplicationEngine engine;
- engine.rootContext()->setContextProperty("COMM", &comm);
-
- engine.load(
- QUrl(QStringLiteral("qrc:/extra/WindowManagerSampleApp.qml")));
- QObject *root = engine.rootObjects().first();
- QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
- QObject::connect(root, SIGNAL(frameSwapped()), qwm, SLOT(slotActivateSurface()));
-
- return app.exec();
-}
diff --git a/client/main.cpp.sample2 b/client/main.cpp.sample2
deleted file mode 100644
index 5d9cc44..0000000
--- a/client/main.cpp.sample2
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- *
- * 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 <QDebug>
-#include <QDir>
-#include <QGuiApplication>
-#include <QQmlApplicationEngine>
-#include <QQmlContext>
-#include <QQuickView>
-#include <QQuickWindow>
-#include "communication.h"
-
-#include "qlibwindowmanager.h"
-
-int main(int argc, char *argv[]) {
- QGuiApplication app(argc, argv);
-
- qDebug() << QCoreApplication::arguments();
-
- if (QCoreApplication::arguments().count() < 5) {
- qWarning() << "Wrong parameters specified for the application. "
- "Please restart with correct parameters:"
- "width, height, name, color [port] [token]:\n\n"
- "/usr/bin/WindowManagerSampleApp/"
- "qmlWindowManagerSampleApp width height name color\n";
- exit(EXIT_FAILURE);
- }
-
- QString label = QCoreApplication::arguments().at(3);
-
- QLibWindowmanager* qwm = new QLibWindowmanager();
-
- QString token = "wm";
- int port = 1700;
- if(QCoreApplication::arguments().count() == 7){
- bool ok;
- port = QCoreApplication::arguments().at(5).toInt(&ok);
- if(ok == false){
- port = 1700;
- }
- else{
- token = QCoreApplication::arguments().at(6);
- }
- }
- const char* ctoken = token.toLatin1().data();
- if (qwm->init(port, ctoken) != 0) {
- exit(EXIT_FAILURE);
- }
-
- if (qwm->requestSurface(
- QCoreApplication::arguments().at(3).toLatin1().data()) != 0) {
- exit(EXIT_FAILURE);
- }
-
- qwm->set_event_handler(QLibWindowmanager::Event_SyncDraw, [qwm](char const *label) {
- //qwm->endDraw(label);
- fprintf(stderr, "Surface %s got syncDraw!\n", label);
- });
- qwm->set_event_handler(QLibWindowmanager::Event_Active, [](char const *label) {
- fprintf(stderr, "Surface %s got activated!\n", label);
- });
-
- communication comm;
- comm.setWidth(QCoreApplication::arguments().at(1).toUInt());
- comm.setHeight(QCoreApplication::arguments().at(2).toUInt());
- comm.setAppName(label);
- comm.setColor(QCoreApplication::arguments().at(4));
-
- QQmlApplicationEngine engine;
- engine.rootContext()->setContextProperty("COMM", &comm);
-
- engine.load(
- QUrl(QStringLiteral("qrc:/extra/WindowManagerSampleApp.qml")));
- QObject *root = engine.rootObjects().first();
- QObject::connect(root, SIGNAL(created()), qwm, SLOT(slotActivateSurface()));
-
- return app.exec();
-}
diff --git a/client/qlibwindowmanager.cpp b/client/qlibwindowmanager.cpp
deleted file mode 100644
index e69f0ac..0000000
--- a/client/qlibwindowmanager.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- *
- * 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 "qlibwindowmanager.h"
-#include <unistd.h>
-
-int QLibWindowmanager::init(int port, char const *token) {
- return this->wm->init(port, token);
-}
-
-int QLibWindowmanager::requestSurface(const char *label) {
- applabel = label;
- return this->wm->requestSurface(label);
-}
-
-int QLibWindowmanager::activateSurface(const char *label) {
- return this->wm->activateSurface(label);
-}
-
-int QLibWindowmanager::deactivateSurface(const char *label) {
- return this->wm->deactivateSurface(label);
-}
-
-int QLibWindowmanager::endDraw(const char *label) { return this->wm->endDraw(label); }
-
-void QLibWindowmanager::set_event_handler(enum QEventType et,
- std::function<void(char const *label)> f) {
- LibWindowmanager::EventType wet = (LibWindowmanager::EventType)et;
- return this->wm->set_event_handler(wet, std::move(f));
-}
-
-void QLibWindowmanager::slotActivateSurface(){
- qDebug("%s",__FUNCTION__);
- this->activateSurface(applabel.c_str());
-}
-
-QLibWindowmanager::QLibWindowmanager(QObject *parent)
- :QObject(parent)
-{
- wm = new LibWindowmanager();
-}
-
-QLibWindowmanager::~QLibWindowmanager() { }
diff --git a/client/qlibwindowmanager.h b/client/qlibwindowmanager.h
deleted file mode 100644
index ed86a65..0000000
--- a/client/qlibwindowmanager.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- *
- * 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 QLIBWINDOWMANAGER_H
-#define QLIBWINDOWMANAGER_H
-#include <libwindowmanager.h>
-#include <functional>
- #include <QObject>
- #include <QUrl>
- #include <QVariant>
- #include <string>
- #include <vector>
-
-class QLibWindowmanager : public QObject{
-Q_OBJECT
-public:
- explicit QLibWindowmanager(QObject *parent = nullptr);
- ~QLibWindowmanager();
-
- QLibWindowmanager(const QLibWindowmanager &) = delete;
- QLibWindowmanager &operator=(const QLibWindowmanager &) = delete;
-
-public:
- using handler_fun = std::function<void(const char *)>;
-
- enum QEventType {
- Event_Active = 1,
- Event_Inactive,
-
- Event_Visible,
- Event_Invisible,
-
- Event_SyncDraw,
- Event_FlushDraw,
- };
-
- static QLibWindowmanager &instance();
-
- int init(int port, char const *token);
-
- // WM API
- int requestSurface(const char *label);
- int activateSurface(const char *label);
- int deactivateSurface(const char *label);
- int endDraw(const char *label);
- void set_event_handler(enum QEventType et, handler_fun f);
-
-public slots:
- void slotActivateSurface();
-
-private:
- LibWindowmanager* wm;
- std::string applabel;
- std::vector<int> surfaceIDs;
-};
-#endif // LIBWINDOWMANAGER_H
diff --git a/client/qmlWindowManagerSampleApp.pro b/client/qmlWindowManagerSampleApp.pro
deleted file mode 100644
index 3064d57..0000000
--- a/client/qmlWindowManagerSampleApp.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-TEMPLATE = app
-QT += qml quick
-CONFIG += c++11
-
-HEADERS += communication.h qlibwindowmanager.h
-
-SOURCES += main.cpp \
- communication.cpp qlibwindowmanager.cpp
-RESOURCES += sample.qrc
-
-INCLUDEPATH += $$[QT_SYSROOT]/usr/include/afb
-
-LIBS += -lwindowmanager
-#LIBS += -lsystemd
-LIBS += -lafbwsc
-#LIBS += -ljson-c
-
-target.path = /usr/bin/WindowManagerSampleApp
-
-INSTALLS += target
diff --git a/client/sample.qrc b/client/sample.qrc
deleted file mode 100644
index be79eb6..0000000
--- a/client/sample.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>extra/WindowManagerSampleApp.qml</file>
- </qresource>
-</RCC>
diff --git a/conf/areas.json b/conf/areas.json
deleted file mode 100644
index 03ddfe4..0000000
--- a/conf/areas.json
+++ /dev/null
@@ -1,85 +0,0 @@
-{
- "areas": [
- {
- "name": "fullscreen",
- "rect": {
- "x": 0,
- "y": 0,
- "w": 1080,
- "h": 1920
- }
- },
- {
- "name": "normal.full",
- "rect": {
- "x": 0,
- "y": 218,
- "w": 1080,
- "h": 1488
- }
- },
- {
- "name": "split.main",
- "rect": {
- "x": 0,
- "y": 218,
- "w": 1080,
- "h": 744
- }
- },
- {
- "name": "split.sub",
- "rect": {
- "x": 0,
- "y": 962,
- "w": 1080,
- "h": 744
- }
- },
- {
- "name": "software_keyboard",
- "rect": {
- "x": 0,
- "y": 962,
- "w": 1080,
- "h": 744
- }
- },
- {
- "name": "restriction.normal",
- "rect": {
- "x": 0,
- "y": 218,
- "w": 1080,
- "h": 1488
- }
- },
- {
- "name": "restriction.split.main",
- "rect": {
- "x": 0,
- "y": 218,
- "w": 1080,
- "h": 744
- }
- },
- {
- "name": "restriction.split.sub",
- "rect": {
- "x": 0,
- "y": 962,
- "w": 1080,
- "h": 744
- }
- },
- {
- "name": "on_screen",
- "rect": {
- "x": 0,
- "y": 218,
- "w": 1080,
- "h": 1488
- }
- }
- ]
-}
diff --git a/conf/layers.json b/conf/layers.json
deleted file mode 100644
index 539846a..0000000
--- a/conf/layers.json
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "description": "Layer mapping",
- "mappings": [
- {
- "name": "BackGroundLayer",
- "role" : "navigation|radio|music|video",
- "id_range_begin": 0,
- "id_range_end": 0,
- "comment": "Work Around: This is a special fallback layer that not stopping wayland event loop."
- },
- {
- "name": "FarHomeScreen",
- "role": "homescreen",
- "id_range_begin": 100,
- "id_range_end": 199,
- "comment": "FarHomeScreen is the part of HomeScreen. The z order of this layer is lower than NearHomeScreen"
- },
- {
- "name": "Apps",
- "role": "music|video|browser|radio|phone|navigation|map|hvac|settings|dashboard|poi|mixer|sdl|launcher|fallback",
- "id_range_begin": 1000,
- "id_range_end": 2999,
- "comment": "Application layer"
- },
- {
- "name": "NearHomeScreen",
- "role": "software_keyboard",
- "id_range_begin": 3000,
- "id_range_end": 3999,
- "comment": "NearHomeScreen is the part of HomeScreen. The usecase is used by software_keyboard etc"
- },
- {
- "name": "Popup",
- "role": "popup*",
- "id_range_begin": 4000,
- "id_range_end": 4999,
- "comment": "This layer is for popup application layer"
- },
- {
- "name": "Restriction",
- "role": "restriction",
- "id_range_begin": 5000,
- "id_range_end": 5999,
- "comment": "This layer is for restriction notification on driving. This is used by restriction role"
- },
- {
- "name": "OnScreen",
- "role": "^on_screen.*",
- "id_range_begin": 6000,
- "id_range_end": 6999,
- "comment": "System notification layer. For example, on_screen_low_battery_alert to notify user"
- }
- ]
-}
diff --git a/deploy.sh b/deploy.sh
new file mode 100755
index 0000000..d08f669
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+cd build
+source /opt/agl-sdk/6.0.0_toyota_special/environment-setup-aarch64-agl-linux
+make package
+if [ $? -eq 0 ]; then
+ scp package/windowmanager-service.wgt root@${1}:~
+ ssh root@${1} afm-util remove windowmanager-service@0.1
+ ssh root@${1} afm-util install windowmanager-service.wgt
+ ssh root@${1} sync
+ ssh root@${1} reboot
+fi \ No newline at end of file
diff --git a/doc/ApplicationGuide.md b/doc/ApplicationGuide.md
index 981bdbc..2240bb1 100644
--- a/doc/ApplicationGuide.md
+++ b/doc/ApplicationGuide.md
@@ -1,929 +1,757 @@
-# Window Manager Application Guide
-
-## Table of content
-
-- [Target reader of this document](#Target\ reader\ of\ this\ document)
-- [Overview](#Overview)
- - [Supported usecase](#Supported\ usecase)
-- [Getting Started](#Getting\ Started)
- - [Build](#Build)
- - [Install](#Install)
- - [Bitbake](#Bitbake)
- - [Enable to call Window Manager](#Enable\ to\ call\ Window\ Manager)
-- [Software Architecture](#Software\ Architecture)
-- [Sequence](#Sequence)
-- [API reference](#API\ reference)
- - [Request to Window Manager](#Request\ to\ Window\ Manager)
- - [Event from Window Manager](#Event\ from\ Window\ Manager)
- - [Client Library](#Client\ library)
-- [Sample code](#Sample\ code)
-- [Policy Manager](#Policy\ Manager)
- - [Enabling split](#Enabling\ split)
-- [Release Note](#Release\ Note)
-
-| Version | Author | Updated at |
-|:-:|:-:|:-:|
-| 0.8 | TOYOTA MOTOR CORPORATION| 22th/Feb/2019 |
+**Window Manager Application Guide**
+====
+<div align="right">Revision: 0.5</div>
+<div align="right">TOYOTA MOTOR CORPORATION</div>
+<div align="right">20th/Mar/2018</div>
* * *
+<div id="Table\ of\ content"></div>
+
+Table of content
+============
+- [Introduction](#Introduction)
+ - [Intended audience](#Intended\ audience)
+ - [Scope of this Document](#Scope\ of\ this\ Document)
+ - [Known Issues](#Known\ Issues)
+ - [External libraries](#External\ libraries)
+ - [Client Library](#Client\ Library)
+- [Concepts](#Concepts)
+ - [Layers](#Layers)
+ - [Surfaces](#Surfaces)
+- [Configuration](#Configuration)
+ - [Configuration Items](#Configuration\ Items)
+- [Building and Running](#Building\ and\ Running)
+ - [Dependencies](#Dependencies)
+ - [Build Configuration](#Build\ Configuration)
+- [Implementation Notes](#Implementation\ Notes)
+ - [Structure](#Structure)
+- [Sequence](#Sequence)
+- [Binding API](#Binding\ API)
+ - [LibWindowmanager](#LibWindowmanager)
+ - [Methods](#Methods)
+ - [Errors](#Errors)
+ - [Usage](#Usage)
+ - [Events](#Events)
+- [Sample](#Sample)
-## Target reader of this document
-
-This document is intended for developers and system integrators who
-need to know, how Window manager works and how it is to be used.
-
-### Scope of this Document
-
-This document covers Window manager that was implemented for TMC and
-delivered to the Automotive Grade Linux (AGL) project. It includes its
-implementation details, concepts of operation, configuration and usage.
-
-It does not include
-
-- document of the underlying architecture, see
- [HMI-Framework](https://wiki.automotivelinux.org/hmiframework).
-
-- document of the AGL application framework and its technologies,
- see [AGL Application
- Framework](https://wiki.automotivelinux.org/agl-distro/app-framework).
-
-- document of HomeScreen, see
- [HomeScreen](./3_1-HomeScreen-Guide.html).
-
-It is highly recommended to have a good understanding of these documents
-and projects before using Window manager.
-* * *
+<div id="Introduction"></div>
-# Overview
+Introduction
+============
-Window Manager is the service process which provides window management based on policy.
-And implements a layout switching of applications on
+This window manager implements simple layout switching of applications on
multiple layers and with different layer layouts.
-Window Manager is based on ivi layer management from GENIVI and AGL application framework.
-
-Window Manager consists of
-
-- afb-binder
-- service binding library
-- shared library for policy management
-- configuration files
-
-In order to understand Window Manager, the below figure shows the one of typical usecases.
-In this example, there are two mode for window management.
-
-1. Window Management in `Car Stops`
-1. Window Management in `Car Runs`
-![Figure: Typical usecase](parts/state_change_example.png)
+<div id="Intended\ audience"></div>
-The important points are:
+Intended audience
+-----------------
-- Window transition should be done by Window Manager
-
- Window Manager switch application displayed on top layer by user operation(touch shortcut button).
- In this example, when an user touches `navigation` shortcut button, Window Manager displays `navigation` and hide `launcher`. Next, when an user touches `videoplayer` shortcut button, Window Manager divides a screen into two parts and display two applications.
-
-- There is a priority `role` for each application.
-
- Window Manager realizes state transition change based on the policy which consists of `role`.
- According to the state transition table, it controls the visibility of application window, layout change, and so on.
- The reasons why this is necessary are
-
-- to support user driving
-- not to disturb a driver concerns on driving for safety
+This document is intended for developers and system integrators who
+need to know, how the window manager works and how it is to be used.
- In this example, for safety, when the car starts running, Window Manager set up the role `videoplayer`
- to be masked and uncontrollable by user not to disturb driver concerns.
- And, for supporting driving, set up `navigation` role to be displayed 3 seconds after the car ran.
- In `Car Run` state, the user can't switch to other application from Navigation application until car stops.
+<div id="Scope\ of\ this\ Document"></div>
-## Supported usecase
+Scope of this Document
+----------------------
-1. Window Management
-- When an user chooses a different application, Window Manager changes the layout and then displays the application.
-- When an user chooses a different application, Window Manager changes the layout and then hides the displayed application.
-2. Policy Management
-- Window Manager changes layout according to policy table based on `role`.
-3. Define Layout by `area` configuration
-- Window Manager realizes the abstracted `area` and can resize the window by using it. User can easily edit this configuration.
+This document covers the window manager that was implemented for TMC and
+delivered to the Automotive Grade Linux (AGL) project. It includes its
+implementation details, concepts of operation, configuration and usage.
-* * *
+It does not include
-## Getting Started
+- document of the underlying architecture, see
+ [HMI-Framework](https://wiki.automotivelinux.org/hmiframework).
-### Build by SDK
+- document of the AGL application framework and its technologies,
+ see [AGL Application
+ Framework](https://wiki.automotivelinux.org/agl-distro/app-framework).
-```bash
-git clone https://gerrit.automotivelinux.org/gerrit/apps/agl-service-windowmanager
-cd agl-service-windowmanager
-mkdir build
-cd build
-source <your SDK path> // normally this is /opt/agl-sdk/environment
-cmake ..
-make
-make package
-```
+It is highly recommended to have a good understanding of these documents
+and projects before using the window manager.
-The widget package is populated in the 'package' directory.
+<div id="Known\ Issues"></div>
-```bash
-ls package/
-root windowmanager-service.wgt
-```
+Known Issues
+------------
-### Install
+Currently there is a one known issues:
-Copy windowmanager-service.wgt to the file system then execute the following command.
+- Only single-surface Qt applications are support through the
+ libwindowmanager library. This is a limitation of how Qt creates surface
+ IDs for the ivi-application interface.
-```bash
-afm-util install windowmanager-service.wgt
-```
+<div id="External\ libraries"></div>
-## Bitbake
+External libraries
+------------------
-You can make Window Manager object files with the following two stage operations.
+This project includes a copy of version 2.1.1 the excellent [C++11 JSON
+library by Niels Lohmann](https://github.com/nlohmann/json).
-### Download recipe
+<div id="Client\ Library"></div>
-```bash
-mkdir WORK
-cd WORK
-repo init -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo
-repo sync
-```
+Client Library
+--------------
-### Execute Bitbake
+A client library implementation that internally uses the *libafbwsc*, is
+provided in the `libwindowmanager`.
-```bash
-source meta-agl/scripts/aglsetup.sh -m m3ulcb agl-demo hmi-framework
-bitbake agl-demo-platform
-```
+<div id="Concepts"></div>
-* * *
+Concepts
+========
-## Enable to call Window Manager
+The window manager implements a couple of concepts in order to allow
+efficient implementation.
-To call Window Manager, it is important to enable the permission from security framework.
-To use Window Manager API, an application or a service shall add the following configuration definition into "config.xml" of your application.
+<div id="Layers"></div>
-```xml
-<feature name="urn:AGL:widget:required-api">
- <param name="windowmanager" value="ws" />
-</feature>
-```
+Layers
+------
-To call Window Manager function easily, Window Manager provides a library which is called "libwindowmanager".
-This library provides a function style API calling interface.
-So you can include the libwindowmanager.hpp header file, and can link against this library.
-Please also refer to the sample application.
+Layers are entities that are stacked on top of each other. Each layer
+has an ID which is used for the ivi-controller interface, but this ID
+also implicitly specifies its stacking order, from lowest to highest.
-See also our [Sample code](#Sample\ code).
+Layers are always full-screen. We do not use layer dimensions as a way
+to setup the scene, rather - each layer has a layout attached to it,
+which specifies an area that is used by surfaces to draw on.
-* * *
+Additionally, layers will generally leave surfaces on below layers
+activated, and only disable surfaces on layers the are above the
+currently used layer.
-## Software Architecture
+It is possible to deactivate these surfaces on lower layers explicitly
+using the `DeactivateSurface` API call.
-The static relationship with other components is shown below.
-The actual logic of Window Manager is the binding in Binder(afb-daemon).
-Window Manager is based on AGL application framework,
-so the IPC via websocket is protected by AGL application framework.
+<div id="Surfaces"></div>
-The upper binder is for the application side security context.
-The lower binder is the Window Manager for the server side security context.
-Usually an application side binder has some business logic for each application, so the number of binders depend on the number of applications which use Window Manager.
-On the other hand, regarding lower binder there is only one module in the system. This binder receives messages from multiple applications.
+Surfaces
+--------
-An application can use libwindowmanager.so to call Window Manager API simply.
+Surfaces are *placed* on layers according to their name. The surface
+will then be resized to dimensions, according to the layer's layout
+configuration.
-Window Manager is based on the GENIVI layer management system.
-![wm_software_stack.png](parts/wm_software_stack.png)
+<div id="Configuration"></div>
-### Layers
+Configuration
+=============
-Layers are entities that means the application stack group defined in `layers.json`.
-This doesn't mean layer ID defined in GENIVI ivi layer.
-The layer ID is used for application itself in Window Manager.
-Currently, application can't have multiple surfaces in Window Manager.
+The window manager is configured with the *layers.json* configuration
+file, by default it is searched in `${AFM_APP_INSTALL_DIR}/etc/layers.json`.
+Note, that the window manager will use default configuration unless this configuration is found.
-### Surfaces
+A sample configuration is provided with the window manager
+implementation, this sample is installed to ${AFM_APP_INSTALL_DIR}/etc/layers.json.
-Surfaces are *placed* on layers . The surface
-will then be resized to dimensions, according to the name of `areas.json`
-application requests by `activateWindow` or policy management.
-As default, `normal.full` is set by libwindowmanager for native application.
+Note:
+Currently, window manager doesn't block the application displaying because "Fallback" is set by default. If the "Fallback" is not set in layers.json, window manager blocks the application displaying. In such a situation, you have to add your role(application name) at "role" in layers.json.
-### Configuration
+<div id="Configuration\ Items"></div>
-The window manager is configured with the *layers.json*, *areas.json*, *roles.db* configuration
-files. By default they are searched in `${AFM_APP_INSTALL_DIR}/etc/`.
+Configuration Items
+-------------------
-Sample configurations are provided with the window manager
-implementation, these samples are installed to ${AFM_APP_INSTALL_DIR}/etc/ .
+This section describes configuration items available through
+`layers.json`. It will do this, by first providing an example, and then
+going into its components.
-This configuration is supposed to be configured by policy designer which means OEM or Tier1.
+### main\_surface
-#### layers.json
+ "main_surface": {
+ "surface_role": "HomeScreen",
+ },
-`layers.json` has three roles.
+The `main_surface` object describes a surface that will internally be
+treated as the main surface - usually this mean *HomeScreen*. The only
+special handling this surface receives, is that it is not allowed to
+deactivate it. Placement of this surface on an layer is done by the
+other configuration described below.
-1. Create application containers `Layer`.
-1. Set id range for applications.
-1. Attach application to `Layer` according to the role application requests.
+- `surface_role` this configuration item specifies the name of the
+ main surface. Set this to e.g. `HomeScreen`.
-The sample configuration is here
+### mappings
-```json
-{
- "comment": "Surface ID to Layer ID mapping",
+This configuration item is a list of surface-name to layer mappings.
- "main_surface": {
- "surface_role": "HomeScreen",
- "comment": "This surface should never be made invisible (The HomeScreen)"
- },
+#### surface to layer mapping
- "mappings": [
- {
- "role": "BackGroundLayer",
- "name": "BackGroundLayer",
- "layer_id": 999,
- "comment": "Single BackGround layer map for the map, radio, music and video"
- },
+ "mappings": [
{
- "role": "homescreen",
- "name": "FarHomeScreen",
+ "role": "^HomeScreen$",
+ "name": "HomeScreen",
"layer_id": 1000,
- "comment": "FarHomeScreen is the part of HomeScreen. The z order of this layer is lower than NearHomeScreen"
+ "area": { "type": "full" },
+ "comment": "Single layer map for the HomeScreen"
},
{
- "role": "music|video|browser|radio|phone|map|hvac|settings|dashboard|poi|mixer|sdl|launcher|fallback",
- "name": "Apps",
+ "role": "MediaPlayer|Radio|Phone|Navigation|HVAC|Settings|Dashboard|POI|Mixer",
+ "name": "apps",
"layer_id": 1001,
- "comment": "Range of IDs that will always be placed on layer 1001"
+ "area": { "type": "rect", "rect": { "x": 0, "y": 218, "width": -1, "height": -433 } },
+ "comment": "Range of IDs that will always be placed on layer 1001, negative rect values are interpreted as output_size.dimension - $value",
+
+ "split_layouts": [
+ {
+ "name": "Navigation",
+ "main_match": "Navigation",
+ "sub_match": "HVAC|MediaPlayer",
+ "priority": 1000
+ }
+ ]
},
{
- "role": "^on_screen.*",
- "name": "OnScreen",
+ "role": "^OnScreen.*",
+ "name": "popups",
"layer_id": 9999,
- "comment": "Range of IDs that will always be placed on the OnScreen layer, that gets a very high 'dummy' id of 9999"
+ "area": { "type": "rect", "rect": { "x": 0, "y": 760, "width": -1, "height": 400 } },
+ "comment": "Range of IDs that will always be placed on the popup layer, that gets a very high 'dummy' id of 9999"
}
- ]
-}
-```
+ ]
Each mapping defines the following items to map corresponding surfaces
to a layer.
-- `role` defines what kind of ability the application has. And the application will be attached to `Layer` according to the `role`.
- A regular expression that application drawing names
+- `role` defines a regular expression that application drawing names
are matched against. If applications match this regular expression,
the surface will be visible on this layer.
-- `name` is just a name definition for `Layer`, it has no
+- `name` is just a name definition for this layer, it has no
functional use apart from identifying a layer with a name.
-- `layer_id` is the id used in GENIVI IVI layer management control.
-`Layer` stacks from beginning to end.
+- `layer_id` specifies which ID this layer will use.
-The above `Layer` example image is below.
+- `area` is an object that defines the area assigned to surfaces.
-![wm_layer_stack.png](parts/wm_layer_stack.png)
+- `split_layouts` is an optional item, that - if present - defines a
+ number of possible split-screen layouts for this layer.
-Note:
-"fallback" role is the special role. This role is set if the role application requests doesn't exist
-in `layers.json`. Then, Window Manager will accept any applications.
-If the "fallback" is not set in layers.json, window manager blocks the application displaying in such case.
-In such a situation, you have to add your role(application name) at "role" in layers.json.
+#### Area
-Note:
-`BackGroundLayer` name of `Layer` is exception for work around. This layer is fallback layer not to stop event loop of application when it becomes invisible.
-The problem is issued in <https://jira.automotivelinux.org/browse/SPEC-1484>.
-
-#### areas.json
-
-Area means abstract expressions of 2-dimensional size and position.
-`areas.json` defines the area which an application is set.
-
-```json
-{
- "areas": [
- {
- "name": "fullscreen",
- "rect": {
- "x": 0,
- "y": 0,
- "w": 1080,
- "h": 1920
- }
- },
- {
- "name": "normal.full",
- "rect": {
- "x": 0,
- "y": 218,
- "w": 1080,
- "h": 1488
- }
- },
- {
- "name": "split.main",
- "rect": {
- "x": 0,
- "y": 218,
- "w": 1080,
- "h": 744
- }
- },
- {
- "name": "split.sub",
- "rect": {
- "x": 0,
- "y": 962,
- "w": 1080,
- "h": 744
- }
- }
- ]
-}
-```
-
-The image of the above setting is described below.
-
-![wm_area.png](parts/wm_area.png)
-
-- `name` is an abstract data of rectangle.
-
-- `rect` has 4 arguments. `x`, `y` means the offset from (0, 0) of screen.`w` means the width of the area, and `h` means the height of the area. The dimensions can be specified relative to the screen dimensions.
-
-The dimensions can be specified absolute to the screen dimensions. But if `fullscreen` is not suitable to screen dimensions, Window Manager scales the area automatically.
+Areas can be either `full` or `rect`, whereas `full` means a full-screen
+layer, this is mostly useful for the main\_surface or HomeScreen layer.
+`rect` declares a layer drawing area specified as a rectangle with start
+coordinates `x` and `y` as well as its dimensions `width` and `height`.
-Note:
-
-`fullscreen` must be set because this is the base size of scaling in Window Manger.
-
-Note:
+The dimensions can be specified relative to the screen dimensions. For
+this negative values for width and height must be used.
-The direction of the coordinates depends on `transform` in weston.ini.
-Currently, agl-demo-platform set `transform=270`.
-This suppose to use screen vertically.
-
-#### roles.db
-
-* * *
+For example, a full-screen surface can have the following `rect`
+definition:
-## Sequence
+ "rect": { "x": 0,
+ "y": 0,
+ "width": -1,
+ "height": -1 }
-To understand the sequence between application and window manager, refer to the [spec document](https://wiki.automotivelinux.org/hmiframework).
+A surface that leaves a 200pixel margin on the top and bottom can use
+the following `rect` definition:
-The typical sequence to render your application, follow the sequence below.
+ "rect": { "x": 0,
+ "y": 200,
+ "width": -1,
+ "height": -401 }
-1. Register your role (and request surfaceID)
+So the expression for the actual surface dimensions when using
+screen-size-relative values will be:
-![request_role.png](parts/request_role.png)
+ actual_width = screen_width + 1 + width
+ actual_height = screen_height + 1 + height
-The above sequence is the initialization phase of your application to use Window Manager.
-An Application has to register your `role` to Window Manager. For ivi-shell application, Window Manager generates surfaceID to input it into the function
-to create surface. And also it is important for synchronization to get `syncDraw` event for receiving the request for resize and redraw, and notifying Window Manager of `endDraw`, so register callback function with setEventHandler for `syncDraw`.
+Or in other words, to leave an `N` wide border around a surface, the
+actual value in the dimension configuration needs to be `-N - 1`, and
+appropriate offsets need to be set for `x` and `y`.
-[requestSurface](#requestSurface)
+#### split\_layouts
-[setEventHandler](#wm_subscribe)
+This configuration item allows the specification of split-screen layouts
+on layers for certain surfaces.
-setEventHandler is API of libwindowmanager. This calls wm_subscribe internally.
+A split screen layout always has a *main* surface and a *sub* surface.
+In order to enter a split screen layout, first the *main* surface of the
+layout must be activated, and then the *sub* surface. In order to
+disable the split layout, one of the two participating surface must be
+deactivated (or a surface on a layer below the current one must be
+activated).
-2. Display your window
-
-![hmi_framework_designed_seq_toyota.png](parts/hmi_framework_designed_seq_toyota.png)
+ "split_layouts": [
+ {
+ "name": "Navigation",
+ "main_match": "Navigation",
+ "sub_match": "HVAC|MediaPlayer",
+ }
+ ]
-To display your window, your application has to request `activateWindow` with `role` and `area` to Window Manager.
-Window Manager checks the app should be visible on the `area` according to the policy table using `role` .
-If it is accepted, afb_req_success will be returned, and next Window Manager
-will push the event `syncDraw` to applications which will be displayed. If it is denied, afb_req_fail will be returned. In this sample sequence, `syncDraw` is emitted to the apps who requested only,
-but this shall be emitted to other applications whose size shall be changed.
+A split layout object has the following attributes:
-[activateWindow](#activateWindow)
+- `name` defines its name, it has no actual function other then a way
+ to identify this split layout.
-[syncDraw](#syncDraw)
+- `main_match` is a regular expression that matches for the *main*
+ surface of this split layout.
-[endDraw](#endDraw)
+- `sub_match` is a regular expression that matches for the *sub*
+ surface of this layout.
-[flushDraw](#flushDraw)
+In the above example only the surface with drawing name
+`Navigation` will be used as the *main* surface, and the surfaces
+with drawing name `HVAC` or `MediaPlayer` can be used as a *sub* surface for
+this layout.
-3. Activate OnScreen Window
+The names must still match the layer's role match!
-![deactivate_window.png](parts/deactivate_window.png)
+<div id="Building\ and\ Running"></div>
-[deactivateWindow](#deactivateWindow)
+Building and Running
+====================
-[See sample code for more detail about OnScreen Window.](https://gerrit.automotivelinux.org/gerrit/gitweb?p=apps%2Fonscreenapp.git;a=summary)
+<div id="Dependencies"></div>
-The above sequence shows the sample of OnScreen Window.
-If the role is high priority than NormapApp, Window Manager rejects NormalApp
-request when OnScreenApp is displayed.
+Dependencies
+------------
-Note : Above repository is currently empty, so please refer to the sandbox branch.
+Build dependencies are as follows:
-* * *
+- afb-daemon &gt;= 1.0
-## API reference
+- libsystemd &gt;= 222
-### Request to Window Manager
+- wayland-client &gt;= 1.11
-| Use | verb | version |
-|:-:|:-:|:-:|
-| Initialize | requestSurface | from 0.7 |
-| | wm_subscribe | from 0.7 |
-| | requestSurfaceXDG | from 0.7 |
-|Activate/Deactivate| activateWindow | from 0.7 |
-| | deactivateWindow | from 0.7 |
-| | endDraw | from 0.7 |
-| Change area size | changeAreaSize | from 0.8 |
-| Get Infomation | getDisplayInfo | from 0.7 |
-| | getAreaList | from 0.8 |
+- wayland-ivi-extension &gt;= 2.0.2 (until eel, wayland-ivi-extension &gt;= 1.13)
-Note: We created this table from 0.7
+- cmake &gt;= 2.8
-The data of IPC via websocket consists of JSON.
-This section describes the verb of API and key.
-Normally, the body of requesting API will be here.
+<div id="Supported environment"></div>
-### Initialize
+Supported environment
+-------------------
-#### *requestSurface*
+| Item | Description |
+|:------------|:----------------------------------|
+| AGL version | Electric Eel |
+| Hardware | Renesas R-Car Starter Kit Pro(M3) |
-Register your role to Window Manager and get surfaceID for ivi-shell. The role is used for policy management. SurfaceID is supposed to be set to the API `ivi_application_surface_create` of ivi-application protocol or set it to environment variable `QT_IVI_SURFACE_ID` if your app is Qt and integrate ivi-shell.
-- verb : "requestSurface"
-- argument : {"drawing_name":"your role"}
+<div id="Build\ Configuration"></div>
-the value must be selected in layers.json.
+Build Configuration
+-------------------
-argument example :
+**Download recipe**
+If repo is already done, please start with git clone
-```json
-{
- "drawing_name" : "navigation"
-}
```
+$ mkdir WORK
+$ cd WORK
+$ repo init -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo
+$ repo sync
-#### *requestSurfaceXDG*
-
-This API is for XDGLauncher, so it is not necessary for normal application.
-XDGLauncher is created for XDG application for desktop app without editing for HMI-Framework.
-Please see the repository in detail.
-<https://gerrit.automotivelinux.org/gerrit/gitweb?p=staging%2Fxdg-launcher.git;a=summary>
+```
-#### *wm_subscribe*
+Then you can get the following recipe.
-Subscribe the Window Manager's event.
-Application must subscribe `syncDraw` event.
+* `meta-agl-devel/meta-hmi-framework/recipes-graphics/agl-service-windowmanager-2017`
-- verb : "wm_subscribe"
-- argument : {"event" : *event number*}
+* `meta-agl-devel/meta-hmi-framework/recipes-graphics/libwindowmanager`
-argument example :
+**Bitbake**
-```json
-{
- "event" : 5
-}
+```
+$ source meta-agl/scripts/aglsetup.sh -m m3ulcb agl-demo
+$ bitbake agl-demo-platform
```
-The event is abstracted with a number (enumeration).
-
-| Number | Event |
-|:-:|:-:|
-| 0 | "active" |
-| 1 | "inactive" |
-| 2 | "visible" |
-| 3 | "invisible" |
-| 4 | "syncDraw" |
-| 5 | "flushDraw" |
-| 6 | "screenUpdated" |
-
-### Activate/Deactivate
-
-#### *activateWindow*
-
-Request to display your application with `role` on the `area` to Window Manager.
-Window Manager checks the app should be visible on the `area` and change layout according to the policy table using `role` .
-If it is accepted, afb_req_success will be returned, and next Window Manager
-will push the event `syncDraw` to applications which will be displayed.
-If it is denied, afb_req_fail will be returned.
+<div id="Implementation\ Notes"></div>
-- verb : "activateWindow"
-- argument : {"drawing_name" : "your role", "drawing_area" : "your area"}
+Implementation Notes
+====================
-the value must be selected among layers.json.
+The window manager is implemented as a app-framework-binder binding.
+That means, the build produces one shared object that exports a binding
+interface.
-argument example :
+<div id="Structure"></div>
-```json
-{
- "drawing_name" : "navigation",
- "drawing_area" : "normal.full"
-}
-```
+Structure
+---------
-#### *deactivateWindow*
+The implementation is loosely split across the following source files:
-Request to hide your application to Window Manager.
-This verb is supposed to be used by high priority application which
-are for example popup application or system UI application such like alert.
-If Window Manager set the priority of popup high in the policy, Window Manager may not hide the popup even if normal applications
-send `activateWindow` until popup application send `deactivateWindow` . This behavior depends on the policy table. After this request, Window Manager checks which app should be visible and change layout according to the policy table.
+- `main.cpp`: The program entry point as used by the afb-daemon. This
+ file defines the afbBindingV2 symbol that is used by the afb-daemon
+ in order to load a binding. It also defines the wayland fd event
+ dispatcher and some globals to be used (as context for the afb calls
+ we receive).
-- verb : "deactivateWindow"
-- argument : None
+- `app.cpp` / `app.hpp`: This is the main window manager
+ logic implementation.
-#### *endDraw*
+- `config.cpp` / `config.hpp`: Very simple configuration
+ item interface.
-Notify Window Manager of application finishes drawing.
-This function must be sent in event `syncDraw`.
-Otherwise, Window Manager will roll back to previous state and reject your request `activateWindow` .
+- `controller_hooks.hpp`: hook functions called by the wayland
+ controller to call into the window manager instance. Only a very limited number
+ of events are passed to the window manager, which allowed the usage of
+ such a simple interface.
-- verb : "endDraw"
-- argument : {"drawing_name" : "your role"}
+- `json_helper.cpp` / `json_helper.hpp`: Smaller json related
+ helper functions.
-argument example :
+- `layers.cpp` / `layers.hpp`: Actually hold all the data from
+ layers.json configuration, do some transformations and service the
+ window manager implementation.
-```json
-{
- "drawing_name" : "navigation",
-}
-```
+- `layout.cpp` / `layout.hpp`: Very simple layout state for the
+ implementation of split layouts and tracking of the
+ surfaces involved.
-#### *changeAreaSize*
+- `policy.hpp`: PolicyManager implementation stub. Gets passed the
+ current and new layout on layout switch and can decide upon it being
+ valid or not.
-Request to change the size of area and location. Then Window Manager sends `syncDraw` to the applications whose size and location will be changed.
-The caller has responsible of appearance of layouts.
+- `result.hpp`: Simple result class around
+ `std::experimental::optional` that additionally can hold a
+ `char const *` to describe the error.
-The use case of this function is shown in below.
-The system application such like HomeScreen call this function, then the layout changes. The trigger may be user request on GUI, or system events and so on.
+- `util.cpp` / `util.hpp`: general utility functions and structs - and
+ preprocessor definitions (e.g. `log*()` to AFB logging functions.
-![chnage_layout_img](parts/wm_change_layout.png)
+- `wayland_ivi_wm.cpp` / `wayland_ivi_wm.hpp`: A C++ object-oriented
+ libwayland-client wrapper. It is instanced in `main.cpp` and handles
+ all our wayland needs. These files are in master. In eel, the name
+ of these files are `wayland.cpp` / `wayland.hpp`
-The sequence is below.
+<div id="Sequence"></div>
-![change_layout_sequnce](parts/change_layout_seq.png)
+Sequence
+===============
-- verb : "changeAreaSize"
-- argument : {"areas" : [{"name":"area_name","rect":{"x":int,"y":int,"w":int,"h":int}, ...}]}
+To understand the sequence between application and window manager, refer to the [spec document](https://wiki.automotivelinux.org/windowmanager).
-Note: Only the application whose role is written in whitelist is allowed to call this API. This is because marcious application can change the layouts. The layout should be controled by system application.
-### Get Information
+<div id="Binding\ API"></div>
-#### *getDisplayInfo*
+Binding API
+===============
-Get screen information such as resolution.
+Each function returns a reply containing at least a failed or successful
+result of the call, additionally, when calls return something, it is
+noted.
-- verb : "getDisplayInfo"
-- argument : None
+<div id="LibWindowmanager"></div>
-Return : The screen information will return.
+LibWindowmanager
+------
-Return example :
+This is the public interface of the class `LibWindowmanager`.
-```json
-{
- "response":{
- "width_pixel":1080,
- "height_pixel":1920,
- "width_mm":320,
- "height_mm":520,
- "scale":1
- },
- "jtype" : "afb-reply",
- "request":{
- "status":"success",
- "info":"success",
- "uuid":"05ae219a-0e56-4f46-af9f-3186a18cb110"
- }
-}
-```
+ class LibWindowmanager
+ {
+ public:
+ LibWindowmanager();
+ ~LibWindowmanager();
-Note :
+ enum EventType {
+ Event_Active = 0,
+ Event_Inactive,
-"width_mm", "height_mm" is from output which is one of the wayland object.
-These items lack reliability, so recommend not to use.
+ Event_Visible,
+ Event_Invisible,
-#### *getAreaList*
+ Event_SyncDraw,
+ Event_FlushDraw,
+ };
-Get area definition defined in areas.json.
+ int init(int port, char const *token);
-- verb : "getAreaList"
-- argument : None
+ // Window manager API
+ int requestSurface(json_object *object);
+ int requestSurfaceXDG(json_object *object);
+ int activateSurface(json_object *object);
+ int deactivateSurface(json_object *object);
+ int endDraw(json_object *object);
+ int getDisplayInfo(json_object *object);
+ int getAreaInfo(json_object *in_obj, json_object *out_obj);
-Return : The area definition list.
+ int getAreaInfo(const char *label, json_object *out_obj);
-Return example :
+ void set_event_handler(enum EventType et, handler_fun f);
-```json
-{
- "response":{
- "areas":[
- {
- "name":"on_screen",
- "rect":{
- "x":0,
- "y":218,
- "w":1080,
- "h":1488
- }
- },
- {
- "name":"restriction.split.sub",
- "rect":{
- "x":0,
- "y":962,
- "w":1080,
- "h":744
- }
- }
- ]
- },
- "jtype":"afb-reply",
- "request":{
- "status":"success",
- "uuid":"0e6b8835-0df0-4a34-9718-125e6258b378"
- }
-}
-```
+ };
-### Event from Window Manager
-
-| Number | Event | version |
-|:-:|:-:|:-:|
-| 0 | "active" | from 0.7|
-| 1 | "inactive" | from 0.7 |
-| 2 | "visible" | from 0.7 |
-| 3 | "invisible" | from 0.7 |
-| 4 | "syncDraw" | from 0.7 |
-| 5 | "flushDraw" | from 0.7 |
-| 6 | "screenUpdated" | from 0.7 |
-
-Events also consists of JSON.
-The data of event is contained in `data` such like
-
-```json
-{
- "event":"windowmanager\/active",
- "date":{
- "drawing_name":"navigation"
- },
- "jtype":"afb-event"
-}
-```
+<div id="Methods"></div>
-"event" is the event name.
-"data" is the data object from Window Manager and contains
-the message of event.
-This section describes "event" and the contents of "data".
+Methods
+-------
-#### active
+### init(int port, char const *token)
-This event means when the application becomes active state.
+Initialize the Binding communication.
-example :
+The `token` parameter is a string consisting of only alphanumeric characters.
+If these conditions are not met, the LibWindowmanager instance will not initialize,
+i.e. this call will return `-EINVAL`.
-```json
-{
- "event":"windowmanager\/active",
- "data":{
- "drawing_name":"launcher"
- }
- },
- "jtype":"afb-event"
-}
-```
+The `port` parameter is the port the afb daemon is listening on, an
+invalid port will lead to a failure of the call and return `-EINVAL`.
-#### inactive
+### requestSurface(json_object *object)
-This event means when the application becomes inactive state.
+**args: `{ 'kKeyDrawingName': 'application name' }`**
+This method requests a surface with the label given from the *Window Manager*.
+It will return `surface id` a client application can use, and
+`-errno` on failure. Additionally, on the standard error, messages are
+logged to help debugging the issue.
-example :
+### requestSurfaceXDG(json_object *object)
-```json
-{
- "event":"windowmanager\/inactive",
- "data":{
- "drawing_name":"launcher"
- }
- },
- "jtype":"afb-event"
-}
-```
+**args: `{ 'kKeyDrawingName': 'application name', 'kKeyIviId': 'ivi id' }`**
+This method is mainly intended for *xdglauncher* that controls xdg application such as chromium.
+It will return `surface id` xdglauncher uses, and
+`-errno` on failure. Additionally, on the standard error, messages are
+logged to help debugging the issue.
-#### visible
+### activateSurface(json_object *object)
-This event is issued when the application is visible state.
+**args: `{ 'kKeyDrawingName': 'application name', 'kKeyDrawingArea': 'layout' }`**
+This method is mainly intended for *manager* applications that control
+other applications (think an application manager or the *HomeScreen*).
+It instructs the window manager to activate the surface with the given
+*label*.
-example :
+This method only is effective after the actual window or surface was
+created by the application.
-```json
-{
- "event":"windowmanager\/visible",
- "data":{
- "drawing_name":"launcher"
- }
- },
- "jtype":"afb-event"
-}
-```
+### deactivateSurface(json_object *object)
-#### invisible
+**args: `{ 'kKeyDrawingName': 'application name' }`**
+This method is mainly intended for *manager* applications that control other applications.
+In adition, this is for applications that overrides other applications such like popup message.
+In this case, popup surface requests to be hidden. It instructs the window manager to deactivate the surface associated with the given label. Note, that deactivating a surface also means to implicitly activate another (the last active or if not available *main surface* or *HomeScreen*.)
-This event is issued when the application is invisible state.
+This method only is effective after the actual window or surface was
+created by the application.
-example :
+### endDraw(json_object *object)
-```json
-{
- "event":"windowmanager\/invisible",
- "data":{
- "drawing_name":"launcher"
- }
- },
- "jtype":"afb-event"
-}
-```
+**args: `{ 'kKeyDrawingName': 'application name' }`**
+This function is called from a client application when it is done
+drawing its surface content.
-#### syncDraw
+It is not crucial to make this call at every time a drawing is finished
+- it is mainly intended to allow the window manager to synchronize
+drawing in case of layout switch. The exact semantics are explained in
+the next [Events](#_events) Section.
-This event is issued by Window Manager state change operation in policy to the following cases.
+### getDisplayInfo(json_object *object)
-- Your app requested `activateWindow` then your application will be resized or visible.
-- Other app requested `activateWindow` then your application will be resized or visible.
-- Window Manager change layout due to vehicle condition.
+**args: `{ }`**
+This function gets the display information as follows:
+ - width[pixel]
+ - height[pixel]
+ - width[mm]
+ - height[mm]
-This event is the requests from Window Manager to
+It outputs the display information for json_object in the argument as follows:
+ `{"width_pixel": int value of width[pixel], "height_pixel": int value of height[pixel],
+ "width_mm": int value of width[mm], "height_mm": int value of height[mm]}`
-- request your app to callback `endDraw` to Window Manager.
-- request your app to resize and redraw according to "drawing_area".
+It should be called after calling init().
+It should not be called in the event handler because it occurs hang-up.
-This is the abstract word then the real size is given in "drawing_rect".
+#### NOTE
+It uses wl_output::geometry() for getting physical width[mm] and height[mm] of the display,
+but the value is different with measured value.
-example :
+ - value from wl_output::geometry(): width:320 height:520
+ - measured value : width:193 height:343
-```json
-{
- "event":"windowmanager\/syncDraw",
- "data":{
- "drawing_name":"radio",
- "drawing_area":"normal.full",
- "drawing_rect":{
- "x":0,
- "y":218,
- "width":1080,
- "height":1488
- }
- },
- "jtype":"afb-event"
-}
-```
+### getAreaInfo(json_object *in_obj, json_object *out_obj)
-An application which gets this event must send `endDraw`.
-For details, please see the sequence.
+**args1: `{ 'kKeyDrawingName': 'application name' }`**
+**args2: `{ }`**
+This function gets the information of area drawn by the application as follows:
+ - x-coordinate
+ - y-coordinate
+ - width
+ - height
-#### flushDraw
+It outputs the area information for json_object in the 2nd argument as follows:
+ `{"x": int value of x-coordinate, "y": int value of y-coordinate,
+ "width": int value of width, "height": int value of height}`
-This event is issued after Window Manager receives all `endDraw` from applications who recieved `syncDraw` . After this event, Window Manager expects applications to update its surface.
+It should be called after calling activateSurface().
+It should not be called in the event handler because it occurs hang-up.
-example :
+#### NOTE
+The same information can given by SyncDraw event.
-```json
-{
- "event":"windowmanager\/flushDraw",
- "data":{
- "drawing_name":"launcher"
- }
- },
- "jtype":"afb-event"
-}
-```
+### getAreaInfo(const char *label, json_object *out_obj)
-#### screenUpdated
+**args1: String of application name**
+**args2: `{ }`**
+This function is same with `getAreaInfo(json_object *in_obj, json_object *out_obj)`,
+but only has difference of 1st argument.
-This event is issued after the visible application changes as a state transition change. This contains resized applications and visible applications. This event is issued to all subscriber. Typical usecase is only for HomeScreen. If HomeScreen has an animation until the started application is visible such as progress bar, this signal may become a switch to stop the animation.
+### set\_event\_handler(enum EventType et, handler_fun f)
-```json
-{
- "event":"windowmanager\/screenUpdated",
- "data":{
- "ids":[
- "mediaplayer",
- "navi"
- ]
- },
- "jtype":"afb-event"
-}
-```
+This method needs to be used to register event handlers for the WM
+events described in the EventType enum. Only one hendler for each
+EventType is possible, i.e. if it is called multiple times with the same
+EventType the previous handler will be replaced.
-"ids" is the application_id described in config.xml of application.
+The `func` handler functions will receive the label of the surface this
+event is targeted at.
-### Client library
+See Section [Events](#_events) for more detailed information about event
+delivery to client applications.
-A client library implementation that internally uses the *libafbwsc*, is
-provided in the `libwindowmanager`.
-This library is for C++ native application.
+<div id="Errors"></div>
-Regarding more detail, please refer to <https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Flibwindowmanager.git;a=summary>
+Errors
+------
-* * *
+Methods returning an `int` signal successful operation when returning
+`0`. In case of an error, an error value is returned as a negative errno
+value. E.g. `-EINVAL` to signal that some input value was invalid.
-## Sample code
+Additionally, logging of error messages is done on the standard error
+file descriptor to help debugging the issue.
-In order to enable application to activate application(render on layer),
-above described steps need to be implemented.
+<div id="Usage"></div>
-As a minimal example the usage and initialization can look like the
-following.
+Usage
+-----
-Typical implementation of C++ application.
+### Initialization of LibWindowmanager
-- Repo: `git clone https://gerrit.automotivelinux.org/gerrit/src/libhomescreen`
- - Path: `sample/simple-egl/main.c`
+Before usage of the LibWindowmanager, the method `init()` must be
+called once, it will return `-errno` in case of an error and log
+diagnostic messages to stderr.
-Typical implementation of Qt application.
+### Request a surface
-- Repo: `git clone https://gerrit.automotivelinux.org/gerrit/apps/radio`
-- Repo: `git clone https://gerrit.automotivelinux.org/gerrit/apps/videoplayer`
+When creating a surface with *Qt* - it is necessary to request a surface
+from the WM, internally this will communicate with the window manager
+binding. Only after `requestSurface()` was successful, a surface should
+be created.
-This is the good example to write more simply for Qt application using QtAGLExtra.
+This is also true for *QML* applications, where only after the
+`requestSurface()` should the load of the resource be done. The method
+returns `surface id` a client application can use
+after the surface was requested successfully.
-## Policy Manager
+#### Workings of requestSurface()
-### Concepts
+`LibWindowmanager::requestSurface()` calls the AFB binding verb
+`requestsurface` of the `windowmanager` API. This API call will return a
+numeric ID to be used when creating the surface. This ID is never
+explicitly returned to the client application, instead, it is set in the
+application environment in order for *Qt* to then use it when creating
+the surface.
-Policy Manager decides next layout by using input event data and current state
-based on the policy table.
+With the current *Qt* implementation this means, that only one surface
+will be available to client applications, as subsequent windows will
+increment this numeric ID internally - which then will lead to IDs that
+cannot be known by the window manager as there is no direct
+communication from *Qt* to the WM.
-And PolicyManager is plugin for WindowManager.
-Therefore the OEMs can replace it.
+<div id="Events"></div>
-### Enabling split
+Events
+------
-Window Manager supports split layout to change policy and `areas.json`.
-This section describes how to play split layout. The sample image is here.
+Events are a way for the *Window Manager* to propagate information to
+client applications. It was vital for the project to implement a number
+of events, that mirror functionality that is already present in the
+wayland protocol.
-![example_split.png](parts/example_split.png)
+All events have the surface label as argument - a way to enable future
+multi-surface applications.
-To play the split layout,
+As already stated above, this is currently not possible with the way
+*Qt* implements its surface ID setting.
-1. Edit in `policy_manager/CMakeLists.txt` as follows:
+### Active and Inactive Events
-```cmake:policy_manager/CMakeList.txt
- #set(STM_DIR stub)
- set(STM_DIR zipc)
-```
+These events signal an application that it was activated or deactivated
+respectively. Usually this means it was switched visible - which means
+the surface will now be on the screen and therefor continue to render.
-This results in using source code generated by ZIPC.
+- `Active(json_object *object)`
+ args: { 'kKeyDrawingName': 'application name' }
+ Signal that the surface with the name
+ `kKeyDrawingName` is now active.
-1. Set bool value "ON" to TRY_SPLIT_LAYOUT at line 28 in policy_manager/CMakeLists.txt as follows:
- set(TRY_SPLIT_LAYOUT ON CACHE BOOL "Enable to show split layout")
-1. compile
-1. copy window manager to your board
-1. re-install windowmanager and reboot
+- `Inactive(json_object *object)`
+ args: { 'kKeyDrawingName': 'application name' }
+ Signal that the surface with the
+ name `kKeyDrawingName` is now inactive. This usually means, the layout
+ got changed, and the surface is now considered inactive
+ (or sleeping).
-As a result, if application requests `navi` with `activateWindow` when current layout is `video` or `mediaplayer`, Window Manager change layout to split window. The reverse is true.
+### Visible and Invisible
-Note:
+These events signal an application that it was switched to be visible or
+invisible respectively. These events also are handled implicitly through
+the wayland protocol by means of `wl_surface::enter` and
+`wl_surface::leave` events to the client.
-Currently, the policy manager force application change the size even if the application which has the role doesn't have the split design. In that case, the view of application may be ugly. Window Manager supposes that applications may have multi designs according to system design by OEM. For example, if OEM sets 2 pattern layout for `navi`, the application which requests `navi` should have 2 pattern designs.
+- `Visible(json_object *object)`
+ args: { 'kKeyDrawingName': 'application name' }
+ Signal applications, that the
+ surface with name `kKeyDrawingName` is now visible.
-* * *
+- `Invisible(json_object *object)`
+ args: { 'kKeyDrawingName': 'application name' }
+ Signal applications that the
+ surface with name `kKeyDrawingName` is now invisible.
-## Release Note
+### SyncDraw and FlushDraw
-### version: 0.8
+These events instruct applications that they should redraw their surface
+contents - again, this is handled implicitly by the wayland protocol.
-#### New Feature
+`SyncDraw` is sent to the application when it has to redraw its surface.
-- Add Policy Manager
+`FlushDraw` is sent to the application when it should swap its buffers,
+that is *signal* the compositor that its surface contains new content.
-### version: 0.7
+- `SyncDraw(json_object *object)`
+ args: { 'kKeyDrawingName': 'application name', 'kKeyDrawingArea': 'layout',
+ 'kKeyDrawingRect': { "x": int value of x-coordinate, "y": int value of y-coordinate,
+ "width": int value of width, "height": int value of height } }
+ Signal applications, that the
+ surface with name `kKeyDrawingArea` needs to redraw its content
+ in the layout with name `kKeyDrawingArea` - this
+ usually is sent when the surface geometry changed.
+ And the area position and size are included with name `kKeyDrawingRect`.
-#### New Features
+- `FlushDraw(json_object *object)`
+ args: { 'kKeyDrawingName': 'application name' }
+ Signal applications, that the
+ surface with name `kKeyDrawingArea` can now be swapped to its newly
+ drawn content as the window manager is ready to activate a new
+ layout (i.e. a new surface geometry).
-- Add API of getting area list and changing area size on runtime
+<div id="Sample"></div>
-#### Changes
+Sample
+============
-- Reduce binary size to use ilmControl library.
-- Change layer management. Client has one ivi-layer and can have multi surfaces.
-- Stop conversion table which is compatible with old role to avoid complexity.
-- Upgrade bindings v3.
-- Add configuration file over-ride mechanism.
+In order to enable application to use the `WM` surface registration
+function the above described steps need to be implemented.
-#### Limitation
+As a minimal example the usage and initialization can look like the
+following.
-- Only single-surface Qt applications are support through the
- libwindowmanager library. This is a limitation of how Qt creates surface
- IDs for the ivi-application interface.
+Repo: `apps/agl-service-homescreen-2017`
+Path: `sample/template/main.c`
-- Currenly, Window Manager supports only one screen. Dual display is not supported.
-- As implemented in sample code, Qt application has to wait requesting `activateWindow` until `frameSwapped` is emitted.
-- Qt application conceals, wayland and openGL processes, so it is difficult to call `swapBuffer` after `flushDraw` event described in the architecture document. But no problem if you use toolkit such as Qt, because it is automatically processed between applications and compositor(weston).
-- Editing ZIPC is difficult for open source developer due to licence.
diff --git a/doc/api-services-book.yml b/doc/api-services-book.yml
deleted file mode 100644
index ce02b30..0000000
--- a/doc/api-services-book.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-type: books
-books:
--
- id: agl-service-windowmanager
- title: AGL Service Windowmanager
- description: AGL Service Windowmanager documentation
- keywords:
- author: "TOYOTA MOTOR CORPORATION"
- version: master
- chapters:
- - url: ApplicationGuide.md
- destination: 3_2-WindowManager-Guide.md
- name: Window Manager Developper Guide \ No newline at end of file
diff --git a/doc/parts/change_layout_seq.png b/doc/parts/change_layout_seq.png
deleted file mode 100644
index 6895cfa..0000000
--- a/doc/parts/change_layout_seq.png
+++ /dev/null
Binary files differ
diff --git a/doc/parts/deactivate_window.png b/doc/parts/deactivate_window.png
deleted file mode 100644
index cd0d48c..0000000
--- a/doc/parts/deactivate_window.png
+++ /dev/null
Binary files differ
diff --git a/doc/parts/example_split.png b/doc/parts/example_split.png
deleted file mode 100644
index e9fd476..0000000
--- a/doc/parts/example_split.png
+++ /dev/null
Binary files differ
diff --git a/doc/parts/hmi_framework_designed_seq_toyota.png b/doc/parts/hmi_framework_designed_seq_toyota.png
deleted file mode 100644
index 2dedabf..0000000
--- a/doc/parts/hmi_framework_designed_seq_toyota.png
+++ /dev/null
Binary files differ
diff --git a/doc/parts/request_role.png b/doc/parts/request_role.png
deleted file mode 100644
index ca20678..0000000
--- a/doc/parts/request_role.png
+++ /dev/null
Binary files differ
diff --git a/doc/parts/state_change_example.png b/doc/parts/state_change_example.png
deleted file mode 100644
index 23dada4..0000000
--- a/doc/parts/state_change_example.png
+++ /dev/null
Binary files differ
diff --git a/doc/parts/wm_area.png b/doc/parts/wm_area.png
deleted file mode 100644
index e713782..0000000
--- a/doc/parts/wm_area.png
+++ /dev/null
Binary files differ
diff --git a/doc/parts/wm_change_layout.png b/doc/parts/wm_change_layout.png
deleted file mode 100644
index 2bc9ef6..0000000
--- a/doc/parts/wm_change_layout.png
+++ /dev/null
Binary files differ
diff --git a/doc/parts/wm_layer_stack.png b/doc/parts/wm_layer_stack.png
deleted file mode 100644
index 9c99731..0000000
--- a/doc/parts/wm_layer_stack.png
+++ /dev/null
Binary files differ
diff --git a/doc/parts/wm_software_stack.png b/doc/parts/wm_software_stack.png
deleted file mode 100644
index aa66636..0000000
--- a/doc/parts/wm_software_stack.png
+++ /dev/null
Binary files differ
diff --git a/layers.json b/layers.json
new file mode 100644
index 0000000..29bad45
--- /dev/null
+++ b/layers.json
@@ -0,0 +1,90 @@
+{
+ "description": "Layer mapping, if screen is not specified, screen is set to 0",
+ "mappings": [
+ {
+ "name": "BackGroundLayer",
+ "role" : "map|radio|music|video|navigation",
+ "id_range_begin": 0,
+ "id_range_end": 0,
+ "comment": "Work Around: This is evacuation layer that not stopping event loop"
+ },
+ {
+ "name": "FarHomeScreen",
+ "role": "",
+ "id_range_begin": 100,
+ "id_range_end": 199,
+ "comment": "FarHomeScreen is the part of HomeScreen. The z order of this layer is lower than NearHomeScreen"
+ },
+ {
+ "name": "Apps",
+ "role": "music|video|browser|radio|phone|map|navigation|hvac|settings|dashboard|poi|mixer|sdl|launcher|receiver|tachometer|fallback",
+ "id_range_begin": 1000,
+ "id_range_end": 2999,
+ "comment": "Range of IDs that will always be placed on layer 1001"
+ },
+ {
+ "name": "NearHomeScreen",
+ "role": "homescreen",
+ "id_range_begin": 3000,
+ "id_range_end": 3000,
+ "comment": "TOYOTA special software keyboard"
+ },
+ {
+ "name": "Application Popup Layer",
+ "role": "popup*",
+ "id_range_begin": 4000,
+ "id_range_end": 4999,
+ "comment": "[T.B.D]This layer is for application popup layer"
+ },
+ {
+ "name": "Restriction",
+ "role": "restriction",
+ "id_range_begin": 5000,
+ "id_range_end": 5999,
+ "comment": "This layer is for restriction notification. This is used by restriction role"
+ },
+ {
+ "name": "OnScreen",
+ "role": "^on_screen*",
+ "id_range_begin": 6000,
+ "id_range_end": 6999,
+ "comment": "Range of IDs that will always be placed on the OnScreen layer, that gets a very high 'dummy' id of 9999"
+ },
+ {
+ "name": "Remote",
+ "role": "tbtnavi",
+ "id_range_begin": 9000,
+ "id_range_end": 9199,
+ "screen" : 1,
+ "comment": "Range of IDs that will always be placed on the OnScreen layer, that gets a very high 'dummy' id of 9999"
+ },
+ {
+ "name": "RemoteRSE1",
+ "role": "music|video|browser|radio|phone|map|navigation|hvac|settings|dashboard|poi|mixer|sdl|launcher|receiver|tachometer|fallback",
+ "id_range_begin": 9200,
+ "id_range_end": 9399,
+ "comment": "Range of IDs that will always be placed on the OnScreen layer, that gets a very high 'dummy' id of 9999"
+ },
+ {
+ "name": "RemoteRSE2",
+ "role": "music|video|browser|radio|phone|map|navigation|hvac|settings|dashboard|poi|mixer|sdl|launcher|receiver|tachometer|fallback",
+ "id_range_begin": 9400,
+ "id_range_end": 9599,
+ "comment": "Range of IDs that will always be placed on the OnScreen layer, that gets a very high 'dummy' id of 9999"
+ },
+ {
+ "name": "RemoteHUD",
+ "role": "music|video|browser|radio|phone|map|navigation|hvac|settings|dashboard|poi|mixer|sdl|launcher|receiver|tachometer|fallback",
+ "id_range_begin": 9600,
+ "id_range_end": 9799,
+ "comment": "Range of IDs that will always be placed on the OnScreen layer, that gets a very high 'dummy' id of 9999"
+ },
+ {
+ "name": "RemoteHUDUpperLeft",
+ "role": "music|video|browser|radio|phone|map|navigation|hvac|settings|dashboard|poi|mixer|sdl|launcher|receiver|tachometer|fallback",
+ "id_range_begin": 9800,
+ "id_range_end": 9999,
+ "comment": "Range of IDs that will always be placed on the OnScreen layer, that gets a very high 'dummy' id of 9999"
+ }
+ ]
+}
diff --git a/package/root/config.xml b/package/root/config.xml
index 375dc54..e11ef63 100644
--- a/package/root/config.xml
+++ b/package/root/config.xml
@@ -8,12 +8,14 @@
<feature name="urn:AGL:widget:required-permission">
<param name="urn:AGL:permission::public:hidden" value="required" />
<param name="urn:AGL:permission::system:run-by-default" value="required" />
- <param name="urn:AGL:permission::public:display" value="required" />
+ <param name="urn:AGL:permission:afm:system:runner" value="required" />
</feature>
<feature name="urn:AGL:widget:provided-api">
<param name="windowmanager" value="ws" />
</feature>
- <feature name="urn:AGL:widget:required-binding">
+ <feature name="urn:AGL:widget:required-api">
+ <param name="low-can" value="ws" />
<param name="lib/windowmanager-service.so" value="local" />
+ <param name="afm-main" value="ws" />
</feature>
</widget>
diff --git a/policy_manager/CMakeLists.txt b/policy_manager/CMakeLists.txt
index 3ec4c39..5903340 100644
--- a/policy_manager/CMakeLists.txt
+++ b/policy_manager/CMakeLists.txt
@@ -19,21 +19,21 @@ pkg_check_modules(AFB REQUIRED afb-daemon)
pkg_check_modules(SD REQUIRED libsystemd>=222)
# Set name of STM
-set(STM_DIR stub)
-#set(STM_DIR zipc)
+#set(STM_DIR stub)
+set(STM_DIR zipc)
-# Select roles.db
+# Select roles.json
if(zipc MATCHES ${STM_DIR})
# if trying to show split layout, change from OFF to ON
- set(TRY_SPLIT_LAYOUT OFF CACHE BOOL "Enable to show split layout")
+ set(TRY_SPLIT_LAYOUT ON CACHE BOOL "Enable to show split layout")
if(${TRY_SPLIT_LAYOUT})
- set(ROLES_DB_NAME roles.db.zipc.split)
+ set(ROLES_CONFIG_FILE_NAME roles.json.zipc.split)
else()
- set(ROLES_DB_NAME roles.db.zipc)
+ set(ROLES_CONFIG_FILE_NAME roles.json.zipc)
endif()
else()
- set(ROLES_DB_NAME roles.db)
+ set(ROLES_CONFIG_FILE_NAME roles.json)
endif()
# Add STM directory
@@ -99,6 +99,6 @@ add_custom_command(TARGET ${TARGETS_PM} POST_BUILD
COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/root/lib
COMMAND cp -f ${PROJECT_BINARY_DIR}/${PLUGIN_PM}/lib${PLUGIN_PM}.so ${PROJECT_BINARY_DIR}/package/root/lib
COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/root/etc
- COMMAND cp -f ${PROJECT_SOURCE_DIR}/${PLUGIN_PM}/db/states.db ${PROJECT_BINARY_DIR}/package/root/etc
- COMMAND cp -f ${PROJECT_SOURCE_DIR}/${PLUGIN_PM}/db/${ROLES_DB_NAME} ${PROJECT_BINARY_DIR}/package/root/etc/roles.db
+ COMMAND cp -f ${PROJECT_SOURCE_DIR}/${PLUGIN_PM}/config/layouts.json ${PROJECT_BINARY_DIR}/package/root/etc
+ COMMAND cp -f ${PROJECT_SOURCE_DIR}/${PLUGIN_PM}/config/${ROLES_CONFIG_FILE_NAME} ${PROJECT_BINARY_DIR}/package/root/etc/roles.json
)
diff --git a/policy_manager/config/layouts.json b/policy_manager/config/layouts.json
new file mode 100644
index 0000000..70eadbb
--- /dev/null
+++ b/policy_manager/config/layouts.json
@@ -0,0 +1,422 @@
+{
+ "ecus": [
+ {
+ "name": "master",
+ "layouts": [
+ {
+ "name": "homescreen",
+ "areas": [
+ {
+ "name": "fullscreen",
+ "category": "homescreen"
+ }
+ ]
+ },
+ {
+ "name": "splitable.split",
+ "areas": [
+ {
+ "name": "split.main",
+ "category": "splitable_main"
+ },
+ {
+ "name": "split.sub",
+ "category": "splitable_sub"
+ }
+ ]
+ },
+ {
+ "name": "general.normal",
+ "areas": [
+ {
+ "name": "normal.full",
+ "category": "general"
+ }
+ ]
+ },
+ {
+ "name": "software_keyboard",
+ "areas": [
+ {
+ "name": "software_keyboard",
+ "category": "software_keyboard"
+ }
+ ]
+ },
+ {
+ "name": "pop_up",
+ "areas": [
+ {
+ "name": "on_screen",
+ "category": "pop_up"
+ }
+ ]
+ },
+ {
+ "name": "system_alert",
+ "areas": [
+ {
+ "name": "on_screen",
+ "category": "system_alert"
+ }
+ ]
+ },
+ {
+ "name": "tbt",
+ "areas": [
+ {
+ "name": "normal.full",
+ "category": "tbt"
+ }
+ ]
+ },
+ {
+ "name": "remote_tbt",
+ "areas": [
+ {
+ "name": "master.split.sub",
+ "category": "tbt"
+ }
+ ]
+ },
+ {
+ "name": "meter.normal",
+ "areas": [
+ {
+ "name": "normal.full",
+ "category": "meter"
+ }
+ ]
+ },
+ {
+ "name": "meter_receiver",
+ "areas": [
+ {
+ "name": "split.main",
+ "category": "meter"
+ },
+ {
+ "name": "split.sub",
+ "category": "receiver"
+ }
+ ]
+ },
+ {
+ "name": "meter_splitable",
+ "areas": [
+ {
+ "name": "split.main",
+ "category": "meter"
+ },
+ {
+ "name": "split.sub",
+ "category": "splitable_sub"
+ }
+ ]
+ },
+ {
+ "name": "splitable_receiver",
+ "areas": [
+ {
+ "name": "split.main",
+ "category": "splitable_main"
+ },
+ {
+ "name": "split.sub",
+ "category": "receiver"
+ }
+ ]
+ },
+ {
+ "name": "receiver.split",
+ "areas": [
+ {
+ "name": "split.sub",
+ "category": "receiver"
+ }
+ ]
+ },
+ {
+ "name": "debug.normal",
+ "areas": [
+ {
+ "name": "normal.full",
+ "category": "debug"
+ }
+ ]
+ },
+ {
+ "name": "debug.split.main",
+ "areas": [
+ {
+ "name": "split.main",
+ "category": "debug"
+ }
+ ]
+ },
+ {
+ "name": "debug.split.sub",
+ "areas": [
+ {
+ "name": "split.sub",
+ "category": "debug"
+ }
+ ]
+ },
+ {
+ "name": "debug.fullscreen",
+ "areas": [
+ {
+ "name": "fullscreen",
+ "category": "debug"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "slave",
+ "layouts": [
+ {
+ "name": "homescreen",
+ "areas": [
+ {
+ "name": "fullscreen",
+ "category": "homescreen"
+ }
+ ]
+ },
+ {
+ "name": "map.normal",
+ "areas": [
+ {
+ "name": "normal.full",
+ "category": "map"
+ }
+ ]
+ },
+ {
+ "name": "map.split",
+ "areas": [
+ {
+ "name": "split.main",
+ "category": "map"
+ },
+ {
+ "name": "split.sub",
+ "category": "splitable"
+ }
+ ]
+ },
+ {
+ "name": "map.fullscreen",
+ "areas": [
+ {
+ "name": "fullscreen",
+ "category": "map"
+ }
+ ]
+ },
+ {
+ "name": "splitable.normal",
+ "areas": [
+ {
+ "name": "normal.full",
+ "category": "splitable"
+ }
+ ]
+ },
+ {
+ "name": "splitable.split",
+ "areas": [
+ {
+ "name": "split.main",
+ "category": "splitable"
+ },
+ {
+ "name": "split.sub",
+ "category": "splitable"
+ }
+ ]
+ },
+ {
+ "name": "general.normal",
+ "areas": [
+ {
+ "name": "normal.full",
+ "category": "general"
+ }
+ ]
+ },
+ {
+ "name": "system.normal",
+ "areas": [
+ {
+ "name": "normal.full",
+ "category": "system"
+ }
+ ]
+ },
+ {
+ "name": "software_keyboard",
+ "areas": [
+ {
+ "name": "software_keyboard",
+ "category": "software_keyboard"
+ }
+ ]
+ },
+ {
+ "name": "restriction.normal",
+ "areas": [
+ {
+ "name": "restriction.normal",
+ "category": "restriction"
+ }
+ ]
+ },
+ {
+ "name": "restriction.split.main",
+ "areas": [
+ {
+ "name": "restriction.split.main",
+ "category": "restriction"
+ }
+ ]
+ },
+ {
+ "name": "restriction.split.sub",
+ "areas": [
+ {
+ "name": "restriction.split.sub",
+ "category": "restriction"
+ }
+ ]
+ },
+ {
+ "name": "pop_up",
+ "areas": [
+ {
+ "name": "on_screen",
+ "category": "pop_up"
+ }
+ ]
+ },
+ {
+ "name": "system_alert",
+ "areas": [
+ {
+ "name": "on_screen",
+ "category": "system_alert"
+ }
+ ]
+ },
+ {
+ "name": "tbt",
+ "areas": [
+ {
+ "name": "normal.full",
+ "category": "tbt"
+ }
+ ]
+ },
+ {
+ "name": "remote_tbt",
+ "areas": [
+ {
+ "name": "master.split.sub",
+ "category": "tbt"
+ }
+ ]
+ },
+ {
+ "name": "debug.normal",
+ "areas": [
+ {
+ "name": "normal.full",
+ "category": "debug"
+ }
+ ]
+ },
+ {
+ "name": "debug.split.main",
+ "areas": [
+ {
+ "name": "split.main",
+ "category": "debug"
+ }
+ ]
+ },
+ {
+ "name": "debug.split.sub",
+ "areas": [
+ {
+ "name": "split.sub",
+ "category": "debug"
+ }
+ ]
+ },
+ {
+ "name": "debug.fullscreen",
+ "areas": [
+ {
+ "name": "fullscreen",
+ "category": "debug"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "rse1",
+ "layouts": [
+ {
+ "name": "general.normal",
+ "areas": [
+ {
+ "name": "rse1.normal.full",
+ "category": "general"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "rse2",
+ "layouts": [
+ {
+ "name": "general.normal",
+ "areas": [
+ {
+ "name": "rse2.normal.full",
+ "category": "general"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "hud",
+ "layouts": [
+ {
+ "name": "normal.full",
+ "areas": [
+ {
+ "name": "hud.normal.full",
+ "category": "general"
+ }
+ ]
+ },
+ {
+ "name": "upper.left",
+ "areas": [
+ {
+ "name": "hud.upper.left",
+ "category": "speed"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/policy_manager/db/roles.db b/policy_manager/config/roles.json
index 184e602..c657fec 100644
--- a/policy_manager/db/roles.db
+++ b/policy_manager/config/roles.json
@@ -8,7 +8,7 @@
},
{
"category": "debug",
- "role": "launcher | navigation | map | poi | browser | sdl | mixer | radio | hvac | debug | phone | video | music | settings | dashboard | fallback",
+ "role": "launcher | map | poi | browser | sdl | mixer | radio | hvac | debug | phone | video | music | settings | dashboard | fallback",
"area": "normal.full | split.main | split.sub | fullscreen",
"layer": "apps",
},
@@ -35,6 +35,18 @@
"role": "system_alert",
"area": "on_screen",
"layer": "on_screen",
+ },
+ {
+ "category": "tbt",
+ "role": "tbt",
+ "area": "normal.full | master.split.sub",
+ "layer": "remote",
+ },
+ {
+ "category": "receiver",
+ "role": "receiver",
+ "area": "normal.full | split.main | split.sub",
+ "layer": "apps",
}
]
}
diff --git a/policy_manager/db/roles.db.zipc b/policy_manager/config/roles.json.zipc
index 13ada24..facb1d8 100644
--- a/policy_manager/db/roles.db.zipc
+++ b/policy_manager/config/roles.json.zipc
@@ -8,7 +8,7 @@
},
{
"category": "map",
- "role": "navigation",
+ "role": "map",
"area": "normal.full | split.main",
"layer": "apps",
},
diff --git a/policy_manager/config/roles.json.zipc.split b/policy_manager/config/roles.json.zipc.split
new file mode 100644
index 0000000..2bfd35e
--- /dev/null
+++ b/policy_manager/config/roles.json.zipc.split
@@ -0,0 +1,192 @@
+{
+ "ecus": [
+ {
+ "name": "master",
+ "roles":[
+ {
+ "category": "homescreen",
+ "role": "homescreen",
+ "area": "fullscreen",
+ "layer": "homescreen",
+ },
+ {
+ "category": "general",
+ "role": "launcher | browser | debug | settings | hvac | dashboard | fallback",
+ "area": "normal.full | master.split.sub",
+ "description": "For split test, video and music are moved to category:splitable",
+ "layer": "apps",
+ },
+ {
+ "category": "splitable_main",
+ "role": "mixer | video | phone",
+ "area": "split.main",
+ "description": "For split test, video and music are included here",
+ "layer": "apps",
+ },
+ {
+ "category": "splitable_sub",
+ "role": "music | radio | poi",
+ "area": "split.sub",
+ "description": "For split test, video and music are included here",
+ "layer": "apps",
+ },
+ {
+ "category": "software_keyboard",
+ "role": "software_keyboard",
+ "area": "software_keyboard",
+ "layer": "near_homescreen",
+ },
+ {
+ "category": "pop_up",
+ "role": "on_screen | on_screen_phone | onscreen",
+ "area": "on_screen",
+ "layer": "on_screen",
+ },
+ {
+ "category": "system_alert",
+ "role": "system_alert",
+ "area": "on_screen",
+ "layer": "on_screen",
+ },
+ {
+ "category": "tbt",
+ "role": "tbtnavi | tbtnavi2 | dashboard",
+ "area": "master.split.sub",
+ "layer": "remote",
+ },
+ {
+ "category": "meter",
+ "role": "tachometer",
+ "area": "split.main | normal.full",
+ "layer": "apps",
+ "auto_started_roles": "tachometer",
+ },
+ {
+ "category": "receiver",
+ "role": "receiver",
+ "area": "split.sub | normal.full",
+ "layer": "apps",
+ }
+ ]
+ },
+ {
+ "name": "slave",
+ "roles":[
+ {
+ "category": "homescreen",
+ "role": "homescreen",
+ "area": "fullscreen",
+ "layer": "homescreen",
+ },
+ {
+ "category": "map",
+ "role": "navigation | sdl_usb",
+ "area": "normal.full | split.main | fullscreen",
+ "layer": "apps",
+ },
+ {
+ "category": "general",
+ "role": "poi | browser | mixer | radio | hvac | debug | phone | fallback",
+ "area": "normal.full",
+ "description": "For split test, video and music are moved to category:splitable",
+ "layer": "apps",
+ },
+ {
+ "category": "system",
+ "role": "launcher | settings | dashboard",
+ "area": "normal.full",
+ "layer": "apps",
+ },
+ {
+ "category": "splitable",
+ "role": "video | music | sdl_bt | webbrowser | eb",
+ "area": "normal.full | split.main | split.sub",
+ "description": "For split test, video and music are included here",
+ "layer": "apps",
+ },
+ {
+ "category": "software_keyboard",
+ "role": "software_keyboard",
+ "area": "software_keyboard",
+ "layer": "near_homescreen",
+ },
+ {
+ "category": "restriction",
+ "role": "restriction",
+ "area": "restriction.normal | restriction.split.main | restriction.split.sub",
+ "layer": "restriction",
+ "auto_started_roles": "restriction",
+ },
+ {
+ "category": "pop_up",
+ "role": "on_screen | on_screen_phone | onscreen",
+ "area": "on_screen",
+ "layer": "on_screen",
+ },
+ {
+ "category": "system_alert",
+ "role": "system_alert",
+ "area": "on_screen",
+ "layer": "on_screen",
+ },
+ {
+ "category": "tbt",
+ "role": "tbtnavi",
+ "area": "master.split.sub",
+ "layer": "remote",
+ },
+ {
+ "category": "meter",
+ "role": "tachometer",
+ "area": "split.main | normal.full",
+ "layer": "apps",
+ },
+ {
+ "category": "receiver",
+ "role": "receiver",
+ "area": "split.sub | normal.full",
+ "layer": "apps",
+ }
+ ]
+ },
+ {
+ "name": "rse1",
+ "roles":[
+ {
+ "category": "general",
+ "role": "video | music | sdl_bt | webbrowser | eb | poi | browser | mixer | radio | hvac | debug | phone | fallback",
+ "area": "rse1.normal.full",
+ "layer": "RemoteRSE1",
+ }
+ ]
+ },
+ {
+ "name": "rse2",
+ "roles":[
+ {
+ "category": "general",
+ "role": "video | music | sdl_bt | webbrowser | eb | poi | browser | mixer | radio | hvac | debug | phone | fallback",
+ "area": "rse2.normal.full",
+ "layer": "RemoteRSE2",
+ }
+ ]
+ },
+ {
+ "name": "hud",
+ "roles":[
+ {
+ "category": "general",
+ "role": "video | music | sdl_bt | webbrowser | eb | poi | browser | mixer | radio | hvac | debug | phone | fallback",
+ "area": "hud.normal.full",
+ "layer": "RemoteHUD",
+ },
+ {
+ "category": "speed",
+ "role": "video | music | sdl_bt | webbrowser | eb | poi | browser | mixer | radio | hvac | debug | phone | fallback",
+ "area": "hud.upper.left",
+ "layer": "RemoteHUDUpperLeft",
+ }
+ ]
+ },
+ ]
+}
diff --git a/policy_manager/db/roles.db.zipc.split b/policy_manager/db/roles.db.zipc.split
deleted file mode 100644
index cef2631..0000000
--- a/policy_manager/db/roles.db.zipc.split
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "roles":[
- {
- "category": "homescreen",
- "role": "homescreen",
- "area": "fullscreen",
- "layer": "homescreen",
- },
- {
- "category": "map",
- "role": "navigation",
- "area": "normal.full | split.main",
- "layer": "apps",
- },
- {
- "category": "general",
- "role": "launcher | poi | browser | sdl | mixer | radio | hvac | debug | phone | fallback",
- "area": "normal.full",
- "description": "For split test, video and music are moved to category:splitable",
- "layer": "apps",
- },
- {
- "category": "system",
- "role": "settings | dashboard",
- "area": "normal.full",
- "layer": "apps",
- },
- {
- "category": "splitable",
- "role": "video | music",
- "area": "normal.full | split.main | split.sub",
- "description": "For split test, video and music are included here",
- "layer": "apps",
- },
- {
- "category": "software_keyboard",
- "role": "software_keyboard",
- "area": "software_keyboard",
- "layer": "near_homescreen",
- },
- {
- "category": "restriction",
- "role": "restriction",
- "area": "restriction.normal | restriction.split.main | restriction.split.sub",
- "layer": "restriction",
- },
- {
- "category": "pop_up",
- "role": "on_screen | on_screen_phone",
- "area": "on_screen",
- "layer": "on_screen",
- },
- {
- "category": "system_alert",
- "role": "system_alert",
- "area": "on_screen",
- "layer": "on_screen",
- }
- ]
-}
diff --git a/policy_manager/db/states.db b/policy_manager/db/states.db
deleted file mode 100644
index 371be3b..0000000
--- a/policy_manager/db/states.db
+++ /dev/null
@@ -1,174 +0,0 @@
-{
- "states": [
- {
- "name": "homescreen",
- "areas": [
- {
- "name": "fullscreen",
- "category": "homescreen"
- }
- ]
- },
- {
- "name": "map.normal",
- "areas": [
- {
- "name": "normal.full",
- "category": "map"
- }
- ]
- },
- {
- "name": "map.split",
- "areas": [
- {
- "name": "split.main",
- "category": "map"
- },
- {
- "name": "split.sub",
- "category": "splitable"
- }
- ]
- },
- {
- "name": "map.fullscreen",
- "areas": [
- {
- "name": "fullscreen",
- "category": "map"
- }
- ]
- },
- {
- "name": "splitable.normal",
- "areas": [
- {
- "name": "normal.full",
- "category": "splitable"
- }
- ]
- },
- {
- "name": "splitable.split",
- "areas": [
- {
- "name": "split.main",
- "category": "splitable"
- },
- {
- "name": "split.sub",
- "category": "splitable"
- }
- ]
- },
- {
- "name": "general.normal",
- "areas": [
- {
- "name": "normal.full",
- "category": "general"
- }
- ]
- },
- {
- "name": "system.normal",
- "areas": [
- {
- "name": "normal.full",
- "category": "system"
- }
- ]
- },
- {
- "name": "software_keyboard",
- "areas": [
- {
- "name": "software_keyboard",
- "category": "software_keyboard"
- }
- ]
- },
- {
- "name": "restriction.normal",
- "areas": [
- {
- "name": "restriction.normal",
- "category": "restriction"
- }
- ]
- },
- {
- "name": "restriction.split.main",
- "areas": [
- {
- "name": "restriction.split.main",
- "category": "restriction"
- }
- ]
- },
- {
- "name": "restriction.split.sub",
- "areas": [
- {
- "name": "restriction.split.sub",
- "category": "restriction"
- }
- ]
- },
- {
- "name": "pop_up",
- "areas": [
- {
- "name": "on_screen",
- "category": "pop_up"
- }
- ]
- },
- {
- "name": "system_alert",
- "areas": [
- {
- "name": "on_screen",
- "category": "system_alert"
- }
- ]
- },
- {
- "name": "debug.normal",
- "areas": [
- {
- "name": "normal.full",
- "category": "debug"
- }
- ]
- },
- {
- "name": "debug.split.main",
- "areas": [
- {
- "name": "split.main",
- "category": "debug"
- }
- ]
- },
- {
- "name": "debug.split.sub",
- "areas": [
- {
- "name": "split.sub",
- "category": "debug"
- }
- ]
- },
- {
- "name": "debug.fullscreen",
- "areas": [
- {
- "name": "fullscreen",
- "category": "debug"
- }
- ]
- }
- ]
-}
diff --git a/policy_manager/policy_manager.cpp b/policy_manager/policy_manager.cpp
index 90256bb..bf70614 100644
--- a/policy_manager/policy_manager.cpp
+++ b/policy_manager/policy_manager.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2018 TOYOTA MOTOR CORPORATION
- * Copyright (c) 2018 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +26,7 @@
extern "C"
{
-#define AFB_BINDING_VERSION 3
+#define AFB_BINDING_VERSION 2
#include <afb/afb-binding.h>
#include <systemd/sd-event.h>
#include "stm.h"
@@ -35,6 +34,9 @@ extern "C"
namespace pm
{
+static const char kPathRolesConfigFile[] = "/etc/roles.json";
+static const char kPathLayoutsConfigFile[] = "/etc/layouts.json";
+
static const int kInvisibleRoleHistoryNum = 5;
static PolicyManager *g_context;
@@ -60,12 +62,24 @@ PolicyManager::PolicyManager()
role2category(),
category2role(),
category2areas()
-{}
+{
+ this->p_crr_state = new (StmState);
+ this->p_prv_state = new (StmState);
+}
+
+PolicyManager::~PolicyManager()
+{
+ delete this->p_crr_state;
+ delete this->p_prv_state;
+}
-int PolicyManager::initialize()
+int PolicyManager::initialize(std::string ecu_name)
{
int ret = 0;
+ // Set ECU name
+ this->ecu_name = ecu_name;
+
// Create convert map
for (int i = StmEvtNoMin; i <= StmEvtNoMax; i++)
{
@@ -85,19 +99,19 @@ int PolicyManager::initialize()
this->areaname2no[kStmAreaName[i]] = i;
}
- // Load roles.db
- ret = this->loadRoleDb();
+ // Load roles config
+ ret = this->loadRolesConfigFile();
if (0 > ret)
{
- HMI_ERROR("Load roles.db Error!!");
+ HMI_ERROR("Load roles config file Error!!");
return ret;
}
- // Load states.db
- ret = this->loadStateDb();
+ // Load layouts config
+ ret = this->loadLayoutsConfigFile();
if (0 > ret)
{
- HMI_ERROR("Load states.db Error!!");
+ HMI_ERROR("Load layouts config file Error!!");
return ret;
}
@@ -105,7 +119,7 @@ int PolicyManager::initialize()
this->initializeState();
// Initialize StateTransitioner
- stmInitialize();
+ stmInitialize(ecu_name.c_str());
// Store instance
pm::g_context = this;
@@ -171,7 +185,7 @@ int PolicyManager::setInputEventData(json_object *json_in)
itr = this->role2category.find("fallback");
if (this->role2category.end() != itr)
{
- HMI_DEBUG("Role:%s is not registered in roles.db, fallback as normal app", role);
+ HMI_DEBUG("Role:%s is not registered in roles config file, fallback as normal app", role);
category = this->role2category["fallback"];
}
}
@@ -247,6 +261,7 @@ void PolicyManager::undoState()
this->dumpLayerState(this->crr_layers);
this->crr_layers = this->prv_layers;
+ this->crr_invisible_role_history = this->prv_invisible_role_history;
HMI_DEBUG(">>>>>>>>>> AFTER UNDO");
this->dumpLayerState(this->crr_layers);
@@ -254,9 +269,25 @@ void PolicyManager::undoState()
void PolicyManager::initializeState()
{
+ this->initializeModeState();
this->initializeLayerState();
}
+void PolicyManager::initializeModeState()
+{
+ Mode init_car_ele;
+ init_car_ele.state = "none";
+ init_car_ele.changed = false;
+
+ for (int i = StmCarElementNoMin; i <= StmCarElementNoMax; i++)
+ {
+ const char *car_ele_name = kStmCarElementName[i];
+ this->crr_car_elements[car_ele_name] = init_car_ele;
+ }
+
+ this->prv_car_elements = this->crr_car_elements;
+}
+
void PolicyManager::initializeLayerState()
{
AreaState init_area;
@@ -316,47 +347,109 @@ void PolicyManager::addStateToJson(const char *layer_name, bool changed,
json_object_object_add(*json_out, "areas", json_areas);
}
-void PolicyManager::updateState(int event_id, StmState crr_state)
+void PolicyManager::updateState(int event_id)
+{
+ this->updateModeState();
+ this->updateLayer(event_id);
+}
+
+void PolicyManager::updateModeState()
{
- this->updateLayer(event_id, crr_state);
+ int car_state_no;
+ std::string car_state;
+ bool changed;
+
+ // Store previous layers
+ this->prv_car_elements = this->crr_car_elements;
+
+ // Update car elements
+ HMI_DEBUG(">>> CAR ELEMENTS");
+ for (int car_ele_no = StmCarElementNoMin;
+ car_ele_no <= StmCarElementNoMax; car_ele_no++)
+ {
+ const char *car_ele_name = kStmCarElementName[car_ele_no];
+
+ car_state_no = this->p_crr_state->car_element[car_ele_no].state;
+ car_state = kStmCarElementStateNameList[car_ele_no][car_state_no];
+ changed = (this->p_crr_state->car_element[car_ele_no].changed) ? true : false;
+
+ this->crr_car_elements[car_ele_name].state = car_state;
+ this->crr_car_elements[car_ele_name].changed = changed;
+
+ HMI_DEBUG(">>> >>> NAME: %s", car_ele_name);
+ HMI_DEBUG(">>> >>> >>> STATE:%s", car_state.c_str());
+ HMI_DEBUG(">>> >>> >>> CHANGED:%s", (changed) ? "true" : "false");
+ }
}
-void PolicyManager::updateLayer(int event_id, StmState crr_state)
+void PolicyManager::updateLayer(int event_id)
{
for (int layer_no = StmLayerNoMin;
layer_no <= StmLayerNoMax; layer_no++)
{
HMI_DEBUG(">>> LAYER:%s CHANGED:%d LAYOUT:%s",
- kStmLayerName[layer_no], crr_state.layer[layer_no].changed,
- kStmLayoutName[crr_state.layer[layer_no].state]);
+ kStmLayerName[layer_no], this->p_crr_state->layer[layer_no].changed,
+ kStmLayoutName[this->p_crr_state->layer[layer_no].state]);
}
// Store previous layers
this->prv_layers = this->crr_layers;
+ // Store previous role history
+ this->prv_invisible_role_history = this->crr_invisible_role_history;
+
// Update layers
for (int layer_no = StmLayerNoMin;
layer_no <= StmLayerNoMax; layer_no++)
{
const char *layer_name = kStmLayerName[layer_no];
+ // If restriction mode is changed to mode2 on,
+ // store current state for state of restriction mode off
+ if (this->changedRestrictionModeTo2On() ||
+ this->changedAccelPedalOffToOn()) // Control by Accel
+ // this->changedLightstatusBrakeOnToOff()) // Control by Brake
+ {
+ HMI_DEBUG("Store current state for state of restriction mode off");
+ this->prv_layers_car_stop[layer_name] = this->crr_layers[layer_name];
+ }
+
// This layer is changed?
- int changed = crr_state.layer[layer_no].changed;
+ int changed = this->p_crr_state->layer[layer_no].changed;
if (changed)
{
HMI_DEBUG(">>>>>>>>>> Update layout of layer:%s", layer_name);
// Get current layout name of this layer
- int crr_layout_state_no = crr_state.layer[layer_no].state;
+ int crr_layout_state_no = this->p_crr_state->layer[layer_no].state;
std::string crr_layout_name = std::string(kStmLayoutName[crr_layout_state_no]);
LayoutState crr_layout_state;
- this->updateLayout(event_id, layer_no,
- crr_layout_name, crr_layout_state);
+ changed = this->updateLayout(event_id, layer_no,
+ crr_layout_name, crr_layout_state);
// Update current layout of this layer
this->crr_layers[layer_name].layout_state = crr_layout_state;
}
+ else
+ {
+ int category_no = STM_GET_CATEGORY_FROM_ID(event_id);
+ std::string req_ctg = kStmCategoryName[category_no];
+ std::string req_role = this->req_role_list[event_id];
+ for (const auto &ctg : this->layer2categories[layer_name])
+ {
+ if (ctg == req_ctg)
+ {
+ // If layer is not changed and requested role is in this layer,
+ // push requested role to history stack
+ // because the application which has this role have been started
+ HMI_DEBUG("Add requested role to history "
+ "because the application which has this role have been started");
+ this->pushInvisibleRoleHistory(req_ctg, req_role);
+ }
+ }
+ }
+
// Update changed flag
this->crr_layers[layer_name].changed = (changed) ? true : false;
}
@@ -376,7 +469,7 @@ void PolicyManager::updateLayer(int event_id, StmState crr_state)
int PolicyManager::updateLayout(int event_id, int layer_no,
std::string crr_layout_name, LayoutState &crr_layout_state)
{
- int changed;
+ int changed = 1;
int event_no = STM_GET_EVENT_FROM_ID(event_id);
int category_no = STM_GET_CATEGORY_FROM_ID(event_id);
@@ -393,7 +486,37 @@ int PolicyManager::updateLayout(int event_id, int layer_no,
LayoutState prv_layout_state = this->prv_layers[layer_name].layout_state;
std::string prv_layout_name = prv_layout_state.name;
- if ((prv_layout_name == crr_layout_name) &&
+ if (this->changedRestrictionMode2OnToOther() ||
+ this->changedAccelPedalOnToOff()) // Control by Accel
+ // this->changedLightstatusBrakeOffToOn()) // Control by Brake
+ {
+ // If restriction mode is changed from mode2 -> mode1,
+ // restore state of restriction mode off
+ HMI_DEBUG("Restriction mode is changed from mode2 -> mode1, so restore state of restriction mode off");
+ crr_layout_state = this->prv_layers_car_stop[layer_name].layout_state;
+ crr_layout_name = crr_layout_state.name;
+ if ((prv_layout_name == crr_layout_name) &&
+ (kStmAreaName[StmAreaNoNone] == crr_layout_name))
+ {
+ changed = 0;
+ }
+ else
+ {
+ // If the roles which is exist in previous layout is not in current,
+ // push to role history
+ for (const auto &prv_as : prv_layout_state.area_list)
+ {
+ for (const auto &crr_as : crr_layout_state.area_list)
+ {
+ if (prv_as.role == crr_as.role)
+ break;
+ }
+
+ this->pushInvisibleRoleHistory(prv_as.category, prv_as.role);
+ }
+ }
+ }
+ else if ((prv_layout_name == crr_layout_name) &&
(kStmLayoutName[StmLayoutNoNone] == crr_layout_name))
{
// If previous and current layout are none
@@ -573,10 +696,35 @@ int PolicyManager::updateLayout(int event_id, int layer_no,
return changed;
}
-void PolicyManager::createOutputInformation(StmState crr_state, json_object **json_out)
+void PolicyManager::createOutputInformation(json_object **json_out)
{
json_object *json_tmp;
+ // Create car element information
+ // {
+ // "car_elements": [
+ // {
+ // "parking_brake": {
+ // "changed": <bool>,
+ // "state": <const char*>
+ // },
+ // ...
+ // },
+ json_object *json_car_ele = json_object_new_array();
+ const char *car_ele_name;
+ for (int car_ele_no = StmCarElementNoMin;
+ car_ele_no <= StmCarElementNoMax; car_ele_no++)
+ {
+ car_ele_name = kStmCarElementName[car_ele_no];
+ json_tmp = json_object_new_object();
+ this->addStateToJson(car_ele_name,
+ this->crr_car_elements[car_ele_name].changed,
+ this->crr_car_elements[car_ele_name].state,
+ &json_tmp);
+ json_object_array_add(json_car_ele, json_tmp);
+ }
+ json_object_object_add(*json_out, "car_elements", json_car_ele);
+
// Create layout information
//
// "layers": [
@@ -609,6 +757,39 @@ void PolicyManager::createOutputInformation(StmState crr_state, json_object **js
json_object_object_add(*json_out, "layers", json_layer);
}
+void PolicyManager::controlTimerEvent()
+{
+ // for ALS2018 (RestrictionMode = Running and after 3sec)
+ // if (this->p_crr_state->car_element[StmCarElementNoRunning].changed)
+ // {
+ // if (StmRunningNoRun == this->p_crr_state->car_element[StmCarElementNoRunning].state)
+ // {
+ // // Set delay event(restriction mode on)
+ // this->setStateTransitionProcessToSystemd(StmEvtNoRestrictionModeOn,
+ // 3000, "");
+ // }
+ // else if (StmRunningNoStop ==
+ // this->p_crr_state->car_element[StmCarElementNoRunning].state)
+ // {
+ // // Stop timer for restriction on event
+ // if (this->event_source_list.find(StmEvtNoRestrictionModeOn) !=
+ // this->event_source_list.end())
+ // {
+ // HMI_DEBUG("Stop timer for restriction on");
+ // sd_event_source *event_source = this->event_source_list[StmEvtNoRestrictionModeOn];
+ // int ret = sd_event_source_set_enabled(event_source, SD_EVENT_OFF);
+ // if (0 > ret)
+ // {
+ // HMI_ERROR("Failed to stop timer");
+ // }
+ // }
+
+ // // Set event(restriction mode off)
+ // this->setStateTransitionProcessToSystemd(StmEvtNoRestrictionModeOff, 0, "");
+ // }
+ // }
+}
+
int PolicyManager::transitionState(sd_event_source *source, void *data)
{
HMI_DEBUG(">>>>>>>>>> START STATE TRANSITION");
@@ -624,9 +805,11 @@ int PolicyManager::transitionState(sd_event_source *source, void *data)
kStmCategoryName[category_no],
kStmAreaName[area_no]);
+ // Store current state
+ *(this->p_prv_state) = *(this->p_crr_state);
+
// Transition state
- StmState crr_state;
- int ret = stmTransitionState(event_id, &crr_state);
+ int ret = stmTransitionState(event_id, this->p_crr_state);
if (0 > ret)
{
HMI_ERROR("Failed transition state");
@@ -648,11 +831,11 @@ int PolicyManager::transitionState(sd_event_source *source, void *data)
}
// Update state which is managed by PolicyManager
- this->updateState(event_id, crr_state);
+ this->updateState(event_id);
// Create output information for ResourceManager
json_object *json_out = json_object_new_object();
- this->createOutputInformation(crr_state, &json_out);
+ this->createOutputInformation(&json_out);
// Notify changed state
if (nullptr != this->callback.onStateTransitioned)
@@ -660,6 +843,9 @@ int PolicyManager::transitionState(sd_event_source *source, void *data)
this->callback.onStateTransitioned(json_out);
}
+ // Start/Stop timer events
+ this->controlTimerEvent();
+
// Release json_object
json_object_put(json_out);
@@ -690,15 +876,15 @@ int PolicyManager::timerEvent(sd_event_source *source, uint64_t usec, void *data
int PolicyManager::setStateTransitionProcessToSystemd(int event_id, uint64_t delay_ms, std::string role)
{
struct sd_event_source *event_source;
- HMI_DEBUG("wm:pm event_id:0x%x delay:%d role:%s", event_id, delay_ms, role.c_str());
+ HMI_DEBUG("event_id:0x%x delay:%d role:%s", event_id, delay_ms, role.c_str());
if (0 == delay_ms)
{
- int ret = sd_event_add_defer(afb_api_get_event_loop(afbBindingV3root), &event_source,
+ int ret = sd_event_add_defer(afb_daemon_get_event_loop(), &event_source,
&pm::transitionStateWrapper, new int(event_id));
if (0 > ret)
{
- HMI_ERROR("wm:pm Failed to sd_event_add_defer: errno:%d", ret);
+ HMI_ERROR("Faild to sd_event_add_defer: errno:%d", ret);
return -1;
}
}
@@ -712,12 +898,12 @@ int PolicyManager::setStateTransitionProcessToSystemd(int event_id, uint64_t del
uint64_t usec = (time_spec.tv_sec * 1000000) + (time_spec.tv_nsec / 1000) + (delay_ms * 1000);
// Set timer
- int ret = sd_event_add_time(afb_api_get_event_loop(afbBindingV3root), &event_source,
+ int ret = sd_event_add_time(afb_daemon_get_event_loop(), &event_source,
CLOCK_BOOTTIME, usec, 1,
&pm::timerEventWrapper, new int(event_id));
if (0 > ret)
{
- HMI_ERROR("wm:pm Failed to sd_event_add_time: errno:%d", ret);
+ HMI_ERROR("Faild to sd_event_add_time: errno:%d", ret);
return -1;
}
}
@@ -728,22 +914,156 @@ int PolicyManager::setStateTransitionProcessToSystemd(int event_id, uint64_t del
return 0;
}
-int PolicyManager::loadRoleDb()
+bool PolicyManager::changedRestrictionModeTo2On()
+{
+ // TODO: If possible thie process should be include in zipc stm in the future
+ if (this->p_crr_state->car_element[StmCarElementNoRestrictionMode].changed &&
+ (StmRestrictionModeSttNoOn != this->p_prv_state->car_element[StmCarElementNoRestrictionMode].state) &&
+ (StmRestrictionModeSttNoOn == this->p_crr_state->car_element[StmCarElementNoRestrictionMode].state))
+ {
+ return true;
+ }
+ return false;
+}
+
+bool PolicyManager::changedRestrictionMode2OnToOther()
+{
+ // TODO: If possible thie process should be include in zipc stm in the future
+ if (this->p_crr_state->car_element[StmCarElementNoRestrictionMode].changed &&
+ (StmRestrictionModeSttNoOn == this->p_prv_state->car_element[StmCarElementNoRestrictionMode].state) &&
+ (StmRestrictionModeSttNoOn != this->p_crr_state->car_element[StmCarElementNoRestrictionMode].state))
+ {
+ return true;
+ }
+ return false;
+}
+
+// bool PolicyManager::changedLightstatusBrakeOffToOn()
+// {
+// // TODO: For master
+// // If possible thie process should be include in zipc stm in the future
+// if (("master" == this->ecu_name) &&
+// this->p_crr_state->car_element[StmCarElementNoLightstatusBrake].changed &&
+// (StmLightstatusBrakeSttNoOff == this->p_prv_state->car_element[StmCarElementNoLightstatusBrake].state) &&
+// (StmLightstatusBrakeSttNoOn == this->p_crr_state->car_element[StmCarElementNoLightstatusBrake].state))
+// {
+// return true;
+// }
+// return false;
+// }
+
+// bool PolicyManager::changedLightstatusBrakeOnToOff()
+// {
+// // TODO: For master
+// // If possible thie process should be include in zipc stm in the future
+// if (("master" == this->ecu_name) &&
+// this->p_crr_state->car_element[StmCarElementNoLightstatusBrake].changed &&
+// (StmLightstatusBrakeSttNoOn == this->p_prv_state->car_element[StmCarElementNoLightstatusBrake].state) &&
+// (StmLightstatusBrakeSttNoOff == this->p_crr_state->car_element[StmCarElementNoLightstatusBrake].state))
+// {
+// return true;
+// }
+// return false;
+// }
+
+bool PolicyManager::changedAccelPedalOffToOn()
{
- std::string file_name(get_file_path("roles.db"));
+ // TODO: For master
+ // If possible thie process should be include in zipc stm in the future
+ if (("master" == this->ecu_name) &&
+ this->p_crr_state->car_element[StmCarElementNoAccelPedal].changed &&
+ (StmAccelPedalSttNoOff == this->p_prv_state->car_element[StmCarElementNoAccelPedal].state) &&
+ (StmAccelPedalSttNoOn == this->p_crr_state->car_element[StmCarElementNoAccelPedal].state))
+ {
+ return true;
+ }
+ return false;
+}
- // Load roles.db
+bool PolicyManager::changedAccelPedalOnToOff()
+{
+ // TODO: For master
+ // If possible thie process should be include in zipc stm in the future
+ if (("master" == this->ecu_name) &&
+ this->p_crr_state->car_element[StmCarElementNoAccelPedal].changed &&
+ (StmAccelPedalSttNoOn == this->p_prv_state->car_element[StmCarElementNoAccelPedal].state) &&
+ (StmAccelPedalSttNoOff == this->p_crr_state->car_element[StmCarElementNoAccelPedal].state))
+ {
+ return true;
+ }
+ return false;
+}
+
+int PolicyManager::loadRolesConfigFile()
+{
+ std::string file_name;
+
+ // Get afm application installed dir
+ char const *afm_app_install_dir = getenv("AFM_APP_INSTALL_DIR");
+ HMI_DEBUG("afm_app_install_dir:%s", afm_app_install_dir);
+
+ if (!afm_app_install_dir)
+ {
+ HMI_ERROR("AFM_APP_INSTALL_DIR is not defined");
+ }
+ else
+ {
+ file_name = std::string(afm_app_install_dir) + std::string(pm::kPathRolesConfigFile);
+ }
+
+ // Load roles config file
json_object *json_obj;
int ret = this->inputJsonFilie(file_name.c_str(), &json_obj);
if (0 > ret)
{
- HMI_ERROR("Could not open roles.db, so use default role information");
- json_obj = json_tokener_parse(kDefaultRoleDb);
+ HMI_ERROR("Could not open %s, so use default role information", pm::kPathRolesConfigFile);
+ json_obj = json_tokener_parse(kDefaultRolesConfig);
}
HMI_DEBUG("json_obj dump:%s", json_object_get_string(json_obj));
+ // Parse ecus
+ json_object *json_cfg;
+ if (!json_object_object_get_ex(json_obj, "ecus", &json_cfg))
+ {
+ HMI_ERROR("Parse Error!!");
+ return -1;
+ }
+
+ int num_ecu = json_object_array_length(json_cfg);
+ HMI_DEBUG("json_cfg(ecus) len:%d", num_ecu);
+
+ const char* c_ecu_name;
+ json_object *json_ecu;
+ for (int i = 0; i < num_ecu; i++)
+ {
+ json_ecu= json_object_array_get_idx(json_cfg, i);
+
+ c_ecu_name = this->getStringFromJson(json_ecu, "name");
+ if (nullptr == c_ecu_name)
+ {
+ HMI_ERROR("Parse Error!!");
+ return -1;
+ }
+
+ if (std::string(c_ecu_name) == this->ecu_name)
+ {
+ break;
+ }
+ else
+ {
+ json_ecu = nullptr;
+ }
+ }
+
+ if (!json_ecu)
+ {
+ HMI_ERROR("Areas for ecu:%s is NOT exist!!", this->ecu_name.c_str());
+ return -1;
+ }
+
+ // Parse roles
json_object *json_roles;
- if (!json_object_object_get_ex(json_obj, "roles", &json_roles))
+ if (!json_object_object_get_ex(json_ecu, "roles", &json_roles))
{
HMI_ERROR("Parse Error!!");
return -1;
@@ -790,6 +1110,22 @@ int PolicyManager::loadRoleDb()
this->category2role[category] = std::string(roles);
this->category2areas[category] = vct_areas;
this->layer2categories[layer].push_back(category);
+
+ // TODO: For run-by-default applications, set history in advance
+ const char *auto_started_roles;
+ auto_started_roles = this->getStringFromJson(json_tmp, "auto_started_roles");
+ if (nullptr != auto_started_roles)
+ {
+ std::vector<std::string> vct_auto_started_roles;
+ vct_auto_started_roles =
+ this->parseString(std::string(auto_started_roles), '|');
+
+ for (auto itr = vct_auto_started_roles.end() - 1;
+ itr >= vct_auto_started_roles.begin(); --itr)
+ {
+ this->pushInvisibleRoleHistory(category, *itr);
+ }
+ }
}
// Check
@@ -813,44 +1149,105 @@ int PolicyManager::loadRoleDb()
HMI_DEBUG("key:%s, val:%s", x.first.c_str(), y.c_str());
}
}
+
+ HMI_DEBUG("Check layer2categories");
+ for (const auto &x : this->layer2categories)
+ {
+ for (const auto &y : x.second)
+ {
+ HMI_DEBUG("key:%s, val:%s", x.first.c_str(), y.c_str());
+ }
+ }
return 0;
}
-int PolicyManager::loadStateDb()
+int PolicyManager::loadLayoutsConfigFile()
{
HMI_DEBUG("Call");
- std::string file_name(get_file_path("states.db"));
+ // Get afm application installed dir
+ char const *afm_app_install_dir = getenv("AFM_APP_INSTALL_DIR");
+ HMI_DEBUG("afm_app_install_dir:%s", afm_app_install_dir);
- // Load states.db
+ std::string file_name;
+ if (!afm_app_install_dir)
+ {
+ HMI_ERROR("AFM_APP_INSTALL_DIR is not defined");
+ }
+ else
+ {
+ file_name = std::string(afm_app_install_dir) + std::string(pm::kPathLayoutsConfigFile);
+ }
+
+ // Load states config file
json_object *json_obj;
int ret = this->inputJsonFilie(file_name.c_str(), &json_obj);
if (0 > ret)
{
- HMI_DEBUG("Could not open states.db, so use default layout information");
- json_obj = json_tokener_parse(kDefaultStateDb);
+ HMI_DEBUG("Could not open %s, so use default layout information", pm::kPathLayoutsConfigFile);
+ json_obj = json_tokener_parse(kDefaultLayoutsConfig);
}
HMI_DEBUG("json_obj dump:%s", json_object_get_string(json_obj));
- // Perse states
- HMI_DEBUG("Perse states");
+ // Parse ecus
json_object *json_cfg;
- if (!json_object_object_get_ex(json_obj, "states", &json_cfg))
+ if (!json_object_object_get_ex(json_obj, "ecus", &json_cfg))
{
HMI_ERROR("Parse Error!!");
return -1;
}
- int len = json_object_array_length(json_cfg);
- HMI_DEBUG("json_cfg len:%d", len);
- HMI_DEBUG("json_cfg dump:%s", json_object_get_string(json_cfg));
+ int num_ecu = json_object_array_length(json_cfg);
+ HMI_DEBUG("json_cfg(ecus) len:%d", num_ecu);
+
+ const char* c_ecu_name;
+ json_object *json_ecu;
+ for (int i = 0; i < num_ecu; i++)
+ {
+ json_ecu= json_object_array_get_idx(json_cfg, i);
+
+ c_ecu_name = this->getStringFromJson(json_ecu, "name");
+ if (nullptr == c_ecu_name)
+ {
+ HMI_ERROR("Parse Error!!");
+ return -1;
+ }
+
+ if (std::string(c_ecu_name) == this->ecu_name)
+ {
+ break;
+ }
+ else
+ {
+ json_ecu = nullptr;
+ }
+ }
+
+ if (!json_ecu)
+ {
+ HMI_ERROR("Areas for ecu:%s is NOT exist!!", this->ecu_name.c_str());
+ return -1;
+ }
+
+ // Perse layouts
+ HMI_DEBUG("Perse layouts");
+ json_object *json_layouts;
+ if (!json_object_object_get_ex(json_ecu, "layouts", &json_layouts))
+ {
+ HMI_ERROR("Parse Error!!");
+ return -1;
+ }
+
+ int len = json_object_array_length(json_layouts);
+ HMI_DEBUG("json_layouts len:%d", len);
+ HMI_DEBUG("json_layouts dump:%s", json_object_get_string(json_layouts));
const char *layout;
const char *role;
const char *category;
for (int i = 0; i < len; i++)
{
- json_object *json_tmp = json_object_array_get_idx(json_cfg, i);
+ json_object *json_tmp = json_object_array_get_idx(json_layouts, i);
layout = this->getStringFromJson(json_tmp, "name");
if (nullptr == layout)
@@ -955,35 +1352,35 @@ int PolicyManager::loadStateDb()
void PolicyManager::pushInvisibleRoleHistory(std::string category, std::string role)
{
- auto i = std::remove_if(this->invisible_role_history[category].begin(),
- this->invisible_role_history[category].end(),
+ auto i = std::remove_if(this->crr_invisible_role_history[category].begin(),
+ this->crr_invisible_role_history[category].end(),
[role](std::string x) { return (role == x); });
- if (this->invisible_role_history[category].end() != i)
+ if (this->crr_invisible_role_history[category].end() != i)
{
- this->invisible_role_history[category].erase(i);
+ this->crr_invisible_role_history[category].erase(i);
}
- this->invisible_role_history[category].push_back(role);
+ this->crr_invisible_role_history[category].push_back(role);
- if (pm::kInvisibleRoleHistoryNum < invisible_role_history[category].size())
+ if (pm::kInvisibleRoleHistoryNum < crr_invisible_role_history[category].size())
{
- this->invisible_role_history[category].erase(
- this->invisible_role_history[category].begin());
+ this->crr_invisible_role_history[category].erase(
+ this->crr_invisible_role_history[category].begin());
}
}
std::string PolicyManager::popInvisibleRoleHistory(std::string category)
{
std::string role;
- if (invisible_role_history[category].empty())
+ if (crr_invisible_role_history[category].empty())
{
role = "";
}
else
{
- role = this->invisible_role_history[category].back();
- this->invisible_role_history[category].pop_back();
+ role = this->crr_invisible_role_history[category].back();
+ this->crr_invisible_role_history[category].pop_back();
}
return role;
}
@@ -1092,7 +1489,7 @@ void PolicyManager::dumpInvisibleRoleHistory()
std::string category = std::string(kStmCategoryName[ctg_no]);
std::string str = category + " [ ";
- for (const auto &i : this->invisible_role_history[category])
+ for (const auto &i : this->crr_invisible_role_history[category])
str += (i + " > ");
str += "]";
@@ -1128,7 +1525,7 @@ std::string PolicyManager::deleteSpace(std::string str)
return ret;
}
-const char *PolicyManager::kDefaultRoleDb = "{ \
+const char *PolicyManager::kDefaultRolesConfig = "{ \
\"roles\":[ \
{ \
\"category\": \"homescreen\", \
@@ -1173,8 +1570,8 @@ const char *PolicyManager::kDefaultRoleDb = "{ \
] \
}";
-const char *PolicyManager::kDefaultStateDb = "{ \
- \"states\": [ \
+const char *PolicyManager::kDefaultLayoutsConfig = "{ \
+ \"layouts\": [ \
{ \
\"name\": \"homescreen\", \
\"layer\": \"far_homescreen\", \
diff --git a/policy_manager/policy_manager.hpp b/policy_manager/policy_manager.hpp
index 798b706..f3ec0f9 100644
--- a/policy_manager/policy_manager.hpp
+++ b/policy_manager/policy_manager.hpp
@@ -31,7 +31,7 @@ class PolicyManager
{
public:
explicit PolicyManager();
- ~PolicyManager() = default;
+ ~PolicyManager();
using Handler = std::function<void(json_object *)>;
@@ -41,7 +41,7 @@ class PolicyManager
Handler onError;
} CallbackTable;
- int initialize();
+ int initialize(std::string ecu_name);
void registerCallback(CallbackTable callback_table);
int setInputEventData(json_object *json_in);
int executeStateTransition();
@@ -87,10 +87,19 @@ class PolicyManager
bool changed;
} LayerState;
+ typedef struct Mode
+ {
+ std::string state;
+ bool changed;
+ } Mode;
+
typedef std::vector<std::string> Areas;
typedef std::vector<std::string> Categories;
typedef std::vector<std::string> Roles;
+ StmState *p_crr_state;
+ StmState *p_prv_state;
+
// Convert map
std::unordered_map<std::string, int> eventname2no;
std::unordered_map<std::string, int> categoryname2no;
@@ -107,27 +116,45 @@ class PolicyManager
CallbackTable callback;
+ std::unordered_map<std::string, Mode> prv_car_elements;
+ std::unordered_map<std::string, Mode> crr_car_elements;
+
std::unordered_map<std::string, LayerState> prv_layers;
std::unordered_map<std::string, LayerState> crr_layers;
+ std::unordered_map<std::string, LayerState> prv_layers_car_stop;
+
std::unordered_map<std::string, LayoutState> default_layouts;
- std::map<std::string, Roles> invisible_role_history;
+ std::map<std::string, Roles> crr_invisible_role_history;
+ std::map<std::string, Roles> prv_invisible_role_history;
+
+ std::string ecu_name;
void initializeState();
+ void initializeModeState();
void initializeLayerState();
- void updateState(int event_id, StmState crr_state);
- void updateLayer(int event_id, StmState crr_state);
+ void updateState(int event_id);
+ void updateModeState();
+ void updateLayer(int event_id);
int updateLayout(int event_id, int layer_no,
std::string crr_layout_name, LayoutState &crr_layout_state);
- void createOutputInformation(StmState crr_state, json_object **json_out);
+ void createOutputInformation(json_object **json_out);
+ void controlTimerEvent();
int setStateTransitionProcessToSystemd(int event, uint64_t delay_ms, std::string role);
void pushInvisibleRoleHistory(std::string category, std::string role);
std::string popInvisibleRoleHistory(std::string category);
- int loadRoleDb();
- int loadStateDb();
+ bool changedRestrictionModeTo2On();
+ bool changedRestrictionMode2OnToOther();
+ // bool changedLightstatusBrakeOffToOn();
+ // bool changedLightstatusBrakeOnToOff();
+ bool changedAccelPedalOffToOn();
+ bool changedAccelPedalOnToOff();
+
+ int loadRolesConfigFile();
+ int loadLayoutsConfigFile();
void dumpLayerState(std::unordered_map<std::string, LayerState> &layers);
void dumpInvisibleRoleHistory();
@@ -142,8 +169,8 @@ class PolicyManager
std::vector<std::string> parseString(std::string str, char delimiter);
std::string deleteSpace(std::string str);
- static const char *kDefaultRoleDb;
- static const char *kDefaultStateDb;
+ static const char *kDefaultRolesConfig;
+ static const char *kDefaultLayoutsConfig;
};
#endif // TMCAGLWM_POLICY_MANAGER_HPP
diff --git a/policy_manager/stm/stm.c b/policy_manager/stm/stm.c
index c63a599..fd3eff6 100644
--- a/policy_manager/stm/stm.c
+++ b/policy_manager/stm/stm.c
@@ -22,9 +22,18 @@ const char* kStmEventName[] = {
"none",
"activate",
"deactivate",
+ "trans_gear_neutral",
+ "trans_gear_not_neutral",
+ "parking_brake_off",
+ "parking_brake_on",
+ "accel_pedal_off",
+ "accel_pedal_on",
+ "lamp_off",
+ "lamp_on",
+ "lightstatus_brake_off",
+ "lightstatus_brake_on",
"restriction_mode_off",
- "restriction_mode_1_on",
- "restriction_mode_2_on",
+ "restriction_mode_on",
"undo",
};
@@ -34,11 +43,16 @@ const char* kStmCategoryName[] = {
"map",
"general",
"splitable",
+ "splitable_main",
+ "splitable_sub",
"pop_up",
"system_alert",
"restriction",
"system",
"software_keyboard",
+ "tbt",
+ "meter",
+ "receiver",
"debug",
};
@@ -53,6 +67,8 @@ const char* kStmAreaName[] = {
"restriction.split.main",
"restriction.split.sub",
"software_keyboard",
+ "master.split.sub",
+ "upper.left",
};
const char* kStmLayoutName[] = {
@@ -71,6 +87,17 @@ const char* kStmLayoutName[] = {
"restriction.split.sub",
"system.normal",
"software_keyboard",
+ "tbt",
+ "remote_tbt",
+ "remote_rse1",
+ "remote_rse2",
+ "remote_hud",
+ "remote_hud_upper_left",
+ "meter.normal",
+ "meter_receiver",
+ "meter_splitable",
+ "splitable_receiver",
+ "receiver.split",
"debug.normal",
"debug.split.main",
"debug.split.sub",
@@ -83,9 +110,14 @@ const char* kStmLayerName[] = {
"near_homescreen",
"restriction",
"on_screen",
+ "remote",
+ "remote_hud",
+ "remote_hud_upper_left",
+ "remote_rse1",
+ "remote_rse2"
};
-const char* kStmModeName[] = {
+const char* kStmCarElementName[] = {
"trans_gear",
"parking_brake",
"accel_pedal",
@@ -95,18 +127,53 @@ const char* kStmModeName[] = {
"restriction_mode",
};
+const char* kStmTransGearStateName[] = {
+ "neutral",
+ "not_neutral"
+};
+
+const char* kStmParkingBrakeStateName[] = {
+ "off",
+ "on"
+};
+
+const char* kStmAccelPedalStateName[] = {
+ "off",
+ "on"
+};
+
+const char* kStmRunningSttNo2Name[] = {
+ "stop",
+ "run"
+};
+
+const char* kStmLampStateName[] = {
+ "off",
+ "on"
+};
+
+const char* kStmLightstatusBrakeStateName[] = {
+ "off",
+ "on"
+};
+
const char* kStmRestrictionModeStateName[] = {
"off",
- "1on",
- "2on",
+ "on",
};
-const char** kStmModeStateNameList[] = {
+const char** kStmCarElementStateNameList[] = {
+ kStmTransGearStateName,
+ kStmParkingBrakeStateName,
+ kStmAccelPedalStateName,
+ kStmRunningSttNo2Name,
+ kStmLampStateName,
+ kStmLightstatusBrakeStateName,
kStmRestrictionModeStateName,
};
-void stmInitialize() {
- stmInitializeInner();
+void stmInitialize(const char *ecu_name) {
+ stmInitializeInner(ecu_name);
}
int stmTransitionState(int event, StmState* state) {
diff --git a/policy_manager/stm/stm.h b/policy_manager/stm/stm.h
index deebf9c..487adb5 100644
--- a/policy_manager/stm/stm.h
+++ b/policy_manager/stm/stm.h
@@ -32,14 +32,32 @@
#define STM_GET_AREA_FROM_ID(id) \
(((id) >> 16) & 0xFF)
+// ECU type
+enum StmEcuType {
+ StmEcuTypeIVI = 0,
+ StmEcuTypeMeter,
+ StmEcuTypeHUD,
+ StmEcuTypeRSE1,
+ StmEcuTypeRSE2
+};
+
// Event number
enum StmEvtNo {
StmEvtNoNone = 0,
StmEvtNoActivate,
StmEvtNoDeactivate,
+ StmEvtNoTransGearN,
+ StmEvtNoTransGearNotN,
+ StmEvtNoParkingBrakeOff,
+ StmEvtNoParkingBrakeOn,
+ StmEvtNoAccelPedalOff,
+ StmEvtNoAccelPedalOn,
+ StmEvtNoLampOff,
+ StmEvtNoLampOn,
+ StmEvtNoLightstatusBrakeOff,
+ StmEvtNoLightstatusBrakeOn,
StmEvtNoRestrictionModeOff,
- StmEvtNoRestrictionMode1On,
- StmEvtNoRestrictionMode2On,
+ StmEvtNoRestrictionModeOn,
StmEvtNoUndo,
StmEvtNoNum,
@@ -55,11 +73,16 @@ enum StmCtgNo {
StmCtgNoMap,
StmCtgNoGeneral,
StmCtgNoSplitable,
+ StmCtgNoSplitableMain,
+ StmCtgNoSplitableSub,
StmCtgNoPopUp,
StmCtgNoSystemAlert,
StmCtgNoRestriction,
StmCtgNoSystem,
StmCtgNoSoftwareKeyboard,
+ StmCtgNoTbt,
+ StmCtgNoMeter,
+ StmCtgNoReceiver,
StmCtgNoDebug,
StmCtgNoNum,
@@ -80,6 +103,8 @@ enum StmAreaNo {
StmAreaNoRestrictionSplitMain,
StmAreaNoRestrictionSplitSub,
StmAreaNoSoftwareKyeboard,
+ StmAreaNoMasterSplitSub,
+ StmAreaNoUpperLeft,
StmAreaNoNum,
@@ -94,6 +119,11 @@ enum StmLayerNo {
StmLayerNoNearHomescreen,
StmLayerNoRestriction,
StmLayerNoOnScreen,
+ StmLayerNoRemote,
+ StmLayerNoRemoteHUD,
+ StmLayerNoRemoteHUDUpperLeft,
+ StmLayerNoRemoteRSE1,
+ StmLayerNoRemoteRSE2,
StmLayerNoNum,
@@ -118,6 +148,17 @@ enum StmLayoutNo {
StmLayoutNoRstSplSub,
StmLayoutNoSysNml,
StmLayoutNoSftKbd,
+ StmLayoutNoTbt,
+ StmLayoutNoRmtTbt,
+ StmLayoutNoRmtRse1,
+ StmLayoutNoRmtRse2,
+ StmLayoutNoRmtHud,
+ StmLayoutNoRmtUpLeft,
+ StmLayoutNoMtrNml,
+ StmLayoutNoMtrRcv,
+ StmLayoutNoMtrSpl,
+ StmLayoutNoSplRcv,
+ StmLayoutNoRcvSpl,
StmLayoutNoDbgNml,
StmLayoutNoDbgSplMain,
StmLayoutNoDbgSplSub,
@@ -129,21 +170,56 @@ enum StmLayoutNo {
StmLayoutNoMax = StmLayoutNoNum - 1,
};
-// Mode kind number
-enum StmModeNo {
- StmModeNoRestrictionMode = 0,
+// Enum for mode state
+enum StmTransGearStt {
+ StmTransGearSttNoN = 0,
+ StmTransGearSttNoNotN
+};
- StmModeNoNum,
+enum StmParkingBrakeStt {
+ StmParkingBrakeSttNoOff = 0,
+ StmParkingBrakeSttNoOn
+};
- StmModeNoMin = StmModeNoRestrictionMode,
- StmModeNoMax = StmModeNoNum - 1,
+enum StmAccelPedalStt {
+ StmAccelPedalSttNoOff = 0,
+ StmAccelPedalSttNoOn
+};
+
+enum StmCarStt {
+ StmRunningNoStop = 0,
+ StmRunningNoRun
+};
+
+enum StmLampStt {
+ StmLampSttNoOff = 0,
+ StmLampSttNoOn
+};
+
+enum StmLightstatusBrakeStt {
+ StmLightstatusBrakeSttNoOff = 0,
+ StmLightstatusBrakeSttNoOn
};
-// Enum for mode state
enum StmRestrictionModeSttNo {
StmRestrictionModeSttNoOff = 0,
- StmRestrictionModeSttNo1On,
- StmRestrictionModeSttNo2On,
+ StmRestrictionModeSttNoOn,
+};
+
+// Mode kind number
+enum StmCarElementNo {
+ StmCarElementNoTransGear = 0,
+ StmCarElementNoParkingBrake,
+ StmCarElementNoAccelPedal,
+ StmCarElementNoRunning,
+ StmCarElementNoLamp,
+ StmCarElementNoLightstatusBrake,
+ StmCarElementNoRestrictionMode,
+
+ StmCarElementNoNum,
+
+ StmCarElementNoMin = StmCarElementNoTransGear,
+ StmCarElementNoMax = StmCarElementNoNum - 1,
};
// String for state
@@ -152,8 +228,8 @@ extern const char* kStmCategoryName[];
extern const char* kStmAreaName[];
extern const char* kStmLayoutName[];
extern const char* kStmLayerName[];
-extern const char* kStmModeName[];
-extern const char** kStmModeStateNameList[];
+extern const char* kStmCarElementName[];
+extern const char** kStmCarElementStateNameList[];
// Struct for state
typedef struct StmBaseState {
@@ -162,12 +238,12 @@ typedef struct StmBaseState {
} StmBaseState;
typedef struct StmState {
- StmBaseState mode[StmModeNoNum];
+ StmBaseState car_element[StmCarElementNoNum];
StmBaseState layer[StmLayerNoNum];
} StmState;
// API
-void stmInitialize();
+void stmInitialize(const char *ecu_name);
int stmTransitionState(int event_no, StmState* state);
void stmUndoState();
diff --git a/policy_manager/stm/stm.h.bak b/policy_manager/stm/stm.h.bak
new file mode 100644
index 0000000..685a43b
--- /dev/null
+++ b/policy_manager/stm/stm.h.bak
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2018 TOYOTA MOTOR CORPORATION
+ *
+ * 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 TMCAGLWM_STM_HPP
+#define TMCAGLWM_STM_HPP
+
+#define STM_TRUE 1
+#define STM_FALSE 0
+
+#define STM_CREATE_EVENT_ID(evt, ctg, area) \
+ ((evt) | ((ctg) << 8) | ((area) << 16))
+
+#define STM_GET_EVENT_FROM_ID(id) \
+ ((id) & 0xFF)
+
+#define STM_GET_CATEGORY_FROM_ID(id) \
+ (((id) >> 8) & 0xFF)
+
+#define STM_GET_AREA_FROM_ID(id) \
+ (((id) >> 16) & 0xFF)
+
+// Event number
+enum StmEvtNo {
+ StmEvtNoNone = 0,
+ StmEvtNoActivate,
+ StmEvtNoDeactivate,
+ StmEvtNoTransGearN,
+ StmEvtNoTransGearNotN,
+ StmEvtNoParkingBrakeOff,
+ StmEvtNoParkingBrakeOn,
+ StmEvtNoAccelPedalOff,
+ StmEvtNoAccelPedalOn,
+ StmEvtNoLampOff,
+ StmEvtNoLampOn,
+ StmEvtNoLightstatusBrakeOff,
+ StmEvtNoLightstatusBrakeOn,
+ StmEvtNoRestrictionModeOff,
+ StmEvtNoRestrictionModeOn,
+ StmEvtNoUndo,
+
+ StmEvtNoNum,
+
+ StmEvtNoMin = StmEvtNoNone,
+ StmEvtNoMax = StmEvtNoNum - 1,
+};
+
+// Category number
+enum StmCtgNo {
+ StmCtgNoNone = 0,
+ StmCtgNoHomescreen,
+ StmCtgNoMap,
+ StmCtgNoGeneral,
+ StmCtgNoSplitable,
+ StmCtgNoSplitableMain,
+ StmCtgNoSplitableSub,
+ StmCtgNoPopUp,
+ StmCtgNoSystemAlert,
+ StmCtgNoRestriction,
+ StmCtgNoSystem,
+ StmCtgNoSoftwareKeyboard,
+ StmCtgNoTbt,
+ StmCtgNoMeter,
+ StmCtgNoReceiver,
+ StmCtgNoDebug,
+
+ StmCtgNoNum,
+
+ StmCtgNoMin = StmCtgNoNone,
+ StmCtgNoMax = StmCtgNoNum - 1,
+};
+
+// Area number
+enum StmAreaNo {
+ StmAreaNoNone = 0,
+ StmAreaNoFullscreen,
+ StmAreaNoNormal,
+ StmAreaNoSplitMain,
+ StmAreaNoSplitSub,
+ StmAreaNoOnScreen,
+ StmAreaNoRestrictionNormal,
+ StmAreaNoRestrictionSplitMain,
+ StmAreaNoRestrictionSplitSub,
+ StmAreaNoSoftwareKyeboard,
+ StmAreaNoMasterSplitSub,
+
+ StmAreaNoNum,
+
+ StmAreaNoMin = StmAreaNoNone,
+ StmAreaNoMax = StmAreaNoNum - 1,
+};
+
+// Layer number
+enum StmLayerNo {
+ StmLayerNoHomescreen = 0,
+ StmLayerNoApps,
+ StmLayerNoNearHomescreen,
+ StmLayerNoRestriction,
+ StmLayerNoOnScreen,
+ StmLayerNoRemote,
+
+ StmLayerNoNum,
+
+ StmLayerNoMin = StmLayerNoHomescreen,
+ StmLayerNoMax = StmLayerNoNum - 1,
+};
+
+// Layout kind number
+enum StmLayoutNo {
+ StmLayoutNoNone = 0,
+ StmLayoutNoPopUp,
+ StmLayoutNoSysAlt,
+ StmLayoutNoMapNml,
+ StmLayoutNoMapSpl,
+ StmLayoutNoMapFll,
+ StmLayoutNoSplNml,
+ StmLayoutNoSplSpl,
+ StmLayoutNoGenNml,
+ StmLayoutNoHms,
+ StmLayoutNoRstNml,
+ StmLayoutNoRstSplMain,
+ StmLayoutNoRstSplSub,
+ StmLayoutNoSysNml,
+ StmLayoutNoSftKbd,
+ StmLayoutNoTbt,
+ StmLayoutNoRmtTbt,
+ StmLayoutNoMtrNml,
+ StmLayoutNoMtrRcv,
+ StmLayoutNoMtrSpl,
+ StmLayoutNoSplRcv,
+ StmLayoutNoRcvSpl,
+ StmLayoutNoDbgNml,
+ StmLayoutNoDbgSplMain,
+ StmLayoutNoDbgSplSub,
+ StmLayoutNoDbgFll,
+
+ StmLayoutNoNum,
+
+ StmLayoutNoMin = StmLayoutNoNone,
+ StmLayoutNoMax = StmLayoutNoNum - 1,
+};
+
+// Enum for mode state
+enum StmTransGearStt {
+ StmTransGearSttNoN = 0,
+ StmTransGearSttNoNotN
+};
+
+enum StmParkingBrakeStt {
+ StmParkingBrakeSttNoOff = 0,
+ StmParkingBrakeSttNoOn
+};
+
+enum StmAccelPedalStt {
+ StmAccelPedalSttNoOff = 0,
+ StmAccelPedalSttNoOn
+};
+
+enum StmCarStt {
+ StmRunningNoStop = 0,
+ StmRunningNoRun
+};
+
+enum StmLampStt {
+ StmLampSttNoOff = 0,
+ StmLampSttNoOn
+};
+
+enum StmLightstatusBrakeStt {
+ StmLightstatusBrakeSttNoOff = 0,
+ StmLightstatusBrakeSttNoOn
+};
+
+enum StmRestrictionModeSttNo {
+ StmRestrictionModeSttNoOff = 0,
+ StmRestrictionModeSttNoOn,
+};
+
+// Mode kind number
+enum StmCarElementNo {
+ StmCarElementNoTransGear = 0,
+ StmCarElementNoParkingBrake,
+ StmCarElementNoAccelPedal,
+ StmCarElementNoRunning,
+ StmCarElementNoLamp,
+ StmCarElementNoLightstatusBrake,
+ StmCarElementNoRestrictionMode,
+
+ StmCarElementNoNum,
+
+ StmCarElementNoMin = StmCarElementNoTransGear,
+ StmCarElementNoMax = StmCarElementNoNum - 1,
+};
+
+// String for state
+extern const char* kStmEventName[];
+extern const char* kStmCategoryName[];
+extern const char* kStmAreaName[];
+extern const char* kStmLayoutName[];
+extern const char* kStmLayerName[];
+extern const char* kStmCarElementName[];
+extern const char** kStmCarElementStateNameList[];
+
+// Struct for state
+typedef struct StmBaseState {
+ int changed;
+ int state;
+} StmBaseState;
+
+typedef struct StmState {
+ StmBaseState car_element[StmCarElementNoNum];
+ StmBaseState layer[StmLayerNoNum];
+} StmState;
+
+// API
+void stmInitialize(const char *ecu_name);
+int stmTransitionState(int event_no, StmState* state);
+void stmUndoState();
+
+
+#endif // TMCAGLWM_STM_HPP
diff --git a/policy_manager/stm/stub/stm_inner.c b/policy_manager/stm/stub/stm_inner.c
index bd1b319..2ae2cf0 100644
--- a/policy_manager/stm/stub/stm_inner.c
+++ b/policy_manager/stm/stub/stm_inner.c
@@ -95,6 +95,32 @@ int stmTransitionStateInner(int event, StmState* state) {
g_stm_crr_state.layer[StmLayerNoOnScreen].state = StmLayoutNoSysAlt;
g_stm_crr_state.layer[StmLayerNoOnScreen].changed = STM_TRUE;
}
+ else if (StmCtgNoTbt == category_no)
+ {
+ if (StmAreaNoMasterSplitSub == area_no)
+ {
+ g_stm_crr_state.layer[StmLayerNoApps].state = StmLayoutNoRcvSpl;
+ g_stm_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
+
+ g_stm_crr_state.layer[StmLayerNoRemote].state = StmLayoutNoRmtTbt;
+ g_stm_crr_state.layer[StmLayerNoRemote].changed = STM_TRUE;
+ }
+ else if (StmAreaNoNormal == area_no)
+ {
+ g_stm_crr_state.layer[StmLayerNoRemote].state = StmLayoutNoTbt;
+ g_stm_crr_state.layer[StmLayerNoRemote].changed = STM_TRUE;
+ }
+ }
+ else if (StmCtgNoReceiver == category_no)
+ {
+ g_stm_crr_state.layer[StmLayerNoApps].state = StmLayoutNoRcvSpl;
+ g_stm_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
+ }
+ else if (StmCtgNoMeter == category_no)
+ {
+ g_stm_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMtrNml;
+ g_stm_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
+ }
}
else if (StmEvtNoDeactivate == event_no)
{
@@ -138,6 +164,14 @@ int stmTransitionStateInner(int event, StmState* state) {
g_stm_crr_state.layer[StmLayerNoOnScreen].changed = STM_TRUE;
}
}
+ else if (StmCtgNoTbt == category_no)
+ {
+ if (StmLayoutNoRmtTbt == g_stm_prv_state.layer[StmLayerNoRemote].state)
+ {
+ g_stm_crr_state.layer[StmLayerNoRemote].state = StmLayoutNoNone;
+ g_stm_crr_state.layer[StmLayerNoRemote].changed = STM_TRUE;
+ }
+ }
}
// Copy current state for return
diff --git a/policy_manager/stm/zipc/CMakeLists.txt b/policy_manager/stm/zipc/CMakeLists.txt
index de286a7..76a2109 100644
--- a/policy_manager/stm/zipc/CMakeLists.txt
+++ b/policy_manager/stm/zipc/CMakeLists.txt
@@ -24,6 +24,18 @@ set(ST_DIR_NHS ${ST_DIR}/NearHomeScreen)
set(ST_DIR_OS ${ST_DIR}/OnScreenlayer)
set(ST_DIR_RL ${ST_DIR}/RestrictionLayer)
set(ST_DIR_RM ${ST_DIR}/RestrictionMode)
+set(ST_DIR_AP ${ST_DIR}/AccelPedal)
+set(ST_DIR_CS ${ST_DIR}/CarState)
+set(ST_DIR_LSB ${ST_DIR}/LightStatusBrake)
+
+set(ST_DIR_MST_AL ${ST_DIR}/master/layer/apps)
+set(ST_DIR_MST_RMT ${ST_DIR}/master/layer/remote)
+
+set(ST_DIR_RMT_HUD ${ST_DIR}/hud/layer/remote_hud)
+set(ST_DIR_RMT_HUD_UL ${ST_DIR}/hud/layer/remote_hud_upper_left)
+
+set(ST_DIR_RMT_RSE1 ${ST_DIR}/rse1/layer/remote_rse1)
+set(ST_DIR_RMT_RSE2 ${ST_DIR}/rse2/layer/remote_rse2)
add_library(${TARGETS_STM}
STATIC
@@ -41,6 +53,24 @@ add_library(${TARGETS_STM}
${ST_DIR_RL}/ZREL_Restriction_func.c
${ST_DIR_RM}/ZREM_RestrictionMode.c
${ST_DIR_RM}/ZREM_RestrictionMode_func.c
+ ${ST_DIR_AP}/ZACCEL_AccelPedal.c
+ ${ST_DIR_AP}/ZACCEL_AccelPedalState_func.c
+ ${ST_DIR_CS}/ZCAR_CarState.c
+ ${ST_DIR_CS}/ZCAR_CarState_func.c
+ ${ST_DIR_LSB}/ZLIGHT_LightstatusBrake.c
+ ${ST_DIR_LSB}/ZLIGHT_LightstatusBrakeStatus_func.c
+ ./stm_master_apps.c
+ ./stm_master_remote.c
+ ${ST_DIR_MST_AL}/Zmaster_apps_apps_main.c
+ ${ST_DIR_MST_RMT}/Zmaster_remote_remote.c
+ ${ST_DIR_RMT_HUD}/Zremote_hud_remote_hud.c
+ ${ST_DIR_RMT_HUD}/Zremote_hud_remote_hud_func.c
+ ${ST_DIR_RMT_HUD_UL}/Zremote_hud_upper_left_remote_hud_up_left.c
+ ${ST_DIR_RMT_HUD_UL}/Zremote_hud_upper_left_remote_hud_up_left_func.c
+ ${ST_DIR_RMT_RSE1}/Zremote_rse1_remote_rse1.c
+ ${ST_DIR_RMT_RSE1}/Zremote_rse1_remote_rse1_func.c
+ ${ST_DIR_RMT_RSE2}/Zremote_rse2_remote_rse2.c
+ ${ST_DIR_RMT_RSE2}/Zremote_rse2_remote_rse2_func.c
)
target_include_directories(${TARGETS_STM}
@@ -53,6 +83,15 @@ target_include_directories(${TARGETS_STM}
./${ST_DIR_OS}
./${ST_DIR_RL}
./${ST_DIR_RM}
+ ./${ST_DIR_AP}
+ ./${ST_DIR_CS}
+ ./${ST_DIR_LSB}
+ ./${ST_DIR_MST_AL}
+ ./${ST_DIR_MST_RMT}
+ ./${ST_DIR_RMT_HUD}
+ ./${ST_DIR_RMT_HUD_UL}
+ ./${ST_DIR_RMT_RSE1}
+ ./${ST_DIR_RMT_RSE2}
./${ST_DIR_CMN}
)
@@ -70,4 +109,5 @@ set_target_properties(${TARGETS_STM}
C_EXTENSIONS OFF
C_STANDARD 99
C_STANDARD_REQUIRED ON
+ POSITION_INDEPENDENT_CODE ON
)
diff --git a/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedal.c b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedal.c
new file mode 100755
index 0000000..c9374fd
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedal.c
@@ -0,0 +1,117 @@
+/************************************************************/
+/* ZACCEL_AccelPedal.c */
+/* AccelPedal State transition model source file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../ZST_include.h"
+
+/* State management variable */
+static uint8_t ZACCEL_AccelPedalState[ZACCEL_ACCELPEDALSTATENOMAX];
+
+static void ZACCEL_AccelPedals0e1( void );
+static void ZACCEL_AccelPedals1e0( void );
+static void ZACCEL_AccelPedals0Event( void );
+static void ZACCEL_AccelPedals1Event( void );
+
+/****************************************/
+/* Action function */
+/* STM : AccelPedal */
+/* State : accel_pedal_off( No 0 ) */
+/* Event : evt_accel_pedal_on( No 1 ) */
+/****************************************/
+static void ZACCEL_AccelPedals0e1( void )
+{
+ ZACCEL_AccelPedalState[ZACCEL_ACCELPEDAL] = ( uint8_t )ZACCEL_ACCELPEDALS1;
+ stm_aps_start_activity_accel_pedal_on();
+}
+
+/****************************************/
+/* Action function */
+/* STM : AccelPedal */
+/* State : accel_pedal_on( No 1 ) */
+/* Event : evt_accel_pedal_off( No 0 )*/
+/****************************************/
+static void ZACCEL_AccelPedals1e0( void )
+{
+ ZACCEL_AccelPedalState[ZACCEL_ACCELPEDAL] = ( uint8_t )ZACCEL_ACCELPEDALS0;
+ stm_aps_start_activity_accel_pedal_off();
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : AccelPedal */
+/* State : accel_pedal_off( No 0 ) */
+/****************************************/
+static void ZACCEL_AccelPedals0Event( void )
+{
+ /*evt_accel_pedal_on*/
+ if( g_stm_event == StmEvtNoAccelPedalOn )
+ {
+ ZACCEL_AccelPedals0e1();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : AccelPedal */
+/* State : accel_pedal_on( No 1 ) */
+/****************************************/
+static void ZACCEL_AccelPedals1Event( void )
+{
+ /*evt_accel_pedal_off*/
+ if( g_stm_event == StmEvtNoAccelPedalOff )
+ {
+ ZACCEL_AccelPedals1e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event call function */
+/* STM : AccelPedal */
+/****************************************/
+void stm_aps_event_call( void )
+{
+ stm_aps_start_stm();
+ switch( ZACCEL_AccelPedalState[ZACCEL_ACCELPEDAL] )
+ {
+ case ZACCEL_ACCELPEDALS0:
+ ZACCEL_AccelPedals0Event();
+ break;
+ case ZACCEL_ACCELPEDALS1:
+ ZACCEL_AccelPedals1Event();
+ break;
+ default:
+ /*Not accessible to this else (default).*/
+ break;
+ }
+}
+
+/****************************************/
+/* Initial function */
+/* STM : AccelPedal */
+/****************************************/
+void stm_aps_initialize( void )
+{
+ ZACCEL_AccelPedalState[ZACCEL_ACCELPEDAL] = ( uint8_t )ZACCEL_ACCELPEDALS0;
+ stm_aps_start_activity_accel_pedal_off();
+}
+
+/****************************************/
+/* Terminate function */
+/* STM : AccelPedal */
+/****************************************/
+void ZACCEL_AccelPedalTerminate( void )
+{
+ ZACCEL_AccelPedalState[ZACCEL_ACCELPEDAL] = ( uint8_t )ZACCEL_ACCELPEDALTERMINATE;
+}
+
diff --git a/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedal.h b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedal.h
new file mode 100755
index 0000000..03ed59d
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedal.h
@@ -0,0 +1,41 @@
+/************************************************************/
+/* ZACCEL_AccelPedal.h */
+/* AccelPedal State transition model header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZACCEL_ACCELPEDAL_H
+#define ZHEADER_ZACCEL_ACCELPEDAL_H
+
+/*State management variable access define*/
+#define ZACCEL_ACCELPEDAL ( 0U )
+#define ZACCEL_ACCELPEDALS0 ( 0U )
+#define ZACCEL_ACCELPEDALS1 ( 1U )
+#define ZACCEL_ACCELPEDALSTATENOMAX ( 1U )
+
+/*End state define*/
+#define ZACCEL_ACCELPEDALEND ( 2U )
+/*Terminate state define*/
+#define ZACCEL_ACCELPEDALTERMINATE ( ZACCEL_ACCELPEDALEND + 1U )
+
+/*State no define*/
+#define ZACCEL_ACCELPEDALS0STATENO ( 0U )
+#define ZACCEL_ACCELPEDALS1STATENO ( 1U )
+
+/*State serial no define*/
+#define ZACCEL_ACCELPEDALS0STATESERIALNO ( 0U )
+#define ZACCEL_ACCELPEDALS1STATESERIALNO ( 1U )
+
+/*Event no define*/
+#define ZACCEL_ACCELPEDALE0EVENTNO ( 0U )
+#define ZACCEL_ACCELPEDALE1EVENTNO ( 1U )
+
+/*Event serial no define*/
+#define ZACCEL_ACCELPEDALE0EVENTSERIALNO ( 0U )
+#define ZACCEL_ACCELPEDALE1EVENTSERIALNO ( 1U )
+
+/*Extern function*/
+extern void stm_aps_event_call( void );
+extern void stm_aps_initialize( void );
+extern void ZACCEL_AccelPedalTerminate( void );
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedalState_func.c b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedalState_func.c
new file mode 100755
index 0000000..ec08c0f
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedalState_func.c
@@ -0,0 +1,45 @@
+/************************************************************/
+/* ZACCEL_AccelPedalState_func.c */
+/* Function and variable source file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../ZST_include.h"
+
+/*************************************************************
+ Function definition
+*************************************************************/
+
+/*
+ * @name stm_aps_start_activity_accel_pedal_off
+ */
+void stm_aps_start_activity_accel_pedal_off() {
+ g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state = StmAccelPedalSttNoOff;
+ g_stm_crr_state.car_element[StmCarElementNoAccelPedal].changed = STM_TRUE;
+}
+
+/*
+ * @name stm_aps_start_activity_accel_pedal_on
+ */
+void stm_aps_start_activity_accel_pedal_on() {
+ g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state = StmAccelPedalSttNoOn;
+ g_stm_crr_state.car_element[StmCarElementNoAccelPedal].changed = STM_TRUE;
+}
+
+/*
+ * @name stm_aps_initialize_variable
+ */
+void stm_aps_initialize_variable() {
+ g_stm_prv_state.car_element[StmCarElementNoAccelPedal].state = StmAccelPedalSttNoOff;
+ g_stm_prv_state.car_element[StmCarElementNoAccelPedal].changed = STM_FALSE;
+
+ g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state = StmAccelPedalSttNoOff;
+ g_stm_crr_state.car_element[StmCarElementNoAccelPedal].changed = STM_FALSE;
+}
+
+/*
+ * @name stm_aps_start_stm
+ */
+void stm_aps_start_stm() {
+ g_stm_prv_state.car_element[StmCarElementNoAccelPedal].state = g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state;
+ g_stm_crr_state.car_element[StmCarElementNoAccelPedal].changed = STM_FALSE;
+}
diff --git a/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedalState_func.h b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedalState_func.h
new file mode 100755
index 0000000..b74cf92
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedalState_func.h
@@ -0,0 +1,14 @@
+/************************************************************/
+/* ZACCEL_AccelPedalState_func.h */
+/* Function and variable header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZACCEL_ACCELPEDALSTATE_FUNC_H
+#define ZHEADER_ZACCEL_ACCELPEDALSTATE_FUNC_H
+
+extern void stm_aps_start_activity_accel_pedal_off();
+extern void stm_aps_start_activity_accel_pedal_on();
+extern void stm_aps_initialize_variable();
+extern void stm_aps_start_stm();
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_AppsLayer.c b/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_AppsLayer.c
index b6891e8..ac1fb16 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_AppsLayer.c
+++ b/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_AppsLayer.c
@@ -1,7 +1,7 @@
/************************************************************/
/* ZAPL_AppsLayer.c */
/* AppsLayer State transition model source file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#include "../ZST_include.h"
@@ -23,7 +23,7 @@ static void ZAPL_RestrictionModeOffs0e18( void );
static void ZAPL_RestrictionModeOffs1e0( void );
static void ZAPL_RestrictionModeOffs1e8( void );
static void ZAPL_RestrictionModeOffs2e3( void );
-static void ZAPL_RestrictionModeOffs3e2( void );
+static void ZAPL_RestrictionModeOffs3e16( void );
static void ZAPL_RestrictionModeOffs4e3( void );
static void ZAPL_RestrictionModeOffs5e3( void );
static void ZAPL_RestrictionModeOffs6e6( void );
@@ -87,7 +87,7 @@ static void ZAPL_AppsLayers0StateEntry( void )
/****************************************/
/* State start activity function */
/* STM : AppsLayer */
-/* State : restriction_mode_2_on( No 1 ) */
+/* State : restriction_mode_on( No 1 )*/
/****************************************/
static void ZAPL_AppsLayers1StateEntry( void )
{
@@ -121,7 +121,7 @@ static void ZAPL_AppsLayers0e1( void )
/****************************************/
/* Action function */
/* STM : AppsLayer */
-/* State : restriction_mode_2_on( No 1 ) */
+/* State : restriction_mode_on( No 1 )*/
/* Event : stt_restriction_mode_off( No 0 ) */
/****************************************/
static void ZAPL_AppsLayers1e0( void )
@@ -263,9 +263,9 @@ static void ZAPL_RestrictionModeOffs2e3( void )
/* Action function */
/* STM : RestrictionModeOff */
/* State : map_fullscreen( No 3 ) */
-/* Event : ara_fullscreen( No 2 ) */
+/* Event : stt_prv_layer_apps_map_fll( No 16 ) */
/****************************************/
-static void ZAPL_RestrictionModeOffs3e2( void )
+static void ZAPL_RestrictionModeOffs3e16( void )
{
stm_apl_start_activity_map_fullscreen();
}
@@ -367,10 +367,10 @@ static void ZAPL_RestrictionModeOns1e3( void )
/****************************************/
static void ZAPL_AppsLayers0Event( void )
{
- /*stt_restriction_mode_2_on*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNo2On )
+ /*stt_restriction_mode_on*/
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOn )
{
- stm_apl_event_restriction_mode_2_on();
+ stm_apl_event_restriction_mode_on();
/*stt_map_is_activated*/
if( g_stm_map_is_activated == STM_TRUE )
{
@@ -406,7 +406,7 @@ static void ZAPL_AppsLayers0Event( void )
static void ZAPL_RestrictionModeOffs0Event( void )
{
/*stt_restriction_mode_off*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
/*evt_activate*/
if( g_stm_event == StmEvtNoActivate )
@@ -548,7 +548,7 @@ static void ZAPL_RestrictionModeOffs0Event( void )
static void ZAPL_RestrictionModeOffs1Event( void )
{
/*stt_restriction_mode_off*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
/*evt_activate*/
if( g_stm_event == StmEvtNoActivate )
@@ -723,7 +723,7 @@ static void ZAPL_RestrictionModeOffs1Event( void )
static void ZAPL_RestrictionModeOffs2Event( void )
{
/*stt_restriction_mode_off*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
/*evt_activate*/
if( g_stm_event == StmEvtNoActivate )
@@ -898,7 +898,7 @@ static void ZAPL_RestrictionModeOffs2Event( void )
static void ZAPL_RestrictionModeOffs3Event( void )
{
/*stt_restriction_mode_off*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
/*evt_activate*/
if( g_stm_event == StmEvtNoActivate )
@@ -911,11 +911,6 @@ static void ZAPL_RestrictionModeOffs3Event( void )
{
ZAPL_RestrictionModeOffs0e0();
}
- /*ara_fullscreen*/
- else if( g_stm_area == StmAreaNoFullscreen )
- {
- ZAPL_RestrictionModeOffs3e2();
- }
else
{
/*Else and default design have not done.*/
@@ -1019,7 +1014,7 @@ static void ZAPL_RestrictionModeOffs3Event( void )
/*stt_prv_layer_apps_map_fll*/
else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMapFll )
{
- ZAPL_RestrictionModeOffs3e2();
+ ZAPL_RestrictionModeOffs3e16();
}
/*stt_prv_layer_apps_spl_nml*/
else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml )
@@ -1068,7 +1063,7 @@ static void ZAPL_RestrictionModeOffs3Event( void )
static void ZAPL_RestrictionModeOffs4Event( void )
{
/*stt_restriction_mode_off*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
/*evt_activate*/
if( g_stm_event == StmEvtNoActivate )
@@ -1253,7 +1248,7 @@ static void ZAPL_RestrictionModeOffs4Event( void )
static void ZAPL_RestrictionModeOffs5Event( void )
{
/*stt_restriction_mode_off*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
/*evt_activate*/
if( g_stm_event == StmEvtNoActivate )
@@ -1438,7 +1433,7 @@ static void ZAPL_RestrictionModeOffs5Event( void )
static void ZAPL_RestrictionModeOffs6Event( void )
{
/*stt_restriction_mode_off*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
/*evt_activate*/
if( g_stm_event == StmEvtNoActivate )
@@ -1608,7 +1603,7 @@ static void ZAPL_RestrictionModeOffs6Event( void )
static void ZAPL_RestrictionModeOffs7Event( void )
{
/*stt_restriction_mode_off*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
/*evt_activate*/
if( g_stm_event == StmEvtNoActivate )
@@ -1773,12 +1768,12 @@ static void ZAPL_RestrictionModeOffs7Event( void )
/****************************************/
/* Event appraisal function */
/* STM : AppsLayer */
-/* State : restriction_mode_2_on( No 1 ) */
+/* State : restriction_mode_on( No 1 )*/
/****************************************/
static void ZAPL_AppsLayers1Event( void )
{
/*stt_restriction_mode_off*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
stm_apl_event_restriction_mode_off();
ZAPL_AppsLayers1e0();
@@ -1797,8 +1792,8 @@ static void ZAPL_AppsLayers1Event( void )
/****************************************/
static void ZAPL_RestrictionModeOns0Event( void )
{
- /*stt_restriction_mode_2_on*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNo2On )
+ /*stt_restriction_mode_on*/
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOn )
{
/*evt_activate*/
if( g_stm_event == StmEvtNoActivate )
@@ -1862,8 +1857,8 @@ static void ZAPL_RestrictionModeOns0Event( void )
/****************************************/
static void ZAPL_RestrictionModeOns1Event( void )
{
- /*stt_restriction_mode_2_on*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNo2On )
+ /*stt_restriction_mode_on*/
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOn )
{
/*evt_activate*/
if( g_stm_event == StmEvtNoActivate )
diff --git a/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_AppsLayer.h b/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_AppsLayer.h
index 4cbbc10..d94cbc0 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_AppsLayer.h
+++ b/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_AppsLayer.h
@@ -1,7 +1,7 @@
/************************************************************/
/* ZAPL_AppsLayer.h */
/* AppsLayer State transition model header file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZAPL_APPSLAYER_H
#define ZHEADER_ZAPL_APPSLAYER_H
diff --git a/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_Apps_func.c b/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_Apps_func.c
index b42df05..245271f 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_Apps_func.c
+++ b/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_Apps_func.c
@@ -1,7 +1,7 @@
/************************************************************/
/* ZAPL_Apps_func.c */
/* Function and variable source file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#include "../ZST_include.h"
@@ -92,15 +92,15 @@ void stm_apl_start_activity_system() {
* @name stm_apl_event_restriction_mode_off
*/
void stm_apl_event_restriction_mode_off() {
- g_stm_crr_state.layer[StmLayerNoApps].state = g_prv_apps_state_rest_mode_1;
+ g_stm_crr_state.layer[StmLayerNoApps].state = g_prv_apps_state_car_stop;
g_stm_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
}
/*
- * @name stm_apl_event_restriction_mode_2_on
+ * @name stm_apl_event_restriction_mode_on
*/
-void stm_apl_event_restriction_mode_2_on() {
- g_prv_apps_state_rest_mode_1 = g_stm_prv_state.layer[StmLayerNoApps].state;
+void stm_apl_event_restriction_mode_on() {
+ g_prv_apps_state_car_stop = g_stm_prv_state.layer[StmLayerNoApps].state;
}
/*
diff --git a/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_Apps_func.h b/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_Apps_func.h
index 6f741b5..8d1de90 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_Apps_func.h
+++ b/policy_manager/stm/zipc/StateTransitionor/AppsLayer/ZAPL_Apps_func.h
@@ -1,7 +1,7 @@
/************************************************************/
/* ZAPL_Apps_func.h */
/* Function and variable header file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZAPL_APPS_FUNC_H
#define ZHEADER_ZAPL_APPS_FUNC_H
@@ -15,7 +15,7 @@ extern void stm_apl_start_activity_splitable_split();
extern void stm_apl_start_activity_general();
extern void stm_apl_start_activity_system();
extern void stm_apl_event_restriction_mode_off();
-extern void stm_apl_event_restriction_mode_2_on();
+extern void stm_apl_event_restriction_mode_on();
extern void stm_apl_initialize_variable();
extern void stm_apl_start_stm();
diff --git a/policy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState.c b/policy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState.c
new file mode 100755
index 0000000..2134a99
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState.c
@@ -0,0 +1,117 @@
+/************************************************************/
+/* ZCAR_CarState.c */
+/* CarState State transition model source file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../ZST_include.h"
+
+/* State management variable */
+static uint8_t ZCAR_CarStateState[ZCAR_CARSTATESTATENOMAX];
+
+static void ZCAR_CarStates0e1( void );
+static void ZCAR_CarStates1e0( void );
+static void ZCAR_CarStates0Event( void );
+static void ZCAR_CarStates1Event( void );
+
+/****************************************/
+/* Action function */
+/* STM : CarState */
+/* State : car_stop( No 0 ) */
+/* Event : stt_accel_pedal_on( No 1 ) */
+/****************************************/
+static void ZCAR_CarStates0e1( void )
+{
+ ZCAR_CarStateState[ZCAR_CARSTATE] = ( uint8_t )ZCAR_CARSTATES1;
+ stm_rns_start_activity_car_run();
+}
+
+/****************************************/
+/* Action function */
+/* STM : CarState */
+/* State : car_run( No 1 ) */
+/* Event : stt_accel_pedal_off( No 0 )*/
+/****************************************/
+static void ZCAR_CarStates1e0( void )
+{
+ ZCAR_CarStateState[ZCAR_CARSTATE] = ( uint8_t )ZCAR_CARSTATES0;
+ stm_rns_start_activity_car_stop();
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : CarState */
+/* State : car_stop( No 0 ) */
+/****************************************/
+static void ZCAR_CarStates0Event( void )
+{
+ /*stt_accel_pedal_on*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOn )
+ {
+ ZCAR_CarStates0e1();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : CarState */
+/* State : car_run( No 1 ) */
+/****************************************/
+static void ZCAR_CarStates1Event( void )
+{
+ /*stt_accel_pedal_off*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOff )
+ {
+ ZCAR_CarStates1e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event call function */
+/* STM : CarState */
+/****************************************/
+void stm_rns_event_call( void )
+{
+ stm_rns_start_stm();
+ switch( ZCAR_CarStateState[ZCAR_CARSTATE] )
+ {
+ case ZCAR_CARSTATES0:
+ ZCAR_CarStates0Event();
+ break;
+ case ZCAR_CARSTATES1:
+ ZCAR_CarStates1Event();
+ break;
+ default:
+ /*Not accessible to this else (default).*/
+ break;
+ }
+}
+
+/****************************************/
+/* Initial function */
+/* STM : CarState */
+/****************************************/
+void stm_rns_initialize( void )
+{
+ ZCAR_CarStateState[ZCAR_CARSTATE] = ( uint8_t )ZCAR_CARSTATES0;
+ stm_rns_start_activity_car_stop();
+}
+
+/****************************************/
+/* Terminate function */
+/* STM : CarState */
+/****************************************/
+void ZCAR_CarStateTerminate( void )
+{
+ ZCAR_CarStateState[ZCAR_CARSTATE] = ( uint8_t )ZCAR_CARSTATETERMINATE;
+}
+
diff --git a/policy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState.h b/policy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState.h
new file mode 100755
index 0000000..5ad694e
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState.h
@@ -0,0 +1,41 @@
+/************************************************************/
+/* ZCAR_CarState.h */
+/* CarState State transition model header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZCAR_CARSTATE_H
+#define ZHEADER_ZCAR_CARSTATE_H
+
+/*State management variable access define*/
+#define ZCAR_CARSTATE ( 0U )
+#define ZCAR_CARSTATES0 ( 0U )
+#define ZCAR_CARSTATES1 ( 1U )
+#define ZCAR_CARSTATESTATENOMAX ( 1U )
+
+/*End state define*/
+#define ZCAR_CARSTATEEND ( 2U )
+/*Terminate state define*/
+#define ZCAR_CARSTATETERMINATE ( ZCAR_CARSTATEEND + 1U )
+
+/*State no define*/
+#define ZCAR_CARSTATES0STATENO ( 0U )
+#define ZCAR_CARSTATES1STATENO ( 1U )
+
+/*State serial no define*/
+#define ZCAR_CARSTATES0STATESERIALNO ( 0U )
+#define ZCAR_CARSTATES1STATESERIALNO ( 1U )
+
+/*Event no define*/
+#define ZCAR_CARSTATEE0EVENTNO ( 0U )
+#define ZCAR_CARSTATEE1EVENTNO ( 1U )
+
+/*Event serial no define*/
+#define ZCAR_CARSTATEE0EVENTSERIALNO ( 0U )
+#define ZCAR_CARSTATEE1EVENTSERIALNO ( 1U )
+
+/*Extern function*/
+extern void stm_rns_event_call( void );
+extern void stm_rns_initialize( void );
+extern void ZCAR_CarStateTerminate( void );
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState_func.c b/policy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState_func.c
new file mode 100755
index 0000000..49e3c02
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState_func.c
@@ -0,0 +1,45 @@
+/************************************************************/
+/* ZCAR_CarState_func.c */
+/* Function and variable source file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../ZST_include.h"
+
+/*************************************************************
+ Function definition
+*************************************************************/
+
+/*
+ * @name stm_rns_start_activity_car_stop
+ */
+void stm_rns_start_activity_car_stop() {
+ g_stm_crr_state.car_element[StmCarElementNoRunning].state = StmRunningNoStop;
+ g_stm_crr_state.car_element[StmCarElementNoRunning].changed = STM_TRUE;
+}
+
+/*
+ * @name stm_rns_start_activity_car_run
+ */
+void stm_rns_start_activity_car_run() {
+ g_stm_crr_state.car_element[StmCarElementNoRunning].state = StmRunningNoRun;
+ g_stm_crr_state.car_element[StmCarElementNoRunning].changed = STM_TRUE;
+}
+
+/*
+ * @name stm_rns_initialize_variable
+ */
+void stm_rns_initialize_variable() {
+ g_stm_prv_state.car_element[StmCarElementNoRunning].state = StmRunningNoStop;
+ g_stm_prv_state.car_element[StmCarElementNoRunning].changed = STM_FALSE;
+
+ g_stm_crr_state.car_element[StmCarElementNoRunning].state = StmRunningNoStop;
+ g_stm_crr_state.car_element[StmCarElementNoRunning].changed = STM_FALSE;
+}
+
+/*
+ * @name stm_rns_start_stm
+ */
+void stm_rns_start_stm() {
+ g_stm_prv_state.car_element[StmCarElementNoRunning].state = g_stm_crr_state.car_element[StmCarElementNoRunning].state;
+ g_stm_crr_state.car_element[StmCarElementNoRunning].changed = STM_FALSE;
+}
diff --git a/policy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState_func.h b/policy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState_func.h
new file mode 100755
index 0000000..da9e1ec
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/CarState/ZCAR_CarState_func.h
@@ -0,0 +1,14 @@
+/************************************************************/
+/* ZCAR_CarState_func.h */
+/* Function and variable header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZCAR_CARSTATE_FUNC_H
+#define ZHEADER_ZCAR_CARSTATE_FUNC_H
+
+extern void stm_rns_start_activity_car_stop();
+extern void stm_rns_start_activity_car_run();
+extern void stm_rns_initialize_variable();
+extern void stm_rns_start_stm();
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen.c b/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen.c
index a4cd474..70777a4 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen.c
+++ b/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen.c
@@ -1,7 +1,7 @@
/************************************************************/
/* ZHSL_HomeScreen.c */
/* HomeScreen State transition model source file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#include "../ZST_include.h"
@@ -9,7 +9,6 @@
static uint8_t ZHSL_HomeScreenState[ZHSL_HOMESCREENSTATENOMAX];
static void ZHSL_HomeScreens0e0( void );
-static void ZHSL_HomeScreens1e0( void );
static void ZHSL_HomeScreens0Event( void );
static void ZHSL_HomeScreens1Event( void );
@@ -26,17 +25,6 @@ static void ZHSL_HomeScreens0e0( void )
}
/****************************************/
-/* Action function */
-/* STM : HomeScreen */
-/* State : homescreen( No 1 ) */
-/* Event : ara_fullscreen( No 0 ) */
-/****************************************/
-static void ZHSL_HomeScreens1e0( void )
-{
- stm_hsl_start_activity_homescreen();
-}
-
-/****************************************/
/* Event appraisal function */
/* STM : HomeScreen */
/* State : none( No 0 ) */
@@ -80,34 +68,6 @@ static void ZHSL_HomeScreens0Event( void )
/****************************************/
static void ZHSL_HomeScreens1Event( void )
{
- /*evt_activate*/
- if( g_stm_event == StmEvtNoActivate )
- {
- /*ctg_homescreen*/
- if( g_stm_category == StmCtgNoHomescreen )
- {
- /*ara_fullscreen*/
- if( g_stm_area == StmAreaNoFullscreen )
- {
- ZHSL_HomeScreens1e0();
- }
- else
- {
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
- }
- }
- else
- {
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
- }
- }
- else
- {
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
- }
}
/****************************************/
diff --git a/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen.h b/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen.h
index ffa8552..7115cee 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen.h
+++ b/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen.h
@@ -1,7 +1,7 @@
/************************************************************/
/* ZHSL_HomeScreen.h */
/* HomeScreen State transition model header file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZHSL_HOMESCREEN_H
#define ZHEADER_ZHSL_HOMESCREEN_H
diff --git a/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen_func.c b/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen_func.c
index 4d50ab0..7a0aa55 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen_func.c
+++ b/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen_func.c
@@ -1,7 +1,7 @@
/************************************************************/
/* ZHSL_HomeScreen_func.c */
/* Function and variable source file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#include "../ZST_include.h"
diff --git a/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen_func.h b/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen_func.h
index d5f4ab9..a2c1919 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen_func.h
+++ b/policy_manager/stm/zipc/StateTransitionor/HomeScreenLayer/ZHSL_HomeScreen_func.h
@@ -1,7 +1,7 @@
/************************************************************/
/* ZHSL_HomeScreen_func.h */
/* Function and variable header file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZHSL_HOMESCREEN_FUNC_H
#define ZHEADER_ZHSL_HOMESCREEN_FUNC_H
diff --git a/policy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrake.c b/policy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrake.c
new file mode 100755
index 0000000..11ab8dc
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrake.c
@@ -0,0 +1,117 @@
+/************************************************************/
+/* ZLIGHT_LightstatusBrake.c */
+/* LightstatusBrake State transition model source file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../ZST_include.h"
+
+/* State management variable */
+static uint8_t ZLIGHT_LightstatusBrakeState[ZLIGHT_LIGHTSTATUSBRAKESTATENOMAX];
+
+static void ZLIGHT_LightstatusBrakes0e1( void );
+static void ZLIGHT_LightstatusBrakes1e0( void );
+static void ZLIGHT_LightstatusBrakes0Event( void );
+static void ZLIGHT_LightstatusBrakes1Event( void );
+
+/****************************************/
+/* Action function */
+/* STM : LightstatusBrake */
+/* State : lightstatus_brake_on( No 0 ) */
+/* Event : evt_lightstatus_brake_off( No 1 ) */
+/****************************************/
+static void ZLIGHT_LightstatusBrakes0e1( void )
+{
+ ZLIGHT_LightstatusBrakeState[ZLIGHT_LIGHTSTATUSBRAKE] = ( uint8_t )ZLIGHT_LIGHTSTATUSBRAKES1;
+ stm_lbs_start_activity_lightstatus_brake_off();
+}
+
+/****************************************/
+/* Action function */
+/* STM : LightstatusBrake */
+/* State : lightstatus_brake_off( No 1 ) */
+/* Event : evt_lightstatus_brake_on( No 0 ) */
+/****************************************/
+static void ZLIGHT_LightstatusBrakes1e0( void )
+{
+ ZLIGHT_LightstatusBrakeState[ZLIGHT_LIGHTSTATUSBRAKE] = ( uint8_t )ZLIGHT_LIGHTSTATUSBRAKES0;
+ stm_lbs_start_activity_lightstatus_brake_on();
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : LightstatusBrake */
+/* State : lightstatus_brake_on( No 0 ) */
+/****************************************/
+static void ZLIGHT_LightstatusBrakes0Event( void )
+{
+ /*evt_lightstatus_brake_off*/
+ if( g_stm_event == StmEvtNoLightstatusBrakeOff )
+ {
+ ZLIGHT_LightstatusBrakes0e1();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : LightstatusBrake */
+/* State : lightstatus_brake_off( No 1 ) */
+/****************************************/
+static void ZLIGHT_LightstatusBrakes1Event( void )
+{
+ /*evt_lightstatus_brake_on*/
+ if( g_stm_event == StmEvtNoLightstatusBrakeOn )
+ {
+ ZLIGHT_LightstatusBrakes1e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event call function */
+/* STM : LightstatusBrake */
+/****************************************/
+void stm_lbs_event_call( void )
+{
+ stm_lbs_start_stm();
+ switch( ZLIGHT_LightstatusBrakeState[ZLIGHT_LIGHTSTATUSBRAKE] )
+ {
+ case ZLIGHT_LIGHTSTATUSBRAKES0:
+ ZLIGHT_LightstatusBrakes0Event();
+ break;
+ case ZLIGHT_LIGHTSTATUSBRAKES1:
+ ZLIGHT_LightstatusBrakes1Event();
+ break;
+ default:
+ /*Not accessible to this else (default).*/
+ break;
+ }
+}
+
+/****************************************/
+/* Initial function */
+/* STM : LightstatusBrake */
+/****************************************/
+void stm_lbs_initialize( void )
+{
+ ZLIGHT_LightstatusBrakeState[ZLIGHT_LIGHTSTATUSBRAKE] = ( uint8_t )ZLIGHT_LIGHTSTATUSBRAKES0;
+ stm_lbs_start_activity_lightstatus_brake_on();
+}
+
+/****************************************/
+/* Terminate function */
+/* STM : LightstatusBrake */
+/****************************************/
+void ZLIGHT_LightstatusBrakeTerminate( void )
+{
+ ZLIGHT_LightstatusBrakeState[ZLIGHT_LIGHTSTATUSBRAKE] = ( uint8_t )ZLIGHT_LIGHTSTATUSBRAKETERMINATE;
+}
+
diff --git a/policy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrake.h b/policy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrake.h
new file mode 100755
index 0000000..2ce216f
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrake.h
@@ -0,0 +1,41 @@
+/************************************************************/
+/* ZLIGHT_LightstatusBrake.h */
+/* LightstatusBrake State transition model header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZLIGHT_LIGHTSTATUSBRAKE_H
+#define ZHEADER_ZLIGHT_LIGHTSTATUSBRAKE_H
+
+/*State management variable access define*/
+#define ZLIGHT_LIGHTSTATUSBRAKE ( 0U )
+#define ZLIGHT_LIGHTSTATUSBRAKES0 ( 0U )
+#define ZLIGHT_LIGHTSTATUSBRAKES1 ( 1U )
+#define ZLIGHT_LIGHTSTATUSBRAKESTATENOMAX ( 1U )
+
+/*End state define*/
+#define ZLIGHT_LIGHTSTATUSBRAKEEND ( 2U )
+/*Terminate state define*/
+#define ZLIGHT_LIGHTSTATUSBRAKETERMINATE ( ZLIGHT_LIGHTSTATUSBRAKEEND + 1U )
+
+/*State no define*/
+#define ZLIGHT_LIGHTSTATUSBRAKES0STATENO ( 0U )
+#define ZLIGHT_LIGHTSTATUSBRAKES1STATENO ( 1U )
+
+/*State serial no define*/
+#define ZLIGHT_LIGHTSTATUSBRAKES0STATESERIALNO ( 0U )
+#define ZLIGHT_LIGHTSTATUSBRAKES1STATESERIALNO ( 1U )
+
+/*Event no define*/
+#define ZLIGHT_LIGHTSTATUSBRAKEE0EVENTNO ( 0U )
+#define ZLIGHT_LIGHTSTATUSBRAKEE1EVENTNO ( 1U )
+
+/*Event serial no define*/
+#define ZLIGHT_LIGHTSTATUSBRAKEE0EVENTSERIALNO ( 0U )
+#define ZLIGHT_LIGHTSTATUSBRAKEE1EVENTSERIALNO ( 1U )
+
+/*Extern function*/
+extern void stm_lbs_event_call( void );
+extern void stm_lbs_initialize( void );
+extern void ZLIGHT_LightstatusBrakeTerminate( void );
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrakeStatus_func.c b/policy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrakeStatus_func.c
new file mode 100755
index 0000000..2feafdb
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrakeStatus_func.c
@@ -0,0 +1,45 @@
+/************************************************************/
+/* ZLIGHT_LightstatusBrakeStatus_func.c */
+/* Function and variable source file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../ZST_include.h"
+
+/*************************************************************
+ Function definition
+*************************************************************/
+
+/*
+ * @name stm_lbs_start_activity_lightstatus_brake_off
+ */
+void stm_lbs_start_activity_lightstatus_brake_off() {
+ g_stm_crr_state.car_element[StmCarElementNoLightstatusBrake].state = StmLightstatusBrakeSttNoOff;
+ g_stm_crr_state.car_element[StmCarElementNoLightstatusBrake].changed = STM_TRUE;
+}
+
+/*
+ * @name stm_lbs_start_activity_lightstatus_brake_on
+ */
+void stm_lbs_start_activity_lightstatus_brake_on() {
+ g_stm_crr_state.car_element[StmCarElementNoLightstatusBrake].state = StmLightstatusBrakeSttNoOn;
+ g_stm_crr_state.car_element[StmCarElementNoLightstatusBrake].changed = STM_TRUE;
+}
+
+/*
+ * @name stm_lbs_initialize_variable
+ */
+void stm_lbs_initialize_variable() {
+ g_stm_prv_state.car_element[StmCarElementNoLightstatusBrake].state = StmLightstatusBrakeSttNoOn;
+ g_stm_prv_state.car_element[StmCarElementNoLightstatusBrake].changed = STM_FALSE;
+
+ g_stm_crr_state.car_element[StmCarElementNoLightstatusBrake].state = StmLightstatusBrakeSttNoOn;
+ g_stm_crr_state.car_element[StmCarElementNoLightstatusBrake].changed = STM_FALSE;
+}
+
+/*
+ * @name stm_lbs_start_stm
+ */
+void stm_lbs_start_stm() {
+ g_stm_prv_state.car_element[StmCarElementNoLightstatusBrake].state = g_stm_crr_state.car_element[StmCarElementNoLightstatusBrake].state;
+ g_stm_crr_state.car_element[StmCarElementNoLightstatusBrake].changed = STM_FALSE;
+}
diff --git a/policy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrakeStatus_func.h b/policy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrakeStatus_func.h
new file mode 100755
index 0000000..c1aa7ab
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/LightStatusBrake/ZLIGHT_LightstatusBrakeStatus_func.h
@@ -0,0 +1,14 @@
+/************************************************************/
+/* ZLIGHT_LightstatusBrakeStatus_func.h */
+/* Function and variable header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZLIGHT_LIGHTSTATUSBRAKESTATUS_FUNC_H
+#define ZHEADER_ZLIGHT_LIGHTSTATUSBRAKESTATUS_FUNC_H
+
+extern void stm_lbs_start_activity_lightstatus_brake_off();
+extern void stm_lbs_start_activity_lightstatus_brake_on();
+extern void stm_lbs_initialize_variable();
+extern void stm_lbs_start_stm();
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomeScreen_func.c b/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomeScreen_func.c
index c8ba22f..e523349 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomeScreen_func.c
+++ b/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomeScreen_func.c
@@ -1,7 +1,7 @@
/************************************************************/
/* ZNHL_NearHomeScreen_func.c */
/* Function and variable source file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#include "../ZST_include.h"
@@ -29,15 +29,15 @@ void stm_nhl_start_activity_software_keyboard() {
* @name stm_nhl_event_restriction_mode_off
*/
void stm_nhl_event_restriction_mode_off() {
- g_stm_crr_state.layer[StmLayerNoNearHomescreen].state = g_prv_near_homescreen_state_rest_mode_1;
+ g_stm_crr_state.layer[StmLayerNoNearHomescreen].state = g_prv_near_homescreen_state_car_stop;
g_stm_crr_state.layer[StmLayerNoNearHomescreen].changed = STM_TRUE;
}
/*
- * @name stm_nhl_event_restriction_mode_2_on
+ * @name stm_nhl_event_restriction_mode_on
*/
void stm_nhl_event_restriction_mode_on() {
- g_prv_near_homescreen_state_rest_mode_1 = g_stm_prv_state.layer[StmLayerNoNearHomescreen].state;
+ g_prv_near_homescreen_state_car_stop = g_stm_prv_state.layer[StmLayerNoNearHomescreen].state;
}
/*
diff --git a/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomeScreen_func.h b/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomeScreen_func.h
index d2b13f7..a1b70ee 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomeScreen_func.h
+++ b/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomeScreen_func.h
@@ -1,7 +1,7 @@
/************************************************************/
/* ZNHL_NearHomeScreen_func.h */
/* Function and variable header file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZNHL_NEARHOMESCREEN_FUNC_H
#define ZHEADER_ZNHL_NEARHOMESCREEN_FUNC_H
diff --git a/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomescreen.c b/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomescreen.c
index cc3bbc7..e4213cb 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomescreen.c
+++ b/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomescreen.c
@@ -1,7 +1,7 @@
/************************************************************/
/* ZNHL_NearHomescreen.c */
/* NearHomescreen State transition model source file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#include "../ZST_include.h"
@@ -10,8 +10,8 @@ static uint8_t ZNHL_NearHomescreenState[ZNHL_NEARHOMESCREENSTATENOMAX];
static void ZNHL_NearHomescreens0e0( void );
static void ZNHL_NearHomescreens0e3( void );
-static void ZNHL_NearHomescreens1e0( void );
static void ZNHL_NearHomescreens1e2( void );
+static void ZNHL_NearHomescreens1e4( void );
static void ZNHL_NearHomescreens0Event( void );
static void ZNHL_NearHomescreens1Event( void );
@@ -42,23 +42,23 @@ static void ZNHL_NearHomescreens0e3( void )
/* Action function */
/* STM : NearHomescreen */
/* State : software_keyboard( No 1 ) */
-/* Event : ara_software_keyboard( No 0 ) */
+/* Event : ctg_software_keyboard( No 2 ) */
/****************************************/
-static void ZNHL_NearHomescreens1e0( void )
+static void ZNHL_NearHomescreens1e2( void )
{
- stm_nhl_start_activity_software_keyboard();
+ ZNHL_NearHomescreenState[ZNHL_NEARHOMESCREEN] = ( uint8_t )ZNHL_NEARHOMESCREENS0;
+ stm_nhl_start_activity_none();
}
/****************************************/
/* Action function */
/* STM : NearHomescreen */
/* State : software_keyboard( No 1 ) */
-/* Event : ctg_software_keyboard( No 2 ) */
+/* Event : stt_prv_layer_near_homescreen_sft_kbd( No 4 ) */
/****************************************/
-static void ZNHL_NearHomescreens1e2( void )
+static void ZNHL_NearHomescreens1e4( void )
{
- ZNHL_NearHomescreenState[ZNHL_NEARHOMESCREEN] = ( uint8_t )ZNHL_NEARHOMESCREENS0;
- stm_nhl_start_activity_none();
+ stm_nhl_start_activity_software_keyboard();
}
/****************************************/
@@ -123,30 +123,8 @@ static void ZNHL_NearHomescreens0Event( void )
/****************************************/
static void ZNHL_NearHomescreens1Event( void )
{
- /*evt_activate*/
- if( g_stm_event == StmEvtNoActivate )
- {
- /*ctg_software_keyboard*/
- if( g_stm_category == StmCtgNoSoftwareKeyboard )
- {
- /*ara_software_keyboard*/
- if( g_stm_area == StmAreaNoSoftwareKyeboard )
- {
- ZNHL_NearHomescreens1e0();
- }
- else
- {
- ZNHL_NearHomescreens1e0();
- }
- }
- else
- {
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
- }
- }
/*evt_deactivate*/
- else if( g_stm_event == StmEvtNoDeactivate )
+ if( g_stm_event == StmEvtNoDeactivate )
{
/*ctg_software_keyboard*/
if( g_stm_category == StmCtgNoSoftwareKeyboard )
@@ -170,7 +148,7 @@ static void ZNHL_NearHomescreens1Event( void )
/*stt_prv_layer_near_homescreen_sft_kbd*/
else if( g_stm_prv_state.layer[StmLayerNoNearHomescreen].state == StmLayoutNoSftKbd )
{
- ZNHL_NearHomescreens1e0();
+ ZNHL_NearHomescreens1e4();
}
else
{
@@ -178,8 +156,8 @@ static void ZNHL_NearHomescreens1Event( void )
/*Please confirm the STM and design else and default.*/
}
}
- /*stt_restriction_mode_1_on*/
- else if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNo1On )
+ /*stt_accel_pedal_on*/
+ else if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOn )
{
ZNHL_NearHomescreens1e2();
}
diff --git a/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomescreen.h b/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomescreen.h
index f23775e..5ad45c9 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomescreen.h
+++ b/policy_manager/stm/zipc/StateTransitionor/NearHomeScreen/ZNHL_NearHomescreen.h
@@ -1,7 +1,7 @@
/************************************************************/
/* ZNHL_NearHomescreen.h */
/* NearHomescreen State transition model header file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZNHL_NEARHOMESCREEN_H
#define ZHEADER_ZNHL_NEARHOMESCREEN_H
diff --git a/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OnScreen_func.c b/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OnScreen_func.c
index 90a6f6f..d00f144 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OnScreen_func.c
+++ b/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OnScreen_func.c
@@ -1,7 +1,7 @@
/************************************************************/
/* ZOSL_OnScreen_func.c */
/* Function and variable source file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#include "../ZST_include.h"
@@ -37,15 +37,15 @@ void stm_osl_start_activity_system_alert() {
* @name stm_osl_event_restriction_mode_off
*/
void stm_osl_event_restriction_mode_off() {
- g_stm_crr_state.layer[StmLayerNoOnScreen].state = g_prv_on_screen_state_rest_mode_1;
+ g_stm_crr_state.layer[StmLayerNoOnScreen].state = g_prv_on_screen_state_car_stop;
g_stm_crr_state.layer[StmLayerNoOnScreen].changed = STM_TRUE;
}
/*
- * @name stm_osl_event_restriction_mode_2_on
+ * @name stm_osl_event_restriction_mode_on
*/
-void stm_osl_event_restriction_mode_2_on() {
- g_prv_on_screen_state_rest_mode_1 = g_stm_prv_state.layer[StmLayerNoOnScreen].state;
+void stm_osl_event_restriction_mode_on() {
+ g_prv_on_screen_state_car_stop = g_stm_prv_state.layer[StmLayerNoOnScreen].state;
}
/*
* @name stm_osl_initialize_variable
diff --git a/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OnScreen_func.h b/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OnScreen_func.h
index e85accb..790f9ce 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OnScreen_func.h
+++ b/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OnScreen_func.h
@@ -1,7 +1,7 @@
/************************************************************/
/* ZOSL_OnScreen_func.h */
/* Function and variable header file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZOSL_ONSCREEN_FUNC_H
#define ZHEADER_ZOSL_ONSCREEN_FUNC_H
@@ -10,7 +10,7 @@ extern void stm_osl_start_activity_none();
extern void stm_osl_start_activity_pop_up();
extern void stm_osl_start_activity_system_alert();
extern void stm_osl_event_restriction_mode_off();
-extern void stm_osl_event_restriction_mode_2_on();
+extern void stm_osl_event_restriction_mode_on();
extern void stm_osl_initialize_variable();
extern void stm_osl_start_stm();
diff --git a/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OslMain.c b/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OslMain.c
index 53a50e1..910df6c 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OslMain.c
+++ b/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OslMain.c
@@ -1,7 +1,7 @@
/************************************************************/
/* ZOSL_OslMain.c */
/* OslMain State transition model source file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#include "../ZST_include.h"
@@ -18,11 +18,11 @@ static void ZOSL_OslRestOffs0e1( void );
static void ZOSL_OslRestOffs0e4( void );
static void ZOSL_OslRestOffs1e0( void );
static void ZOSL_OslRestOffs1e2( void );
-static void ZOSL_OslRestOffs2e1( void );
+static void ZOSL_OslRestOffs2e6( void );
static void ZOSL_OslRestOns0e0( void );
static void ZOSL_OslRestOns0e2( void );
-static void ZOSL_OslRestOns1e0( void );
static void ZOSL_OslRestOns1e1( void );
+static void ZOSL_OslRestOns1e3( void );
static void ZOSL_OslMains0Event( void );
static void ZOSL_OslRestOffs0Event( void );
static void ZOSL_OslRestOffs1Event( void );
@@ -58,7 +58,7 @@ static void ZOSL_OslMains0StateEntry( void )
/****************************************/
/* State start activity function */
/* STM : OslMain */
-/* State : restriction_mode_2_on( No 1 ) */
+/* State : restriction_mode_on( No 1 )*/
/****************************************/
static void ZOSL_OslMains1StateEntry( void )
{
@@ -105,7 +105,7 @@ static void ZOSL_OslMains0e2( void )
/****************************************/
/* Action function */
/* STM : OslMain */
-/* State : restriction_mode_2_on( No 1 ) */
+/* State : restriction_mode_on( No 1 )*/
/* Event : stt_restriction_mode_off( No 0 ) */
/****************************************/
static void ZOSL_OslMains1e0( void )
@@ -176,9 +176,9 @@ static void ZOSL_OslRestOffs1e2( void )
/* Action function */
/* STM : OslRestOff */
/* State : system_alert( No 2 ) */
-/* Event : ara_onscreen( No 1 ) */
+/* Event : stt_prv_layer_on_screen_sys_alt( No 6 ) */
/****************************************/
-static void ZOSL_OslRestOffs2e1( void )
+static void ZOSL_OslRestOffs2e6( void )
{
stm_osl_start_activity_system_alert();
}
@@ -210,23 +210,23 @@ static void ZOSL_OslRestOns0e2( void )
/* Action function */
/* STM : OslRestOn */
/* State : system_alert( No 1 ) */
-/* Event : ara_onscreen( No 0 ) */
+/* Event : ctg_systemalert( No 1 ) */
/****************************************/
-static void ZOSL_OslRestOns1e0( void )
+static void ZOSL_OslRestOns1e1( void )
{
- stm_osl_start_activity_system_alert();
+ ZOSL_OslMainState[ZOSL_OSLMAINS1F] = ( uint8_t )ZOSL_OSLRESTONS0;
+ stm_osl_start_activity_none();
}
/****************************************/
/* Action function */
/* STM : OslRestOn */
/* State : system_alert( No 1 ) */
-/* Event : ctg_systemalert( No 1 ) */
+/* Event : stt_prv_layer_on_screen_sys_alt( No 3 ) */
/****************************************/
-static void ZOSL_OslRestOns1e1( void )
+static void ZOSL_OslRestOns1e3( void )
{
- ZOSL_OslMainState[ZOSL_OSLMAINS1F] = ( uint8_t )ZOSL_OSLRESTONS0;
- stm_osl_start_activity_none();
+ stm_osl_start_activity_system_alert();
}
/****************************************/
@@ -236,10 +236,10 @@ static void ZOSL_OslRestOns1e1( void )
/****************************************/
static void ZOSL_OslMains0Event( void )
{
- /*stt_restriction_mode_2_on*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNo2On )
+ /*stt_restriction_mode_on*/
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOn )
{
- stm_rel_event_restriction_mode_2_on();
+ stm_rel_event_restriction_mode_on();
/*stt_crr_layer_on_screen_pop*/
if( g_stm_crr_state.layer[StmLayerNoOnScreen].state == StmLayoutNoPopUp )
{
@@ -271,7 +271,7 @@ static void ZOSL_OslMains0Event( void )
static void ZOSL_OslRestOffs0Event( void )
{
/*stt_restriction_mode_off*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
/*evt_activate*/
if( g_stm_event == StmEvtNoActivate )
@@ -355,7 +355,7 @@ static void ZOSL_OslRestOffs0Event( void )
static void ZOSL_OslRestOffs1Event( void )
{
/*stt_restriction_mode_off*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
/*evt_activate*/
if( g_stm_event == StmEvtNoActivate )
@@ -453,33 +453,10 @@ static void ZOSL_OslRestOffs1Event( void )
static void ZOSL_OslRestOffs2Event( void )
{
/*stt_restriction_mode_off*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
- /*evt_activate*/
- if( g_stm_event == StmEvtNoActivate )
- {
- /*ctg_systemalert*/
- if( g_stm_category == StmCtgNoSystemAlert )
- {
- /*ara_onscreen*/
- if( g_stm_area == StmAreaNoOnScreen )
- {
- ZOSL_OslRestOffs2e1();
- }
- else
- {
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
- }
- }
- else
- {
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
- }
- }
/*evt_deactivate*/
- else if( g_stm_event == StmEvtNoDeactivate )
+ if( g_stm_event == StmEvtNoDeactivate )
{
/*ctg_systemalert*/
if( g_stm_category == StmCtgNoSystemAlert )
@@ -508,7 +485,7 @@ static void ZOSL_OslRestOffs2Event( void )
/*stt_prv_layer_on_screen_sys_alt*/
else if( g_stm_prv_state.layer[StmLayerNoOnScreen].state == StmLayoutNoSysAlt )
{
- ZOSL_OslRestOffs2e1();
+ ZOSL_OslRestOffs2e6();
}
else
{
@@ -532,12 +509,12 @@ static void ZOSL_OslRestOffs2Event( void )
/****************************************/
/* Event appraisal function */
/* STM : OslMain */
-/* State : restriction_mode_2_on( No 1 ) */
+/* State : restriction_mode_on( No 1 )*/
/****************************************/
static void ZOSL_OslMains1Event( void )
{
/*stt_restriction_mode_off*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
stm_rel_event_restriction_mode_off();
ZOSL_OslMains1e0();
@@ -556,8 +533,8 @@ static void ZOSL_OslMains1Event( void )
/****************************************/
static void ZOSL_OslRestOns0Event( void )
{
- /*stt_restriction_mode_2_on*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNo2On )
+ /*stt_restriction_mode_on*/
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOn )
{
/*evt_activate*/
if( g_stm_event == StmEvtNoActivate )
@@ -621,34 +598,11 @@ static void ZOSL_OslRestOns0Event( void )
/****************************************/
static void ZOSL_OslRestOns1Event( void )
{
- /*stt_restriction_mode_2_on*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNo2On )
+ /*stt_restriction_mode_on*/
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOn )
{
- /*evt_activate*/
- if( g_stm_event == StmEvtNoActivate )
- {
- /*ctg_systemalert*/
- if( g_stm_category == StmCtgNoSystemAlert )
- {
- /*ara_onscreen*/
- if( g_stm_area == StmAreaNoOnScreen )
- {
- ZOSL_OslRestOns1e0();
- }
- else
- {
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
- }
- }
- else
- {
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
- }
- }
/*evt_deactivate*/
- else if( g_stm_event == StmEvtNoDeactivate )
+ if( g_stm_event == StmEvtNoDeactivate )
{
/*ctg_systemalert*/
if( g_stm_category == StmCtgNoSystemAlert )
@@ -672,7 +626,7 @@ static void ZOSL_OslRestOns1Event( void )
/*stt_prv_layer_on_screen_sys_alt*/
else if( g_stm_prv_state.layer[StmLayerNoOnScreen].state == StmLayoutNoSysAlt )
{
- ZOSL_OslRestOns1e0();
+ ZOSL_OslRestOns1e3();
}
else
{
diff --git a/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OslMain.h b/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OslMain.h
index ee45304..911db5b 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OslMain.h
+++ b/policy_manager/stm/zipc/StateTransitionor/OnScreenlayer/ZOSL_OslMain.h
@@ -1,7 +1,7 @@
/************************************************************/
/* ZOSL_OslMain.h */
/* OslMain State transition model header file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZOSL_OSLMAIN_H
#define ZHEADER_ZOSL_OSLMAIN_H
diff --git a/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_RelMain.c b/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_RelMain.c
index 6d07643..821b2a4 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_RelMain.c
+++ b/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_RelMain.c
@@ -1,7 +1,7 @@
/************************************************************/
/* ZREL_RelMain.c */
/* RelMain State transition model source file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#include "../ZST_include.h"
@@ -58,7 +58,7 @@ static void ZREL_RelMains0StateEntry( void )
/****************************************/
/* State start activity function */
/* STM : RelMain */
-/* State : restriction_mode_2_on( No 1 ) */
+/* State : restriction_mode_on( No 1 )*/
/****************************************/
static void ZREL_RelMains1StateEntry( void )
{
@@ -77,7 +77,7 @@ static void ZREL_RelMains1StateEntry( void )
/* Action function */
/* STM : RelMain */
/* State : restriction_mode_off( No 0 ) */
-/* Event : stt_restriction_mode_2_on( No 1 ) */
+/* Event : stt_restriction_mode_on( No 1 ) */
/****************************************/
static void ZREL_RelMains0e1( void )
{
@@ -89,7 +89,7 @@ static void ZREL_RelMains0e1( void )
/****************************************/
/* Action function */
/* STM : RelMain */
-/* State : restriction_mode_2_on( No 1 ) */
+/* State : restriction_mode_on( No 1 )*/
/* Event : stt_restriction_mode_off( No 0 ) */
/****************************************/
static void ZREL_RelMains1e0( void )
@@ -197,10 +197,10 @@ static void ZREL_RelRestOffs3e0( void )
/****************************************/
static void ZREL_RelMains0Event( void )
{
- /*stt_restriction_mode_2_on*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNo2On )
+ /*stt_restriction_mode_on*/
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOn )
{
- stm_rel_event_restriction_mode_2_on();
+ stm_rel_event_restriction_mode_on();
ZREL_RelMains0e1();
}
else
@@ -217,54 +217,73 @@ static void ZREL_RelMains0Event( void )
/****************************************/
static void ZREL_RelRestOffs0Event( void )
{
- /*stt_restriction_mode_1_on*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNo1On )
+ /*stt_restriction_mode_off*/
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
- /*stt_crr_layer_apps_changed*/
- if( g_stm_crr_state.layer[StmLayerNoApps].changed == STM_TRUE )
+ /*stt_accel_pedal_on*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOn )
{
- /*stt_crr_layer_apps_map_spl*/
- if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl )
+ /*stt_crr_layer_apps_changed*/
+ if( g_stm_crr_state.layer[StmLayerNoApps].changed == STM_TRUE )
{
- ZREL_RelRestOffs0e0();
- }
- /*stt_crr_layer_apps_spl_nml*/
- else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml )
- {
- ZREL_RelRestOffs0e1();
- }
- /*stt_crr_layer_apps_spl_spl*/
- else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplSpl )
- {
- ZREL_RelRestOffs0e1();
- }
- /*stt_crr_layer_apps_gen_nml*/
- else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoGenNml )
- {
- ZREL_RelRestOffs0e1();
+ /*stt_crr_layer_apps_map_spl*/
+ if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl )
+ {
+ ZREL_RelRestOffs0e0();
+ }
+ /*stt_crr_layer_apps_spl_nml*/
+ else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml )
+ {
+ ZREL_RelRestOffs0e1();
+ }
+ /*stt_crr_layer_apps_spl_spl*/
+ else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplSpl )
+ {
+ ZREL_RelRestOffs0e1();
+ }
+ /*stt_crr_layer_apps_gen_nml*/
+ else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoGenNml )
+ {
+ ZREL_RelRestOffs0e1();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
}
- else
+ /*evt_activate*/
+ else if( g_stm_event == StmEvtNoActivate )
{
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
- }
- }
- /*evt_activate*/
- else if( g_stm_event == StmEvtNoActivate )
- {
- /*ctg_restriction*/
- if( g_stm_category == StmCtgNoRestriction )
- {
- /*ara_restriction_normal*/
- if( g_stm_area == StmAreaNoRestrictionNormal )
+ /*ctg_restriction*/
+ if( g_stm_category == StmCtgNoRestriction )
{
- /*stt_crr_layer_apps_spl_nml*/
- if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml )
+ /*ara_restriction_normal*/
+ if( g_stm_area == StmAreaNoRestrictionNormal )
{
- ZREL_RelRestOffs0e1();
+ /*stt_crr_layer_apps_spl_nml*/
+ if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml )
+ {
+ ZREL_RelRestOffs0e1();
+ }
+ /*stt_crr_layer_apps_map_spl*/
+ else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl )
+ {
+ ZREL_RelRestOffs0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ara_restriction_split_main*/
+ else if( g_stm_area == StmAreaNoRestrictionSplitMain )
+ {
+ ZREL_RelRestOffs0e8();
}
- /*stt_crr_layer_apps_map_spl*/
- else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl )
+ /*ara_restriction_split_sub*/
+ else if( g_stm_area == StmAreaNoRestrictionSplitSub )
{
ZREL_RelRestOffs0e0();
}
@@ -274,16 +293,6 @@ static void ZREL_RelRestOffs0Event( void )
/*Please confirm the STM and design else and default.*/
}
}
- /*ara_restriction_split_main*/
- else if( g_stm_area == StmAreaNoRestrictionSplitMain )
- {
- ZREL_RelRestOffs0e8();
- }
- /*ara_restriction_split_sub*/
- else if( g_stm_area == StmAreaNoRestrictionSplitSub )
- {
- ZREL_RelRestOffs0e0();
- }
else
{
/*Else and default design have not done.*/
@@ -296,17 +305,8 @@ static void ZREL_RelRestOffs0Event( void )
/*Please confirm the STM and design else and default.*/
}
}
- else
- {
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
- }
- }
- /*stt_restriction_mode_off*/
- else if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
- {
/*evt_undo*/
- if( g_stm_event == StmEvtNoUndo )
+ else if( g_stm_event == StmEvtNoUndo )
{
/*stt_prv_layer_rst_none*/
if( g_stm_prv_state.layer[StmLayerNoRestriction].state == StmLayoutNoNone )
@@ -354,62 +354,81 @@ static void ZREL_RelRestOffs0Event( void )
/****************************************/
static void ZREL_RelRestOffs1Event( void )
{
- /*stt_restriction_mode_1_on*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNo1On )
+ /*stt_restriction_mode_off*/
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
- /*stt_crr_layer_apps_changed*/
- if( g_stm_crr_state.layer[StmLayerNoApps].changed == STM_TRUE )
- {
- /*stt_crr_layer_apps_map_spl*/
- if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl )
- {
- ZREL_RelRestOffs0e0();
- }
- /*stt_crr_layer_apps_spl_nml*/
- else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml )
- {
- ZREL_RelRestOffs1e1();
- }
- /*stt_crr_layer_apps_spl_spl*/
- else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplSpl )
- {
- ZREL_RelRestOffs1e1();
- }
- /*stt_crr_layer_apps_gen_nml*/
- else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoGenNml )
- {
- ZREL_RelRestOffs1e1();
- }
- else
- {
- ZREL_RelRestOffs1e4();
- }
- }
- /*stt_crr_layer_hs_changed*/
- else if( g_stm_crr_state.layer[StmLayerNoHomescreen].changed == STM_TRUE )
+ /*stt_accel_pedal_on*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOn )
{
- /*stt_crr_layer_hs_hms*/
- if( g_stm_crr_state.layer[StmLayerNoHomescreen].state == StmLayoutNoHms )
+ /*stt_crr_layer_apps_changed*/
+ if( g_stm_crr_state.layer[StmLayerNoApps].changed == STM_TRUE )
{
- ZREL_RelRestOffs1e4();
+ /*stt_crr_layer_apps_map_spl*/
+ if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl )
+ {
+ ZREL_RelRestOffs0e0();
+ }
+ /*stt_crr_layer_apps_spl_nml*/
+ else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml )
+ {
+ ZREL_RelRestOffs1e1();
+ }
+ /*stt_crr_layer_apps_spl_spl*/
+ else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplSpl )
+ {
+ ZREL_RelRestOffs1e1();
+ }
+ /*stt_crr_layer_apps_gen_nml*/
+ else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoGenNml )
+ {
+ ZREL_RelRestOffs1e1();
+ }
+ else
+ {
+ ZREL_RelRestOffs1e4();
+ }
}
- else
+ /*stt_crr_layer_hs_changed*/
+ else if( g_stm_crr_state.layer[StmLayerNoHomescreen].changed == STM_TRUE )
{
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
+ /*stt_crr_layer_hs_hms*/
+ if( g_stm_crr_state.layer[StmLayerNoHomescreen].state == StmLayoutNoHms )
+ {
+ ZREL_RelRestOffs1e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
}
- }
- /*evt_activate*/
- else if( g_stm_event == StmEvtNoActivate )
- {
- /*ctg_restriction*/
- if( g_stm_category == StmCtgNoRestriction )
+ /*evt_activate*/
+ else if( g_stm_event == StmEvtNoActivate )
{
- /*ara_restriction_normal*/
- if( g_stm_area == StmAreaNoRestrictionNormal )
+ /*ctg_restriction*/
+ if( g_stm_category == StmCtgNoRestriction )
{
- /*stt_crr_layer_apps_map_spl*/
- if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl )
+ /*ara_restriction_normal*/
+ if( g_stm_area == StmAreaNoRestrictionNormal )
+ {
+ /*stt_crr_layer_apps_map_spl*/
+ if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl )
+ {
+ ZREL_RelRestOffs0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ara_restriction_split_main*/
+ else if( g_stm_area == StmAreaNoRestrictionSplitMain )
+ {
+ ZREL_RelRestOffs0e8();
+ }
+ /*ara_restriction_split_sub*/
+ else if( g_stm_area == StmAreaNoRestrictionSplitSub )
{
ZREL_RelRestOffs0e0();
}
@@ -419,15 +438,19 @@ static void ZREL_RelRestOffs1Event( void )
/*Please confirm the STM and design else and default.*/
}
}
- /*ara_restriction_split_main*/
- else if( g_stm_area == StmAreaNoRestrictionSplitMain )
+ /*ctg_homescreen*/
+ else if( g_stm_category == StmCtgNoHomescreen )
{
- ZREL_RelRestOffs0e8();
- }
- /*ara_restriction_split_sub*/
- else if( g_stm_area == StmAreaNoRestrictionSplitSub )
- {
- ZREL_RelRestOffs0e0();
+ /*ara_fullscreen*/
+ if( g_stm_area == StmAreaNoFullscreen )
+ {
+ ZREL_RelRestOffs1e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
}
else
{
@@ -435,11 +458,11 @@ static void ZREL_RelRestOffs1Event( void )
/*Please confirm the STM and design else and default.*/
}
}
- /*ctg_homescreen*/
- else if( g_stm_category == StmCtgNoHomescreen )
+ /*evt_deactivate*/
+ else if( g_stm_event == StmEvtNoDeactivate )
{
- /*ara_fullscreen*/
- if( g_stm_area == StmAreaNoFullscreen )
+ /*ctg_restriction*/
+ if( g_stm_category == StmCtgNoRestriction )
{
ZREL_RelRestOffs1e4();
}
@@ -455,11 +478,11 @@ static void ZREL_RelRestOffs1Event( void )
/*Please confirm the STM and design else and default.*/
}
}
- /*evt_deactivate*/
- else if( g_stm_event == StmEvtNoDeactivate )
+ /*stt_accel_pedal_off*/
+ else if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOff )
{
- /*ctg_restriction*/
- if( g_stm_category == StmCtgNoRestriction )
+ /*stt_prv_layer_rst_not_none*/
+ if( g_stm_prv_state.layer[StmLayerNoRestriction].state != StmLayoutNoNone )
{
ZREL_RelRestOffs1e4();
}
@@ -469,20 +492,6 @@ static void ZREL_RelRestOffs1Event( void )
/*Please confirm the STM and design else and default.*/
}
}
- else
- {
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
- }
- }
- /*stt_restriction_mode_off*/
- else if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
- {
- /*stt_prv_layer_rst_not_none*/
- if( g_stm_prv_state.layer[StmLayerNoRestriction].state != StmLayoutNoNone )
- {
- ZREL_RelRestOffs1e4();
- }
/*evt_undo*/
else if( g_stm_event == StmEvtNoUndo )
{
@@ -532,69 +541,83 @@ static void ZREL_RelRestOffs1Event( void )
/****************************************/
static void ZREL_RelRestOffs2Event( void )
{
- /*stt_restriction_mode_1_on*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNo1On )
+ /*stt_restriction_mode_off*/
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
- /*stt_crr_layer_apps_changed*/
- if( g_stm_crr_state.layer[StmLayerNoApps].changed == STM_TRUE )
- {
- /*stt_crr_layer_apps_map_spl*/
- if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl )
- {
- ZREL_RelRestOffs0e0();
- }
- /*stt_crr_layer_apps_spl_nml*/
- else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml )
- {
- ZREL_RelRestOffs0e1();
- }
- /*stt_crr_layer_apps_spl_spl*/
- else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplSpl )
- {
- ZREL_RelRestOffs0e1();
- }
- /*stt_crr_layer_apps_gen_nml*/
- else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoGenNml )
- {
- ZREL_RelRestOffs0e1();
- }
- else
- {
- ZREL_RelRestOffs1e4();
- }
- }
- /*stt_crr_layer_hs_changed*/
- else if( g_stm_crr_state.layer[StmLayerNoHomescreen].changed == STM_TRUE )
+ /*stt_accel_pedal_on*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOn )
{
- /*stt_crr_layer_hs_hms*/
- if( g_stm_crr_state.layer[StmLayerNoHomescreen].state == StmLayoutNoHms )
+ /*stt_crr_layer_apps_changed*/
+ if( g_stm_crr_state.layer[StmLayerNoApps].changed == STM_TRUE )
{
- ZREL_RelRestOffs1e4();
+ /*stt_crr_layer_apps_map_spl*/
+ if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl )
+ {
+ ZREL_RelRestOffs0e0();
+ }
+ /*stt_crr_layer_apps_spl_nml*/
+ else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml )
+ {
+ ZREL_RelRestOffs0e1();
+ }
+ /*stt_crr_layer_apps_spl_spl*/
+ else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplSpl )
+ {
+ ZREL_RelRestOffs0e1();
+ }
+ /*stt_crr_layer_apps_gen_nml*/
+ else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoGenNml )
+ {
+ ZREL_RelRestOffs0e1();
+ }
+ else
+ {
+ ZREL_RelRestOffs1e4();
+ }
}
- else
+ /*stt_crr_layer_hs_changed*/
+ else if( g_stm_crr_state.layer[StmLayerNoHomescreen].changed == STM_TRUE )
{
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
+ /*stt_crr_layer_hs_hms*/
+ if( g_stm_crr_state.layer[StmLayerNoHomescreen].state == StmLayoutNoHms )
+ {
+ ZREL_RelRestOffs1e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
}
- }
- /*evt_activate*/
- else if( g_stm_event == StmEvtNoActivate )
- {
- /*ctg_restriction*/
- if( g_stm_category == StmCtgNoRestriction )
+ /*evt_activate*/
+ else if( g_stm_event == StmEvtNoActivate )
{
- /*ara_restriction_normal*/
- if( g_stm_area == StmAreaNoRestrictionNormal )
+ /*ctg_restriction*/
+ if( g_stm_category == StmCtgNoRestriction )
{
- /*stt_crr_layer_apps_spl_nml*/
- if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml )
+ /*ara_restriction_normal*/
+ if( g_stm_area == StmAreaNoRestrictionNormal )
{
- ZREL_RelRestOffs0e1();
+ /*stt_crr_layer_apps_spl_nml*/
+ if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml )
+ {
+ ZREL_RelRestOffs0e1();
+ }
+ /*stt_crr_layer_apps_map_spl*/
+ else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl )
+ {
+ ZREL_RelRestOffs0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
}
- /*stt_crr_layer_apps_map_spl*/
- else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl )
+ /*ara_restriction_split_sub*/
+ else if( g_stm_area == StmAreaNoRestrictionSplitSub )
{
- ZREL_RelRestOffs0e0();
+ ZREL_RelRestOffs0e1();
}
else
{
@@ -602,10 +625,19 @@ static void ZREL_RelRestOffs2Event( void )
/*Please confirm the STM and design else and default.*/
}
}
- /*ara_restriction_split_sub*/
- else if( g_stm_area == StmAreaNoRestrictionSplitSub )
+ /*ctg_homescreen*/
+ else if( g_stm_category == StmCtgNoHomescreen )
{
- ZREL_RelRestOffs0e1();
+ /*ara_fullscreen*/
+ if( g_stm_area == StmAreaNoFullscreen )
+ {
+ ZREL_RelRestOffs1e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
}
else
{
@@ -613,11 +645,11 @@ static void ZREL_RelRestOffs2Event( void )
/*Please confirm the STM and design else and default.*/
}
}
- /*ctg_homescreen*/
- else if( g_stm_category == StmCtgNoHomescreen )
+ /*evt_deactivate*/
+ else if( g_stm_event == StmEvtNoDeactivate )
{
- /*ara_fullscreen*/
- if( g_stm_area == StmAreaNoFullscreen )
+ /*ctg_restriction*/
+ if( g_stm_category == StmCtgNoRestriction )
{
ZREL_RelRestOffs1e4();
}
@@ -633,11 +665,11 @@ static void ZREL_RelRestOffs2Event( void )
/*Please confirm the STM and design else and default.*/
}
}
- /*evt_deactivate*/
- else if( g_stm_event == StmEvtNoDeactivate )
+ /*stt_accel_pedal_off*/
+ else if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOff )
{
- /*ctg_restriction*/
- if( g_stm_category == StmCtgNoRestriction )
+ /*stt_prv_layer_rst_not_none*/
+ if( g_stm_prv_state.layer[StmLayerNoRestriction].state != StmLayoutNoNone )
{
ZREL_RelRestOffs1e4();
}
@@ -647,20 +679,6 @@ static void ZREL_RelRestOffs2Event( void )
/*Please confirm the STM and design else and default.*/
}
}
- else
- {
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
- }
- }
- /*stt_restriction_mode_off*/
- else if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
- {
- /*stt_prv_layer_rst_not_none*/
- if( g_stm_prv_state.layer[StmLayerNoRestriction].state != StmLayoutNoNone )
- {
- ZREL_RelRestOffs1e4();
- }
/*evt_undo*/
else if( g_stm_event == StmEvtNoUndo )
{
@@ -710,62 +728,76 @@ static void ZREL_RelRestOffs2Event( void )
/****************************************/
static void ZREL_RelRestOffs3Event( void )
{
- /*stt_restriction_mode_1_on*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNo1On )
+ /*stt_restriction_mode_off*/
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
- /*stt_crr_layer_apps_changed*/
- if( g_stm_crr_state.layer[StmLayerNoApps].changed == STM_TRUE )
- {
- /*stt_crr_layer_apps_map_spl*/
- if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl )
- {
- ZREL_RelRestOffs3e0();
- }
- /*stt_crr_layer_apps_spl_nml*/
- else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml )
- {
- ZREL_RelRestOffs0e1();
- }
- /*stt_crr_layer_apps_spl_spl*/
- else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplSpl )
- {
- ZREL_RelRestOffs0e1();
- }
- /*stt_crr_layer_apps_gen_nml*/
- else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoGenNml )
- {
- ZREL_RelRestOffs0e1();
- }
- else
- {
- ZREL_RelRestOffs1e4();
- }
- }
- /*stt_crr_layer_hs_changed*/
- else if( g_stm_crr_state.layer[StmLayerNoHomescreen].changed == STM_TRUE )
+ /*stt_accel_pedal_on*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOn )
{
- /*stt_crr_layer_hs_hms*/
- if( g_stm_crr_state.layer[StmLayerNoHomescreen].state == StmLayoutNoHms )
+ /*stt_crr_layer_apps_changed*/
+ if( g_stm_crr_state.layer[StmLayerNoApps].changed == STM_TRUE )
{
- ZREL_RelRestOffs1e4();
+ /*stt_crr_layer_apps_map_spl*/
+ if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl )
+ {
+ ZREL_RelRestOffs3e0();
+ }
+ /*stt_crr_layer_apps_spl_nml*/
+ else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml )
+ {
+ ZREL_RelRestOffs0e1();
+ }
+ /*stt_crr_layer_apps_spl_spl*/
+ else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplSpl )
+ {
+ ZREL_RelRestOffs0e1();
+ }
+ /*stt_crr_layer_apps_gen_nml*/
+ else if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoGenNml )
+ {
+ ZREL_RelRestOffs0e1();
+ }
+ else
+ {
+ ZREL_RelRestOffs1e4();
+ }
}
- else
+ /*stt_crr_layer_hs_changed*/
+ else if( g_stm_crr_state.layer[StmLayerNoHomescreen].changed == STM_TRUE )
{
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
+ /*stt_crr_layer_hs_hms*/
+ if( g_stm_crr_state.layer[StmLayerNoHomescreen].state == StmLayoutNoHms )
+ {
+ ZREL_RelRestOffs1e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
}
- }
- /*evt_activate*/
- else if( g_stm_event == StmEvtNoActivate )
- {
- /*ctg_restriction*/
- if( g_stm_category == StmCtgNoRestriction )
+ /*evt_activate*/
+ else if( g_stm_event == StmEvtNoActivate )
{
- /*ara_restriction_normal*/
- if( g_stm_area == StmAreaNoRestrictionNormal )
+ /*ctg_restriction*/
+ if( g_stm_category == StmCtgNoRestriction )
{
- /*stt_crr_layer_apps_spl_nml*/
- if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml )
+ /*ara_restriction_normal*/
+ if( g_stm_area == StmAreaNoRestrictionNormal )
+ {
+ /*stt_crr_layer_apps_spl_nml*/
+ if( g_stm_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml )
+ {
+ ZREL_RelRestOffs0e1();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ara_restriction_split_main*/
+ else if( g_stm_area == StmAreaNoRestrictionSplitMain )
{
ZREL_RelRestOffs0e1();
}
@@ -775,10 +807,19 @@ static void ZREL_RelRestOffs3Event( void )
/*Please confirm the STM and design else and default.*/
}
}
- /*ara_restriction_split_main*/
- else if( g_stm_area == StmAreaNoRestrictionSplitMain )
+ /*ctg_homescreen*/
+ else if( g_stm_category == StmCtgNoHomescreen )
{
- ZREL_RelRestOffs0e1();
+ /*ara_fullscreen*/
+ if( g_stm_area == StmAreaNoFullscreen )
+ {
+ ZREL_RelRestOffs1e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
}
else
{
@@ -786,11 +827,11 @@ static void ZREL_RelRestOffs3Event( void )
/*Please confirm the STM and design else and default.*/
}
}
- /*ctg_homescreen*/
- else if( g_stm_category == StmCtgNoHomescreen )
+ /*evt_deactivate*/
+ else if( g_stm_event == StmEvtNoDeactivate )
{
- /*ara_fullscreen*/
- if( g_stm_area == StmAreaNoFullscreen )
+ /*ctg_restriction*/
+ if( g_stm_category == StmCtgNoRestriction )
{
ZREL_RelRestOffs1e4();
}
@@ -806,11 +847,11 @@ static void ZREL_RelRestOffs3Event( void )
/*Please confirm the STM and design else and default.*/
}
}
- /*evt_deactivate*/
- else if( g_stm_event == StmEvtNoDeactivate )
+ /*stt_accel_pedal_off*/
+ else if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOff )
{
- /*ctg_restriction*/
- if( g_stm_category == StmCtgNoRestriction )
+ /*stt_prv_layer_rst_not_none*/
+ if( g_stm_prv_state.layer[StmLayerNoRestriction].state != StmLayoutNoNone )
{
ZREL_RelRestOffs1e4();
}
@@ -820,20 +861,6 @@ static void ZREL_RelRestOffs3Event( void )
/*Please confirm the STM and design else and default.*/
}
}
- else
- {
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
- }
- }
- /*stt_restriction_mode_off*/
- else if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
- {
- /*stt_prv_layer_rst_not_none*/
- if( g_stm_prv_state.layer[StmLayerNoRestriction].state != StmLayoutNoNone )
- {
- ZREL_RelRestOffs1e4();
- }
/*evt_undo*/
else if( g_stm_event == StmEvtNoUndo )
{
@@ -879,12 +906,12 @@ static void ZREL_RelRestOffs3Event( void )
/****************************************/
/* Event appraisal function */
/* STM : RelMain */
-/* State : restriction_mode_2_on( No 1 ) */
+/* State : restriction_mode_on( No 1 )*/
/****************************************/
static void ZREL_RelMains1Event( void )
{
/*stt_restriction_mode_off*/
- if( g_stm_crr_state.mode[StmModeNoRestrictionMode].state == StmRestrictionModeSttNoOff )
+ if( g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state == StmRestrictionModeSttNoOff )
{
stm_rel_event_restriction_mode_off();
ZREL_RelMains1e0();
diff --git a/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_RelMain.h b/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_RelMain.h
index ce82e7a..b82553b 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_RelMain.h
+++ b/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_RelMain.h
@@ -1,7 +1,7 @@
/************************************************************/
/* ZREL_RelMain.h */
/* RelMain State transition model header file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZREL_RELMAIN_H
#define ZHEADER_ZREL_RELMAIN_H
diff --git a/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_Restriction_func.c b/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_Restriction_func.c
index 5195f98..6af7746 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_Restriction_func.c
+++ b/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_Restriction_func.c
@@ -1,7 +1,7 @@
/************************************************************/
/* ZREL_Restriction_func.c */
/* Function and variable source file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#include "../ZST_include.h"
@@ -45,15 +45,15 @@ void stm_rel_start_activity_restriction_split_sub() {
* @name stm_rel_event_restriction_mode_off
*/
void stm_rel_event_restriction_mode_off() {
- g_stm_crr_state.layer[StmLayerNoRestriction].state = g_prv_restriction_state_rest_mode_1;
+ g_stm_crr_state.layer[StmLayerNoRestriction].state = g_prv_restriction_state_car_stop;
g_stm_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE;
}
/*
- * @name stm_rel_event_restriction_mode_2_on
+ * @name stm_rel_event_restriction_mode_on
*/
-void stm_rel_event_restriction_mode_2_on() {
- g_prv_restriction_state_rest_mode_1 = g_stm_prv_state.layer[StmLayerNoRestriction].state;
+void stm_rel_event_restriction_mode_on() {
+ g_prv_restriction_state_car_stop = g_stm_prv_state.layer[StmLayerNoRestriction].state;
}
/*
diff --git a/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_Restriction_func.h b/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_Restriction_func.h
index 5cd9b7d..3dde89d 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_Restriction_func.h
+++ b/policy_manager/stm/zipc/StateTransitionor/RestrictionLayer/ZREL_Restriction_func.h
@@ -1,7 +1,7 @@
/************************************************************/
/* ZREL_Restriction_func.h */
/* Function and variable header file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZREL_RESTRICTION_FUNC_H
#define ZHEADER_ZREL_RESTRICTION_FUNC_H
@@ -11,7 +11,7 @@ extern void stm_rel_start_activity_restriction_normal();
extern void stm_rel_start_activity_restriction_split_main();
extern void stm_rel_start_activity_restriction_split_sub();
extern void stm_rel_event_restriction_mode_off();
-extern void stm_rel_event_restriction_mode_2_on();
+extern void stm_rel_event_restriction_mode_on();
extern void stm_rel_initialize_variable();
extern void stm_rel_start_stm();
diff --git a/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode.c b/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode.c
index 7fe5700..3cd5961 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode.c
+++ b/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode.c
@@ -1,7 +1,7 @@
/************************************************************/
/* ZREM_RestrictionMode.c */
/* RestrictionMode State transition model source file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#include "../ZST_include.h"
@@ -9,88 +9,45 @@
static uint8_t ZREM_RestrictionModeState[ZREM_RESTRICTIONMODESTATENOMAX];
static void ZREM_RestrictionModes0e1( void );
-static void ZREM_RestrictionModes0e2( void );
static void ZREM_RestrictionModes1e0( void );
static void ZREM_RestrictionModes0Event( void );
static void ZREM_RestrictionModes1Event( void );
-static void ZREM_RestrictionModes2Event( void );
/****************************************/
/* Action function */
/* STM : RestrictionMode */
-/* State : restriction_mode_off( No 0 ) */
-/* Event : evt_restriction_mode_1_on( No 1 ) */
+/* State : restriction_mode_on( No 0 )*/
+/* Event : evt_restriction_mode_off( No 1 ) */
/****************************************/
static void ZREM_RestrictionModes0e1( void )
{
ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] = ( uint8_t )ZREM_RESTRICTIONMODES1;
- stm_rem_start_activity_restriction_mode_1_on();
-}
-
-/****************************************/
-/* Action function */
-/* STM : RestrictionMode */
-/* State : restriction_mode_off( No 0 ) */
-/* Event : evt_restriction_mode_2_on( No 2 ) */
-/****************************************/
-static void ZREM_RestrictionModes0e2( void )
-{
- ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] = ( uint8_t )ZREM_RESTRICTIONMODES2;
- stm_rem_start_activity_restriction_mode_2_on();
+ stm_rem_start_activity_restriction_mode_off();
}
/****************************************/
/* Action function */
/* STM : RestrictionMode */
-/* State : restriction_mode_1_on( No 1 ) */
-/* Event : evt_restriction_mode_off( No 0 ) */
+/* State : restriction_mode_off( No 1 ) */
+/* Event : evt_restriction_mode_on( No 0 ) */
/****************************************/
static void ZREM_RestrictionModes1e0( void )
{
ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] = ( uint8_t )ZREM_RESTRICTIONMODES0;
- stm_rem_start_activity_restriction_mode_off();
+ stm_rem_start_activity_restriction_mode_on();
}
/****************************************/
/* Event appraisal function */
/* STM : RestrictionMode */
-/* State : restriction_mode_off( No 0 ) */
+/* State : restriction_mode_on( No 0 )*/
/****************************************/
static void ZREM_RestrictionModes0Event( void )
{
- /*evt_restriction_mode_1_on*/
- if( g_stm_event == StmEvtNoRestrictionMode1On )
- {
- ZREM_RestrictionModes0e1();
- }
- /*evt_restriction_mode_2_on*/
- else if( g_stm_event == StmEvtNoRestrictionMode2On )
- {
- ZREM_RestrictionModes0e2();
- }
- else
- {
- /*Else and default design have not done.*/
- /*Please confirm the STM and design else and default.*/
- }
-}
-
-/****************************************/
-/* Event appraisal function */
-/* STM : RestrictionMode */
-/* State : restriction_mode_1_on( No 1 ) */
-/****************************************/
-static void ZREM_RestrictionModes1Event( void )
-{
/*evt_restriction_mode_off*/
if( g_stm_event == StmEvtNoRestrictionModeOff )
{
- ZREM_RestrictionModes1e0();
- }
- /*evt_restriction_mode_2_on*/
- else if( g_stm_event == StmEvtNoRestrictionMode2On )
- {
- ZREM_RestrictionModes0e2();
+ ZREM_RestrictionModes0e1();
}
else
{
@@ -102,20 +59,15 @@ static void ZREM_RestrictionModes1Event( void )
/****************************************/
/* Event appraisal function */
/* STM : RestrictionMode */
-/* State : restriction_mode_2_on( No 2 ) */
+/* State : restriction_mode_off( No 1 ) */
/****************************************/
-static void ZREM_RestrictionModes2Event( void )
+static void ZREM_RestrictionModes1Event( void )
{
- /*evt_restriction_mode_off*/
- if( g_stm_event == StmEvtNoRestrictionModeOff )
+ /*evt_restriction_mode_on*/
+ if( g_stm_event == StmEvtNoRestrictionModeOn )
{
ZREM_RestrictionModes1e0();
}
- /*evt_restriction_mode_1_on*/
- else if( g_stm_event == StmEvtNoRestrictionMode1On )
- {
- ZREM_RestrictionModes0e1();
- }
else
{
/*Else and default design have not done.*/
@@ -138,9 +90,6 @@ void stm_rem_event_call( void )
case ZREM_RESTRICTIONMODES1:
ZREM_RestrictionModes1Event();
break;
- case ZREM_RESTRICTIONMODES2:
- ZREM_RestrictionModes2Event();
- break;
default:
/*Not accessible to this else (default).*/
break;
@@ -153,7 +102,7 @@ void stm_rem_event_call( void )
/****************************************/
void stm_rem_initialize( void )
{
- ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] = ( uint8_t )ZREM_RESTRICTIONMODES0;
+ ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] = ( uint8_t )ZREM_RESTRICTIONMODES1;
stm_rem_start_activity_restriction_mode_off();
}
diff --git a/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode.h b/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode.h
index f2c2026..956f019 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode.h
+++ b/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode.h
@@ -1,7 +1,7 @@
/************************************************************/
/* ZREM_RestrictionMode.h */
/* RestrictionMode State transition model header file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZREM_RESTRICTIONMODE_H
#define ZHEADER_ZREM_RESTRICTIONMODE_H
@@ -10,33 +10,28 @@
#define ZREM_RESTRICTIONMODE ( 0U )
#define ZREM_RESTRICTIONMODES0 ( 0U )
#define ZREM_RESTRICTIONMODES1 ( 1U )
-#define ZREM_RESTRICTIONMODES2 ( 2U )
#define ZREM_RESTRICTIONMODESTATENOMAX ( 1U )
/*End state define*/
-#define ZREM_RESTRICTIONMODEEND ( 3U )
+#define ZREM_RESTRICTIONMODEEND ( 2U )
/*Terminate state define*/
#define ZREM_RESTRICTIONMODETERMINATE ( ZREM_RESTRICTIONMODEEND + 1U )
/*State no define*/
#define ZREM_RESTRICTIONMODES0STATENO ( 0U )
#define ZREM_RESTRICTIONMODES1STATENO ( 1U )
-#define ZREM_RESTRICTIONMODES2STATENO ( 2U )
/*State serial no define*/
#define ZREM_RESTRICTIONMODES0STATESERIALNO ( 0U )
#define ZREM_RESTRICTIONMODES1STATESERIALNO ( 1U )
-#define ZREM_RESTRICTIONMODES2STATESERIALNO ( 2U )
/*Event no define*/
#define ZREM_RESTRICTIONMODEE0EVENTNO ( 0U )
#define ZREM_RESTRICTIONMODEE1EVENTNO ( 1U )
-#define ZREM_RESTRICTIONMODEE2EVENTNO ( 2U )
/*Event serial no define*/
#define ZREM_RESTRICTIONMODEE0EVENTSERIALNO ( 0U )
#define ZREM_RESTRICTIONMODEE1EVENTSERIALNO ( 1U )
-#define ZREM_RESTRICTIONMODEE2EVENTSERIALNO ( 2U )
/*Extern function*/
extern void stm_rem_event_call( void );
diff --git a/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode_func.c b/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode_func.c
index 94807f8..56e1020 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode_func.c
+++ b/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode_func.c
@@ -1,7 +1,7 @@
/************************************************************/
/* ZREM_RestrictionMode_func.c */
/* Function and variable source file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#include "../ZST_include.h"
@@ -10,44 +10,36 @@
*************************************************************/
/*
- * @name stm_rem_start_activity_restriction_mode_1_on
+ * @name stm_rem_start_activity_restriction_mode_on
*/
-void stm_rem_start_activity_restriction_mode_1_on() {
- g_stm_crr_state.mode[StmModeNoRestrictionMode].state = StmRestrictionModeSttNo1On;
- g_stm_crr_state.mode[StmModeNoRestrictionMode].changed = STM_TRUE;
-}
-
-/*
- * @name stm_rem_start_activity_restriction_mode_2_on
- */
-void stm_rem_start_activity_restriction_mode_2_on() {
- g_stm_crr_state.mode[StmModeNoRestrictionMode].state = StmRestrictionModeSttNo2On;
- g_stm_crr_state.mode[StmModeNoRestrictionMode].changed = STM_TRUE;
+void stm_rem_start_activity_restriction_mode_on() {
+ g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state = StmRestrictionModeSttNoOn;
+ g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].changed = STM_TRUE;
}
/*
* @name stm_rem_start_activity_restriction_mode_off
*/
void stm_rem_start_activity_restriction_mode_off() {
- g_stm_crr_state.mode[StmModeNoRestrictionMode].state = StmRestrictionModeSttNoOff;
- g_stm_crr_state.mode[StmModeNoRestrictionMode].changed = STM_TRUE;
+ g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state = StmRestrictionModeSttNoOff;
+ g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].changed = STM_TRUE;
}
/*
* @name stm_rem_initialize_variable
*/
void stm_rem_initialize_variable() {
- g_stm_prv_state.mode[StmModeNoRestrictionMode].state = StmRestrictionModeSttNoOff;
- g_stm_prv_state.mode[StmModeNoRestrictionMode].changed = STM_FALSE;
+ g_stm_prv_state.car_element[StmCarElementNoRestrictionMode].state = StmRestrictionModeSttNoOff;
+ g_stm_prv_state.car_element[StmCarElementNoRestrictionMode].changed = STM_FALSE;
- g_stm_crr_state.mode[StmModeNoRestrictionMode].state = StmRestrictionModeSttNoOff;
- g_stm_crr_state.mode[StmModeNoRestrictionMode].changed = STM_FALSE;
+ g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state = StmRestrictionModeSttNoOff;
+ g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].changed = STM_FALSE;
}
/*
* @name stm_rem_start_stm
*/
void stm_rem_start_stm() {
- g_stm_prv_state.mode[StmModeNoRestrictionMode].state = g_stm_crr_state.mode[StmModeNoRestrictionMode].state;
- g_stm_crr_state.mode[StmModeNoRestrictionMode].changed = STM_FALSE;
+ g_stm_prv_state.car_element[StmCarElementNoRestrictionMode].state = g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].state;
+ g_stm_crr_state.car_element[StmCarElementNoRestrictionMode].changed = STM_FALSE;
}
diff --git a/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode_func.h b/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode_func.h
index f85ab14..9a5b226 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode_func.h
+++ b/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode_func.h
@@ -1,13 +1,12 @@
/************************************************************/
/* ZREM_RestrictionMode_func.h */
/* Function and variable header file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZREM_RESTRICTIONMODE_FUNC_H
#define ZHEADER_ZREM_RESTRICTIONMODE_FUNC_H
-extern void stm_rem_start_activity_restriction_mode_1_on();
-extern void stm_rem_start_activity_restriction_mode_2_on();
+extern void stm_rem_start_activity_restriction_mode_on();
extern void stm_rem_start_activity_restriction_mode_off();
extern void stm_rem_initialize_variable();
extern void stm_rem_start_stm();
diff --git a/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_def.h b/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_def.h
index 0212a95..1a484da 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_def.h
+++ b/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_def.h
@@ -1,7 +1,7 @@
/************************************************************/
/* ZST_StateTransitionor_def.h */
/* Define header file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZST_STATETRANSITIONOR_DEF_H
#define ZHEADER_ZST_STATETRANSITIONOR_DEF_H
diff --git a/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_func.c b/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_func.c
index 3903202..2779653 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_func.c
+++ b/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_func.c
@@ -1,7 +1,7 @@
/************************************************************/
/* ZST_StateTransitionor_func.c */
/* Function and variable source file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#include "ZST_include.h"
@@ -10,6 +10,12 @@
*************************************************************/
#include <string.h>
+#include <stdbool.h>
+
+#include "../stm_master_apps.h"
+#include "../stm_master_remote.h"
+
+static int stm_ecu_type = StmEcuTypeIVI;
//=================================
// API
@@ -17,34 +23,131 @@
/**
* Initialize STM
*/
-void stmInitializeInner() {
+void stmInitializeInner(const char *ecu_name) {
+
+ if (0 == strcmp("slave", ecu_name))
+ {
+ stm_ecu_type = StmEcuTypeIVI;
+ }
+ else if (0 == strcmp("master", ecu_name))
+ {
+ stm_ecu_type = StmEcuTypeMeter;
+ }
+ else if (0 == strcmp("hud", ecu_name))
+ {
+ stm_ecu_type = StmEcuTypeHUD;
+ }
+ else if (0 == strcmp("rse1", ecu_name))
+ {
+ stm_ecu_type = StmEcuTypeRSE1;
+ }
+ else if (0 == strcmp("rse2", ecu_name))
+ {
+ stm_ecu_type = StmEcuTypeRSE2;
+ }
+
// Initialize previous state
memset(&g_stm_prv_state, 0, sizeof(g_stm_prv_state));
// Initialize current state
g_stm_crr_state = g_stm_prv_state;
- /* Initialize restriction mode state */
- stm_rem_initialize();
- stm_rem_initialize_variable();
+ // Initialize map activate state
+ g_stm_map_is_activated = STM_FALSE;
+
+ switch ( stm_ecu_type )
+ {
+ case StmEcuTypeMeter:
+ /* Initialize LightstatusBrake state */
+ stm_lbs_initialize();
+ stm_lbs_initialize_variable();
- // Initialize homecsreen layer
- stm_hsl_initialize();
- stm_hsl_initialize_variable();
+ /* Initialize AccelPedal state */
+ stm_aps_initialize();
+ stm_aps_initialize_variable();
- // Initialize apps layer
- stm_apl_initialize();
- stm_apl_initialize_variable();
+ /* Initialize car state */
+ stm_rns_initialize();
+ stm_rns_initialize_variable();
- // Initialize near_homecsreen layer
- stm_nhl_initialize();
- stm_nhl_initialize_variable();
+ /* Initialize restriction mode state */
+ stm_rem_initialize();
+ stm_rem_initialize_variable();
- /* Initialize restriction layer */
- stm_rel_initialize();
- stm_rel_initialize_variable();
+ // Initialize homecsreen layer
+ stm_hsl_initialize();
+ stm_hsl_initialize_variable();
- g_stm_map_is_activated = STM_FALSE;
+ // Initialize apps layer on master ecu
+ stm_master_apl_initialize();
+ stm_master_apl_initialize_valiable();
+
+ // Initialize near_homecsreen layer
+ stm_nhl_initialize();
+ stm_nhl_initialize_variable();
+
+ /* Initialize restriction layer */
+ stm_rel_initialize();
+ stm_rel_initialize_variable();
+
+ // Initialize remote layer on master ecu
+ stm_mst_rmt_initialize();
+ stm_mst_rmt_initialize_valiable();
+ break;
+ case StmEcuTypeHUD:
+ // Initialize remote_hud layer on HUD ecu
+ stm_rmt_hud_initialize();
+ stm_rmt_hud_initialize_variable();
+
+ // Initialize remote_hud_up_left layer on HUD ecu
+ stm_rmt_hud_up_left_initialize();
+ stm_rmt_hud_up_left_initialize_variable();
+ break;
+ case StmEcuTypeRSE1:
+ // Initialize remote_rse1 layer on RSE1 ecu
+ stm_rmt_rse1_initialize();
+ stm_rmt_rse1_initialize_variable();
+ break;
+ case StmEcuTypeRSE2:
+ // Initialize remote_rse2 layer on RSE2 ecu
+ stm_rmt_rse2_initialize();
+ stm_rmt_rse2_initialize_variable();
+ break;
+ case StmEcuTypeIVI:
+ default:
+ // Initialize LightstatusBrake state
+ stm_lbs_initialize();
+ stm_lbs_initialize_variable();
+
+ // Initialize AccelPedal state
+ stm_aps_initialize();
+ stm_aps_initialize_variable();
+
+ // Initialize car state
+ stm_rns_initialize();
+ stm_rns_initialize_variable();
+
+ // Initialize restriction mode state
+ stm_rem_initialize();
+ stm_rem_initialize_variable();
+
+ // Initialize homecsreen layer
+ stm_hsl_initialize();
+ stm_hsl_initialize_variable();
+
+ // Initialize apps layer
+ stm_apl_initialize();
+ stm_apl_initialize_variable();
+
+ // Initialize near_homecsreen layer
+ stm_nhl_initialize();
+ stm_nhl_initialize_variable();
+
+ // Initialize restriction layer
+ stm_rel_initialize();
+ stm_rel_initialize_variable();
+ break;
+ }
}
/**
@@ -55,23 +158,84 @@ int stmTransitionStateInner(int event_id, StmState* state) {
g_stm_category = STM_GET_CATEGORY_FROM_ID(event_id);
g_stm_area = STM_GET_AREA_FROM_ID(event_id);
- // restriction mode
- stm_rem_event_call();
+ switch ( stm_ecu_type )
+ {
+ case StmEcuTypeMeter:
+ // LightstatusBrake state
+ stm_lbs_event_call();
- // homescreen layer
- stm_hsl_event_call();
+ // AccelPedal state
+ stm_aps_event_call();
- // apps layer
- stm_apl_event_call();
+ // Car state
+ stm_rns_event_call();
- // near_homecsreen layer
- stm_nhl_event_call();
+ // restriction mode
+ stm_rem_event_call();
- // restriction layer
- stm_rel_event_call();
+ // homescreen layer
+ stm_hsl_event_call();
- // on_screen layer
- stm_osl_event_call();
+ // apps layer on master ecu
+ stm_master_apl_event_call();
+
+ // near_homecsreen layer
+ stm_nhl_event_call();
+
+ // restriction layer
+ stm_rel_event_call();
+
+ // on_screen layer
+ stm_osl_event_call();
+
+ // remote layer on master ecu
+ stm_mst_rmt_event_call();
+ break;
+ case StmEcuTypeHUD:
+ // remote_hud layer on HUD ecu
+ stm_rmt_hud_event_call();
+
+ // remote_hud_up_left layer on HUD ecu
+ stm_rmt_hud_up_left_event_call();
+ break;
+ case StmEcuTypeRSE1:
+ // remote_rse1 layer on RSE1 ecu
+ stm_rmt_rse1_event_call();
+ break;
+ case StmEcuTypeRSE2:
+ // remote_rse2 layer on RSE2 ecu
+ stm_rmt_rse1_event_call();
+ break;
+ case StmEcuTypeIVI:
+ default:
+ // LightstatusBrake state
+ stm_lbs_event_call();
+
+ // AccelPedal state
+ stm_aps_event_call();
+
+ // Car state
+ stm_rns_event_call();
+
+ // restriction mode
+ stm_rem_event_call();
+
+ // homescreen layer
+ stm_hsl_event_call();
+
+ // apps layer
+ stm_apl_event_call();
+
+ // near_homecsreen layer
+ stm_nhl_event_call();
+
+ // restriction layer
+ stm_rel_event_call();
+
+ // on_screen layer
+ stm_osl_event_call();
+ break;
+ }
// Copy current state for return
memcpy(state, &g_stm_crr_state, sizeof(g_stm_crr_state));
@@ -85,8 +249,16 @@ int stmTransitionStateInner(int event_id, StmState* state) {
void stmUndoStateInner() {
g_stm_event = StmEvtNoUndo;
- // apps layer
- stm_apl_event_call();
+ if (StmEcuTypeMeter == stm_ecu_type)
+ {
+ // apps layer on master ecu
+ stm_master_apl_event_call();
+ }
+ else
+ {
+ // apps layer
+ stm_apl_event_call();
+ }
// near_homecsreen layer
stm_nhl_event_call();
@@ -97,6 +269,11 @@ void stmUndoStateInner() {
// on_screen layer
stm_osl_event_call();
+ if (StmEcuTypeMeter == stm_ecu_type)
+ {
+ // remote layer on master ecu
+ stm_mst_rmt_event_call();
+ }
+
g_stm_crr_state = g_stm_prv_state;
}
-
diff --git a/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_func.h b/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_func.h
index 78c4636..a94b1a3 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_func.h
+++ b/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_func.h
@@ -1,12 +1,12 @@
/************************************************************/
/* ZST_StateTransitionor_func.h */
/* Function and variable header file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZST_STATETRANSITIONOR_FUNC_H
#define ZHEADER_ZST_STATETRANSITIONOR_FUNC_H
-extern void stmInitializeInner();
+extern void stmInitializeInner(const char *ecu_name);
extern int stmTransitionStateInner(int event_id, StmState* state);
extern void stmUndoStateInner();
diff --git a/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_var.c b/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_var.c
index b3a2273..5a25680 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_var.c
+++ b/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_var.c
@@ -1,7 +1,7 @@
/************************************************************/
/* ZST_StateTransitionor_var.c */
/* Function and variable source file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#include "ZST_include.h"
@@ -36,21 +36,21 @@ int g_stm_area;
int g_stm_map_is_activated;
/**
- * g_prv_apps_state_rest_mode_1
+ * g_prv_apps_state_car_stop
*/
-int g_prv_apps_state_rest_mode_1;
+int g_prv_apps_state_car_stop;
/**
- * g_prv_near_homescreen_state_rest_mode_1
+ * g_prv_near_homescreen_state_car_stop
*/
-int g_prv_near_homescreen_state_rest_mode_1;
+int g_prv_near_homescreen_state_car_stop;
/**
- * g_prv_restriction_state_rest_mode_1
+ * g_prv_restriction_state_car_stop
*/
-int g_prv_restriction_state_rest_mode_1;
+int g_prv_restriction_state_car_stop;
/**
- * g_prv_on_screen_state_rest_mode_1
+ * g_prv_on_screen_state_car_stop
*/
-int g_prv_on_screen_state_rest_mode_1;
+int g_prv_on_screen_state_car_stop;
diff --git a/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_var.h b/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_var.h
index 57b52ee..cd2a6fd 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_var.h
+++ b/policy_manager/stm/zipc/StateTransitionor/ZST_StateTransitionor_var.h
@@ -1,7 +1,7 @@
/************************************************************/
/* ZST_StateTransitionor_var.h */
/* Function and variable header file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZST_STATETRANSITIONOR_VAR_H
#define ZHEADER_ZST_STATETRANSITIONOR_VAR_H
@@ -12,9 +12,9 @@ extern int g_stm_event;
extern int g_stm_category;
extern int g_stm_area;
extern int g_stm_map_is_activated;
-extern int g_prv_apps_state_rest_mode_1;
-extern int g_prv_near_homescreen_state_rest_mode_1;
-extern int g_prv_restriction_state_rest_mode_1;
-extern int g_prv_on_screen_state_rest_mode_1;
+extern int g_prv_apps_state_car_stop;
+extern int g_prv_near_homescreen_state_car_stop;
+extern int g_prv_restriction_state_car_stop;
+extern int g_prv_on_screen_state_car_stop;
#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/ZST_include.h b/policy_manager/stm/zipc/StateTransitionor/ZST_include.h
index e3d1572..b5beb20 100644..100755
--- a/policy_manager/stm/zipc/StateTransitionor/ZST_include.h
+++ b/policy_manager/stm/zipc/StateTransitionor/ZST_include.h
@@ -1,7 +1,7 @@
/************************************************************/
/* ZST_include.h */
/* Functional block ST include file */
-/* ZIPC Designer Version 1.2.0 */
+/* ZIPC Designer Version 1.2.1 */
/************************************************************/
#ifndef ZHEADER_ZST_INCLUDE_H
@@ -11,19 +11,37 @@
#include "../Common/MisraCType.h"
#include "../Common/Event.h"
#include "ZST_StateTransitionor_def.h"
+#include "master/layer/apps/Zmaster_apps_master_apps_def.h"
+#include "master/layer/remote/Zmaster_remote_master_remote_def.h"
#include "ZST_StateTransitionor_func.h"
#include "ZST_StateTransitionor_var.h"
+#include "hud/layer/remote_hud/Zremote_hud_remote_hud_func.h"
+#include "hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left_func.h"
+#include "rse1/layer/remote_rse1/Zremote_rse1_remote_rse1_func.h"
+#include "rse2/layer/remote_rse2/Zremote_rse2_remote_rse2_func.h"
#include "AppsLayer/ZAPL_Apps_func.h"
#include "OnScreenlayer/ZOSL_OnScreen_func.h"
#include "HomeScreenLayer/ZHSL_HomeScreen_func.h"
#include "RestrictionLayer/ZREL_Restriction_func.h"
#include "RestrictionMode/ZREM_RestrictionMode_func.h"
#include "NearHomeScreen/ZNHL_NearHomeScreen_func.h"
+#include "AccelPedal/ZACCEL_AccelPedalState_func.h"
+#include "CarState/ZCAR_CarState_func.h"
+#include "LightStatusBrake/ZLIGHT_LightstatusBrakeStatus_func.h"
+#include "master/layer/apps/Zmaster_apps_apps_main.h"
+#include "master/layer/remote/Zmaster_remote_remote.h"
+#include "hud/layer/remote_hud/Zremote_hud_remote_hud.h"
+#include "hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left.h"
+#include "rse1/layer/remote_rse1/Zremote_rse1_remote_rse1.h"
+#include "rse2/layer/remote_rse2/Zremote_rse2_remote_rse2.h"
#include "AppsLayer/ZAPL_AppsLayer.h"
#include "OnScreenlayer/ZOSL_OslMain.h"
#include "HomeScreenLayer/ZHSL_HomeScreen.h"
#include "RestrictionLayer/ZREL_RelMain.h"
#include "RestrictionMode/ZREM_RestrictionMode.h"
#include "NearHomeScreen/ZNHL_NearHomescreen.h"
+#include "AccelPedal/ZACCEL_AccelPedal.h"
+#include "CarState/ZCAR_CarState.h"
+#include "LightStatusBrake/ZLIGHT_LightstatusBrake.h"
#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud.c b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud.c
new file mode 100755
index 0000000..26569e3
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud.c
@@ -0,0 +1,179 @@
+/************************************************************/
+/* Zremote_hud_remote_hud.c */
+/* remote_hud State transition model source file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../../../ZST_include.h"
+
+/* State management variable */
+static uint8_t Zremote_hud_remote_hudState[ZREMOTE_HUD_REMOTE_HUDSTATENOMAX];
+
+static void Zremote_hud_remote_huds0e0( void );
+static void Zremote_hud_remote_huds1e0( void );
+static void Zremote_hud_remote_huds1e1( void );
+static void Zremote_hud_remote_huds0Event( void );
+static void Zremote_hud_remote_huds1Event( void );
+
+/****************************************/
+/* Action function */
+/* STM : remote_hud */
+/* State : none( No 0 ) */
+/* Event : ara_normal( No 0 ) */
+/****************************************/
+static void Zremote_hud_remote_huds0e0( void )
+{
+ Zremote_hud_remote_hudState[ZREMOTE_HUD_REMOTE_HUD] = ( uint8_t )ZREMOTE_HUD_REMOTE_HUDS1;
+ stm_remote_hud_start_activity_general();
+}
+
+/****************************************/
+/* Action function */
+/* STM : remote_hud */
+/* State : general( No 1 ) */
+/* Event : ara_normal( No 0 ) */
+/****************************************/
+static void Zremote_hud_remote_huds1e0( void )
+{
+ stm_remote_hud_start_activity_general();
+}
+
+/****************************************/
+/* Action function */
+/* STM : remote_hud */
+/* State : general( No 1 ) */
+/* Event : ctg_general( No 1 ) */
+/****************************************/
+static void Zremote_hud_remote_huds1e1( void )
+{
+ Zremote_hud_remote_hudState[ZREMOTE_HUD_REMOTE_HUD] = ( uint8_t )ZREMOTE_HUD_REMOTE_HUDS0;
+ stm_remote_hud_start_activity_none();
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : remote_hud */
+/* State : none( No 0 ) */
+/****************************************/
+static void Zremote_hud_remote_huds0Event( void )
+{
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_general*/
+ if( g_stm_category == StmCtgNoGeneral )
+ {
+ /*ara_normal*/
+ if( g_stm_area == StmAreaNoNormal )
+ {
+ Zremote_hud_remote_huds0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : remote_hud */
+/* State : general( No 1 ) */
+/****************************************/
+static void Zremote_hud_remote_huds1Event( void )
+{
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_general*/
+ if( g_stm_category == StmCtgNoGeneral )
+ {
+ /*ara_normal*/
+ if( g_stm_area == StmAreaNoNormal )
+ {
+ Zremote_hud_remote_huds1e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_deactivate*/
+ else if( g_stm_event == StmEvtNoDeactivate )
+ {
+ /*ctg_general*/
+ if( g_stm_category == StmCtgNoGeneral )
+ {
+ Zremote_hud_remote_huds1e1();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event call function */
+/* STM : remote_hud */
+/****************************************/
+void stm_rmt_hud_event_call( void )
+{
+ stm_remote_hud_start_stm();
+ switch( Zremote_hud_remote_hudState[ZREMOTE_HUD_REMOTE_HUD] )
+ {
+ case ZREMOTE_HUD_REMOTE_HUDS0:
+ Zremote_hud_remote_huds0Event();
+ break;
+ case ZREMOTE_HUD_REMOTE_HUDS1:
+ Zremote_hud_remote_huds1Event();
+ break;
+ default:
+ /*Not accessible to this else (default).*/
+ break;
+ }
+}
+
+/****************************************/
+/* Initial function */
+/* STM : remote_hud */
+/****************************************/
+void stm_rmt_hud_initialize( void )
+{
+ Zremote_hud_remote_hudState[ZREMOTE_HUD_REMOTE_HUD] = ( uint8_t )ZREMOTE_HUD_REMOTE_HUDS0;
+ stm_remote_hud_start_activity_none();
+}
+
+/****************************************/
+/* Terminate function */
+/* STM : remote_hud */
+/****************************************/
+void Zremote_hud_remote_hudTerminate( void )
+{
+ Zremote_hud_remote_hudState[ZREMOTE_HUD_REMOTE_HUD] = ( uint8_t )ZREMOTE_HUD_REMOTE_HUDTERMINATE;
+}
+
diff --git a/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud.h b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud.h
new file mode 100755
index 0000000..dd37968
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud.h
@@ -0,0 +1,41 @@
+/************************************************************/
+/* Zremote_hud_remote_hud.h */
+/* remote_hud State transition model header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZREMOTE_HUD_REMOTE_HUD_H
+#define ZHEADER_ZREMOTE_HUD_REMOTE_HUD_H
+
+/*State management variable access define*/
+#define ZREMOTE_HUD_REMOTE_HUD ( 0U )
+#define ZREMOTE_HUD_REMOTE_HUDS0 ( 0U )
+#define ZREMOTE_HUD_REMOTE_HUDS1 ( 1U )
+#define ZREMOTE_HUD_REMOTE_HUDSTATENOMAX ( 1U )
+
+/*End state define*/
+#define ZREMOTE_HUD_REMOTE_HUDEND ( 2U )
+/*Terminate state define*/
+#define ZREMOTE_HUD_REMOTE_HUDTERMINATE ( ZREMOTE_HUD_REMOTE_HUDEND + 1U )
+
+/*State no define*/
+#define ZREMOTE_HUD_REMOTE_HUDS0STATENO ( 0U )
+#define ZREMOTE_HUD_REMOTE_HUDS1STATENO ( 1U )
+
+/*State serial no define*/
+#define ZREMOTE_HUD_REMOTE_HUDS0STATESERIALNO ( 0U )
+#define ZREMOTE_HUD_REMOTE_HUDS1STATESERIALNO ( 1U )
+
+/*Event no define*/
+#define ZREMOTE_HUD_REMOTE_HUDE0EVENTNO ( 0U )
+#define ZREMOTE_HUD_REMOTE_HUDE1EVENTNO ( 1U )
+
+/*Event serial no define*/
+#define ZREMOTE_HUD_REMOTE_HUDE0EVENTSERIALNO ( 0U )
+#define ZREMOTE_HUD_REMOTE_HUDE1EVENTSERIALNO ( 1U )
+
+/*Extern function*/
+extern void stm_rmt_hud_event_call( void );
+extern void stm_rmt_hud_initialize( void );
+extern void Zremote_hud_remote_hudTerminate( void );
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud_func.c b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud_func.c
new file mode 100755
index 0000000..9a1c17f
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud_func.c
@@ -0,0 +1,50 @@
+/************************************************************/
+/* Zremote_hud_remote_hud_func.c */
+/* Function and variable source file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../../../ZST_include.h"
+
+/*************************************************************
+ Function definition
+*************************************************************/
+
+/**
+ * stm_rmt_hud_initialize_variable
+ */
+void stm_rmt_hud_initialize_variable() {
+ g_stm_prv_state.layer[StmLayerNoRemoteHUD].state = StmLayoutNoNone;
+ g_stm_prv_state.layer[StmLayerNoRemoteHUD].changed = STM_FALSE;
+
+ g_stm_crr_state.layer[StmLayerNoRemoteHUD].state = StmLayoutNoNone;
+ g_stm_crr_state.layer[StmLayerNoRemoteHUD].changed = STM_FALSE;
+}
+
+/**
+ * stm_remote_hud_start_stm
+ */
+void stm_remote_hud_start_stm() {
+ if (g_stm_event == StmEvtNoUndo) {
+ // nop
+ }
+ else {
+ g_stm_prv_state.layer[StmLayerNoRemoteHUD].state = g_stm_crr_state.layer[StmLayerNoRemoteHUD].state;
+ }
+ g_stm_crr_state.layer[StmLayerNoRemoteHUD].changed = STM_FALSE;
+}
+
+/**
+ * stm_remote_hud_start_activity_none
+ */
+void stm_remote_hud_start_activity_none() {
+ g_stm_crr_state.layer[StmLayerNoRemoteHUD].state = StmLayoutNoNone;
+ g_stm_crr_state.layer[StmLayerNoRemoteHUD].changed = STM_TRUE;
+}
+
+/**
+ * stm_remote_hud_start_activity_general
+ */
+void stm_remote_hud_start_activity_general(){
+ g_stm_crr_state.layer[StmLayerNoRemoteHUD].state = StmLayoutNoGenNml;
+ g_stm_crr_state.layer[StmLayerNoRemoteHUD].changed = STM_TRUE;
+}
diff --git a/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud_func.h b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud_func.h
new file mode 100755
index 0000000..1de83f4
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud/Zremote_hud_remote_hud_func.h
@@ -0,0 +1,14 @@
+/************************************************************/
+/* Zremote_hud_remote_hud_func.h */
+/* Function and variable header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZREMOTE_HUD_REMOTE_HUD_FUNC_H
+#define ZHEADER_ZREMOTE_HUD_REMOTE_HUD_FUNC_H
+
+extern void stm_rmt_hud_initialize_variable();
+extern void stm_remote_hud_start_stm();
+extern void stm_remote_hud_start_activity_none();
+extern void stm_remote_hud_start_activity_general();
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left.c b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left.c
new file mode 100755
index 0000000..32c5041
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left.c
@@ -0,0 +1,179 @@
+/************************************************************/
+/* Zremote_hud_upper_left_remote_hud_up_left.c */
+/* remote_hud_up_left State transition model source file*/
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../../../ZST_include.h"
+
+/* State management variable */
+static uint8_t Zremote_hud_upper_left_remote_hud_up_leftState[ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTSTATENOMAX];
+
+static void Zremote_hud_upper_left_remote_hud_up_lefts0e0( void );
+static void Zremote_hud_upper_left_remote_hud_up_lefts1e0( void );
+static void Zremote_hud_upper_left_remote_hud_up_lefts1e1( void );
+static void Zremote_hud_upper_left_remote_hud_up_lefts0Event( void );
+static void Zremote_hud_upper_left_remote_hud_up_lefts1Event( void );
+
+/****************************************/
+/* Action function */
+/* STM : remote_hud_up_left */
+/* State : none( No 0 ) */
+/* Event : ara_upper_left( No 0 ) */
+/****************************************/
+static void Zremote_hud_upper_left_remote_hud_up_lefts0e0( void )
+{
+ Zremote_hud_upper_left_remote_hud_up_leftState[ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFT] = ( uint8_t )ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTS1;
+ stm_remote_hud_up_left_start_activity_upper_left();
+}
+
+/****************************************/
+/* Action function */
+/* STM : remote_hud_up_left */
+/* State : upper_left( No 1 ) */
+/* Event : ara_upper_left( No 0 ) */
+/****************************************/
+static void Zremote_hud_upper_left_remote_hud_up_lefts1e0( void )
+{
+ stm_remote_hud_up_left_start_activity_upper_left();
+}
+
+/****************************************/
+/* Action function */
+/* STM : remote_hud_up_left */
+/* State : upper_left( No 1 ) */
+/* Event : ctg_general( No 1 ) */
+/****************************************/
+static void Zremote_hud_upper_left_remote_hud_up_lefts1e1( void )
+{
+ Zremote_hud_upper_left_remote_hud_up_leftState[ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFT] = ( uint8_t )ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTS0;
+ stm_remote_hud_up_left_start_activity_none();
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : remote_hud_up_left */
+/* State : none( No 0 ) */
+/****************************************/
+static void Zremote_hud_upper_left_remote_hud_up_lefts0Event( void )
+{
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_general*/
+ if( g_stm_category == StmCtgNoGeneral )
+ {
+ /*ara_upper_left*/
+ if( g_stm_area == StmAreaNoUpperLeft )
+ {
+ Zremote_hud_upper_left_remote_hud_up_lefts0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : remote_hud_up_left */
+/* State : upper_left( No 1 ) */
+/****************************************/
+static void Zremote_hud_upper_left_remote_hud_up_lefts1Event( void )
+{
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_general*/
+ if( g_stm_category == StmCtgNoGeneral )
+ {
+ /*ara_upper_left*/
+ if( g_stm_area == StmAreaNoUpperLeft )
+ {
+ Zremote_hud_upper_left_remote_hud_up_lefts1e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_deactivate*/
+ else if( g_stm_event == StmEvtNoDeactivate )
+ {
+ /*ctg_general*/
+ if( g_stm_category == StmCtgNoGeneral )
+ {
+ Zremote_hud_upper_left_remote_hud_up_lefts1e1();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event call function */
+/* STM : remote_hud_up_left */
+/****************************************/
+void stm_rmt_hud_up_left_event_call( void )
+{
+ stm_remote_hud_up_left_start_stm();
+ switch( Zremote_hud_upper_left_remote_hud_up_leftState[ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFT] )
+ {
+ case ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTS0:
+ Zremote_hud_upper_left_remote_hud_up_lefts0Event();
+ break;
+ case ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTS1:
+ Zremote_hud_upper_left_remote_hud_up_lefts1Event();
+ break;
+ default:
+ /*Not accessible to this else (default).*/
+ break;
+ }
+}
+
+/****************************************/
+/* Initial function */
+/* STM : remote_hud_up_left */
+/****************************************/
+void stm_rmt_hud_up_left_initialize( void )
+{
+ Zremote_hud_upper_left_remote_hud_up_leftState[ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFT] = ( uint8_t )ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTS0;
+ stm_remote_hud_up_left_start_activity_none();
+}
+
+/****************************************/
+/* Terminate function */
+/* STM : remote_hud_up_left */
+/****************************************/
+void Zremote_hud_upper_left_remote_hud_up_leftTerminate( void )
+{
+ Zremote_hud_upper_left_remote_hud_up_leftState[ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFT] = ( uint8_t )ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTTERMINATE;
+}
+
diff --git a/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left.h b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left.h
new file mode 100755
index 0000000..815da18
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left.h
@@ -0,0 +1,41 @@
+/************************************************************/
+/* Zremote_hud_upper_left_remote_hud_up_left.h */
+/* remote_hud_up_left State transition model header file*/
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFT_H
+#define ZHEADER_ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFT_H
+
+/*State management variable access define*/
+#define ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFT ( 0U )
+#define ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTS0 ( 0U )
+#define ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTS1 ( 1U )
+#define ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTSTATENOMAX ( 1U )
+
+/*End state define*/
+#define ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTEND ( 2U )
+/*Terminate state define*/
+#define ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTTERMINATE ( ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTEND + 1U )
+
+/*State no define*/
+#define ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTS0STATENO ( 0U )
+#define ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTS1STATENO ( 1U )
+
+/*State serial no define*/
+#define ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTS0STATESERIALNO ( 0U )
+#define ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTS1STATESERIALNO ( 1U )
+
+/*Event no define*/
+#define ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTE0EVENTNO ( 0U )
+#define ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTE1EVENTNO ( 1U )
+
+/*Event serial no define*/
+#define ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTE0EVENTSERIALNO ( 0U )
+#define ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFTE1EVENTSERIALNO ( 1U )
+
+/*Extern function*/
+extern void stm_rmt_hud_up_left_event_call( void );
+extern void stm_rmt_hud_up_left_initialize( void );
+extern void Zremote_hud_upper_left_remote_hud_up_leftTerminate( void );
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left_func.c b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left_func.c
new file mode 100755
index 0000000..2ed9d3b
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left_func.c
@@ -0,0 +1,49 @@
+/************************************************************/
+/* Zremote_hud_upper_left_remote_hud_up_left_func.c */
+/* Function and variable source file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../../../ZST_include.h"
+
+/*************************************************************
+ Function definition
+*************************************************************/
+/**
+ * stm_rmt_hud_up_left_initialize_variable
+ */
+void stm_rmt_hud_up_left_initialize_variable() {
+ g_stm_prv_state.layer[StmLayerNoRemoteHUDUpperLeft].state = StmLayoutNoNone;
+ g_stm_prv_state.layer[StmLayerNoRemoteHUDUpperLeft].changed = STM_FALSE;
+
+ g_stm_crr_state.layer[StmLayerNoRemoteHUDUpperLeft].state = StmLayoutNoNone;
+ g_stm_crr_state.layer[StmLayerNoRemoteHUDUpperLeft].changed = STM_FALSE;
+}
+
+/**
+ * stm_remote_hud_up_left_start_stm
+ */
+void stm_remote_hud_up_left_start_stm() {
+ if (g_stm_event == StmEvtNoUndo) {
+ // nop
+ }
+ else {
+ g_stm_prv_state.layer[StmLayerNoRemoteHUDUpperLeft].state = g_stm_crr_state.layer[StmLayerNoRemoteHUDUpperLeft].state;
+ }
+ g_stm_crr_state.layer[StmLayerNoRemoteHUDUpperLeft].changed = STM_FALSE;
+}
+
+/**
+ * stm_remote_hud_up_left_start_activity_none
+ */
+void stm_remote_hud_up_left_start_activity_none() {
+ g_stm_crr_state.layer[StmLayerNoRemoteHUDUpperLeft].state = StmLayoutNoNone;
+ g_stm_crr_state.layer[StmLayerNoRemoteHUDUpperLeft].changed = STM_TRUE;
+}
+
+/**
+ * stm_remote_hud_up_left_start_activity_upper_left
+ */
+void stm_remote_hud_up_left_start_activity_upper_left(){
+ g_stm_crr_state.layer[StmLayerNoRemoteHUDUpperLeft].state = StmLayoutNoRmtUpLeft;
+ g_stm_crr_state.layer[StmLayerNoRemoteHUDUpperLeft].changed = STM_TRUE;
+}
diff --git a/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left_func.h b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left_func.h
new file mode 100755
index 0000000..f230d6f
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/hud/layer/remote_hud_upper_left/Zremote_hud_upper_left_remote_hud_up_left_func.h
@@ -0,0 +1,14 @@
+/************************************************************/
+/* Zremote_hud_upper_left_remote_hud_up_left_func.h */
+/* Function and variable header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFT_FUNC_H
+#define ZHEADER_ZREMOTE_HUD_UPPER_LEFT_REMOTE_HUD_UP_LEFT_FUNC_H
+
+extern void stm_rmt_hud_up_left_initialize_variable();
+extern void stm_remote_hud_up_left_start_stm();
+extern void stm_remote_hud_up_left_start_activity_none();
+extern void stm_remote_hud_up_left_start_activity_upper_left();
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/master/layer/apps/Zmaster_apps_apps_main.c b/policy_manager/stm/zipc/StateTransitionor/master/layer/apps/Zmaster_apps_apps_main.c
new file mode 100755
index 0000000..9ac17a2
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/master/layer/apps/Zmaster_apps_apps_main.c
@@ -0,0 +1,1456 @@
+/************************************************************/
+/* Zmaster_apps_apps_main.c */
+/* apps_main State transition model source file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../../../ZST_include.h"
+
+/* State management variable */
+static uint8_t Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINSTATENOMAX];
+
+static void Zmaster_apps_apps_mains0StateEntry( void );
+static void Zmaster_apps_apps_mains1StateEntry( void );
+static void Zmaster_apps_apps_mains0e1( void );
+static void Zmaster_apps_apps_mains1e0( void );
+static void Zmaster_apps_apps_car_stops0e0( void );
+static void Zmaster_apps_apps_car_stops0e2( void );
+static void Zmaster_apps_apps_car_stops0e3( void );
+static void Zmaster_apps_apps_car_stops0e4( void );
+static void Zmaster_apps_apps_car_stops0e11( void );
+static void Zmaster_apps_apps_car_stops0e15( void );
+static void Zmaster_apps_apps_car_runs0e0( void );
+static void Zmaster_apps_apps_car_runs0e3( void );
+static void Zmaster_apps_apps_mains0Event( void );
+static void Zmaster_apps_apps_car_stops0Event( void );
+static void Zmaster_apps_apps_car_stops1Event( void );
+static void Zmaster_apps_apps_car_stops2Event( void );
+static void Zmaster_apps_apps_car_stops3Event( void );
+static void Zmaster_apps_apps_car_stops4Event( void );
+static void Zmaster_apps_apps_car_stops5Event( void );
+static void Zmaster_apps_apps_mains1Event( void );
+static void Zmaster_apps_apps_car_runs0Event( void );
+static void Zmaster_apps_apps_car_runs1Event( void );
+
+/****************************************/
+/* State start activity function */
+/* STM : apps_main */
+/* State : accel_pedal_off( No 0 ) */
+/****************************************/
+static void Zmaster_apps_apps_mains0StateEntry( void )
+{
+ switch( Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINS0F] )
+ {
+ case ZMASTER_APPS_APPS_CAR_STOPS0:
+ stm_mst_apl_start_activity_none();
+ break;
+ case ZMASTER_APPS_APPS_CAR_STOPS1:
+ stm_mst_apl_start_activity_meter_receiver();
+ break;
+ case ZMASTER_APPS_APPS_CAR_STOPS2:
+ stm_mst_apl_start_activity_meter_splitable();
+ break;
+ case ZMASTER_APPS_APPS_CAR_STOPS3:
+ stm_mst_apl_start_activity_splitable_receiver();
+ break;
+ case ZMASTER_APPS_APPS_CAR_STOPS4:
+ stm_mst_apl_start_activity_splitable_split();
+ break;
+ case ZMASTER_APPS_APPS_CAR_STOPS5:
+ stm_mst_apl_start_activity_general();
+ break;
+ default:
+ /*Not accessible to this else (default).*/
+ break;
+ }
+}
+
+/****************************************/
+/* State start activity function */
+/* STM : apps_main */
+/* State : accel_pedal_on( No 1 ) */
+/****************************************/
+static void Zmaster_apps_apps_mains1StateEntry( void )
+{
+ switch( Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINS1F] )
+ {
+ case ZMASTER_APPS_APPS_CAR_RUNS0:
+ stm_mst_apl_start_activity_meter_receiver();
+ break;
+ case ZMASTER_APPS_APPS_CAR_RUNS1:
+ stm_mst_apl_start_activity_meter();
+ break;
+ default:
+ /*Not accessible to this else (default).*/
+ break;
+ }
+}
+
+/****************************************/
+/* Action function */
+/* STM : apps_main */
+/* State : accel_pedal_off( No 0 ) */
+/* Event : stt_accel_pedal_on( No 1 ) */
+/****************************************/
+static void Zmaster_apps_apps_mains0e1( void )
+{
+ Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAIN] = ( uint8_t )ZMASTER_APPS_APPS_MAINS1;
+ Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINS1F] = ( uint8_t )ZMASTER_APPS_APPS_CAR_RUNS0;
+ Zmaster_apps_apps_mains1StateEntry();
+}
+
+/****************************************/
+/* Action function */
+/* STM : apps_main */
+/* State : accel_pedal_on( No 1 ) */
+/* Event : stt_accel_pedal_off( No 0 )*/
+/****************************************/
+static void Zmaster_apps_apps_mains1e0( void )
+{
+ Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAIN] = ( uint8_t )ZMASTER_APPS_APPS_MAINS0;
+ Zmaster_apps_apps_mains0StateEntry();
+}
+
+/****************************************/
+/* Action function */
+/* STM : apps_car_stop */
+/* State : none( No 0 ) */
+/* Event : ara_split_main( No 0 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_stops0e0( void )
+{
+ Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINS0F] = ( uint8_t )ZMASTER_APPS_APPS_CAR_STOPS1;
+ stm_mst_apl_start_activity_meter_receiver();
+}
+
+/****************************************/
+/* Action function */
+/* STM : apps_car_stop */
+/* State : none( No 0 ) */
+/* Event : ara_split_main( No 2 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_stops0e2( void )
+{
+ Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINS0F] = ( uint8_t )ZMASTER_APPS_APPS_CAR_STOPS3;
+ stm_mst_apl_start_activity_splitable_receiver();
+}
+
+/****************************************/
+/* Action function */
+/* STM : apps_car_stop */
+/* State : none( No 0 ) */
+/* Event : ara_split_sub( No 3 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_stops0e3( void )
+{
+ Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINS0F] = ( uint8_t )ZMASTER_APPS_APPS_CAR_STOPS2;
+ stm_mst_apl_start_activity_meter_splitable();
+}
+
+/****************************************/
+/* Action function */
+/* STM : apps_car_stop */
+/* State : none( No 0 ) */
+/* Event : ara_normal( No 4 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_stops0e4( void )
+{
+ Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINS0F] = ( uint8_t )ZMASTER_APPS_APPS_CAR_STOPS5;
+ stm_mst_apl_start_activity_general();
+}
+
+/****************************************/
+/* Action function */
+/* STM : apps_car_stop */
+/* State : none( No 0 ) */
+/* Event : stt_prv_layer_apps_none( No 11 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_stops0e11( void )
+{
+ Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINS0F] = ( uint8_t )ZMASTER_APPS_APPS_CAR_STOPS0;
+ stm_mst_apl_start_activity_none();
+}
+
+/****************************************/
+/* Action function */
+/* STM : apps_car_stop */
+/* State : none( No 0 ) */
+/* Event : stt_prv_layer_apps_splitable_split( No 15 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_stops0e15( void )
+{
+ Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINS0F] = ( uint8_t )ZMASTER_APPS_APPS_CAR_STOPS4;
+ stm_mst_apl_start_activity_splitable_split();
+}
+
+/****************************************/
+/* Action function */
+/* STM : apps_car_run */
+/* State : meter_receiver( No 0 ) */
+/* Event : ara_normal( No 0 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_runs0e0( void )
+{
+ Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINS1F] = ( uint8_t )ZMASTER_APPS_APPS_CAR_RUNS1;
+ stm_mst_apl_start_activity_meter();
+}
+
+/****************************************/
+/* Action function */
+/* STM : apps_car_run */
+/* State : meter_receiver( No 0 ) */
+/* Event : stt_prv_layer_apps_meter_receiver( No 3 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_runs0e3( void )
+{
+ Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINS1F] = ( uint8_t )ZMASTER_APPS_APPS_CAR_RUNS0;
+ stm_mst_apl_start_activity_meter_receiver();
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : apps_main */
+/* State : accel_pedal_off( No 0 ) */
+/****************************************/
+static void Zmaster_apps_apps_mains0Event( void )
+{
+ /*stt_accel_pedal_on*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOn )
+ {
+ stm_mst_apl_event_lightstatus_brake_off();
+ Zmaster_apps_apps_mains0e1();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : apps_car_stop */
+/* State : none( No 0 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_stops0Event( void )
+{
+ /*stt_accel_pedal_off*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOff )
+ {
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_meter*/
+ if( g_stm_category == StmCtgNoMeter )
+ {
+ /*ara_split_main*/
+ if( g_stm_area == StmAreaNoSplitMain )
+ {
+ Zmaster_apps_apps_car_stops0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_receiver*/
+ else if( g_stm_category == StmCtgNoReceiver )
+ {
+ /*ara_split_sub*/
+ if( g_stm_area == StmAreaNoSplitSub )
+ {
+ Zmaster_apps_apps_car_stops0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_splitable_main*/
+ else if( g_stm_category == StmCtgNoSplitableMain )
+ {
+ /*ara_split_main*/
+ if( g_stm_area == StmAreaNoSplitMain )
+ {
+ Zmaster_apps_apps_car_stops0e2();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_splitable_sub*/
+ else if( g_stm_category == StmCtgNoSplitableSub )
+ {
+ /*ara_split_sub*/
+ if( g_stm_area == StmAreaNoSplitSub )
+ {
+ Zmaster_apps_apps_car_stops0e3();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_general*/
+ else if( g_stm_category == StmCtgNoGeneral )
+ {
+ /*ara_normal*/
+ if( g_stm_area == StmAreaNoNormal )
+ {
+ Zmaster_apps_apps_car_stops0e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_undo*/
+ else if( g_stm_event == StmEvtNoUndo )
+ {
+ /*stt_prv_layer_apps_none*/
+ if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoNone )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ /*stt_prv_layer_apps_meter_receiver*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrRcv )
+ {
+ Zmaster_apps_apps_car_stops0e0();
+ }
+ /*stt_prv_layer_apps_meter_splitable*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrSpl )
+ {
+ Zmaster_apps_apps_car_stops0e3();
+ }
+ /*stt_prv_layer_apps_splitable_receiver*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoSplRcv )
+ {
+ Zmaster_apps_apps_car_stops0e2();
+ }
+ /*stt_prv_layer_apps_splitable_split*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoSplSpl )
+ {
+ Zmaster_apps_apps_car_stops0e15();
+ }
+ /*stt_prv_layer_apps_gen_nml*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoGenNml )
+ {
+ Zmaster_apps_apps_car_stops0e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : apps_car_stop */
+/* State : meter_receiver( No 1 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_stops1Event( void )
+{
+ /*stt_accel_pedal_off*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOff )
+ {
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_splitable_main*/
+ if( g_stm_category == StmCtgNoSplitableMain )
+ {
+ /*ara_split_main*/
+ if( g_stm_area == StmAreaNoSplitMain )
+ {
+ Zmaster_apps_apps_car_stops0e2();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_splitable_sub*/
+ else if( g_stm_category == StmCtgNoSplitableSub )
+ {
+ /*ara_split_sub*/
+ if( g_stm_area == StmAreaNoSplitSub )
+ {
+ Zmaster_apps_apps_car_stops0e3();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_general*/
+ else if( g_stm_category == StmCtgNoGeneral )
+ {
+ /*ara_normal*/
+ if( g_stm_area == StmAreaNoNormal )
+ {
+ Zmaster_apps_apps_car_stops0e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_homescreen*/
+ else if( g_stm_category == StmCtgNoHomescreen )
+ {
+ /*ara_fullscreen*/
+ if( g_stm_area == StmAreaNoFullscreen )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_deactivate*/
+ else if( g_stm_event == StmEvtNoDeactivate )
+ {
+ /*ctg_meter*/
+ if( g_stm_category == StmCtgNoMeter )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ /*ctg_receiver*/
+ else if( g_stm_category == StmCtgNoReceiver )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_undo*/
+ else if( g_stm_event == StmEvtNoUndo )
+ {
+ /*stt_prv_layer_apps_none*/
+ if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoNone )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ /*stt_prv_layer_apps_meter_receiver*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrRcv )
+ {
+ Zmaster_apps_apps_car_stops0e0();
+ }
+ /*stt_prv_layer_apps_meter_splitable*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrSpl )
+ {
+ Zmaster_apps_apps_car_stops0e3();
+ }
+ /*stt_prv_layer_apps_splitable_receiver*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoSplRcv )
+ {
+ Zmaster_apps_apps_car_stops0e2();
+ }
+ /*stt_prv_layer_apps_splitable_split*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoSplSpl )
+ {
+ Zmaster_apps_apps_car_stops0e15();
+ }
+ /*stt_prv_layer_apps_gen_nml*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoGenNml )
+ {
+ Zmaster_apps_apps_car_stops0e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : apps_car_stop */
+/* State : meter_splitable( No 2 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_stops2Event( void )
+{
+ /*stt_accel_pedal_off*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOff )
+ {
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_receiver*/
+ if( g_stm_category == StmCtgNoReceiver )
+ {
+ /*ara_split_sub*/
+ if( g_stm_area == StmAreaNoSplitSub )
+ {
+ Zmaster_apps_apps_car_stops0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_splitable_main*/
+ else if( g_stm_category == StmCtgNoSplitableMain )
+ {
+ /*ara_split_main*/
+ if( g_stm_area == StmAreaNoSplitMain )
+ {
+ Zmaster_apps_apps_car_stops0e15();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_splitable_sub*/
+ else if( g_stm_category == StmCtgNoSplitableSub )
+ {
+ /*ara_split_sub*/
+ if( g_stm_area == StmAreaNoSplitSub )
+ {
+ Zmaster_apps_apps_car_stops0e3();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_general*/
+ else if( g_stm_category == StmCtgNoGeneral )
+ {
+ /*ara_normal*/
+ if( g_stm_area == StmAreaNoNormal )
+ {
+ Zmaster_apps_apps_car_stops0e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_homescreen*/
+ else if( g_stm_category == StmCtgNoHomescreen )
+ {
+ /*ara_fullscreen*/
+ if( g_stm_area == StmAreaNoFullscreen )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_deactivate*/
+ else if( g_stm_event == StmEvtNoDeactivate )
+ {
+ /*ctg_meter*/
+ if( g_stm_category == StmCtgNoMeter )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ /*ctg_splitable_sub*/
+ else if( g_stm_category == StmCtgNoSplitableSub )
+ {
+ /*ara_split_sub*/
+ if( g_stm_area == StmAreaNoSplitSub )
+ {
+ Zmaster_apps_apps_car_stops0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_undo*/
+ else if( g_stm_event == StmEvtNoUndo )
+ {
+ /*stt_prv_layer_apps_none*/
+ if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoNone )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ /*stt_prv_layer_apps_meter_receiver*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrRcv )
+ {
+ Zmaster_apps_apps_car_stops0e0();
+ }
+ /*stt_prv_layer_apps_meter_splitable*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrSpl )
+ {
+ Zmaster_apps_apps_car_stops0e3();
+ }
+ /*stt_prv_layer_apps_splitable_receiver*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoSplRcv )
+ {
+ Zmaster_apps_apps_car_stops0e2();
+ }
+ /*stt_prv_layer_apps_splitable_split*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoSplSpl )
+ {
+ Zmaster_apps_apps_car_stops0e15();
+ }
+ /*stt_prv_layer_apps_gen_nml*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoGenNml )
+ {
+ Zmaster_apps_apps_car_stops0e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : apps_car_stop */
+/* State : splitable_receiver( No 3 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_stops3Event( void )
+{
+ /*stt_accel_pedal_off*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOff )
+ {
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_meter*/
+ if( g_stm_category == StmCtgNoMeter )
+ {
+ /*ara_split_main*/
+ if( g_stm_area == StmAreaNoSplitMain )
+ {
+ Zmaster_apps_apps_car_stops0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_splitable_main*/
+ else if( g_stm_category == StmCtgNoSplitableMain )
+ {
+ /*ara_split_main*/
+ if( g_stm_area == StmAreaNoSplitMain )
+ {
+ Zmaster_apps_apps_car_stops0e2();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_splitable_sub*/
+ else if( g_stm_category == StmCtgNoSplitableSub )
+ {
+ /*ara_split_sub*/
+ if( g_stm_area == StmAreaNoSplitSub )
+ {
+ Zmaster_apps_apps_car_stops0e15();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_general*/
+ else if( g_stm_category == StmCtgNoGeneral )
+ {
+ /*ara_normal*/
+ if( g_stm_area == StmAreaNoNormal )
+ {
+ Zmaster_apps_apps_car_stops0e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_homescreen*/
+ else if( g_stm_category == StmCtgNoHomescreen )
+ {
+ /*ara_fullscreen*/
+ if( g_stm_area == StmAreaNoFullscreen )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_deactivate*/
+ else if( g_stm_event == StmEvtNoDeactivate )
+ {
+ /*ctg_receiver*/
+ if( g_stm_category == StmCtgNoReceiver )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ /*ctg_splitable_main*/
+ else if( g_stm_category == StmCtgNoSplitableMain )
+ {
+ /*ara_split_main*/
+ if( g_stm_area == StmAreaNoSplitMain )
+ {
+ Zmaster_apps_apps_car_stops0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_undo*/
+ else if( g_stm_event == StmEvtNoUndo )
+ {
+ /*stt_prv_layer_apps_none*/
+ if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoNone )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ /*stt_prv_layer_apps_meter_receiver*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrRcv )
+ {
+ Zmaster_apps_apps_car_stops0e0();
+ }
+ /*stt_prv_layer_apps_meter_splitable*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrSpl )
+ {
+ Zmaster_apps_apps_car_stops0e3();
+ }
+ /*stt_prv_layer_apps_splitable_receiver*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoSplRcv )
+ {
+ Zmaster_apps_apps_car_stops0e2();
+ }
+ /*stt_prv_layer_apps_splitable_split*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoSplSpl )
+ {
+ Zmaster_apps_apps_car_stops0e15();
+ }
+ /*stt_prv_layer_apps_gen_nml*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoGenNml )
+ {
+ Zmaster_apps_apps_car_stops0e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : apps_car_stop */
+/* State : splitable_split( No 4 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_stops4Event( void )
+{
+ /*stt_accel_pedal_off*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOff )
+ {
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_meter*/
+ if( g_stm_category == StmCtgNoMeter )
+ {
+ /*ara_split_main*/
+ if( g_stm_area == StmAreaNoSplitMain )
+ {
+ Zmaster_apps_apps_car_stops0e3();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_receiver*/
+ else if( g_stm_category == StmCtgNoReceiver )
+ {
+ /*ara_split_sub*/
+ if( g_stm_area == StmAreaNoSplitSub )
+ {
+ Zmaster_apps_apps_car_stops0e2();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_splitable_main*/
+ else if( g_stm_category == StmCtgNoSplitableMain )
+ {
+ /*ara_split_main*/
+ if( g_stm_area == StmAreaNoSplitMain )
+ {
+ Zmaster_apps_apps_car_stops0e15();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_splitable_sub*/
+ else if( g_stm_category == StmCtgNoSplitableSub )
+ {
+ /*ara_split_sub*/
+ if( g_stm_area == StmAreaNoSplitSub )
+ {
+ Zmaster_apps_apps_car_stops0e15();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_general*/
+ else if( g_stm_category == StmCtgNoGeneral )
+ {
+ /*ara_normal*/
+ if( g_stm_area == StmAreaNoNormal )
+ {
+ Zmaster_apps_apps_car_stops0e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_homescreen*/
+ else if( g_stm_category == StmCtgNoHomescreen )
+ {
+ /*ara_fullscreen*/
+ if( g_stm_area == StmAreaNoFullscreen )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_deactivate*/
+ else if( g_stm_event == StmEvtNoDeactivate )
+ {
+ /*ctg_splitable_main*/
+ if( g_stm_category == StmCtgNoSplitableMain )
+ {
+ /*ara_split_main*/
+ if( g_stm_area == StmAreaNoSplitMain )
+ {
+ Zmaster_apps_apps_car_stops0e3();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_splitable_sub*/
+ else if( g_stm_category == StmCtgNoSplitableSub )
+ {
+ /*ara_split_sub*/
+ if( g_stm_area == StmAreaNoSplitSub )
+ {
+ Zmaster_apps_apps_car_stops0e2();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_undo*/
+ else if( g_stm_event == StmEvtNoUndo )
+ {
+ /*stt_prv_layer_apps_none*/
+ if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoNone )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ /*stt_prv_layer_apps_meter_receiver*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrRcv )
+ {
+ Zmaster_apps_apps_car_stops0e0();
+ }
+ /*stt_prv_layer_apps_meter_splitable*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrSpl )
+ {
+ Zmaster_apps_apps_car_stops0e3();
+ }
+ /*stt_prv_layer_apps_splitable_receiver*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoSplRcv )
+ {
+ Zmaster_apps_apps_car_stops0e2();
+ }
+ /*stt_prv_layer_apps_splitable_split*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoSplSpl )
+ {
+ Zmaster_apps_apps_car_stops0e15();
+ }
+ /*stt_prv_layer_apps_gen_nml*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoGenNml )
+ {
+ Zmaster_apps_apps_car_stops0e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : apps_car_stop */
+/* State : general( No 5 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_stops5Event( void )
+{
+ /*stt_accel_pedal_off*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOff )
+ {
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_meter*/
+ if( g_stm_category == StmCtgNoMeter )
+ {
+ /*ara_split_main*/
+ if( g_stm_area == StmAreaNoSplitMain )
+ {
+ Zmaster_apps_apps_car_stops0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_receiver*/
+ else if( g_stm_category == StmCtgNoReceiver )
+ {
+ /*ara_split_sub*/
+ if( g_stm_area == StmAreaNoSplitSub )
+ {
+ Zmaster_apps_apps_car_stops0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_splitable_main*/
+ else if( g_stm_category == StmCtgNoSplitableMain )
+ {
+ /*ara_split_main*/
+ if( g_stm_area == StmAreaNoSplitMain )
+ {
+ Zmaster_apps_apps_car_stops0e2();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_splitable_sub*/
+ else if( g_stm_category == StmCtgNoSplitableSub )
+ {
+ /*ara_split_sub*/
+ if( g_stm_area == StmAreaNoSplitSub )
+ {
+ Zmaster_apps_apps_car_stops0e3();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_general*/
+ else if( g_stm_category == StmCtgNoGeneral )
+ {
+ /*ara_normal*/
+ if( g_stm_area == StmAreaNoNormal )
+ {
+ Zmaster_apps_apps_car_stops0e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_homescreen*/
+ else if( g_stm_category == StmCtgNoHomescreen )
+ {
+ /*ara_fullscreen*/
+ if( g_stm_area == StmAreaNoFullscreen )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_deactivate*/
+ else if( g_stm_event == StmEvtNoDeactivate )
+ {
+ /*ctg_general*/
+ if( g_stm_category == StmCtgNoGeneral )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_undo*/
+ else if( g_stm_event == StmEvtNoUndo )
+ {
+ /*stt_prv_layer_apps_none*/
+ if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoNone )
+ {
+ Zmaster_apps_apps_car_stops0e11();
+ }
+ /*stt_prv_layer_apps_meter_receiver*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrRcv )
+ {
+ Zmaster_apps_apps_car_stops0e0();
+ }
+ /*stt_prv_layer_apps_meter_splitable*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrSpl )
+ {
+ Zmaster_apps_apps_car_stops0e3();
+ }
+ /*stt_prv_layer_apps_splitable_receiver*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoSplRcv )
+ {
+ Zmaster_apps_apps_car_stops0e2();
+ }
+ /*stt_prv_layer_apps_splitable_split*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoSplSpl )
+ {
+ Zmaster_apps_apps_car_stops0e15();
+ }
+ /*stt_prv_layer_apps_gen_nml*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoGenNml )
+ {
+ Zmaster_apps_apps_car_stops0e4();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : apps_main */
+/* State : accel_pedal_on( No 1 ) */
+/****************************************/
+static void Zmaster_apps_apps_mains1Event( void )
+{
+ /*stt_accel_pedal_off*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOff )
+ {
+ stm_mst_apl_event_lightstatus_brake_on();
+ Zmaster_apps_apps_mains1e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : apps_car_run */
+/* State : meter_receiver( No 0 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_runs0Event( void )
+{
+ /*stt_accel_pedal_on*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOn )
+ {
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_meter*/
+ if( g_stm_category == StmCtgNoMeter )
+ {
+ /*ara_normal*/
+ if( g_stm_area == StmAreaNoNormal )
+ {
+ Zmaster_apps_apps_car_runs0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_undo*/
+ else if( g_stm_event == StmEvtNoUndo )
+ {
+ /*stt_prv_layer_apps_meter_receiver*/
+ if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrRcv )
+ {
+ Zmaster_apps_apps_car_runs0e3();
+ }
+ /*stt_prv_layer_apps_meter*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrNml )
+ {
+ Zmaster_apps_apps_car_runs0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : apps_car_run */
+/* State : meter( No 1 ) */
+/****************************************/
+static void Zmaster_apps_apps_car_runs1Event( void )
+{
+ /*stt_accel_pedal_on*/
+ if( g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state == StmAccelPedalSttNoOn )
+ {
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_meter*/
+ if( g_stm_category == StmCtgNoMeter )
+ {
+ /*ara_split_main*/
+ if( g_stm_area == StmAreaNoSplitMain )
+ {
+ Zmaster_apps_apps_car_runs0e3();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*ctg_receiver*/
+ else if( g_stm_category == StmCtgNoReceiver )
+ {
+ /*ara_split_sub*/
+ if( g_stm_area == StmAreaNoSplitSub )
+ {
+ Zmaster_apps_apps_car_runs0e3();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_undo*/
+ else if( g_stm_event == StmEvtNoUndo )
+ {
+ /*stt_prv_layer_apps_meter_receiver*/
+ if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrRcv )
+ {
+ Zmaster_apps_apps_car_runs0e3();
+ }
+ /*stt_prv_layer_apps_meter*/
+ else if( g_stm_prv_state.layer[StmLayerNoApps].state == StmLayoutNoMtrNml )
+ {
+ Zmaster_apps_apps_car_runs0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event call function */
+/* STM : apps_main */
+/****************************************/
+void stm_master_apl_event_call( void )
+{
+ stm_mst_apl_start_stm();
+ switch( Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAIN] )
+ {
+ case ZMASTER_APPS_APPS_MAINS0:
+ switch( Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINS0F] )
+ {
+ case ZMASTER_APPS_APPS_CAR_STOPS0:
+ Zmaster_apps_apps_car_stops0Event();
+ break;
+ case ZMASTER_APPS_APPS_CAR_STOPS1:
+ Zmaster_apps_apps_car_stops1Event();
+ break;
+ case ZMASTER_APPS_APPS_CAR_STOPS2:
+ Zmaster_apps_apps_car_stops2Event();
+ break;
+ case ZMASTER_APPS_APPS_CAR_STOPS3:
+ Zmaster_apps_apps_car_stops3Event();
+ break;
+ case ZMASTER_APPS_APPS_CAR_STOPS4:
+ Zmaster_apps_apps_car_stops4Event();
+ break;
+ case ZMASTER_APPS_APPS_CAR_STOPS5:
+ Zmaster_apps_apps_car_stops5Event();
+ break;
+ default:
+ /*Not accessible to this else (default).*/
+ break;
+ }
+ Zmaster_apps_apps_mains0Event();
+ break;
+ case ZMASTER_APPS_APPS_MAINS1:
+ switch( Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINS1F] )
+ {
+ case ZMASTER_APPS_APPS_CAR_RUNS0:
+ Zmaster_apps_apps_car_runs0Event();
+ break;
+ case ZMASTER_APPS_APPS_CAR_RUNS1:
+ Zmaster_apps_apps_car_runs1Event();
+ break;
+ default:
+ /*Not accessible to this else (default).*/
+ break;
+ }
+ Zmaster_apps_apps_mains1Event();
+ break;
+ default:
+ /*Not accessible to this else (default).*/
+ break;
+ }
+}
+
+/****************************************/
+/* Initial function */
+/* STM : apps_main */
+/****************************************/
+void stm_master_apl_initialize( void )
+{
+ Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAIN] = ( uint8_t )ZMASTER_APPS_APPS_MAINS0;
+ Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINS0F] = ( uint8_t )ZMASTER_APPS_APPS_CAR_STOPS0;
+ Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAINS1F] = ( uint8_t )ZMASTER_APPS_APPS_CAR_RUNS0;
+ Zmaster_apps_apps_mains0StateEntry();
+}
+
+/****************************************/
+/* Terminate function */
+/* STM : apps_main */
+/****************************************/
+void Zmaster_apps_apps_mainTerminate( void )
+{
+ Zmaster_apps_apps_mainState[ZMASTER_APPS_APPS_MAIN] = ( uint8_t )ZMASTER_APPS_APPS_MAINTERMINATE;
+}
+
diff --git a/policy_manager/stm/zipc/StateTransitionor/master/layer/apps/Zmaster_apps_apps_main.h b/policy_manager/stm/zipc/StateTransitionor/master/layer/apps/Zmaster_apps_apps_main.h
new file mode 100755
index 0000000..fba3224
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/master/layer/apps/Zmaster_apps_apps_main.h
@@ -0,0 +1,111 @@
+/************************************************************/
+/* Zmaster_apps_apps_main.h */
+/* apps_main State transition model header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZMASTER_APPS_APPS_MAIN_H
+#define ZHEADER_ZMASTER_APPS_APPS_MAIN_H
+
+/*State management variable access define*/
+#define ZMASTER_APPS_APPS_MAIN ( 0U )
+#define ZMASTER_APPS_APPS_MAINS0F ( 1U )
+#define ZMASTER_APPS_APPS_MAINS1F ( 2U )
+#define ZMASTER_APPS_APPS_MAINS0 ( 0U )
+#define ZMASTER_APPS_APPS_CAR_STOPS0 ( 0U )
+#define ZMASTER_APPS_APPS_CAR_STOPS1 ( 1U )
+#define ZMASTER_APPS_APPS_CAR_STOPS2 ( 2U )
+#define ZMASTER_APPS_APPS_CAR_STOPS3 ( 3U )
+#define ZMASTER_APPS_APPS_CAR_STOPS4 ( 4U )
+#define ZMASTER_APPS_APPS_CAR_STOPS5 ( 5U )
+#define ZMASTER_APPS_APPS_MAINS1 ( 1U )
+#define ZMASTER_APPS_APPS_CAR_RUNS0 ( 0U )
+#define ZMASTER_APPS_APPS_CAR_RUNS1 ( 1U )
+#define ZMASTER_APPS_APPS_MAINSTATENOMAX ( 3U )
+
+/*End state define*/
+#define ZMASTER_APPS_APPS_MAINEND ( 6U )
+/*Terminate state define*/
+#define ZMASTER_APPS_APPS_MAINTERMINATE ( ZMASTER_APPS_APPS_MAINEND + 1U )
+
+/*State no define*/
+#define ZMASTER_APPS_APPS_MAINS0STATENO ( 0U )
+#define ZMASTER_APPS_APPS_CAR_STOPS0STATENO ( 0U )
+#define ZMASTER_APPS_APPS_CAR_STOPS1STATENO ( 1U )
+#define ZMASTER_APPS_APPS_CAR_STOPS2STATENO ( 2U )
+#define ZMASTER_APPS_APPS_CAR_STOPS3STATENO ( 3U )
+#define ZMASTER_APPS_APPS_CAR_STOPS4STATENO ( 4U )
+#define ZMASTER_APPS_APPS_CAR_STOPS5STATENO ( 5U )
+#define ZMASTER_APPS_APPS_MAINS1STATENO ( 1U )
+#define ZMASTER_APPS_APPS_CAR_RUNS0STATENO ( 0U )
+#define ZMASTER_APPS_APPS_CAR_RUNS1STATENO ( 1U )
+
+/*State serial no define*/
+#define ZMASTER_APPS_APPS_MAINS0STATESERIALNO ( 0U )
+#define ZMASTER_APPS_APPS_CAR_STOPS0STATESERIALNO ( 1U )
+#define ZMASTER_APPS_APPS_CAR_STOPS1STATESERIALNO ( 2U )
+#define ZMASTER_APPS_APPS_CAR_STOPS2STATESERIALNO ( 3U )
+#define ZMASTER_APPS_APPS_CAR_STOPS3STATESERIALNO ( 4U )
+#define ZMASTER_APPS_APPS_CAR_STOPS4STATESERIALNO ( 5U )
+#define ZMASTER_APPS_APPS_CAR_STOPS5STATESERIALNO ( 6U )
+#define ZMASTER_APPS_APPS_MAINS1STATESERIALNO ( 7U )
+#define ZMASTER_APPS_APPS_CAR_RUNS0STATESERIALNO ( 8U )
+#define ZMASTER_APPS_APPS_CAR_RUNS1STATESERIALNO ( 9U )
+
+/*Event no define*/
+#define ZMASTER_APPS_APPS_MAINE0EVENTNO ( 0U )
+#define ZMASTER_APPS_APPS_MAINE1EVENTNO ( 1U )
+#define ZMASTER_APPS_APPS_CAR_STOPE0EVENTNO ( 0U )
+#define ZMASTER_APPS_APPS_CAR_STOPE1EVENTNO ( 1U )
+#define ZMASTER_APPS_APPS_CAR_STOPE2EVENTNO ( 2U )
+#define ZMASTER_APPS_APPS_CAR_STOPE3EVENTNO ( 3U )
+#define ZMASTER_APPS_APPS_CAR_STOPE4EVENTNO ( 4U )
+#define ZMASTER_APPS_APPS_CAR_STOPE5EVENTNO ( 5U )
+#define ZMASTER_APPS_APPS_CAR_STOPE6EVENTNO ( 6U )
+#define ZMASTER_APPS_APPS_CAR_STOPE7EVENTNO ( 7U )
+#define ZMASTER_APPS_APPS_CAR_STOPE8EVENTNO ( 8U )
+#define ZMASTER_APPS_APPS_CAR_STOPE9EVENTNO ( 9U )
+#define ZMASTER_APPS_APPS_CAR_STOPE10EVENTNO ( 10U )
+#define ZMASTER_APPS_APPS_CAR_STOPE11EVENTNO ( 11U )
+#define ZMASTER_APPS_APPS_CAR_STOPE12EVENTNO ( 12U )
+#define ZMASTER_APPS_APPS_CAR_STOPE13EVENTNO ( 13U )
+#define ZMASTER_APPS_APPS_CAR_STOPE14EVENTNO ( 14U )
+#define ZMASTER_APPS_APPS_CAR_STOPE15EVENTNO ( 15U )
+#define ZMASTER_APPS_APPS_CAR_STOPE16EVENTNO ( 16U )
+#define ZMASTER_APPS_APPS_CAR_RUNE0EVENTNO ( 0U )
+#define ZMASTER_APPS_APPS_CAR_RUNE1EVENTNO ( 1U )
+#define ZMASTER_APPS_APPS_CAR_RUNE2EVENTNO ( 2U )
+#define ZMASTER_APPS_APPS_CAR_RUNE3EVENTNO ( 3U )
+#define ZMASTER_APPS_APPS_CAR_RUNE4EVENTNO ( 4U )
+
+/*Event serial no define*/
+#define ZMASTER_APPS_APPS_MAINE0EVENTSERIALNO ( 0U )
+#define ZMASTER_APPS_APPS_MAINE1EVENTSERIALNO ( 1U )
+#define ZMASTER_APPS_APPS_CAR_STOPE0EVENTNO ( 0U )
+#define ZMASTER_APPS_APPS_CAR_STOPE1EVENTNO ( 1U )
+#define ZMASTER_APPS_APPS_CAR_STOPE2EVENTNO ( 2U )
+#define ZMASTER_APPS_APPS_CAR_STOPE3EVENTNO ( 3U )
+#define ZMASTER_APPS_APPS_CAR_STOPE4EVENTNO ( 4U )
+#define ZMASTER_APPS_APPS_CAR_STOPE5EVENTNO ( 5U )
+#define ZMASTER_APPS_APPS_CAR_STOPE6EVENTNO ( 6U )
+#define ZMASTER_APPS_APPS_CAR_STOPE7EVENTNO ( 7U )
+#define ZMASTER_APPS_APPS_CAR_STOPE8EVENTNO ( 8U )
+#define ZMASTER_APPS_APPS_CAR_STOPE9EVENTNO ( 9U )
+#define ZMASTER_APPS_APPS_CAR_STOPE10EVENTNO ( 10U )
+#define ZMASTER_APPS_APPS_CAR_STOPE11EVENTNO ( 11U )
+#define ZMASTER_APPS_APPS_CAR_STOPE12EVENTNO ( 12U )
+#define ZMASTER_APPS_APPS_CAR_STOPE13EVENTNO ( 13U )
+#define ZMASTER_APPS_APPS_CAR_STOPE14EVENTNO ( 14U )
+#define ZMASTER_APPS_APPS_CAR_STOPE15EVENTNO ( 15U )
+#define ZMASTER_APPS_APPS_CAR_STOPE16EVENTNO ( 16U )
+#define ZMASTER_APPS_APPS_CAR_RUNE0EVENTNO ( 0U )
+#define ZMASTER_APPS_APPS_CAR_RUNE1EVENTNO ( 1U )
+#define ZMASTER_APPS_APPS_CAR_RUNE2EVENTNO ( 2U )
+#define ZMASTER_APPS_APPS_CAR_RUNE3EVENTNO ( 3U )
+#define ZMASTER_APPS_APPS_CAR_RUNE4EVENTNO ( 4U )
+
+/*Extern function*/
+extern void stm_master_apl_event_call( void );
+extern void stm_master_apl_initialize( void );
+extern void Zmaster_apps_apps_mainTerminate( void );
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/master/layer/apps/Zmaster_apps_master_apps_def.h b/policy_manager/stm/zipc/StateTransitionor/master/layer/apps/Zmaster_apps_master_apps_def.h
new file mode 100755
index 0000000..f592c64
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/master/layer/apps/Zmaster_apps_master_apps_def.h
@@ -0,0 +1,15 @@
+/************************************************************/
+/* Zmaster_apps_master_apps_def.h */
+/* Define header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZMASTER_APPS_MASTER_APPS_DEF_H
+#define ZHEADER_ZMASTER_APPS_MASTER_APPS_DEF_H
+
+/*************************************************************
+ Define definition
+*************************************************************/
+
+#include "../../../../stm_master_apps.h"
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/master/layer/remote/Zmaster_remote_master_remote_def.h b/policy_manager/stm/zipc/StateTransitionor/master/layer/remote/Zmaster_remote_master_remote_def.h
new file mode 100755
index 0000000..3fb6e16
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/master/layer/remote/Zmaster_remote_master_remote_def.h
@@ -0,0 +1,15 @@
+/************************************************************/
+/* Zmaster_remote_master_remote_def.h */
+/* Define header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZMASTER_REMOTE_MASTER_REMOTE_DEF_H
+#define ZHEADER_ZMASTER_REMOTE_MASTER_REMOTE_DEF_H
+
+/*************************************************************
+ Define definition
+*************************************************************/
+
+#include "../../../../stm_master_remote.h"
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/master/layer/remote/Zmaster_remote_remote.c b/policy_manager/stm/zipc/StateTransitionor/master/layer/remote/Zmaster_remote_remote.c
new file mode 100755
index 0000000..55619f3
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/master/layer/remote/Zmaster_remote_remote.c
@@ -0,0 +1,229 @@
+/************************************************************/
+/* Zmaster_remote_remote.c */
+/* remote State transition model source file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../../../ZST_include.h"
+
+/* State management variable */
+static uint8_t Zmaster_remote_remoteState[ZMASTER_REMOTE_REMOTESTATENOMAX];
+
+static void Zmaster_remote_remotes0e0( void );
+static void Zmaster_remote_remotes0e2( void );
+static void Zmaster_remote_remotes1e0( void );
+static void Zmaster_remote_remotes1e1( void );
+static void Zmaster_remote_remotes0Event( void );
+static void Zmaster_remote_remotes1Event( void );
+
+/****************************************/
+/* Action function */
+/* STM : remote */
+/* State : none( No 0 ) */
+/* Event : ara_master_split_sub( No 0 ) */
+/****************************************/
+static void Zmaster_remote_remotes0e0( void )
+{
+ Zmaster_remote_remoteState[ZMASTER_REMOTE_REMOTE] = ( uint8_t )ZMASTER_REMOTE_REMOTES1;
+ stm_mst_rmt_start_activity_tbt();
+}
+
+/****************************************/
+/* Action function */
+/* STM : remote */
+/* State : none( No 0 ) */
+/* Event : stt_prv_layer_remote_none( No 2 ) */
+/****************************************/
+static void Zmaster_remote_remotes0e2( void )
+{
+ stm_mst_rmt_start_activity_none();
+}
+
+/****************************************/
+/* Action function */
+/* STM : remote */
+/* State : tbt( No 1 ) */
+/* Event : ara_master_split_sub( No 0 ) */
+/****************************************/
+static void Zmaster_remote_remotes1e0( void )
+{
+ stm_mst_rmt_start_activity_tbt();
+}
+
+/****************************************/
+/* Action function */
+/* STM : remote */
+/* State : tbt( No 1 ) */
+/* Event : ctg_tbt( No 1 ) */
+/****************************************/
+static void Zmaster_remote_remotes1e1( void )
+{
+ Zmaster_remote_remoteState[ZMASTER_REMOTE_REMOTE] = ( uint8_t )ZMASTER_REMOTE_REMOTES0;
+ stm_mst_rmt_start_activity_none();
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : remote */
+/* State : none( No 0 ) */
+/****************************************/
+static void Zmaster_remote_remotes0Event( void )
+{
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_tbt*/
+ if( g_stm_category == StmCtgNoTbt )
+ {
+ /*ara_master_split_sub*/
+ if( g_stm_area == StmAreaNoMasterSplitSub )
+ {
+ Zmaster_remote_remotes0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_undo*/
+ else if( g_stm_event == StmEvtNoUndo )
+ {
+ /*stt_prv_layer_remote_none*/
+ if( g_stm_prv_state.layer[StmLayerNoRemote].state == StmLayoutNoNone )
+ {
+ Zmaster_remote_remotes0e2();
+ }
+ /*stt_prv_layer_remote_tbt*/
+ else if( g_stm_prv_state.layer[StmLayerNoRemote].state == StmLayoutNoRmtTbt )
+ {
+ Zmaster_remote_remotes0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : remote */
+/* State : tbt( No 1 ) */
+/****************************************/
+static void Zmaster_remote_remotes1Event( void )
+{
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_tbt*/
+ if( g_stm_category == StmCtgNoTbt )
+ {
+ /*ara_master_split_sub*/
+ if( g_stm_area == StmAreaNoMasterSplitSub )
+ {
+ Zmaster_remote_remotes1e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_deactivate*/
+ else if( g_stm_event == StmEvtNoDeactivate )
+ {
+ /*ctg_tbt*/
+ if( g_stm_category == StmCtgNoTbt )
+ {
+ Zmaster_remote_remotes1e1();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_undo*/
+ else if( g_stm_event == StmEvtNoUndo )
+ {
+ /*stt_prv_layer_remote_none*/
+ if( g_stm_prv_state.layer[StmLayerNoRemote].state == StmLayoutNoNone )
+ {
+ Zmaster_remote_remotes1e1();
+ }
+ /*stt_prv_layer_remote_tbt*/
+ else if( g_stm_prv_state.layer[StmLayerNoRemote].state == StmLayoutNoRmtTbt )
+ {
+ Zmaster_remote_remotes1e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event call function */
+/* STM : remote */
+/****************************************/
+void stm_mst_rmt_event_call( void )
+{
+ stm_mst_rmt_start_stm();
+ switch( Zmaster_remote_remoteState[ZMASTER_REMOTE_REMOTE] )
+ {
+ case ZMASTER_REMOTE_REMOTES0:
+ Zmaster_remote_remotes0Event();
+ break;
+ case ZMASTER_REMOTE_REMOTES1:
+ Zmaster_remote_remotes1Event();
+ break;
+ default:
+ /*Not accessible to this else (default).*/
+ break;
+ }
+}
+
+/****************************************/
+/* Initial function */
+/* STM : remote */
+/****************************************/
+void stm_mst_rmt_initialize( void )
+{
+ Zmaster_remote_remoteState[ZMASTER_REMOTE_REMOTE] = ( uint8_t )ZMASTER_REMOTE_REMOTES0;
+ stm_mst_rmt_start_activity_none();
+}
+
+/****************************************/
+/* Terminate function */
+/* STM : remote */
+/****************************************/
+void Zmaster_remote_remoteTerminate( void )
+{
+ Zmaster_remote_remoteState[ZMASTER_REMOTE_REMOTE] = ( uint8_t )ZMASTER_REMOTE_REMOTETERMINATE;
+}
+
diff --git a/policy_manager/stm/zipc/StateTransitionor/master/layer/remote/Zmaster_remote_remote.h b/policy_manager/stm/zipc/StateTransitionor/master/layer/remote/Zmaster_remote_remote.h
new file mode 100755
index 0000000..3f88fa4
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/master/layer/remote/Zmaster_remote_remote.h
@@ -0,0 +1,45 @@
+/************************************************************/
+/* Zmaster_remote_remote.h */
+/* remote State transition model header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZMASTER_REMOTE_REMOTE_H
+#define ZHEADER_ZMASTER_REMOTE_REMOTE_H
+
+/*State management variable access define*/
+#define ZMASTER_REMOTE_REMOTE ( 0U )
+#define ZMASTER_REMOTE_REMOTES0 ( 0U )
+#define ZMASTER_REMOTE_REMOTES1 ( 1U )
+#define ZMASTER_REMOTE_REMOTESTATENOMAX ( 1U )
+
+/*End state define*/
+#define ZMASTER_REMOTE_REMOTEEND ( 2U )
+/*Terminate state define*/
+#define ZMASTER_REMOTE_REMOTETERMINATE ( ZMASTER_REMOTE_REMOTEEND + 1U )
+
+/*State no define*/
+#define ZMASTER_REMOTE_REMOTES0STATENO ( 0U )
+#define ZMASTER_REMOTE_REMOTES1STATENO ( 1U )
+
+/*State serial no define*/
+#define ZMASTER_REMOTE_REMOTES0STATESERIALNO ( 0U )
+#define ZMASTER_REMOTE_REMOTES1STATESERIALNO ( 1U )
+
+/*Event no define*/
+#define ZMASTER_REMOTE_REMOTEE0EVENTNO ( 0U )
+#define ZMASTER_REMOTE_REMOTEE1EVENTNO ( 1U )
+#define ZMASTER_REMOTE_REMOTEE2EVENTNO ( 2U )
+#define ZMASTER_REMOTE_REMOTEE3EVENTNO ( 3U )
+
+/*Event serial no define*/
+#define ZMASTER_REMOTE_REMOTEE0EVENTSERIALNO ( 0U )
+#define ZMASTER_REMOTE_REMOTEE1EVENTSERIALNO ( 1U )
+#define ZMASTER_REMOTE_REMOTEE2EVENTSERIALNO ( 2U )
+#define ZMASTER_REMOTE_REMOTEE3EVENTSERIALNO ( 3U )
+
+/*Extern function*/
+extern void stm_mst_rmt_event_call( void );
+extern void stm_mst_rmt_initialize( void );
+extern void Zmaster_remote_remoteTerminate( void );
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1.c b/policy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1.c
new file mode 100755
index 0000000..7a39d96
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1.c
@@ -0,0 +1,179 @@
+/************************************************************/
+/* Zremote_rse1_remote_rse1.c */
+/* remote_rse1 State transition model source file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../../../ZST_include.h"
+
+/* State management variable */
+static uint8_t Zremote_rse1_remote_rse1State[ZREMOTE_RSE1_REMOTE_RSE1STATENOMAX];
+
+static void Zremote_rse1_remote_rse1s0e0( void );
+static void Zremote_rse1_remote_rse1s1e0( void );
+static void Zremote_rse1_remote_rse1s1e1( void );
+static void Zremote_rse1_remote_rse1s0Event( void );
+static void Zremote_rse1_remote_rse1s1Event( void );
+
+/****************************************/
+/* Action function */
+/* STM : remote_rse1 */
+/* State : none( No 0 ) */
+/* Event : ara_normal( No 0 ) */
+/****************************************/
+static void Zremote_rse1_remote_rse1s0e0( void )
+{
+ Zremote_rse1_remote_rse1State[ZREMOTE_RSE1_REMOTE_RSE1] = ( uint8_t )ZREMOTE_RSE1_REMOTE_RSE1S1;
+ stm_remote_rse1_start_activity_general();
+}
+
+/****************************************/
+/* Action function */
+/* STM : remote_rse1 */
+/* State : general( No 1 ) */
+/* Event : ara_normal( No 0 ) */
+/****************************************/
+static void Zremote_rse1_remote_rse1s1e0( void )
+{
+ stm_remote_rse1_start_activity_general();
+}
+
+/****************************************/
+/* Action function */
+/* STM : remote_rse1 */
+/* State : general( No 1 ) */
+/* Event : ctg_receiver( No 1 ) */
+/****************************************/
+static void Zremote_rse1_remote_rse1s1e1( void )
+{
+ Zremote_rse1_remote_rse1State[ZREMOTE_RSE1_REMOTE_RSE1] = ( uint8_t )ZREMOTE_RSE1_REMOTE_RSE1S0;
+ stm_remote_rse1_start_activity_none();
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : remote_rse1 */
+/* State : none( No 0 ) */
+/****************************************/
+static void Zremote_rse1_remote_rse1s0Event( void )
+{
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_receiver*/
+ if( g_stm_category == StmCtgNoReceiver )
+ {
+ /*ara_normal*/
+ if( g_stm_area == StmAreaNoNormal )
+ {
+ Zremote_rse1_remote_rse1s0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : remote_rse1 */
+/* State : general( No 1 ) */
+/****************************************/
+static void Zremote_rse1_remote_rse1s1Event( void )
+{
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_receiver*/
+ if( g_stm_category == StmCtgNoReceiver )
+ {
+ /*ara_normal*/
+ if( g_stm_area == StmAreaNoNormal )
+ {
+ Zremote_rse1_remote_rse1s1e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_deactivate*/
+ else if( g_stm_event == StmEvtNoDeactivate )
+ {
+ /*ctg_receiver*/
+ if( g_stm_category == StmCtgNoReceiver )
+ {
+ Zremote_rse1_remote_rse1s1e1();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event call function */
+/* STM : remote_rse1 */
+/****************************************/
+void stm_rmt_rse1_event_call( void )
+{
+ stm_remote_rse1_start_stm();
+ switch( Zremote_rse1_remote_rse1State[ZREMOTE_RSE1_REMOTE_RSE1] )
+ {
+ case ZREMOTE_RSE1_REMOTE_RSE1S0:
+ Zremote_rse1_remote_rse1s0Event();
+ break;
+ case ZREMOTE_RSE1_REMOTE_RSE1S1:
+ Zremote_rse1_remote_rse1s1Event();
+ break;
+ default:
+ /*Not accessible to this else (default).*/
+ break;
+ }
+}
+
+/****************************************/
+/* Initial function */
+/* STM : remote_rse1 */
+/****************************************/
+void stm_rmt_rse1_initialize( void )
+{
+ Zremote_rse1_remote_rse1State[ZREMOTE_RSE1_REMOTE_RSE1] = ( uint8_t )ZREMOTE_RSE1_REMOTE_RSE1S0;
+ stm_remote_rse1_start_activity_none();
+}
+
+/****************************************/
+/* Terminate function */
+/* STM : remote_rse1 */
+/****************************************/
+void Zremote_rse1_remote_rse1Terminate( void )
+{
+ Zremote_rse1_remote_rse1State[ZREMOTE_RSE1_REMOTE_RSE1] = ( uint8_t )ZREMOTE_RSE1_REMOTE_RSE1TERMINATE;
+}
+
diff --git a/policy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1.h b/policy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1.h
new file mode 100755
index 0000000..a85f16c
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1.h
@@ -0,0 +1,41 @@
+/************************************************************/
+/* Zremote_rse1_remote_rse1.h */
+/* remote_rse1 State transition model header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZREMOTE_RSE1_REMOTE_RSE1_H
+#define ZHEADER_ZREMOTE_RSE1_REMOTE_RSE1_H
+
+/*State management variable access define*/
+#define ZREMOTE_RSE1_REMOTE_RSE1 ( 0U )
+#define ZREMOTE_RSE1_REMOTE_RSE1S0 ( 0U )
+#define ZREMOTE_RSE1_REMOTE_RSE1S1 ( 1U )
+#define ZREMOTE_RSE1_REMOTE_RSE1STATENOMAX ( 1U )
+
+/*End state define*/
+#define ZREMOTE_RSE1_REMOTE_RSE1END ( 2U )
+/*Terminate state define*/
+#define ZREMOTE_RSE1_REMOTE_RSE1TERMINATE ( ZREMOTE_RSE1_REMOTE_RSE1END + 1U )
+
+/*State no define*/
+#define ZREMOTE_RSE1_REMOTE_RSE1S0STATENO ( 0U )
+#define ZREMOTE_RSE1_REMOTE_RSE1S1STATENO ( 1U )
+
+/*State serial no define*/
+#define ZREMOTE_RSE1_REMOTE_RSE1S0STATESERIALNO ( 0U )
+#define ZREMOTE_RSE1_REMOTE_RSE1S1STATESERIALNO ( 1U )
+
+/*Event no define*/
+#define ZREMOTE_RSE1_REMOTE_RSE1E0EVENTNO ( 0U )
+#define ZREMOTE_RSE1_REMOTE_RSE1E1EVENTNO ( 1U )
+
+/*Event serial no define*/
+#define ZREMOTE_RSE1_REMOTE_RSE1E0EVENTSERIALNO ( 0U )
+#define ZREMOTE_RSE1_REMOTE_RSE1E1EVENTSERIALNO ( 1U )
+
+/*Extern function*/
+extern void stm_rmt_rse1_event_call( void );
+extern void stm_rmt_rse1_initialize( void );
+extern void Zremote_rse1_remote_rse1Terminate( void );
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1_func.c b/policy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1_func.c
new file mode 100755
index 0000000..cfeb4a1
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1_func.c
@@ -0,0 +1,49 @@
+/************************************************************/
+/* Zremote_rse1_remote_rse1_func.c */
+/* Function and variable source file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../../../ZST_include.h"
+
+/*************************************************************
+ Function definition
+*************************************************************/
+/**
+ * stm_rmt_rse1_initialize_variable
+ */
+void stm_rmt_rse1_initialize_variable() {
+ g_stm_prv_state.layer[StmLayerNoRemoteRSE1].state = StmLayoutNoNone;
+ g_stm_prv_state.layer[StmLayerNoRemoteRSE1].changed = STM_FALSE;
+
+ g_stm_crr_state.layer[StmLayerNoRemoteRSE1].state = StmLayoutNoNone;
+ g_stm_crr_state.layer[StmLayerNoRemoteRSE1].changed = STM_FALSE;
+}
+
+/**
+ * stm_remote_rse1_start_stm
+ */
+void stm_remote_rse1_start_stm() {
+ if (g_stm_event == StmEvtNoUndo) {
+ // nop
+ }
+ else {
+ g_stm_prv_state.layer[StmLayerNoRemoteRSE1].state = g_stm_crr_state.layer[StmLayerNoRemoteRSE1].state;
+ }
+ g_stm_crr_state.layer[StmLayerNoRemoteRSE1].changed = STM_FALSE;
+}
+
+/**
+ * stm_remote_rse1_start_activity_none
+ */
+void stm_remote_rse1_start_activity_none() {
+ g_stm_crr_state.layer[StmLayerNoRemoteRSE1].state = StmLayoutNoNone;
+ g_stm_crr_state.layer[StmLayerNoRemoteRSE1].changed = STM_TRUE;
+}
+
+/**
+ * stm_remote_rse1_start_activity_general
+ */
+void stm_remote_rse1_start_activity_general(){
+ g_stm_crr_state.layer[StmLayerNoRemoteRSE1].state = StmLayoutNoGenNml;
+ g_stm_crr_state.layer[StmLayerNoRemoteRSE1].changed = STM_TRUE;
+}
diff --git a/policy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1_func.h b/policy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1_func.h
new file mode 100755
index 0000000..dcbd3e3
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/rse1/layer/remote_rse1/Zremote_rse1_remote_rse1_func.h
@@ -0,0 +1,14 @@
+/************************************************************/
+/* Zremote_rse1_remote_rse1_func.h */
+/* Function and variable header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZREMOTE_RSE1_REMOTE_RSE1_FUNC_H
+#define ZHEADER_ZREMOTE_RSE1_REMOTE_RSE1_FUNC_H
+
+extern void stm_rmt_rse1_initialize_variable();
+extern void stm_remote_rse1_start_stm();
+extern void stm_remote_rse1_start_activity_none();
+extern void stm_remote_rse1_start_activity_general();
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2.c b/policy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2.c
new file mode 100755
index 0000000..4f2cd6c
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2.c
@@ -0,0 +1,179 @@
+/************************************************************/
+/* Zremote_rse2_remote_rse2.c */
+/* remote_rse2 State transition model source file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../../../ZST_include.h"
+
+/* State management variable */
+static uint8_t Zremote_rse2_remote_rse2State[ZREMOTE_RSE2_REMOTE_RSE2STATENOMAX];
+
+static void Zremote_rse2_remote_rse2s0e0( void );
+static void Zremote_rse2_remote_rse2s1e0( void );
+static void Zremote_rse2_remote_rse2s1e1( void );
+static void Zremote_rse2_remote_rse2s0Event( void );
+static void Zremote_rse2_remote_rse2s1Event( void );
+
+/****************************************/
+/* Action function */
+/* STM : remote_rse2 */
+/* State : none( No 0 ) */
+/* Event : ara_normal( No 0 ) */
+/****************************************/
+static void Zremote_rse2_remote_rse2s0e0( void )
+{
+ Zremote_rse2_remote_rse2State[ZREMOTE_RSE2_REMOTE_RSE2] = ( uint8_t )ZREMOTE_RSE2_REMOTE_RSE2S1;
+ stm_remote_rse2_start_activity_general();
+}
+
+/****************************************/
+/* Action function */
+/* STM : remote_rse2 */
+/* State : general( No 1 ) */
+/* Event : ara_normal( No 0 ) */
+/****************************************/
+static void Zremote_rse2_remote_rse2s1e0( void )
+{
+ stm_remote_rse2_start_activity_general();
+}
+
+/****************************************/
+/* Action function */
+/* STM : remote_rse2 */
+/* State : general( No 1 ) */
+/* Event : ctg_receiver( No 1 ) */
+/****************************************/
+static void Zremote_rse2_remote_rse2s1e1( void )
+{
+ Zremote_rse2_remote_rse2State[ZREMOTE_RSE2_REMOTE_RSE2] = ( uint8_t )ZREMOTE_RSE2_REMOTE_RSE2S0;
+ stm_remote_rse2_start_activity_none();
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : remote_rse2 */
+/* State : none( No 0 ) */
+/****************************************/
+static void Zremote_rse2_remote_rse2s0Event( void )
+{
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_receiver*/
+ if( g_stm_category == StmCtgNoReceiver )
+ {
+ /*ara_normal*/
+ if( g_stm_area == StmAreaNoNormal )
+ {
+ Zremote_rse2_remote_rse2s0e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event appraisal function */
+/* STM : remote_rse2 */
+/* State : general( No 1 ) */
+/****************************************/
+static void Zremote_rse2_remote_rse2s1Event( void )
+{
+ /*evt_activate*/
+ if( g_stm_event == StmEvtNoActivate )
+ {
+ /*ctg_receiver*/
+ if( g_stm_category == StmCtgNoReceiver )
+ {
+ /*ara_normal*/
+ if( g_stm_area == StmAreaNoNormal )
+ {
+ Zremote_rse2_remote_rse2s1e0();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ /*evt_deactivate*/
+ else if( g_stm_event == StmEvtNoDeactivate )
+ {
+ /*ctg_receiver*/
+ if( g_stm_category == StmCtgNoReceiver )
+ {
+ Zremote_rse2_remote_rse2s1e1();
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+ }
+ else
+ {
+ /*Else and default design have not done.*/
+ /*Please confirm the STM and design else and default.*/
+ }
+}
+
+/****************************************/
+/* Event call function */
+/* STM : remote_rse2 */
+/****************************************/
+void stm_rmt_rse2_event_call( void )
+{
+ stm_remote_rse2_start_stm();
+ switch( Zremote_rse2_remote_rse2State[ZREMOTE_RSE2_REMOTE_RSE2] )
+ {
+ case ZREMOTE_RSE2_REMOTE_RSE2S0:
+ Zremote_rse2_remote_rse2s0Event();
+ break;
+ case ZREMOTE_RSE2_REMOTE_RSE2S1:
+ Zremote_rse2_remote_rse2s1Event();
+ break;
+ default:
+ /*Not accessible to this else (default).*/
+ break;
+ }
+}
+
+/****************************************/
+/* Initial function */
+/* STM : remote_rse2 */
+/****************************************/
+void stm_rmt_rse2_initialize( void )
+{
+ Zremote_rse2_remote_rse2State[ZREMOTE_RSE2_REMOTE_RSE2] = ( uint8_t )ZREMOTE_RSE2_REMOTE_RSE2S0;
+ stm_remote_rse2_start_activity_none();
+}
+
+/****************************************/
+/* Terminate function */
+/* STM : remote_rse2 */
+/****************************************/
+void Zremote_rse2_remote_rse2Terminate( void )
+{
+ Zremote_rse2_remote_rse2State[ZREMOTE_RSE2_REMOTE_RSE2] = ( uint8_t )ZREMOTE_RSE2_REMOTE_RSE2TERMINATE;
+}
+
diff --git a/policy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2.h b/policy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2.h
new file mode 100755
index 0000000..f7f768e
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2.h
@@ -0,0 +1,41 @@
+/************************************************************/
+/* Zremote_rse2_remote_rse2.h */
+/* remote_rse2 State transition model header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZREMOTE_RSE2_REMOTE_RSE2_H
+#define ZHEADER_ZREMOTE_RSE2_REMOTE_RSE2_H
+
+/*State management variable access define*/
+#define ZREMOTE_RSE2_REMOTE_RSE2 ( 0U )
+#define ZREMOTE_RSE2_REMOTE_RSE2S0 ( 0U )
+#define ZREMOTE_RSE2_REMOTE_RSE2S1 ( 1U )
+#define ZREMOTE_RSE2_REMOTE_RSE2STATENOMAX ( 1U )
+
+/*End state define*/
+#define ZREMOTE_RSE2_REMOTE_RSE2END ( 2U )
+/*Terminate state define*/
+#define ZREMOTE_RSE2_REMOTE_RSE2TERMINATE ( ZREMOTE_RSE2_REMOTE_RSE2END + 1U )
+
+/*State no define*/
+#define ZREMOTE_RSE2_REMOTE_RSE2S0STATENO ( 0U )
+#define ZREMOTE_RSE2_REMOTE_RSE2S1STATENO ( 1U )
+
+/*State serial no define*/
+#define ZREMOTE_RSE2_REMOTE_RSE2S0STATESERIALNO ( 0U )
+#define ZREMOTE_RSE2_REMOTE_RSE2S1STATESERIALNO ( 1U )
+
+/*Event no define*/
+#define ZREMOTE_RSE2_REMOTE_RSE2E0EVENTNO ( 0U )
+#define ZREMOTE_RSE2_REMOTE_RSE2E1EVENTNO ( 1U )
+
+/*Event serial no define*/
+#define ZREMOTE_RSE2_REMOTE_RSE2E0EVENTSERIALNO ( 0U )
+#define ZREMOTE_RSE2_REMOTE_RSE2E1EVENTSERIALNO ( 1U )
+
+/*Extern function*/
+extern void stm_rmt_rse2_event_call( void );
+extern void stm_rmt_rse2_initialize( void );
+extern void Zremote_rse2_remote_rse2Terminate( void );
+
+#endif
diff --git a/policy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2_func.c b/policy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2_func.c
new file mode 100755
index 0000000..cae3382
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2_func.c
@@ -0,0 +1,49 @@
+/************************************************************/
+/* Zremote_rse2_remote_rse2_func.c */
+/* Function and variable source file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#include "../../../ZST_include.h"
+
+/*************************************************************
+ Function definition
+*************************************************************/
+/**
+ * stm_rrt_rse2_initialize_variable
+ */
+void stm_rmt_rse2_initialize_variable() {
+ g_stm_prv_state.layer[StmLayerNoRemoteRSE2].state = StmLayoutNoNone;
+ g_stm_prv_state.layer[StmLayerNoRemoteRSE2].changed = STM_FALSE;
+
+ g_stm_crr_state.layer[StmLayerNoRemoteRSE2].state = StmLayoutNoNone;
+ g_stm_crr_state.layer[StmLayerNoRemoteRSE2].changed = STM_FALSE;
+}
+
+/**
+ * stm_remote_rse2_start_stm
+ */
+void stm_remote_rse2_start_stm() {
+ if (g_stm_event == StmEvtNoUndo) {
+ // nop
+ }
+ else {
+ g_stm_prv_state.layer[StmLayerNoRemoteRSE2].state = g_stm_crr_state.layer[StmLayerNoRemoteRSE2].state;
+ }
+ g_stm_crr_state.layer[StmLayerNoRemoteRSE2].changed = STM_FALSE;
+}
+
+/**
+ * stm_remote_rse2_start_activity_none
+ */
+void stm_remote_rse2_start_activity_none() {
+ g_stm_crr_state.layer[StmLayerNoRemoteRSE2].state = StmLayoutNoNone;
+ g_stm_crr_state.layer[StmLayerNoRemoteRSE2].changed = STM_TRUE;
+}
+
+/*
+ * @name stm_remote_rse2_start_activity_general
+ */
+void stm_remote_rse2_start_activity_general(){
+ g_stm_crr_state.layer[StmLayerNoRemoteRSE2].state = StmLayoutNoGenNml;
+ g_stm_crr_state.layer[StmLayerNoRemoteRSE2].changed = STM_TRUE;
+}
diff --git a/policy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2_func.h b/policy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2_func.h
new file mode 100755
index 0000000..2643478
--- /dev/null
+++ b/policy_manager/stm/zipc/StateTransitionor/rse2/layer/remote_rse2/Zremote_rse2_remote_rse2_func.h
@@ -0,0 +1,14 @@
+/************************************************************/
+/* Zremote_rse2_remote_rse2_func.h */
+/* Function and variable header file */
+/* ZIPC Designer Version 1.2.1 */
+/************************************************************/
+#ifndef ZHEADER_ZREMOTE_RSE2_REMOTE_RSE2_FUNC_H
+#define ZHEADER_ZREMOTE_RSE2_REMOTE_RSE2_FUNC_H
+
+extern void stm_rmt_rse2_initialize_variable();
+extern void stm_remote_rse2_start_stm();
+extern void stm_remote_rse2_start_activity_none();
+extern void stm_remote_rse2_start_activity_general();
+
+#endif
diff --git a/policy_manager/stm/zipc/stm_master_apps.c b/policy_manager/stm/zipc/stm_master_apps.c
new file mode 100644
index 0000000..a8cc0e2
--- /dev/null
+++ b/policy_manager/stm/zipc/stm_master_apps.c
@@ -0,0 +1,63 @@
+#include "./StateTransitionor/ZST_include.h"
+
+void stm_mst_apl_start_activity_none() {
+ g_stm_crr_state.layer[StmLayerNoApps].state = StmLayoutNoNone;
+ g_stm_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
+}
+
+void stm_mst_apl_start_activity_meter_receiver() {
+ g_stm_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMtrRcv;
+ g_stm_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
+}
+
+void stm_mst_apl_start_activity_meter_splitable() {
+ g_stm_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMtrSpl;
+ g_stm_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
+}
+
+void stm_mst_apl_start_activity_splitable_receiver() {
+ g_stm_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSplRcv;
+ g_stm_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
+}
+
+void stm_mst_apl_start_activity_splitable_split() {
+ g_stm_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSplSpl;
+ g_stm_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
+}
+
+void stm_mst_apl_start_activity_general() {
+ g_stm_crr_state.layer[StmLayerNoApps].state = StmLayoutNoGenNml;
+ g_stm_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
+}
+
+void stm_mst_apl_start_activity_meter() {
+ g_stm_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMtrNml;
+ g_stm_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
+}
+
+void stm_mst_apl_event_lightstatus_brake_on() {
+ g_stm_crr_state.layer[StmLayerNoApps].state = g_prv_apps_state_car_stop;
+ g_stm_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
+}
+
+void stm_mst_apl_event_lightstatus_brake_off() {
+ g_prv_apps_state_car_stop = g_stm_prv_state.layer[StmLayerNoApps].state;
+}
+
+void stm_master_apl_initialize_valiable() {
+ g_stm_prv_state.layer[StmLayerNoApps].state = StmLayoutNoNone;
+ g_stm_prv_state.layer[StmLayerNoApps].changed = STM_FALSE;
+
+ g_stm_crr_state.layer[StmLayerNoApps].state = StmLayoutNoNone;
+ g_stm_crr_state.layer[StmLayerNoApps].changed = STM_FALSE;
+}
+
+void stm_mst_apl_start_stm() {
+ if (g_stm_event == StmEvtNoUndo) {
+ // nop
+ }
+ else {
+ g_stm_prv_state.layer[StmLayerNoApps].state = g_stm_crr_state.layer[StmLayerNoApps].state;
+ }
+ g_stm_crr_state.layer[StmLayerNoApps].changed = STM_FALSE;
+}
diff --git a/policy_manager/stm/zipc/stm_master_apps.h b/policy_manager/stm/zipc/stm_master_apps.h
new file mode 100644
index 0000000..d10e56b
--- /dev/null
+++ b/policy_manager/stm/zipc/stm_master_apps.h
@@ -0,0 +1,11 @@
+extern void stm_mst_apl_start_activity_none();
+extern void stm_mst_apl_start_activity_meter_receiver();
+extern void stm_mst_apl_start_activity_meter_splitable();
+extern void stm_mst_apl_start_activity_splitable_receiver();
+extern void stm_mst_apl_start_activity_splitable_split();
+extern void stm_mst_apl_start_activity_general();
+extern void stm_mst_apl_start_activity_meter();
+extern void stm_mst_apl_event_lightstatus_brake_on();
+extern void stm_mst_apl_event_lightstatus_brake_off();
+extern void stm_master_apl_initialize_valiable();
+extern void stm_mst_apl_start_stm();
diff --git a/policy_manager/stm/zipc/stm_master_remote.c b/policy_manager/stm/zipc/stm_master_remote.c
new file mode 100644
index 0000000..d63cba1
--- /dev/null
+++ b/policy_manager/stm/zipc/stm_master_remote.c
@@ -0,0 +1,29 @@
+#include "./StateTransitionor/ZST_include.h"
+
+void stm_mst_rmt_start_activity_none() {
+ g_stm_crr_state.layer[StmLayerNoRemote].state = StmLayoutNoNone;
+ g_stm_crr_state.layer[StmLayerNoRemote].changed = STM_TRUE;
+}
+
+void stm_mst_rmt_start_activity_tbt() {
+ g_stm_crr_state.layer[StmLayerNoRemote].state = StmLayoutNoRmtTbt;
+ g_stm_crr_state.layer[StmLayerNoRemote].changed = STM_TRUE;
+}
+
+void stm_mst_rmt_initialize_valiable() {
+ g_stm_prv_state.layer[StmLayerNoRemote].state = StmLayoutNoNone;
+ g_stm_prv_state.layer[StmLayerNoRemote].changed = STM_FALSE;
+
+ g_stm_crr_state.layer[StmLayerNoRemote].state = StmLayoutNoNone;
+ g_stm_crr_state.layer[StmLayerNoRemote].changed = STM_FALSE;
+}
+
+void stm_mst_rmt_start_stm() {
+ if (g_stm_event == StmEvtNoUndo) {
+ // nop
+ }
+ else {
+ g_stm_prv_state.layer[StmLayerNoRemote].state = g_stm_crr_state.layer[StmLayerNoRemote].state;
+ }
+ g_stm_crr_state.layer[StmLayerNoRemote].changed = STM_FALSE;
+}
diff --git a/policy_manager/stm/zipc/stm_master_remote.h b/policy_manager/stm/zipc/stm_master_remote.h
new file mode 100644
index 0000000..45d77c7
--- /dev/null
+++ b/policy_manager/stm/zipc/stm_master_remote.h
@@ -0,0 +1,4 @@
+extern void stm_mst_rmt_start_activity_none();
+extern void stm_mst_rmt_start_activity_tbt();
+extern void stm_mst_rmt_initialize_valiable();
+extern void stm_mst_rmt_start_stm();
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fc19a18..093b356 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -35,7 +35,9 @@ add_library(${TARGETS_WM} MODULE
wm_client.cpp
wm_error.cpp
wm_layer.cpp
- wm_layer_control.cpp)
+ wm_layer_control.cpp
+ wm_connection.cpp
+ low_can_client.cpp)
target_include_directories(${TARGETS_WM}
PRIVATE
@@ -56,7 +58,7 @@ target_link_libraries(${TARGETS_WM}
target_compile_definitions(${TARGETS_WM}
PRIVATE
- AFB_BINDING_VERSION=3
+ AFB_BINDING_VERSION=2
# We do not want source location of messages
AFB_BINDING_PRAGMA_NO_VERBOSE_DETAILS
WINMAN_VERSION_STRING="${PACKAGE_VERSION}"
@@ -70,7 +72,7 @@ endif()
target_compile_options(${TARGETS_WM}
PRIVATE
- -Wall -Wextra -Wno-unused-parameter -Wno-comment -Wno-missing-field-initializers)
+ -Wall -Wextra -Wno-unused-parameter -Wno-comment)
set_target_properties(${TARGETS_WM}
PROPERTIES
@@ -111,8 +113,11 @@ add_custom_command(TARGET ${TARGETS_WM} POST_BUILD
COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/root/lib
COMMAND cp -rf ${PROJECT_BINARY_DIR}/src/${TARGETS_WM}.so ${PROJECT_BINARY_DIR}/package/root/lib
COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/root/etc
- COMMAND cp -f ${CMAKE_SOURCE_DIR}/conf/layers.json ${PROJECT_BINARY_DIR}/package/root/etc
- COMMAND cp -f ${CMAKE_SOURCE_DIR}/conf/areas.json ${PROJECT_BINARY_DIR}/package/root/etc
+ COMMAND cp -f ${PROJECT_SOURCE_DIR}/layers.json ${PROJECT_BINARY_DIR}/package/root/etc
+ COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/config/old_roles.json ${PROJECT_BINARY_DIR}/package/root/etc
+ COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/config/areas.json ${PROJECT_BINARY_DIR}/package/root/etc
+ COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/config/connection.json ${PROJECT_BINARY_DIR}/package/root/etc
+ COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/config/timeout.json ${PROJECT_BINARY_DIR}/package/root/etc
)
add_custom_target(package DEPENDS ${PROJECT_BINARY_DIR}/package/root
diff --git a/src/applist.cpp b/src/applist.cpp
index 473d687..8ef08dd 100644
--- a/src/applist.cpp
+++ b/src/applist.cpp
@@ -82,27 +82,6 @@ void AppList::addClient(const string &appid, unsigned layer, const string &role)
}
/**
- * Add Client to the list
- *
- * This function is overload function.
- * But this function just register application.
- * So an application does not have role, surface, layer.
- * Client need to register role and layer afterward.
- *
- * @param string[in] Application id. This will be the key to withdraw the information.
- * @return None
- * @attention This function should be called once for the app
- * Caller should take care not to be called more than once.
- */
-void AppList::addClient(const string &appid)
-{
- std::lock_guard<std::mutex> lock(this->mtx);
- shared_ptr<WMClient> client = std::make_shared<WMClient>(appid, 0, "");
- this->app2client[appid] = client;
- this->clientDump();
-}
-
-/**
* Remove WMClient from the list
*
* @param string[in] Application id. This will be the key to withdraw the information.
@@ -332,8 +311,8 @@ const vector<struct WMAction> &AppList::getActions(unsigned req_num, bool* found
}
HMI_SEQ_ERROR(req_num, "Couldn't get action with the request : %d", req_num);
{
- static vector<struct WMAction> empty;
- return empty;
+ static vector<struct WMAction> empty;
+ return empty;
}
}
@@ -402,7 +381,7 @@ WMError AppList::setAction(unsigned req_num, shared_ptr<WMClient> client, const
}
// If visible task is not invisible, redraw is required -> true
bool edraw_f = (visible != TaskVisible::INVISIBLE) ? false : true;
- WMAction action{req_num, client, role, area, visible, edraw_f};
+ WMAction action{req_num, client, role, area, visible, edraw_f, TaskCarState::NO_TASK};
x.sync_draw_req.push_back(action);
result = WMError::SUCCESS;
@@ -438,11 +417,23 @@ bool AppList::setEndDrawFinished(unsigned req_num, const string &appid, const st
{
for (auto &y : x.sync_draw_req)
{
- if (y.client->appID() == appid && y.role == role)
+ if (nullptr != y.client)
+ {
+ if (y.client->appID() == appid && y.role == role)
+ {
+ HMI_SEQ_INFO(req_num, "Role %s finish redraw", y.role.c_str());
+ y.end_draw_finished = true;
+ result = true;
+ }
+ }
+ else
{
- HMI_SEQ_INFO(req_num, "Role %s finish redraw", y.role.c_str());
- y.end_draw_finished = true;
- result = true;
+ if (y.role == role)
+ {
+ HMI_SEQ_INFO(req_num, "Role %s finish redraw", y.role.c_str());
+ y.end_draw_finished = true;
+ result = true;
+ }
}
}
}
@@ -553,7 +544,7 @@ void AppList::reqDump()
{
DUMP(
"Action : (APPID :%s, ROLE :%s, AREA :%s, VISIBLE : %s, END_DRAW_FINISHED: %d)",
- y.client->appID().c_str(),
+ (y.client) ? y.client->appID().c_str() : "-",
y.role.c_str(),
y.area.c_str(),
(y.visible == TaskVisible::INVISIBLE) ? "invisible" : "visible",
diff --git a/src/applist.hpp b/src/applist.hpp
index 0fe3bbd..085504a 100644
--- a/src/applist.hpp
+++ b/src/applist.hpp
@@ -45,7 +45,6 @@ class AppList
void addClient(const std::string &appid, unsigned layer,
unsigned surface, const std::string &role);
void addClient(const std::string &appid, unsigned layer, const std::string &role);
- void addClient(const std::string &appid);
void removeClient(const std::string &appid);
bool contains(const std::string &appid) const;
int countClient() const;
diff --git a/src/config/areas.json b/src/config/areas.json
new file mode 100644
index 0000000..cd54725
--- /dev/null
+++ b/src/config/areas.json
@@ -0,0 +1,306 @@
+{
+ "ecus": [
+ {
+ "name": "master",
+ "screens": [
+ {
+ "id": 0,
+ "areas": [
+ {
+ "name": "fullscreen",
+ "rect": {
+ "x": 0,
+ "y": 0,
+ "w": 1920,
+ "h": 1080
+ }
+ },
+ {
+ "name": "normal.full",
+ "rect": {
+ "x": 0,
+ "y": 180,
+ "w": 1920,
+ "h": 720
+ }
+ },
+ {
+ "name": "split.main",
+ "rect": {
+ "x": 0,
+ "y": 180,
+ "w": 1280,
+ "h": 720
+ }
+ },
+ {
+ "name": "split.sub",
+ "rect": {
+ "x": 1280,
+ "y": 180,
+ "w": 640,
+ "h": 720
+ }
+ },
+ {
+ "name": "software_keyboard",
+ "rect": {
+ "x": 0,
+ "y": 962,
+ "w": 1080,
+ "h": 744
+ }
+ },
+ {
+ "name": "restriction.normal",
+ "rect": {
+ "x": 0,
+ "y": 0,
+ "w": 1920,
+ "h": 1080
+ }
+ },
+ {
+ "name": "restriction.split.main",
+ "rect": {
+ "x": 0,
+ "y": 0,
+ "w": 1920,
+ "h": 540
+ }
+ },
+ {
+ "name": "restriction.split.sub",
+ "rect": {
+ "x": 0,
+ "y": 540,
+ "w": 1920,
+ "h": 540
+ }
+ },
+ {
+ "name": "on_screen",
+ "rect": {
+ "x": 1280,
+ "y": 0,
+ "w": 640,
+ "h": 720
+ }
+ },
+ {
+ "name": "master.split.sub",
+ "rect": {
+ "x": 1280,
+ "y": 0,
+ "w": 640,
+ "h": 720
+ }
+ },
+ {
+ "name": "hud.upper.left",
+ "rect": {
+ "x": 0,
+ "y": 0,
+ "w": 480,
+ "h": 180
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "slave",
+ "screens": [
+ {
+ "id": 0,
+ "areas": [
+ {
+ "name": "fullscreen",
+ "rect": {
+ "x": 0,
+ "y": 0,
+ "w": 1080,
+ "h": 1920
+ }
+ },
+ {
+ "name": "normal.full",
+ "rect": {
+ "x": 0,
+ "y": 218,
+ "w": 1080,
+ "h": 1488
+ }
+ },
+ {
+ "name": "split.main",
+ "rect": {
+ "x": 0,
+ "y": 218,
+ "w": 1080,
+ "h": 744
+ }
+ },
+ {
+ "name": "split.sub",
+ "rect": {
+ "x": 0,
+ "y": 962,
+ "w": 1080,
+ "h": 744
+ }
+ },
+ {
+ "name": "software_keyboard",
+ "rect": {
+ "x": 0,
+ "y": 962,
+ "w": 1080,
+ "h": 744
+ }
+ },
+ {
+ "name": "restriction.normal",
+ "rect": {
+ "x": 0,
+ "y": 218,
+ "w": 1080,
+ "h": 1488
+ }
+ },
+ {
+ "name": "restriction.split.main",
+ "rect": {
+ "x": 0,
+ "y": 218,
+ "w": 1080,
+ "h": 744
+ }
+ },
+ {
+ "name": "restriction.split.sub",
+ "rect": {
+ "x": 0,
+ "y": 962,
+ "w": 1080,
+ "h": 744
+ }
+ },
+ {
+ "name": "on_screen",
+ "rect": {
+ "x": 0,
+ "y": 218,
+ "w": 1080,
+ "h": 1488
+ }
+ },
+ {
+ "name": "master.split.sub",
+ "rect": {
+ "x": 0,
+ "y": 180,
+ "w": 640,
+ "h": 720
+ }
+ },
+ {
+ "name": "rse1.normal.full",
+ "rect": {
+ "x": 0,
+ "y": 0,
+ "w": 1920,
+ "h": 720
+ }
+ },
+ {
+ "name": "rse2.normal.full",
+ "rect": {
+ "x": 0,
+ "y": 0,
+ "w": 1920,
+ "h": 720
+ }
+ },
+ {
+ "name": "hud.normal.full",
+ "rect": {
+ "x": 0,
+ "y": 0,
+ "w": 1920,
+ "h": 720
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "rse1",
+ "screens": [
+ {
+ "id": 0,
+ "areas": [
+ {
+ "name": "rse1.normal.full",
+ "rect": {
+ "x": 0,
+ "y": 0,
+ "w": 1920,
+ "h": 720
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "rse2",
+ "screens": [
+ {
+ "id": 0,
+ "areas": [
+ {
+ "name": "rse2.normal.full",
+ "rect": {
+ "x": 0,
+ "y": 0,
+ "w": 1920,
+ "h": 720
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "hud",
+ "screens": [
+ {
+ "id": 0,
+ "areas": [
+ {
+ "name": "hud.normal.full",
+ "rect": {
+ "x": 0,
+ "y": 0,
+ "w": 1920,
+ "h": 720
+ }
+ },
+ {
+ "name": "hud.upper.left",
+ "rect": {
+ "x": 0,
+ "y": 0,
+ "w": 480,
+ "h": 180
+ }
+ }
+ ]
+ }
+ ]
+ },
+ ]
+}
diff --git a/src/config/connection.json b/src/config/connection.json
new file mode 100644
index 0000000..18dc7ad
--- /dev/null
+++ b/src/config/connection.json
@@ -0,0 +1,48 @@
+{
+ "screen_name": "master",
+ "wm_port": 54400,
+ "areas": [
+ {
+ "area_name": "fullscreen",
+ "transmitter_port": 54401,
+ "width": 1920,
+ "height": 1080
+ }
+ ],
+ "connections": [
+ {
+ "screen_name": "slave",
+ "ip": "192.168.200.101",
+ "wm_port": 54410,
+ "master_mode": false,
+ "areas": [
+ {
+ "area_name": "split.sub",
+ "transmitter_port": 54411,
+ "width": 640,
+ "height": 720
+ }
+ ]
+ },
+ {
+ "screen_name": "hud",
+ "ip": "192.168.200.102",
+ "wm_port": 54420,
+ "master_mode": false,
+ "areas": [
+ {
+ "area_name": "fullscreen",
+ "transmitter_port": 54421,
+ "width": 1920,
+ "height": 1080
+ },
+ {
+ "area_name": "leftup",
+ "transmitter_port": 54422,
+ "width": 640,
+ "height": 720
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/config/old_roles.json b/src/config/old_roles.json
new file mode 100644
index 0000000..02a4c2d
--- /dev/null
+++ b/src/config/old_roles.json
@@ -0,0 +1,68 @@
+{
+ "old_roles": [
+ {
+ "name": "HomeScreen",
+ "new": "homescreen"
+ },
+ {
+ "name": "Music",
+ "new": "music"
+ },
+ {
+ "name": "MediaPlayer",
+ "new": "music"
+ },
+ {
+ "name": "Video",
+ "new": "video"
+ },
+ {
+ "name": "VideoPlayer",
+ "new": "video"
+ },
+ {
+ "name": "WebBrowser",
+ "new": "browser"
+ },
+ {
+ "name": "Radio",
+ "new": "radio"
+ },
+ {
+ "name": "Phone",
+ "new": "phone"
+ },
+ {
+ "name": "Navigation",
+ "new": "map"
+ },
+ {
+ "name": "HVAC",
+ "new": "hvac"
+ },
+ {
+ "name": "Settings",
+ "new": "settings"
+ },
+ {
+ "name": "Dashboard",
+ "new": "dashboard"
+ },
+ {
+ "name": "POI",
+ "new": "poi"
+ },
+ {
+ "name": "Mixer",
+ "new": "mixer"
+ },
+ {
+ "name": "Restriction",
+ "new": "restriction"
+ },
+ {
+ "name": "^OnScreen.*",
+ "new": "on_screen"
+ }
+ ]
+}
diff --git a/src/config/timeout.json b/src/config/timeout.json
new file mode 100644
index 0000000..a3e4419
--- /dev/null
+++ b/src/config/timeout.json
@@ -0,0 +1,4 @@
+{
+ "times": 60000,
+ "sleep": 50
+}
diff --git a/src/config/weston.json b/src/config/weston.json
new file mode 100644
index 0000000..44e379c
--- /dev/null
+++ b/src/config/weston.json
@@ -0,0 +1,4 @@
+{
+ "times": 60000,
+ "sleep": 50
+}
diff --git a/src/json_helper.cpp b/src/json_helper.cpp
index 72ae36a..d9cf5eb 100644
--- a/src/json_helper.cpp
+++ b/src/json_helper.cpp
@@ -69,6 +69,18 @@ int getIntFromJson(json_object *obj, const char *key)
return json_object_get_int(tmp);
}
+double getDoubleFromJson(json_object *obj, const char *key)
+{
+ json_object *tmp;
+ if (!json_object_object_get_ex(obj, key, &tmp))
+ {
+ HMI_DEBUG("Not found key \"%s\"", key);
+ return 0;
+ }
+
+ return json_object_get_double(tmp);
+}
+
json_bool getBoolFromJson(json_object *obj, const char *key)
{
json_object *tmp;
diff --git a/src/json_helper.hpp b/src/json_helper.hpp
index 6ccbcc1..d4ae85a 100644
--- a/src/json_helper.hpp
+++ b/src/json_helper.hpp
@@ -21,12 +21,12 @@
#include <vector>
struct json_object;
-
json_object *to_json(std::vector<uint32_t> const &v);
namespace jh {
const char* getStringFromJson(json_object* obj, const char* key);
int getIntFromJson(json_object *obj, const char *key);
+double getDoubleFromJson(json_object *obj, const char *key);
json_bool getBoolFromJson(json_object *obj, const char *key);
int inputJsonFilie(const char* file, json_object** obj);
} // namespace jh
diff --git a/src/low_can_client.cpp b/src/low_can_client.cpp
new file mode 100644
index 0000000..090aa14
--- /dev/null
+++ b/src/low_can_client.cpp
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2018 TOYOTA MOTOR CORPORATION
+ *
+ * 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 "low_can_client.hpp"
+#include "json_helper.hpp"
+#include "util.hpp"
+
+extern "C"
+{
+#include <afb/afb-binding.h>
+}
+
+namespace wm
+{
+
+LowCanClient::LowCanClient()
+ : vehicle_speed(0),
+ trans_gear_pos(0),
+ headlamp_status(FALSE),
+ parking_brake_status(TRUE),
+ accel_pedal_pos(0),
+ accel_pedal_stt(FALSE),
+ lightstatus_brake_status(TRUE),
+ is_changed_accel_pedal_stt(false)
+{
+}
+
+void LowCanClient::initialize()
+{
+ int ret;
+
+ // Require API "low-can"
+ ret = afb_daemon_require_api_v2("low-can", 1);
+ if (0 > ret)
+ {
+ HMI_INFO("Requirement API \"low-can\" failed");
+ return;
+ }
+
+ // Subscribe low-level-can
+ // low-can subscribe { "event": "vehicle.speed" }
+ // low-can subscribe { "event": "transmission_gear_position" }
+ // low-can subscribe { "event": "headlamp_status" }
+ // low-can subscribe { "event": "parking_brake_status" }
+ // low-can subscribe { "event": "accelerator.pedal.position" }
+ // low-can subscribe { "event": "lightstatus.brake" }
+ for (int i = SignalNoMin; i <= SignalNoMax; i++)
+ {
+ // Set Event
+ json_object *json_obj = json_object_new_object();
+ json_object_object_add(json_obj, "event",
+ json_object_new_string(this->kSignalName[i]));
+
+ // Set filter
+ if (0 != strcmp("", this->kFilterValue[i]))
+ {
+ json_object_object_add(json_obj, "filter",
+ json_tokener_parse(this->kFilterValue[i]));
+ }
+ HMI_DEBUG("subscribe message:%s", json_object_get_string(json_obj));
+
+ // Subscribe
+ afb_service_call("low-can", "subscribe", json_obj,
+ [](void *closure, int status, json_object *result) {
+ HMI_DEBUG("subscribe result:%s", json_object_get_string(result));
+ },
+ nullptr);
+ }
+
+ return;
+}
+
+const char *LowCanClient::analyzeCanSignal(struct json_object *object)
+{
+ HMI_DEBUG("object:%s", json_object_get_string(object));
+
+ const char *name = jh::getStringFromJson(object, "name");
+ HMI_DEBUG("CAN signal name:%s", name);
+
+ if (strstr(name, this->kSignalName[SignalNoVehicliSpeed]))
+ {
+ // Update vehicle speed
+ this->vehicle_speed = jh::getIntFromJson(object, "value");
+ HMI_DEBUG("Update vehicle speed:%d", this->vehicle_speed);
+ }
+ else if (strstr(name, this->kSignalName[SignalNoTransGearPos]))
+ {
+ // Update transmission gear position
+ this->trans_gear_pos = jh::getIntFromJson(object, "value");
+ HMI_DEBUG("Update transmission gear position:%d", this->trans_gear_pos);
+ }
+ else if (strstr(name, this->kSignalName[SignalNoHeadlame]))
+ {
+ // Update headlamp status
+ this->headlamp_status = jh::getBoolFromJson(object, "value");
+ HMI_DEBUG("Update headlamp status:%d", this->headlamp_status);
+ }
+ else if (strstr(name, this->kSignalName[SignalNoParkingBrake]))
+ {
+ // Update parking gear status
+ this->parking_brake_status = jh::getBoolFromJson(object, "value");
+ HMI_DEBUG("Update parking brake status:%d", this->parking_brake_status);
+ }
+ else if (strstr(name, this->kSignalName[SignalNoAccelPedalPos]))
+ {
+ // Clear flag for whether accel pedal state is changed
+ this->is_changed_accel_pedal_stt = false;
+
+ // Update accelerator pedal status
+ this->accel_pedal_pos = jh::getDoubleFromJson(object, "value");
+ HMI_DEBUG("Update accelerator pedal position:%lf", this->accel_pedal_pos);
+
+ bool accel_pedal_stt;
+ if (0 != this->accel_pedal_pos)
+ {
+ accel_pedal_stt = true;
+ }
+ else
+ {
+ accel_pedal_stt = false;
+ }
+
+ if (accel_pedal_stt != this->accel_pedal_stt)
+ {
+ this->is_changed_accel_pedal_stt = true;
+ this->accel_pedal_stt = accel_pedal_stt;
+ }
+ }
+ else if (strstr(name, this->kSignalName[SignalNoLightstatusBrake]))
+ {
+ // Update lightstatus brake status
+ this->lightstatus_brake_status = jh::getBoolFromJson(object, "value");
+ HMI_DEBUG("Update lightstatus brake status:%d", this->lightstatus_brake_status);
+ }
+
+ return name;
+}
+
+bool LowCanClient::isChangedAccelPedalState()
+{
+ return this->is_changed_accel_pedal_stt;
+}
+
+int LowCanClient::getCurrentTransGearState()
+{
+ return this->trans_gear_pos;
+}
+
+bool LowCanClient::getCurrentHeadlampState()
+{
+ return (bool)this->headlamp_status;
+}
+
+bool LowCanClient::getCurrentParkingBrakeState()
+{
+ return (bool)this->parking_brake_status;
+}
+
+double LowCanClient::getCurrentAccelPedalPosition()
+{
+ return this->accel_pedal_pos;
+}
+
+bool LowCanClient::getCurrentAccelPedalState()
+{
+ return this->accel_pedal_stt;
+}
+
+bool LowCanClient::getCurrentLightstatusBrakeState()
+{
+ return (bool)this->lightstatus_brake_status;
+}
+
+} // namespace wm
diff --git a/src/low_can_client.hpp b/src/low_can_client.hpp
new file mode 100644
index 0000000..9b7f509
--- /dev/null
+++ b/src/low_can_client.hpp
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+ *
+ * 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 TMCAGLWM_LOW_CAN_CLIENT_HPP
+#define TMCAGLWM_LOW_CAN_CLIENT_HPP
+
+#include <string>
+#include <vector>
+#include <json-c/json.h>
+
+namespace wm
+{
+
+class LowCanClient
+{
+
+ public:
+ explicit LowCanClient();
+ ~LowCanClient() = default;
+
+ enum SignalNo
+ {
+ SignalNoVehicliSpeed = 0,
+ SignalNoTransGearPos,
+ SignalNoHeadlame,
+ SignalNoParkingBrake,
+ SignalNoAccelPedalPos,
+ SignalNoLightstatusBrake,
+
+ SignalNum,
+
+ SignalNoMin = SignalNoVehicliSpeed,
+ SignalNoMax = SignalNum - 1,
+ };
+
+ const std::vector<const char *> kSignalName{
+ "vehicle.speed",
+ "transmission_gear_position",
+ "headlamp_status",
+ "parking_brake_status",
+ "accelerator.pedal.position",
+ "lightstatus.brake",
+ };
+
+ void initialize();
+ const char *analyzeCanSignal(struct json_object *object);
+
+ int getCurrentTransGearState();
+ bool getCurrentHeadlampState();
+ bool getCurrentParkingBrakeState();
+ double getCurrentAccelPedalPosition();
+ bool getCurrentAccelPedalState();
+ bool getCurrentLightstatusBrakeState();
+
+ bool isChangedAccelPedalState();
+
+ private:
+ // Disable copy and move
+ LowCanClient(LowCanClient const &) = delete;
+ LowCanClient &operator=(LowCanClient const &) = delete;
+ LowCanClient(LowCanClient &&) = delete;
+ LowCanClient &operator=(LowCanClient &&) = delete;
+
+ enum TransGearPosVal
+ {
+ TransGearPosValD1 = 1,
+ TransGearPosValD2,
+ TransGearPosValD3,
+ TransGearPosValD4,
+ TransGearPosValD5,
+ TransGearPosValD6,
+ TransGearPosValD7,
+ TransGearPosValD8,
+ TransGearPosValR,
+ TransGearPosValN,
+ };
+
+ const std::vector<const char *> kFilterValue{
+ "", // vehicle.speed
+ "", // transmission_gear_position
+ "", // headlamp_status
+ "", // parking_brake_status
+ "", // accelerator.pedal.position
+ "", // lightstatus.brake
+ };
+
+ int vehicle_speed;
+ int trans_gear_pos;
+ json_bool headlamp_status;
+ json_bool parking_brake_status;
+ double accel_pedal_pos;
+ bool accel_pedal_stt;
+ json_bool lightstatus_brake_status;
+
+ bool is_changed_accel_pedal_stt;
+};
+
+} // namespace wm
+
+#endif // TMCAGLWM_LOW_CAN_CLIENT_HPP
diff --git a/src/main.cpp b/src/main.cpp
index 6483655..6fff161 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -18,6 +18,9 @@
#include <algorithm>
#include <mutex>
#include <json.h>
+#include <stdlib.h>
+#include <vector>
+#include "util.hpp"
#include "window_manager.hpp"
#include "json_helper.hpp"
@@ -56,7 +59,7 @@ int afb_instance::init()
return this->wmgr.init();
}
-static int _binding_init()
+int _binding_init()
{
HMI_NOTICE("WinMan ver. %s", WINMAN_VERSION_STRING);
@@ -78,7 +81,7 @@ error:
return -1;
}
-static int binding_init (afb_api_t api) noexcept
+int binding_init() noexcept
{
try
{
@@ -110,20 +113,21 @@ static void cbRemoveClientCtxt(void *data)
delete ctxt;
}
-static void createSecurityContext(afb_req_t req, const char* appid, const char* role)
+static void createSecurityContext(afb_req req, const char* appid, const char* role)
{
WMClientCtxt *ctxt = (WMClientCtxt *)afb_req_context_get(req);
if (!ctxt)
{
// Create Security Context at first time
- WMClientCtxt *ctxt = new WMClientCtxt(appid, role);
+ const char *new_role = g_afb_instance->wmgr.convertRoleOldToNew(role);
+ WMClientCtxt *ctxt = new WMClientCtxt(appid, new_role);
HMI_DEBUG("create session for %s", ctxt->name.c_str());
afb_req_session_set_LOA(req, 1);
afb_req_context_set(req, ctxt, cbRemoveClientCtxt);
}
}
-void windowmanager_requestsurface(afb_req_t req) noexcept
+void windowmanager_requestsurface(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
if (g_afb_instance == nullptr)
@@ -169,7 +173,7 @@ void windowmanager_requestsurface(afb_req_t req) noexcept
}
}
-void windowmanager_requestsurfacexdg(afb_req_t req) noexcept
+void windowmanager_requestsurfacexdg(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
if (g_afb_instance == nullptr)
@@ -222,7 +226,50 @@ void windowmanager_requestsurfacexdg(afb_req_t req) noexcept
}
}
-void windowmanager_activatewindow(afb_req_t req) noexcept
+void windowmanager_setrole(afb_req req) noexcept
+{
+ std::lock_guard<std::mutex> guard(binding_m);
+ if (g_afb_instance == nullptr)
+ {
+ afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
+ return;
+ }
+ try
+ {
+ json_object *jreq = afb_req_json(req);
+
+ json_object *j_role = nullptr;
+ if (!json_object_object_get_ex(jreq, "role", &j_role))
+ {
+ afb_req_fail(req, "failed", "Need char const* argument role");
+ return;
+ }
+ char const *a_role = json_object_get_string(j_role);
+ char *appid = afb_req_get_application_id(req);
+
+ if(appid)
+ {
+ auto ret = g_afb_instance->wmgr.api_set_role(appid, a_role);
+ if (!ret)
+ {
+ afb_req_fail(req, "failed", "Couldn't register");
+ }
+ else
+ {
+ createSecurityContext(req, appid, a_role);
+ afb_req_success(req, NULL, "success");
+ }
+ free(appid);
+ }
+ }
+ catch (std::exception &e)
+ {
+ afb_req_fail_f(req, "failed", "Uncaught exception while calling requestsurfacexdg: %s", e.what());
+ return;
+ }
+}
+
+void windowmanager_activatewindow(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
if (g_afb_instance == nullptr)
@@ -250,17 +297,40 @@ void windowmanager_activatewindow(afb_req_t req) noexcept
char* appid = afb_req_get_application_id(req);
if(appid)
{
- g_afb_instance->wmgr.api_activate_window(
- appid, a_drawing_name, a_drawing_area,
- [&req](const char *errmsg) {
- if (errmsg != nullptr)
- {
- HMI_ERROR(errmsg);
- afb_req_fail(req, "failed", errmsg);
- return;
- }
- afb_req_success(req, NULL, "success");
- });
+ auto reply = [&req](const char *errmsg) {
+ if (errmsg != nullptr)
+ {
+ HMI_ERROR(errmsg);
+ afb_req_fail(req, "failed", errmsg);
+ return;
+ }
+ afb_req_success(req, NULL, "success");
+ };
+
+ if (!g_afb_instance->wmgr.wmcon.isRemoteArea(a_drawing_area))
+ {
+ g_afb_instance->wmgr.api_activate_window(
+ appid, a_drawing_name, a_drawing_area, reply);
+ }
+ else
+ {
+ std::string ecu_name;
+ ecu_name = g_afb_instance->wmgr.wmcon.getAreaToEcuName(a_drawing_area);
+
+ // TODO: temporarily
+ if (!g_afb_instance->wmgr.wmcon.isConnectionMode())
+ {
+ HMI_ERROR("WM Standalone Mode");
+ afb_req_fail(req, "failed", "Standalone Mode");
+ }
+ else
+ {
+ // If Window Manager is slave and this request is for master,
+ // request activateWindow to master
+ g_afb_instance->wmgr.api_activate_surface_to_master(
+ appid, a_drawing_name, a_drawing_area, reply);
+ }
+ }
free(appid);
}
}
@@ -272,7 +342,7 @@ void windowmanager_activatewindow(afb_req_t req) noexcept
}
}
-void windowmanager_deactivatewindow(afb_req_t req) noexcept
+void windowmanager_deactivatewindow(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
if (g_afb_instance == nullptr)
@@ -293,17 +363,30 @@ void windowmanager_deactivatewindow(afb_req_t req) noexcept
char* appid = afb_req_get_application_id(req);
if(appid)
{
- g_afb_instance->wmgr.api_deactivate_window(
- appid, a_drawing_name,
- [&req](const char *errmsg) {
- if (errmsg != nullptr)
- {
- HMI_ERROR(errmsg);
- afb_req_fail(req, "failed", errmsg);
- return;
- }
- afb_req_success(req, NULL, "success");
- });
+ auto reply = [&req](const char *errmsg) {
+ if (errmsg != nullptr)
+ {
+ HMI_ERROR(errmsg);
+ afb_req_fail(req, "failed", errmsg);
+ return;
+ }
+ afb_req_success(req, NULL, "success");
+ };
+
+ // TODO: Check whether role is tbtnavi to request remote invisible
+ if (g_afb_instance->wmgr.wmcon.getAppIdToEcuName(appid) == "" ||
+ ("tbtnavi" != std::string(a_drawing_name)))
+ {
+ g_afb_instance->wmgr.api_deactivate_window(
+ appid, a_drawing_name, reply);
+ }
+ else
+ {
+ // If Window Manager is slave and this request is for master,
+ // request deactivateWindow to master
+ g_afb_instance->wmgr.api_deactivate_surface_to_master(
+ appid, a_drawing_name, reply);
+ }
free(appid);
}
}
@@ -315,7 +398,7 @@ void windowmanager_deactivatewindow(afb_req_t req) noexcept
}
}
-void windowmanager_enddraw(afb_req_t req) noexcept
+void windowmanager_enddraw(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
if (g_afb_instance == nullptr)
@@ -337,8 +420,18 @@ void windowmanager_enddraw(afb_req_t req) noexcept
char* appid = afb_req_get_application_id(req);
if(appid)
{
- g_afb_instance->wmgr.api_enddraw(appid, a_drawing_name);
- free(appid);
+ if (g_afb_instance->wmgr.wmcon.getAppIdToEcuName(appid) == "" ||
+ !g_afb_instance->wmgr.wmcon.isSyncDrawingForRemote(appid))
+ {
+ g_afb_instance->wmgr.api_enddraw(appid, a_drawing_name);
+ }
+ else
+ {
+ // If Window Manager is slave and requesting app is syncDrawing,
+ // request endDraw to master
+ g_afb_instance->wmgr.api_enddraw_for_remote(appid, a_drawing_name);
+ }
+ free(appid);
}
}
catch (std::exception &e)
@@ -349,7 +442,7 @@ void windowmanager_enddraw(afb_req_t req) noexcept
}
}
-void windowmanager_getdisplayinfo_thunk(afb_req_t req) noexcept
+void windowmanager_getdisplayinfo_thunk(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
if (g_afb_instance == nullptr)
@@ -376,7 +469,7 @@ void windowmanager_getdisplayinfo_thunk(afb_req_t req) noexcept
}
}
-void windowmanager_getareainfo_thunk(afb_req_t req) noexcept
+void windowmanager_getareainfo_thunk(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
if (g_afb_instance == nullptr)
@@ -413,14 +506,132 @@ void windowmanager_getareainfo_thunk(afb_req_t req) noexcept
}
}
-void windowmanager_get_area_list(afb_req_t req) noexcept
+void windowmanager_getcarinfo_thunk(afb_req req) noexcept
+{
+ std::lock_guard<std::mutex> guard(binding_m);
+ if (g_afb_instance == nullptr)
+ {
+ afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
+ return;
+ }
+
+ try
+ {
+ json_object *jreq = afb_req_json(req);
+
+ json_object *j_label = nullptr;
+ if (! json_object_object_get_ex(jreq, "label", &j_label))
+ {
+ afb_req_fail(req, "failed", "Need char const* argument label");
+ return;
+ }
+ char const* a_label = json_object_get_string(j_label);
+
+ auto ret = g_afb_instance->wmgr.api_get_car_info(a_label);
+ if (ret.is_err())
+ {
+ afb_req_fail(req, "failed", ret.unwrap_err());
+ return;
+ }
+
+ afb_req_success(req, ret.unwrap(), "success");
+ }
+ catch (std::exception &e)
+ {
+ afb_req_fail_f(req, "failed", "Uncaught exception while calling getcarinfo: %s", e.what());
+ return;
+ }
+}
+
+void windowmanager_set_render_order(afb_req req) noexcept
+{
+ std::lock_guard<std::mutex> guard(binding_m);
+ if (g_afb_instance == nullptr)
+ {
+ afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
+ return;
+ }
+
+ char* appid = afb_req_get_application_id(req);
+ if(appid)
+ {
+ json_object *jreq = afb_req_json(req);
+ json_object *j_ro; // Do not free this. binder frees jreq, then free j_ro
+ if (json_object_object_get_ex(jreq, "render_order", &j_ro))
+ {
+ int size = json_object_array_length(j_ro);
+ std::vector<std::string> ro(size);
+ for(int i = 0; i < size; i++)
+ {
+ ro[i] = json_object_get_string(json_object_array_get_idx(j_ro, i));
+ }
+
+ auto ret = g_afb_instance->wmgr.api_client_set_render_order(appid, ro);
+ if (!ret)
+ {
+ afb_req_fail(req, "failed", nullptr);
+ }
+ else
+ {
+ afb_req_success(req, nullptr, nullptr);
+ }
+ }
+ free(appid);
+ }
+ else
+ {
+ afb_req_fail(req, "failed", nullptr);
+ }
+}
+
+void windowmanager_attach_app(afb_req req) noexcept
+{
+ std::lock_guard<std::mutex> guard(binding_m);
+ if (g_afb_instance == nullptr)
+ {
+ afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
+ return;
+ }
+
+ char* appid = afb_req_get_application_id(req);
+ if(appid)
+ {
+ json_object *jreq = afb_req_json(req);
+ json_object *j_dest, *j_id; // Do not free this. binder frees jreq, then free j_ro
+ if (json_object_object_get_ex(jreq, "destination", &j_dest) &&
+ json_object_object_get_ex(jreq, "service_surface", &j_id))
+ {
+ const char* dest_app = json_object_get_string(j_dest);
+ const char* service = json_object_get_string(j_id);
+
+ std::string uuid = g_afb_instance->wmgr.api_client_attach_service_surface(appid, dest_app, service);
+ if (uuid.empty())
+ {
+ afb_req_fail(req, "failed", nullptr);
+ }
+ else
+ {
+ json_object *resp = json_object_new_object();
+ json_object_object_add(resp, "uuid", json_object_new_string(uuid.c_str()));
+ afb_req_success(req, resp, nullptr);
+ }
+ }
+ free(appid);
+ }
+ else
+ {
+ afb_req_fail(req, "failed", nullptr);
+ }
+}
+
+void windowmanager_get_area_list(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
json_object* ret = g_afb_instance->wmgr.api_get_area_list();
afb_req_success(req, ret, nullptr);
}
-void windowmanager_change_area_size(afb_req_t req) noexcept
+void windowmanager_change_area_size(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
if (g_afb_instance == nullptr)
@@ -480,7 +691,7 @@ void windowmanager_change_area_size(afb_req_t req) noexcept
}
}
-void windowmanager_wm_subscribe(afb_req_t req) noexcept
+void windowmanager_wm_subscribe(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
if (g_afb_instance == nullptr)
@@ -498,15 +709,20 @@ void windowmanager_wm_subscribe(afb_req_t req) noexcept
afb_req_fail(req, "failed", "Need char const* argument event");
return;
}
- wm::WindowManager::EventType event_id = (wm::WindowManager::EventType)json_object_get_int(j);
- bool ret = g_afb_instance->wmgr.api_subscribe(req, event_id);
+ int event_id = json_object_get_int(j);
+ int ret = g_afb_instance->wmgr.api_subscribe(req, event_id);
- if (!ret)
+ if (ret)
{
afb_req_fail(req, "failed", "Error: afb_req_subscribe()");
return;
}
afb_req_success(req, NULL, "success");
+
+ if (event_id == g_afb_instance->wmgr.Event_Handshake)
+ {
+ g_afb_instance->wmgr.api_handshake();
+ }
}
catch (std::exception &e)
{
@@ -515,7 +731,24 @@ void windowmanager_wm_subscribe(afb_req_t req) noexcept
}
}
-void windowmanager_ping(afb_req_t req) noexcept
+void windowmanager_connect(afb_req req) noexcept
+{
+ std::lock_guard<std::mutex> guard(binding_m);
+
+ HMI_DEBUG("WM - HS Connect");
+
+ if (g_afb_instance == nullptr)
+ {
+ afb_req_fail(req, "Failed", "Not Start WindowManager");
+ return;
+ }
+ else
+ {
+ afb_req_success(req, NULL, "success");
+ }
+}
+
+void windowmanager_ping(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
@@ -530,7 +763,7 @@ void windowmanager_ping(afb_req_t req) noexcept
}
}
-void windowmanager_debug_terminate(afb_req_t req) noexcept
+void windowmanager_debug_terminate(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
if (g_afb_instance == nullptr)
@@ -557,32 +790,30 @@ void windowmanager_debug_terminate(afb_req_t req) noexcept
}
}
-const afb_verb_t windowmanager_verbs[] = {
- { .verb = "requestSurface", .callback = windowmanager_requestsurface },
- { .verb = "requestSurfaceXDG", .callback = windowmanager_requestsurfacexdg },
- { .verb = "activateWindow", .callback = windowmanager_activatewindow },
- { .verb = "deactivateWindow", .callback = windowmanager_deactivatewindow },
- { .verb = "endDraw", .callback = windowmanager_enddraw },
- { .verb = "getDisplayInfo", .callback = windowmanager_getdisplayinfo_thunk },
- { .verb = "getAreaInfo", .callback = windowmanager_getareainfo_thunk },
- { .verb = "changeAreaSize", .callback = windowmanager_change_area_size },
- { .verb = "getAreaList", .callback = windowmanager_get_area_list },
- { .verb = "wm_subscribe", .callback = windowmanager_wm_subscribe },
- { .verb = "ping", .callback = windowmanager_ping },
- { .verb = "debug_terminate", .callback = windowmanager_debug_terminate },
- {} };
-
-extern "C" const afb_binding_t afbBindingExport = {
- .api = "windowmanager",
- .specification = "windowmanager",
- .info = "windowmanager",
- .verbs = windowmanager_verbs,
- .preinit = nullptr,
- .init = binding_init,
- .onevent = nullptr,
- .userdata = nullptr,
- .provide_class = nullptr,
- .require_class = nullptr,
- .require_api = nullptr,
- .noconcurrency = 0
-};
+void on_event(const char *event, struct json_object *object)
+{
+ g_afb_instance->wmgr.analyzeReceivedEvent(event, object);
+}
+
+const struct afb_verb_v2 windowmanager_verbs[] = {
+ {"requestSurface", windowmanager_requestsurface, nullptr, nullptr, AFB_SESSION_NONE},
+ {"requestSurfaceXdg", windowmanager_requestsurfacexdg, nullptr, nullptr, AFB_SESSION_NONE},
+ {"setRole", windowmanager_setrole, nullptr, nullptr, AFB_SESSION_NONE},
+ {"activateWindow", windowmanager_activatewindow, nullptr, nullptr, AFB_SESSION_NONE},
+ {"deactivateWindow", windowmanager_deactivatewindow, nullptr, nullptr, AFB_SESSION_NONE},
+ {"endDraw", windowmanager_enddraw, nullptr, nullptr, AFB_SESSION_NONE},
+ {"getDisplayInfo", windowmanager_getdisplayinfo_thunk, nullptr, nullptr, AFB_SESSION_NONE},
+ {"getAreaInfo", windowmanager_getareainfo_thunk, nullptr, nullptr, AFB_SESSION_NONE},
+ {"getCarInfo", windowmanager_getcarinfo_thunk, nullptr, nullptr, AFB_SESSION_NONE },
+ {"setRenderOrder", windowmanager_set_render_order, nullptr, nullptr, AFB_SESSION_NONE},
+ {"changeAreaSize", windowmanager_change_area_size, nullptr, nullptr, AFB_SESSION_NONE},
+ {"getAreaList", windowmanager_get_area_list, nullptr, nullptr, AFB_SESSION_NONE},
+ {"attachApp", windowmanager_attach_app, nullptr, nullptr, AFB_SESSION_NONE},
+ {"wm_subscribe", windowmanager_wm_subscribe, nullptr, nullptr, AFB_SESSION_NONE},
+ {"wm_connect", windowmanager_connect, nullptr, nullptr, AFB_SESSION_NONE},
+ {"ping", windowmanager_ping, nullptr, nullptr, AFB_SESSION_NONE},
+ {"debug_terminate", windowmanager_debug_terminate, nullptr, nullptr, AFB_SESSION_NONE},
+ {}};
+
+extern "C" const struct afb_binding_v2 afbBindingV2 = {
+ "windowmanager", nullptr, nullptr, windowmanager_verbs, nullptr, binding_init, on_event, 0};
diff --git a/src/pm_wrapper.cpp b/src/pm_wrapper.cpp
index 8706128..7cf90f0 100644
--- a/src/pm_wrapper.cpp
+++ b/src/pm_wrapper.cpp
@@ -43,14 +43,14 @@ static void onError(json_object *json_out)
PMWrapper::PMWrapper() {}
-int PMWrapper::initialize()
+int PMWrapper::initialize(std::string ecu_name)
{
int ret = 0;
- ret = this->pm.initialize();
+ ret = this->pm.initialize(ecu_name);
if (0 > ret)
{
- HMI_ERROR("Faild to initialize PolicyManager");
+ HMI_ERROR("wm:pmw", "Faild to initialize PolicyManager");
}
g_context = this;
@@ -81,7 +81,39 @@ int PMWrapper::setInputEventData(Task task, std::string role, std::string area)
{
event = "deactivate";
}
- else
+ else if (Task::TASK_PARKING_BRAKE_OFF == task)
+ {
+ event = "parking_brake_off";
+ }
+ else if (Task::TASK_PARKING_BRAKE_ON == task)
+ {
+ event = "parking_brake_on";
+ }
+ else if (Task::TASK_ACCEL_PEDAL_OFF == task)
+ {
+ event = "accel_pedal_off";
+ }
+ else if (Task::TASK_ACCEL_PEDAL_ON == task)
+ {
+ event = "accel_pedal_on";
+ }
+ else if (Task::TASK_HEDLAMP_OFF == task)
+ {
+ event = "headlamp_off";
+ }
+ else if (Task::TASK_HEDLAMP_ON == task)
+ {
+ event = "headlamp_on";
+ }
+ else if (Task::TASK_LIGHTSTATUS_BRAKE_OFF == task)
+ {
+ event = "lightstatus_brake_off";
+ }
+ else if (Task::TASK_LIGHTSTATUS_BRAKE_ON == task)
+ {
+ event = "lightstatus_brake_on";
+ }
+ else
{
event = "";
}
@@ -95,7 +127,7 @@ int PMWrapper::setInputEventData(Task task, std::string role, std::string area)
ret = this->pm.setInputEventData(json_in);
if (0 > ret)
{
- HMI_ERROR("Faild to set input event data to PolicyManager");
+ HMI_ERROR("wm:pmw", "Faild to set input event data to PolicyManager");
}
json_object_put(json_in);
@@ -108,7 +140,7 @@ int PMWrapper::executeStateTransition()
ret = this->pm.executeStateTransition();
if (0 > ret)
{
- HMI_ERROR("Failed to execute state transition for PolicyManager");
+ HMI_ERROR("wm:pmw", "Failed to execute state transition for PolicyManager");
}
return ret;
@@ -127,11 +159,151 @@ void PMWrapper::updateStates(json_object *json_out)
HMI_DEBUG("json_out dump:%s", json_object_get_string(json_out));
+ this->createCarStateChangeAction(json_out, actions);
this->createLayoutChangeAction(json_out, actions);
this->on_state_transitioned(actions);
}
+void PMWrapper::createCarStateChangeAction(json_object *json_out, std::vector<WMAction> &actions)
+{
+ json_object *json_car_ele;
+ if (!json_object_object_get_ex(json_out, "car_elements", &json_car_ele))
+ {
+ HMI_DEBUG("Not found key \"car_elements\"");
+ return;
+ }
+
+ int len = json_object_array_length(json_car_ele);
+ HMI_DEBUG("json_car_ele len:%d", len);
+
+ for (int i = 0; i < len; i++)
+ {
+ json_object *json_tmp = json_object_array_get_idx(json_car_ele, i);
+
+ std::string car_ele_name = jh::getStringFromJson(json_tmp, "name");
+ std::string state = jh::getStringFromJson(json_tmp, "state");
+ json_bool changed = jh::getBoolFromJson(json_tmp, "changed");
+ HMI_DEBUG("car_element:%s changed:%d", car_ele_name.c_str(), changed);
+
+ if (changed)
+ {
+ TaskCarState task = TaskCarState::NO_TASK;
+ if ("parking_brake" == car_ele_name)
+ {
+ if ("off" == state)
+ {
+ task = TaskCarState::PARKING_BRAKE_OFF;
+ }
+ else if ("on" == state)
+ {
+ task = TaskCarState::PARKING_BRAKE_ON;
+ }
+ else
+ {
+ HMI_DEBUG("Unknown parking brake state: %s", state.c_str());
+ }
+ }
+ else if ("accel_pedal" == car_ele_name)
+ {
+ if ("off" == state)
+ {
+ task = TaskCarState::ACCEL_PEDAL_OFF;
+ }
+ else if ("on" == state)
+ {
+ task = TaskCarState::ACCEL_PEDAL_ON;
+ }
+ else
+ {
+ HMI_DEBUG("Unknown accel pedal state: %s", state.c_str());
+ }
+ }
+ else if ("lamp" == car_ele_name)
+ {
+ if ("off" == state)
+ {
+ task = TaskCarState::HEDLAMP_OFF;
+ }
+ else if ("on" == state)
+ {
+ task = TaskCarState::HEDLAMP_ON;
+ }
+ else
+ {
+ HMI_DEBUG("Unknown lamp state: %s", state.c_str());
+ }
+ }
+ else if ("lightstatus_brake" == car_ele_name)
+ {
+ if ("off" == state)
+ {
+ task = TaskCarState::LIGHTSTATUS_BRAKE_OFF;
+ }
+ else if ("on" == state)
+ {
+ task = TaskCarState::LIGHTSTATUS_BRAKE_ON;
+ }
+ else
+ {
+ HMI_DEBUG("Unknown lightstatus brake state: %s", state.c_str());
+ }
+ }
+ else if ("running" == car_ele_name)
+ {
+ if ("stop" == state)
+ {
+ task = TaskCarState::CAR_STOP;
+ }
+ else if ("run" == state)
+ {
+ task = TaskCarState::CAR_RUN;
+ }
+ else
+ {
+ HMI_DEBUG("Unknown car state: %s", state.c_str());
+ }
+ }
+ else if ("restriction_mode" == car_ele_name)
+ {
+ if ("off" == state)
+ {
+ task = TaskCarState::RESTRICTION_MODE_OFF;
+ }
+ else if ("on" == state)
+ {
+ task = TaskCarState::RESTRICTION_MODE_ON;
+ }
+ else
+ {
+ HMI_DEBUG("Unknown car state: %s", state.c_str());
+ }
+ }
+ else
+ {
+ HMI_DEBUG("Unknown car element: %s", car_ele_name.c_str());
+ }
+
+ // Set action
+ if (TaskCarState::NO_TASK != task)
+ {
+ bool end_draw_finished = true;
+ WMAction act
+ {
+ 0,
+ nullptr,
+ "",
+ "",
+ TaskVisible::NO_CHANGE,
+ end_draw_finished,
+ task
+ };
+ actions.push_back(act);
+ }
+ }
+ }
+}
+
void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vector<WMAction> &actions)
{
// Get displayed roles from previous layout
@@ -197,7 +369,8 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vector<WMAc
role_name,
area_name,
TaskVisible::VISIBLE,
- end_draw_finished
+ end_draw_finished,
+ TaskCarState::NO_TASK
};
actions.push_back(act);
}
@@ -220,7 +393,8 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vector<WMAc
role_name,
area_name,
TaskVisible::VISIBLE,
- end_draw_finished
+ end_draw_finished,
+ TaskCarState::NO_TASK
};
actions.push_back(act);
}
@@ -245,7 +419,8 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vector<WMAc
i_prv.first,
"",
TaskVisible::INVISIBLE,
- end_draw_finished
+ end_draw_finished,
+ TaskCarState::NO_TASK
};
actions.push_back(act);
}
diff --git a/src/pm_wrapper.hpp b/src/pm_wrapper.hpp
index 31ec002..84d68df 100644
--- a/src/pm_wrapper.hpp
+++ b/src/pm_wrapper.hpp
@@ -41,7 +41,7 @@ class PMWrapper
using StateTransitionHandler = std::function<void(std::vector<WMAction>)>;
using ErrorHandler = std::function<void(void)>;
- int initialize();
+ int initialize(std::string ecu_name);
void registerCallback(StateTransitionHandler on_state_transitioned,
ErrorHandler on_error);
int setInputEventData(Task task, std::string role, std::string area);
@@ -67,6 +67,7 @@ class PMWrapper
std::map<std::string, RoleState> prvlayer2rolestate;
std::map<std::string, RoleState> crrlayer2rolestate;
+ void createCarStateChangeAction(json_object *json_out, std::vector<WMAction> &actions);
void createLayoutChangeAction(json_object *json_out, std::vector<WMAction> &actions);
};
diff --git a/src/request.cpp b/src/request.cpp
index 069f8ff..0d8e5d4 100644
--- a/src/request.cpp
+++ b/src/request.cpp
@@ -30,6 +30,13 @@ WMRequest::WMRequest(string appid, string role, string area, Task task)
{
}
+WMRequest::WMRequest(Task task)
+ : req_num(0),
+ trigger{"", "", "", task},
+ sync_draw_req(0)
+{
+}
+
WMRequest::~WMRequest()
{
}
@@ -41,4 +48,4 @@ WMRequest::WMRequest(const WMRequest &obj)
this->sync_draw_req = obj.sync_draw_req;
}
-} // namespace wm \ No newline at end of file
+} // namespace wm
diff --git a/src/request.hpp b/src/request.hpp
index 0f0e199..9827627 100644
--- a/src/request.hpp
+++ b/src/request.hpp
@@ -31,6 +31,16 @@ enum Task
TASK_ALLOCATE,
TASK_RELEASE,
TASK_CHANGE_AREA,
+ TASK_PARKING_BRAKE_OFF,
+ TASK_PARKING_BRAKE_ON,
+ TASK_ACCEL_PEDAL_OFF,
+ TASK_ACCEL_PEDAL_ON,
+ TASK_HEDLAMP_OFF,
+ TASK_HEDLAMP_ON,
+ TASK_LIGHTSTATUS_BRAKE_OFF,
+ TASK_LIGHTSTATUS_BRAKE_ON,
+ TASK_RESTRICTION_MODE_OFF,
+ TASK_RESTRICTION_MODE_ON,
TASK_INVALID
};
@@ -38,9 +48,30 @@ enum TaskVisible
{
VISIBLE,
INVISIBLE,
+ REQ_REMOTE_VISIBLE,
+ REQ_REMOTE_INVISIBLE,
+ REMOTE_VISIBLE,
+ REMOTE_INVISIBLE,
NO_CHANGE
};
+enum TaskCarState
+{
+ PARKING_BRAKE_OFF,
+ PARKING_BRAKE_ON,
+ ACCEL_PEDAL_OFF,
+ ACCEL_PEDAL_ON,
+ HEDLAMP_OFF,
+ HEDLAMP_ON,
+ LIGHTSTATUS_BRAKE_OFF,
+ LIGHTSTATUS_BRAKE_ON,
+ CAR_STOP,
+ CAR_RUN,
+ RESTRICTION_MODE_OFF,
+ RESTRICTION_MODE_ON,
+ NO_TASK,
+};
+
struct WMTrigger
{
std::string appid;
@@ -57,6 +88,7 @@ struct WMAction
std::string area;
TaskVisible visible;
bool end_draw_finished;
+ TaskCarState car_state;
};
struct WMRequest
@@ -64,6 +96,7 @@ struct WMRequest
WMRequest();
explicit WMRequest(std::string appid, std::string role,
std::string area, Task task);
+ explicit WMRequest(Task task);
virtual ~WMRequest();
WMRequest(const WMRequest &obj);
@@ -74,4 +107,4 @@ struct WMRequest
} // namespace wm
-#endif //WMREQUEST_HPP \ No newline at end of file
+#endif //WMREQUEST_HPP
diff --git a/src/util.cpp b/src/util.cpp
index 0591d55..7d000b8 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- * Copyright (c) 2018 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,11 +16,11 @@
#include "util.hpp"
+#include <sstream>
#include <time.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
-#include <fstream>
#include <unistd.h>
@@ -31,7 +30,7 @@ void rectangle::fit(unsigned long to_width, unsigned long to_height)
{
// fit rect within (to_width x to_height)
- if (to_width <= (unsigned long)width()) {
+ if (to_width <= width()) {
// scale to fit with
set_bottom(top() + (static_cast<long>(to_width) * height() / width()) - 1);
set_right(left() + to_width - 1);
@@ -143,38 +142,32 @@ void _DUMP(enum LOG_LEVEL level, const char *log, ...)
free(message);
}
-std::string get_file_path(const char *file_name, const char *root_path)
+std::vector<std::string> parseString(std::string str, char delimiter)
{
- char const *default_base_path = root_path;
- std::string path("");
-
- if(!file_name) {
- return path;
- }
-
- if (!default_base_path) {
- default_base_path = getenv("AFM_APP_INSTALL_DIR");
- if (!default_base_path) {
- HMI_ERROR("AFM_APP_INSTALL_DIR is not defined");
+ // Parse string by delimiter
+ std::vector<std::string> vct;
+ std::stringstream ss{str};
+ std::string buf;
+ while (std::getline(ss, buf, delimiter))
+ {
+ if (!buf.empty())
+ {
+ // Delete space and push back to vector
+ vct.push_back(deleteSpace(buf));
}
}
- if (default_base_path) {
- path = default_base_path;
- path.append("/etc/");
- path.append(file_name);
- }
+ return vct;
+}
- // Check for over-ride in /etc/xdg/windowmanager
- std::string override_path("/etc/xdg/windowmanager/");
- override_path.append(file_name);
- std::ifstream i(override_path);
- if (i.good()) {
- path = override_path;
+std::string deleteSpace(std::string str)
+{
+ std::string ret = str;
+ size_t pos;
+ while ((pos = ret.find_first_of(" ")) != std::string::npos)
+ {
+ ret.erase(pos, 1);
}
- i.close();
-
- HMI_INFO("Using %s", path.c_str());
- return path;
+ return ret;
}
void ChangeAreaReq::dump()
@@ -192,4 +185,4 @@ void ChangeAreaReq::dump()
DUMP("update change app : %s, area:%s", req.first.c_str(), req.second.c_str());
}
DUMP("======== dump end =========");
-}
+} \ No newline at end of file
diff --git a/src/util.hpp b/src/util.hpp
index 9540772..4c3870f 100644
--- a/src/util.hpp
+++ b/src/util.hpp
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- * Copyright (c) 2018 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +19,8 @@
#include <functional>
#include <thread>
+#include <string>
+#include <vector>
#include <unordered_map>
#include <sys/poll.h>
#include <string.h>
@@ -54,6 +55,9 @@ void _HMI_LOG(enum LOG_LEVEL level, const char* file, const char* func, const in
void _HMI_SEQ_LOG(enum LOG_LEVEL level, const char* file, const char* func, const int line, unsigned seq_num, const char* log, ...);
void _DUMP(enum LOG_LEVEL level, const char *log, ...);
+std::vector<std::string> parseString(std::string str, char delimiter);
+std::string deleteSpace(std::string str);
+
struct rect
{
int32_t w, h;
@@ -119,9 +123,6 @@ class rectangle
long _bottom;
};
-// Configuration file path helper
-std::string get_file_path(const char *file_name, const char *root_path = NULL);
-
typedef struct ChangeAreaReq {
std::string appname;
std::unordered_map<std::string, struct rect> area_req;
@@ -132,5 +133,4 @@ typedef struct ChangeAreaReq {
ChangeAreaReq(const ChangeAreaReq& val) = default;
void dump();
} ChangeAreaReq;
-
-#endif // WM_UTIL_HPP
+#endif // !WM_UTIL_HPP
diff --git a/src/window_manager.cpp b/src/window_manager.cpp
index f9070f6..1432769 100644
--- a/src/window_manager.cpp
+++ b/src/window_manager.cpp
@@ -26,6 +26,8 @@ extern "C"
#include <systemd/sd-event.h>
}
+#define WM_LASTMODE_PATH "/etc/lastmode.json"
+
using std::string;
using std::vector;
using std::unordered_map;
@@ -65,13 +67,33 @@ static const vector<string> kListEventName{
"syncDraw",
"flushDraw",
"screenUpdated",
+ "handshake",
+ "headlampOff",
+ "headlampOn",
+ "parkingBrakeOff",
+ "parkingBrakeOn",
+ "lightstatusBrakeOff",
+ "lightstatusBrakeOn",
+ "carStop",
+ "carRun",
"error"};
+static const char kPathOldRolesConfigFile[] = "/etc/old_roles.json";
static sd_event_source *g_timer_ev_src = nullptr;
static AppList g_app_list;
static WindowManager *g_context;
static vector<string> white_list_area_size_change = {
- "homescreen", "settings"
+ "homescreen"
+};
+
+struct AfbClosure {
+public:
+ AfbClosure(unsigned pid, unsigned ppid, unsigned surface)
+ : pid(pid), ppid(ppid), surface(surface) {}
+ ~AfbClosure() = default;
+ unsigned pid;
+ unsigned ppid;
+ unsigned surface;
};
namespace
@@ -93,14 +115,22 @@ static void onError()
{
g_context->processError(WMError::LAYOUT_CHANGE_FAIL);
}
+
+static void onReceiveRemoteRequest(json_object *data)
+{
+ g_context->processForRemoteRequest(data);
+}
} // namespace
/**
* WindowManager Impl
*/
WindowManager::WindowManager()
- : id_alloc{}
+ : wmcon{},
+ id_alloc{}
{
+ this->end_init = false;
+
const char *path = getenv("AFM_APP_INSTALL_DIR");
if (!path)
{
@@ -108,39 +138,61 @@ WindowManager::WindowManager()
}
string root = path;
- this->lc = std::make_shared<LayerControl>(root);
+ // TODO: ECU name should be decide by config file
+ // Get mode and decide ECU name
+ string ecu_name = this->wmcon.getEcuName();
+
+ this->lc = std::make_shared<LayerControl>(root, ecu_name);
HMI_DEBUG("Layer Controller initialized");
}
int WindowManager::init()
{
+ WMError err;
+
LayerControlCallbacks lmcb;
lmcb.surfaceCreated = [&](unsigned pid, unsigned surface){
- this->surface_created(surface);
+ this->surface_created(pid, surface);
};
lmcb.surfaceDestroyed = [&](unsigned surface){
this->surface_removed(surface);
};
- if(this->lc->init(lmcb) != WMError::SUCCESS)
+ err = this->lc->init(lmcb);
+ if (err == WMError::FAIL)
{
+ HMI_ERROR("Could not connect to weston");
return -1;
}
+ // TODO: application requests by old role,
+ // so create role map (old, new)
+ // Load old_roles config file
+ this->loadOldRolesConfigFile();
+
+ // Initialize LowCanClient
+ this->lcc.initialize();
+
// Store my context for calling callback from PolicyManager
g_context = this;
// Initialize PMWrapper
- this->pmw.initialize();
+ this->pmw.initialize(this->wmcon.getEcuName());
// Register callback to PolicyManager
this->pmw.registerCallback(onStateTransitioned, onError);
- // Make afb event for subscriber
- for (int i = Event_ScreenUpdated; i < Event_Error; i++)
+ // Initialize WMConnection
+ this->wmcon.initialize();
+
+ // Register callback to WMConnection
+ this->wmcon.registerCallback(onReceiveRemoteRequest);
+
+ // Make afb event
+ for (int i = Event_Val_Min; i <= Event_Val_Max; i++)
{
- map_afb_event[kListEventName[i]] = afb_api_make_event(afbBindingV3root, kListEventName[i].c_str());
+ map_afb_event[kListEventName[i]] = afb_daemon_make_event(kListEventName[i].c_str());
}
const struct rect css_bg = this->lc->getAreaSize("fullscreen");
@@ -156,47 +208,65 @@ int WindowManager::init()
double scale = static_cast<double>(dp_bg.height()) / css_bg.h;
this->lc->setupArea(dp_bg, scale);
- return 0;
+ this->end_init = true;
+
+ return 0; //init_layers();
}
result<int> WindowManager::api_request_surface(char const *appid, char const *drawing_name)
{
- string str_id = appid;
- string role = drawing_name;
- unsigned lid = 0;
-
- if(!g_app_list.contains(str_id))
+ // TODO: application requests by old role,
+ // so convert role old to new
+ const char *role = this->convertRoleOldToNew(drawing_name);
+ string l_name;
+ string s_appid = appid;
+ string s_role = role;
+
+ if(!g_app_list.contains(s_appid))
{
- lid = this->generateLayerForClient(role);
- if (lid == 0)
+ unsigned l_id = this->lc->getNewLayerID(s_role, &l_name);
+ if (l_id == 0)
{
- return Err<int>("Designated role does not match any role, fallback is disabled");
+ // register drawing_name as fallback and make it displayed.
+ l_id = this->lc->getNewLayerID("fallback", &l_name);
+ HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role);
+ if (l_id == 0)
+ {
+ return Err<int>("Designated role does not match any role, fallback is disabled");
+ }
}
- // add client into the db
- g_app_list.addClient(str_id, lid, role);
- }
- else
- {
- // This case occurs when an client calls "subscribe" before request_surface.
- // Then application doesn't have layer and role yet.
- auto client = g_app_list.lookUpClient(str_id);
- if(client->layerID() == 0)
+
+ // TODO: remote layer size is fixed value
+ if ("Remote" == l_name)
+ {
+ this->lc->createNewRemoteLayer(l_id);
+ }
+ else
{
- client->setLayerID(this->generateLayerForClient(role));
+ this->lc->createNewLayer(l_id);
}
- client->setRole(role);
+
+ // add client into the db
+ g_app_list.addClient(s_appid, l_id, s_role);
}
// generate surface ID for ivi-shell application
- auto rname = this->id_alloc.lookup(role);
+
+ auto rname = this->id_alloc.lookup(string(role));
if (!rname)
{
// name does not exist yet, allocate surface id...
auto id = int(this->id_alloc.generate_id(role));
- this->tmp_surface2app[id] = {str_id, lid};
+ this->tmp_surface2app[id] = {s_appid, 0};
+
+ // Work Around
+ HMI_NOTICE("WORK AROUND: add surface on request surface");
+ auto client = g_app_list.lookUpClient(s_appid);
+ client->addSurface(id);
+ ///////////////
- auto client = g_app_list.lookUpClient(str_id);
- client->registerSurface(id);
+ // Set role map of (new, old)
+ this->rolenew2old[role] = string(drawing_name);
return Ok<int>(id);
}
@@ -208,10 +278,8 @@ result<int> WindowManager::api_request_surface(char const *appid, char const *dr
char const *WindowManager::api_request_surface(char const *appid, char const *drawing_name,
char const *ivi_id)
{
- string str_id = appid;
- string role = drawing_name;
-
unsigned sid = std::stol(ivi_id);
+
HMI_DEBUG("This API(requestSurfaceXDG) is for XDG Application using runXDG");
/*
* IVI-shell doesn't send surface_size event via ivi-wm protocol
@@ -226,30 +294,45 @@ char const *WindowManager::api_request_surface(char const *appid, char const *dr
return "fail";
}
- if(!g_app_list.contains(str_id))
+ // TODO: application requests by old role,
+ // so convert role old to new
+ const char *role = this->convertRoleOldToNew(drawing_name);
+ string s_role = role;
+ string s_appid = appid;
+ string l_name;
+
+ if(!g_app_list.contains(s_appid))
{
- unsigned l_id = this->generateLayerForClient(role);
+ // auto lid = this->layers.get_layer_id(string(role));
+ unsigned l_id = this->lc->getNewLayerID(s_role, &l_name);
if (l_id == 0)
{
- return "Designated role does not match any role, fallback is disabled";
+ /**
+ * register drawing_name as fallback and make it displayed.
+ */
+ l_id = this->lc->getNewLayerID("fallback", &l_name);
+ HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role);
+ if (l_id == 0)
+ {
+ return "Designated role does not match any role, fallback is disabled";
+ }
}
- // add client into the db
- g_app_list.addClient(str_id, l_id, role);
- }
- else
- {
- // This case occurs when an client calls "subscribe" before request_surface.
- // Then application doesn't have layer and role yet.
- auto client = g_app_list.lookUpClient(str_id);
- if(client->layerID() == 0)
+
+ // TODO: remote layer size is fixed value
+ if ("Remote" == l_name)
{
- client->setLayerID(this->generateLayerForClient(role));
+ this->lc->createNewRemoteLayer(l_id);
+ }
+ else
+ {
+ this->lc->createNewLayer(l_id);
}
- client->setRole(role);
- }
- auto rname = this->id_alloc.lookup(role);
+ // add client into the db
+ g_app_list.addClient(s_appid, l_id, s_role);
+ }
+ auto rname = this->id_alloc.lookup(s_role);
if (rname)
{
return "Surface already present";
@@ -258,17 +341,121 @@ char const *WindowManager::api_request_surface(char const *appid, char const *dr
// register pair drawing_name and ivi_id
this->id_alloc.register_name_id(role, sid);
- auto client = g_app_list.lookUpClient(str_id);
+ auto client = g_app_list.lookUpClient(s_appid);
client->addSurface(sid);
+ // Set role map of (new, old)
+ this->rolenew2old[role] = string(drawing_name);
+
return nullptr;
}
+bool WindowManager::api_set_role(char const *appid, char const *drawing_name)
+{
+ bool ret = false;
+
+ // TODO: application requests by old role,
+ // so convert role old to new
+ const char *role = this->convertRoleOldToNew(drawing_name);
+ string s_role = role;
+ string s_appid = appid;
+ string l_name;
+
+ // Create WMClient
+ if(!g_app_list.contains(s_appid))
+ {
+ // auto lid = this->layers.get_layer_id(string(role));
+ unsigned l_id = this->lc->getNewLayerID(s_role, &l_name);
+ if (l_id == 0)
+ {
+ /**
+ * register drawing_name as fallback and make it displayed.
+ */
+ l_id = this->lc->getNewLayerID("fallback", &l_name);
+ HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role);
+ if (l_id == 0)
+ {
+ HMI_ERROR("Designated role does not match any role, fallback is disabled");
+ return ret;
+ }
+ }
+
+ // TODO: remote layer size is fixed value
+ if ("Remote" == l_name)
+ {
+ this->lc->createNewRemoteLayer(l_id);
+ }
+ else
+ {
+ this->lc->createNewLayer(l_id);
+ }
+
+ // add client into the db
+ g_app_list.addClient(s_appid, l_id, s_role);
+ // Set role map of (new, old)
+ this->rolenew2old[role] = string(drawing_name);
+ }
+
+ // for(auto itr = this->tmp_surface2app.begin();
+ // itr != this->tmp_surface2app.end() ; ++itr)
+ // {
+ for(auto& x : this->tmp_surface2app)
+ {
+ if(x.second.appid == s_appid)
+ {
+ unsigned surface = x.first;
+ auto client = g_app_list.lookUpClient(s_appid);
+ client->addSurface(surface);
+ this->tmp_surface2app.erase(surface);
+ this->id_alloc.register_name_id(s_role, surface);
+ break;
+ }
+ }
+
+/* if(0 != pid){
+ // search floating surfaceID from pid if pid is designated.
+ wm_err = g_app_list.popFloatingSurface(pid, &surface);
+ }
+ else{
+ // get floating surface with appid. If WM queries appid from pid,
+ // WM can bind surface and role with appid(not implemented yet)
+ //wm_err = g_app_list.popFloatingSurface(id);
+ }
+ if(wm_err != WMError::SUCCESS){
+ HMI_ERROR("No floating surface for app: %s", id.c_str());
+ g_app_list.addFloatingClient(id, lid, role);
+ HMI_NOTICE("%s : Waiting for surface creation", id.c_str());
+ return ret;
+ }
+
+ ret = true;
+ if (g_app_list.contains(id))
+ {
+ HMI_INFO("Add role: %s with surface: %d. Client %s has multi surfaces.",
+ role.c_str(), surface, id.c_str());
+ auto client = g_app_list.lookUpClient(id);
+ client->appendRole(role);
+ }
+ else{
+ HMI_INFO("Create new client: %s, surface: %d into layer: %d with role: %s",
+ id.c_str(), surface, lid, role.c_str());
+ g_app_list.addClient(id, lid, role);
+ } */
+
+ // register pair drawing_name and ivi_id
+
+ return true;
+}
+
void WindowManager::api_activate_window(char const *appid, char const *drawing_name,
char const *drawing_area, const reply_func &reply)
{
+ // TODO: application requests by old role,
+ // so convert role old to new
+ const char *c_role = this->convertRoleOldToNew(drawing_name);
+
string id = appid;
- string role = drawing_name;
+ string role = c_role;
string area = drawing_area;
if(!g_app_list.contains(id))
@@ -278,12 +465,51 @@ void WindowManager::api_activate_window(char const *appid, char const *drawing_n
}
auto client = g_app_list.lookUpClient(id);
+ // unsigned srfc = client->surfaceID(role);
+ // unsigned layer = client->layerID();
+
+ // g_app_list.removeFloatingSurface(client->surfaceID());
+ // g_app_list.removeFloatingSurface(client);i
+ unsigned layer = client->layerID();
+
+ //TODO Deactivate remote viewing app for remote view change to local view.
+ if(this->lc->hasRemoteLayer(layer) && this->wmcon.getAppIdToEcuName(appid) != "")
+ {
+ HMI_DEBUG("Deactivate remote App %s", drawing_name);
+ std::string tmp_area = this->wmcon.getAppIdToEcuName(appid) + ".split.sub";
+ HMI_DEBUG("Deactivate area name: %s", tmp_area.c_str());
+ this->wmcon.sendRequest("deactivateWindow", appid, drawing_name, tmp_area.c_str());
+
+ unsigned req_num = g_app_list.currentRequestNumber();
+ const char *c_role = this->convertRoleOldToNew(drawing_name);
+ bool end_draw_finished = true;
+ WMAction act
+ {
+ req_num,
+ client,
+ string(c_role),
+ "",
+ TaskVisible::REMOTE_INVISIBLE,
+ end_draw_finished,
+ TaskCarState::NO_TASK
+ };
+
+ this->lc->visibilityChange(act);
+ this->lc->renderLayers();
+
+ this->emit_invisible(role);
+ this->emit_deactivated(role);
+ }
+
Task task = Task::TASK_ALLOCATE;
unsigned req_num = 0;
WMError ret = WMError::UNKNOWN;
ret = this->setRequest(id, role, area, task, &req_num);
+ //vector<WMLayerState> current_states = this->lc->getCurrentStates();
+ // ret = this->setRequest(id, role, area, task, current_states, &req_num);
+
if(ret != WMError::SUCCESS)
{
HMI_ERROR(errorDescription(ret));
@@ -291,6 +517,8 @@ void WindowManager::api_activate_window(char const *appid, char const *drawing_n
return;
}
+ this->wmcon.setAppIdToEcuName(id, "");
+
reply(nullptr);
if (req_num != g_app_list.currentRequestNumber())
{
@@ -299,7 +527,9 @@ void WindowManager::api_activate_window(char const *appid, char const *drawing_n
return;
}
- // Do allocate tasks
+ /*
+ * Do allocate tasks
+ */
ret = this->checkPolicy(req_num);
if (ret != WMError::SUCCESS)
@@ -311,12 +541,156 @@ void WindowManager::api_activate_window(char const *appid, char const *drawing_n
}
}
+void WindowManager::api_activate_surface_for_slave(
+ char const *appid, char const *drawing_name,
+ char const *drawing_area, const reply_func &reply)
+{
+ // TODO: application requests by old role,
+ // so convert role old to new
+ const char *c_role = this->convertRoleOldToNew(drawing_name);
+
+ string id = appid;
+ string role = c_role;
+ string area = drawing_area;
+
+ if(!g_app_list.contains(id))
+ {
+ // Request surface of app in slave to register app information
+ this->api_request_surface(appid, drawing_name);
+
+ // Set role of app in slave to register app information
+ this->api_set_role(appid, drawing_name);
+ }
+ auto client = g_app_list.lookUpClient(id);
+
+ // unsigned srfc = client->surfaceID(role);
+ // unsigned layer = client->layerID();
+
+ // g_app_list.removeFloatingSurface(client->surfaceID());
+ // g_app_list.removeFloatingSurface(client);
+
+ Task task = Task::TASK_ALLOCATE;
+ unsigned req_num = 0;
+ WMError ret = WMError::UNKNOWN;
+
+ ret = this->setRequestForSlave(id, role, area, task, &req_num);
+
+ //vector<WMLayerState> current_states = this->lc->getCurrentStates();
+ // ret = this->setRequest(id, role, area, task, current_states, &req_num);
+
+ if(ret != WMError::SUCCESS)
+ {
+ HMI_ERROR(errorDescription(ret));
+ reply("Failed to set request");
+ return;
+ }
+
+ this->wmcon.setAppIdToReceivedEcuName(id);
+
+ reply(nullptr);
+ if (req_num != g_app_list.currentRequestNumber())
+ {
+ // Add request, then invoked after the previous task is finished
+ HMI_SEQ_DEBUG(req_num, "request is accepted");
+ return;
+ }
+
+ /*
+ * Do allocate tasks
+ */
+ ret = this->checkPolicyForSlave(req_num);
+
+ if (ret != WMError::SUCCESS)
+ {
+ //this->emit_error()
+ HMI_SEQ_ERROR(req_num, errorDescription(ret));
+ g_app_list.removeRequest(req_num);
+ this->processNextRequest();
+ }
+}
+
+void WindowManager::api_activate_surface_to_master(
+ char const *appid, char const *drawing_name,
+ char const *drawing_area, const reply_func &reply)
+{
+ // TODO: application requests by old role,
+ // so convert role old to new
+ const char *c_role = this->convertRoleOldToNew(drawing_name);
+
+ string id = appid;
+ string role = c_role;
+ string area = drawing_area;
+
+ if(!g_app_list.contains(id))
+ {
+ reply("app doesn't request 'requestSurface' or 'setRole' yet");
+ return;
+ }
+ auto client = g_app_list.lookUpClient(id);
+
+ // unsigned srfc = client->surfaceID(role);
+ // unsigned layer = client->layerID();
+
+ // g_app_list.removeFloatingSurface(client->surfaceID());
+ // g_app_list.removeFloatingSurface(client);
+
+ Task task = Task::TASK_ALLOCATE;
+ unsigned req_num = 0;
+ WMError ret = WMError::UNKNOWN;
+
+ ret = this->setRequest(id, role, area, task, &req_num);
+
+ //vector<WMLayerState> current_states = this->lc->getCurrentStates();
+ // ret = this->setRequest(id, role, area, task, current_states, &req_num);
+
+ if(ret != WMError::SUCCESS)
+ {
+ HMI_ERROR(errorDescription(ret));
+ reply("Failed to set request");
+ return;
+ }
+
+ std::string ecu_name;
+ ecu_name = this->wmcon.getAreaToEcuName(area.c_str());
+
+ this->wmcon.setAppIdToEcuName(id, ecu_name);
+
+ reply(nullptr);
+ if (req_num != g_app_list.currentRequestNumber())
+ {
+ // Add request, then invoked after the previous task is finished
+ HMI_SEQ_DEBUG(req_num, "request is accepted");
+ return;
+ }
+
+ /*
+ * Do allocate tasks
+ */
+ int i_ret = this->wmcon.sendRequest("activateWindow", appid,
+ drawing_name, drawing_area);
+ if (0 > i_ret)
+ {
+ //this->emit_error()
+ HMI_SEQ_ERROR(req_num, errorDescription(ret));
+ g_app_list.removeRequest(req_num);
+ this->processNextRequest();
+ }
+
+ this->setTimer();
+}
+
void WindowManager::api_deactivate_window(char const *appid, char const *drawing_name,
const reply_func &reply)
{
- // Check Phase
+ // TODO: application requests by old role,
+ // so convert role old to new
+ const char *c_role = this->convertRoleOldToNew(drawing_name);
+
+ /*
+ * Check Phase
+ */
string id = appid;
- string role = drawing_name;
+ string role = c_role;
string area = ""; //drawing_area;
Task task = Task::TASK_RELEASE;
unsigned req_num = 0;
@@ -339,7 +713,9 @@ void WindowManager::api_deactivate_window(char const *appid, char const *drawing
return;
}
- // Do allocate tasks
+ /*
+ * Do allocate tasks
+ */
ret = this->checkPolicy(req_num);
if (ret != WMError::SUCCESS)
@@ -351,10 +727,112 @@ void WindowManager::api_deactivate_window(char const *appid, char const *drawing
}
}
+void WindowManager::api_deactivate_surface_for_slave(char const *appid, char const *drawing_name,
+ const reply_func &reply)
+{
+ // TODO: application requests by old role,
+ // so convert role old to new
+ const char *c_role = this->convertRoleOldToNew(drawing_name);
+
+ /*
+ * Check Phase
+ */
+ string id = appid;
+ string role = c_role;
+ string area = "";//drawing_area;
+ Task task = Task::TASK_RELEASE;
+ unsigned req_num = 0;
+ WMError ret = WMError::UNKNOWN;
+
+ ret = this->setRequest(id, role, area, task, &req_num);
+
+ if (ret != WMError::SUCCESS)
+ {
+ HMI_ERROR(errorDescription(ret));
+ reply("Failed to set request");
+ return;
+ }
+
+ reply(nullptr);
+ if (req_num != g_app_list.currentRequestNumber())
+ {
+ // Add request, then invoked after the previous task is finished
+ HMI_SEQ_DEBUG(req_num, "request is accepted");
+ return;
+ }
+
+ /*
+ * Do allocate tasks
+ */
+ ret = this->checkPolicyForSlave(req_num);
+
+ if (ret != WMError::SUCCESS)
+ {
+ //this->emit_error()
+ HMI_SEQ_ERROR(req_num, errorDescription(ret));
+ g_app_list.removeRequest(req_num);
+ this->processNextRequest();
+ }
+}
+
+void WindowManager::api_deactivate_surface_to_master(char const *appid, char const *drawing_name,
+ const reply_func &reply)
+{
+ // TODO: application requests by old role,
+ // so convert role old to new
+ const char *c_role = this->convertRoleOldToNew(drawing_name);
+
+ /*
+ * Check Phase
+ */
+ string id = appid;
+ string role = c_role;
+ string area = "";//drawing_area;
+ Task task = Task::TASK_RELEASE;
+ unsigned req_num = 0;
+ WMError ret = WMError::UNKNOWN;
+
+ ret = this->setRequest(id, role, area, task, &req_num);
+
+ if (ret != WMError::SUCCESS)
+ {
+ HMI_ERROR(errorDescription(ret));
+ reply("Failed to set request");
+ return;
+ }
+
+ reply(nullptr);
+ if (req_num != g_app_list.currentRequestNumber())
+ {
+ // Add request, then invoked after the previous task is finished
+ HMI_SEQ_DEBUG(req_num, "request is accepted");
+ return;
+ }
+
+ /*
+ * Do allocate tasks
+ */
+ int i_ret = this->wmcon.sendRequest("deactivateWindow", appid,
+ drawing_name, "");
+ if (0 > i_ret)
+ {
+ //this->emit_error()
+ HMI_SEQ_ERROR(req_num, errorDescription(ret));
+ g_app_list.removeRequest(req_num);
+ this->processNextRequest();
+ }
+
+ this->setTimer();
+}
+
void WindowManager::api_enddraw(char const *appid, char const *drawing_name)
{
+ // TODO: application requests by old role,
+ // so convert role old to new
+ const char *c_role = this->convertRoleOldToNew(drawing_name);
+
string id = appid;
- string role = drawing_name;
+ string role = c_role;
unsigned current_req = g_app_list.currentRequestNumber();
bool result = g_app_list.setEndDrawFinished(current_req, id, role);
@@ -381,6 +859,8 @@ void WindowManager::api_enddraw(char const *appid, char const *drawing_name)
this->emitScreenUpdated(current_req);
HMI_SEQ_INFO(current_req, "Finish request status: %s", errorDescription(ret));
+ this->saveLastModeData(current_req);
+
g_app_list.removeRequest(current_req);
this->processNextRequest();
@@ -392,6 +872,67 @@ void WindowManager::api_enddraw(char const *appid, char const *drawing_name)
}
}
+int WindowManager::api_subscribe(afb_req req, int event_id)
+{
+ struct afb_event event = this->map_afb_event[kListEventName[event_id]];
+ return afb_req_subscribe(req, event);
+}
+
+void WindowManager::api_handshake()
+{
+ if (this->end_init && this->wmcon.getEndInit())
+ {
+ this->send_event(kListEventName[Event_Handshake]);
+ }
+}
+
+void WindowManager::api_enddraw_for_remote(char const *appid, char const *drawing_name)
+{
+ int ret = this->wmcon.sendRequest("endDraw", appid, drawing_name, "");
+ if (0 > ret)
+ {
+ //this->emit_error()
+
+ this->pmw.undoState();
+ this->lc->undoUpdate();
+
+ unsigned current_req = g_app_list.currentRequestNumber();
+ g_app_list.removeRequest(current_req);
+ this->processNextRequest();
+
+ return;
+ }
+
+ this->api_enddraw(appid, drawing_name);
+}
+
+bool WindowManager::api_client_set_render_order(char const* appid, const vector<string>& render_order)
+{
+ bool ret = false;
+ string id = appid;
+ auto client = g_app_list.lookUpClient(id);
+ if(client)
+ {
+ client->setRenderOrder(render_order);
+ }
+ return ret;
+}
+
+string WindowManager::api_client_attach_service_surface
+ (const char* appid, const char* dest, const char* service_surface)
+{
+ string uuid, s_dest = dest;
+ auto client = g_app_list.lookUpClient(s_dest);
+ if(!client)
+ {
+ HMI_ERROR("Failed to look up destination [%s]", dest);
+ return uuid;
+ }
+ uuid = client->attachTmpServiceSurface(appid, service_surface);
+ this->tmp_services.emplace_back(TmpService{appid, dest, service_surface, uuid});
+ return uuid;
+}
+
json_object* WindowManager::api_get_area_list()
{
json_object* ret = json_object_new_object();
@@ -480,46 +1021,9 @@ void WindowManager::api_change_area_size(ChangeAreaReq &areas)
// Request change size to applications
for(const auto &action : g_app_list.getActions(req_num, &found))
{
- struct rect r = this->lc->getAreaSize(action.area);
- action.client->emitSyncDraw(action.area, r);
- }
-}
-
-bool WindowManager::api_subscribe(afb_req_t req, EventType event_id)
-{
- bool ret = false;
- char* appid = afb_req_get_application_id(req);
- if(event_id < Event_Val_Min || event_id > Event_Val_Max)
- {
- HMI_ERROR("not defined in Window Manager", event_id);
- return ret;
- }
- HMI_INFO("%s subscribe %s : %d", appid, kListEventName[event_id].c_str(), event_id);
- if(event_id == Event_ScreenUpdated)
- {
- // Event_ScreenUpdated should be emitted to subscriber
- afb_event_t event = this->map_afb_event[kListEventName[event_id]];
- int rc = afb_req_subscribe(req, event);
- if(rc == 0)
- {
- ret = true;
- }
- }
- else if(appid)
- {
- string id = appid;
- free(appid);
- if(!g_app_list.contains(id))
- {
- g_app_list.addClient(id);
- }
- g_app_list.lookUpClient(id)->subscribe(req, kListEventName[event_id]);
- }
- else
- {
- HMI_ERROR("appid is not set");
+ string old_role = this->rolenew2old[action.role];
+ this->emit_syncdraw(old_role, action.area);
}
- return ret;
}
result<json_object *> WindowManager::api_get_display_info()
@@ -541,7 +1045,9 @@ result<json_object *> WindowManager::api_get_area_info(char const *drawing_name)
{
HMI_DEBUG("called");
- string role = drawing_name;
+ // TODO: application requests by old role,
+ // so convert role old to new
+ const char *role = this->convertRoleOldToNew(drawing_name);
// Check drawing name, surface/layer id
auto const &surface_id = this->id_alloc.lookup(role);
@@ -551,7 +1057,7 @@ result<json_object *> WindowManager::api_get_area_info(char const *drawing_name)
}
// Set area rectangle
- struct rect area_info = this->area_info[*surface_id];
+ rect area_info = this->area_info[*surface_id];
json_object *object = json_object_new_object();
json_object_object_add(object, kKeyX, json_object_new_int(area_info.x));
json_object_object_add(object, kKeyY, json_object_new_int(area_info.y));
@@ -561,10 +1067,166 @@ result<json_object *> WindowManager::api_get_area_info(char const *drawing_name)
return Ok<json_object *>(object);
}
+result<json_object *> WindowManager::api_get_car_info(char const *label)
+{
+ json_object *j_in = nullptr;
+ json_object *j_out = nullptr;
+
+ if (0 == strcmp("parking_brake_status", label))
+ {
+ // Get parking brake status
+ json_bool val = (this->crr_car_info.parking_brake_stt) ? TRUE : FALSE;
+ j_in = json_object_new_boolean(val);
+ }
+ else if (0 == strcmp("accelerator.pedal.position", label))
+ {
+ // Get accelerator pedal position
+ double val = this->crr_car_info.accel_pedal_pos;
+ j_in = json_object_new_double(val);
+ }
+ else if (0 == strcmp("car_state", label))
+ {
+ // Get running state
+ const char* val = (this->crr_car_info.running_stt) ? "run" : "stop";
+ j_in = json_object_new_string(val);
+ }
+ else if (0 == strcmp("lightstatus.brake", label)) {
+ // Get lightstatus brake status
+ json_bool val = (this->crr_car_info.lightstatus_brake_stt) ? TRUE : FALSE;
+ j_in = json_object_new_boolean(val);
+ }
+ else
+ {
+ return Err<json_object *>("Car info does not exist");
+ }
+
+ // Create output object
+ j_out = json_object_new_object();
+ json_object_object_add(j_out, "value", j_in);
+
+ return Ok<json_object *>(j_out);
+}
+
+void WindowManager::send_event(const string& evname)
+{
+ HMI_DEBUG("%s: %s", __func__, evname.c_str());
+
+ int ret = afb_event_push(this->map_afb_event[evname], nullptr);
+ if (ret != 0)
+ {
+ HMI_DEBUG("afb_event_push: %m");
+ }
+}
+
+void WindowManager::send_event(const string& evname, const string& role)
+{
+ HMI_DEBUG("%s: %s(%s)", __func__, evname.c_str(), role.c_str());
+
+ json_object *j = json_object_new_object();
+ json_object_object_add(j, kKeyDrawingName, json_object_new_string(role.c_str()));
+
+ int ret = afb_event_push(this->map_afb_event[evname], j);
+ if (ret != 0)
+ {
+ HMI_DEBUG("afb_event_push failed: %m");
+ }
+}
+
+void WindowManager::send_event(const string& evname, const string& role, const string& area,
+ int x, int y, int w, int h)
+{
+ HMI_DEBUG("%s: %s(%s, %s) x:%d y:%d w:%d h:%d",
+ __func__, evname.c_str(), role.c_str(), area.c_str(), x, y, w, h);
+
+ json_object *j_rect = json_object_new_object();
+ json_object_object_add(j_rect, kKeyX, json_object_new_int(x));
+ json_object_object_add(j_rect, kKeyY, json_object_new_int(y));
+ json_object_object_add(j_rect, kKeyWidth, json_object_new_int(w));
+ json_object_object_add(j_rect, kKeyHeight, json_object_new_int(h));
+
+ json_object *j = json_object_new_object();
+ json_object_object_add(j, kKeyDrawingName, json_object_new_string(role.c_str()));
+ json_object_object_add(j, kKeyDrawingArea, json_object_new_string(area.c_str()));
+ json_object_object_add(j, kKeyDrawingRect, j_rect);
+
+ int ret = afb_event_push(this->map_afb_event[evname], j);
+ if (ret != 0)
+ {
+ HMI_DEBUG("afb_event_push failed: %m");
+ }
+}
+
+string WindowManager::searchApp(unsigned pid, unsigned ppid, unsigned surface, json_object* resp)
+{
+ // retrieve appid from pid from application manager
+ string appid;
+ // check appid then add it to the client
+ HMI_INFO("Runners:%s", json_object_get_string(resp));
+ int size = json_object_array_length(resp);
+ HMI_INFO("pid %d, ppid %d, surface %d",pid, ppid, surface);
+ for(int i = 0; i < size; i++)
+ {
+ json_object *j = json_object_array_get_idx(resp, i);
+ int runid = jh::getIntFromJson(j, "runid");
+ const char* id = jh::getStringFromJson(j, "id");
+ HMI_DEBUG("Appid %s, runid %d", id, runid);
+ if(id && (runid == ppid))
+ {
+ string s_id = id;
+ s_id.erase(s_id.find('@'));
+ appid = s_id;
+ HMI_INFO("App found %s", appid.c_str());
+ break;
+ }
+ }
+ if(appid.empty())
+ {
+ HMI_WARNING("Failed to retrieve id");
+ }
+ return appid;
+}
+
+void WindowManager::storeSurface(const string& appid, unsigned ppid, unsigned surface)
+{
+ auto elem = std::find_if(this->tmp_services.begin(), this->tmp_services.end(),
+ [&appid](TmpService& ts){
+ return (ts.dest == appid );
+ });
+
+ this->lc->setXDGSurfaceOriginSize(surface);
+ if(elem != this->tmp_services.end())
+ {
+ // attachApp
+ auto client = g_app_list.lookUpClient(elem->dest);
+ if(client == nullptr)
+ {
+ return;
+ }
+ HMI_INFO("Attach surface %d (service %s) to app %s", surface, elem->service.c_str(), elem->dest.c_str());
+ client->attachServiceSurface(elem->service, surface);
+ }
+ else
+ {
+ // setRole
+ auto client = g_app_list.lookUpClient(appid);
+ if(client != nullptr)
+ {
+ client->addSurface(surface);
+ this->id_alloc.register_name_id(client->role(), surface);
+ }
+ else
+ {
+ // Store tmp surface and appid for application
+ // who requests setRole after creating shell surface
+ this->tmp_surface2app.emplace(surface, TmpClient{appid, ppid});
+ }
+ }
+}
+
/**
* proxied events
*/
-void WindowManager::surface_created(unsigned surface_id)
+void WindowManager::surface_created(unsigned pid, unsigned surface_id)
{
// requestSurface
if(this->tmp_surface2app.count(surface_id) != 0)
@@ -582,6 +1244,52 @@ void WindowManager::surface_created(unsigned surface_id)
}
this->tmp_surface2app.erase(surface_id);
}
+ else
+ {
+ HMI_NOTICE("Unknown surface %d", surface_id);
+ // retrieve ppid
+ std::ostringstream os;
+ os << pid ;
+ string path = "/proc/" + os.str() + "/stat";
+ std::ifstream ifs(path.c_str());
+ string str;
+ unsigned ppid = 0;
+ if(!ifs.fail() && std::getline(ifs, str))
+ {
+ std::sscanf(str.data(), "%*d %*s %*c %d", &ppid);
+ HMI_INFO("Retrieve ppid %d", ppid);
+ }
+ else
+ {
+ HMI_ERROR("Failed to open /proc/%d/stat", pid);
+ HMI_ERROR("File system may be different");
+ return;
+ }
+ struct AfbClosure* c = new struct AfbClosure(pid, ppid, surface_id);
+ // search pid from surfaceID
+ afb_service_call("afm-main", "runners", json_object_new_object(),
+ [](void* closure, int stat, json_object* resp){
+ HMI_DEBUG("check %s", json_object_get_string(resp));
+ struct AfbClosure* c = static_cast<struct AfbClosure*>(closure);
+ HMI_DEBUG("check");
+ if(stat != 0)
+ {
+ HMI_ERROR("Failed to call runners");
+ }
+ else
+ {
+ json_object* j;
+ json_object_object_get_ex(resp, "response", &j);
+ string appid = g_context->searchApp(c->pid, c->ppid, c->surface, j);
+ if(!appid.empty())
+ {
+ g_context->storeSurface(appid, c->ppid, c->surface);
+ }
+ }
+ json_object_put(resp);
+ delete c;
+ }, c);
+ }
}
void WindowManager::surface_removed(unsigned surface_id)
@@ -608,6 +1316,25 @@ void WindowManager::exceptionProcessForTransition()
this->processNextRequest();
}
+void WindowManager::analyzeReceivedEvent(const char *event, struct json_object *object)
+{
+ HMI_DEBUG("event:%s", event);
+
+ // If receive low can signal
+ if (strstr(event, "low-can"))
+ {
+ // Analyze low can signal
+ const char *signal_name = this->lcc.analyzeCanSignal(object);
+
+ // Create task for car state and input it to PolicyManager
+ Task task = this->convertCanSignalToCarStateTask(signal_name);
+ if (Task::TASK_INVALID != task)
+ {
+ this->inputCarStateTask(task);
+ }
+ }
+}
+
void WindowManager::timerHandler()
{
unsigned req_num = g_app_list.currentRequestNumber();
@@ -619,8 +1346,10 @@ void WindowManager::timerHandler()
void WindowManager::startTransitionWrapper(vector<WMAction> &actions)
{
- WMError ret;
+ WMError ret = WMError::UNKNOWN;
+ // req_num is guaranteed by Window Manager
unsigned req_num = g_app_list.currentRequestNumber();
+ Task task = Task::TASK_INVALID;
if (actions.empty())
{
@@ -636,27 +1365,58 @@ void WindowManager::startTransitionWrapper(vector<WMAction> &actions)
}
}
+ // Check weather there is the no request task
+ // [The no request task]
+ // - TaskCarState::RESTRICTION_MODE_OFF
+ // - TaskCarState::RESTRICTION_MODE_ON
+ for (const auto &act : actions)
+ {
+ if (TaskCarState::RESTRICTION_MODE_OFF == act.car_state)
+ {
+ task = Task::TASK_RESTRICTION_MODE_OFF;
+ break;
+ }
+ else if (TaskCarState::RESTRICTION_MODE_ON == act.car_state)
+ {
+ task = Task::TASK_RESTRICTION_MODE_ON;
+ break;
+ }
+ }
+
+ // If there is the request-less task, set request here
+ if (Task::TASK_INVALID != task) {
+ unsigned req_num;
+ ret = this->setRequest(task, &req_num);
+
+ if(ret != WMError::SUCCESS)
+ {
+ goto error;
+ }
+ }
+
for (auto &act : actions)
{
if ("" != act.role)
{
bool found;
- auto const &surface_id = this->id_alloc.lookup(act.role);
+ auto const &surface_id = this->id_alloc.lookup(act.role.c_str());
if(surface_id == nullopt)
{
- goto proc_remove_request;
+ HMI_SEQ_DEBUG(req_num, "There is not surface id for role:%s", act.role.c_str());
+ continue;
}
+
string appid = g_app_list.getAppID(*surface_id, &found);
if (!found)
{
if (TaskVisible::INVISIBLE == act.visible)
{
- // App is killed, so do not set this action
+ HMI_SEQ_DEBUG(req_num, "role:%s is killed, so do not set this action", act.role.c_str());
continue;
}
else
{
- HMI_SEQ_ERROR(req_num, "appid which is visible is not found");
+ HMI_SEQ_ERROR(req_num, "appid of role:%s which is visible is not found", act.role.c_str());
ret = WMError::FAIL;
goto error;
}
@@ -664,6 +1424,20 @@ void WindowManager::startTransitionWrapper(vector<WMAction> &actions)
auto client = g_app_list.lookUpClient(appid);
act.req_num = req_num;
act.client = client;
+
+ if (this->wmcon.getAppIdToEcuName(appid) != "")
+ {
+ if (TaskVisible::VISIBLE == act.visible && this->wmcon.getAreaToEcuName(act.area.c_str()) == this->wmcon.getEcuName())
+ {
+ HMI_DEBUG("Set TaskVisible::REQ_REMOTE_VISIBLE");
+ act.visible = TaskVisible::REQ_REMOTE_VISIBLE;
+ }
+ else
+ {
+ HMI_DEBUG("Set TaskVisible::REQ_REMOTE_INVISIBLE");
+ act.visible = TaskVisible::REQ_REMOTE_INVISIBLE;
+ }
+ }
}
ret = g_app_list.setAction(req_num, act);
@@ -711,22 +1485,246 @@ void WindowManager::processError(WMError error)
this->processNextRequest();
}
-unsigned WindowManager::generateLayerForClient(const string& role)
+void WindowManager::processForRemoteRequest(json_object *data)
{
- unsigned lid = this->lc->getNewLayerID(role);
- if (lid == 0)
+ const char *req = jh::getStringFromJson(data, "req");
+ const char *appid = jh::getStringFromJson(data, "appid");
+ const char *drawing_name = jh::getStringFromJson(data, "drawing_name");
+ const char *drawing_area = jh::getStringFromJson(data, "drawing_area");
+ string request = req;
+ string role = drawing_name;
+ string area = drawing_area;
+
+ if (!req || !drawing_name)
{
- // register drawing_name as fallback and make it displayed.
- lid = this->lc->getNewLayerID(string("fallback"));
- HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role.c_str());
- if (lid == 0)
+ HMI_ERROR("Parse Error!!");
+ return;
+ }
+
+ if (this->wmcon.getAreaToEcuName(drawing_area) == this->wmcon.getEcuName())
+ {
+ if (!appid)
{
- return lid;
+ HMI_ERROR("Parse Error!!");
+ return;
+ }
+
+ auto reply = [](const char *errmsg) {
+ if (errmsg != nullptr)
+ {
+ HMI_ERROR(errmsg);
+ return;
+ }
+ };
+
+ if ("activateWindow" == request)
+ {
+ if (!drawing_area)
+ {
+ HMI_ERROR("Parse Error!!");
+ return;
+ }
+
+ this->api_activate_surface_for_slave(
+ appid, drawing_name, drawing_area, reply);
+ }
+ else if ("deactivateWindow" == request)
+ {
+ this->api_deactivate_surface_for_slave(
+ appid, drawing_name, reply);
+ }
+ else if ("endDraw" == request)
+ {
+ this->api_enddraw(appid, drawing_name);
}
}
- this->lc->createNewLayer(lid);
- // add client into the db
- return lid;
+ else
+ {
+ if ("syncDraw" == request)
+ {
+ this->stopTimer();
+
+ if (!appid || !drawing_area)
+ {
+ HMI_ERROR("Parse Error!!");
+ return;
+ }
+
+ unsigned req_num = g_app_list.currentRequestNumber();
+ auto client = g_app_list.lookUpClient(appid);
+
+ // TODO: application requests by old role,
+ // so convert role old to new
+ const char *c_role = this->convertRoleOldToNew(drawing_name);
+
+ // Create action
+ bool end_draw_finished = false;
+ WMAction act
+ {
+ req_num,
+ client,
+ string(c_role),
+ area,
+ TaskVisible::REMOTE_VISIBLE,
+ end_draw_finished,
+ TaskCarState::NO_TASK
+ };
+
+ // Set action
+ WMError ret = g_app_list.setAction(req_num, act);
+ if (ret != WMError::SUCCESS)
+ {
+ HMI_SEQ_ERROR(req_num, "Setting action is failed");
+ return;
+ }
+
+ this->emit_syncdraw(role, area);
+ this->wmcon.startSyncDrawForRemote(appid);
+ this->setTimer();
+ }
+ else if ("activated" == request)
+ {
+ this->emit_visible(role);
+ this->emit_activated(area);
+ }
+ else if ("deactivated" == request)
+ {
+ this->stopTimer();
+
+ if (!appid || !drawing_area)
+ {
+ HMI_ERROR("Parse Error!!");
+ return;
+ }
+
+ unsigned req_num = g_app_list.currentRequestNumber();
+ auto client = g_app_list.lookUpClient(appid);
+
+ // TODO: application requests by old role,
+ // so convert role old to new
+ const char *c_role = this->convertRoleOldToNew(drawing_name);
+
+ if(!this->lc->hasRemoteLayer(client->layerID()))
+ {
+ HMI_DEBUG("Deactivated");
+ return;
+ }
+
+ // Create action
+ bool end_draw_finished = true;
+ WMAction act
+ {
+ req_num,
+ client,
+ string(c_role),
+ "",
+ TaskVisible::REMOTE_INVISIBLE,
+ end_draw_finished,
+ TaskCarState::NO_TASK
+ };
+
+ this->lc->visibilityChange(act);
+ this->lc->renderLayers();
+
+ this->emit_invisible(role);
+ this->emit_deactivated(role);
+ }
+ else if ("flushDraw" == request)
+ {
+ this->emit_flushdraw(role);
+ }
+ }
+}
+
+/*
+ ******* Private Functions *******
+ */
+
+void WindowManager::emit_activated(const string& role)
+{
+ this->send_event(kListEventName[Event_Active], role);
+}
+
+void WindowManager::emit_deactivated(const string& role)
+{
+ this->send_event(kListEventName[Event_Inactive], role);
+}
+
+void WindowManager::emit_syncdraw(const string& role, char const *area, int x, int y, int w, int h)
+{
+ this->send_event(kListEventName[Event_SyncDraw], role, area, x, y, w, h);
+}
+
+void WindowManager::emit_syncdraw(const string &role, const string &area)
+{
+ struct rect rect = this->lc->getAreaSize(area);
+ this->send_event(kListEventName[Event_SyncDraw],
+ role.c_str(), area.c_str(), rect.x, rect.y, rect.w, rect.h);
+}
+
+void WindowManager::emit_flushdraw(const string& role)
+{
+ this->send_event(kListEventName[Event_FlushDraw], role);
+}
+
+void WindowManager::emit_visible(const string& role, bool is_visible)
+{
+ this->send_event(is_visible ? kListEventName[Event_Visible] : kListEventName[Event_Invisible], role);
+}
+
+void WindowManager::emit_invisible(const string& role)
+{
+ return emit_visible(role, false);
+}
+
+void WindowManager::emit_visible(const string& role) { return emit_visible(role, true); }
+
+void WindowManager::emitHeadlampOff()
+{
+ // Send HeadlampOff event for all application
+ this->send_event(kListEventName[Event_HeadlampOff]);
+}
+
+void WindowManager::emitHeadlampOn()
+{
+ // Send HeadlampOn event for all application
+ this->send_event(kListEventName[Event_HeadlampOn]);
+}
+
+void WindowManager::emitParkingBrakeOff()
+{
+ // Send ParkingBrakeOff event for all application
+ this->send_event(kListEventName[Event_ParkingBrakeOff]);
+}
+
+void WindowManager::emitParkingBrakeOn()
+{
+ // Send ParkingBrakeOn event for all application
+ this->send_event(kListEventName[Event_ParkingBrakeOn]);
+}
+
+void WindowManager::emitLightstatusBrakeOff()
+{
+ // Send LightstatusBrakeOff event for all application
+ this->send_event(kListEventName[Event_LightstatusBrakeOff]);
+}
+
+void WindowManager::emitLightstatusBrakeOn()
+{
+ // Send LightstatusBrakeOn event for all application
+ this->send_event(kListEventName[Event_LightstatusBrakeOn]);
+}
+
+void WindowManager::emitCarStop()
+{
+ // Send CarStop event for all application
+ this->send_event(kListEventName[Event_CarStop]);
+}
+
+void WindowManager::emitCarRun()
+{
+ // Send CarRun event for all application
+ this->send_event(kListEventName[Event_CarRun]);
}
WMError WindowManager::setRequest(const string& appid, const string &role, const string &area,
@@ -761,6 +1759,48 @@ WMError WindowManager::setRequest(const string& appid, const string &role, const
return WMError::SUCCESS;
}
+WMError WindowManager::setRequest(Task task, unsigned* req_num)
+{
+ /*
+ * Queueing Phase
+ */
+ unsigned current = g_app_list.currentRequestNumber();
+
+ WMRequest req = WMRequest(task);
+ unsigned new_req = g_app_list.addRequest(req);
+ *req_num = new_req;
+ g_app_list.reqDump();
+
+ HMI_SEQ_DEBUG(current, "start sequence for task:%d", task);
+
+ return WMError::SUCCESS;
+}
+
+WMError WindowManager::setRequestForSlave(const string& appid, const string &role, const string &area,
+ Task task, unsigned* req_num)
+{
+ /*
+ * Queueing Phase
+ */
+ unsigned current = g_app_list.currentRequestNumber();
+ unsigned requested_num = g_app_list.getRequestNumber(appid);
+ if (requested_num != 0)
+ {
+ HMI_SEQ_INFO(requested_num,
+ "%s %s %s request is already queued", appid.c_str(), role.c_str(), area.c_str());
+ return REQ_REJECTED;
+ }
+
+ WMRequest req = WMRequest(appid, role, area, task);
+ unsigned new_req = g_app_list.addRequest(req);
+ *req_num = new_req;
+ g_app_list.reqDump();
+
+ HMI_SEQ_DEBUG(current, "%s start sequence with %s, %s", appid.c_str(), role.c_str(), area.c_str());
+
+ return WMError::SUCCESS;
+}
+
WMError WindowManager::checkPolicy(unsigned req_num)
{
/*
@@ -777,6 +1817,54 @@ WMError WindowManager::checkPolicy(unsigned req_num)
}
string req_area = trigger.area;
+ if (trigger.task == Task::TASK_ALLOCATE)
+ {
+ const char *msg = this->check_surface_exist(trigger.role.c_str());
+
+ if (msg)
+ {
+ HMI_SEQ_ERROR(req_num, msg);
+ return ret;
+ }
+ }
+
+ // Input event data to PolicyManager
+ if (0 > this->pmw.setInputEventData(trigger.task, trigger.role, trigger.area))
+ {
+ HMI_SEQ_ERROR(req_num, "Failed to set input event data to PolicyManager");
+ return ret;
+ }
+
+ // Execute state transition of PolicyManager
+ if (0 > this->pmw.executeStateTransition())
+ {
+ HMI_SEQ_ERROR(req_num, "Failed to execute state transition of PolicyManager");
+ return ret;
+ }
+
+ ret = WMError::SUCCESS;
+
+ g_app_list.reqDump();
+
+ return ret;
+}
+
+WMError WindowManager::checkPolicyForSlave(unsigned req_num)
+{
+ /*
+ * Check Policy
+ */
+ // get current trigger
+ bool found = false;
+ WMError ret = WMError::LAYOUT_CHANGE_FAIL;
+ auto trigger = g_app_list.getRequest(req_num, &found);
+ if (!found)
+ {
+ ret = WMError::NO_ENTRY;
+ return ret;
+ }
+ string req_area = trigger.area;
+
// Input event data to PolicyManager
if (0 > this->pmw.setInputEventData(trigger.task, trigger.role, trigger.area))
{
@@ -815,11 +1903,28 @@ WMError WindowManager::startTransition(unsigned req_num)
g_app_list.reqDump();
for (const auto &action : actions)
{
+ // TODO: application requests by old role,
+ // so convert role new to old for emitting event
+ string old_role = this->rolenew2old[action.role];
+
if (action.visible == TaskVisible::VISIBLE)
{
sync_draw_happen = true;
- struct rect r = this->lc->getAreaSize(action.area);
- action.client->emitSyncDraw(action.area, r);
+
+ this->emit_syncdraw(old_role, action.area);
+ /* TODO: emit event for app not subscriber
+ if(g_app_list.contains(y.appid))
+ g_app_list.lookUpClient(y.appid)->emit_syncdraw(y.role, y.area); */
+ }
+ else if(action.visible == TaskVisible::REQ_REMOTE_VISIBLE)
+ {
+ // If this action is for slave, send to slave
+ this->wmcon.sendRequest("syncDraw", action.client->appID().c_str(),
+ old_role.c_str(), action.area.c_str());
+ }
+ else if (action.car_state != TaskCarState::NO_TASK)
+ {
+ this->transitionCarState(action.car_state);
}
}
@@ -834,7 +1939,28 @@ WMError WindowManager::startTransition(unsigned req_num)
for (const auto &x : actions)
{
this->lc->visibilityChange(x);
- x.client->emitVisible(false);
+ string old_role = this->rolenew2old[x.role];
+
+ if (x.visible == TaskVisible::INVISIBLE)
+ {
+ emit_deactivated(old_role);
+ }
+ else if (x.visible == TaskVisible::REQ_REMOTE_INVISIBLE)
+ {
+ // If this action is for slave, send to slave
+ int i_ret = this->wmcon.sendRequest("deactivated", x.client->appID().c_str(),
+ old_role.c_str(), "");
+ if (0 > i_ret)
+ {
+ ret = WMError::FAIL;
+ }
+ }
+
+ /* if (g_app_list.contains(x.appid))
+ {
+ auto client = g_app_list.lookUpClient(x.appid);
+ //this->deactivate(client->surfaceID(x.role));
+ } */
}
this->lc->renderLayers();
ret = WMError::NO_LAYOUT_CHANGE;
@@ -842,10 +1968,63 @@ WMError WindowManager::startTransition(unsigned req_num)
return ret;
}
+void WindowManager::transitionCarState(TaskCarState task)
+{
+ if (TaskCarState::PARKING_BRAKE_OFF == task)
+ {
+ this->crr_car_info.parking_brake_stt = false;
+ this->emitParkingBrakeOff();
+ }
+ else if (TaskCarState::PARKING_BRAKE_ON == task)
+ {
+ this->crr_car_info.parking_brake_stt = true;
+ this->emitParkingBrakeOn();
+ }
+ else if (TaskCarState::ACCEL_PEDAL_OFF == task)
+ {
+ this->crr_car_info.accel_pedal_stt = false;
+ }
+ else if (TaskCarState::ACCEL_PEDAL_ON == task)
+ {
+ this->crr_car_info.accel_pedal_stt = true;
+ }
+ else if (TaskCarState::HEDLAMP_OFF == task)
+ {
+ this->crr_car_info.headlamp_stt = false;
+ this->emitHeadlampOff();
+ }
+ else if (TaskCarState::HEDLAMP_ON == task)
+ {
+ this->crr_car_info.headlamp_stt = true;
+ this->emitHeadlampOn();
+ }
+ else if (TaskCarState::LIGHTSTATUS_BRAKE_OFF == task)
+ {
+ this->crr_car_info.lightstatus_brake_stt = false;
+ this->emitLightstatusBrakeOff();
+ }
+ else if (TaskCarState::LIGHTSTATUS_BRAKE_ON == task)
+ {
+ this->crr_car_info.lightstatus_brake_stt = true;
+ this->emitLightstatusBrakeOn();
+ }
+ else if (TaskCarState::CAR_STOP == task)
+ {
+ this->crr_car_info.running_stt = false;
+ this->emitCarStop();
+ }
+ else if (TaskCarState::CAR_RUN == task)
+ {
+ this->crr_car_info.running_stt = true;
+ this->emitCarRun();
+ }
+}
+
WMError WindowManager::doEndDraw(unsigned req_num)
{
// get actions
bool found;
+ bool trigger_homescreen = false;
auto actions = g_app_list.getActions(req_num, &found);
WMError ret = WMError::SUCCESS;
if (!found)
@@ -853,6 +2032,13 @@ WMError WindowManager::doEndDraw(unsigned req_num)
ret = WMError::NO_ENTRY;
return ret;
}
+ auto trigger = g_app_list.getRequest(req_num, &found);
+ HMI_SEQ_INFO(req_num, "trigger.role = %s", trigger.role.c_str());
+
+ if(trigger.role == "homescreen")
+ {
+ trigger_homescreen = true;
+ }
HMI_SEQ_INFO(req_num, "do endDraw");
@@ -869,8 +2055,46 @@ WMError WindowManager::doEndDraw(unsigned req_num)
"Failed to manipulate surfaces while state change : %s", errorDescription(ret));
return ret;
}
- ret = this->lc->visibilityChange(act);
- act.client->emitVisible((act.visible == VISIBLE));
+
+ if(trigger_homescreen && (act.visible == TaskVisible::INVISIBLE))
+ {
+ HMI_SEQ_NOTICE(req_num, "don't change visible if homescreen role is trigger");
+ }
+ else
+ {
+ ret = this->lc->visibilityChange(act);
+ }
+
+ // Emit active/deactive event
+ string old_role = this->rolenew2old[act.role];
+ switch(act.visible)
+ {
+ case TaskVisible::VISIBLE :
+ emit_visible(old_role);
+ emit_activated(old_role);
+ break;
+ case TaskVisible::REQ_REMOTE_VISIBLE :
+ {
+ // If this action is for slave, send to slave
+ int i_ret = this->wmcon.sendRequest("activated", "", old_role.c_str(), "");
+ if (0 > i_ret)
+ {
+ ret = WMError::FAIL;
+ }
+ break;
+ }
+ case TaskVisible::INVISIBLE :
+ if(!trigger_homescreen)
+ {
+ emit_invisible(old_role);
+ emit_deactivated(old_role);
+ }
+ break;
+ default :
+ // TaskVisible::REMOTE_VISIBLE, TaskVisible::REMOTE_INVISIBLE is this case
+ // If this action is for slave, send to slave
+ break;
+ }
if (ret != WMError::SUCCESS)
{
@@ -887,9 +2111,18 @@ WMError WindowManager::doEndDraw(unsigned req_num)
for(const auto &act_flush : actions)
{
+ // TODO: application requests by old role,
+ // so convert role new to old for emitting event
+ string old_role = this->rolenew2old[act_flush.role];
+
if(act_flush.visible == TaskVisible::VISIBLE)
{
- act_flush.client->emitFlushDraw();
+ this->emit_flushdraw(old_role);
+ }
+ else if(act_flush.visible == TaskVisible::REQ_REMOTE_VISIBLE)
+ {
+ // If this action is for slave, send to slave
+ this->wmcon.sendRequest("flushDraw", "", old_role.c_str(), "");
}
}
@@ -902,7 +2135,8 @@ void WindowManager::emitScreenUpdated(unsigned req_num)
HMI_SEQ_DEBUG(req_num, "emit screen updated");
bool found = false;
auto actions = g_app_list.getActions(req_num, &found);
- if (!found)
+
+ if(!found)
{
HMI_SEQ_ERROR(req_num,
"Window Manager bug :%s : Action is not set",
@@ -910,13 +2144,15 @@ void WindowManager::emitScreenUpdated(unsigned req_num)
return;
}
+ HMI_DEBUG("@@@@@");
// create json object
json_object *j = json_object_new_object();
json_object *jarray = json_object_new_array();
for(const auto& action: actions)
{
- if(action.visible != TaskVisible::INVISIBLE)
+ if((action.visible == TaskVisible::VISIBLE) ||
+ (action.visible == TaskVisible::REMOTE_VISIBLE))
{
json_object_array_add(jarray, json_object_new_string(action.client->appID().c_str()));
}
@@ -926,7 +2162,7 @@ void WindowManager::emitScreenUpdated(unsigned req_num)
int ret = afb_event_push(
this->map_afb_event[kListEventName[Event_ScreenUpdated]], j);
- if (ret < 0)
+ if (ret != 0)
{
HMI_DEBUG("afb_event_push failed: %m");
}
@@ -944,7 +2180,7 @@ void WindowManager::setTimer()
if (g_timer_ev_src == nullptr)
{
// firsttime set into sd_event
- int ret = sd_event_add_time(afb_api_get_event_loop(afbBindingV3root), &g_timer_ev_src,
+ int ret = sd_event_add_time(afb_daemon_get_event_loop(), &g_timer_ev_src,
CLOCK_BOOTTIME, (uint64_t)(ts.tv_sec + kTimeOut) * 1000000ULL, 1, processTimerHandler, this);
if (ret < 0)
{
@@ -990,4 +2226,374 @@ void WindowManager::processNextRequest()
}
}
+const char* WindowManager::convertRoleOldToNew(char const *old_role)
+{
+ const char *new_role = nullptr;
+
+ for (auto const &on : this->roleold2new)
+ {
+ std::regex regex = std::regex(on.first);
+ if (std::regex_match(old_role, regex))
+ {
+ // role is old. So convert to new.
+ new_role = on.second.c_str();
+ break;
+ }
+ }
+
+ if (nullptr == new_role)
+ {
+ // role is new or fallback.
+ new_role = old_role;
+ }
+
+ HMI_DEBUG("old:%s -> new:%s", old_role, new_role);
+
+ return new_role;
+}
+
+int WindowManager::loadOldRolesConfigFile()
+{
+ // Get afm application installed dir
+ char const *afm_app_install_dir = getenv("AFM_APP_INSTALL_DIR");
+ HMI_DEBUG("afm_app_install_dir:%s", afm_app_install_dir);
+
+ string file_name;
+ if (!afm_app_install_dir)
+ {
+ HMI_ERROR("AFM_APP_INSTALL_DIR is not defined");
+ }
+ else
+ {
+ file_name = string(afm_app_install_dir) + string(kPathOldRolesConfigFile);
+ }
+
+ // Load old_rolea config file
+ json_object* json_obj;
+ int ret = jh::inputJsonFilie(file_name.c_str(), &json_obj);
+ if (0 > ret)
+ {
+ HMI_ERROR("Could not open %s, so use default old_roles information", kPathOldRolesConfigFile);
+ json_obj = json_tokener_parse(kDefaultOldRolesConfig);
+ }
+ HMI_DEBUG("json_obj dump:%s", json_object_get_string(json_obj));
+
+ // Perse apps
+ json_object* json_cfg;
+ if (!json_object_object_get_ex(json_obj, "old_roles", &json_cfg))
+ {
+ HMI_ERROR("Parse Error!!");
+ return -1;
+ }
+
+ int len = json_object_array_length(json_cfg);
+ HMI_DEBUG("json_cfg len:%d", len);
+ HMI_DEBUG("json_cfg dump:%s", json_object_get_string(json_cfg));
+
+ for (int i=0; i<len; i++)
+ {
+ json_object* json_tmp = json_object_array_get_idx(json_cfg, i);
+
+ const char* old_role = jh::getStringFromJson(json_tmp, "name");
+ if (nullptr == old_role)
+ {
+ HMI_ERROR("Parse Error!!");
+ return -1;
+ }
+
+ const char* new_role = jh::getStringFromJson(json_tmp, "new");
+ if (nullptr == new_role)
+ {
+ HMI_ERROR("Parse Error!!");
+ return -1;
+ }
+
+ this->roleold2new[old_role] = string(new_role);
+ }
+
+ // Check
+ for(auto itr = this->roleold2new.begin();
+ itr != this->roleold2new.end(); ++itr)
+ {
+ HMI_DEBUG(">>> role old:%s new:%s",
+ itr->first.c_str(), itr->second.c_str());
+ }
+
+ // Release json_object
+ json_object_put(json_obj);
+
+ return 0;
+}
+
+int WindowManager::saveLastModeData(unsigned req_num)
+{
+ bool found;
+ auto actions = g_app_list.getActions(req_num, &found);
+
+ HMI_DEBUG("Save LastMode data");
+
+ if (!found)
+ {
+ HMI_DEBUG("Not Found Entry");
+ return -1;
+ }
+
+ json_object *j_obj = json_object_new_object();
+ json_object *j_array = json_object_new_array();
+
+ for (const auto &act : actions)
+ {
+ if (act.visible == TaskVisible::VISIBLE)
+ {
+ unsigned layer = act.client->layerID();
+ unsigned surface = act.client->surfaceID();
+
+ t_ilm_bool visibility;
+
+ ilm_layerGetVisibility(layer, &visibility);
+
+ if (visibility == ILM_FALSE)
+ {
+ continue;
+ }
+
+ ilmSurfaceProperties sp;
+ ilm_getPropertiesOfSurface(surface, &sp);
+
+ json_object *j_array_obj = json_object_new_object();
+ json_object_object_add(j_array_obj, "role", json_object_new_string(act.role.c_str()));
+ json_object_object_add(j_array_obj, "visible",
+ json_object_new_string((visibility ? "true" : "false")));
+ json_object_object_add(j_array_obj, "area", json_object_new_string(act.area.c_str()));
+ json_object_object_add(j_array_obj, "destX", json_object_new_int(sp.destX));
+ json_object_object_add(j_array_obj, "destY", json_object_new_int(sp.destY));
+ json_object_object_add(j_array_obj, "destWidth", json_object_new_int(sp.destWidth));
+ json_object_object_add(j_array_obj, "destHeight", json_object_new_int(sp.destHeight));
+ json_object_object_add(j_array_obj, "sourceX", json_object_new_int(sp.sourceX));
+ json_object_object_add(j_array_obj, "sourceY", json_object_new_int(sp.sourceY));
+ json_object_object_add(j_array_obj, "sourceWidth", json_object_new_int(sp.sourceWidth));
+ json_object_object_add(j_array_obj, "sourceHeight", json_object_new_int(sp.sourceHeight));
+
+ json_object_array_add(j_array, j_array_obj);
+ }
+ }
+
+ json_object_object_add(j_obj, "LastModeData", j_array);
+
+ const char *buf = json_object_to_json_string(j_obj);
+
+ std::string root = getenv("AFM_APP_INSTALL_DIR");
+ std::string lastmode_path = root + WM_LASTMODE_PATH;
+
+ FILE *fp = fopen(lastmode_path.c_str(), "wb");
+ if (nullptr == fp)
+ {
+ HMI_ERROR("Could not open file");
+ return -1;
+ }
+
+ int len = strlen(buf);
+ fwrite(buf, len, 1, fp);
+
+ fclose(fp);
+
+ json_object_put(j_obj);
+
+ return 0;
+}
+
+Task WindowManager::convertCanSignalToCarStateTask(const char *signal_name)
+{
+ wm::LowCanClient *lcc = &(this->lcc);
+ Task task = Task::TASK_INVALID;
+
+ // If car info is updated, set car state change event
+ if (strstr(signal_name, lcc->kSignalName[lcc->SignalNoParkingBrake]))
+ {
+ HMI_DEBUG("Parking Brake state is changed");
+
+ if (lcc->getCurrentParkingBrakeState())
+ {
+ task = wm::Task::TASK_PARKING_BRAKE_ON;
+ }
+ else
+ {
+ task = wm::Task::TASK_PARKING_BRAKE_OFF;
+ }
+ }
+ else if (strstr(signal_name, lcc->kSignalName[lcc->SignalNoAccelPedalPos]))
+ {
+ // Update accel pedal position
+ this->crr_car_info.accel_pedal_pos = lcc->getCurrentAccelPedalPosition();
+
+ if (lcc->isChangedAccelPedalState())
+ {
+ HMI_DEBUG("Accelerator Pedal state is changed");
+
+ if (lcc->getCurrentAccelPedalState())
+ {
+ task = wm::Task::TASK_ACCEL_PEDAL_ON;
+ }
+ else
+ {
+ task = wm::Task::TASK_ACCEL_PEDAL_OFF;
+ }
+ }
+ }
+ else if (strstr(signal_name, lcc->kSignalName[lcc->SignalNoHeadlame]))
+ {
+ HMI_DEBUG("Headlamp state is changed");
+
+ if (lcc->getCurrentHeadlampState())
+ {
+ task = wm::Task::TASK_HEDLAMP_ON;
+ }
+ else
+ {
+ task = wm::Task::TASK_HEDLAMP_OFF;
+ }
+ }
+ else if (strstr(signal_name, lcc->kSignalName[lcc->SignalNoLightstatusBrake]))
+ {
+ HMI_DEBUG("Lightstatus Brake state is changed");
+
+ if (lcc->getCurrentLightstatusBrakeState())
+ {
+ task = wm::Task::TASK_LIGHTSTATUS_BRAKE_ON;
+ }
+ else
+ {
+ task = wm::Task::TASK_LIGHTSTATUS_BRAKE_OFF;
+ }
+ }
+ return task;
+}
+
+void WindowManager::inputCarStateTask(Task task)
+{
+ unsigned req_num = 0;
+ WMError ret = WMError::UNKNOWN;
+
+ ret = this->setRequest(task, &req_num);
+
+ if(ret != WMError::SUCCESS)
+ {
+ HMI_ERROR(errorDescription(ret));
+ return;
+ }
+
+ if (req_num != g_app_list.currentRequestNumber())
+ {
+ // Add request, then invoked after the previous task is finished
+ HMI_SEQ_DEBUG(req_num, "request is accepted");
+ return;
+ }
+
+ /*
+ * Do allocate tasks
+ */
+ ret = this->checkPolicy(req_num);
+
+ if (ret != WMError::SUCCESS)
+ {
+ //this->emit_error()
+ HMI_SEQ_ERROR(req_num, errorDescription(ret));
+ g_app_list.removeRequest(req_num);
+ this->processNextRequest();
+ }
+}
+
+const char *WindowManager::check_surface_exist(const char *drawing_name)
+{
+ auto const &surface_id = this->id_alloc.lookup(string(drawing_name));
+ if (!surface_id)
+ {
+ return "Surface does not exist";
+ }
+
+ /* if (!this->controller->surface_exists(*surface_id))
+ {
+ return "Surface does not exist in controller!";
+ } */
+
+ /* auto layer_id = this->layers.get_layer_id(*surface_id);
+
+ if (!layer_id)
+ {
+ return "Surface is not on any layer!";
+ } */
+
+ HMI_DEBUG("surface %d is detected", *surface_id);
+ return nullptr;
+}
+
+const char* WindowManager::kDefaultOldRolesConfig = "{ \
+ \"old_roles\": [ \
+ { \
+ \"name\": \"HomeScreen\", \
+ \"new\": \"homescreen\" \
+ }, \
+ { \
+ \"name\": \"Music\", \
+ \"new\": \"music\" \
+ }, \
+ { \
+ \"name\": \"MediaPlayer\", \
+ \"new\": \"music\" \
+ }, \
+ { \
+ \"name\": \"Video\", \
+ \"new\": \"video\" \
+ }, \
+ { \
+ \"name\": \"VideoPlayer\", \
+ \"new\": \"video\" \
+ }, \
+ { \
+ \"name\": \"WebBrowser\", \
+ \"new\": \"browser\" \
+ }, \
+ { \
+ \"name\": \"Radio\", \
+ \"new\": \"radio\" \
+ }, \
+ { \
+ \"name\": \"Phone\", \
+ \"new\": \"phone\" \
+ }, \
+ { \
+ \"name\": \"Navigation\", \
+ \"new\": \"map\" \
+ }, \
+ { \
+ \"name\": \"HVAC\", \
+ \"new\": \"hvac\" \
+ }, \
+ { \
+ \"name\": \"Settings\", \
+ \"new\": \"settings\" \
+ }, \
+ { \
+ \"name\": \"Dashboard\", \
+ \"new\": \"dashboard\" \
+ }, \
+ { \
+ \"name\": \"POI\", \
+ \"new\": \"poi\" \
+ }, \
+ { \
+ \"name\": \"Mixer\", \
+ \"new\": \"mixer\" \
+ }, \
+ { \
+ \"name\": \"Restriction\", \
+ \"new\": \"restriction\" \
+ }, \
+ { \
+ \"name\": \"^OnScreen.*\", \
+ \"new\": \"on_screen\" \
+ } \
+ ] \
+}";
+
} // namespace wm
diff --git a/src/window_manager.hpp b/src/window_manager.hpp
index 4c2c49b..da6a267 100644
--- a/src/window_manager.hpp
+++ b/src/window_manager.hpp
@@ -27,6 +27,8 @@
#include "request.hpp"
#include "wm_error.hpp"
#include "wm_layer_control.hpp"
+#include "wm_connection.hpp"
+#include "low_can_client.hpp"
extern "C"
{
#include <afb/afb-binding.h>
@@ -131,7 +133,37 @@ struct id_allocator
struct TmpClient
{
std::string appid;
- unsigned layer;
+ unsigned pid;
+};
+
+struct TmpService
+{
+ std::string appid; // Used to search who create service surface
+ std::string dest; // Used to attach service to destination application
+ std::string service;// The name of service surface
+ std::string uuid; // uuid
+ TmpService(const std::string& app, const std::string& dst,
+ const std::string& svc, const std::string& uuid)
+ : appid(app), dest(dst), service(svc), uuid(uuid) {}
+};
+
+struct CarInfo
+{
+ CarInfo()
+ : parking_brake_stt(true),
+ accel_pedal_stt(false),
+ accel_pedal_pos(0.0),
+ running_stt(false),
+ headlamp_stt(false),
+ lightstatus_brake_stt(true)
+ {};
+
+ bool parking_brake_stt;
+ bool accel_pedal_stt;
+ double accel_pedal_pos;
+ bool running_stt;
+ bool headlamp_stt;
+ bool lightstatus_brake_stt;
};
class WindowManager
@@ -155,14 +187,33 @@ class WindowManager
Event_ScreenUpdated,
+ Event_Handshake,
+
+ Event_HeadlampOff,
+ Event_HeadlampOn,
+
+ Event_ParkingBrakeOff,
+ Event_ParkingBrakeOn,
+
+ Event_LightstatusBrakeOff,
+ Event_LightstatusBrakeOn,
+
+ Event_CarStop,
+ Event_CarRun,
+
Event_Error,
Event_Val_Max = Event_Error,
};
+ enum WM_Mode
+ {
+ Mode_Standalone = 0,
+ Mode_Connection,
+ };
+
explicit WindowManager();
~WindowManager() = default;
-
WindowManager(WindowManager const &) = delete;
WindowManager &operator=(WindowManager const &) = delete;
WindowManager(WindowManager &&) = delete;
@@ -172,33 +223,81 @@ class WindowManager
result<int> api_request_surface(char const *appid, char const *role);
char const *api_request_surface(char const *appid, char const *role, char const *ivi_id);
+ bool api_set_role(char const *appid, char const *role);
void api_activate_window(char const *appid, char const *role, char const *drawing_area, const reply_func &reply);
+ void api_activate_surface_for_slave(char const *appid, char const *drawing_name,
+ char const *drawing_area, const reply_func &reply);
+ void api_activate_surface_to_master(char const *appid, char const *drawing_name,
+ char const *drawing_area, const reply_func &reply);
void api_deactivate_window(char const *appid, char const *role, const reply_func &reply);
+ void api_deactivate_surface_for_slave(char const *appid, char const *drawing_name,
+ const reply_func &reply);
+ void api_deactivate_surface_to_master(char const *appid, char const *drawing_name,
+ const reply_func &reply);
void api_enddraw(char const *appid, char const *role);
+ int api_subscribe(afb_req req, int event_id);
+ void api_handshake();
+ void api_enddraw_for_remote(char const *appid, char const *drawing_name);
+ bool api_client_set_render_order(const char *appid, const std::vector<std::string> &render_order);
+ std::string api_client_attach_service_surface(const char* appid, const char* dest, const char* service_surface);
json_object* api_get_area_list();
void api_change_area_size(ChangeAreaReq &areas);
- bool api_subscribe(afb_req_t req, EventType event_id);
result<json_object *> api_get_display_info();
result<json_object *> api_get_area_info(char const *role);
+ result<json_object *> api_get_car_info(char const *label);
+ void send_event(const std::string& evname);
+ void send_event(const std::string& evname, const std::string& role);
+ void send_event(const std::string& evname, const std::string& role, const std::string& area, int x, int y, int w, int h);
// Events from the compositor we are interested in
- void surface_created(unsigned surface_id);
+ void surface_created(unsigned pid, unsigned surface_id);
void surface_removed(unsigned surface_id);
void removeClient(const std::string &appid);
void exceptionProcessForTransition();
+ const char* convertRoleOldToNew(char const *role);
+
+ void analyzeReceivedEvent(const char *event, struct json_object *object);
+
// Do not use this function
void timerHandler();
void startTransitionWrapper(std::vector<WMAction> &actions);
void processError(WMError error);
+ void processForRemoteRequest(json_object *data);
+ std::string searchApp(unsigned pid, unsigned ppid, unsigned surface, json_object* resp);
+ void storeSurface(const std::string& appid, unsigned ppid, unsigned surface);
+
+ WMConnection wmcon;
private:
- unsigned generateLayerForClient(const std::string &role);
+ // WM Events to clients
+ void emit_activated(const std::string& role);
+ void emit_deactivated(const std::string& role);
+ void emit_syncdraw(const std::string& role, char const *area, int x, int y, int w, int h);
+ void emit_syncdraw(const std::string &role, const std::string &area);
+ void emit_flushdraw(const std::string& role);
+ void emit_visible(const std::string& role, bool is_visible);
+ void emit_invisible(const std::string& role);
+ void emit_visible(const std::string& role);
+ void emitHeadlampOff();
+ void emitHeadlampOn();
+ void emitParkingBrakeOff();
+ void emitParkingBrakeOn();
+ void emitLightstatusBrakeOff();
+ void emitLightstatusBrakeOn();
+ void emitCarStop();
+ void emitCarRun();
+
WMError setRequest(const std::string &appid, const std::string &role, const std::string &area,
Task task, unsigned *req_num);
+ WMError setRequest(Task task, unsigned* req_num);
+ WMError setRequestForSlave(const std::string& appid, const std::string &role,
+ const std::string &area, Task task, unsigned* req_num);
WMError checkPolicy(unsigned req_num);
+ WMError checkPolicyForSlave(unsigned req_num);
WMError startTransition(unsigned req_num);
+ void transitionCarState(TaskCarState task);
WMError doEndDraw(unsigned req_num);
void emitScreenUpdated(unsigned req_num);
@@ -207,16 +306,34 @@ class WindowManager
void stopTimer();
void processNextRequest();
+ int loadOldRolesConfigFile();
+
+ int saveLastModeData(unsigned req_num);
+
+ Task convertCanSignalToCarStateTask(const char *signal_name);
+ void inputCarStateTask(Task task);
+
+ const char *check_surface_exist(const char *role);
+
private:
- std::map<std::string, afb_event_t> map_afb_event;
- std::unordered_map<std::string, struct rect> area2size;
+ std::map<std::string, struct afb_event> map_afb_event;
+ std::unordered_map<std::string, std::string> roleold2new;
+ std::unordered_map<std::string, std::string> rolenew2old;
std::shared_ptr<LayerControl> lc;
+
+ LowCanClient lcc;
+ CarInfo crr_car_info;
+
PMWrapper pmw;
rect_map area_info;
struct id_allocator id_alloc;
+ bool end_init;
+
// ID allocation and proxy methods for lookup
std::unordered_map<unsigned, struct TmpClient> tmp_surface2app;
+ std::vector<struct TmpService> tmp_services;
+ static const char* kDefaultOldRolesConfig;
};
} // namespace wm
diff --git a/src/wm_client.cpp b/src/wm_client.cpp
index 4bccb8c..3acf09e 100644
--- a/src/wm_client.cpp
+++ b/src/wm_client.cpp
@@ -16,7 +16,10 @@
#include <json-c/json.h>
#include "wm_client.hpp"
+#include "util.hpp"
#include <ilm/ilm_control.h>
+#include <uuid/uuid.h>
+
#define INVALID_SURFACE_ID 0
@@ -26,34 +29,19 @@ using std::vector;
namespace wm
{
-static const char kActive[] = "active";
-static const char kInactive[] = "inactive";
-static const char kVisible[] = "visible";
-static const char kInvisible[] = "invisible";
-static const char kSyncDraw[] = "syncDraw";
-static const char kFlushDraw[] = "flushDraw";
+static const vector<string> kWMEvents = {
+ // Private event for applications
+ "syncDraw", "flushDraw", "visible", "invisible", "active", "inactive", "error"};
+static const vector<string> kErrorDescription = {
+ "unknown-error"};
+
static const char kKeyDrawingName[] = "drawing_name";
-static const char kKeyDrawingArea[] = "drawing_area";
-static const char kKeyRole[] = "role";
-static const char kKeyArea[] = "area";
static const char kKeyrole[] = "role";
static const char kKeyError[] = "error";
-static const char kKeyErrorDesc[] = "errorDescription";
-static const char kKeyX[] = "x";
-static const char kKeyY[] = "y";
-static const char kKeyWidth[] = "width";
-static const char kKeyHeight[] = "height";
-static const char kKeyDrawingRect[] = "drawing-rect";
-
-static const vector<string> kWMEvents = {
- // Private event for applications
- kActive, kInactive,
- kVisible, kInvisible,
- kSyncDraw, kFlushDraw,
- kKeyError};
+static const char kKeyErrorDesc[] = "kErrorDescription";
WMClient::WMClient(const string &appid, unsigned layer, unsigned surface, const string &role)
- : id(appid), layer(layer), is_source_set(false),
+ : id(appid), layer(layer),
role2surface(0)
{
role2surface[role] = surface;
@@ -62,7 +50,7 @@ WMClient::WMClient(const string &appid, unsigned layer, unsigned surface, const
#if GTEST_ENABLED
string ev = x;
#else
- afb_event_t ev = afb_api_make_event(afbBindingV3root, x.c_str());
+ afb_event ev = afb_daemon_make_event(x.c_str());
#endif
evname2afb_event[x] = ev;
}
@@ -71,9 +59,6 @@ WMClient::WMClient(const string &appid, unsigned layer, unsigned surface, const
WMClient::WMClient(const string &appid, const string &role)
: id(appid),
layer(0),
- is_source_set(false),
- is_active(false),
- main_role(role),
role2surface(0),
evname2afb_event(0)
{
@@ -83,7 +68,7 @@ WMClient::WMClient(const string &appid, const string &role)
#if GTEST_ENABLED
string ev = x;
#else
- afb_event_t ev = afb_api_make_event(afbBindingV3root, x.c_str());
+ afb_event ev = afb_daemon_make_event(x.c_str());
#endif
evname2afb_event[x] = ev;
}
@@ -92,8 +77,6 @@ WMClient::WMClient(const string &appid, const string &role)
WMClient::WMClient(const string &appid, unsigned layer, const string &role)
: id(appid),
layer(layer),
- is_source_set(false),
- is_active(false),
main_role(role),
role2surface(0),
evname2afb_event(0)
@@ -104,7 +87,7 @@ WMClient::WMClient(const string &appid, unsigned layer, const string &role)
#if GTEST_ENABLED
string ev = x;
#else
- afb_event_t ev = afb_api_make_event(afbBindingV3root, x.c_str());
+ afb_event ev = afb_daemon_make_event(x.c_str());
#endif
evname2afb_event[x] = ev;
}
@@ -120,45 +103,16 @@ string WMClient::role() const
return this->main_role;
}
-void WMClient::setRole(const string& role)
-{
- this->main_role = role;
-}
-
unsigned WMClient::layerID() const
{
return this->layer;
}
-void WMClient::setLayerID(unsigned id)
-{
- this->layer = id;
-}
-
unsigned WMClient::surfaceID() const
{
return this->surface;
}
-void WMClient::registerSurface(unsigned surface)
-{
- this->surface = surface;
-}
-
-void WMClient::activate()
-{
- if(!this->isActive())
- this->emitActive(true); // emit when state is changed
- this->is_active = true;
-}
-
-void WMClient::deactivate()
-{
- if(this->isActive())
- this->emitActive(false); // emit when state is changed
- this->is_active = false;
-}
-
/**
* Add surface to the client
*
@@ -179,16 +133,6 @@ WMError WMClient::addSurface(unsigned surface)
return (err == ILM_SUCCESS) ? WMError::SUCCESS : WMError::FAIL;
}
-void WMClient::setSurfaceSizeCorrectly()
-{
- this->is_source_set = true;
-}
-
-bool WMClient::isSourceSizeSet()
-{
- return this->is_source_set;
-}
-
bool WMClient::removeSurfaceIfExist(unsigned surface)
{
bool ret = false;
@@ -197,152 +141,131 @@ bool WMClient::removeSurfaceIfExist(unsigned surface)
this->surface = INVALID_SURFACE_ID;
ret = true;
}
- return ret;
-}
-
-bool WMClient::subscribe(afb_req_t req, const string &evname)
-{
- int ret = afb_req_subscribe(req, this->evname2afb_event[evname]);
- if (ret)
+ else
{
- HMI_DEBUG("Failed to subscribe %s", evname.c_str());
- return false;
+ for(auto &x : this->service2surfaces)
+ {
+ if(x.second == surface)
+ {
+ ret = true;
+ string key = x.first;
+ this->service2surfaces.erase(key);
+ this->service2supplier.erase(key);
+ }
+ }
}
- return true;
+ return ret;
}
-void WMClient::emitVisible(bool visible)
+WMError WMClient::setRenderOrder(const vector<string> &order)
{
- // error check
- bool allow_send = false;
- if(visible)
+ WMError ret = WMError::SUCCESS;
+ this->surface_render_order.clear();
+ for(const auto& x : order)
{
- allow_send = afb_event_is_valid(this->evname2afb_event[kVisible]);
- }
- else
- {
- allow_send = afb_event_is_valid(this->evname2afb_event[kInvisible]);
- }
- if(allow_send)
- {
- json_object* j = json_object_new_object();
- json_object_object_add(j, kKeyRole, json_object_new_string(this->role().c_str()));
- json_object_object_add(j, kKeyDrawingName, json_object_new_string(this->role().c_str()));
-
- if(visible)
+ unsigned s; // surface
+ if(x == this->role())
{
- afb_event_push(this->evname2afb_event[kVisible], j);
+ s = this->surfaceID();
+ }
+ else if(this->service2surfaces.count(x) != 0)
+ {
+ s = this->service2surfaces[x];
}
else
{
- afb_event_push(this->evname2afb_event[kInvisible], j);
+ ret = WMError::NOT_REGISTERED;
+ break;
}
+ this->surface_render_order.push_back(s);
}
- else
- {
- HMI_ERROR("Failed to send %s", __func__);
- }
-}
-
-void WMClient::emitActive(bool active)
-{
- // error check
- bool allow_send = false;
- if(active)
- {
- allow_send = afb_event_is_valid(this->evname2afb_event[kActive]);
- }
- else
+ if(ret == WMError::SUCCESS)
{
- allow_send = afb_event_is_valid(this->evname2afb_event[kInactive]);
- }
- if(allow_send)
- {
- json_object* j = json_object_new_object();
- json_object_object_add(j, kKeyRole, json_object_new_string(this->role().c_str()));
- json_object_object_add(j, kKeyDrawingName, json_object_new_string(this->role().c_str()));
-
- if(active)
+ int count = 0;
+ t_ilm_layer* id_array = new t_ilm_surface[this->surface_render_order.size()];
+ if(id_array == nullptr)
{
- afb_event_push(this->evname2afb_event[kActive], j);
+ HMI_WARNING("short memory");
+ ret = WMError::FAIL;
}
else
{
- afb_event_push(this->evname2afb_event[kInactive], j);
+ for(const auto& i : this->surface_render_order)
+ {
+ id_array[count] = i;
+ ++count;
+ }
+ ilm_layerSetRenderOrder(this->layerID(),
+ id_array, this->surface_render_order.size());
+ delete id_array;
}
}
- else
- {
- HMI_ERROR("Failed to send %s", __func__);
- }
+ return ret;
}
-void WMClient::emitSyncDraw(const string& area, struct rect& r)
+string WMClient::attachTmpServiceSurface(const string& supplier, const string& service_surface)
{
- HMI_NOTICE("trace");
- if(afb_event_is_valid(this->evname2afb_event[kSyncDraw]))
- {
- json_object *j_rect = json_object_new_object();
- json_object_object_add(j_rect, kKeyX, json_object_new_int(r.x));
- json_object_object_add(j_rect, kKeyY, json_object_new_int(r.y));
- json_object_object_add(j_rect, kKeyWidth, json_object_new_int(r.w));
- json_object_object_add(j_rect, kKeyHeight, json_object_new_int(r.h));
-
- json_object* j = json_object_new_object();
- json_object_object_add(j, kKeyRole, json_object_new_string(this->role().c_str()));
- json_object_object_add(j, kKeyDrawingName, json_object_new_string(this->role().c_str()));
- json_object_object_add(j, kKeyDrawingArea, json_object_new_string(area.c_str()));
- json_object_object_add(j, kKeyArea, json_object_new_string(this->role().c_str()));
+ string uuid;
+ uuid_t u;
+ char out[37]; // uuid is 36 characters
+ uuid_generate_random(u);
+ uuid_unparse(u, out);
+ uuid = out;
+ this->service2supplier.emplace(service_surface, supplier);
+ return uuid;
+}
- json_object_object_add(j, kKeyDrawingRect, j_rect);
- afb_event_push(this->evname2afb_event[kSyncDraw], j);
- }
- else
+WMError WMClient::attachServiceSurface(const string& service_surface, unsigned surface)
+{
+ WMError ret = WMError::NOT_REGISTERED;
+ if(this->service2supplier.count(service_surface) != 0)
{
- HMI_ERROR("Failed to send %s", __func__);
+ this->service2surfaces.emplace(service_surface, surface);
+ ret = WMError::SUCCESS;
}
+ return ret;
}
-void WMClient::emitFlushDraw()
+#if GTEST_ENABLED
+bool WMClient::subscribe(afb_req req, const string &evname)
{
- if(afb_event_is_valid(this->evname2afb_event[kFlushDraw]))
- {
- json_object* j = json_object_new_object();
- json_object_object_add(j, kKeyRole, json_object_new_string(this->role().c_str()));
- json_object_object_add(j, kKeyDrawingName, json_object_new_string(this->role().c_str()));
- afb_event_push(this->evname2afb_event[kFlushDraw], nullptr);
+ if(evname != kKeyError){
+ HMI_DEBUG("error is only enabeled for now");
+ return false;
}
- else
+ int ret = afb_req_subscribe(req, this->evname2afb_event[evname]);
+ if (ret)
{
- HMI_ERROR("Failed to send %s", __func__);
+ HMI_DEBUG("Failed to subscribe %s", evname.c_str());
+ return false;
}
+ return true;
}
-void WMClient::emitError(WMError error)
+void WMClient::emitError(WM_CLIENT_ERROR_EVENT ev)
{
if (!afb_event_is_valid(this->evname2afb_event[kKeyError])){
HMI_ERROR("event err is not valid");
return;
}
json_object *j = json_object_new_object();
- json_object_object_add(j, kKeyError, json_object_new_int(error));
- json_object_object_add(j, kKeyErrorDesc, json_object_new_string(errorDescription(error)));
- HMI_DEBUG("error: %d, description:%s", error, errorDescription(error));
+ json_object_object_add(j, kKeyError, json_object_new_int(ev));
+ json_object_object_add(j, kKeyErrorDesc, json_object_new_string(kErrorDescription[ev].c_str()));
+ HMI_DEBUG("error: %d, description:%s", ev, kErrorDescription[ev].c_str());
+
int ret = afb_event_push(this->evname2afb_event[kKeyError], j);
if (ret != 0)
{
HMI_DEBUG("afb_event_push failed: %m");
}
}
+#endif
void WMClient::dumpInfo()
{
DUMP("APPID : %s", id.c_str());
DUMP(" LAYER : %d", layer);
- for (const auto &x : this->role2surface)
- {
- DUMP(" ROLE : %s , SURFACE : %d", x.first.c_str(), x.second);
- }
+ DUMP(" ROLE : %s , SURFACE : %d", main_role.c_str(), surface);
}
} // namespace wm \ No newline at end of file
diff --git a/src/wm_client.hpp b/src/wm_client.hpp
index 7df4dea..fc171f4 100644
--- a/src/wm_client.hpp
+++ b/src/wm_client.hpp
@@ -20,17 +20,22 @@
#include <vector>
#include <string>
#include <unordered_map>
-#include "util.hpp"
#include "wm_error.hpp"
extern "C"
{
+#define AFB_BINDING_VERSION 2
#include <afb/afb-binding.h>
}
namespace wm
{
+enum WM_CLIENT_ERROR_EVENT
+{
+ UNKNOWN_ERROR
+};
+
class WMClient
{
public:
@@ -45,47 +50,43 @@ class WMClient
std::string appID() const;
std::string role() const;
- void setRole(const std::string& role);
unsigned layerID() const;
- void setLayerID(unsigned id);
unsigned surfaceID() const;
- void registerSurface(unsigned surface);
- void activate();
- void deactivate();
- std::string area() const {return this->app_area;};
- void setArea(const std::string area) {this->app_area = area;}
+ // void setRole(const std::string& role);
+ // void appendRole(const std::string& role);
WMError addSurface(unsigned surface);
- bool isSourceSizeSet();
- void setSurfaceSizeCorrectly();
- bool isActive() { return this->is_active;}
bool removeSurfaceIfExist(unsigned surface);
+ // bool removeRole(const std::string& role);
+ std::vector<unsigned> renderOrder() const;
+ WMError setRenderOrder(const std::vector<std::string>& order);
+ std::string attachTmpServiceSurface(const std::string& from, const std::string& service_surface);
+ WMError attachServiceSurface(const std::string& service_surface, unsigned surface);
- bool subscribe(afb_req_t req, const std::string &event_name);
- void emitActive(bool active);
- void emitVisible(bool visible);
- void emitSyncDraw(const std::string& area, struct rect& r);
- void emitFlushDraw();
- void emitError(WMError error);
+#if GTEST_ENABLED
+ bool subscribe(afb_req req, const std::string &event_name);
+ void emitError(WM_CLIENT_ERROR_EVENT ev);
+#endif
void dumpInfo();
private:
std::string id;
unsigned layer;
- bool is_source_set;
- bool is_active;
std::string main_role;
- std::string app_area;
+ std::string area;
unsigned surface; // currently, main application has only one surface.
//std::vector<std::string> role_list;
+ std::vector<unsigned> surface_render_order;
+ std::unordered_map<std::string, unsigned> service2surfaces;
std::unordered_map<std::string, unsigned> role2surface;
+ std::unordered_map<std::string, std::string> service2supplier;
#if GTEST_ENABLED
// This is for unit test. afb_make_event occurs sig11 if call not in afb-binding
std::unordered_map<std::string, std::string> evname2afb_event;
#else
- std::unordered_map<std::string, afb_event_t> evname2afb_event;
+ std::unordered_map<std::string, struct afb_event> evname2afb_event;
#endif
};
} // namespace wm
-#endif
+#endif \ No newline at end of file
diff --git a/src/wm_connection.cpp b/src/wm_connection.cpp
new file mode 100644
index 0000000..af970f5
--- /dev/null
+++ b/src/wm_connection.cpp
@@ -0,0 +1,845 @@
+/*
+ * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+ *
+ * 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 "wm_connection.hpp"
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include "json_helper.hpp"
+#include "util.hpp"
+
+extern "C"
+{
+#include <afb/afb-binding.h>
+#include <systemd/sd-event.h>
+}
+
+
+/**
+ * namespace wm
+ */
+namespace wm
+{
+
+
+namespace
+{
+
+static const char kPathConnectionConfigFile[] = "/etc/hmi-config/connection.json";
+static const char kPathTimeoutConfigFile[] = "/etc/timeout.json";
+static const char kDefaultIpAddr[] = "192.168.10.10";
+static const int kDefaultPort = 4000;
+static const uint64_t kDefaultTimes = 60000;
+static const uint64_t kDefaultSleep = 50;
+static struct sd_event_source *g_limit_timer_src = nullptr;
+static struct sd_event_source *g_sleep_timer_src = nullptr;
+
+static int setTimer(sd_event_source **src, uint64_t usec, void* handler, void* data)
+{
+ int ret = sd_event_add_time(afb_daemon_get_event_loop(), src,
+ CLOCK_BOOTTIME, usec, 1, (sd_event_time_handler_t)handler, data);
+
+ if (ret < 0)
+ {
+ HMI_ERROR("Colud't set timer");
+ }
+
+ return ret;
+}
+
+static void updateTimer(sd_event_source *src, uint64_t usec)
+{
+ sd_event_source_set_time(src, usec);
+ sd_event_source_set_enabled(src, SD_EVENT_ONESHOT);
+}
+
+static void stopEvent(sd_event_source *src)
+{
+ int ret = sd_event_source_set_enabled(src, SD_EVENT_OFF);
+ if (ret < 0)
+ {
+ HMI_ERROR("Not set SD_EVENT_OFF (%s)", strerror(-ret));
+ }
+ sd_event_source_unref(src);
+}
+
+static int onIoEventReceive(sd_event_source *src, int fd, uint32_t revents, void * data)
+{
+ WMConnection *p_wmcon = (WMConnection*)data;
+
+ json_object *j_out[10];
+ int j_cnt;
+ int ret = p_wmcon->receive(j_out, &j_cnt, fd);
+ if (0 > ret)
+ {
+ return 0;
+ }
+
+ for(int i = 0; i < j_cnt; i++)
+ {
+ const char* rq = jh::getStringFromJson(j_out[i], "req");
+ const char* id = jh::getStringFromJson(j_out[i], "appid");
+ const char* dn = jh::getStringFromJson(j_out[i], "drawing_name");
+ const char* da = jh::getStringFromJson(j_out[i], "drawing_area");
+
+ HMI_DEBUG("req:%s appid:%s, drawing_name:%s, drawing_area:%s", rq, id, dn, da);
+
+ // Callback
+ p_wmcon->callOnReceivedHandler(j_out[i]);
+ }
+
+ return 0;
+}
+
+static int onIoEventAccept(sd_event_source *src, int fd, uint32_t revents, void * data)
+{
+ WMConnection *p_wmcon = (WMConnection*)data;
+
+ p_wmcon->serverAccept(fd);
+
+ return 0;
+}
+
+static int onIoEventConnected(sd_event_source *src, int fd, uint32_t revents, void * data)
+{
+ WMConnection *p_wmcon = (WMConnection*)data;
+
+ int ret = p_wmcon->connectedToServer(fd);
+
+ if (ret == 0)
+ {
+ stopEvent(src);
+
+ ret = sd_event_add_io(afb_daemon_get_event_loop(), nullptr,
+ fd, EPOLLIN, onIoEventReceive, p_wmcon);
+ }
+
+ return ret;
+}
+
+static int sleepTimerHandler(sd_event_source *s, uint64_t usec, void *userdata)
+{
+ WMConnection *p_wmcon = (WMConnection*)userdata;
+
+ int ret = p_wmcon->connectToEcu();
+
+ return ret;
+}
+
+static void limitTimerHandler(sd_event_source *s, uint64_t usec, void *userdata)
+{
+ WMConnection *p_wmcon = (WMConnection*)userdata;
+
+ p_wmcon->connectionTimeLimit();
+}
+
+} // namespace
+
+WMConnection::WMConnection()
+{
+ this->end_init = false;
+
+ //Load timeout config file
+ this->loadTimeoutConfigFile();
+
+ // Load connection config file
+ this->loadConnectionConfigFile();
+
+ // TODO: ECU name should be decide by config file
+ this->ecu_name = this->mode;
+}
+
+int WMConnection::initialize()
+{
+ int ret;
+ uint64_t sleepTime, limitTime;
+
+ // Initialize for Master/Slave
+ ret = this->initializeServer();
+
+ sleepTime = getNextTimerTime(this->sleep);
+
+ if (sleepTime <= 0)
+ {
+ HMI_ERROR("Cloud't get Next Timer");
+ goto connection_init_error;
+ }
+
+ ret = setTimer(&g_sleep_timer_src, sleepTime, (void *)sleepTimerHandler, this);
+ sd_event_source_set_enabled(g_sleep_timer_src, SD_EVENT_OFF);
+
+ limitTime = getNextTimerTime(this->times);
+
+ if (limitTime <= 0)
+ {
+ HMI_ERROR("Cloud't get Next Timer");
+ goto connection_init_error;
+ }
+
+ ret = setTimer(&g_limit_timer_src, limitTime, (void *)limitTimerHandler, this);
+
+ this->connectToEcu();
+
+ return ret;
+
+
+connection_init_error:
+ HMI_ERROR("Connection Initialize Failed");
+ return -1;
+}
+
+void WMConnection::registerCallback(ReceivedHandler on_received)
+{
+ this->onReceived = on_received;
+}
+
+int WMConnection::sendRequest(char const *req, char const *appid,
+ char const *drawing_name, char const *drawing_area)
+{
+ int ret;
+ json_object *j_obj = json_object_new_object();
+ json_object_object_add(j_obj, "req", json_object_new_string(req));
+ json_object_object_add(j_obj, "appid", json_object_new_string(appid));
+ json_object_object_add(j_obj, "drawing_name", json_object_new_string(drawing_name));
+ json_object_object_add(j_obj, "drawing_area", json_object_new_string(drawing_area));
+
+ std::string ecu_name = getAppIdToEcuName(appid);
+
+ HMI_DEBUG("send ecu_name %s", ecu_name.c_str());
+
+ ret = this->send(j_obj, ecu_name);
+
+ json_object_put(j_obj);
+
+ return ret;
+}
+
+int WMConnection::send(struct json_object* j_in, std::string ecu_name)
+{
+ SocketInfo *socketData = &this->wm_socket[ecu_name];
+
+ // Convert json_object to string to send
+ const char *buf = json_object_to_json_string(j_in);
+ if (nullptr == buf)
+ {
+ HMI_ERROR("Failed to convert json_object to string");
+ return -1;
+ }
+
+ int len = strlen(buf);
+
+ HMI_DEBUG("Send data(len:%d): %s", len, buf);
+
+ int n = write(socketData->connectedSocket(), buf, len);
+ if(0 > n)
+ {
+ HMI_ERROR("Failed to send data (%s)", strerror(errno));
+ return -1;
+ }
+
+ return 0;
+}
+
+bool WMConnection::isRemoteArea(const char* area)
+{
+ if (nullptr == area)
+ {
+ return false;
+ }
+
+ std::string str_area = std::string(area);
+ if ("" == str_area)
+ {
+ return false;
+ }
+
+ std::vector<std::string> elements;
+ elements = parseString(str_area, '.');
+
+ for (auto itr = this->wm_socket.begin(); itr != this->wm_socket.end(); ++itr)
+ {
+ if (itr->first == elements[0])
+ {
+ if (itr->first != this->ecu_name)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool WMConnection::isConnecting(std::string ecu_name)
+{
+ return (0 > this->wm_socket[ecu_name].connectedSocket()) ? false : true;
+}
+
+bool WMConnection::isConnectionMode()
+{
+ return (Mode_Connection == this->wm_mode) ? true : false;
+}
+
+std::string WMConnection::parseMasterArea(const char* area)
+{
+ std::string ret_area = "";
+ std::vector<std::string> elements;
+ elements = parseString(std::string(area), '.');
+
+ if ("master" != elements[0])
+ {
+ return std::string(area);
+ }
+
+ for (auto itr = (elements.begin() + 1); itr != elements.end(); ++itr)
+ {
+ ret_area += *itr;
+
+ if ((elements.end() - 1) != itr)
+ {
+ ret_area += ".";
+ }
+ }
+ return ret_area;
+}
+
+bool WMConnection::isSyncDrawingForRemote(const char* appid)
+{
+ if (std::string(appid) == this->syndDrawingAppId)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+void WMConnection::startSyncDrawForRemote(const char* appid)
+{
+ this->syndDrawingAppId = std::string(appid);
+}
+
+void WMConnection::finishSyncDrawForRemote(const char* appid)
+{
+ if (std::string(appid) == this->syndDrawingAppId)
+ {
+ this->syndDrawingAppId = "";
+ }
+}
+
+std::string WMConnection::getAreaToEcuName(const char* area)
+{
+ std::string result;
+ std::string str_area = std::string(area);
+
+ if (str_area.find('.') != std::string::npos)
+ {
+ std::vector<std::string> elements;
+ elements = parseString(str_area, '.');
+ result = elements[0];
+ }
+ else
+ {
+ result = str_area;
+ }
+
+ return result;
+}
+
+std::string WMConnection::getSocketToEcuName(int socket)
+{
+ for (auto itr = this->wm_socket.begin(); itr != this->wm_socket.end(); ++itr)
+ {
+ if (socket == itr->second.connectedSocket())
+ {
+ return itr->first;
+ }
+ }
+
+ return "";
+}
+
+std::string WMConnection::getMySocketToEcuName(int socket)
+{
+ for (auto itr = this->wm_socket.begin(); itr != this->wm_socket.end(); ++itr)
+ {
+ if (socket == itr->second.mySocket())
+ {
+ return itr->first;
+ }
+ }
+
+ return "";
+}
+
+std::string WMConnection::getAppIdToEcuName(std::string appid)
+{
+ if (appid2ecuName.count(appid) == 1)
+ {
+ return this->appid2ecuName[appid];
+ }
+ else
+ {
+ return "";
+ }
+}
+
+std::string WMConnection::getIpToEcuName(std::string ip)
+{
+ for (auto itr = this->wm_socket.begin(); itr != this->wm_socket.end(); ++itr)
+ {
+ if (ip == itr->second.ip())
+ {
+ return itr->first;
+ }
+ }
+
+ return "";
+}
+
+void WMConnection::setAppIdToEcuName(std::string appid, std::string ecu_name)
+{
+ this->appid2ecuName[appid] = ecu_name;
+}
+
+void WMConnection::setAppIdToReceivedEcuName(std::string appid)
+{
+ this->appid2ecuName[appid] = received_ecu_name;
+}
+
+std::string WMConnection::getEcuName()
+{
+ return this->ecu_name;
+}
+
+bool WMConnection::getEndInit()
+{
+ return this->end_init;
+}
+
+void WMConnection::callOnReceivedHandler(json_object *j_out)
+{
+ this->onReceived(j_out);
+}
+
+int WMConnection::initializeServer()
+{
+ int ret = 0;
+ struct sockaddr_in addr;
+
+ SocketInfo *socketData = &this->wm_socket[this->ecu_name];
+
+ // Create socket
+ socketData->setMySocket(socket(AF_INET, SOCK_STREAM, 0));
+ if (0 > socketData->mySocket())
+ {
+ HMI_ERROR("Failed to create socket (%s)", strerror(errno));
+ return -1;
+ }
+
+ socketData->setConnectedSocket(socketData->mySocket());
+
+ // Bind socket
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons(socketData->wmPort());
+ addr.sin_addr.s_addr = htonl(INADDR_ANY);
+
+ ret = bind(socketData->mySocket(), (struct sockaddr *)&addr, sizeof(addr));
+ if (0 > ret)
+ {
+ HMI_ERROR("Failed to bind socket (%s)", strerror(errno));
+ return -1;
+ }
+
+ // Listen connection
+ ret = listen(socketData->mySocket(), 1);
+ if (0 > ret)
+ {
+ HMI_ERROR("Failed to listen connection (%s)", strerror(errno));
+ return -1;
+ }
+
+ // Register callback to accept connection
+ ret = sd_event_add_io(afb_daemon_get_event_loop(), nullptr,
+ socketData->mySocket(), EPOLLIN,
+ onIoEventAccept, this);
+ if (0 > ret)
+ {
+ HMI_ERROR("Failed to add I/O event accept(%s)", strerror(-ret));
+ return -1;
+ }
+
+ return ret;
+}
+
+int WMConnection::initializeClient(std::string ecu_name)
+{
+ SocketInfo *socketData = &this->wm_socket[ecu_name];
+
+ if (socketData->mySocket() != -1)
+ {
+ close(socketData->mySocket());
+ }
+
+ // Create socket
+ int my_socket = socket(AF_INET, SOCK_STREAM, 0);
+ if (0 > my_socket)
+ {
+ HMI_ERROR("Failed to create socket (%s)", strerror(errno));
+ return -1;
+ }
+
+ socketData->setMySocket(my_socket);
+
+ return 0;
+}
+
+int WMConnection::connectToEcu()
+{
+ int cnt = 0;
+
+ HMI_DEBUG("Start Connection");
+
+ if (this->wm_socket.empty())
+ {
+ HMI_DEBUG("Connection destination is not written to connection.json");
+ stopEvent(g_limit_timer_src);
+ stopEvent(g_sleep_timer_src);
+
+ this->end_init = true;
+ this->wm_mode = Mode_Standalone;
+
+ return 0;
+ }
+
+ for (auto itr = this->wm_socket.begin(); itr != this->wm_socket.end(); ++itr)
+ {
+ std::string ecu_name = itr->first;
+ HMI_DEBUG("ECU Names %s", ecu_name.c_str());
+
+ if (itr->second.connectedSocket() != -1 || !itr->second.masterMode())
+ {
+ cnt++;
+ HMI_DEBUG("Already Connected");
+ continue;
+ }
+
+ if (itr->second.masterMode())
+ {
+ HMI_DEBUG("Try Connection");
+ connectToServer(ecu_name);
+ }
+ }
+
+ if (cnt == (int)this->wm_socket.size())
+ {
+ HMI_DEBUG("All Connected!!");
+
+ stopEvent(g_sleep_timer_src);
+ stopEvent(g_limit_timer_src);
+
+ this->end_init = true;
+ this->wm_mode = Mode_Connection;
+
+ return 0;
+ }
+
+ uint64_t sleepTime = getNextTimerTime(this->sleep);
+ updateTimer(g_sleep_timer_src, sleepTime);
+
+ return 0;
+}
+
+void WMConnection::connectionTimeLimit()
+{
+ HMI_DEBUG("Time Limit");
+
+ stopEvent(g_sleep_timer_src);
+ stopEvent(g_limit_timer_src);
+
+ this->wm_socket[this->ecu_name].setConnectedSocket(-1);
+ this->wm_mode = Mode_Standalone;
+
+ for (auto itr = this->wm_socket.begin(); itr != this->wm_socket.end(); ++itr)
+ {
+ if (itr->second.connectedSocket() != -1)
+ {
+ HMI_DEBUG("Connection Mode");
+ this->wm_mode = Mode_Connection;
+ }
+ else
+ {
+ close(itr->second.mySocket());
+ }
+ }
+
+ if (this->wm_mode == Mode_Standalone)
+ {
+ close(this->wm_socket[this->ecu_name].mySocket());
+ }
+
+ this->end_init = true;
+}
+
+int WMConnection::connectToServer(std::string ecu_name)
+{
+ int ret = 0;
+ struct sockaddr_in addr;
+
+ this->initializeClient(ecu_name);
+
+ SocketInfo *socketData = &wm_socket[ecu_name];
+
+ // Connect to master
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons(socketData->wmPort());
+ addr.sin_addr.s_addr = inet_addr(socketData->ip().c_str());
+
+ connect(socketData->mySocket(), (struct sockaddr *)&addr, sizeof(addr));
+
+ ret = sd_event_add_io(afb_daemon_get_event_loop(), nullptr,
+ socketData->mySocket(), EPOLLOUT,
+ onIoEventConnected, this);
+
+ if (0 > ret)
+ {
+ HMI_ERROR("Failed to add I/O event receive(%s)", strerror(-ret));
+ return -1;
+ }
+
+ return ret;
+}
+
+int WMConnection::connectedToServer(int socket)
+{
+ int ret;
+
+ struct sockaddr_in addr;
+ socklen_t addr_len = sizeof(addr);
+
+ std::string ecu_name = getMySocketToEcuName(socket);
+
+ ret = getpeername(socket, (struct sockaddr*)&addr, &addr_len);
+
+ if (ret != 0)
+ {
+ HMI_DEBUG("Failed to connect %s (%s)", ecu_name.c_str(), strerror(errno));
+ return -1;
+ }
+
+ HMI_DEBUG("Connected to %s", ecu_name.c_str());
+
+ SocketInfo *socketData = &this->wm_socket[ecu_name];
+
+ // Store connected socket
+ socketData->setConnectedSocket(socket);
+
+ return 0;
+}
+
+int WMConnection::serverAccept(int socket)
+{
+ struct sockaddr_in addr;
+
+ // Accept connection
+ socklen_t len = sizeof(addr);
+ int my_socket = this->wm_socket[this->getEcuName()].mySocket();
+ int connected_socket = accept(my_socket, (struct sockaddr *)&addr, &len);
+ if (0 > connected_socket)
+ {
+ HMI_ERROR("Failed to accept connection (%s)", strerror(errno));
+ return -1;
+ }
+
+ std::string ip = inet_ntoa(addr.sin_addr);
+ std::string ecu_name = getIpToEcuName(ip);
+
+ SocketInfo *socketData = &this->wm_socket[ecu_name];
+
+ // Store connected socket
+ socketData->setConnectedSocket(connected_socket);
+
+ // Register callback to receive
+ int ret = sd_event_add_io(afb_daemon_get_event_loop(), nullptr,
+ connected_socket, EPOLLIN,
+ onIoEventReceive, this);
+ if (0 > ret)
+ {
+ HMI_ERROR("Failed to add I/O event receive(%s)", strerror(-ret));
+ return -1;
+ }
+
+ return 0;
+}
+
+int WMConnection::receive(json_object** j_out, int *j_cnt, int socket)
+{
+ char buf[1024] = {};
+ int n;
+
+ n = read(socket, buf, sizeof(buf));
+ if(0 > n)
+ {
+ HMI_ERROR("Failed to receive data (%s)", strerror(errno));
+ return -1;
+ }
+
+ HMI_DEBUG("Received data length: %d", n);
+ HMI_DEBUG("Received data: %s", buf);
+
+ // Parse received data
+ struct json_tokener *tokener = json_tokener_new();
+ int cnt = 0;
+
+ while (n >= tokener->char_offset)
+ {
+ j_out[cnt] = json_tokener_parse_ex(tokener, &buf[tokener->char_offset], n);
+
+ if (nullptr == j_out[cnt])
+ {
+ break;
+ }
+
+ cnt++;
+ }
+
+ *j_cnt = cnt;
+ json_tokener_free(tokener);
+
+ this->received_ecu_name = this->getSocketToEcuName(socket);
+ HMI_DEBUG("received ecu name %s", this->received_ecu_name.c_str());
+
+ return 0;
+}
+
+int WMConnection::loadTimeoutConfigFile()
+{
+ // Get afm application installed dir
+ char const *afm_app_install_dir = getenv("AFM_APP_INSTALL_DIR");
+ if (!afm_app_install_dir)
+ {
+ HMI_ERROR("AFM_APP_INSTALL_DIR is not defined");
+ }
+ std::string path = std::string(afm_app_install_dir) + std::string(kPathTimeoutConfigFile);
+
+ // Load connection config file
+ json_object *json_obj;
+ int ret = jh::inputJsonFilie(path.c_str(), &json_obj);
+ if (0 > ret)
+ {
+ HMI_ERROR("Could not open %s, so use default timeout", path.c_str());
+ this->times = kDefaultTimes;
+ this->sleep = kDefaultSleep;
+ return 0;
+ }
+ HMI_DEBUG("json_obj dump:%s", json_object_get_string(json_obj));
+
+ int times = jh::getIntFromJson(json_obj, "times");
+ this->times = (0 != times) ? times : kDefaultTimes;
+
+ int sleep = jh::getIntFromJson(json_obj, "sleep");
+ this->sleep = (0 != sleep) ? sleep : kDefaultSleep;
+
+ // Release json_object
+ json_object_put(json_obj);
+
+ return 0;
+}
+
+int WMConnection::loadConnectionConfigFile()
+{
+ std::string path = std::string(kPathConnectionConfigFile);
+
+ // Load connection config file
+ json_object *json_obj, *json_cfg;
+ int ret = jh::inputJsonFilie(path.c_str(), &json_obj);
+ if (0 > ret)
+ {
+ HMI_ERROR("Could not open %s, so use default mode \"slave\"", kPathConnectionConfigFile);
+ this->wm_socket["slave"] = SocketInfo("slave", kDefaultIpAddr, kDefaultPort, false);
+ return 0;
+ }
+ HMI_DEBUG("json_obj dump:%s", json_object_get_string(json_obj));
+
+ const char* screen_name = jh::getStringFromJson(json_obj, "screen_name");
+ this->mode = (nullptr != screen_name) ? screen_name : "slave";
+
+ int wm_port = jh::getIntFromJson(json_obj, "wm_port");
+
+ this->wm_socket[screen_name] = SocketInfo(screen_name, "", wm_port, true);
+
+ // Check
+ HMI_DEBUG("screen_name:%s wm_port:%d", screen_name, wm_port);
+
+ if (!json_object_object_get_ex(json_obj, "connections", &json_cfg))
+ {
+ HMI_ERROR("connection.json Parse Error!!");
+ return 0;
+ }
+
+ int len = json_object_array_length(json_cfg);
+
+ for (int i = 0; i < len; i++)
+ {
+ json_object *json_conn = json_object_array_get_idx(json_cfg, i);
+
+ std::string screen_name = jh::getStringFromJson(json_conn, "screen_name");
+ std::string ip = jh::getStringFromJson(json_conn, "ip");
+ int wm_port = jh::getIntFromJson(json_conn, "wm_port");
+ bool master_mode = jh::getBoolFromJson(json_conn, "master_mode");
+
+ this->wm_socket[screen_name] = SocketInfo(screen_name, ip, wm_port, master_mode);
+
+ HMI_DEBUG("screen_name:%s ip:%s port:%d server_mode:%s", screen_name.c_str(),
+ ip.c_str(), wm_port, (master_mode ? "true" : "false"));
+ }
+
+ // Release json_object
+ json_object_put(json_obj);
+
+ return 0;
+}
+
+uint64_t WMConnection::getNextTimerTime(uint64_t msec)
+{
+ struct timespec ts;
+
+ if (clock_gettime(CLOCK_BOOTTIME, &ts) != 0)
+ {
+ HMI_ERROR("Could't set time (clock_gettime() returns with error");
+ return -1;
+ }
+
+ uint64_t timer_nsec = ((ts.tv_sec * 1000000000ULL) + (ts.tv_nsec) + (msec * 1000000));
+
+ if (!timer_nsec)
+ {
+ HMI_ERROR("Second is 0");
+ return -1;
+ }
+
+ return timer_nsec / 1000;
+}
+
+} // namespace wm
diff --git a/src/wm_connection.hpp b/src/wm_connection.hpp
new file mode 100644
index 0000000..91f870e
--- /dev/null
+++ b/src/wm_connection.hpp
@@ -0,0 +1,117 @@
+/*
+ * Insert Copyright if needed.
+ */
+
+#ifndef WM_CONNECTION_HPP
+#define WM_CONNECTION_HPP
+
+#include <functional>
+#include <unordered_map>
+
+struct json_object;
+
+namespace wm
+{
+
+class SocketInfo
+{
+ public:
+ SocketInfo() {};
+ SocketInfo(std::string screen_name, std::string ip, int wm_port, bool master_mode) : _screen_name(screen_name),
+ _ip(ip), _wm_port(wm_port), _master_mode(master_mode){}
+ std::string screenName() const { return _screen_name; }
+ std::string ip() const { return _ip; }
+ int wmPort() const { return _wm_port; }
+ bool masterMode() const { return _master_mode; }
+ int mySocket() const { return _my_socket; }
+ int connectedSocket() const { return _connected_socket; }
+ void setMySocket(int socket) { this->_my_socket = socket; }
+ void setConnectedSocket(int socket) { this->_connected_socket = socket; }
+
+ private:
+ std::string _screen_name;
+ std::string _ip;
+ int _wm_port;
+ bool _master_mode;
+ int _my_socket = -1;
+ int _connected_socket = -1;
+};
+
+class WMConnection
+{
+ public:
+ WMConnection();
+ ~WMConnection() = default;
+
+ using ReceivedHandler = std::function<void(json_object* j_out)>;
+
+ enum ModeType
+ {
+ Mode_Standalone = 0,
+ Mode_Connection,
+ };
+
+ int initialize();
+ void registerCallback(ReceivedHandler on_received);
+ int sendRequest(char const *req, char const *appid,
+ char const *drawing_name, char const *drawing_area);
+ bool isRemoteArea(const char* area);
+ bool isConnecting(std::string ecu_name);
+ bool isConnectionMode();
+ std::string parseMasterArea(const char* area);
+ bool isSyncDrawingForRemote(const char* role);
+ void startSyncDrawForRemote(const char* role);
+ void finishSyncDrawForRemote(const char* role);
+ int getMySocket();
+ int getConnectedSocket();
+ void setConnectedSocket(int connected_socket);
+ std::string getAreaToEcuName(const char* area);
+ std::string getSocketToEcuName(int socket);
+ std::string getMySocketToEcuName(int socket);
+ std::string getAppIdToEcuName(std::string appid);
+ std::string getIpToEcuName(std::string ip);
+ std::string getEcuName();
+ bool getEndInit();
+ void setAppIdToEcuName(std::string appid, std::string ecu_name);
+ void setAppIdToReceivedEcuName(std::string appid);
+ void callOnReceivedHandler(json_object *j_out);
+ int connectToEcu();
+ int connectToServer(std::string ecu_name);
+ int connectedToServer(int socket);
+ void connectionTimeLimit();
+
+ int serverAccept(int socket);
+ int receive(json_object** j_out, int *j_cnt, int socket);
+
+ private:
+ std::string mode;
+ std::string received_ecu_name;
+ ReceivedHandler onReceived;
+ std::string syndDrawingAppId;
+
+ std::string ecu_name;
+ std::string received_ecu;
+
+ uint64_t times;
+ uint64_t sleep;
+
+ bool end_init;
+ ModeType wm_mode;
+
+ std::unordered_map<std::string, SocketInfo> wm_socket;
+ std::unordered_map<std::string, std::string> appid2ecuName;
+
+ int initializeServer();
+ int initializeClient(std::string ecu_name);
+ int loadTimeoutConfigFile();
+ int loadConnectionConfigFile();
+
+ int send(json_object* j_in, std::string ecu_name);
+
+ uint64_t getNextTimerTime(uint64_t msec);
+};
+
+} // namespace wm
+
+#endif // WM_CONNECTION_HPP
+
diff --git a/src/wm_layer.cpp b/src/wm_layer.cpp
index 4eceb43..e1454f8 100644
--- a/src/wm_layer.cpp
+++ b/src/wm_layer.cpp
@@ -66,6 +66,12 @@ void LayerState::removeLayer(unsigned layer)
this->render_order.erase(fwd_itr, this->render_order.end());
}
+bool LayerState::hasLayer(unsigned layer)
+{
+ auto itr = std::find(this->render_order.begin(), this->render_order.end(), layer);
+ return (itr != this->render_order.end()) ? true : false;
+}
+
void LayerState::attachAppToArea(const string& app, const string& area)
{
this->area2appid[area] = app;
@@ -96,6 +102,7 @@ WMLayer::WMLayer(json_object* j, unsigned wm_layer_id) : tmp_state(), state(), w
this->role_list = jh::getStringFromJson(j, "role");
this->id_begin = static_cast<unsigned>(jh::getIntFromJson(j, "id_range_begin"));
this->id_end = static_cast<unsigned>(jh::getIntFromJson(j, "id_range_end"));
+ this->screen = jh::getIntFromJson(j, "screen"); // screen is not defined in layers.json, screen is set to 0
if (name.empty())
{
@@ -183,6 +190,11 @@ void WMLayer::removeLayerFromState(unsigned layer)
this->tmp_state.removeLayer(layer);
}
+bool WMLayer::hasLayerFromState(unsigned layer)
+{
+ this->tmp_state.hasLayer(layer);
+}
+
void WMLayer::attachAppToArea(const string& app, const string& area)
{
this->tmp_state.attachAppToArea(app, area);
@@ -250,7 +262,7 @@ void WMLayer::undo()
void WMLayer::dump()
{
DUMP("===== wm layer status =====");
- DUMP("Layer :%s", this->name.c_str());
+ DUMP("Layer :%s on screen %d", this->name.c_str(), this->screen);
DUMP(" [Current]");
this->state.dump();
DUMP(" [To be]");
diff --git a/src/wm_layer.hpp b/src/wm_layer.hpp
index 97cf8a8..7da432c 100644
--- a/src/wm_layer.hpp
+++ b/src/wm_layer.hpp
@@ -38,6 +38,7 @@ class LayerState
const std::vector<unsigned> getIviIdList();
void addLayer(unsigned layer);
void removeLayer(unsigned layer);
+ bool hasLayer(unsigned layer);
void attachAppToArea(const std::string& app, const std::string& area);
// Debug
@@ -59,6 +60,7 @@ class WMLayer
unsigned idBegin() { return this->id_begin; }
unsigned idEnd() { return this->id_end; }
unsigned getWMLayerID() { return this->wm_layer_id; }
+ unsigned getScreenID() { return this->screen; }
const std::string& layerName();
void appendArea(const std::string& area);
LayerState& getLayerState() { return tmp_state; }
@@ -69,6 +71,7 @@ class WMLayer
// Manipulation
void addLayerToState(unsigned layer);
void removeLayerFromState(unsigned layer);
+ bool hasLayerFromState(unsigned layer);
void attachAppToArea(const std::string& app, const std::string& area);
std::string attachedApp(const std::string& area);
void update();
@@ -88,6 +91,7 @@ class WMLayer
std::string role_list;
std::vector<std::string> area_list;
std::vector<unsigned> id_list;
+ unsigned screen;
unsigned id_begin;
unsigned id_end;
};
diff --git a/src/wm_layer_control.cpp b/src/wm_layer_control.cpp
index c5c7913..8086fd3 100644
--- a/src/wm_layer_control.cpp
+++ b/src/wm_layer_control.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- * Copyright (c) 2018 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,10 +21,22 @@
#include "request.hpp"
#include "json_helper.hpp"
-#define LC_AREA_FILE "areas.json"
-#define LC_LAYER_SETTING_FILE "layers.json"
+#define LC_AREA_PATH "/etc/areas.json"
+#define LC_LAYER_SETTING_PATH "/etc/layers.json"
+#define LC_WESTON_SETTING_PATH "/etc/weston.json"
#define LC_DEFAULT_AREA "fullscreen"
#define BACK_GROUND_LAYER "BackGroundLayer"
+#define REMOTE_LAYER "Remote"
+#define REMOTE_LAYER_RSE1 "RemoteRSE1"
+#define REMOTE_LAYER_RSE2 "RemoteRSE2"
+#define REMOTE_LAYER_HUD "RemoteHUD"
+#define REMOTE_LAYER_HUD_UL "RemoteHUDUpperLeft"
+#define AREA_NAME_RSE1 "rse1.normal.full"
+#define AREA_NAME_RSE2 "rse2.normal.full"
+#define AREA_NAME_HUD "hud.normal.full"
+#define AREA_NAME_HUD_UL "hud.upper.left"
+#define defaultWestonTimes 60000
+#define defaultWestonSleep 50
using std::string;
using std::vector;
@@ -57,15 +68,19 @@ static void layerCallback_static(t_ilm_layer layer,
g_lc_ctxt->dispatchLayerPropChangeEvent(layer, layer_prop, mask);
}
-LayerControl::LayerControl(const std::string& root)
+LayerControl::LayerControl(const std::string& root, const std::string& ecu_name)
{
- string area_path(get_file_path(LC_AREA_FILE, root.c_str()));
- string layer_path(get_file_path(LC_LAYER_SETTING_FILE, root.c_str()));
+ string area_path = root + LC_AREA_PATH;
+ string layer_path= root + LC_LAYER_SETTING_PATH;
+ string weston_path = root + LC_WESTON_SETTING_PATH;
+
+ this->loadWestonSetting(weston_path);
+
// load layers.setting.json
WMError ret = this->loadLayerSetting(layer_path);
assert(ret == WMError::SUCCESS);
// load areas.json
- ret = this->loadAreaDb(area_path);
+ ret = this->loadAreasConfigFile(area_path, ecu_name);
assert(ret == WMError::SUCCESS);
}
@@ -74,21 +89,37 @@ WMError LayerControl::init(const LayerControlCallbacks& cb)
HMI_DEBUG("Initialize of ilm library and display");
t_ilm_uint num = 0;
t_ilm_uint *ids;
- int cnt = 0;
- ilmErrorTypes rc = ilm_init();
+ ilmErrorTypes rc;
+ struct timespec startTs, endTs;
+
+ if (clock_gettime(CLOCK_BOOTTIME, &startTs) != 0)
+ {
+ HMI_ERROR("Could't set time (clock_gettime() returns with error");
+ goto lc_init_error;
+ }
+
+ endTs = startTs;
- while (rc != ILM_SUCCESS)
+ while ((startTs.tv_sec + (this->times / 1000)) > endTs.tv_sec)
{
- cnt++;
- if (20 <= cnt)
+ rc = ilm_init();
+
+ if (rc == ILM_SUCCESS)
{
- HMI_ERROR("Could not connect to compositor");
- goto lc_init_error;
+ HMI_DEBUG("Weston Connected");
+ break;
}
+
HMI_ERROR("Wait to start weston ...");
- sleep(1);
- rc = ilm_init();
+ usleep(this->sleep * 1000);
+
+ if (clock_gettime(CLOCK_BOOTTIME, &endTs) != 0)
+ {
+ HMI_ERROR("Could't set time (clock_gettime() returns with error");
+ goto lc_init_error;
+ }
}
+
if(rc != ILM_SUCCESS) goto lc_init_error;
// Get current screen setting
@@ -99,12 +130,16 @@ WMError LayerControl::init(const LayerControlCallbacks& cb)
for(unsigned i = 0; i < num; i++)
{
HMI_INFO("get screen: %d", ids[i]);
+ ilmScreenProperties prop;
+ rc = ilm_getPropertiesOfScreen(ids[i], &prop);
+
+ if(rc != ILM_SUCCESS) goto lc_init_error;
+ this->wm_screens.emplace_back(Screen(ids[i], prop.screenWidth, prop.screenHeight));
}
+
// Currently, 0 is only available
this->screenID = ids[0];
- rc = ilm_getPropertiesOfScreen(this->screenID, &this->screen_prop);
-
if(rc != ILM_SUCCESS) goto lc_init_error;
// Register Callback to Window Manager and from ILM
@@ -134,7 +169,22 @@ void LayerControl::createNewLayer(unsigned id)
this->renderLayers();
}
-unsigned LayerControl::getNewLayerID(const string& role)
+void LayerControl::createNewRemoteLayer(unsigned id)
+{
+ HMI_INFO("create new ID :%d (For remote layer)", id);
+ struct rect rct = {640, 720, 0, 0};
+ ilm_layerCreateWithDimension(&id, rct.w, rct.h);
+ //ilm_layerSetSourceRectangle(id, rct.x, rct.y, rct.w, rct.h);
+ ilm_layerSetDestinationRectangle(id, this->offset_x, this->offset_y, rct.w, rct.h);
+ ilm_layerSetOpacity(id, 1.0);
+ ilm_layerSetVisibility(id, ILM_FALSE);
+ ilm_commitChanges();
+ auto wm_layer = getWMLayer(id);
+ wm_layer->addLayerToState(id);
+ this->renderLayers();
+}
+
+unsigned LayerControl::getNewLayerID(const string& role, string* layer_name)
{
unsigned ret = 0;
for(const auto& l: this->wm_layers)
@@ -142,6 +192,7 @@ unsigned LayerControl::getNewLayerID(const string& role)
ret = l->getNewLayerID(role);
if(ret != 0)
{
+ *layer_name = l->layerName();
unsigned wmlid = l->getWMLayerID();
this->lid2wmlid[ret] = wmlid;
break;
@@ -179,6 +230,10 @@ void LayerControl::setupArea(const rectangle& base_rct, double scaling)
this->offset_x = base_rct.left();
this->offset_y = base_rct.top();
+ // TODO: set all screen
+ this->wm_screens[0].setScale(scaling);
+ this->wm_screens[0].setOffset(offset_x, offset_y);
+
for (auto &i : this->area2size)
{
i.second.x = static_cast<int>(scaling * i.second.x + 0.5);
@@ -193,7 +248,7 @@ void LayerControl::setupArea(const rectangle& base_rct, double scaling)
Screen LayerControl::getScreenInfo()
{
- return Screen(this->screen_prop.screenWidth, this->screen_prop.screenHeight);
+ return wm_screens[0];
}
double LayerControl::scale()
@@ -201,55 +256,69 @@ double LayerControl::scale()
return this->scaling;
}
+WMError LayerControl::updateLayer(LayerState& layer_state)
+{
+ return WMError::SUCCESS;
+}
+
WMError LayerControl::renderLayers()
{
HMI_INFO("Commit change");
WMError rc = WMError::SUCCESS;
- // Check the number of layers
- vector<unsigned> ivi_l_ids;
- for(auto& l : this->wm_layers)
+ // Create render order for each screen and set render order
+ for(const auto& screen : this->wm_screens)
{
- auto state = l->getLayerState();
- HMI_DEBUG("layer %s", l->layerName().c_str());
- for(const auto& id : state.getIviIdList())
+ unsigned size_ids = 0;
+ for(const auto& wm_l : this->wm_layers)
{
- HMI_DEBUG("Add %d", id);
- ivi_l_ids.push_back(id);
+ if(wm_l->getScreenID() == screen.id())
+ {
+ for(const auto& id : wm_l->getLayerState().getIviIdList())
+ {
+ ++size_ids;
+ }
+ }
+ }
+ t_ilm_layer* id_array = new t_ilm_layer[size_ids];
+ if(id_array == nullptr)
+ {
+ HMI_WARNING("short memory");
+ this->undoUpdate();
+ return WMError::FAIL;
+ }
+ int idx = 0;
+ for(const auto& wm_l : this->wm_layers)
+ {
+ if(wm_l->getScreenID() == screen.id())
+ {
+ for(const auto& id : wm_l->getLayerState().getIviIdList())
+ {
+ id_array[idx] = id;
+ ++idx;
+ }
+ }
}
- }
-
- // Create render order
- t_ilm_layer* id_array = new t_ilm_layer[ivi_l_ids.size()];
- if(id_array == nullptr)
- {
- HMI_WARNING("short memory");
- this->undoUpdate();
- return WMError::FAIL;
- }
- int count = 0;
- for(const auto& i : ivi_l_ids)
- {
- id_array[count] = i;
- ++count;
- }
- // Display
- ilmErrorTypes ret = ilm_displaySetRenderOrder(this->screenID, id_array, ivi_l_ids.size());
- if(ret != ILM_SUCCESS)
- {
- this->undoUpdate();
- rc = WMError::FAIL;
- }
- else
- {
- for(auto& l : this->wm_layers)
+ // Send to display
+ ilmErrorTypes ret = ilm_displaySetRenderOrder(screen.id(), id_array, size_ids);
+ if(ret != ILM_SUCCESS)
{
- l->update();
+ this->undoUpdate();
+ return WMError::FAIL;
}
+ else
+ {
+ for(auto& l : this->wm_layers)
+ {
+ if(l->getScreenID() == screen.id()) {
+ l->update();
+ }
+ }
+ }
+ ilm_commitChanges();
+ delete id_array;
}
- ilm_commitChanges();
- delete id_array;
return rc;
}
@@ -276,9 +345,34 @@ void LayerControl::undoUpdate()
}
}
+int LayerControl::loadWestonSetting(const string &path)
+{
+ HMI_DEBUG("loading Weston(Conpositor Time Out) Setting from %s", path.c_str());
+
+ json_object *json_obj;
+
+ int ret = jh::inputJsonFilie(path.c_str(), &json_obj);
+ if (0 > ret)
+ {
+ HMI_ERROR("Could not open %s, so use default", path.c_str());
+ this->times = defaultWestonTimes;
+ this->sleep = defaultWestonSleep;
+ return 0;
+ }
+ HMI_INFO("json_obj dump:%s", json_object_get_string(json_obj));
+
+ long times = jh::getIntFromJson(json_obj, "times");
+ this->times = (0 != times) ? times : defaultWestonTimes;
+
+ long sleep = jh::getIntFromJson(json_obj, "sleep");
+ this->sleep = (0 != sleep) ? sleep : defaultWestonSleep;
+
+ return 0;
+}
+
WMError LayerControl::loadLayerSetting(const string &path)
{
- HMI_DEBUG("loading WMLayer(Application Containers) Setting from %s", path.c_str());
+ HMI_DEBUG("loading WMLayer(Application Containers) Setting from %s", path);
json_object *json_obj, *json_cfg;
int ret = jh::inputJsonFilie(path.c_str(), &json_obj);
@@ -310,9 +404,9 @@ WMError LayerControl::loadLayerSetting(const string &path)
return WMError::SUCCESS;
}
-WMError LayerControl::loadAreaDb(const std::string& path)
+WMError LayerControl::loadAreasConfigFile(const std::string& path, const std::string& ecu_name)
{
- // Load area.db
+ // Load areas config file
json_object *json_obj;
int ret = jh::inputJsonFilie(path.c_str(), &json_obj);
if (0 > ret)
@@ -322,54 +416,115 @@ WMError LayerControl::loadAreaDb(const std::string& path)
}
HMI_INFO("json_obj dump:%s", json_object_get_string(json_obj));
- // Perse areas
+ // Parse ecus
json_object *json_cfg;
- if (!json_object_object_get_ex(json_obj, "areas", &json_cfg))
+ if (!json_object_object_get_ex(json_obj, "ecus", &json_cfg))
{
HMI_ERROR("Parse Error!!");
return WMError::FAIL;
}
- int len = json_object_array_length(json_cfg);
- HMI_DEBUG("json_cfg len:%d", len);
+ int num_ecu = json_object_array_length(json_cfg);
+ HMI_DEBUG("json_cfg(ecus) len:%d", num_ecu);
- const char *area;
- for (int i = 0; i < len; i++)
+ const char* c_ecu_name;
+ json_object *json_ecu;
+ for (int i = 0; i < num_ecu; i++)
{
- json_object *json_tmp = json_object_array_get_idx(json_cfg, i);
- HMI_DEBUG("> json_tmp dump:%s", json_object_get_string(json_tmp));
+ json_ecu= json_object_array_get_idx(json_cfg, i);
- area = jh::getStringFromJson(json_tmp, "name");
- if (nullptr == area)
+ c_ecu_name = jh::getStringFromJson(json_ecu, "name");
+ if (nullptr == c_ecu_name)
{
HMI_ERROR("Parse Error!!");
return WMError::FAIL;
}
- HMI_DEBUG("> area:%s", area);
- json_object *json_rect;
- if (!json_object_object_get_ex(json_tmp, "rect", &json_rect))
+ if (ecu_name == string(c_ecu_name))
{
- HMI_ERROR("Parse Error!!");
- return WMError::FAIL;
+ break;
}
- HMI_DEBUG("> json_rect dump:%s", json_object_get_string(json_rect));
+ else
+ {
+ json_ecu = nullptr;
+ }
+ }
- struct rect area_size;
- area_size.x = jh::getIntFromJson(json_rect, "x");
- area_size.y = jh::getIntFromJson(json_rect, "y");
- area_size.w = jh::getIntFromJson(json_rect, "w");
- area_size.h = jh::getIntFromJson(json_rect, "h");
+ if (!json_ecu)
+ {
+ HMI_ERROR("Areas for ecu:%s is NOT exist!!", ecu_name.c_str());
+ return WMError::FAIL;
+ }
- this->area2size[area] = area_size;
+ // Parse screens
+ if (!json_object_object_get_ex(json_ecu, "screens", &json_cfg))
+ {
+ HMI_ERROR("Parse Error!!");
+ return WMError::FAIL;
}
- // Check
- for (const auto& itr : this->area2size)
+ int num_screen = json_object_array_length(json_cfg);
+ HMI_DEBUG("json_cfg(screens) len:%d", num_screen);
+
+ json_object *json_screen;
+ for (int i = 0; i < num_screen; i++)
{
- HMI_DEBUG("area:%s x:%d y:%d w:%d h:%d",
- itr.first.c_str(), itr.second.x, itr.second.y,
- itr.second.w, itr.second.h);
+ int screen_id;
+ json_screen = json_object_array_get_idx(json_cfg, i);
+ HMI_INFO("json_cfg dump:%s", json_object_get_string(json_cfg));
+
+ // TODO: Currently only one display is connected to a ECU.
+
+ screen_id = jh::getIntFromJson(json_screen, "id"); // screen_id is not used currently
+
+ // Parse areas
+ json_object *json_tmp;
+ if (!json_object_object_get_ex(json_screen, "areas", &json_tmp))
+ {
+ HMI_ERROR("Parse Error!!");
+ return WMError::FAIL;
+ }
+
+ int num_area = json_object_array_length(json_tmp);
+ HMI_DEBUG("json_tmp(areas) len:%d", num_area);
+
+ const char *area;
+ for (int j = 0; j < num_area; j++)
+ {
+ json_object *json_area = json_object_array_get_idx(json_tmp, j);
+
+ area = jh::getStringFromJson(json_area, "name");
+ if (nullptr == area)
+ {
+ HMI_ERROR("Parse Error!!");
+ return WMError::FAIL;
+ }
+ HMI_DEBUG("> area:%s", area);
+
+ json_object *json_rect;
+ if (!json_object_object_get_ex(json_area, "rect", &json_rect))
+ {
+ HMI_ERROR("Parse Error!!");
+ return WMError::FAIL;
+ }
+
+ struct rect area_size;
+ area_size.x = jh::getIntFromJson(json_rect, "x");
+ area_size.y = jh::getIntFromJson(json_rect, "y");
+ area_size.w = jh::getIntFromJson(json_rect, "w");
+ area_size.h = jh::getIntFromJson(json_rect, "h");
+ HMI_INFO("%d, %d, %d, %d, ", area_size.x, area_size.y, area_size.w, area_size.h);
+
+ this->area2size[area] = area_size;
+ }
+
+ // Check
+ for (const auto& itr : this->area2size)
+ {
+ HMI_DEBUG("area:%s x:%d y:%d w:%d h:%d",
+ itr.first.c_str(), itr.second.x, itr.second.y,
+ itr.second.w, itr.second.h);
+ }
}
// Release json_object
@@ -380,7 +535,9 @@ WMError LayerControl::loadAreaDb(const std::string& path)
WMError LayerControl::layoutChange(const WMAction& action)
{
- if (action.visible == TaskVisible::INVISIBLE)
+ if ((action.visible == TaskVisible::INVISIBLE) ||
+ (action.visible == TaskVisible::REQ_REMOTE_VISIBLE) ||
+ (action.visible == TaskVisible::REQ_REMOTE_INVISIBLE))
{
// Visibility is not change -> no redraw is required
return WMError::SUCCESS;
@@ -394,26 +551,22 @@ WMError LayerControl::layoutChange(const WMAction& action)
unsigned surface = action.client->surfaceID();
auto rect = this->getAreaSize(action.area);
- HMI_SEQ_INFO(action.req_num, "Set layout %d, %d, %d, %d",rect.x, rect.y, rect.w, rect.h);
+ HMI_DEBUG("Set layout %d, %d, %d, %d",rect.x, rect.y, rect.w, rect.h);
+ // TO BE FIXED:
// Sometimes, ivi_wm_surface_size signal doesn't reach window manager,
- // then, Window Manager set set source size = 0.
- if(!action.client->isSourceSizeSet())
- {
- ilmSurfaceProperties sp;
- ilm_getPropertiesOfSurface(surface, &sp);
- if((sp.origSourceHeight != sp.sourceHeight) || (sp.origSourceWidth != sp.sourceWidth))
- {
- HMI_SEQ_NOTICE(action.req_num, "set source size w:%d h%d", sp.origSourceWidth, sp.origSourceHeight);
- ilm_surfaceSetSourceRectangle(surface, 0, 0, sp.origSourceWidth, sp.origSourceHeight);
- ilm_commitChanges();
- action.client->setSurfaceSizeCorrectly();
- }
+ // then, Window Manager can't set source size.
+ // This fixes it but it takes about 200ns(on R-Car M3) wastefully
+ ilmSurfaceProperties sp;
+ ilm_getPropertiesOfSurface(surface, &sp);
+ if(sp.origSourceHeight != sp.sourceHeight) {
+ HMI_SEQ_NOTICE(action.req_num, "WORK AROUND: set source size w:%d h%d", sp.origSourceWidth, sp.origSourceHeight);
+ ilm_surfaceSetSourceRectangle(surface, 0, 0, sp.origSourceWidth, sp.origSourceHeight);
+ ilm_commitChanges();
}
ilm_surfaceSetDestinationRectangle(surface, rect.x, rect.y, rect.w, rect.h);
ilm_commitChanges();
- action.client->setArea(action.area);
for(auto &wm_layer: this->wm_layers)
{
// Store the state who is assigned to the area
@@ -439,15 +592,30 @@ WMError LayerControl::visibilityChange(const WMAction& action)
return WMError::NOT_REGISTERED;
}
- if (action.visible == TaskVisible::VISIBLE)
+ if (action.visible == TaskVisible::VISIBLE)
{
ret = this->makeVisible(action.client);
}
- else if (action.visible == TaskVisible::INVISIBLE)
+ else if (action.visible == TaskVisible::INVISIBLE)
{
ret = this->makeInvisible(action.client);
}
- ilm_commitChanges();
+ else if (action.visible == TaskVisible::REMOTE_VISIBLE)
+ {
+ this->moveRemote(action.client->layerID(), action.area);
+ ret = this->makeVisible(action.client);
+ }
+ else if (action.visible == TaskVisible::REMOTE_INVISIBLE)
+ {
+ this->moveLocal(action.client->layerID());
+ ret = this->makeInvisible(action.client);
+ }
+ else // TaskVisible::REQ_REMOTE_VISIBLE || TaskVisible::REQ_REMOTE_INVISIBLE
+ {
+ // Visibility is not change
+ ret = WMError::SUCCESS;
+ }
+
return ret;
}
@@ -519,6 +687,7 @@ void LayerControl::dispatchCreateEvent(ilmObjectType object, unsigned id, bool c
return;
}
this->cb.surfaceCreated(sp.creatorPid, id);
+ ilm_surfaceSetSourceRectangle(id, 0, 0, sp.origSourceWidth, sp.origSourceHeight);
ilm_surfaceAddNotification(id, surfaceCallback_static);
ilm_surfaceSetVisibility(id, ILM_TRUE);
ilm_surfaceSetType(id, ILM_SURFACETYPE_DESKTOP);
@@ -684,4 +853,73 @@ bool LayerControl::moveForeGround(const shared_ptr<WMClient> client)
return ret;
}
+bool LayerControl::moveRemote(unsigned layer, const std::string& area)
+{
+ bool ret = false;
+ std::string remote_layer;
+
+ if (area == AREA_NAME_RSE1)
+ remote_layer = REMOTE_LAYER_RSE1;
+ else if (area == AREA_NAME_RSE2)
+ remote_layer = REMOTE_LAYER_RSE2;
+ else if (area == AREA_NAME_HUD)
+ remote_layer = REMOTE_LAYER_HUD;
+ else if (area == AREA_NAME_HUD_UL)
+ remote_layer = REMOTE_LAYER_HUD_UL;
+ else
+ remote_layer = REMOTE_LAYER;
+
+ auto remote = this->getWMLayer(remote_layer);
+
+ if(remote != nullptr)
+ {
+ ret = true;
+ if(remote->hasLayerID(layer))
+ {
+ HMI_DEBUG("Already moved layer %d", layer);
+ remote->dump();
+ return ret;
+ }
+ remote->addLayerToState(layer);
+ auto wm_layer = this->getWMLayer(layer);
+ wm_layer->removeLayerFromState(layer);
+ wm_layer->dump();
+ remote->dump();
+ ret = true;
+ }
+
+ return ret;
+}
+
+bool LayerControl::moveLocal(unsigned layer)
+{
+ bool ret = false;
+
+ auto remote = this->getWMLayer(REMOTE_LAYER);
+ if(remote != nullptr)
+ {
+ remote->removeLayerFromState(layer);
+ auto wm_layer = this->getWMLayer(layer);
+ wm_layer->addLayerToState(layer);
+ wm_layer->dump();
+ remote->dump();
+ ret = true;
+ }
+
+ return ret;
+}
+
+bool LayerControl::hasRemoteLayer(unsigned layer)
+{
+ bool ret = false;
+
+ auto remote = this->getWMLayer(REMOTE_LAYER);
+ if(remote != nullptr)
+ {
+ ret = remote->hasLayerFromState(layer);
+ }
+
+ return ret;
+}
+
} // namespace wm
diff --git a/src/wm_layer_control.hpp b/src/wm_layer_control.hpp
index 68acd66..6eb7a76 100644
--- a/src/wm_layer_control.hpp
+++ b/src/wm_layer_control.hpp
@@ -27,14 +27,24 @@ namespace wm {
class Screen {
public:
- Screen(unsigned w, unsigned h) : _width(w), _height(h){}
- unsigned width() { return _width; }
- unsigned height() { return _height; }
+ Screen(unsigned id, unsigned w, unsigned h) : _screen_id(id), _width(w), _height(h){}
+ unsigned width() const { return _width; }
+ unsigned height() const { return _height; }
+ unsigned id() const { return _screen_id; }
+ unsigned scale() const { return _scale; }
+ int offsetX() const { return _offset_x; }
+ int offsetY() const { return _offset_y; }
+ void setScale(double scl) { this->_scale = scl; }
+ void setOffset(int x, int y) { this->_offset_x = x; this->_offset_y = y; }
private:
+ unsigned _screen_id;
unsigned _width;
unsigned _height;
unsigned _pysical_width = 0;
unsigned _pysical_height = 0;
+ int _offset_x = 0;
+ int _offset_y = 0;
+ double _scale = 1.0;
};
class LayerControlCallbacks {
@@ -60,18 +70,21 @@ class WMClient;
class LayerControl
{
public:
- explicit LayerControl(const std::string& root);
+ explicit LayerControl(const std::string& root, const std::string& ecu_name);
~LayerControl() = default;
WMError init(const LayerControlCallbacks& cb);
void createNewLayer(unsigned id);
- unsigned getNewLayerID(const std::string& role);
+ void createNewRemoteLayer(unsigned id);
+ unsigned getNewLayerID(const std::string& role, std::string* layer_name);
std::shared_ptr<WMLayer> getWMLayer(unsigned layer);
std::shared_ptr<WMLayer> getWMLayer(std::string layer_name);
struct rect getAreaSize(const std::string& area);
void setupArea(const rectangle& base_rct, double scaling);
Screen getScreenInfo();
double scale();
+ WMError updateLayer(LayerState& layer_state);
WMError renderLayers();
+ // WMError renderLayersRemote();
WMError setXDGSurfaceOriginSize(unsigned surface);
void undoUpdate();
WMError layoutChange(const WMAction& action);
@@ -87,23 +100,32 @@ class LayerControl
void dispatchSurfacePropChangeEvent(unsigned id, struct ilmSurfaceProperties*, t_ilm_notification_mask);
void dispatchLayerPropChangeEvent(unsigned id, struct ilmLayerProperties*, t_ilm_notification_mask);
+ bool hasRemoteLayer(unsigned layer);
+
private:
WMError makeVisible(const std::shared_ptr<WMClient> client);
WMError makeInvisible(const std::shared_ptr<WMClient> client);
bool moveForeGround(const std::shared_ptr<WMClient> client);
bool moveBackGround(const std::shared_ptr<WMClient> client);
+ bool moveRemote(unsigned layer, const std::string& area);
+ bool moveLocal(unsigned layer);
+ int loadWestonSetting(const std::string &path);
WMError loadLayerSetting(const std::string& path);
- WMError loadAreaDb(const std::string& path);
+ WMError loadAreasConfigFile(const std::string& path, const std::string& ecu_name);
std::vector<std::shared_ptr<WMLayer>> wm_layers;
+ std::vector<Screen> wm_screens;
std::unordered_map<unsigned, unsigned> lid2wmlid;
std::unordered_map<std::string, struct rect> area2size;
unsigned screenID;
- struct ilmScreenProperties screen_prop;
+
double scaling;
int offset_x;
int offset_y;
LayerControlCallbacks cb;
+
+ long times;
+ long sleep;
};
-} // namespace wm \ No newline at end of file
+} // namespace wm