From 968fd5feb69d9d8b8ffac50a517ac87c6d04e53c Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Tue, 19 Apr 2016 15:41:28 +0200 Subject: Made the ClimateControl API more complete Changed the recirculationMode from being a bool to a enum. Added support for: * outsideTemperature * zoneSynchronization * defrost * recirculationSensitivityLevel * climateMode * automaticClimateFanIntensityLevel Change-Id: Ia8f5189aaba34546fbcc40893e316a8c91e1ad2b Reviewed-by: Robert Griebl --- examples/vehiclefunctions/climate_qml/main.qml | 7 ++++-- .../vehiclefunctions/climate_widget/mainwindow.cpp | 27 ++++++++++++++++------ .../vehiclefunctions/climate_widget/mainwindow.h | 4 +++- 3 files changed, 28 insertions(+), 10 deletions(-) (limited to 'examples') diff --git a/examples/vehiclefunctions/climate_qml/main.qml b/examples/vehiclefunctions/climate_qml/main.qml index 7776b01..68c11ae 100644 --- a/examples/vehiclefunctions/climate_qml/main.qml +++ b/examples/vehiclefunctions/climate_qml/main.qml @@ -139,10 +139,13 @@ ApplicationWindow { CheckBox { text: "Air Recirculation" - checked: climateControl.airRecirculation.value + checked: climateControl.recirculationMode.value === ClimateControl.RecirculationOn enabled: climateControl.airRecirculation.available onClicked: { - climateControl.airRecirculation.value = checked + if (checked) + climateControl.recirculationMode.value = ClimateControl.RecirculationOn + else + climateControl.recirculationMode.value = ClimateControl.RecirculationOff } } diff --git a/examples/vehiclefunctions/climate_widget/mainwindow.cpp b/examples/vehiclefunctions/climate_widget/mainwindow.cpp index 66ac611..343a83e 100644 --- a/examples/vehiclefunctions/climate_widget/mainwindow.cpp +++ b/examples/vehiclefunctions/climate_widget/mainwindow.cpp @@ -101,14 +101,14 @@ MainWindow::MainWindow(QWidget *parent) : m_climateControl, &QtIVIClimateControl::setAirConditioningEnabled); //Air Recirculation - ui->cb_airRecirculation->setChecked(m_climateControl->isAirRecirculationEnabled()); - ui->cb_airRecirculation->setEnabled(m_climateControl->airRecirculationAttribute().isAvailable()); - connect(m_climateControl, &QtIVIClimateControl::airRecirculationEnabledChanged, - ui->cb_airRecirculation, &QCheckBox::setChecked); - connect(m_climateControl, &QtIVIClimateControl::airRecirculationAttributeChanged, + ui->cb_airRecirculation->setChecked(m_climateControl->recirculationMode() == QtIVIClimateControl::RecirculationOn); + ui->cb_airRecirculation->setEnabled(m_climateControl->recirculationModeAttribute().isAvailable()); + connect(m_climateControl, &QtIVIClimateControl::recirculationModeChanged, + this, &MainWindow::onAirRecirculationModeChanged); + connect(m_climateControl, &QtIVIClimateControl::recirculationModeAttributeChanged, this, &MainWindow::onAirRecirculationAttributeChanged); connect(ui->cb_airRecirculation, &QCheckBox::clicked, - m_climateControl, &QtIVIClimateControl::setAirRecirculationEnabled); + this, &MainWindow::setAirRecirculationEnabled); //Heater ui->cb_heater->setChecked(m_climateControl->isHeaterEnabled()); @@ -127,7 +127,20 @@ MainWindow::~MainWindow() delete ui; } -void MainWindow::onAirRecirculationAttributeChanged(const QtIVIPropertyAttribute & attribute) +void MainWindow::setAirRecirculationEnabled(bool enabled) +{ + if (enabled) + m_climateControl->setRecirculationMode(QtIVIClimateControl::RecirculationOn); + else + m_climateControl->setRecirculationMode(QtIVIClimateControl::RecirculationOff); +} + +void MainWindow::onAirRecirculationModeChanged(QtIVIClimateControl::RecirculationMode mode) +{ + ui->cb_airRecirculation->setChecked(mode == QtIVIClimateControl::RecirculationOn); +} + +void MainWindow::onAirRecirculationAttributeChanged(const QtIVIPropertyAttribute & attribute) { ui->cb_airRecirculation->setEnabled(attribute.isAvailable()); } diff --git a/examples/vehiclefunctions/climate_widget/mainwindow.h b/examples/vehiclefunctions/climate_widget/mainwindow.h index 65d936a..81564bd 100644 --- a/examples/vehiclefunctions/climate_widget/mainwindow.h +++ b/examples/vehiclefunctions/climate_widget/mainwindow.h @@ -74,7 +74,9 @@ public: ~MainWindow(); private slots: - void onAirRecirculationAttributeChanged(const QtIVIPropertyAttribute &attribute); + void setAirRecirculationEnabled(bool enabled); + void onAirRecirculationModeChanged(QtIVIClimateControl::RecirculationMode mode); + void onAirRecirculationAttributeChanged(const QtIVIPropertyAttribute &attribute); void onHeaterAttributeChanged(const QtIVIPropertyAttribute &attribute); void onAirConditioningAttributeChanged(const QtIVIPropertyAttribute &attribute); void setupFlowDirectionRadioButtons(QtIVIClimateControl::AirflowDirections direction); -- cgit v1.2.3