summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2017-11-03 09:48:04 +0100
committerDominik Holland <dominik.holland@pelagicore.com>2017-11-03 09:49:33 +0100
commitfb338368765f60c48d2b44abbad8b4c9fb6751eb (patch)
tree86d9c7b4ff4afab6b1aa90d31e9fb31c03a6acfb /examples
parent9d372b44458baeab4ee5d131477dfc4bbd858f6b (diff)
parent489d2d4bd6c4602729f2dfe75f4a3b966b693c9c (diff)
downloadqtivi-fb338368765f60c48d2b44abbad8b4c9fb6751eb.tar.gz
Merge remote-tracking branch 'origin/5.10' into 5.9
Change-Id: I5f8466c36a701eefec72fbd3bc32a8fe129e994d
Diffstat (limited to 'examples')
-rw-r--r--examples/core/core.pro4
-rw-r--r--examples/core/qface-ivi-climate/backend_simulator/backend_simulator.pro69
-rwxr-xr-xexamples/core/qface-ivi-climate/build.sh77
-rw-r--r--examples/core/qface-ivi-climate/demo/demo.pro82
-rw-r--r--examples/core/qface-ivi-climate/demo/main.cpp69
-rw-r--r--examples/core/qface-ivi-climate/demo/main.qml119
-rw-r--r--examples/core/qface-ivi-climate/demo/qml.qrc5
-rw-r--r--examples/core/qface-ivi-climate/example-ivi-climate.qface132
-rw-r--r--examples/core/qface-ivi-climate/example-ivi-climate.yaml62
-rw-r--r--examples/core/qface-ivi-climate/frontend/frontend.pro62
-rw-r--r--examples/core/qface-ivi-climate/qface-ivi-climate.pro59
-rw-r--r--examples/examples.pro1
-rw-r--r--examples/vehiclefunctions/climate_qml/main.qml94
-rw-r--r--examples/vehiclefunctions/climate_widget/mainwindow.cpp62
-rw-r--r--examples/vehiclefunctions/climate_widget/mainwindow.h10
-rw-r--r--examples/vehiclefunctions/window_qml/WindowItem.qml41
16 files changed, 805 insertions, 143 deletions
diff --git a/examples/core/core.pro b/examples/core/core.pro
new file mode 100644
index 0000000..14dc55e
--- /dev/null
+++ b/examples/core/core.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+
+QT_FOR_CONFIG += ivicore
+qtConfig(ivigenerator): SUBDIRS = qface-ivi-climate
diff --git a/examples/core/qface-ivi-climate/backend_simulator/backend_simulator.pro b/examples/core/qface-ivi-climate/backend_simulator/backend_simulator.pro
new file mode 100644
index 0000000..23c1bbf
--- /dev/null
+++ b/examples/core/qface-ivi-climate/backend_simulator/backend_simulator.pro
@@ -0,0 +1,69 @@
+# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+# Contact: https://www.qt.io/licensing/
+#
+# This file is part of the QtIvi module of the Qt Toolkit.
+#
+# $QT_BEGIN_LICENSE:BSD-QTAS$
+# Commercial License Usage
+# Licensees holding valid commercial Qt Automotive Suite licenses may use
+# this file in accordance with the commercial license agreement provided
+# with the Software or, alternatively, in accordance with the terms
+# contained in a written agreement between you and The Qt Company. For
+# licensing terms and conditions see https://www.qt.io/terms-conditions.
+# For further information use the contact form at https://www.qt.io/contact-us.
+#
+# BSD License Usage
+# Alternatively, you may use this file under the terms of the BSD license
+# as follows:
+#
+# "Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of The Qt Company Ltd nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+#
+# $QT_END_LICENSE$
+#
+# SPDX-License-Identifier: BSD-3-Clause
+
+TEMPLATE=lib
+TARGET = $$qtLibraryTarget(example_ivi_climate)
+CONFIG += ivigenerator plugin
+macos: CONFIG += debug_and_release build_all
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviClimateExample)
+DESTDIR = ../qtivi
+
+CONFIG += warn_off
+INCLUDEPATH += $$OUT_PWD/../frontend
+PLUGIN_TYPE = qtivi
+PLUGIN_EXTENDS = qtivi
+PLUGIN_CLASS_NAME = ClimatePlugin
+
+QT += core ivicore
+
+QFACE_FORMAT = backend_simulator
+QFACE_SOURCES = ../example-ivi-climate.qface
+
+target.path = $$[QT_INSTALL_EXAMPLES]/core/qface-ivi-climate/backend_simulator
+INSTALLS += target
diff --git a/examples/core/qface-ivi-climate/build.sh b/examples/core/qface-ivi-climate/build.sh
new file mode 100755
index 0000000..f61aabe
--- /dev/null
+++ b/examples/core/qface-ivi-climate/build.sh
@@ -0,0 +1,77 @@
+#!/bin/bash -e
+
+# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+# Contact: https://www.qt.io/licensing/
+#
+# This file is part of the QtIvi module of the Qt Toolkit.
+#
+# $QT_BEGIN_LICENSE:BSD-QTAS$
+# Commercial License Usage
+# Licensees holding valid commercial Qt Automotive Suite licenses may use
+# this file in accordance with the commercial license agreement provided
+# with the Software or, alternatively, in accordance with the terms
+# contained in a written agreement between you and The Qt Company. For
+# licensing terms and conditions see https://www.qt.io/terms-conditions.
+# For further information use the contact form at https://www.qt.io/contact-us.
+#
+# BSD License Usage
+# Alternatively, you may use this file under the terms of the BSD license
+# as follows:
+#
+# "Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of The Qt Company Ltd nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+#
+# $QT_END_LICENSE$
+#
+# SPDX-License-Identifier: BSD-3-Clause
+
+# A die helper function
+# $1: The exit message
+# $2: The exit code
+die() {
+ echo "${1}"
+ exit ${2}
+}
+
+WORKDIR=$(dirname $0)
+GENERATOR=${WORKDIR}/../../src/tools/ivigenerator/generate.py
+test -x ${GENERATOR} || die "${GENERATOR} does not exists or can't be executed" 1
+out_dir=${WORKDIR}
+idlfile=qface-ivi-climate
+/bin/rm -rf ${out_dir}/frontend/*.{h,cpp,pri}
+/bin/rm -rf ${out_dir}/backend_simulator/*.{h,cpp,pri}
+${GENERATOR} --format=frontend ${WORKDIR}/${idlfile}.qface ${out_dir}/frontend || die "Generator failed" 1
+${GENERATOR} --format=backend_simulator ${WORKDIR}/${idlfile}.qface ${out_dir}/backend_simulator || die "Generator for backend failed" 1
+test -d build && /bin/rm -rf build
+test -d build && die "Cannot remove existing build folder" 1
+mkdir -p build || die "Cannot create build folder" 1
+pushd build
+project_dir=..
+qmake ${project_dir}/${idlfile}.pro || die "Failed to run qmake" 1
+make || die "Failed to build" 1
+popd
+
+die "All OK" 0
diff --git a/examples/core/qface-ivi-climate/demo/demo.pro b/examples/core/qface-ivi-climate/demo/demo.pro
new file mode 100644
index 0000000..980bf42
--- /dev/null
+++ b/examples/core/qface-ivi-climate/demo/demo.pro
@@ -0,0 +1,82 @@
+# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+# Contact: https://www.qt.io/licensing/
+#
+# This file is part of the QtIvi module of the Qt Toolkit.
+#
+# $QT_BEGIN_LICENSE:BSD-QTAS$
+# Commercial License Usage
+# Licensees holding valid commercial Qt Automotive Suite licenses may use
+# this file in accordance with the commercial license agreement provided
+# with the Software or, alternatively, in accordance with the terms
+# contained in a written agreement between you and The Qt Company. For
+# licensing terms and conditions see https://www.qt.io/terms-conditions.
+# For further information use the contact form at https://www.qt.io/contact-us.
+#
+# BSD License Usage
+# Alternatively, you may use this file under the terms of the BSD license
+# as follows:
+#
+# "Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of The Qt Company Ltd nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+#
+# $QT_END_LICENSE$
+#
+# SPDX-License-Identifier: BSD-3-Clause
+
+TARGET = qface-ivi-climate
+TEMPLATE = app
+
+QT += qml quick
+CONFIG += c++11
+CONFIG -= app_bundle
+DESTDIR = ../
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviClimateExample)
+INCLUDEPATH += $$OUT_PWD/../frontend
+
+SOURCES += main.cpp
+
+RESOURCES += qml.qrc
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH =
+
+# Additional import path used to resolve QML modules just for Qt Quick Designer
+QML_DESIGNER_IMPORT_PATH =
+
+# The following define makes your compiler emit warnings if you use
+# any feature of Qt which as been marked deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if you use deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
+
+target.path = $$[QT_INSTALL_EXAMPLES]/core/qface-ivi-climate/demo
+INSTALLS += target
diff --git a/examples/core/qface-ivi-climate/demo/main.cpp b/examples/core/qface-ivi-climate/demo/main.cpp
new file mode 100644
index 0000000..245bb26
--- /dev/null
+++ b/examples/core/qface-ivi-climate/demo/main.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtIvi module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD-QTAS$
+** Commercial License Usage
+** Licensees holding valid commercial Qt Automotive Suite licenses may use
+** this file in accordance with the commercial license agreement provided
+** with the Software or, alternatively, in accordance with the terms
+** contained in a written agreement between you and The Qt Company. For
+** licensing terms and conditions see https://www.qt.io/terms-conditions.
+** For further information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+#include <climatemodule.h>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ ClimateModule::registerTypes();
+ ClimateModule::registerQmlTypes(QLatin1String("IviClimate"), 1, 0);
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+
+ return app.exec();
+}
diff --git a/examples/core/qface-ivi-climate/demo/main.qml b/examples/core/qface-ivi-climate/demo/main.qml
new file mode 100644
index 0000000..a8255db
--- /dev/null
+++ b/examples/core/qface-ivi-climate/demo/main.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtIvi module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD-QTAS$
+** Commercial License Usage
+** Licensees holding valid commercial Qt Automotive Suite licenses may use
+** this file in accordance with the commercial license agreement provided
+** with the Software or, alternatively, in accordance with the terms
+** contained in a written agreement between you and The Qt Company. For
+** licensing terms and conditions see https://www.qt.io/terms-conditions.
+** For further information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Window 2.2
+import IviClimate 1.0
+
+Window {
+ visible: true
+ width: 640
+ height: 480
+ title: qsTr("QtIVI Climate")
+
+ UiClimateControl {
+ id: climateCtrl
+ }
+
+ Column {
+ anchors.fill: parent
+ anchors.margins: 5
+
+ Text {
+ text: "Air Conditioning: " + climateCtrl.airConditioning
+ }
+ Text {
+ text: "Heater: " + climateCtrl.heater
+ }
+ Text {
+ text: "Fan Speed Level: " + climateCtrl.fanSpeedLevel
+ }
+ Text {
+ text: "Steering Wheel Heater: " + climateCtrl.steeringWheelHeater
+ }
+ Text {
+ text: "Target Temperature: " + climateCtrl.targetTemperature
+ }
+ Text {
+ text: "Seat Cooler: " + climateCtrl.seatCooler
+ }
+ Text {
+ text: "Seat Heater: " + climateCtrl.seatHeater
+ }
+ Text {
+ text: "Outside Temperature: " + climateCtrl.outsideTemperature
+ }
+ Text {
+ text: "Zone Synchronization: " + climateCtrl.zoneSynchronization
+ }
+ Text {
+ text: "Defrost: " + climateCtrl.defrost
+ }
+ Text {
+ property var vals: ["Off", "On", "Auto"]
+ text: "Recirculation Mode: " + vals[climateCtrl.recirculationMode]
+ }
+ Text {
+ text: "Recirculation: " + climateCtrl.recirculation
+ }
+ Text {
+ text: "Recirculation Sensitivity Level: " + climateCtrl.recirculationSensitivityLevel
+ }
+ Text {
+ property var vals: ["Off", "On", "Auto"]
+ text: "Climate Mode: " + vals[climateCtrl.climateMode]
+ }
+ Text {
+ text: "Automatic Climate Fan Intensity Level: " + climateCtrl.automaticClimateFanIntensityLevel
+ }
+ }
+}
diff --git a/examples/core/qface-ivi-climate/demo/qml.qrc b/examples/core/qface-ivi-climate/demo/qml.qrc
new file mode 100644
index 0000000..5f6483a
--- /dev/null
+++ b/examples/core/qface-ivi-climate/demo/qml.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/core/qface-ivi-climate/example-ivi-climate.qface b/examples/core/qface-ivi-climate/example-ivi-climate.qface
new file mode 100644
index 0000000..ec99060
--- /dev/null
+++ b/examples/core/qface-ivi-climate/example-ivi-climate.qface
@@ -0,0 +1,132 @@
+/**
+ * Test module
+ */
+module Example.IVI.Climate 1.0;
+
+/**
+ * The ClimateControl provides a QML interface to the climate control
+ * of the vehicle.
+ */
+@config: { zoned: true, id: "example.qtivi.ClimateControl/1.0", qml_type: "UiClimateControl" }
+interface ClimateControl {
+ /**
+ * @brief Value is true if the air conditioning is enabled.
+ */
+ bool airConditioning;
+ /**
+ * @brief value is true if the heater is enabled.
+ */
+ bool heater;
+ /**
+ * @brief value holds the fan speed level, where the level can be between
+ * minimumValue(off) to maximumValue (strongest).
+ */
+ @config_simulator: { range: [0, 50] }
+ int fanSpeedLevel;
+ /**
+ * @brief value holds the steering wheel heater level, where the level can
+ * be between minimumValue(off) to maximumValue (warmest).
+ */
+ @config_simulator: { minimum: 0 }
+ int steeringWheelHeater;
+ /**
+ * @brief value holds the target temperature of the zone expressed
+ * in centigrades, where the temperature can be between
+ * minimumValue(coolest) to maximumValue (warmest).
+ */
+ @config_simulator: { maximum: 30.0 }
+ real targetTemperature;
+ /**
+ * @brief value holds the seat cooler level, where the level can be
+ * between minimumValue(off) to maximumValue (coolest).
+ */
+ int seatCooler;
+ /**
+ * @brief value holds the seat heater level, where the level can be between
+ * minimumValue(off) to maximumValue (warmest).
+ */
+ int seatHeater;
+ /**
+ * @brief value holds the outside temperature of the zone expressed in
+ * centigrades, where the temperature can be between
+ * minimumValue(coolest) to maximumValue (warmest).
+ */
+ int outsideTemperature;
+ /**
+ * @brief outside temp lable
+ */
+ @config_simulator: { domain: ["cold", "mild", "warm" ] }
+ string outsideTemperatureLabel;
+ /**
+ * @brief value is true if the zone synchronization is enabled.
+ *
+ * Which zones and properties are synchronized is controlled
+ * by the backend implementing it.
+ */
+ bool zoneSynchronization;
+ /**
+ * @brief value is true if defrost is enabled. Usually that means that the fans
+ * are on the highest level to remove ice from the windshield.
+ */
+ bool defrost;
+ /**
+ * @brief value holds the recirculation mode
+ */
+ RecirculationMode recirculationMode;
+ /**
+ * @brief value is true if the recirculation is currently running.
+ */
+ bool recirculation;
+ /**
+ * @brief value holds the sensitivity level of the recirculation
+ * system when the recirculationMode is set to AutoRecirculation,
+ * where the level can be between minimumValue(least sensitive)
+ * to maximumValue(most sensitive).
+ */
+ int recirculationSensitivityLevel;
+ /**
+ * @brief value holds the climate mode
+ */
+ ClimateMode climateMode;
+ /**
+ * @brief value holds the intensity level of the fan when the climateMode
+ * is set to AutoClimate, where the level can be between
+ * minimumValue(least intensity) to maximumValue(most intensity).
+ */
+ int automaticClimateFanIntensityLevel;
+ /**
+ * @brief value holds the combination of flags indicating the areas
+ * where airflow is on.
+ */
+ AirflowDirection airflowDirections;
+}
+
+/**
+ * @brief Control where the airflow goes
+ */
+flag AirflowDirection {
+ /**
+ * @brief Airflow to the windshield
+ */
+ Windshield = 1,
+ /**
+ * @brief Airflow to the dashboard
+ */
+ Dashboard = 2,
+ /**
+ * @brief Airflow to the floor
+ */
+ Floor = 4
+}
+
+enum RecirculationMode {
+ RecirculationOff = 0x0,
+ RecirculationOn = 0x1,
+ AutoRecirculation = 0x2
+}
+
+enum ClimateMode {
+ ClimateOff = 0x0,
+ ClimateOn = 0x1,
+ AutoClimate = 0x2
+}
diff --git a/examples/core/qface-ivi-climate/example-ivi-climate.yaml b/examples/core/qface-ivi-climate/example-ivi-climate.yaml
new file mode 100644
index 0000000..f114ef0
--- /dev/null
+++ b/examples/core/qface-ivi-climate/example-ivi-climate.yaml
@@ -0,0 +1,62 @@
+Example.IVI.Climate.ClimateControl:
+ config_simulator:
+ zones: { left : FrontLeft, right : FrontRight, rear: Rear }
+
+Example.IVI.Climate.ClimateControl#airConditioning:
+ config_simulator:
+ default: true
+
+Example.IVI.Climate.ClimateControl#heater:
+ config_simulator:
+ default: true
+
+Example.IVI.Climate.ClimateControl#recirculation:
+ config_simulator:
+ default: false
+
+Example.IVI.Climate.ClimateControl#zoneSynchronization:
+ config_simulator:
+ default: false
+
+Example.IVI.Climate.ClimateControl#defrost:
+ config_simulator:
+ default: false
+
+Example.IVI.Climate.ClimateControl#steeringWheelHeater:
+ config_simulator:
+ default: 0
+
+Example.IVI.Climate.ClimateControl#fanSpeedLevel:
+ config_simulator:
+ default: 2
+
+Example.IVI.Climate.ClimateControl#recirculationMode:
+ config_simulator:
+ default: RecirculationMode.RecirculationOff
+
+Example.IVI.Climate.ClimateControl#recirculationSensitivityLevel:
+ config_simulator:
+ unsupported: true
+ default: 0
+
+Example.IVI.Climate.ClimateControl#climateMode:
+ config_simulator:
+ unsupported: true
+ default: ClimateMode.ClimateOn
+
+Example.IVI.Climate.ClimateControl#automaticClimateFanIntensityLevel:
+ config_simulator:
+ unsupported: true
+ default: 0
+
+Example.IVI.Climate.ClimateControl#targetTemperature:
+ config_simulator:
+ default: 0
+
+Example.IVI.Climate.ClimateControl#seatCooler:
+ config_simulator:
+ default: 0
+
+Example.IVI.Climate.ClimateControl#seatHeater:
+ config_simulator:
+ default: 0
diff --git a/examples/core/qface-ivi-climate/frontend/frontend.pro b/examples/core/qface-ivi-climate/frontend/frontend.pro
new file mode 100644
index 0000000..7e11573
--- /dev/null
+++ b/examples/core/qface-ivi-climate/frontend/frontend.pro
@@ -0,0 +1,62 @@
+# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+# Contact: https://www.qt.io/licensing/
+#
+# This file is part of the QtIvi module of the Qt Toolkit.
+#
+# $QT_BEGIN_LICENSE:BSD-QTAS$
+# Commercial License Usage
+# Licensees holding valid commercial Qt Automotive Suite licenses may use
+# this file in accordance with the commercial license agreement provided
+# with the Software or, alternatively, in accordance with the terms
+# contained in a written agreement between you and The Qt Company. For
+# licensing terms and conditions see https://www.qt.io/terms-conditions.
+# For further information use the contact form at https://www.qt.io/contact-us.
+#
+# BSD License Usage
+# Alternatively, you may use this file under the terms of the BSD license
+# as follows:
+#
+# "Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of The Qt Company Ltd nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+#
+# $QT_END_LICENSE$
+#
+# SPDX-License-Identifier: BSD-3-Clause
+
+TARGET = $$qtLibraryTarget(QtIviClimateExample)
+TEMPLATE = lib
+CONFIG += ivigenerator
+DESTDIR = ..
+macos: CONFIG += debug_and_release build_all
+
+QT += ivicore ivicore-private qml quick
+
+DEFINES += QT_BUILD_CLIMATE_LIB
+
+QFACE_SOURCES = ../example-ivi-climate.qface
+
+target.path = $$[QT_INSTALL_EXAMPLES]/core/qface-ivi-climate/frontend
+INSTALLS += target
diff --git a/examples/core/qface-ivi-climate/qface-ivi-climate.pro b/examples/core/qface-ivi-climate/qface-ivi-climate.pro
new file mode 100644
index 0000000..07bc50c
--- /dev/null
+++ b/examples/core/qface-ivi-climate/qface-ivi-climate.pro
@@ -0,0 +1,59 @@
+# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+# Contact: https://www.qt.io/licensing/
+#
+# This file is part of the QtIvi module of the Qt Toolkit.
+#
+# $QT_BEGIN_LICENSE:BSD-QTAS$
+# Commercial License Usage
+# Licensees holding valid commercial Qt Automotive Suite licenses may use
+# this file in accordance with the commercial license agreement provided
+# with the Software or, alternatively, in accordance with the terms
+# contained in a written agreement between you and The Qt Company. For
+# licensing terms and conditions see https://www.qt.io/terms-conditions.
+# For further information use the contact form at https://www.qt.io/contact-us.
+#
+# BSD License Usage
+# Alternatively, you may use this file under the terms of the BSD license
+# as follows:
+#
+# "Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of The Qt Company Ltd nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+#
+# $QT_END_LICENSE$
+#
+# SPDX-License-Identifier: BSD-3-Clause
+
+TEMPLATE = subdirs
+
+SUBDIRS = frontend \
+ backend_simulator \
+ demo
+
+CONFIG += ordered
+
+OTHER_FILES += \
+ example-ivi-climate.qface \
+ example-ivi-climate.yaml
diff --git a/examples/examples.pro b/examples/examples.pro
index e689d54..d58eb45 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -1,5 +1,6 @@
TEMPLATE = subdirs
+SUBDIRS += core
qtHaveModule(ivivehiclefunctions): SUBDIRS += vehiclefunctions
qtHaveModule(ivimedia): SUBDIRS += media
qtHaveModule(geniviextras): SUBDIRS += geniviextras
diff --git a/examples/vehiclefunctions/climate_qml/main.qml b/examples/vehiclefunctions/climate_qml/main.qml
index 1d84f47..3dc8c6f 100644
--- a/examples/vehiclefunctions/climate_qml/main.qml
+++ b/examples/vehiclefunctions/climate_qml/main.qml
@@ -83,37 +83,34 @@ ApplicationWindow {
anchors.fill: parent
CheckBox {
text: "Windshield"
- checked: climateControl.airflowDirections.value & ClimateControl.Windshield
- enabled: climateControl.airflowDirections.availableValues.indexOf(ClimateControl.Windshield) !== -1
+ checked: climateControl.airflowDirections & ClimateControl.Windshield
onClicked: {
if (checked)
- climateControl.airflowDirections.value |= ClimateControl.Windshield
+ climateControl.airflowDirections |= ClimateControl.Windshield
else
- climateControl.airflowDirections.value &= ~ClimateControl.Windshield
+ climateControl.airflowDirections &= ~ClimateControl.Windshield
}
}
CheckBox {
text: "Dashboard"
- checked: climateControl.airflowDirections.value & ClimateControl.Dashboard
- enabled: climateControl.airflowDirections.availableValues.indexOf(ClimateControl.Dashboard) !== -1
+ checked: climateControl.airflowDirections & ClimateControl.Dashboard
onClicked: {
if (checked)
- climateControl.airflowDirections.value |= ClimateControl.Dashboard
+ climateControl.airflowDirections |= ClimateControl.Dashboard
else
- climateControl.airflowDirections.value &= ~ClimateControl.Dashboard
+ climateControl.airflowDirections &= ~ClimateControl.Dashboard
}
}
CheckBox {
text: "Floor"
- checked: climateControl.airflowDirections.value & ClimateControl.Floor
- enabled: climateControl.airflowDirections.availableValues.indexOf(ClimateControl.Floor) !== -1
+ checked: climateControl.airflowDirections & ClimateControl.Floor
onClicked: {
if (checked)
- climateControl.airflowDirections.value |= ClimateControl.Floor
+ climateControl.airflowDirections |= ClimateControl.Floor
else
- climateControl.airflowDirections.value &= ~ClimateControl.Floor
+ climateControl.airflowDirections &= ~ClimateControl.Floor
}
}
}
@@ -121,31 +118,28 @@ ApplicationWindow {
CheckBox {
text: "Air Condition"
- checked: climateControl.airConditioning.value
- enabled: climateControl.airConditioning.available
+ checked: climateControl.airConditioningEnabled
onClicked: {
- climateControl.airConditioning.value = checked
+ climateControl.airConditioningEnabled = checked
}
}
CheckBox {
text: "Heater"
- checked: climateControl.heater.value
- enabled: climateControl.heater.available
+ checked: climateControl.heaterEnabled
onClicked: {
- climateControl.heater.value = checked
+ climateControl.heaterEnabled = checked
}
}
CheckBox {
text: "Air Recirculation"
- checked: climateControl.recirculationMode.value === ClimateControl.RecirculationOn
- enabled: climateControl.airRecirculation.available
+ checked: climateControl.recirculationMode === ClimateControl.RecirculationOn
onClicked: {
if (checked)
- climateControl.recirculationMode.value = ClimateControl.RecirculationOn
+ climateControl.recirculationMode = ClimateControl.RecirculationOn
else
- climateControl.recirculationMode.value = ClimateControl.RecirculationOff
+ climateControl.recirculationMode = ClimateControl.RecirculationOff
}
}
@@ -157,12 +151,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.fanSpeedLevel.value
- minimumValue: climateControl.fanSpeedLevel.minimumValue
- maximumValue: climateControl.fanSpeedLevel.maximumValue
- enabled: climateControl.fanSpeedLevel.available
+ value: climateControl.fanSpeedLevel
onValueChanged: {
- climateControl.fanSpeedLevel.value = value
+ climateControl.fanSpeedLevel = value
}
}
}
@@ -175,12 +166,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.steeringWheelHeater.value
- minimumValue: climateControl.steeringWheelHeater.minimumValue
- maximumValue: climateControl.steeringWheelHeater.maximumValue
- enabled: climateControl.steeringWheelHeater.available
+ value: climateControl.steeringWheelHeater
onValueChanged: {
- climateControl.steeringWheelHeater.value = value
+ climateControl.steeringWheelHeater = value
}
}
}
@@ -199,12 +187,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.zoneAt.FrontLeft.targetTemperature.value
- minimumValue: climateControl.zoneAt.FrontLeft.targetTemperature.minimumValue
- maximumValue: climateControl.zoneAt.FrontLeft.targetTemperature.maximumValue
- enabled: climateControl.zoneAt.FrontLeft.targetTemperature.available
+ value: climateControl.zoneAt.FrontLeft.targetTemperature
onValueChanged: {
- climateControl.zoneAt.FrontLeft.targetTemperature.value = value
+ climateControl.zoneAt.FrontLeft.targetTemperature = value
}
}
}
@@ -217,12 +202,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.zoneAt.FrontLeft.seatHeater.value
- minimumValue: climateControl.zoneAt.FrontLeft.seatHeater.minimumValue
- maximumValue: climateControl.zoneAt.FrontLeft.seatHeater.maximumValue
- enabled: climateControl.zoneAt.FrontLeft.seatHeater.available
+ value: climateControl.zoneAt.FrontLeft.seatHeater
onValueChanged: {
- climateControl.zoneAt.FrontLeft.seatHeater.value = value
+ climateControl.zoneAt.FrontLeft.seatHeater = value
}
}
}
@@ -240,12 +222,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.zoneAt.FrontRight.targetTemperature.value
- minimumValue: climateControl.zoneAt.FrontRight.targetTemperature.minimumValue
- maximumValue: climateControl.zoneAt.FrontRight.targetTemperature.maximumValue
- enabled: climateControl.zoneAt.FrontRight.targetTemperature.available
+ value: climateControl.zoneAt.FrontRight.targetTemperature
onValueChanged: {
- climateControl.zoneAt.FrontRight.targetTemperature.value = value
+ climateControl.zoneAt.FrontRight.targetTemperature = value
}
}
}
@@ -258,12 +237,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.zoneAt.FrontRight.seatHeater.value
- minimumValue: climateControl.zoneAt.FrontRight.seatHeater.minimumValue
- maximumValue: climateControl.zoneAt.FrontRight.seatHeater.maximumValue
- enabled: climateControl.zoneAt.FrontRight.seatHeater.available
+ value: climateControl.zoneAt.FrontRight.seatHeater
onValueChanged: {
- climateControl.zoneAt.FrontRight.seatHeater.value = value
+ climateControl.zoneAt.FrontRight.seatHeater = value
}
}
}
@@ -281,12 +257,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.zoneAt.Rear.targetTemperature.value
- minimumValue: climateControl.zoneAt.Rear.targetTemperature.minimumValue
- maximumValue: climateControl.zoneAt.Rear.targetTemperature.maximumValue
- enabled: climateControl.zoneAt.Rear.targetTemperature.available
+ value: climateControl.zoneAt.Rear.targetTemperature
onValueChanged: {
- climateControl.zoneAt.Rear.targetTemperature.value = value
+ climateControl.zoneAt.Rear.targetTemperature = value
}
}
}
@@ -299,12 +272,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.zoneAt.Rear.seatHeater.value
- minimumValue: climateControl.zoneAt.Rear.seatHeater.minimumValue
- maximumValue: climateControl.zoneAt.Rear.seatHeater.maximumValue
- enabled: climateControl.zoneAt.Rear.seatHeater.available
+ value: climateControl.zoneAt.Rear.seatHeater
onValueChanged: {
- climateControl.zoneAt.Rear.seatHeater.value = value
+ climateControl.zoneAt.Rear.seatHeater = value
}
}
}
diff --git a/examples/vehiclefunctions/climate_widget/mainwindow.cpp b/examples/vehiclefunctions/climate_widget/mainwindow.cpp
index 50d1921..9e46a87 100644
--- a/examples/vehiclefunctions/climate_widget/mainwindow.cpp
+++ b/examples/vehiclefunctions/climate_widget/mainwindow.cpp
@@ -61,7 +61,7 @@ MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
m_buttonGroup(new QButtonGroup(this)),
- m_climateControl(0)
+ m_climateControl(nullptr)
{
ui->setupUi(this);
@@ -81,42 +81,30 @@ MainWindow::MainWindow(QWidget *parent) :
//![2]
//Air Flow Direction
setupFlowDirectionRadioButtons(m_climateControl->airflowDirections());
- setupFlowDirectionAttribute(m_climateControl->airflowDirectionsAttribute());
connect(m_buttonGroup, static_cast<void (QButtonGroup::*)(QAbstractButton *, bool)>(&QButtonGroup::buttonToggled),
this, &MainWindow::onFlowDirectionButtonToggled);
connect(m_climateControl, &QIviClimateControl::airflowDirectionsChanged,
this, &MainWindow::setupFlowDirectionRadioButtons);
- connect(m_climateControl, &QIviClimateControl::airflowDirectionsAttributeChanged,
- this, &MainWindow::setupFlowDirectionAttribute);
//Air Condition
ui->cb_airCondition->setChecked(m_climateControl->isAirConditioningEnabled());
- ui->cb_airCondition->setEnabled(m_climateControl->airConditioningAttribute().isAvailable());
connect(m_climateControl, &QIviClimateControl::airConditioningEnabledChanged,
ui->cb_airCondition, &QCheckBox::setChecked);
- connect(m_climateControl, &QIviClimateControl::airConditioningAttributeChanged,
- this, &MainWindow::onAirConditioningAttributeChanged);
connect(ui->cb_airCondition, &QCheckBox::clicked,
m_climateControl, &QIviClimateControl::setAirConditioningEnabled);
//Air Recirculation
- ui->cb_airRecirculation->setChecked(m_climateControl->recirculationMode() == QIviClimateControl::RecirculationOn);
- ui->cb_airRecirculation->setEnabled(m_climateControl->recirculationModeAttribute().isAvailable());
+ ui->cb_airRecirculation->setChecked(m_climateControl->recirculationMode() == QtIviVehicleFunctionsModule::RecirculationOn);
connect(m_climateControl, &QIviClimateControl::recirculationModeChanged,
this, &MainWindow::onAirRecirculationModeChanged);
- connect(m_climateControl, &QIviClimateControl::recirculationModeAttributeChanged,
- this, &MainWindow::onAirRecirculationAttributeChanged);
connect(ui->cb_airRecirculation, &QCheckBox::clicked,
this, &MainWindow::setAirRecirculationEnabled);
//Heater
ui->cb_heater->setChecked(m_climateControl->isHeaterEnabled());
- ui->cb_heater->setEnabled(m_climateControl->heaterAttribute().isAvailable());
connect(m_climateControl, &QIviClimateControl::heaterEnabledChanged,
ui->cb_heater, &QCheckBox::setChecked);
- connect(m_climateControl, &QIviClimateControl::heaterAttributeChanged,
- this, &MainWindow::onHeaterAttributeChanged);
connect(ui->cb_heater, &QCheckBox::clicked,
m_climateControl, &QIviClimateControl::setHeaterEnabled);
}
@@ -130,44 +118,22 @@ MainWindow::~MainWindow()
void MainWindow::setAirRecirculationEnabled(bool enabled)
{
if (enabled)
- m_climateControl->setRecirculationMode(QIviClimateControl::RecirculationOn);
+ m_climateControl->setRecirculationMode(QtIviVehicleFunctionsModule::RecirculationOn);
else
- m_climateControl->setRecirculationMode(QIviClimateControl::RecirculationOff);
+ m_climateControl->setRecirculationMode(QtIviVehicleFunctionsModule::RecirculationOff);
}
-void MainWindow::onAirRecirculationModeChanged(QIviClimateControl::RecirculationMode mode)
+void MainWindow::onAirRecirculationModeChanged(QtIviVehicleFunctionsModule::RecirculationMode mode)
{
- ui->cb_airRecirculation->setChecked(mode == QIviClimateControl::RecirculationOn);
-}
-
-void MainWindow::onAirRecirculationAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::RecirculationMode> &attribute)
-{
- ui->cb_airRecirculation->setEnabled(attribute.isAvailable());
-}
-
-void MainWindow::onHeaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute)
-{
- ui->cb_heater->setEnabled(attribute.isAvailable());
-}
-
-void MainWindow::onAirConditioningAttributeChanged(const QIviPropertyAttribute<bool> & attribute)
-{
- ui->cb_airCondition->setEnabled(attribute.isAvailable());
+ ui->cb_airRecirculation->setChecked(mode == QtIviVehicleFunctionsModule::RecirculationOn);
}
//![3]
-void MainWindow::setupFlowDirectionRadioButtons(QIviClimateControl::AirflowDirections direction)
-{
- ui->cb_windshield->setChecked(direction.testFlag(QIviClimateControl::Windshield));
- ui->cb_dashboard->setChecked(direction.testFlag(QIviClimateControl::Dashboard));
- ui->cb_floor->setChecked(direction.testFlag(QIviClimateControl::Floor));
-}
-
-void MainWindow::setupFlowDirectionAttribute(const QIviPropertyAttribute<QIviClimateControl::AirflowDirections> &attribute)
+void MainWindow::setupFlowDirectionRadioButtons(QtIviVehicleFunctionsModule::AirflowDirections direction)
{
- ui->cb_windshield->setEnabled(attribute.availableValues().contains(QIviClimateControl::Windshield));
- ui->cb_dashboard->setEnabled(attribute.availableValues().contains(QIviClimateControl::Dashboard));
- ui->cb_floor->setEnabled(attribute.availableValues().contains(QIviClimateControl::Floor));
+ ui->cb_windshield->setChecked(direction.testFlag(QtIviVehicleFunctionsModule::Windshield));
+ ui->cb_dashboard->setChecked(direction.testFlag(QtIviVehicleFunctionsModule::Dashboard));
+ ui->cb_floor->setChecked(direction.testFlag(QtIviVehicleFunctionsModule::Floor));
}
void MainWindow::onFlowDirectionButtonToggled(QAbstractButton *button, bool checked)
@@ -175,14 +141,14 @@ void MainWindow::onFlowDirectionButtonToggled(QAbstractButton *button, bool chec
Q_UNUSED(button)
Q_UNUSED(checked)
- QIviClimateControl::AirflowDirections direction;
+ QtIviVehicleFunctionsModule::AirflowDirections direction;
if (ui->cb_windshield->isChecked())
- direction |= QIviClimateControl::Windshield;
+ direction |= QtIviVehicleFunctionsModule::Windshield;
if (ui->cb_dashboard->isChecked())
- direction |= QIviClimateControl::Dashboard;
+ direction |= QtIviVehicleFunctionsModule::Dashboard;
if (ui->cb_floor->isChecked())
- direction |= QIviClimateControl::Floor;
+ direction |= QtIviVehicleFunctionsModule::Floor;
m_climateControl->setAirflowDirections(direction);
}
diff --git a/examples/vehiclefunctions/climate_widget/mainwindow.h b/examples/vehiclefunctions/climate_widget/mainwindow.h
index f296ffc..a7e0cd1 100644
--- a/examples/vehiclefunctions/climate_widget/mainwindow.h
+++ b/examples/vehiclefunctions/climate_widget/mainwindow.h
@@ -70,17 +70,13 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
- explicit MainWindow(QWidget *parent = 0);
+ explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void setAirRecirculationEnabled(bool enabled);
- void onAirRecirculationModeChanged(QIviClimateControl::RecirculationMode mode);
- void onAirRecirculationAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::RecirculationMode> &attribute);
- void onHeaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute);
- void onAirConditioningAttributeChanged(const QIviPropertyAttribute<bool> &attribute);
- void setupFlowDirectionRadioButtons(QIviClimateControl::AirflowDirections direction);
- void setupFlowDirectionAttribute(const QIviPropertyAttribute<QIviClimateControl::AirflowDirections> &attribute);
+ void onAirRecirculationModeChanged(QtIviVehicleFunctionsModule::RecirculationMode mode);
+ void setupFlowDirectionRadioButtons(QtIviVehicleFunctionsModule::AirflowDirections direction);
void onFlowDirectionButtonToggled(QAbstractButton *button, bool checked);
private:
diff --git a/examples/vehiclefunctions/window_qml/WindowItem.qml b/examples/vehiclefunctions/window_qml/WindowItem.qml
index 31bf053..3212e71 100644
--- a/examples/vehiclefunctions/window_qml/WindowItem.qml
+++ b/examples/vehiclefunctions/window_qml/WindowItem.qml
@@ -73,25 +73,22 @@ GroupBox {
ColumnLayout {
RowLayout {
- enabled: zone.state.available
Label {
text: "Window state: "
}
Label {
- text: stateToString(zone.state.value)
+ text: stateToString(zone.state)
}
}
Button {
text: "open"
- enabled: zone.state.available
onClicked: zone.open()
}
Button {
text: "close"
- enabled: zone.state.available
onClicked: zone.close()
}
@@ -101,14 +98,13 @@ GroupBox {
ColumnLayout {
RowLayout {
- enabled: zone.blindState.available
Label {
text: "State: "
}
Label {
- text: stateToString(zone.blindState.value)
+ text: stateToString(zone.blindState)
}
}
@@ -119,33 +115,30 @@ GroupBox {
RadioButton {
text: "Open"
exclusiveGroup: blindGroup
- enabled: zone.blindMode.availableValues.indexOf(WindowControl.BlindOpen) !== -1
- checked: zone.blindMode.value === WindowControl.BlindOpen
+ checked: zone.blindMode === WindowControl.BlindOpen
onCheckedChanged: {
if (checked)
- zone.blindMode.value = WindowControl.BlindOpen
+ zone.blindMode = WindowControl.BlindOpen
}
}
RadioButton {
text: "Closed"
exclusiveGroup: blindGroup
- enabled: zone.blindMode.availableValues.indexOf(WindowControl.BlindClosed) !== -1
- checked: zone.blindMode.value === WindowControl.BlindClosed
+ checked: zone.blindMode === WindowControl.BlindClosed
onCheckedChanged: {
if (checked)
- zone.blindMode.value = WindowControl.BlindClosed
+ zone.blindMode = WindowControl.BlindClosed
}
}
RadioButton {
text: "Automatic"
exclusiveGroup: blindGroup
- enabled: zone.blindMode.availableValues.indexOf(WindowControl.AutoBlind) !== -1
- checked: zone.blindMode.value === WindowControl.AutoBlind
+ checked: zone.blindMode === WindowControl.AutoBlind
onCheckedChanged: {
if (checked)
- zone.blindMode.value = WindowControl.AutoBlind
+ zone.blindMode = WindowControl.AutoBlind
}
}
}
@@ -157,14 +150,13 @@ GroupBox {
ColumnLayout {
RowLayout {
- enabled: zone.heater.available
Label {
text: "Running: "
}
Label {
- text: zone.heater.value
+ text: zone.heater
}
}
@@ -175,33 +167,30 @@ GroupBox {
RadioButton {
text: "On"
exclusiveGroup: heaterGroup
- enabled: zone.heaterMode.availableValues.indexOf(WindowControl.HeaterOn) !== -1
- checked: zone.heaterMode.value === WindowControl.HeaterOn
+ checked: zone.heaterMode === WindowControl.HeaterOn
onCheckedChanged: {
if (checked)
- zone.heaterMode.value = WindowControl.HeaterOn
+ zone.heaterMode = WindowControl.HeaterOn
}
}
RadioButton {
text: "Off"
exclusiveGroup: heaterGroup
- enabled: zone.heaterMode.availableValues.indexOf(WindowControl.HeaterOff) !== -1
- checked: zone.heaterMode.value === WindowControl.HeaterOff
+ checked: zone.heaterMode === WindowControl.HeaterOff
onCheckedChanged: {
if (checked)
- zone.heaterMode.value = WindowControl.HeaterOff
+ zone.heaterMode = WindowControl.HeaterOff
}
}
RadioButton {
text: "Automatic"
exclusiveGroup: heaterGroup
- enabled: zone.heaterMode.availableValues.indexOf(WindowControl.AutoHeater) !== -1
- checked: zone.heaterMode.value === WindowControl.AutoHeater
+ checked: zone.heaterMode === WindowControl.AutoHeater
onCheckedChanged: {
if (checked)
- zone.heaterMode.value = WindowControl.AutoHeater
+ zone.heaterMode = WindowControl.AutoHeater
}
}
}