evbox: Add Qt6 support
parent
a06333719b
commit
3e2dc2940a
|
|
@ -1,13 +1,11 @@
|
|||
include(../plugins.pri)
|
||||
|
||||
QT += network serialport
|
||||
QT *= network serialport
|
||||
|
||||
SOURCES += \
|
||||
evboxdiscovery.cpp \
|
||||
evboxport.cpp \
|
||||
integrationpluginevbox.cpp \
|
||||
|
||||
HEADERS += \
|
||||
evboxdiscovery.h \
|
||||
evboxport.h \
|
||||
integrationpluginevbox.h \
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Copyright 2013 - 2023, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file is part of nymea.
|
||||
* This project including source code and documentation is protected by
|
||||
* copyright law, and remains the property of nymea GmbH. All rights, including
|
||||
* reproduction, publication, editing and translation, are reserved. The use of
|
||||
* this project is subject to the terms of a license agreement to be concluded
|
||||
* with nymea GmbH in accordance with the terms of use of nymea GmbH, available
|
||||
* under https://nymea.io/license
|
||||
*
|
||||
* GNU Lesser General Public License Usage
|
||||
* Alternatively, this project may be redistributed and/or modified under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; version 3. This project 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this project. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For any further details and any questions please contact us under
|
||||
* contact@nymea.io or see our FAQ/Licensing Information on
|
||||
* https://nymea.io/license/faq
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include "evboxdiscovery.h"
|
||||
|
||||
EVBoxDiscovery::EVBoxDiscovery(EVBoxPort *evboxPort, QObject *parent)
|
||||
: QObject{parent},
|
||||
m_port{evboxPort}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Copyright 2013 - 2023, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file is part of nymea.
|
||||
* This project including source code and documentation is protected by
|
||||
* copyright law, and remains the property of nymea GmbH. All rights, including
|
||||
* reproduction, publication, editing and translation, are reserved. The use of
|
||||
* this project is subject to the terms of a license agreement to be concluded
|
||||
* with nymea GmbH in accordance with the terms of use of nymea GmbH, available
|
||||
* under https://nymea.io/license
|
||||
*
|
||||
* GNU Lesser General Public License Usage
|
||||
* Alternatively, this project may be redistributed and/or modified under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; version 3. This project 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this project. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For any further details and any questions please contact us under
|
||||
* contact@nymea.io or see our FAQ/Licensing Information on
|
||||
* https://nymea.io/license/faq
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef EVBOXDISCOVERY_H
|
||||
#define EVBOXDISCOVERY_H
|
||||
|
||||
#include <QObject>
|
||||
#include "evboxport.h"
|
||||
|
||||
class EVBoxDiscovery : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EVBoxDiscovery(EVBoxPort *evboxPort, QObject *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
|
||||
private:
|
||||
EVBoxPort *m_port = nullptr;
|
||||
|
||||
};
|
||||
|
||||
#endif // EVBOXDISCOVERY_H
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Copyright 2013 - 2023, nymea GmbH
|
||||
* Copyright 2013 - 2025, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file is part of nymea.
|
||||
|
|
@ -30,17 +30,14 @@
|
|||
|
||||
#include "evboxport.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QDataStream>
|
||||
|
||||
#include "extern-plugininfo.h"
|
||||
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
#define STX 0x02
|
||||
#define ETX 0x03
|
||||
|
||||
|
||||
EVBoxPort::EVBoxPort(const QString &portName, QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
|
|
@ -51,8 +48,11 @@ EVBoxPort::EVBoxPort(const QString &portName, QObject *parent)
|
|||
m_serialPort->setParity(QSerialPort::NoParity);
|
||||
|
||||
connect(m_serialPort, &QSerialPort::readyRead, this, &EVBoxPort::onReadyRead);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
connect(m_serialPort, &QSerialPort::errorOccurred, this, [this](){
|
||||
#else
|
||||
connect(m_serialPort, static_cast<void(QSerialPort::*)(QSerialPort::SerialPortError)>(&QSerialPort::error), this, [=](){
|
||||
#endif
|
||||
qCWarning(dcEVBox()) << "Serial Port error" << m_serialPort->error() << m_serialPort->errorString();
|
||||
if (m_serialPort->error() != QSerialPort::NoError) {
|
||||
if (m_serialPort->isOpen()) {
|
||||
|
|
@ -262,7 +262,7 @@ void EVBoxPort::processQueue()
|
|||
|
||||
commandData += "80"; // Dst addr
|
||||
commandData += "A0"; // Sender address
|
||||
commandData += QString::number(cmd.command);
|
||||
commandData += QString::number(cmd.command).toUtf8();
|
||||
|
||||
qCDebug(dcEVBox()) << "Sending command" << cmd.command << "to" << cmd.serial << "MaxCurrent:" << cmd.maxChargingCurrent;
|
||||
|
||||
|
|
@ -272,7 +272,7 @@ void EVBoxPort::processQueue()
|
|||
processQueue();
|
||||
return;
|
||||
}
|
||||
commandData += cmd.serial;
|
||||
commandData += cmd.serial.toUtf8();
|
||||
// The content of the “information module” is 16 bytes in size and not defined. ¯\_(ツ)_/¯
|
||||
commandData += "00112233445566778899AABBCCDDEEFF";
|
||||
|
||||
|
|
@ -281,16 +281,16 @@ void EVBoxPort::processQueue()
|
|||
|
||||
}
|
||||
|
||||
commandData += QString("%1").arg(cmd.maxChargingCurrent * 10, 4, 10, QChar('0'));
|
||||
commandData += QString("%1").arg(cmd.maxChargingCurrent * 10, 4, 10, QChar('0'));
|
||||
commandData += QString("%1").arg(cmd.maxChargingCurrent * 10, 4, 10, QChar('0'));
|
||||
commandData += QString("%1").arg(cmd.timeout, 4, 10, QChar('0'));
|
||||
commandData += QString("%1").arg(cmd.maxChargingCurrent * 10, 4, 10, QChar('0')).toUtf8();
|
||||
commandData += QString("%1").arg(cmd.maxChargingCurrent * 10, 4, 10, QChar('0')).toUtf8();
|
||||
commandData += QString("%1").arg(cmd.maxChargingCurrent * 10, 4, 10, QChar('0')).toUtf8();
|
||||
commandData += QString("%1").arg(cmd.timeout, 4, 10, QChar('0')).toUtf8();
|
||||
// If we fail to refresh the wallbox after the timeout, it shall turn off, which is what we'll use as default
|
||||
// when we don't know what its set to (as we can't read it).
|
||||
// Hence we do *not* cache the power and maxChargingCurrent states for this one
|
||||
commandData += QString("%1").arg(6, 4, 10, QChar('0'));
|
||||
commandData += QString("%1").arg(6, 4, 10, QChar('0'));
|
||||
commandData += QString("%1").arg(6, 4, 10, QChar('0'));
|
||||
commandData += QString("%1").arg(6, 4, 10, QChar('0')).toUtf8();
|
||||
commandData += QString("%1").arg(6, 4, 10, QChar('0')).toUtf8();
|
||||
commandData += QString("%1").arg(6, 4, 10, QChar('0')).toUtf8();
|
||||
|
||||
commandData += createChecksum(commandData);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Copyright 2013 - 2022, nymea GmbH
|
||||
* Copyright 2013 - 2025, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file is part of nymea.
|
||||
|
|
@ -28,10 +28,8 @@
|
|||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
#include "integrationpluginevbox.h"
|
||||
#include "plugininfo.h"
|
||||
#include "plugintimer.h"
|
||||
#include "evboxport.h"
|
||||
|
||||
#include <QSerialPortInfo>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Copyright 2013 - 2022, nymea GmbH
|
||||
* Copyright 2013 - 2025, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file is part of nymea.
|
||||
|
|
@ -31,11 +31,10 @@
|
|||
#ifndef INTEGRATIONPLUGINEVBOX_H
|
||||
#define INTEGRATIONPLUGINEVBOX_H
|
||||
|
||||
#include "integrations/integrationplugin.h"
|
||||
|
||||
#include "evboxport.h"
|
||||
#include <integrations/integrationplugin.h>
|
||||
|
||||
#include "extern-plugininfo.h"
|
||||
#include "evboxport.h"
|
||||
|
||||
#include <plugintimer.h>
|
||||
#include <QTimer>
|
||||
|
|
|
|||
Loading…
Reference in New Issue