prepared everything for autocreate the slave devices of the cube...allmost all data are now decoded...
This commit is contained in:
parent
f63e7885e0
commit
b283725314
@ -10,7 +10,8 @@ SOURCES += \
|
|||||||
maxcube.cpp \
|
maxcube.cpp \
|
||||||
maxdevice.cpp \
|
maxdevice.cpp \
|
||||||
room.cpp \
|
room.cpp \
|
||||||
livemessage.cpp
|
wallthermostat.cpp \
|
||||||
|
radiatorthermostat.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
deviceplugineq-3.h \
|
deviceplugineq-3.h \
|
||||||
@ -18,5 +19,6 @@ HEADERS += \
|
|||||||
maxcube.h \
|
maxcube.h \
|
||||||
maxdevice.h \
|
maxdevice.h \
|
||||||
room.h \
|
room.h \
|
||||||
livemessage.h
|
wallthermostat.h \
|
||||||
|
radiatorthermostat.h
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ MaxCube::MaxCube(QObject *parent, QString serialNumber, QHostAddress hostAdress,
|
|||||||
|
|
||||||
connect(this,SIGNAL(connected()),this,SLOT(connected()));
|
connect(this,SIGNAL(connected()),this,SLOT(connected()));
|
||||||
connect(this,SIGNAL(disconnected()),this,SLOT(disconnected()));
|
connect(this,SIGNAL(disconnected()),this,SLOT(disconnected()));
|
||||||
|
|
||||||
connect(this,SIGNAL(readyRead()),this,SLOT(readData()));
|
connect(this,SIGNAL(readyRead()),this,SLOT(readData()));
|
||||||
connect(this,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(error(QAbstractSocket::SocketError)));
|
connect(this,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(error(QAbstractSocket::SocketError)));
|
||||||
|
|
||||||
@ -82,26 +83,6 @@ void MaxCube::setPort(const quint16 &port)
|
|||||||
m_port = port;
|
m_port = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray MaxCube::httpConnectionId() const
|
|
||||||
{
|
|
||||||
return m_httpConnectionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaxCube::setHttpConnectionId(const QByteArray &httpConnectionId)
|
|
||||||
{
|
|
||||||
m_httpConnectionId = httpConnectionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
int MaxCube::freeMemorySlots() const
|
|
||||||
{
|
|
||||||
return m_freeMemorySlots;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaxCube::setFreeMemorySlots(const int &freeMemorySlots)
|
|
||||||
{
|
|
||||||
m_freeMemorySlots = freeMemorySlots;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDateTime MaxCube::cubeDateTime() const
|
QDateTime MaxCube::cubeDateTime() const
|
||||||
{
|
{
|
||||||
return m_cubeDateTime;
|
return m_cubeDateTime;
|
||||||
@ -117,9 +98,14 @@ bool MaxCube::portalEnabeld() const
|
|||||||
return m_portalEnabeld;
|
return m_portalEnabeld;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<MaxDevice *> MaxCube::deviceList()
|
QList<WallThermostat *> MaxCube::wallThermostatList()
|
||||||
{
|
{
|
||||||
return m_deviceList;
|
return m_wallThermostatList;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<RadiatorThermostat *> MaxCube::radiatorThermostatList()
|
||||||
|
{
|
||||||
|
return m_radiatorThermostatList;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Room *> MaxCube::roomList()
|
QList<Room *> MaxCube::roomList()
|
||||||
@ -153,28 +139,25 @@ void MaxCube::decodeHelloMessage(QByteArray data)
|
|||||||
m_rfAddress = list.at(1);
|
m_rfAddress = list.at(1);
|
||||||
m_firmware = list.at(2).toInt();
|
m_firmware = list.at(2).toInt();
|
||||||
|
|
||||||
qDebug() << "====================================================";
|
// qDebug() << "====================================================";
|
||||||
qDebug() << " HELLO message:";
|
// qDebug() << " HELLO message:";
|
||||||
qDebug() << "====================================================";
|
// qDebug() << "====================================================";
|
||||||
qDebug() << " serial number | " << list.at(0);
|
// qDebug() << " serial number | " << m_serialNumber;
|
||||||
qDebug() << " RF address (hex) | " << list.at(1);
|
// qDebug() << " RF address (hex) | " << m_rfAddress;
|
||||||
qDebug() << " firmware | " << QString::number(list.at(2).toInt());
|
// qDebug() << " firmware | " << m_firmware;
|
||||||
qDebug() << " HTTP connection id | " << list.at(4);
|
// qDebug() << " Cube date | " << m_cubeDateTime.date().toString("dd.MM.yyyy");
|
||||||
qDebug() << " duty cycle (hex) | " << list.at(5);
|
// qDebug() << " Cube time | " << m_cubeDateTime.time().toString("HH:mm");
|
||||||
qDebug() << " free memory slots (hex) | " << list.at(6);
|
// qDebug() << " State Cube Time | " << list.at(9);
|
||||||
qDebug() << " Cube date | " << m_cubeDateTime.date().toString("dd.MM.yyyy");
|
// qDebug() << " NTP counter | " << list.at(10);
|
||||||
qDebug() << " Cube time | " << m_cubeDateTime.time().toString("HH:mm");
|
|
||||||
qDebug() << " State Cube Time | " << list.at(9);
|
|
||||||
qDebug() << " NTP counter | " << list.at(10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaxCube::decodeMetadataMessage(QByteArray data)
|
void MaxCube::decodeMetadataMessage(QByteArray data)
|
||||||
{
|
{
|
||||||
QList<QByteArray> list = data.left(data.length()-2).split(',');
|
QList<QByteArray> list = data.left(data.length()-2).split(',');
|
||||||
QByteArray dataDecoded = QByteArray::fromBase64(list.at(2));
|
QByteArray dataDecoded = QByteArray::fromBase64(list.at(2));
|
||||||
qDebug() << "====================================================";
|
// qDebug() << "====================================================";
|
||||||
qDebug() << " METADATA message:";
|
// qDebug() << " METADATA message:";
|
||||||
qDebug() << "====================================================";
|
// qDebug() << "====================================================";
|
||||||
|
|
||||||
// parse room list
|
// parse room list
|
||||||
int roomCount = dataDecoded.toHex().mid(4,2).toInt(0,16);
|
int roomCount = dataDecoded.toHex().mid(4,2).toInt(0,16);
|
||||||
@ -191,58 +174,89 @@ void MaxCube::decodeMetadataMessage(QByteArray data)
|
|||||||
m_roomList.append(room);
|
m_roomList.append(room);
|
||||||
roomRawData = roomRawData.right(roomRawData.length() - ((roomNameLength*2) + 10));
|
roomRawData = roomRawData.right(roomRawData.length() - ((roomNameLength*2) + 10));
|
||||||
}
|
}
|
||||||
qDebug() << "-------------------------|-------------------------";
|
// qDebug() << "-------------------------|-------------------------";
|
||||||
qDebug() << "found " << m_roomList.count() << "rooms";
|
// qDebug() << "found " << m_roomList.count() << "rooms";
|
||||||
qDebug() << "-------------------------|-------------------------";
|
// qDebug() << "-------------------------|-------------------------";
|
||||||
|
|
||||||
foreach (Room *room, m_roomList) {
|
// foreach (Room *room, m_roomList) {
|
||||||
qDebug() << " Room Name | " << room->roomName();
|
// qDebug() << " Room Name | " << room->roomName();
|
||||||
qDebug() << " Room ID | " << room->roomId();
|
// qDebug() << " Room ID | " << room->roomId();
|
||||||
qDebug() << " Group RF Address | " << room->groupRfAddress();
|
// qDebug() << " Group RF Address | " << room->groupRfAddress();
|
||||||
qDebug() << "-------------------------|-------------------------";
|
// qDebug() << "-------------------------|-------------------------";
|
||||||
}
|
// }
|
||||||
|
|
||||||
// parse device list
|
// parse device list
|
||||||
int deviceCount = roomRawData.left(2).toInt(0,16);
|
int deviceCount = roomRawData.left(2).toInt(0,16);
|
||||||
QByteArray deviceRawData = roomRawData.right(roomRawData.length() - 2);
|
QByteArray deviceRawData = roomRawData.right(roomRawData.length() - 2);
|
||||||
|
|
||||||
|
// qDebug() << "-------------------------|-------------------------";
|
||||||
|
// qDebug() << "found " << deviceCount << "devices";
|
||||||
|
// qDebug() << "-------------------------|-------------------------";
|
||||||
|
|
||||||
for(int i = 0; i < deviceCount; i++){
|
for(int i = 0; i < deviceCount; i++){
|
||||||
MaxDevice* device = new MaxDevice(this);
|
int deviceType = deviceRawData.left(2).toInt(0,16);
|
||||||
device->setDeviceType(deviceRawData.left(2).toInt(0,16));
|
switch (deviceType) {
|
||||||
device->setRfAddress(deviceRawData.mid(2,6));
|
case MaxDevice::DeviceRadiatorThermostat:{
|
||||||
device->setSerialNumber(QByteArray::fromHex(deviceRawData.mid(8,20)));
|
RadiatorThermostat* device = new RadiatorThermostat(this);
|
||||||
int deviceNameLenght = deviceRawData.mid(28,2).toInt(0,16);
|
device->setDeviceType(deviceType);
|
||||||
device->setDeviceName(QByteArray::fromHex(deviceRawData.mid(30,deviceNameLenght*2)));
|
device->setRfAddress(deviceRawData.mid(2,6));
|
||||||
device->setRoomId(deviceRawData.mid(30 + deviceNameLenght*2,2).toInt(0,16));
|
device->setSerialNumber(QByteArray::fromHex(deviceRawData.mid(8,20)));
|
||||||
|
int deviceNameLenght = deviceRawData.mid(28,2).toInt(0,16);
|
||||||
|
device->setDeviceName(QByteArray::fromHex(deviceRawData.mid(30,deviceNameLenght*2)));
|
||||||
|
device->setRoomId(deviceRawData.mid(30 + deviceNameLenght*2,2).toInt(0,16));
|
||||||
|
deviceRawData = deviceRawData.right(deviceRawData.length() - (32 + deviceNameLenght*2));
|
||||||
|
|
||||||
deviceRawData = deviceRawData.right(deviceRawData.length() - (32 + deviceNameLenght*2));
|
// set room data for each device
|
||||||
m_deviceList.append(device);
|
foreach (Room * room, m_roomList) {
|
||||||
}
|
if(device->roomId() == room->roomId()){
|
||||||
|
device->setRoomName(room->roomName());
|
||||||
qDebug() << "-------------------------|-------------------------";
|
}
|
||||||
qDebug() << "found " << m_deviceList.count() << "devices";
|
|
||||||
qDebug() << "-------------------------|-------------------------";
|
|
||||||
|
|
||||||
foreach (MaxDevice *device, m_deviceList) {
|
|
||||||
qDebug() << " Device Name | " << device->deviceName();
|
|
||||||
qDebug() << " Serial Number| " << device->serialNumber();
|
|
||||||
qDebug() << " Device Type String | " << device->deviceTypeString();
|
|
||||||
qDebug() << " RF address (hex) | " << device->rfAddress();
|
|
||||||
qDebug() << " Room ID | " << device->roomId();
|
|
||||||
qDebug() << "-------------------------|-------------------------";
|
|
||||||
}
|
|
||||||
|
|
||||||
// set room data for each device
|
|
||||||
foreach (MaxDevice *device, m_deviceList) {
|
|
||||||
foreach (Room * room, m_roomList) {
|
|
||||||
if(device->roomId() == room->roomId()){
|
|
||||||
device->setRoomName(room->roomName());
|
|
||||||
}
|
}
|
||||||
|
m_radiatorThermostatList.append(device);
|
||||||
|
|
||||||
|
// qDebug() << " Device Name | " << device->deviceName();
|
||||||
|
// qDebug() << " Serial Number| " << device->serialNumber();
|
||||||
|
// qDebug() << " Device Type String | " << device->deviceTypeString();
|
||||||
|
// qDebug() << " RF address (hex) | " << device->rfAddress();
|
||||||
|
// qDebug() << " Room ID | " << device->roomId();
|
||||||
|
// qDebug() << " Room Name | " << device->roomName();
|
||||||
|
// qDebug() << "-------------------------|-------------------------";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MaxDevice::DeviceWallThermostat:{
|
||||||
|
WallThermostat* device = new WallThermostat(this);
|
||||||
|
device->setDeviceType(deviceType);
|
||||||
|
device->setRfAddress(deviceRawData.mid(2,6));
|
||||||
|
device->setSerialNumber(QByteArray::fromHex(deviceRawData.mid(8,20)));
|
||||||
|
int deviceNameLenght = deviceRawData.mid(28,2).toInt(0,16);
|
||||||
|
device->setDeviceName(QByteArray::fromHex(deviceRawData.mid(30,deviceNameLenght*2)));
|
||||||
|
device->setRoomId(deviceRawData.mid(30 + deviceNameLenght*2,2).toInt(0,16));
|
||||||
|
deviceRawData = deviceRawData.right(deviceRawData.length() - (32 + deviceNameLenght*2));
|
||||||
|
|
||||||
|
// set room data for each device
|
||||||
|
foreach (Room * room, m_roomList) {
|
||||||
|
if(device->roomId() == room->roomId()){
|
||||||
|
device->setRoomName(room->roomName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_wallThermostatList.append(device);
|
||||||
|
|
||||||
|
// qDebug() << " Device Name | " << device->deviceName();
|
||||||
|
// qDebug() << " Serial Number| " << device->serialNumber();
|
||||||
|
// qDebug() << " Device Type String | " << device->deviceTypeString();
|
||||||
|
// qDebug() << " RF address (hex) | " << device->rfAddress();
|
||||||
|
// qDebug() << " Room ID | " << device->roomId();
|
||||||
|
// qDebug() << " Room Name | " << device->roomName();
|
||||||
|
// qDebug() << "-------------------------|-------------------------";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit deviceListReady(m_deviceList);
|
|
||||||
m_cubeInitialized = true;
|
m_cubeInitialized = true;
|
||||||
|
emit deviceListsReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaxCube::decodeConfigMessage(QByteArray data)
|
void MaxCube::decodeConfigMessage(QByteArray data)
|
||||||
@ -253,7 +267,7 @@ void MaxCube::decodeConfigMessage(QByteArray data)
|
|||||||
}
|
}
|
||||||
QByteArray rfAddress = list.at(0);
|
QByteArray rfAddress = list.at(0);
|
||||||
QByteArray dataRaw = QByteArray::fromBase64(list.at(1)).toHex();
|
QByteArray dataRaw = QByteArray::fromBase64(list.at(1)).toHex();
|
||||||
int lengthData = dataRaw.left(2).toInt(0,16);
|
//int lengthData = dataRaw.left(2).toInt(0,16);
|
||||||
if(rfAddress != dataRaw.mid(2,6)){
|
if(rfAddress != dataRaw.mid(2,6)){
|
||||||
qDebug() << "ERROR: rf addresses not equal!";
|
qDebug() << "ERROR: rf addresses not equal!";
|
||||||
}
|
}
|
||||||
@ -261,88 +275,95 @@ void MaxCube::decodeConfigMessage(QByteArray data)
|
|||||||
//QByteArray unknown = dataRaw.mid(12,6);
|
//QByteArray unknown = dataRaw.mid(12,6);
|
||||||
|
|
||||||
QByteArray serialNumber = QByteArray::fromHex(dataRaw.mid(16,20));
|
QByteArray serialNumber = QByteArray::fromHex(dataRaw.mid(16,20));
|
||||||
qDebug() << "====================================================";
|
// qDebug() << "====================================================";
|
||||||
qDebug() << " CONFIG message:";
|
// qDebug() << " CONFIG message:";
|
||||||
qDebug() << "====================================================";
|
// qDebug() << "====================================================";
|
||||||
qDebug() << " Serial Number | " << serialNumber;
|
// qDebug() << " Serial Number | " << serialNumber;
|
||||||
qDebug() << " device Type | " << deviceTypeString(deviceType);
|
// qDebug() << " device Type | " << deviceTypeString(deviceType);
|
||||||
qDebug() << " RF address (hex) | " << rfAddress;
|
// qDebug() << " RF address (hex) | " << rfAddress;
|
||||||
qDebug() << " data length | " << lengthData;
|
// qDebug() << " data length | " << lengthData;
|
||||||
qDebug() << "-------------------------|-------------------------";
|
// qDebug() << "-------------------------|-------------------------";
|
||||||
|
|
||||||
switch (deviceType) {
|
switch (deviceType) {
|
||||||
case MaxDevice::DeviceCube:{
|
case MaxDevice::DeviceCube:{
|
||||||
|
|
||||||
m_portalEnabeld = (bool)dataRaw.mid(36,2).toInt(0,16);
|
m_portalEnabeld = (bool)dataRaw.mid(36,2).toInt(0,16);
|
||||||
|
|
||||||
qDebug() << " portal enabled | " << m_portalEnabeld;
|
// qDebug() << " portal enabled | " << m_portalEnabeld;
|
||||||
qDebug() << " portal URL | " << QString(QByteArray::fromHex(dataRaw.mid(170,68)));
|
// qDebug() << " portal URL | " << QString(QByteArray::fromHex(dataRaw.mid(170,68)));
|
||||||
qDebug() << " time zone | " << QString(QByteArray::fromHex(dataRaw.mid(428,6)));
|
// qDebug() << " time zone | " << QString(QByteArray::fromHex(dataRaw.mid(428,6)));
|
||||||
qDebug() << " summer/winter time | " << QString(QByteArray::fromHex(dataRaw.mid(452,8)));
|
// qDebug() << " summer/winter time | " << QString(QByteArray::fromHex(dataRaw.mid(452,8)));
|
||||||
|
emit cubeConfigReady();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MaxDevice::DeviceRadiatorThermostat:{
|
case MaxDevice::DeviceRadiatorThermostat:{
|
||||||
int roomId = dataRaw.mid(10,2).toInt(0,16);
|
foreach (RadiatorThermostat* device, m_radiatorThermostatList) {
|
||||||
int firmware = dataRaw.mid(12,2).toInt(0,16);
|
if(device->rfAddress() == rfAddress){
|
||||||
double confortTemp = (double)dataRaw.mid(36,2).toInt(0,16) / 2.0;
|
|
||||||
double ecoTemp = (double)dataRaw.mid(38,2).toInt(0,16) / 2.0;
|
|
||||||
double maxSetPointTemp = (double)dataRaw.mid(40,2).toInt(0,16) / 2.0;
|
|
||||||
double minSetPointTemp = (double)dataRaw.mid(42,2).toInt(0,16) / 2.0;
|
|
||||||
double offsetTemp = (double)(dataRaw.mid(44,2).toInt(0,16) / 2.0 ) - 3.5;
|
|
||||||
double windowOpenTemp = (double)dataRaw.mid(46,2).toInt(0,16)/2.0;
|
|
||||||
int windowOpenDuration = dataRaw.mid(48,2).toInt(0,16);
|
|
||||||
// boost code
|
|
||||||
QByteArray boostDurationCode = fillBin(QByteArray::number(dataRaw.mid(50,2).toInt(0,16),2),8);
|
|
||||||
int boostDuration = boostDurationCode.left(3).toInt(0,2) * 5;
|
|
||||||
int valveValue = boostDurationCode.right(5).toInt(0,2) * 5;
|
|
||||||
|
|
||||||
// day of week an time
|
//int roomId = dataRaw.mid(10,2).toInt(0,16);
|
||||||
QByteArray dowTime = fillBin(QByteArray::number(dataRaw.mid(52,2).toInt(0,16),2),8);
|
//int firmware = dataRaw.mid(12,2).toInt(0,16);
|
||||||
QString weekDay = weekDayString(dowTime.left(3).toInt(0,2));
|
device->setConfortTemp((double)dataRaw.mid(36,2).toInt(0,16) / 2.0);
|
||||||
QTime time = QTime(dowTime.right(5).toInt(0,2),0);
|
device->setEcoTemp((double)dataRaw.mid(38,2).toInt(0,16) / 2.0);
|
||||||
|
device->setMaxSetPointTemp((double)dataRaw.mid(40,2).toInt(0,16) / 2.0);
|
||||||
|
device->setMinSetPointTemp((double)dataRaw.mid(42,2).toInt(0,16) / 2.0);
|
||||||
|
device->setOffsetTemp((double)(dataRaw.mid(44,2).toInt(0,16) / 2.0 ) - 3.5);
|
||||||
|
device->setWindowOpenTemp((double)dataRaw.mid(46,2).toInt(0,16)/2.0);
|
||||||
|
device->setWindowOpenDuration(dataRaw.mid(48,2).toInt(0,16));
|
||||||
|
// boost code
|
||||||
|
QByteArray boostDurationCode = fillBin(QByteArray::number(dataRaw.mid(50,2).toInt(0,16),2),8);
|
||||||
|
device->setBoostDuration(boostDurationCode.left(3).toInt(0,2) * 5);
|
||||||
|
device->setBoostValveValue(boostDurationCode.right(5).toInt(0,2) * 5);
|
||||||
|
|
||||||
double valveMaximumSettings = (double)dataRaw.mid(54,2).toInt(0,16)*(double)100.0/255.0;
|
// day of week an time
|
||||||
double valveOffset = (double)dataRaw.mid(56,2).toInt(0,16)*100.0/255.0;
|
QByteArray dowTime = fillBin(QByteArray::number(dataRaw.mid(52,2).toInt(0,16),2),8);
|
||||||
|
device->setDiscalcingWeekDay(weekDayString(dowTime.left(3).toInt(0,2)));
|
||||||
|
device->setDiscalcingTime(QTime(dowTime.right(5).toInt(0,2),0));
|
||||||
|
|
||||||
qDebug() << " Room ID | " << roomId;
|
device->setValveMaximumSettings((double)dataRaw.mid(54,2).toInt(0,16)*(double)100.0/255.0);
|
||||||
qDebug() << " firmware | " << firmware;
|
device->setValveOffset((double)dataRaw.mid(56,2).toInt(0,16)*100.0/255.0);
|
||||||
qDebug() << " Confort Temp. | " << confortTemp << "C";
|
|
||||||
qDebug() << " Eco Temp. | " << ecoTemp << "C";
|
|
||||||
qDebug() << " Max. Set Point Temp. | " << maxSetPointTemp << "C";
|
|
||||||
qDebug() << " Min. Set Point Temp. | " << minSetPointTemp << "C";
|
|
||||||
qDebug() << " Temp. Offset | " << offsetTemp << "C";
|
|
||||||
qDebug() << " Window Open Temp. | " << windowOpenTemp << "C";
|
|
||||||
qDebug() << " Window Open Duration | " << windowOpenDuration << "min";
|
|
||||||
qDebug() << " Boost code | " << boostDurationCode;
|
|
||||||
qDebug() << " Boost Duration | " << boostDuration << "min";
|
|
||||||
qDebug() << " Valve value | " << valveValue << "%";
|
|
||||||
qDebug() << " dow code | " << dowTime;
|
|
||||||
qDebug() << " disclaiming run day | " << weekDay;
|
|
||||||
qDebug() << " disclaiming run time | " << time.toString("HH:mm");
|
|
||||||
qDebug() << " Valve Maximum Settings | " << valveMaximumSettings << "%";
|
|
||||||
qDebug() << " Valve Offset | " << valveOffset << "%";
|
|
||||||
parseWeeklyProgram(dataRaw.right(dataRaw.length() - 58));
|
|
||||||
|
|
||||||
|
// qDebug() << " Room ID | " << device->roomId();
|
||||||
|
// qDebug() << " firmware | " << firmware;
|
||||||
|
// qDebug() << " Confort Temp. | " << device->confortTemp() << "C";
|
||||||
|
// qDebug() << " Eco Temp. | " << device->ecoTemp() << "C";
|
||||||
|
// qDebug() << " Max. Set Point Temp. | " << device->maxSetPointTemp() << "C";
|
||||||
|
// qDebug() << " Min. Set Point Temp. | " << device->minSetPointTemp() << "C";
|
||||||
|
// qDebug() << " Temp. Offset | " << device->offsetTemp() << "C";
|
||||||
|
// qDebug() << " Window Open Temp. | " << device->windowOpenTemp() << "C";
|
||||||
|
// qDebug() << " Window Open Duration | " << device->windowOpenDuration() << "min";
|
||||||
|
// qDebug() << " Boost Duration | " << device->boostDuration() << "min";
|
||||||
|
// qDebug() << " Valve value | " << device->boostValveValue() << "%";
|
||||||
|
// qDebug() << " disclaiming run day | " << device->discalcingWeekDay();
|
||||||
|
// qDebug() << " disclaiming run time | " << device->discalcingTime().toString("HH:mm");
|
||||||
|
// qDebug() << " Valve Maximum Settings | " << device->valveMaximumSettings() << "%";
|
||||||
|
// qDebug() << " Valve Offset | " << device->valveOffset() << "%";
|
||||||
|
parseWeeklyProgram(dataRaw.right(dataRaw.length() - 58));
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MaxDevice::DeviceRadiatorThermostatPlus:
|
case MaxDevice::DeviceRadiatorThermostatPlus:
|
||||||
break;
|
break;
|
||||||
case MaxDevice::DeviceWallThermostat:{
|
case MaxDevice::DeviceWallThermostat:{
|
||||||
int roomId = dataRaw.mid(10,2).toInt(0,16);
|
foreach (WallThermostat* device, m_wallThermostatList) {
|
||||||
int firmware = dataRaw.mid(12,2).toInt(0,16);
|
if(device->rfAddress() == rfAddress){
|
||||||
double confortTemp = (double)dataRaw.mid(36,2).toInt(0,16) / 2.0;
|
//int roomId = dataRaw.mid(10,2).toInt(0,16);
|
||||||
double ecoTemp = (double)dataRaw.mid(38,2).toInt(0,16)/2.0;
|
//int firmware = dataRaw.mid(12,2).toInt(0,16);
|
||||||
double maxSetPointTemp = (double)dataRaw.mid(40,2).toInt(0,16)/2.0;
|
device->setConfortTemp((double)dataRaw.mid(36,2).toInt(0,16) / 2.0);
|
||||||
double minSetPointTemp = (double)dataRaw.mid(42,2).toInt(0,16)/2.0;
|
device->setEcoTemp((double)dataRaw.mid(38,2).toInt(0,16)/2.0);
|
||||||
|
device->setMaxSetPointTemp((double)dataRaw.mid(40,2).toInt(0,16)/2.0);
|
||||||
|
device->setMinSetPointTemp((double)dataRaw.mid(42,2).toInt(0,16)/2.0);
|
||||||
|
|
||||||
qDebug() << " Room ID | " << roomId;
|
// qDebug() << " Room ID | " << device->roomId();
|
||||||
qDebug() << " firmware | " << firmware;
|
// qDebug() << " firmware | " << firmware;
|
||||||
qDebug() << " Confort Temp. | " << confortTemp;
|
// qDebug() << " Confort Temp. | " << device->confortTemp();
|
||||||
qDebug() << " Eco Temp. | " << ecoTemp;
|
// qDebug() << " Eco Temp. | " << device->ecoTemp();
|
||||||
qDebug() << " Max. Set Point Temp. | " << maxSetPointTemp;
|
// qDebug() << " Max. Set Point Temp. | " << device->maxSetPointTemp();
|
||||||
qDebug() << " Min. Set Point Temp. | " << minSetPointTemp;
|
// qDebug() << " Min. Set Point Temp. | " << device->minSetPointTemp();
|
||||||
|
|
||||||
parseWeeklyProgram(dataRaw.right(dataRaw.length() - 44));
|
parseWeeklyProgram(dataRaw.right(dataRaw.length() - 44));
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MaxDevice::DeviceEcoButton:
|
case MaxDevice::DeviceEcoButton:
|
||||||
@ -357,136 +378,121 @@ void MaxCube::decodeConfigMessage(QByteArray data)
|
|||||||
|
|
||||||
void MaxCube::decodeDevicelistMessage(QByteArray data)
|
void MaxCube::decodeDevicelistMessage(QByteArray data)
|
||||||
{
|
{
|
||||||
qDebug() << "====================================================";
|
// qDebug() << "====================================================";
|
||||||
qDebug() << " LIVE message:";
|
// qDebug() << " LIVE message:";
|
||||||
qDebug() << "====================================================";
|
// qDebug() << "====================================================";
|
||||||
//qDebug() << data;
|
|
||||||
QByteArray rawDataAll = QByteArray::fromBase64(data).toHex();
|
|
||||||
qDebug() << rawDataAll;
|
|
||||||
|
|
||||||
|
QByteArray rawDataAll = QByteArray::fromBase64(data).toHex();
|
||||||
QList<QByteArray> deviceMessageList = splitMessage(rawDataAll);
|
QList<QByteArray> deviceMessageList = splitMessage(rawDataAll);
|
||||||
|
|
||||||
foreach (QByteArray rawData, deviceMessageList) {
|
foreach (QByteArray rawData, deviceMessageList) {
|
||||||
|
|
||||||
LiveMessage message;
|
QByteArray rfAddress = rawData.mid(0,6);
|
||||||
message.setRfAddress(rawData.mid(0,6));
|
int deviceType = deviceTypeFromRFAddress(rfAddress);
|
||||||
|
|
||||||
MaxDevice *device = getDeviceTypeFromRFAddress(message.rfAddress());
|
switch (deviceType) {
|
||||||
|
|
||||||
switch (device->deviceType()) {
|
|
||||||
case MaxDevice::DeviceWallThermostat:{
|
case MaxDevice::DeviceWallThermostat:{
|
||||||
QByteArray unknown = rawData.mid(6,2);
|
foreach (WallThermostat* device, m_wallThermostatList) {
|
||||||
|
if(device->rfAddress() == rfAddress){
|
||||||
|
|
||||||
QByteArray initCode = fillBin(QByteArray::number(rawData.mid(8,2).toInt(0,16),2),8);
|
// init/valid code
|
||||||
message.setInformationValid((bool)initCode.mid(3,1).toInt());
|
QByteArray initCode = fillBin(QByteArray::number(rawData.mid(8,2).toInt(0,16),2),8);
|
||||||
message.setErrorOccured((bool)initCode.mid(4,1).toInt());
|
device->setInformationValid((bool)initCode.mid(3,1).toInt());
|
||||||
message.setIsAnswereToCommand((bool)initCode.mid(5,1).toInt());
|
device->setErrorOccured((bool)initCode.mid(4,1).toInt());
|
||||||
message.setInitialized((bool)initCode.mid(6,1).toInt());
|
device->setIsAnswereToCommand((bool)initCode.mid(5,1).toInt());
|
||||||
|
device->setInitialized((bool)initCode.mid(6,1).toInt());
|
||||||
|
|
||||||
QByteArray statusCode = fillBin(QByteArray::number(rawData.mid(10,2).toInt(0,16),2),8);
|
// status code
|
||||||
message.setBatteryLow((bool)statusCode.mid(0,1).toInt());
|
QByteArray statusCode = fillBin(QByteArray::number(rawData.mid(10,2).toInt(0,16),2),8);
|
||||||
message.setLinkStatusOK(!(bool)statusCode.mid(1,1).toInt());
|
device->setBatteryLow((bool)statusCode.mid(0,1).toInt());
|
||||||
message.setPanelLocked((bool)statusCode.mid(2,1).toInt());
|
device->setLinkStatusOK(!(bool)statusCode.mid(1,1).toInt());
|
||||||
message.setGatewayKnown((bool)statusCode.mid(3,1).toInt());
|
device->setPanelLocked((bool)statusCode.mid(2,1).toInt());
|
||||||
message.setDtsActive((bool)statusCode.mid(4,1).toInt());
|
device->setGatewayKnown((bool)statusCode.mid(3,1).toInt());
|
||||||
message.setDeviceMode(statusCode.right(2).toInt(0,2));
|
device->setDtsActive((bool)statusCode.mid(4,1).toInt());
|
||||||
|
device->setDeviceMode(statusCode.right(2).toInt(0,2));
|
||||||
|
|
||||||
message.setValvePosition((double)rawData.mid(12,2).toInt(0,16));
|
// calculate current temperature and setpoint temperature
|
||||||
|
QByteArray tempCode = fillBin(QByteArray::number(rawData.mid(14,2).toInt(0,16),2),8);
|
||||||
|
device->setSetpointTemperatre((double)tempCode.right(6).toInt(0,2) / 2.0);
|
||||||
|
if(tempCode.left(2) == "10"){
|
||||||
|
device->setCurrentTemperatre(((double)rawData.right(2).toInt(0,16) / 10.0) + 25.6);
|
||||||
|
}else{
|
||||||
|
device->setCurrentTemperatre((double)rawData.right(2).toInt(0,16) / 10.0);
|
||||||
|
}
|
||||||
|
|
||||||
// calculate current temperature and setpoint temperature
|
// qDebug() << " raw data | " << rawData;
|
||||||
// 00 00 00 00
|
// qDebug() << " device type | " << device->deviceTypeString();
|
||||||
// 10
|
// qDebug() << " device name | " << device->deviceName();
|
||||||
QByteArray tempCode = fillBin(QByteArray::number(rawData.mid(14,2).toInt(0,16),2),8);
|
// qDebug() << " RF address (hex) | " << device->rfAddress();
|
||||||
message.setSetpointTemperatre((double)tempCode.right(6).toInt(0,2) / 2.0);
|
// qDebug() << " initCode | " << initCode;
|
||||||
double currentTemperature;
|
// qDebug() << " information valid | " << device->informationValid();
|
||||||
if(tempCode.left(2) == "10"){
|
// qDebug() << " error occured | " << device->errorOccured();
|
||||||
currentTemperature = ((double)rawData.right(2).toInt(0,16) / 10.0) + 25.6;
|
// qDebug() << " is answere to a command | " << device->isAnswereToCommand();
|
||||||
}else{
|
// qDebug() << " initialized | " << device->initialized();
|
||||||
currentTemperature = (double)rawData.right(2).toInt(0,16) / 10.0;
|
// qDebug() << " battery low | " << device->batteryLow();
|
||||||
|
// qDebug() << " link status OK | " << device->linkStatusOK();
|
||||||
|
// qDebug() << " panel locked | " << device->panelLocked();
|
||||||
|
// qDebug() << " gateway known | " << device->gatewayKnown();
|
||||||
|
// qDebug() << " DST settings active | " << device->dtsActive();
|
||||||
|
// qDebug() << " device mode | " << device->deviceModeString();
|
||||||
|
// qDebug() << " Temperatur Setpoint | " << device->setpointTemperature();
|
||||||
|
// qDebug() << " Current Temp | " << device->currentTemperature();
|
||||||
|
// qDebug() << "-------------------------|-------------------------";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << " raw data | " << rawData;
|
|
||||||
qDebug() << " device type | " << device->deviceTypeString();
|
|
||||||
qDebug() << " device name | " << device->deviceName();
|
|
||||||
qDebug() << " RF address (hex) | " << message.rfAddress();
|
|
||||||
qDebug() << " unknown | " << unknown;
|
|
||||||
qDebug() << " initCode | " << initCode;
|
|
||||||
qDebug() << " information valid | " << message.informationValid();
|
|
||||||
qDebug() << " error occured | " << message.errorOccured();
|
|
||||||
qDebug() << " is answere to a command | " << message.isAnswereToCommand();
|
|
||||||
qDebug() << " initialized | " << message.initialized();
|
|
||||||
qDebug() << " statusCode | " << statusCode;
|
|
||||||
qDebug() << " battery low | " << message.batteryLow();
|
|
||||||
qDebug() << " link status OK | " << message.linkStatusOK();
|
|
||||||
qDebug() << " panel locked | " << message.panelLocked();
|
|
||||||
qDebug() << " gateway known | " << message.gatewayKnown();
|
|
||||||
qDebug() << " DST settings active | " << message.dtsActive();
|
|
||||||
qDebug() << " device mode | " << message.deviceModeString();
|
|
||||||
qDebug() << " temp Code | " << tempCode;
|
|
||||||
qDebug() << " Temperatur Setpoint | " << message.setpointTemperature();
|
|
||||||
qDebug() << " Current Temp | " << currentTemperature;
|
|
||||||
qDebug() << " unknown | " << rawData.right(rawData.length() - 12);
|
|
||||||
qDebug() << "-------------------------|-------------------------";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
emit liveMessageReady(message);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MaxDevice::DeviceRadiatorThermostat:{
|
case MaxDevice::DeviceRadiatorThermostat:{
|
||||||
QByteArray unknown = rawData.mid(6,2);
|
foreach (RadiatorThermostat* device, m_radiatorThermostatList) {
|
||||||
|
if(device->rfAddress() == rfAddress){
|
||||||
|
|
||||||
QByteArray initCode = fillBin(QByteArray::number(rawData.mid(8,2).toInt(0,16),2),8);
|
QByteArray initCode = fillBin(QByteArray::number(rawData.mid(8,2).toInt(0,16),2),8);
|
||||||
message.setInformationValid((bool)initCode.mid(3,1).toInt());
|
device->setInformationValid((bool)initCode.mid(3,1).toInt());
|
||||||
message.setErrorOccured((bool)initCode.mid(4,1).toInt());
|
device->setErrorOccured((bool)initCode.mid(4,1).toInt());
|
||||||
message.setIsAnswereToCommand((bool)initCode.mid(5,1).toInt());
|
device->setIsAnswereToCommand((bool)initCode.mid(5,1).toInt());
|
||||||
message.setInitialized((bool)initCode.mid(6,1).toInt());
|
device->setInitialized((bool)initCode.mid(6,1).toInt());
|
||||||
|
|
||||||
QByteArray statusCode = fillBin(QByteArray::number(rawData.mid(10,2).toInt(0,16),2),8);
|
QByteArray statusCode = fillBin(QByteArray::number(rawData.mid(10,2).toInt(0,16),2),8);
|
||||||
message.setBatteryLow((bool)statusCode.mid(0,1).toInt());
|
device->setBatteryLow((bool)statusCode.mid(0,1).toInt());
|
||||||
message.setLinkStatusOK(!(bool)statusCode.mid(1,1).toInt());
|
device->setLinkStatusOK(!(bool)statusCode.mid(1,1).toInt());
|
||||||
message.setPanelLocked((bool)statusCode.mid(2,1).toInt());
|
device->setPanelLocked((bool)statusCode.mid(2,1).toInt());
|
||||||
message.setGatewayKnown((bool)statusCode.mid(3,1).toInt());
|
device->setGatewayKnown((bool)statusCode.mid(3,1).toInt());
|
||||||
message.setDtsActive((bool)statusCode.mid(4,1).toInt());
|
device->setDtsActive((bool)statusCode.mid(4,1).toInt());
|
||||||
message.setDeviceMode(statusCode.right(2).toInt(0,2));
|
device->setDeviceMode(statusCode.right(2).toInt(0,2));
|
||||||
|
|
||||||
message.setValvePosition((double)rawData.mid(12,2).toInt(0,16));
|
device->setValvePosition((double)rawData.mid(12,2).toInt(0,16));
|
||||||
message.setSetpointTemperatre((double)rawData.mid(14,2).toInt(0,16)/ 2.0);
|
device->setSetpointTemperatre((double)rawData.mid(14,2).toInt(0,16)/ 2.0);
|
||||||
message.setDateTime(calculateDateTime(rawData.mid(18,4), rawData.mid(22,2)));
|
|
||||||
|
|
||||||
qDebug() << " raw data | " << rawData;
|
// qDebug() << " device type | " << device->deviceTypeString();
|
||||||
qDebug() << " device type | " << device->deviceTypeString();
|
// qDebug() << " device name | " << device->deviceName();
|
||||||
qDebug() << " device name | " << device->deviceName();
|
// qDebug() << " RF address (hex) | " << device->rfAddress();
|
||||||
qDebug() << " RF address (hex) | " << message.rfAddress();
|
// qDebug() << " information valid | " << device->informationValid();
|
||||||
qDebug() << " unknown | " << unknown;
|
// qDebug() << " error occured | " << device->errorOccured();
|
||||||
qDebug() << " information valid | " << message.informationValid();
|
// qDebug() << " is answere to a command | " << device->isAnswereToCommand();
|
||||||
qDebug() << " error occured | " << message.errorOccured();
|
// qDebug() << " initialized | " << device->initialized();
|
||||||
qDebug() << " is answere to a command | " << message.isAnswereToCommand();
|
// qDebug() << " battery low | " << device->batteryLow();
|
||||||
qDebug() << " initialized | " << message.initialized();
|
// qDebug() << " link status OK | " << device->linkStatusOK();
|
||||||
qDebug() << " battery low | " << message.batteryLow();
|
// qDebug() << " panel locked | " << device->panelLocked();
|
||||||
qDebug() << " link status OK | " << message.linkStatusOK();
|
// qDebug() << " gateway known | " << device->gatewayKnown();
|
||||||
qDebug() << " panel locked | " << message.panelLocked();
|
// qDebug() << " DST settings active | " << device->dtsActive();
|
||||||
qDebug() << " gateway known | " << message.gatewayKnown();
|
// qDebug() << " device mode | " << device->deviceModeString();
|
||||||
qDebug() << " DST settings active | " << message.dtsActive();
|
// qDebug() << " valve position | " << device->valvePosition() << "%";
|
||||||
qDebug() << " device mode | " << message.deviceModeString();
|
// qDebug() << " Temperatur Setpoint | " << device->setpointTemperature() << " deg C";
|
||||||
qDebug() << " valve position | " << message.valvePosition() << "%";
|
// qDebug() << "-------------------------|-------------------------";
|
||||||
qDebug() << " Temperatur Setpoint | " << message.setpointTemperature() << " deg C";
|
}
|
||||||
qDebug() << " unknown | " << rawData.right(rawData.length() - 12);
|
}
|
||||||
qDebug() << "-------------------------|-------------------------";
|
|
||||||
|
|
||||||
emit liveMessageReady(message);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MaxDevice::DeviceWindowContact:{
|
case MaxDevice::DeviceWindowContact:{
|
||||||
QByteArray windowOpenRawData = fillBin(QByteArray::number(rawData.mid(10,2).toInt(0,16),2),8);
|
QByteArray windowOpenRawData = fillBin(QByteArray::number(rawData.mid(10,2).toInt(0,16),2),8);
|
||||||
bool windowOpen = (bool)windowOpenRawData.mid(5,1).toInt();
|
//bool windowOpen = (bool)windowOpenRawData.mid(5,1).toInt();
|
||||||
|
|
||||||
qDebug() << " raw data | " << rawData;
|
// qDebug() << " raw data | " << rawData;
|
||||||
qDebug() << " device type | " << device->deviceTypeString();
|
// qDebug() << " device type name | " << "Window Contact";
|
||||||
qDebug() << " device name | " << device->deviceName();
|
// qDebug() << " RF address (hex) | " << rfAddress;
|
||||||
qDebug() << " RF address (hex) | " << message.rfAddress();
|
// qDebug() << " window open code | " << windowOpenRawData;
|
||||||
qDebug() << " window open code | " << windowOpenRawData;
|
// qDebug() << " window open | " << windowOpen;
|
||||||
qDebug() << " window open | " << windowOpen;
|
// qDebug() << "-------------------------|-------------------------";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -502,18 +508,16 @@ void MaxCube::parseWeeklyProgram(QByteArray data)
|
|||||||
//qDebug() << weekDayString(i);
|
//qDebug() << weekDayString(i);
|
||||||
for(int i = 0; i < 52; i+=4){
|
for(int i = 0; i < 52; i+=4){
|
||||||
QByteArray element = fillBin(QByteArray::number(dayData.mid(i,4).toInt(0,16),2),16);
|
QByteArray element = fillBin(QByteArray::number(dayData.mid(i,4).toInt(0,16),2),16);
|
||||||
int minutes = element.right(9).toInt(0,2) * 5;
|
//int minutes = element.right(9).toInt(0,2) * 5;
|
||||||
int hours = (minutes / 60) % 24;
|
//int hours = (minutes / 60) % 24;
|
||||||
minutes = minutes % 60;
|
//minutes = minutes % 60;
|
||||||
QTime time = QTime(hours,minutes);
|
//QTime time = QTime(hours,minutes);
|
||||||
//qDebug() << (double)element.left(7).toInt(0,2) / 2 << "\t" << "deg. until" << "\t" << time.toString("HH:mm");
|
//qDebug() << (double)element.left(7).toInt(0,2) / 2 << "\t" << "deg. until" << "\t" << time.toString("HH:mm");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
data = data.right(data.length() - 52);
|
data = data.right(data.length() - 52);
|
||||||
}
|
}
|
||||||
if(!data.isEmpty()){
|
if(!data.isEmpty()){
|
||||||
qDebug() << " ? | " << data;
|
//qDebug() << " ? | " << data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,10 +527,10 @@ void MaxCube::decodeNewDeviceFoundMessage(QByteArray data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "====================================================";
|
// qDebug() << "====================================================";
|
||||||
qDebug() << " NEW DEVICE message:";
|
// qDebug() << " NEW DEVICE message:";
|
||||||
qDebug() << "====================================================";
|
// qDebug() << "====================================================";
|
||||||
qDebug() << " Serial Number | " << QByteArray::fromBase64(data);
|
// qDebug() << " Serial Number | " << QByteArray::fromBase64(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,31 +627,41 @@ QList<QByteArray> MaxCube::splitMessage(QByteArray data)
|
|||||||
messageList.append(data.mid(2,length));
|
messageList.append(data.mid(2,length));
|
||||||
data = data.right(data.length() - (length+2));
|
data = data.right(data.length() - (length+2));
|
||||||
}
|
}
|
||||||
qDebug() << messageList;
|
//qDebug() << messageList;
|
||||||
return messageList;
|
return messageList;
|
||||||
}
|
}
|
||||||
|
|
||||||
MaxDevice *MaxCube::getDeviceTypeFromRFAddress(QByteArray rfAddress)
|
int MaxCube::deviceTypeFromRFAddress(QByteArray rfAddress)
|
||||||
{
|
{
|
||||||
foreach (MaxDevice *device, m_deviceList){
|
foreach (WallThermostat* device, m_wallThermostatList) {
|
||||||
if(device->rfAddress() == rfAddress){
|
if(device->rfAddress() == rfAddress){
|
||||||
return device;
|
return device->deviceType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
|
||||||
|
foreach (RadiatorThermostat* device, m_radiatorThermostatList) {
|
||||||
|
if(device->rfAddress() == rfAddress){
|
||||||
|
return device->deviceType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaxCube::connected()
|
void MaxCube::connectionStateChanged(const QAbstractSocket::SocketState &socketState)
|
||||||
{
|
{
|
||||||
qDebug() << "-> connected to cube " << m_serialNumber << m_hostAddress.toString();
|
switch (socketState) {
|
||||||
emit cubeConnectionStatusChanged(true);
|
case QAbstractSocket::ConnectedState:
|
||||||
}
|
qDebug() << "-> connected to cube " << m_serialNumber << m_hostAddress.toString();
|
||||||
|
emit cubeConnectionStatusChanged(true);
|
||||||
void MaxCube::disconnected()
|
break;
|
||||||
{
|
case QAbstractSocket::UnconnectedState:
|
||||||
m_cubeInitialized = false;
|
m_cubeInitialized = false;
|
||||||
qDebug() << "-> disconnected from cube " << m_serialNumber << m_hostAddress.toString();
|
qDebug() << "-> disconnected from cube " << m_serialNumber << m_hostAddress.toString();
|
||||||
emit cubeConnectionStatusChanged(false);
|
emit cubeConnectionStatusChanged(false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaxCube::error(QAbstractSocket::SocketError error)
|
void MaxCube::error(QAbstractSocket::SocketError error)
|
||||||
|
|||||||
@ -26,7 +26,8 @@
|
|||||||
|
|
||||||
#include "maxdevice.h"
|
#include "maxdevice.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
#include "livemessage.h"
|
#include "wallthermostat.h"
|
||||||
|
#include "radiatorthermostat.h"
|
||||||
|
|
||||||
class MaxCube : public QTcpSocket
|
class MaxCube : public QTcpSocket
|
||||||
{
|
{
|
||||||
@ -60,18 +61,14 @@ public:
|
|||||||
quint16 port() const;
|
quint16 port() const;
|
||||||
void setPort(const quint16 &port);
|
void setPort(const quint16 &port);
|
||||||
|
|
||||||
QByteArray httpConnectionId() const;
|
|
||||||
void setHttpConnectionId(const QByteArray &httpConnectionId);
|
|
||||||
|
|
||||||
int freeMemorySlots() const;
|
|
||||||
void setFreeMemorySlots(const int &freeMemorySlots);
|
|
||||||
|
|
||||||
QDateTime cubeDateTime() const;
|
QDateTime cubeDateTime() const;
|
||||||
void setCubeDateTime(const QDateTime &cubeDateTime);
|
void setCubeDateTime(const QDateTime &cubeDateTime);
|
||||||
|
|
||||||
bool portalEnabeld() const;
|
bool portalEnabeld() const;
|
||||||
|
|
||||||
QList<MaxDevice*> deviceList();
|
QList<WallThermostat*> wallThermostatList();
|
||||||
|
QList<RadiatorThermostat*> radiatorThermostatList();
|
||||||
|
|
||||||
QList<Room*> roomList();
|
QList<Room*> roomList();
|
||||||
|
|
||||||
void connectToCube();
|
void connectToCube();
|
||||||
@ -86,13 +83,12 @@ private:
|
|||||||
int m_firmware;
|
int m_firmware;
|
||||||
QHostAddress m_hostAddress;
|
QHostAddress m_hostAddress;
|
||||||
quint16 m_port;
|
quint16 m_port;
|
||||||
QByteArray m_httpConnectionId;
|
|
||||||
int m_freeMemorySlots;
|
|
||||||
QDateTime m_cubeDateTime;
|
QDateTime m_cubeDateTime;
|
||||||
bool m_portalEnabeld;
|
bool m_portalEnabeld;
|
||||||
|
|
||||||
QList<Room*> m_roomList;
|
QList<Room*> m_roomList;
|
||||||
QList<MaxDevice*> m_deviceList;
|
QList<WallThermostat*> m_wallThermostatList;
|
||||||
|
QList<RadiatorThermostat*> m_radiatorThermostatList;
|
||||||
|
|
||||||
bool m_cubeInitialized;
|
bool m_cubeInitialized;
|
||||||
|
|
||||||
@ -109,18 +105,21 @@ private:
|
|||||||
|
|
||||||
QByteArray fillBin(QByteArray data, int dataLength);
|
QByteArray fillBin(QByteArray data, int dataLength);
|
||||||
QList<QByteArray> splitMessage(QByteArray data);
|
QList<QByteArray> splitMessage(QByteArray data);
|
||||||
MaxDevice *getDeviceTypeFromRFAddress(QByteArray rfAddress);
|
int deviceTypeFromRFAddress(QByteArray rfAddress);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void cubeDataAvailable(const QByteArray &data);
|
void cubeDataAvailable(const QByteArray &data);
|
||||||
void cubeACK();
|
void cubeACK();
|
||||||
void cubeConnectionStatusChanged(const bool &connected);
|
void cubeConnectionStatusChanged(const bool &connected);
|
||||||
void deviceListReady(QList<MaxDevice*> maxDeviceList);
|
|
||||||
void liveMessageReady(const LiveMessage &liveMessage);
|
// when things are parsed
|
||||||
|
void deviceListsReady();
|
||||||
|
void cubeConfigReady();
|
||||||
|
void wallThermostatConfigReady();
|
||||||
|
void radiatorThermostatConfigReady();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void connected();
|
void connectionStateChanged(const QAbstractSocket::SocketState &socketState);
|
||||||
void disconnected();
|
|
||||||
void error(QAbstractSocket::SocketError error);
|
void error(QAbstractSocket::SocketError error);
|
||||||
void readData();
|
void readData();
|
||||||
void processCubeData(const QByteArray &data);
|
void processCubeData(const QByteArray &data);
|
||||||
|
|||||||
@ -38,6 +38,13 @@ public:
|
|||||||
DeviceEcoButton = 5
|
DeviceEcoButton = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum DeviceMode{
|
||||||
|
Auto = 0,
|
||||||
|
Manual = 1,
|
||||||
|
Temporary = 2,
|
||||||
|
Boost = 3
|
||||||
|
};
|
||||||
|
|
||||||
int deviceType() const;
|
int deviceType() const;
|
||||||
void setDeviceType(const int &deviceType);
|
void setDeviceType(const int &deviceType);
|
||||||
|
|
||||||
|
|||||||
298
plugins/deviceplugins/eq-3/radiatorthermostat.cpp
Normal file
298
plugins/deviceplugins/eq-3/radiatorthermostat.cpp
Normal file
@ -0,0 +1,298 @@
|
|||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* This file is part of guh. *
|
||||||
|
* *
|
||||||
|
* Guh is free software: you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation, version 2 of the License. *
|
||||||
|
* *
|
||||||
|
* Guh is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with guh. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
* *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
#include "radiatorthermostat.h"
|
||||||
|
|
||||||
|
RadiatorThermostat::RadiatorThermostat(QObject *parent) :
|
||||||
|
MaxDevice(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
double RadiatorThermostat::confortTemp() const
|
||||||
|
{
|
||||||
|
return m_confortTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setConfortTemp(const double &confortTemp)
|
||||||
|
{
|
||||||
|
m_confortTemp = confortTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
double RadiatorThermostat::ecoTemp() const
|
||||||
|
{
|
||||||
|
return m_ecoTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setEcoTemp(const double &ecoTemp)
|
||||||
|
{
|
||||||
|
m_ecoTemp = ecoTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
double RadiatorThermostat::maxSetPointTemp() const
|
||||||
|
{
|
||||||
|
return m_maxSetPointTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setMaxSetPointTemp(const double &maxSetPointTemp)
|
||||||
|
{
|
||||||
|
m_maxSetPointTemp = maxSetPointTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
double RadiatorThermostat::minSetPointTemp() const
|
||||||
|
{
|
||||||
|
return m_minSetPointTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setMinSetPointTemp(const double &minSetPointTemp)
|
||||||
|
{
|
||||||
|
m_minSetPointTemp = minSetPointTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
double RadiatorThermostat::windowOpenTemp() const
|
||||||
|
{
|
||||||
|
return m_windowOpenTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setWindowOpenTemp(const double &windowOpenTemp)
|
||||||
|
{
|
||||||
|
m_windowOpenTemp = windowOpenTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
double RadiatorThermostat::offsetTemp() const
|
||||||
|
{
|
||||||
|
return m_offsetTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setOffsetTemp(const double &offsetTemp)
|
||||||
|
{
|
||||||
|
m_offsetTemp = offsetTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
int RadiatorThermostat::windowOpenDuration() const
|
||||||
|
{
|
||||||
|
return m_windowOpenDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setWindowOpenDuration(const int &windowOpenDuration)
|
||||||
|
{
|
||||||
|
m_windowOpenDuration = windowOpenDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
int RadiatorThermostat::boostDuration() const
|
||||||
|
{
|
||||||
|
return m_boostDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setBoostDuration(const int &boostDuration)
|
||||||
|
{
|
||||||
|
m_boostDuration = boostDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
int RadiatorThermostat::boostValveValue() const
|
||||||
|
{
|
||||||
|
return m_boostValveValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setBoostValveValue(const int &boostValveValue)
|
||||||
|
{
|
||||||
|
m_boostValveValue = boostValveValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString RadiatorThermostat::discalcingWeekDay() const
|
||||||
|
{
|
||||||
|
return m_discalcWeekDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setDiscalcingWeekDay(const QString &discalcingWeekDay)
|
||||||
|
{
|
||||||
|
m_discalcWeekDay = discalcingWeekDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTime RadiatorThermostat::discalcingTime() const
|
||||||
|
{
|
||||||
|
return m_discalcTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setDiscalcingTime(const QTime &discalcingTime)
|
||||||
|
{
|
||||||
|
m_discalcTime = discalcingTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
double RadiatorThermostat::valveMaximumSettings() const
|
||||||
|
{
|
||||||
|
return m_valveMaximumSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setValveMaximumSettings(const double &valveMaximumSettings)
|
||||||
|
{
|
||||||
|
m_valveMaximumSettings = valveMaximumSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
double RadiatorThermostat::valveOffset() const
|
||||||
|
{
|
||||||
|
return m_valveOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setValveOffset(const double &valveOffset)
|
||||||
|
{
|
||||||
|
m_valveOffset = valveOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadiatorThermostat::informationValid() const
|
||||||
|
{
|
||||||
|
return m_informationValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setInformationValid(const bool &informationValid)
|
||||||
|
{
|
||||||
|
m_informationValid = informationValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadiatorThermostat::errorOccured() const
|
||||||
|
{
|
||||||
|
return m_errorOccured;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setErrorOccured(const bool &errorOccured)
|
||||||
|
{
|
||||||
|
m_errorOccured = errorOccured;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadiatorThermostat::isAnswereToCommand() const
|
||||||
|
{
|
||||||
|
return m_isAnswerToCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setIsAnswereToCommand(const bool &isAnswereToCommand)
|
||||||
|
{
|
||||||
|
m_isAnswerToCommand = isAnswereToCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadiatorThermostat::initialized() const
|
||||||
|
{
|
||||||
|
return m_initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setInitialized(const bool &initialized)
|
||||||
|
{
|
||||||
|
m_initialized = initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadiatorThermostat::batteryLow() const
|
||||||
|
{
|
||||||
|
return m_batteryLow;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setBatteryLow(const bool &batteryLow)
|
||||||
|
{
|
||||||
|
m_batteryLow = batteryLow;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadiatorThermostat::linkStatusOK() const
|
||||||
|
{
|
||||||
|
return m_linkStatusOK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setLinkStatusOK(const bool &linkStatusOK)
|
||||||
|
{
|
||||||
|
m_linkStatusOK = linkStatusOK;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadiatorThermostat::panelLocked() const
|
||||||
|
{
|
||||||
|
return m_panelLocked;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setPanelLocked(const bool &panelLocked)
|
||||||
|
{
|
||||||
|
m_panelLocked = panelLocked;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadiatorThermostat::gatewayKnown() const
|
||||||
|
{
|
||||||
|
return m_gatewayKnown;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setGatewayKnown(const bool &gatewayKnown)
|
||||||
|
{
|
||||||
|
m_gatewayKnown = gatewayKnown;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadiatorThermostat::dtsActive() const
|
||||||
|
{
|
||||||
|
return m_dtsActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setDtsActive(const bool &dtsActive)
|
||||||
|
{
|
||||||
|
m_dtsActive = dtsActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
int RadiatorThermostat::deviceMode() const
|
||||||
|
{
|
||||||
|
return m_deviceMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setDeviceMode(const int &deviceMode)
|
||||||
|
{
|
||||||
|
m_deviceMode = deviceMode;
|
||||||
|
|
||||||
|
switch (deviceMode) {
|
||||||
|
case Auto:
|
||||||
|
m_deviceModeString = "Auto";
|
||||||
|
break;
|
||||||
|
case Manual:
|
||||||
|
m_deviceModeString = "Manuel";
|
||||||
|
break;
|
||||||
|
case Temporary:
|
||||||
|
m_deviceModeString = "Temporary";
|
||||||
|
break;
|
||||||
|
case Boost:
|
||||||
|
m_deviceModeString = "Boost";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_deviceModeString = "-";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString RadiatorThermostat::deviceModeString() const
|
||||||
|
{
|
||||||
|
return m_deviceModeString;
|
||||||
|
}
|
||||||
|
|
||||||
|
int RadiatorThermostat::valvePosition() const
|
||||||
|
{
|
||||||
|
return m_valvePosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setValvePosition(const int &valvePosition)
|
||||||
|
{
|
||||||
|
m_valvePosition = valvePosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
double RadiatorThermostat::setpointTemperature() const
|
||||||
|
{
|
||||||
|
return m_setpointTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadiatorThermostat::setSetpointTemperatre(const double &setpointTemperature)
|
||||||
|
{
|
||||||
|
m_setpointTemperature = setpointTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
144
plugins/deviceplugins/eq-3/radiatorthermostat.h
Normal file
144
plugins/deviceplugins/eq-3/radiatorthermostat.h
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* This file is part of guh. *
|
||||||
|
* *
|
||||||
|
* Guh is free software: you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation, version 2 of the License. *
|
||||||
|
* *
|
||||||
|
* Guh is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with guh. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
* *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
#ifndef RADIATORTHERMOSTAT_H
|
||||||
|
#define RADIATORTHERMOSTAT_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QTime>
|
||||||
|
|
||||||
|
#include "maxdevice.h"
|
||||||
|
|
||||||
|
class RadiatorThermostat : public MaxDevice
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit RadiatorThermostat(QObject *parent = 0);
|
||||||
|
|
||||||
|
double confortTemp() const;
|
||||||
|
void setConfortTemp(const double &confortTemp);
|
||||||
|
|
||||||
|
double ecoTemp() const;
|
||||||
|
void setEcoTemp(const double &ecoTemp);
|
||||||
|
|
||||||
|
double maxSetPointTemp() const;
|
||||||
|
void setMaxSetPointTemp(const double &maxSetPointTemp);
|
||||||
|
|
||||||
|
double minSetPointTemp() const;
|
||||||
|
void setMinSetPointTemp(const double &minSetPointTemp);
|
||||||
|
|
||||||
|
double windowOpenTemp() const;
|
||||||
|
void setWindowOpenTemp(const double &windowOpenTemp);
|
||||||
|
|
||||||
|
double offsetTemp() const;
|
||||||
|
void setOffsetTemp(const double &offsetTemp);
|
||||||
|
|
||||||
|
int windowOpenDuration() const;
|
||||||
|
void setWindowOpenDuration(const int &windowOpenDuration);
|
||||||
|
|
||||||
|
int boostDuration() const;
|
||||||
|
void setBoostDuration(const int &boostDuration);
|
||||||
|
|
||||||
|
int boostValveValue() const;
|
||||||
|
void setBoostValveValue(const int &boostValveValue);
|
||||||
|
|
||||||
|
QString discalcingWeekDay() const;
|
||||||
|
void setDiscalcingWeekDay(const QString &discalcingWeekDay);
|
||||||
|
|
||||||
|
QTime discalcingTime() const;
|
||||||
|
void setDiscalcingTime(const QTime &discalcingTime);
|
||||||
|
|
||||||
|
double valveMaximumSettings() const;
|
||||||
|
void setValveMaximumSettings(const double &valveMaximumSettings);
|
||||||
|
|
||||||
|
double valveOffset() const;
|
||||||
|
void setValveOffset(const double &valveOffset);
|
||||||
|
|
||||||
|
bool informationValid() const;
|
||||||
|
void setInformationValid(const bool &informationValid);
|
||||||
|
|
||||||
|
bool errorOccured() const;
|
||||||
|
void setErrorOccured(const bool &errorOccured);
|
||||||
|
|
||||||
|
bool isAnswereToCommand() const;
|
||||||
|
void setIsAnswereToCommand(const bool &isAnswereToCommand);
|
||||||
|
|
||||||
|
bool initialized() const;
|
||||||
|
void setInitialized(const bool &initialized);
|
||||||
|
|
||||||
|
bool batteryLow() const;
|
||||||
|
void setBatteryLow(const bool &batteryLow);
|
||||||
|
|
||||||
|
bool linkStatusOK() const;
|
||||||
|
void setLinkStatusOK(const bool &linkStatusOK);
|
||||||
|
|
||||||
|
bool panelLocked() const;
|
||||||
|
void setPanelLocked(const bool &panelLocked);
|
||||||
|
|
||||||
|
bool gatewayKnown() const;
|
||||||
|
void setGatewayKnown(const bool &gatewayKnown);
|
||||||
|
|
||||||
|
bool dtsActive() const;
|
||||||
|
void setDtsActive(const bool &dtsActive);
|
||||||
|
|
||||||
|
int deviceMode() const;
|
||||||
|
void setDeviceMode(const int &deviceMode);
|
||||||
|
|
||||||
|
QString deviceModeString() const;
|
||||||
|
|
||||||
|
int valvePosition() const;
|
||||||
|
void setValvePosition(const int &valvePosition);
|
||||||
|
|
||||||
|
double setpointTemperature() const;
|
||||||
|
void setSetpointTemperatre(const double &setpointTemperature);
|
||||||
|
|
||||||
|
private:
|
||||||
|
double m_confortTemp;
|
||||||
|
double m_ecoTemp;
|
||||||
|
double m_maxSetPointTemp;
|
||||||
|
double m_minSetPointTemp;
|
||||||
|
double m_windowOpenTemp;
|
||||||
|
double m_offsetTemp;
|
||||||
|
int m_windowOpenDuration;
|
||||||
|
int m_boostDuration;
|
||||||
|
int m_boostValveValue;
|
||||||
|
QString m_discalcWeekDay;
|
||||||
|
QTime m_discalcTime;
|
||||||
|
double m_valveMaximumSettings;
|
||||||
|
double m_valveOffset;
|
||||||
|
bool m_informationValid;
|
||||||
|
bool m_errorOccured;
|
||||||
|
bool m_isAnswerToCommand;
|
||||||
|
bool m_initialized;
|
||||||
|
bool m_batteryLow;
|
||||||
|
bool m_linkStatusOK;
|
||||||
|
bool m_panelLocked;
|
||||||
|
bool m_gatewayKnown;
|
||||||
|
bool m_dtsActive;
|
||||||
|
int m_deviceMode;
|
||||||
|
QString m_deviceModeString;
|
||||||
|
int m_valvePosition;
|
||||||
|
double m_setpointTemperature;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // RADIATORTHERMOSTAT_H
|
||||||
@ -16,119 +16,149 @@
|
|||||||
* *
|
* *
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#include "livemessage.h"
|
#include "wallthermostat.h"
|
||||||
|
|
||||||
LiveMessage::LiveMessage(QObject *parent) :
|
WallThermostat::WallThermostat(QObject *parent) :
|
||||||
QObject(parent)
|
MaxDevice(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray LiveMessage::rfAddress() const
|
double WallThermostat::confortTemp() const
|
||||||
{
|
{
|
||||||
return m_rfAddress;
|
return m_confortTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveMessage::setRfAddress(const QByteArray &rfAddress)
|
void WallThermostat::setConfortTemp(const double &confortTemp)
|
||||||
{
|
{
|
||||||
m_rfAddress = rfAddress;
|
m_confortTemp = confortTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LiveMessage::informationValid() const
|
double WallThermostat::ecoTemp() const
|
||||||
|
{
|
||||||
|
return m_ecoTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WallThermostat::setEcoTemp(const double &ecoTemp)
|
||||||
|
{
|
||||||
|
m_ecoTemp = ecoTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
double WallThermostat::maxSetPointTemp() const
|
||||||
|
{
|
||||||
|
return m_maxSetPointTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WallThermostat::setMaxSetPointTemp(const double &maxSetPointTemp)
|
||||||
|
{
|
||||||
|
m_maxSetPointTemp = maxSetPointTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
double WallThermostat::minSetPointTemp() const
|
||||||
|
{
|
||||||
|
return m_minSetPointTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WallThermostat::setMinSetPointTemp(const double &minSetPointTemp)
|
||||||
|
{
|
||||||
|
m_minSetPointTemp = minSetPointTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WallThermostat::informationValid() const
|
||||||
{
|
{
|
||||||
return m_informationValid;
|
return m_informationValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveMessage::setInformationValid(const bool &informationValid)
|
void WallThermostat::setInformationValid(const bool &informationValid)
|
||||||
{
|
{
|
||||||
m_informationValid = informationValid;
|
m_informationValid = informationValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LiveMessage::errorOccured() const
|
bool WallThermostat::errorOccured() const
|
||||||
{
|
{
|
||||||
return m_errorOccured;
|
return m_errorOccured;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveMessage::setErrorOccured(const bool &errorOccured)
|
void WallThermostat::setErrorOccured(const bool &errorOccured)
|
||||||
{
|
{
|
||||||
m_errorOccured = errorOccured;
|
m_errorOccured = errorOccured;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LiveMessage::isAnswereToCommand() const
|
bool WallThermostat::isAnswereToCommand() const
|
||||||
{
|
{
|
||||||
return m_isAnswerToCommand;
|
return m_isAnswerToCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveMessage::setIsAnswereToCommand(const bool &isAnswereToCommand)
|
void WallThermostat::setIsAnswereToCommand(const bool &isAnswereToCommand)
|
||||||
{
|
{
|
||||||
m_isAnswerToCommand = isAnswereToCommand;
|
m_isAnswerToCommand = isAnswereToCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LiveMessage::initialized() const
|
bool WallThermostat::initialized() const
|
||||||
{
|
{
|
||||||
return m_initialized;
|
return m_initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveMessage::setInitialized(const bool &initialized)
|
void WallThermostat::setInitialized(const bool &initialized)
|
||||||
{
|
{
|
||||||
m_initialized = initialized;
|
m_initialized = initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LiveMessage::batteryLow() const
|
bool WallThermostat::batteryLow() const
|
||||||
{
|
{
|
||||||
return m_batteryLow;
|
return m_batteryLow;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveMessage::setBatteryLow(const bool &batteryLow)
|
void WallThermostat::setBatteryLow(const bool &batteryLow)
|
||||||
{
|
{
|
||||||
m_batteryLow = batteryLow;
|
m_batteryLow = batteryLow;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LiveMessage::linkStatusOK() const
|
bool WallThermostat::linkStatusOK() const
|
||||||
{
|
{
|
||||||
return m_linkStatusOK;
|
return m_linkStatusOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveMessage::setLinkStatusOK(const bool &linkStatusOK)
|
void WallThermostat::setLinkStatusOK(const bool &linkStatusOK)
|
||||||
{
|
{
|
||||||
m_linkStatusOK = linkStatusOK;
|
m_linkStatusOK = linkStatusOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LiveMessage::panelLocked() const
|
bool WallThermostat::panelLocked() const
|
||||||
{
|
{
|
||||||
return m_panelLocked;
|
return m_panelLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveMessage::setPanelLocked(const bool &panelLocked)
|
void WallThermostat::setPanelLocked(const bool &panelLocked)
|
||||||
{
|
{
|
||||||
m_panelLocked = panelLocked;
|
m_panelLocked = panelLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LiveMessage::gatewayKnown() const
|
bool WallThermostat::gatewayKnown() const
|
||||||
{
|
{
|
||||||
return m_gatewayKnown;
|
return m_gatewayKnown;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveMessage::setGatewayKnown(const bool &gatewayKnown)
|
void WallThermostat::setGatewayKnown(const bool &gatewayKnown)
|
||||||
{
|
{
|
||||||
m_gatewayKnown = gatewayKnown;
|
m_gatewayKnown = gatewayKnown;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LiveMessage::dtsActive() const
|
bool WallThermostat::dtsActive() const
|
||||||
{
|
{
|
||||||
return m_dtsActive;
|
return m_dtsActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveMessage::setDtsActive(const bool &dtsActive)
|
void WallThermostat::setDtsActive(const bool &dtsActive)
|
||||||
{
|
{
|
||||||
m_dtsActive = dtsActive;
|
m_dtsActive = dtsActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LiveMessage::deviceMode() const
|
int WallThermostat::deviceMode() const
|
||||||
{
|
{
|
||||||
return m_deviceMode;
|
return m_deviceMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveMessage::setDeviceMode(const int &deviceMode)
|
void WallThermostat::setDeviceMode(const int &deviceMode)
|
||||||
{
|
{
|
||||||
m_deviceMode = deviceMode;
|
m_deviceMode = deviceMode;
|
||||||
|
|
||||||
@ -149,40 +179,29 @@ void LiveMessage::setDeviceMode(const int &deviceMode)
|
|||||||
m_deviceModeString = "-";
|
m_deviceModeString = "-";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LiveMessage::deviceModeString() const
|
QString WallThermostat::deviceModeString() const
|
||||||
{
|
{
|
||||||
return m_deviceModeString;
|
return m_deviceModeString;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LiveMessage::valvePosition() const
|
double WallThermostat::setpointTemperature() const
|
||||||
{
|
|
||||||
return m_valvePosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LiveMessage::setValvePosition(const int &valvePosition)
|
|
||||||
{
|
|
||||||
m_valvePosition = valvePosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
double LiveMessage::setpointTemperature() const
|
|
||||||
{
|
{
|
||||||
return m_setpointTemperature;
|
return m_setpointTemperature;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveMessage::setSetpointTemperatre(const double &setpointTemperature)
|
void WallThermostat::setSetpointTemperatre(const double &setpointTemperature)
|
||||||
{
|
{
|
||||||
m_setpointTemperature = setpointTemperature;
|
m_setpointTemperature = setpointTemperature;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDateTime LiveMessage::dateTime() const
|
double WallThermostat::currentTemperature() const
|
||||||
{
|
{
|
||||||
return m_dateTime;
|
return m_currentTemperature;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveMessage::setDateTime(const QDateTime dateTime)
|
void WallThermostat::setCurrentTemperatre(const double ¤tTemperature)
|
||||||
{
|
{
|
||||||
m_dateTime = dateTime;
|
m_currentTemperature = currentTemperature;
|
||||||
}
|
}
|
||||||
@ -16,27 +16,29 @@
|
|||||||
* *
|
* *
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#ifndef LIVEMESSAGE_H
|
#ifndef WALLTHERMOSTAT_H
|
||||||
#define LIVEMESSAGE_H
|
#define WALLTHERMOSTAT_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDateTime>
|
#include "maxdevice.h"
|
||||||
|
|
||||||
class LiveMessage : public QObject
|
class WallThermostat : public MaxDevice
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit LiveMessage(QObject *parent = 0);
|
explicit WallThermostat(QObject *parent = 0);
|
||||||
|
|
||||||
enum DeviceMode{
|
double confortTemp() const;
|
||||||
Auto = 0,
|
void setConfortTemp(const double &confortTemp);
|
||||||
Manual = 1,
|
|
||||||
Temporary = 2,
|
|
||||||
Boost = 3
|
|
||||||
};
|
|
||||||
|
|
||||||
QByteArray rfAddress() const;
|
double ecoTemp() const;
|
||||||
void setRfAddress(const QByteArray & rfAddress);
|
void setEcoTemp(const double &ecoTemp);
|
||||||
|
|
||||||
|
double maxSetPointTemp() const;
|
||||||
|
void setMaxSetPointTemp(const double &maxSetPointTemp);
|
||||||
|
|
||||||
|
double minSetPointTemp() const;
|
||||||
|
void setMinSetPointTemp(const double &minSetPointTemp);
|
||||||
|
|
||||||
bool informationValid() const;
|
bool informationValid() const;
|
||||||
void setInformationValid(const bool &informationValid);
|
void setInformationValid(const bool &informationValid);
|
||||||
@ -76,13 +78,15 @@ public:
|
|||||||
double setpointTemperature() const;
|
double setpointTemperature() const;
|
||||||
void setSetpointTemperatre(const double &setpointTemperature);
|
void setSetpointTemperatre(const double &setpointTemperature);
|
||||||
|
|
||||||
QDateTime dateTime() const;
|
double currentTemperature() const;
|
||||||
void setDateTime(const QDateTime dateTime);
|
void setCurrentTemperatre(const double ¤tTemperature);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
double m_confortTemp;
|
||||||
|
double m_ecoTemp;
|
||||||
|
double m_maxSetPointTemp;
|
||||||
|
double m_minSetPointTemp;
|
||||||
|
|
||||||
QByteArray m_rfAddress;
|
|
||||||
bool m_informationValid;
|
bool m_informationValid;
|
||||||
bool m_errorOccured;
|
bool m_errorOccured;
|
||||||
bool m_isAnswerToCommand;
|
bool m_isAnswerToCommand;
|
||||||
@ -96,7 +100,7 @@ private:
|
|||||||
QString m_deviceModeString;
|
QString m_deviceModeString;
|
||||||
int m_valvePosition;
|
int m_valvePosition;
|
||||||
double m_setpointTemperature;
|
double m_setpointTemperature;
|
||||||
QDateTime m_dateTime;
|
double m_currentTemperature;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
@ -104,4 +108,4 @@ public slots:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LIVEMESSAGE_H
|
#endif // WALLTHERMOSTAT_H
|
||||||
Reference in New Issue
Block a user