aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNaoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>2023-11-22 07:54:57 +0900
committerNaoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>2023-11-26 20:12:00 +0900
commitcbb63f0e45340f6dd2cc9f360ed4da15c745186f (patch)
tree471935b3ce3238f7bb402942ba8c530cf7892500
parent5b7127cac34bf44a9d9e58c02b44939955d50890 (diff)
Support for cluster api binding
Existing AGL Instrument Cluster is not implement cluster service only a framework library. This task aim to support cluster service. In 1st step, cluster-refgui will be controlled by cluster-service demo signal. This patch a part of this task. Bug-AGL: SPEC-4991 Change-Id: I1dfdf3a6b9691f536bb96cd197feac89f4137540 Signed-off-by: Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>
-rw-r--r--Application/cluster-service.cpp427
-rw-r--r--Application/cluster-service.hxx47
-rw-r--r--Application/main.cpp73
-rw-r--r--CMakeLists.txt21
-rw-r--r--GUIModel/Header/Clock.qml12
-rw-r--r--GUIModel/Header/Header.qml22
-rw-r--r--GUIModel/Meter/Meter.qml66
-rw-r--r--GUIModel/Meter/SpeedGuage.qml153
-rw-r--r--GUIModel/main.qml227
9 files changed, 749 insertions, 299 deletions
diff --git a/Application/cluster-service.cpp b/Application/cluster-service.cpp
new file mode 100644
index 0000000..1bc86ad
--- /dev/null
+++ b/Application/cluster-service.cpp
@@ -0,0 +1,427 @@
+#include "cluster-service.hxx"
+#include <cluster_api.h>
+#include <cluster-api-sdevent.h>
+
+#include <systemd/sd-daemon.h>
+#include <systemd/sd-event.h>
+
+//-----------------------------------------------------------------------------------
+QClusterService::QClusterService()
+{
+
+}
+//-----------------------------------------------------------------------------------
+QClusterService::~QClusterService()
+{
+
+
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE int QClusterService::getSpAnalogVal()
+{
+ uint32_t speed_u32 = 0;
+ int retval = 0;
+
+ speed_u32 = ::getSpAnalogVal();
+ if (speed_u32 > (uint32_t)INT_MAX)
+ retval = INT_MAX;
+ else
+ retval = (int)speed_u32;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE int QClusterService::getTaAnalogVal()
+{
+ uint32_t ta_u32 = 0;
+ int retval = 0;
+
+ ta_u32 = ::getTaAnalogVal();
+ if (ta_u32 > (uint32_t)INT_MAX)
+ retval = INT_MAX;
+ else
+ retval = (int)ta_u32;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE int QClusterService::getTrcomTripAVal()
+{
+ uint32_t tripa_u32 = 0;
+ int retval = 0;
+
+ tripa_u32 = ::getTrcomTripAVal();
+ if (tripa_u32 > (uint32_t)INT_MAX)
+ retval = INT_MAX;
+ else
+ retval = (int)tripa_u32;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE int QClusterService::getOTempVal()
+{
+ int16_t tmp_val = -40;
+ int retval = -40;
+
+ tmp_val = ::getOTempVal();
+ retval = (int)tmp_val;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getTurnR()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getTurnR();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getTurnL()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getTurnL();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getFrontRightSeatbelt()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getFrontRightSeatbelt();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getFrontLeftSeatbelt()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getFrontLeftSeatbelt();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getGeneralWarn()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getGeneralWarn();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getEngine()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getEngine();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getLowBattery()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getLowBattery();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getLdwOff()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getLdwOff();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getSrsAirbag()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getSrsAirbag();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getEspOff()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getEspOff();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getBrake()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getBrake();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getAbs()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getAbs();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getEspAct()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getEspAct();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getHillDescent()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getHillDescent();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getImmobi()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getImmobi();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getDoor()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getDoor();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getEps()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getEps();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getAutoHiBeamGreen()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getAutoHiBeamGreen();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE bool QClusterService::getHighbeam()
+{
+ IC_HMI_ON_OFF on_off_flag = IC_HMI_OFF;
+ bool retval = false;
+
+ on_off_flag = ::getHighbeam();
+ if (on_off_flag == IC_HMI_OFF)
+ retval = false;
+ else
+ retval = true;
+
+ return retval;
+}
+//-----------------------------------------------------------------------------------
+Q_INVOKABLE QString QClusterService::getGearAtVal()
+{
+ IC_HMI_GEAR_AT_VAL gear_val = IC_HMI_AT_UNUSED;
+ QString gear_string = QString("");
+
+ gear_val = ::getGearAtVal();
+
+ switch (gear_val) {
+ case IC_HMI_AT_OFF :
+ gear_string = QString("Off");
+ break;
+ case IC_HMI_AT_PARKING :
+ gear_string = QString("P");
+ break;
+ case IC_HMI_AT_REVERSE :
+ gear_string = QString("R");
+ break;
+ case IC_HMI_AT_NEUTRAL :
+ gear_string = QString("N");
+ break;
+ case IC_HMI_AT_DRIVE :
+ gear_string = QString("D");
+ break;
+ case IC_HMI_AT_SECOND :
+ gear_string = QString("S");
+ break;
+ case IC_HMI_AT_LOW_GEAR :
+ gear_string = QString("L");
+ break;
+ case IC_HMI_AT_FIRST :
+ gear_string = QString("F");
+ break;
+ case IC_HMI_AT_MANUAL :
+ gear_string = QString("M");
+ break;
+ case IC_HMI_AT_BRAKE :
+ gear_string = QString("B");
+ break;
+ case IC_HMI_AT_ALL_ON :
+ case IC_HMI_AT_ALL_OFF :
+ case IC_HMI_AT_UNUSED :
+ gear_string = QString("Error");
+ break;
+ default:
+ gear_string = QString("Off");
+ break;
+ }
+
+ return gear_string;
+}
+//-----------------------------------------------------------------------------------
+/*
+static void ic_notify(uint64_t signal, IC_HMI_ON_OFF val)ui
+{
+ fprintf(stdout, "Signal change notify %016lx , val=%1d\r", signal, val);
+}
+*/
+void QClusterService::run()
+{
+ sd_event *event = NULL;
+ data_pool_client_handle_sdevent handle = NULL;
+ int ret = -1;
+
+ ret = sd_event_default(&event);
+ if (ret < 0)
+ goto finish;
+
+ do {
+ ret = data_pool_client_setup_sdevent(event, &handle);
+ if (ret == 0)
+ break;
+ this->msleep(10);
+ } while(true);
+
+ //(void) registerIcHmi(IC_HMI_TT_TURN_R, ic_notify);
+ //(void) registerIcHmi(IC_HMI_TT_TURN_L, ic_notify);
+
+ ret = sd_event_loop(event);
+ if (ret < 0) {
+ //TODO
+ }
+finish:
+ (void) data_pool_client_cleanup_sdevent(handle);
+ event = sd_event_unref(event);
+
+ return;
+}
+
+//-----------------------------------------------------------------------------------
diff --git a/Application/cluster-service.hxx b/Application/cluster-service.hxx
new file mode 100644
index 0000000..06dc5f8
--- /dev/null
+++ b/Application/cluster-service.hxx
@@ -0,0 +1,47 @@
+#ifndef CLUSTERSERVICE_HXX
+#define CLUSTERSERVICE_HXX
+
+#include <QThread>
+
+class QClusterService : public QThread
+{
+ Q_OBJECT
+
+protected :
+ virtual void run();
+
+public:
+ // class I/F for QML
+ Q_INVOKABLE int getSpAnalogVal();
+ Q_INVOKABLE int getTaAnalogVal();
+ Q_INVOKABLE int getTrcomTripAVal();
+ Q_INVOKABLE int getOTempVal();
+ Q_INVOKABLE bool getTurnR();
+ Q_INVOKABLE bool getTurnL();
+ Q_INVOKABLE bool getFrontRightSeatbelt();
+ Q_INVOKABLE bool getFrontLeftSeatbelt();
+ Q_INVOKABLE bool getGeneralWarn();
+ Q_INVOKABLE bool getEngine();
+ Q_INVOKABLE bool getLowBattery();
+ Q_INVOKABLE bool getLdwOff();
+ Q_INVOKABLE bool getSrsAirbag();
+ Q_INVOKABLE bool getEspOff();
+ Q_INVOKABLE bool getBrake();
+ Q_INVOKABLE bool getAbs();
+ Q_INVOKABLE bool getEspAct();
+ Q_INVOKABLE bool getHillDescent();
+ Q_INVOKABLE bool getImmobi();
+ Q_INVOKABLE bool getDoor();
+ Q_INVOKABLE bool getEps();
+ Q_INVOKABLE bool getAutoHiBeamGreen();
+ Q_INVOKABLE bool getHighbeam();
+
+ Q_INVOKABLE QString getGearAtVal();
+
+
+ // class I/F for C++
+ QClusterService();
+ virtual ~QClusterService();
+};
+
+#endif // CLUSTERSERVICE_HXX
diff --git a/Application/main.cpp b/Application/main.cpp
index 3631708..51b0c39 100644
--- a/Application/main.cpp
+++ b/Application/main.cpp
@@ -14,37 +14,42 @@
* limitations under the License.
*/
-#include <QGuiApplication>
-#include <QQmlApplicationEngine>
-#include <QSurfaceFormat>
-#include <QDir>
-#include <QQmlContext>
-#include <QDebug>
-
-
-int main(int argc, char *argv[])
-{
- QSurfaceFormat defaultFormat;
- defaultFormat.setSwapBehavior(QSurfaceFormat::TripleBuffer);
- defaultFormat.setRenderableType(QSurfaceFormat::OpenGLES);
- defaultFormat.setProfile(QSurfaceFormat::NoProfile);
- defaultFormat.setVersion(2,0);
- defaultFormat.setSwapInterval(1);
- defaultFormat.setDepthBufferSize(8);
- defaultFormat.setAlphaBufferSize(8);
- QSurfaceFormat::setDefaultFormat(defaultFormat);
-
- QGuiApplication app(argc, argv);
-
- QQmlApplicationEngine engine;
- engine.rootContext()->setContextProperty("CurDirPath", QString(QCoreApplication::applicationDirPath()));
- const QUrl url(QStringLiteral("qrc:/main.qml"));
- QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
- &app, [url](QObject *obj, const QUrl &objUrl) {
- if (!obj && url == objUrl)
- QCoreApplication::exit(-1);
- }, Qt::QueuedConnection);
- engine.load(url);
-
- return app.exec();
-}
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+#include <QSurfaceFormat>
+#include <QDir>
+#include <QQmlContext>
+#include <QDebug>
+
+#include "cluster-service.hxx"
+
+int main(int argc, char *argv[])
+{
+ QSurfaceFormat defaultFormat;
+ defaultFormat.setSwapBehavior(QSurfaceFormat::TripleBuffer);
+ defaultFormat.setRenderableType(QSurfaceFormat::OpenGLES);
+ defaultFormat.setProfile(QSurfaceFormat::NoProfile);
+ defaultFormat.setVersion(2,0);
+ defaultFormat.setSwapInterval(1);
+ defaultFormat.setDepthBufferSize(8);
+ defaultFormat.setAlphaBufferSize(8);
+ QSurfaceFormat::setDefaultFormat(defaultFormat);
+
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.rootContext()->setContextProperty("CurDirPath", QString(QCoreApplication::applicationDirPath()));
+ const QUrl url(QStringLiteral("qrc:/main.qml"));
+ QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
+ &app, [url](QObject *obj, const QUrl &objUrl) {
+ if (!obj && url == objUrl)
+ QCoreApplication::exit(-1);
+ }, Qt::QueuedConnection);
+ engine.load(url);
+
+ QClusterService cluster_service;
+ cluster_service.start();
+ engine.rootContext()->setContextProperty("cluster_service", &cluster_service);
+
+ return app.exec();
+}
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 88159e5..79b168e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,18 +8,25 @@ set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(INSTALL_DIRECTORY "/opt/apps")
+find_package(PkgConfig REQUIRED)
find_package(Qt5Core REQUIRED)
find_package(Qt5Qml REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5QuickCompiler REQUIRED)
+pkg_check_modules(CLUSTERAPI REQUIRED cluster-api-systemd)
+
include_directories(
"${Qt5Core_INCLUDE_DIRS}"
"${Qt5Qml_INCLUDE_DIRS}"
"${Qt5Gui_INCLUDE_DIRS}"
)
-set(SOURCES Application/main.cpp)
+set(SOURCES
+ Application/main.cpp
+ Application/cluster-service.cpp
+ Application/cluster-service.hxx
+ )
qt5_add_resources(
RESOURCES
@@ -37,7 +44,17 @@ add_executable(
${RESOURCES}
)
-target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Qml Qt5::Gui)
+target_link_libraries(
+ ${PROJECT_NAME}
+ Qt5::Core
+ Qt5::Qml
+ Qt5::Gui
+ ${CLUSTERAPI_LIBRARIES}
+)
+
+link_directories( ${CLUSTERAPI_LIBRARY_DIRS} )
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLUSTERAPI_CXX_FLAGS} ${CLUSTERAPI_C_FLAGS}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CLUSTERAPI_C_FLAGS}")
if(NOT DEFINED APPS_INST_DIR)
set(APPS_INST_DIR /opt/apps)
diff --git a/GUIModel/Header/Clock.qml b/GUIModel/Header/Clock.qml
index 9462049..a17205b 100644
--- a/GUIModel/Header/Clock.qml
+++ b/GUIModel/Header/Clock.qml
@@ -126,4 +126,16 @@ Item{
visible: false
}
}
+
+ Timer {
+ interval: 500
+ repeat: true
+ running: true
+ onTriggered: {
+ var date = new Date;
+ timeHour = date.getHours();
+ timeMinute = date.getMinutes();
+ }
+ }
+
}
diff --git a/GUIModel/Header/Header.qml b/GUIModel/Header/Header.qml
index 3c54765..e1ee62f 100644
--- a/GUIModel/Header/Header.qml
+++ b/GUIModel/Header/Header.qml
@@ -68,4 +68,26 @@ Item {
visible: true
}
}
+
+ function setTurnLOn() {
+ turn_l_on.visible = true;
+ turn_l_off.visible = false;
+ }
+ function setTurnLOff() {
+ turn_l_on.visible = false;
+ turn_l_off.visible = true;
+ }
+
+ function setTurnROn() {
+ turn_r_on.visible = true;
+ turn_r_off.visible = false;
+ }
+ function setTurnROff() {
+ turn_r_on.visible = false;
+ turn_r_off.visible = true;
+ }
+
+ function setTemp(temp_val) {
+ outsideTemperature.tempValue = temp_val;
+ }
}
diff --git a/GUIModel/Meter/Meter.qml b/GUIModel/Meter/Meter.qml
index 1c7c0fe..7c2d5dd 100644
--- a/GUIModel/Meter/Meter.qml
+++ b/GUIModel/Meter/Meter.qml
@@ -40,9 +40,6 @@ Item {
Item {
id: meterParts
property var easing: Easing.InOutQuad
- Component.onCompleted: {
- testAnim.start()
- }
Connections{
target: rootItem
@@ -86,69 +83,6 @@ Item {
DigitalSpeed {
id: digitalSpeed
}
-
- ParallelAnimation{
- id: testAnim
- SequentialAnimation{
- id: testAnimSpeed
- loops: Animation.Infinite
- NumberAnimation {
- target: meter
- property: "speedValue"
- duration: 1000
- easing.type: Easing.InOutQuad
- to: 300
- }
- NumberAnimation{
- duration: 5000
- }
-
- NumberAnimation {
- target: meter
- property: "speedValue"
- duration: 5000
- easing.type: Easing.InOutQuad
- to: 0
- }
- }
-
- SequentialAnimation{
- id: testAnimTacho
- loops: Animation.Infinite
- NumberAnimation {
- target: meter
- property: "tachoValue"
- duration: 500
- easing.type: Easing.InOutQuad
- to: 8000
- }
- NumberAnimation {
- target: meter
- property: "tachoValue"
- duration: 2500
- easing.type: Easing.InOutQuad
- to: 0
- }
- }
- SequentialAnimation{
- id: testAnimCharge
- loops: Animation.Infinite
- NumberAnimation {
- target: meter
- property: "chargeValue"
- duration: 10000
- easing.type: Easing.Linear
- to: 0
- }
- NumberAnimation {
- target: meter
- property: "chargeValue"
- duration: 10000
- easing.type: Easing.Linear
- to: 100
- }
- }
- }
}
}
diff --git a/GUIModel/Meter/SpeedGuage.qml b/GUIModel/Meter/SpeedGuage.qml
index 056c00a..6667cad 100644
--- a/GUIModel/Meter/SpeedGuage.qml
+++ b/GUIModel/Meter/SpeedGuage.qml
@@ -114,157 +114,4 @@ Item {
anchors.leftMargin: -11
anchors.verticalCenter: parent.verticalCenter
}
-
- SequentialAnimation{
- id: normalToAdasAnimation
- onStarted: rootItem.focus=false
- ParallelAnimation{
- NumberAnimation{
- target: speedTxt
- property: "opacity"
- duration: 330
- easing.type: Easing.InOutSine
- from:1.0
- to:0.5
- }
-
- SequentialAnimation{
- NumberAnimation{
- target: pwrGuageGroup
- property: "opacity"
- duration: 330
- easing.type: Easing.InOutSine
- from:1.0
- to:0.0
- }
- PropertyAnimation{
- target: pwrGuageGroup
- property: "visible"
- duration: 0
- easing.type: Easing.InOutSine
- from:true
- to:false
- }
- }
- }
-
- ParallelAnimation{
- /* down size */
- NumberAnimation{
- target: speedGuage
- property: "scale"
- duration: 891
- easing.type: meterParts.easing
- from:1
- to:0.75
- }
-
- /* translation */
- PathAnimation{
- target: speedGuage
- anchorPoint: Qt.point(speedGuage.width/2, speedGuage.height/2)
- orientation: PathAnimation.Fixed
- duration: 891
- easing.type: meterParts.easing
-
- path: Path {
- startX: 960; startY: 391
- PathLine { x: 540; y: 402 }
- }
- }
-
- SequentialAnimation{
- PauseAnimation {
- duration: 891-330
- }
- NumberAnimation{
- target: speedTxt
- property: "opacity"
- duration: 330
- easing.type: Easing.InOutSine
- from:0.5
- to:1.0
- }
- }
- }
- }
-
- SequentialAnimation{
- id: mapToNormalAnimation
- onStarted: rootItem.focus=false
-
- PauseAnimation {
- duration: 254 + 330
- }
-
-
- ParallelAnimation{
- /* scaling */
- NumberAnimation{
- target: speedGuage
- property: "scale"
- duration: 891
- easing.type: meterParts.easing
- from:0.75
- to:1.0
- }
-
- /* slide */
- PathAnimation{
- target: speedGuage
- anchorPoint: Qt.point(speedGuage.width/2, speedGuage.height/2)
- orientation: PathAnimation.Fixed
- duration: 891
- easing.type: meterParts.easing
-
- path: Path {
- startX: 540; startY: 402
- PathLine { x: 960; y: 391 }
- }
- }
-
- NumberAnimation{
- target: speedTxt
- property: "opacity"
- duration: 330
- easing.type: Easing.InOutSine
- from:1.0
- to:0.5
- }
- }
-
- ParallelAnimation{
- NumberAnimation{
- target: speedTxt
- property: "opacity"
- duration: 330
- easing.type: Easing.InOutSine
- from:0.5
- to:1.0
- }
-
- SequentialAnimation{
- PropertyAnimation{
- target: pwrGuageGroup
- property: "visible"
- duration: 0
- easing.type: Easing.InOutSine
- from:false
- to:true
- }
-
- NumberAnimation{
- target: pwrGuageGroup
- property: "opacity"
- duration: 330
- easing.type: Easing.InOutSine
- from:0.0
- to:1.0
- }
- }
- }
- PauseAnimation {
- duration: 330
- }
- }
}
diff --git a/GUIModel/main.qml b/GUIModel/main.qml
index 5389797..8321bb3 100644
--- a/GUIModel/main.qml
+++ b/GUIModel/main.qml
@@ -133,7 +133,7 @@ Window {
}
CruisingRange {
id: cruisingRange
- cruisingRangeValue : 750
+ cruisingRangeValue : 750.0
}
Header{
@@ -251,9 +251,6 @@ Window {
}
}
break
- case(Qt.Key_4):
- telltaleSwitching();
- break
case(Qt.Key_Up):
keyPressed_Up()
@@ -281,11 +278,18 @@ Window {
default:
break
-
-
}
}
+ Timer {
+ property int num : 0
+ interval: 10
+ repeat: true
+ running: true
+ onTriggered: {
+ doUpdateClusterData()
+ }
+ }
Timer { //test
property int num : 0
@@ -315,44 +319,179 @@ Window {
}
}
-// FpsItem{}
-
- function telltaleSwitching(){
- telltale.telltaleMasterWarn = !telltale.telltaleMasterWarn
- telltale.telltaleGeneralWarn = !telltale.telltaleGeneralWarn
- telltale.telltaleBrakeEnergyRecovOff = !telltale.telltaleBrakeEnergyRecovOff
- telltale.telltaleBrakeEnergyRecovLv = !telltale.telltaleBrakeEnergyRecovLv
- telltale.telltaleMotorWarn = !telltale.telltaleMotorWarn
- telltale.telltalePopupHoodWarn = !telltale.telltalePopupHoodWarn
- telltale.telltaleDecharge = !telltale.telltaleDecharge
- telltale.telltaleEvSystemWarn = !telltale.telltaleEvSystemWarn
- telltale.telltaleChargingPlugWarn = !telltale.telltaleChargingPlugWarn
- telltale.telltaleLowBatt = !telltale.telltaleLowBatt
- telltale.telltaleBattWarn = !telltale.telltaleBattWarn
- telltale.telltaleBattTempWarn = !telltale.telltaleBattTempWarn
- telltale.telltaleHighVoltBattCut = !telltale.telltaleHighVoltBattCut
- telltale.telltaleAeb = !telltale.telltaleAeb
- telltale.telltaleLdw = !telltale.telltaleLdw
- telltale.telltaleBsd = !telltale.telltaleBsd
- telltale.telltaleSrsAirbag = !telltale.telltaleSrsAirbag
- telltale.telltaleEpsOff = !telltale.telltaleEpsOff
- telltale.telltaleBrake = !telltale.telltaleBrake
- telltale.telltaleAbsWarn = !telltale.telltaleAbsWarn
- telltale.telltaleEspAct = !telltale.telltaleEspAct
- telltale.telltaleHillDescent = !telltale.telltaleHillDescent
- telltale.telltaleAutoParking = !telltale.telltaleAutoParking
- telltale.telltaleTpmsInd = !telltale.telltaleTpmsInd
- telltale.telltaleImmobi = !telltale.telltaleImmobi
- telltale.telltaleDoor = !telltale.telltaleDoor
- telltale.telltaleSeatbelt = !telltale.telltaleSeatbelt
- telltale.telltaleSeatbelt2 = !telltale.telltaleSeatbelt2
- telltale.telltaleEpbWarn = !telltale.telltaleEpbWarn
- telltale.telltaleEps= !telltale.telltaleEps
- telltale.telltaleHighbeamAssist = !telltale.telltaleHighbeamAssist
- telltale.telltaleHighbeam = !telltale.telltaleHighbeam
- telltale.telltaleRearFog = !telltale.telltaleRearFog
- telltale.telltaleLowbeam = !telltale.telltaleLowbeam
- telltale.telltalePosition = !telltale.telltalePosition
+ //FpsItem{}
+
+ function doUpdateClusterData(){
+ // speed
+ var speed_val_capi = cluster_service.getSpAnalogVal();
+ meter.speedValue = speed_val_capi / 100.0;
+
+ // tacho
+ var tacho_val_capi = cluster_service.getTaAnalogVal();
+ meter.tachoValue = tacho_val_capi;
+
+ // temp
+ var temp_val_capi = cluster_service.getOTempVal();
+ header.setTemp(temp_val_capi);
+
+ // Gear
+ var gear_val_capi = cluster_service.getGearAtVal();
+ if (gear_val_capi === "D") {
+ shiftPosition.shiftId = 1;
+ } else if (gear_val_capi === "B") {
+ shiftPosition.shiftId = 2;
+ } else if (gear_val_capi === "N") {
+ shiftPosition.shiftId = 3;
+ } else if (gear_val_capi === "R") {
+ shiftPosition.shiftId = 4;
+ } else if (gear_val_capi === "P") {
+ shiftPosition.shiftId = 5;
+ } else {
+ shiftPosition.shiftId = 0;
+ }
+
+ // Trip
+ //var tripa_val_capi = cluster_service.getTrcomTripAVal();
+ //cruisingRange.cruisingRangeValue = tripa_val_capi / 10;
+
+ // Turn R
+ var turnr_val_capi = cluster_service.getTurnR();
+ if (turnr_val_capi === true) {
+ header.setTurnROn();
+ } else {
+ header.setTurnROff();
+ }
+
+ // Turn L
+ var turnl_val_capi = cluster_service.getTurnL();
+ if (turnl_val_capi === true) {
+ header.setTurnLOn();
+ } else {
+ header.setTurnLOff();
+ }
+
+ // Seetbelt
+ var sbeltr_val_capi = cluster_service.getFrontRightSeatbelt();
+ if (sbeltr_val_capi === true) {
+ telltale.telltaleSeatbelt = true;
+ } else {
+ telltale.telltaleSeatbelt = false;
+ }
+ var sbeltl_val_capi = cluster_service.getFrontLeftSeatbelt();
+ if (sbeltl_val_capi === true) {
+ telltale.telltaleSeatbelt2 = true;
+ } else {
+ telltale.telltaleSeatbelt2 = false;
+ }
+
+ var genwarn_val_capi = cluster_service.getGeneralWarn();
+ if (genwarn_val_capi === true) {
+ telltale.telltaleGeneralWarn = true;
+ } else {
+ telltale.telltaleGeneralWarn = false;
+ }
+
+ var eng_val_capi = cluster_service.getEngine();
+ if (eng_val_capi === true) {
+ telltale.telltaleMotorWarn = true;
+ } else {
+ telltale.telltaleMotorWarn = false;
+ }
+
+ var lbatt_val_capi = cluster_service.getLowBattery();
+ if (lbatt_val_capi === true) {
+ telltale.telltaleLowBatt = true;
+ } else {
+ telltale.telltaleLowBatt = false;
+ }
+
+ var ldwoff_val_capi = cluster_service.getLdwOff();
+ if (ldwoff_val_capi === true) {
+ telltale.telltaleLdw = true;
+ } else {
+ telltale.telltaleLdw = false;
+ }
+
+ var srsair_val_capi = cluster_service.getSrsAirbag();
+ if (srsair_val_capi === true) {
+ telltale.telltaleSrsAirbag = true;
+ } else {
+ telltale.telltaleSrsAirbag = false;
+ }
+
+ var espoff_val_capi = cluster_service.getEspOff();
+ if (espoff_val_capi === true) {
+ telltale.telltaleEpsOff = true;
+ } else {
+ telltale.telltaleEpsOff = false;
+ }
+
+ var brake_val_capi = cluster_service.getBrake();
+ if (brake_val_capi === true) {
+ telltale.telltaleBrake = true;
+ } else {
+ telltale.telltaleBrake = false;
+ }
+
+ var abs_val_capi = cluster_service.getAbs();
+ if (abs_val_capi === true) {
+ telltale.telltaleAbsWarn = true;
+ } else {
+ telltale.telltaleAbsWarn = false;
+ }
+
+ var espact_val_capi = cluster_service.getEspAct();
+ if (espact_val_capi === true) {
+ telltale.telltaleEspAct = true;
+ } else {
+ telltale.telltaleEspAct = false;
+ }
+
+ var hill_val_capi = cluster_service.getHillDescent();
+ if (hill_val_capi === true) {
+ telltale.telltaleHillDescent = true;
+ } else {
+ telltale.telltaleHillDescent = false;
+ }
+
+ var immobi_val_capi = cluster_service.getImmobi();
+ if (immobi_val_capi === true) {
+ telltale.telltaleImmobi = true;
+ } else {
+ telltale.telltaleImmobi = false;
+ }
+
+ var door_val_capi = cluster_service.getDoor();
+ if (door_val_capi === true) {
+ telltale.telltaleDoor = true;
+ } else {
+ telltale.telltaleDoor = false;
+ }
+
+ var eps_val_capi = cluster_service.getEps();
+ if (eps_val_capi === true) {
+ telltale.telltaleEps = true;
+ } else {
+ telltale.telltaleEps = false;
+ }
+
+ var hibeamgreen_val_capi = cluster_service.getAutoHiBeamGreen();
+ var hibeam_val_capi = cluster_service.getHighbeam();
+ if (hibeamgreen_val_capi === true) {
+ telltale.telltaleHighbeamAssist = true;
+
+ if (hibeam_val_capi === true) {
+ telltale.telltaleHighbeam = true;
+ telltale.telltaleLowbeam = false;
+ } else {
+ telltale.telltaleHighbeam = false;
+ telltale.telltaleLowbeam = true;
+ }
+ } else {
+ telltale.telltaleHighbeamAssist = false;
+ telltale.telltaleHighbeam = false;
+ telltale.telltaleLowbeam = false;
+ }
}
}