diff options
-rw-r--r-- | src/src.pro | 3 | ||||
-rw-r--r-- | src/vehiclefunctions/qtiviclimatecontrol.cpp | 380 | ||||
-rw-r--r-- | src/vehiclefunctions/qtiviclimatecontrol.h | 196 | ||||
-rw-r--r-- | src/vehiclefunctions/qtiviclimatecontrolbackendinterface.h | 57 | ||||
-rw-r--r-- | src/vehiclefunctions/vehiclefunctions.pro | 16 | ||||
-rw-r--r-- | sync.profile | 1 |
6 files changed, 652 insertions, 1 deletions
diff --git a/src/src.pro b/src/src.pro index 6300dbd..c862df4 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,3 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = core +SUBDIRS = core \ + vehiclefunctions diff --git a/src/vehiclefunctions/qtiviclimatecontrol.cpp b/src/vehiclefunctions/qtiviclimatecontrol.cpp new file mode 100644 index 0000000..34dbae1 --- /dev/null +++ b/src/vehiclefunctions/qtiviclimatecontrol.cpp @@ -0,0 +1,380 @@ +#include "qtiviclimatecontrol.h" + +#include "qtiviclimatecontrolbackendinterface.h" + + + +QString QtIVIClimateControlBackendInterface::interfaceName = QLatin1String("com.pelagicore.ClimateControl"); + + + + +QtIVIClimateZone::QtIVIClimateZone(Zone zone, QtIVIClimateControl *parent) + : QObject(parent) + , m_zone(zone) + , m_hasTargetTemperature(false) + , m_hasSeatCooler(false) + , m_hasSeatHeater(false) + , m_targetTemperature(0) + , m_seatCooler(0) + , m_seatHeater(0) +{ + +} + +QtIVIClimateZone::Zone QtIVIClimateZone::zone() const +{ + return m_zone; +} + +bool QtIVIClimateZone::hasTargetTemperature() const +{ + return m_hasTargetTemperature; +} + +int QtIVIClimateZone::targetTemperature() const +{ + return m_targetTemperature; +} + +void QtIVIClimateZone::setTargetTemperature(int t) +{ + if (m_hasTargetTemperature) + qobject_cast<QtIVIClimateControl*>(parent())->backend()->setTargetTemperature(m_zone, t); +} + +bool QtIVIClimateZone::hasSeatCooler() const +{ + return m_hasSeatCooler; +} + +int QtIVIClimateZone::seatCooler() const +{ + return m_seatCooler; +} + +void QtIVIClimateZone::setSeatCooler(int t) +{ + if (m_hasSeatCooler) + qobject_cast<QtIVIClimateControl*>(parent())->backend()->setSeatCooler(m_zone, t); +} + +bool QtIVIClimateZone::hasSeatHeater() const +{ + return m_hasSeatHeater; +} + +int QtIVIClimateZone::seatHeater() const +{ + return m_seatHeater; +} + +void QtIVIClimateZone::setSeatHeater(int t) +{ + if (m_hasSeatHeater) + qobject_cast<QtIVIClimateControl*>(parent())->backend()->setSeatHeater(m_zone, t); +} + +void QtIVIClimateZone::onTargetTemperatureChanged(QtIVIClimateZone::Zone z, int t) +{ + if (z == m_zone) { + m_targetTemperature = t; + emit targetTemperatureChanged(m_seatHeater); + } +} + +void QtIVIClimateZone::onSeatCoolerChanged(QtIVIClimateZone::Zone z, int t) +{ + if (z == m_zone) { + m_seatCooler = t; + emit seatCoolerChanged(m_seatCooler); + } +} + +void QtIVIClimateZone::onSeatHeaterChanged(QtIVIClimateZone::Zone z, int t) +{ + if (z == m_zone) { + m_seatHeater = t; + emit seatHeaterChanged(m_seatHeater); + } +} + +void QtIVIClimateZone::setHasTargetTemperature(bool e) +{ + if(e != m_hasTargetTemperature) { + m_hasTargetTemperature = e; + emit hasTargetTemperatureChanged(m_hasTargetTemperature); + + if (!m_hasTargetTemperature) + onTargetTemperatureChanged(m_zone, 0); + } +} + +void QtIVIClimateZone::setHasSeatCooler(bool e) +{ + if(e != m_hasSeatCooler) { + m_hasSeatCooler = e; + emit hasSeatCoolerChanged(m_hasSeatCooler); + + if (!m_hasSeatCooler) + onSeatCoolerChanged(m_zone, 0); + } +} + +void QtIVIClimateZone::setHasSeatHeater(bool e) +{ + if(e != m_hasSeatHeater) { + m_hasSeatHeater = e; + emit hasSeatHeaterChanged(m_hasSeatHeater); + + if (!m_hasSeatHeater) + onSeatHeaterChanged(m_zone, 0); + } +} + + + + + +QtIVIClimateControl::QtIVIClimateControl(QObject *parent) + : QtIVIAbstractFeature(QtIVIClimateControlBackendInterface::interfaceName, true, parent) + , m_airflowDirection(QtIVIClimateControl::BiLevel) + , m_airConditioning(false) + , m_heater(false) + , m_airRecirculation(false) + , m_steeringWheelHeater(false) + , m_fanSpeedLevel(0) +{ + QList<QtIVIClimateZone::Zone> zones; + zones << QtIVIClimateZone::FrontLeft << QtIVIClimateZone::FrontCenter << QtIVIClimateZone::FrontRight + << QtIVIClimateZone::RearLeft << QtIVIClimateZone::RearCenter << QtIVIClimateZone::RearRight; + foreach(QtIVIClimateZone::Zone z, zones) + m_zones[z] = new QtIVIClimateZone(z, this); +} + +QtIVIClimateControl::AirflowDirection QtIVIClimateControl::airflowDirection() const +{ + return m_airflowDirection; +} + +bool QtIVIClimateControl::isAirConditioningEnabled() const +{ + return m_airConditioning; +} + +bool QtIVIClimateControl::isHeaterEnabled() const +{ + return m_heater; +} + +bool QtIVIClimateControl::isAirRecirculationEnabled() const +{ + return m_airRecirculation; +} + +bool QtIVIClimateControl::isSteeringWheelHeaterEnabled() const +{ + return m_steeringWheelHeater; +} + +int QtIVIClimateControl::fanSpeedLevel() const +{ + return m_fanSpeedLevel; +} + +QtIVIClimateZone *QtIVIClimateControl::climateZone(QtIVIClimateZone::Zone z) const +{ + return m_zones[z]; +} + +QtIVIClimateZone *QtIVIClimateControl::driver() const +{ + return m_zones[backend()?backend()->driverZone():QtIVIClimateZone::FrontLeft]; +} + +QtIVIClimateZone *QtIVIClimateControl::frontLeftZone() const +{ + return m_zones[QtIVIClimateZone::FrontLeft]; +} + +QtIVIClimateZone *QtIVIClimateControl::frontCenterZone() const +{ + return m_zones[QtIVIClimateZone::FrontCenter]; +} + +QtIVIClimateZone *QtIVIClimateControl::frontRightZone() const +{ + return m_zones[QtIVIClimateZone::FrontRight]; +} + +QtIVIClimateZone *QtIVIClimateControl::rearLeftZone() const +{ + return m_zones[QtIVIClimateZone::RearLeft]; +} + +QtIVIClimateZone *QtIVIClimateControl::rearCenterZone() const +{ + return m_zones[QtIVIClimateZone::RearCenter]; +} + +QtIVIClimateZone *QtIVIClimateControl::rearRightZone() const +{ + return m_zones[QtIVIClimateZone::RearRight]; +} + +void QtIVIClimateControl::setAirflowDirection(QtIVIClimateControl::AirflowDirection ad) +{ + if(backend()) + backend()->setAirflowDirection(ad); +} + +void QtIVIClimateControl::setAirConditioningEnabled(bool e) +{ + if(backend()) + backend()->setAirConditioningEnabled(e); +} + +void QtIVIClimateControl::setHeaterEnabled(bool e) +{ + if(backend()) + backend()->setHeaterEnabled(e); +} + +void QtIVIClimateControl::setAirRecirculationEnabled(bool e) +{ + if(backend()) + backend()->setAirRecirculationEnabled(e); +} + +void QtIVIClimateControl::setSteeringWheelHeaterEnabled(bool e) +{ + if(backend()) + backend()->setSteeringWheelHeaterEnabled(e); +} + +void QtIVIClimateControl::setFanSpeedLevel(int fsl) +{ + if(backend()) + backend()->setFanSpeedLevel(fsl); +} + +bool QtIVIClimateControl::acceptServiceObject(QtIVIServiceObject *so) +{ + return (qobject_cast<QtIVIClimateControlBackendInterface*>(so->interfaceInstance(QtIVIClimateControlBackendInterface::interfaceName)) != NULL); +} + +void QtIVIClimateControl::connectToServiceObject(QtIVIServiceObject *so) +{ + QtIVIClimateControlBackendInterface *backend = qobject_cast<QtIVIClimateControlBackendInterface*>(so->interfaceInstance(QtIVIClimateControlBackendInterface::interfaceName)); + + QList<QtIVIClimateZone::Zone> zones; + zones << QtIVIClimateZone::FrontLeft << QtIVIClimateZone::FrontCenter << QtIVIClimateZone::FrontRight + << QtIVIClimateZone::RearLeft << QtIVIClimateZone::RearCenter << QtIVIClimateZone::RearRight; + foreach(QtIVIClimateZone::Zone z, zones) { + connect(backend, SIGNAL(targetTemperatureChanged(QtIVIClimateZone::Zone, int)), m_zones[z], SLOT(onTargetTemperatureChanged(QtIVIClimateZone::Zone,int))); + connect(backend, SIGNAL(seatCoolerChanged(QtIVIClimateZone::Zone, int)), m_zones[z], SLOT(onSeatCoolerChanged(QtIVIClimateZone::Zone,int))); + connect(backend, SIGNAL(seatHeaterChanged(QtIVIClimateZone::Zone, int)), m_zones[z], SLOT(onSeatHeaterChanged(QtIVIClimateZone::Zone,int))); + m_zones[z]->setHasTargetTemperature(backend->hasTargetTemperature(z)); + m_zones[z]->onTargetTemperatureChanged(z, backend->targetTemperature(z)); + m_zones[z]->setHasSeatCooler(backend->hasSeatCooler(z)); + m_zones[z]->onSeatCoolerChanged(z, backend->seatCooler(z)); + m_zones[z]->setHasSeatHeater(backend->hasSeatHeater(z)); + m_zones[z]->onSeatHeaterChanged(z, backend->seatHeater(z)); + } + + connect(backend, SIGNAL(airflowDirectionChanged(QtIVIClimateControl::AirflowDirection)), this, SLOT(onAirflowDirectionChanged(AirflowDirection))); + connect(backend, SIGNAL(airConditioningEnabledChanged(bool)), this, SLOT(onAirConditioningEnabledChanged(bool))); + connect(backend, SIGNAL(heaterEnabledChanged(bool)), this, SLOT(onHeaterEnabledChanged(bool))); + connect(backend, SIGNAL(airRecirculationEnabledChanged(bool)), this, SLOT(onAirRecirculationEnabledChanged(bool))); + connect(backend, SIGNAL(steeringWheelHeaterEnabledChanged(bool)), this, SLOT(onSteeringWheelHeaterEnabledChanged(bool))); + connect(backend, SIGNAL(fanSpeedLevelChanged(int)), this, SLOT(onFanSpeedLevelChanged(int))); + + onAirflowDirectionChanged(backend->airflowDirection()); + onAirConditioningEnabledChanged(backend->airConditioningEnabled()); + onHeaterEnabledChanged(backend->heaterEnabled()); + onAirRecirculationEnabledChanged(backend->airRecirculationEnabled()); + onSteeringWheelHeaterEnabledChanged(backend->steeringWheelHeaterEnabled()); + onFanSpeedLevelChanged(backend->fanSpeedLevel()); +} + +void QtIVIClimateControl::disconnectFromServiceObject(QtIVIServiceObject *so) +{ + QtIVIClimateControlBackendInterface *backend = qobject_cast<QtIVIClimateControlBackendInterface*>(so->interfaceInstance(QtIVIClimateControlBackendInterface::interfaceName)); + + QList<QtIVIClimateZone::Zone> zones; + zones << QtIVIClimateZone::FrontLeft << QtIVIClimateZone::FrontCenter << QtIVIClimateZone::FrontRight + << QtIVIClimateZone::RearLeft << QtIVIClimateZone::RearCenter << QtIVIClimateZone::RearRight; + foreach(QtIVIClimateZone::Zone z, zones) { + disconnect(backend, SIGNAL(targetTemperatureChanged(QtIVIClimateZone::Zone, int)), m_zones[z], SLOT(onTargetTemperatureChanged(QtIVIClimateZone::Zone,int))); + disconnect(backend, SIGNAL(seatCoolerChanged(QtIVIClimateZone::Zone, int)), m_zones[z], SLOT(onSeatCoolerChanged(QtIVIClimateZone::Zone,int))); + disconnect(backend, SIGNAL(seatHeaterChanged(QtIVIClimateZone::Zone, int)), m_zones[z], SLOT(onSeatHeaterChanged(QtIVIClimateZone::Zone,int))); + } + + disconnect(backend, SIGNAL(airflowDirectionChanged(QtIVIClimateControl::AirflowDirection)), this, SLOT(onAirflowDirectionChanged(AirflowDirection))); + disconnect(backend, SIGNAL(airConditioningEnabledChanged(bool)), this, SLOT(onAirConditioningEnabledChanged(bool))); + disconnect(backend, SIGNAL(heaterEnabledChanged(bool)), this, SLOT(onHeaterEnabledChanged(bool))); + disconnect(backend, SIGNAL(airRecirculationEnabledChanged(bool)), this, SLOT(onAirRecirculationEnabledChanged(bool))); + disconnect(backend, SIGNAL(steeringWheelHeaterEnabledChanged(bool)), this, SLOT(onSteeringWheelHeaterEnabledChanged(bool))); + disconnect(backend, SIGNAL(fanSpeedLevelChanged(int)), this, SLOT(onFanSpeedLevelChanged(int))); +} + +void QtIVIClimateControl::clearServiceObject() +{ + /* Safe defaults */ + onAirflowDirectionChanged(QtIVIClimateControl::BiLevel); + onAirConditioningEnabledChanged(false); + onHeaterEnabledChanged(false); + onAirRecirculationEnabledChanged(false); + onSteeringWheelHeaterEnabledChanged(false); + onFanSpeedLevelChanged(0); + + QList<QtIVIClimateZone::Zone> zones; + zones << QtIVIClimateZone::FrontLeft << QtIVIClimateZone::FrontCenter << QtIVIClimateZone::FrontRight + << QtIVIClimateZone::RearLeft << QtIVIClimateZone::RearCenter << QtIVIClimateZone::RearRight; + foreach(QtIVIClimateZone::Zone z, zones) { + m_zones[z]->setHasTargetTemperature(false); + m_zones[z]->setHasSeatCooler(false); + m_zones[z]->setHasSeatHeater(false); + } +} + +void QtIVIClimateControl::onAirflowDirectionChanged(QtIVIClimateControl::AirflowDirection airflowDirection) +{ + m_airflowDirection = airflowDirection; + emit airflowDirectionChanged(m_airflowDirection); +} + +void QtIVIClimateControl::onAirConditioningEnabledChanged(bool airConditioning) +{ + m_airConditioning = airConditioning; + emit airConditioningEnabledChanged(m_airConditioning); +} + +void QtIVIClimateControl::onHeaterEnabledChanged(bool heater) +{ + m_heater = heater; + emit heaterEnabledChanged(m_heater); +} + +void QtIVIClimateControl::onAirRecirculationEnabledChanged(bool airRecirculation) +{ + m_airRecirculation = airRecirculation; + emit airRecirculationEnabledChanged(m_airRecirculation); +} + +void QtIVIClimateControl::onSteeringWheelHeaterEnabledChanged(bool steeringWheelHeater) +{ + m_steeringWheelHeater = steeringWheelHeater; + emit steeringWheelHeaterEnabledChanged(m_steeringWheelHeater); +} + +void QtIVIClimateControl::onFanSpeedLevelChanged(int fanSpeedLevel) +{ + m_fanSpeedLevel = fanSpeedLevel; + emit fanSpeedLevelChanged(m_fanSpeedLevel); +} + +QtIVIClimateControlBackendInterface *QtIVIClimateControl::backend() const +{ + return qobject_cast<QtIVIClimateControlBackendInterface*>(serviceObject()->interfaceInstance(QtIVIClimateControlBackendInterface::interfaceName)); +} diff --git a/src/vehiclefunctions/qtiviclimatecontrol.h b/src/vehiclefunctions/qtiviclimatecontrol.h new file mode 100644 index 0000000..021a6a7 --- /dev/null +++ b/src/vehiclefunctions/qtiviclimatecontrol.h @@ -0,0 +1,196 @@ +#ifndef CLIMATECONTROL_H +#define CLIMATECONTROL_H + +#include <QtIVIAbstractFeature> +#include <QObject> +#include <QMap> + +class QtIVIClimateControl; +class QtIVIClimateControlBackendInterface; + +/* Properties based on http://www.w3.org/2014/automotive/data_spec.html#idl-def-ClimateControl + * This list contains properties per zone. + */ +class QtIVIClimateZone : public QObject +{ + Q_OBJECT + + Q_PROPERTY(Zone zone READ zone CONSTANT) + Q_PROPERTY(bool hasTargetTemperature READ hasTargetTemperature NOTIFY hasTargetTemperatureChanged) + Q_PROPERTY(bool hasSeatCooler READ hasSeatCooler NOTIFY hasSeatCoolerChanged) + Q_PROPERTY(bool hasSeatHeater READ hasSeatHeater NOTIFY hasSeatHeaterChanged) + /* current setting of the desired temperature (Unit: celsius) */ + Q_PROPERTY(int targetTemperature READ targetTemperature WRITE setTargetTemperature NOTIFY targetTemperatureChanged) + /* current status of the seat ventilation ( 0: off, 1: least warm, 10: warmest ) */ + Q_PROPERTY(int seatCooler READ seatCooler WRITE setSeatCooler NOTIFY seatCoolerChanged) + /* current status of the seat warmer ( 0: off, 1: least warm, 10: warmest ) */ + Q_PROPERTY(int seatHeater READ seatHeater WRITE setSeatHeater NOTIFY seatHeaterChanged) + + Q_ENUMS(Zone) + +public: + /* Based on http://www.w3.org/2014/automotive/vehicle_spec.html#idl-def-Zone */ + enum Zone { + FrontLeft, + FrontCenter, + FrontRight, + RearLeft, + RearCenter, + RearRight + }; + + QtIVIClimateZone(Zone zone, QtIVIClimateControl *parent); + + Zone zone() const; + + bool hasTargetTemperature() const; + bool hasSeatCooler() const; + bool hasSeatHeater() const; + + int targetTemperature() const; + int seatCooler() const; + int seatHeater() const; + +public slots: + void setTargetTemperature(int); + void setSeatCooler(int); + void setSeatHeater(int); + +signals: + void hasTargetTemperatureChanged(bool hasTargetTemperature); + void hasSeatCoolerChanged(bool hasSeatCooler); + void hasSeatHeaterChanged(bool hasSeatHeater); + + void targetTemperatureChanged(int targetTemperature); + void seatCoolerChanged(int seatCooler); + void seatHeaterChanged(int seatHeater); + +private slots: + void onTargetTemperatureChanged(QtIVIClimateZone::Zone z, int t); + void onSeatCoolerChanged(QtIVIClimateZone::Zone z, int t); + void onSeatHeaterChanged(QtIVIClimateZone::Zone z, int t); + +private: + friend class QtIVIClimateControl; + + void setHasTargetTemperature(bool); + void setHasSeatCooler(bool); + void setHasSeatHeater(bool); + + Zone m_zone; + + bool m_hasTargetTemperature; + bool m_hasSeatCooler; + bool m_hasSeatHeater; + + int m_targetTemperature; + int m_seatCooler; + int m_seatHeater; +}; + + +/* Properties based on http://www.w3.org/2014/automotive/data_spec.html#idl-def-ClimateControl + * This list contains the properties for the whole car. + */ +class QtIVIClimateControl : public QtIVIAbstractFeature +{ + Q_OBJECT + + Q_PROPERTY(AirflowDirection airflowDirection READ airflowDirection WRITE setAirflowDirection NOTIFY airflowDirectionChanged) + /* current status of the air conditioning system: on (true) or off (false) */ + Q_PROPERTY(bool airConditioning READ isAirConditioningEnabled WRITE setAirConditioningEnabled NOTIFY airConditioningEnabledChanged) + /* current status of the heating system: on (true) or off (false) */ + Q_PROPERTY(bool heater READ isHeaterEnabled WRITE setHeaterEnabled NOTIFY heaterEnabledChanged) + /* current setting of air recirculation: on (true) or pulling in outside air (false) */ + Q_PROPERTY(bool airRecirculation READ isAirRecirculationEnabled WRITE setAirRecirculationEnabled NOTIFY airRecirculationEnabledChanged) + /* current status of steering wheel heater ( 0: off, 1: least warm, 10: warmest ) */ + Q_PROPERTY(bool steeringWheelHeater READ isSteeringWheelHeaterEnabled WRITE setSteeringWheelHeaterEnabled NOTIFY steeringWheelHeaterEnabledChanged) + /* current status of the fan speed of the air flowing (0: off, 1: weakest, 10: strongest ) */ + Q_PROPERTY(int fanSpeedLevel READ fanSpeedLevel WRITE setFanSpeedLevel NOTIFY fanSpeedLevelChanged) + + Q_PROPERTY(QtIVIClimateZone* frontLeftZone READ frontLeftZone CONSTANT) + Q_PROPERTY(QtIVIClimateZone* frontCenterZone READ frontCenterZone CONSTANT) + Q_PROPERTY(QtIVIClimateZone* frontRightZone READ frontRightZone CONSTANT) + Q_PROPERTY(QtIVIClimateZone* rearLeftZone READ rearLeftZone CONSTANT) + Q_PROPERTY(QtIVIClimateZone* rearCenterZone READ rearCenterZone CONSTANT) + Q_PROPERTY(QtIVIClimateZone* rearRightZone READ rearRightZone CONSTANT) + + Q_PROPERTY(QtIVIClimateZone* driver READ driver CONSTANT) + + Q_ENUMS(AirflowDirection) + +public: + QtIVIClimateControl(QObject *parent=0); + + /* Based on http://www.w3.org/2014/automotive/data_spec.html#idl-def-AirflowDirection */ + enum AirflowDirection { + FloorPanel, + FloorDuct, + BiLevel, + DefrostFloor + }; + + AirflowDirection airflowDirection() const; + + bool isAirConditioningEnabled() const; + bool isHeaterEnabled() const; + bool isAirRecirculationEnabled() const; + bool isSteeringWheelHeaterEnabled() const; + int fanSpeedLevel() const; + + QtIVIClimateZone *climateZone(QtIVIClimateZone::Zone) const; + QtIVIClimateZone *driver() const; + + QtIVIClimateZone *frontLeftZone() const; + QtIVIClimateZone *frontCenterZone() const; + QtIVIClimateZone *frontRightZone() const; + QtIVIClimateZone *rearLeftZone() const; + QtIVIClimateZone *rearCenterZone() const; + QtIVIClimateZone *rearRightZone() const; + +public slots: + void setAirflowDirection(AirflowDirection); + void setAirConditioningEnabled(bool); + void setHeaterEnabled(bool); + void setAirRecirculationEnabled(bool); + void setSteeringWheelHeaterEnabled(bool); + void setFanSpeedLevel(int); + +signals: + void airflowDirectionChanged(AirflowDirection airflowDirection); + void airConditioningEnabledChanged(bool airConditioning); + void heaterEnabledChanged(bool heaterEnabled); + void airRecirculationEnabledChanged(bool airRecirculation); + void steeringWheelHeaterEnabledChanged(bool steeringWheelHeater); + void fanSpeedLevelChanged(int fanSpeedLevel); + +protected: + virtual bool acceptServiceObject(QtIVIServiceObject *so); + virtual void connectToServiceObject(QtIVIServiceObject *so); + virtual void disconnectFromServiceObject(QtIVIServiceObject *so); + virtual void clearServiceObject(); + +private slots: + void onAirflowDirectionChanged(AirflowDirection airflowDirection); + void onAirConditioningEnabledChanged(bool airConditioning); + void onHeaterEnabledChanged(bool heater); + void onAirRecirculationEnabledChanged(bool airRecirculation); + void onSteeringWheelHeaterEnabledChanged(bool steeringWheelHeater); + void onFanSpeedLevelChanged(int fanSpeedLevel); + +private: + friend class QtIVIClimateZone; + + QtIVIClimateControlBackendInterface *backend() const; + + AirflowDirection m_airflowDirection; + bool m_airConditioning; + bool m_heater; + bool m_airRecirculation; + bool m_steeringWheelHeater; + int m_fanSpeedLevel; + + QMap<QtIVIClimateZone::Zone, QtIVIClimateZone*> m_zones; +}; + +#endif // CLIMATECONTROL_H diff --git a/src/vehiclefunctions/qtiviclimatecontrolbackendinterface.h b/src/vehiclefunctions/qtiviclimatecontrolbackendinterface.h new file mode 100644 index 0000000..0c5886c --- /dev/null +++ b/src/vehiclefunctions/qtiviclimatecontrolbackendinterface.h @@ -0,0 +1,57 @@ +#ifndef QTIVICLIMATECONTROLBACKENDINTERFACE_H +#define QTIVICLIMATECONTROLBACKENDINTERFACE_H + +#include <QObject> + +/* I'm not sure if we want this one here */ +#include "qtiviclimatecontrol.h" + +class QtIVIClimateControlBackendInterface : public QObject +{ + Q_OBJECT + +public: + static QString interfaceName; + + virtual bool hasTargetTemperature(QtIVIClimateZone::Zone) = 0; + virtual bool hasSeatCooler(QtIVIClimateZone::Zone) = 0; + virtual bool hasSeatHeater(QtIVIClimateZone::Zone) = 0; + virtual void setTargetTemperature(QtIVIClimateZone::Zone, int) = 0; + virtual void setSeatCooler(QtIVIClimateZone::Zone, int) = 0; + virtual void setSeatHeater(QtIVIClimateZone::Zone, int) = 0; + + virtual QtIVIClimateZone::Zone driverZone() const = 0; + + virtual void setAirflowDirection(QtIVIClimateControl::AirflowDirection) = 0; + virtual void setAirConditioningEnabled(bool) = 0; + virtual void setHeaterEnabled(bool) = 0; + virtual void setAirRecirculationEnabled(bool) = 0; + virtual void setSteeringWheelHeaterEnabled(bool) = 0; + virtual void setFanSpeedLevel(int) = 0; + + virtual int targetTemperature(QtIVIClimateZone::Zone) const = 0; + virtual int seatCooler(QtIVIClimateZone::Zone) const = 0; + virtual int seatHeater(QtIVIClimateZone::Zone) const = 0; + + virtual QtIVIClimateControl::AirflowDirection airflowDirection() const = 0; + virtual bool airConditioningEnabled() const = 0; + virtual bool heaterEnabled() const = 0; + virtual bool airRecirculationEnabled() const = 0; + virtual bool steeringWheelHeaterEnabled() const = 0; + virtual int fanSpeedLevel() const = 0; + +signals: + void targetTemperatureChanged(QtIVIClimateZone::Zone, int); + void seatCoolerChanged(QtIVIClimateZone::Zone, int); + void seatHeaterChanged(QtIVIClimateZone::Zone, int); + + void airflowDirectionChanged(QtIVIClimateControl::AirflowDirection); + void airConditioningEnabledChanged(bool); + void heaterEnabledChanged(bool); + void airRecirculationEnabledChanged(bool); + void steeringWheelHeaterEnabledChanged(bool); + void fanSpeedLevelChanged(int); +}; + +#endif // QTIVICLIMATECONTROLBACKENDINTERFACE_H + diff --git a/src/vehiclefunctions/vehiclefunctions.pro b/src/vehiclefunctions/vehiclefunctions.pro new file mode 100644 index 0000000..103a9c5 --- /dev/null +++ b/src/vehiclefunctions/vehiclefunctions.pro @@ -0,0 +1,16 @@ +MODULE = QtIVIVehicleFunctions +TARGET = $$MODULE +QT = core qml QtIVICore +CONFIG += c++11 +VERSION = 1.0.0 + +CMAKE_MODULE_TESTS = '-' + +HEADERS += \ + qtiviclimatecontrol.h \ + qtiviclimatecontrolbackendinterface.h + +SOURCES += \ + qtiviclimatecontrol.cpp + +load(qt_module) diff --git a/sync.profile b/sync.profile index a999d1f..50b6d05 100644 --- a/sync.profile +++ b/sync.profile @@ -1,5 +1,6 @@ %modules = ( # path to module name map "QtIVICore" => "$basedir/src/core", + "QtIVIVehicleFunctions" => "$basedir/src/vehiclefunctions", ); %moduleheaders = ( # restrict the module headers to those found in relative path ); |