update generated connection
This commit is contained in:
parent
8c8b9d0f73
commit
4161d03ec5
@ -28,9 +28,19 @@
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* WARNING
|
||||
*
|
||||
* This file has been autogenerated. Any changes in this file may be overwritten.
|
||||
* If you want to change something, update the register json or the tool.
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include "cionmodbusrtuconnection.h"
|
||||
#include "loggingcategories.h"
|
||||
#include <math.h>
|
||||
#include "math.h"
|
||||
|
||||
NYMEA_LOGGING_CATEGORY(dcCionModbusRtuConnection, "CionModbusRtuConnection")
|
||||
|
||||
CionModbusRtuConnection::CionModbusRtuConnection(ModbusRtuMaster *modbusRtuMaster, quint16 slaveId, QObject *parent) :
|
||||
@ -49,6 +59,18 @@ quint16 CionModbusRtuConnection::slaveId() const
|
||||
{
|
||||
return m_slaveId;
|
||||
}
|
||||
ModbusDataUtils::ByteOrder CionModbusRtuConnection::endianness() const
|
||||
{
|
||||
return m_endianness;
|
||||
}
|
||||
void CionModbusRtuConnection::setEndianness(ModbusDataUtils::ByteOrder endianness)
|
||||
{
|
||||
if (m_endianness == endianness)
|
||||
return;
|
||||
|
||||
m_endianness = endianness;
|
||||
emit endiannessChanged(m_endianness);
|
||||
}
|
||||
quint16 CionModbusRtuConnection::chargingEnabled() const
|
||||
{
|
||||
return m_chargingEnabled;
|
||||
@ -153,11 +175,7 @@ void CionModbusRtuConnection::updateChargingEnabled()
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
QVector<quint16> values = reply->result();
|
||||
qCDebug(dcCionModbusRtuConnection()) << "<-- Response from \"Charging enabled\" register" << 100 << "size:" << 1 << values;
|
||||
quint16 receivedChargingEnabled = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_chargingEnabled != receivedChargingEnabled) {
|
||||
m_chargingEnabled = receivedChargingEnabled;
|
||||
emit chargingEnabledChanged(m_chargingEnabled);
|
||||
}
|
||||
processChargingEnabledRegisterValues(values);
|
||||
}
|
||||
});
|
||||
|
||||
@ -182,11 +200,7 @@ void CionModbusRtuConnection::updateChargingCurrentSetpoint()
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
QVector<quint16> values = reply->result();
|
||||
qCDebug(dcCionModbusRtuConnection()) << "<-- Response from \"Charging current setpoint\" register" << 101 << "size:" << 1 << values;
|
||||
quint16 receivedChargingCurrentSetpoint = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_chargingCurrentSetpoint != receivedChargingCurrentSetpoint) {
|
||||
m_chargingCurrentSetpoint = receivedChargingCurrentSetpoint;
|
||||
emit chargingCurrentSetpointChanged(m_chargingCurrentSetpoint);
|
||||
}
|
||||
processChargingCurrentSetpointRegisterValues(values);
|
||||
}
|
||||
});
|
||||
|
||||
@ -211,11 +225,7 @@ void CionModbusRtuConnection::updateStatusBits()
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
QVector<quint16> values = reply->result();
|
||||
qCDebug(dcCionModbusRtuConnection()) << "<-- Response from \"Mode3-State A, B, C, D, U\" register" << 121 << "size:" << 1 << values;
|
||||
quint16 receivedStatusBits = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_statusBits != receivedStatusBits) {
|
||||
m_statusBits = receivedStatusBits;
|
||||
emit statusBitsChanged(m_statusBits);
|
||||
}
|
||||
processStatusBitsRegisterValues(values);
|
||||
}
|
||||
});
|
||||
|
||||
@ -240,11 +250,7 @@ void CionModbusRtuConnection::updateCpSignalState()
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
QVector<quint16> values = reply->result();
|
||||
qCDebug(dcCionModbusRtuConnection()) << "<-- Response from \"Status bits\" register" << 139 << "size:" << 1 << values;
|
||||
quint16 receivedCpSignalState = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_cpSignalState != receivedCpSignalState) {
|
||||
m_cpSignalState = receivedCpSignalState;
|
||||
emit cpSignalStateChanged(m_cpSignalState);
|
||||
}
|
||||
processCpSignalStateRegisterValues(values);
|
||||
}
|
||||
});
|
||||
|
||||
@ -269,11 +275,7 @@ void CionModbusRtuConnection::updateU1Voltage()
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
QVector<quint16> values = reply->result();
|
||||
qCDebug(dcCionModbusRtuConnection()) << "<-- Response from \"U1 voltage\" register" << 167 << "size:" << 1 << values;
|
||||
float receivedU1Voltage = ModbusDataUtils::convertToUInt16(values) * 1.0 * pow(10, -2);
|
||||
if (m_u1Voltage != receivedU1Voltage) {
|
||||
m_u1Voltage = receivedU1Voltage;
|
||||
emit u1VoltageChanged(m_u1Voltage);
|
||||
}
|
||||
processU1VoltageRegisterValues(values);
|
||||
}
|
||||
});
|
||||
|
||||
@ -298,11 +300,7 @@ void CionModbusRtuConnection::updateGridVoltage()
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
QVector<quint16> values = reply->result();
|
||||
qCDebug(dcCionModbusRtuConnection()) << "<-- Response from \"Voltage of the power supply grid\" register" << 302 << "size:" << 1 << values;
|
||||
float receivedGridVoltage = ModbusDataUtils::convertToUInt16(values) * 1.0 * pow(10, -2);
|
||||
if (m_gridVoltage != receivedGridVoltage) {
|
||||
m_gridVoltage = receivedGridVoltage;
|
||||
emit gridVoltageChanged(m_gridVoltage);
|
||||
}
|
||||
processGridVoltageRegisterValues(values);
|
||||
}
|
||||
});
|
||||
|
||||
@ -327,11 +325,7 @@ void CionModbusRtuConnection::updateMinChargingCurrent()
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
QVector<quint16> values = reply->result();
|
||||
qCDebug(dcCionModbusRtuConnection()) << "<-- Response from \"Minimum charging current\" register" << 507 << "size:" << 1 << values;
|
||||
quint16 receivedMinChargingCurrent = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_minChargingCurrent != receivedMinChargingCurrent) {
|
||||
m_minChargingCurrent = receivedMinChargingCurrent;
|
||||
emit minChargingCurrentChanged(m_minChargingCurrent);
|
||||
}
|
||||
processMinChargingCurrentRegisterValues(values);
|
||||
}
|
||||
});
|
||||
|
||||
@ -345,6 +339,131 @@ void CionModbusRtuConnection::updateMinChargingCurrent()
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::updateCurrentChargingCurrentE3()
|
||||
{
|
||||
// Update registers from Current charging Ampere
|
||||
qCDebug(dcCionModbusRtuConnection()) << "--> Read \"Current charging Ampere\" register:" << 126 << "size:" << 1;
|
||||
ModbusRtuReply *reply = readCurrentChargingCurrentE3();
|
||||
if (reply) {
|
||||
if (!reply->isFinished()) {
|
||||
connect(reply, &ModbusRtuReply::finished, this, [this, reply](){
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
QVector<quint16> values = reply->result();
|
||||
qCDebug(dcCionModbusRtuConnection()) << "<-- Response from \"Current charging Ampere\" register" << 126 << "size:" << 1 << values;
|
||||
processCurrentChargingCurrentE3RegisterValues(values);
|
||||
}
|
||||
});
|
||||
|
||||
connect(reply, &ModbusRtuReply::errorOccurred, this, [reply] (ModbusRtuReply::Error error){
|
||||
qCWarning(dcCionModbusRtuConnection()) << "ModbusRtu reply error occurred while updating \"Current charging Ampere\" registers" << error << reply->errorString();
|
||||
emit reply->finished();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
qCWarning(dcCionModbusRtuConnection()) << "Error occurred while reading \"Current charging Ampere\" registers";
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::updateMaxChargingCurrentE3()
|
||||
{
|
||||
// Update registers from Maximum charging current
|
||||
qCDebug(dcCionModbusRtuConnection()) << "--> Read \"Maximum charging current\" register:" << 127 << "size:" << 1;
|
||||
ModbusRtuReply *reply = readMaxChargingCurrentE3();
|
||||
if (reply) {
|
||||
if (!reply->isFinished()) {
|
||||
connect(reply, &ModbusRtuReply::finished, this, [this, reply](){
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
QVector<quint16> values = reply->result();
|
||||
qCDebug(dcCionModbusRtuConnection()) << "<-- Response from \"Maximum charging current\" register" << 127 << "size:" << 1 << values;
|
||||
processMaxChargingCurrentE3RegisterValues(values);
|
||||
}
|
||||
});
|
||||
|
||||
connect(reply, &ModbusRtuReply::errorOccurred, this, [reply] (ModbusRtuReply::Error error){
|
||||
qCWarning(dcCionModbusRtuConnection()) << "ModbusRtu reply error occurred while updating \"Maximum charging current\" registers" << error << reply->errorString();
|
||||
emit reply->finished();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
qCWarning(dcCionModbusRtuConnection()) << "Error occurred while reading \"Maximum charging current\" registers";
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::updateMaxChargingCurrentCableE3()
|
||||
{
|
||||
// Update registers from Maximum charging current of connected cable
|
||||
qCDebug(dcCionModbusRtuConnection()) << "--> Read \"Maximum charging current of connected cable\" register:" << 128 << "size:" << 1;
|
||||
ModbusRtuReply *reply = readMaxChargingCurrentCableE3();
|
||||
if (reply) {
|
||||
if (!reply->isFinished()) {
|
||||
connect(reply, &ModbusRtuReply::finished, this, [this, reply](){
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
QVector<quint16> values = reply->result();
|
||||
qCDebug(dcCionModbusRtuConnection()) << "<-- Response from \"Maximum charging current of connected cable\" register" << 128 << "size:" << 1 << values;
|
||||
processMaxChargingCurrentCableE3RegisterValues(values);
|
||||
}
|
||||
});
|
||||
|
||||
connect(reply, &ModbusRtuReply::errorOccurred, this, [reply] (ModbusRtuReply::Error error){
|
||||
qCWarning(dcCionModbusRtuConnection()) << "ModbusRtu reply error occurred while updating \"Maximum charging current of connected cable\" registers" << error << reply->errorString();
|
||||
emit reply->finished();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
qCWarning(dcCionModbusRtuConnection()) << "Error occurred while reading \"Maximum charging current of connected cable\" registers";
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::updateChargingDuration()
|
||||
{
|
||||
// Update registers from Charging duration
|
||||
qCDebug(dcCionModbusRtuConnection()) << "--> Read \"Charging duration\" register:" << 151 << "size:" << 2;
|
||||
ModbusRtuReply *reply = readChargingDuration();
|
||||
if (reply) {
|
||||
if (!reply->isFinished()) {
|
||||
connect(reply, &ModbusRtuReply::finished, this, [this, reply](){
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
QVector<quint16> values = reply->result();
|
||||
qCDebug(dcCionModbusRtuConnection()) << "<-- Response from \"Charging duration\" register" << 151 << "size:" << 2 << values;
|
||||
processChargingDurationRegisterValues(values);
|
||||
}
|
||||
});
|
||||
|
||||
connect(reply, &ModbusRtuReply::errorOccurred, this, [reply] (ModbusRtuReply::Error error){
|
||||
qCWarning(dcCionModbusRtuConnection()) << "ModbusRtu reply error occurred while updating \"Charging duration\" registers" << error << reply->errorString();
|
||||
emit reply->finished();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
qCWarning(dcCionModbusRtuConnection()) << "Error occurred while reading \"Charging duration\" registers";
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::updatePluggedInDuration()
|
||||
{
|
||||
// Update registers from Plugged in duration
|
||||
qCDebug(dcCionModbusRtuConnection()) << "--> Read \"Plugged in duration\" register:" << 153 << "size:" << 2;
|
||||
ModbusRtuReply *reply = readPluggedInDuration();
|
||||
if (reply) {
|
||||
if (!reply->isFinished()) {
|
||||
connect(reply, &ModbusRtuReply::finished, this, [this, reply](){
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
QVector<quint16> values = reply->result();
|
||||
qCDebug(dcCionModbusRtuConnection()) << "<-- Response from \"Plugged in duration\" register" << 153 << "size:" << 2 << values;
|
||||
processPluggedInDurationRegisterValues(values);
|
||||
}
|
||||
});
|
||||
|
||||
connect(reply, &ModbusRtuReply::errorOccurred, this, [reply] (ModbusRtuReply::Error error){
|
||||
qCWarning(dcCionModbusRtuConnection()) << "ModbusRtu reply error occurred while updating \"Plugged in duration\" registers" << error << reply->errorString();
|
||||
emit reply->finished();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
qCWarning(dcCionModbusRtuConnection()) << "Error occurred while reading \"Plugged in duration\" registers";
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::updateE3Block()
|
||||
{
|
||||
// Update register block "e3"
|
||||
@ -355,29 +474,10 @@ void CionModbusRtuConnection::updateE3Block()
|
||||
connect(reply, &ModbusRtuReply::finished, this, [this, reply](){
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
QVector<quint16> blockValues = reply->result();
|
||||
QVector<quint16> values;
|
||||
qCDebug(dcCionModbusRtuConnection()) << "<-- Response from reading block \"e3\" register" << 126 << "size:" << 3 << blockValues;
|
||||
values = blockValues.mid(0, 1);
|
||||
quint16 receivedCurrentChargingCurrentE3 = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_currentChargingCurrentE3 != receivedCurrentChargingCurrentE3) {
|
||||
m_currentChargingCurrentE3 = receivedCurrentChargingCurrentE3;
|
||||
emit currentChargingCurrentE3Changed(m_currentChargingCurrentE3);
|
||||
}
|
||||
|
||||
values = blockValues.mid(1, 1);
|
||||
quint16 receivedMaxChargingCurrentE3 = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_maxChargingCurrentE3 != receivedMaxChargingCurrentE3) {
|
||||
m_maxChargingCurrentE3 = receivedMaxChargingCurrentE3;
|
||||
emit maxChargingCurrentE3Changed(m_maxChargingCurrentE3);
|
||||
}
|
||||
|
||||
values = blockValues.mid(2, 1);
|
||||
quint16 receivedMaxChargingCurrentCableE3 = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_maxChargingCurrentCableE3 != receivedMaxChargingCurrentCableE3) {
|
||||
m_maxChargingCurrentCableE3 = receivedMaxChargingCurrentCableE3;
|
||||
emit maxChargingCurrentCableE3Changed(m_maxChargingCurrentCableE3);
|
||||
}
|
||||
|
||||
processCurrentChargingCurrentE3RegisterValues(blockValues.mid(0, 1));
|
||||
processMaxChargingCurrentE3RegisterValues(blockValues.mid(1, 1));
|
||||
processMaxChargingCurrentCableE3RegisterValues(blockValues.mid(2, 1));
|
||||
}
|
||||
});
|
||||
|
||||
@ -401,22 +501,9 @@ void CionModbusRtuConnection::updateDurationsBlock()
|
||||
connect(reply, &ModbusRtuReply::finished, this, [this, reply](){
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
QVector<quint16> blockValues = reply->result();
|
||||
QVector<quint16> values;
|
||||
qCDebug(dcCionModbusRtuConnection()) << "<-- Response from reading block \"durations\" register" << 151 << "size:" << 4 << blockValues;
|
||||
values = blockValues.mid(0, 2);
|
||||
quint32 receivedChargingDuration = ModbusDataUtils::convertToUInt32(values, ModbusDataUtils::ByteOrderBigEndian);
|
||||
if (m_chargingDuration != receivedChargingDuration) {
|
||||
m_chargingDuration = receivedChargingDuration;
|
||||
emit chargingDurationChanged(m_chargingDuration);
|
||||
}
|
||||
|
||||
values = blockValues.mid(2, 2);
|
||||
quint32 receivedPluggedInDuration = ModbusDataUtils::convertToUInt32(values, ModbusDataUtils::ByteOrderBigEndian);
|
||||
if (m_pluggedInDuration != receivedPluggedInDuration) {
|
||||
m_pluggedInDuration = receivedPluggedInDuration;
|
||||
emit pluggedInDurationChanged(m_pluggedInDuration);
|
||||
}
|
||||
|
||||
processChargingDurationRegisterValues(blockValues.mid(0, 2));
|
||||
processPluggedInDurationRegisterValues(blockValues.mid(2, 2));
|
||||
}
|
||||
});
|
||||
|
||||
@ -465,6 +552,149 @@ ModbusRtuReply *CionModbusRtuConnection::readMinChargingCurrent()
|
||||
return m_modbusRtuMaster->readHoldingRegister(m_slaveId, 507, 1);
|
||||
}
|
||||
|
||||
ModbusRtuReply *CionModbusRtuConnection::readCurrentChargingCurrentE3()
|
||||
{
|
||||
return m_modbusRtuMaster->readHoldingRegister(m_slaveId, 126, 1);
|
||||
}
|
||||
|
||||
ModbusRtuReply *CionModbusRtuConnection::readMaxChargingCurrentE3()
|
||||
{
|
||||
return m_modbusRtuMaster->readHoldingRegister(m_slaveId, 127, 1);
|
||||
}
|
||||
|
||||
ModbusRtuReply *CionModbusRtuConnection::readMaxChargingCurrentCableE3()
|
||||
{
|
||||
return m_modbusRtuMaster->readHoldingRegister(m_slaveId, 128, 1);
|
||||
}
|
||||
|
||||
ModbusRtuReply *CionModbusRtuConnection::readChargingDuration()
|
||||
{
|
||||
return m_modbusRtuMaster->readHoldingRegister(m_slaveId, 151, 2);
|
||||
}
|
||||
|
||||
ModbusRtuReply *CionModbusRtuConnection::readPluggedInDuration()
|
||||
{
|
||||
return m_modbusRtuMaster->readHoldingRegister(m_slaveId, 153, 2);
|
||||
}
|
||||
|
||||
ModbusRtuReply *CionModbusRtuConnection::readBlockE3()
|
||||
{
|
||||
return m_modbusRtuMaster->readHoldingRegister(m_slaveId, 126, 3);
|
||||
}
|
||||
|
||||
ModbusRtuReply *CionModbusRtuConnection::readBlockDurations()
|
||||
{
|
||||
return m_modbusRtuMaster->readHoldingRegister(m_slaveId, 151, 4);
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::processChargingEnabledRegisterValues(const QVector<quint16> values)
|
||||
{
|
||||
quint16 receivedChargingEnabled = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_chargingEnabled != receivedChargingEnabled) {
|
||||
m_chargingEnabled = receivedChargingEnabled;
|
||||
emit chargingEnabledChanged(m_chargingEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::processChargingCurrentSetpointRegisterValues(const QVector<quint16> values)
|
||||
{
|
||||
quint16 receivedChargingCurrentSetpoint = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_chargingCurrentSetpoint != receivedChargingCurrentSetpoint) {
|
||||
m_chargingCurrentSetpoint = receivedChargingCurrentSetpoint;
|
||||
emit chargingCurrentSetpointChanged(m_chargingCurrentSetpoint);
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::processStatusBitsRegisterValues(const QVector<quint16> values)
|
||||
{
|
||||
quint16 receivedStatusBits = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_statusBits != receivedStatusBits) {
|
||||
m_statusBits = receivedStatusBits;
|
||||
emit statusBitsChanged(m_statusBits);
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::processCpSignalStateRegisterValues(const QVector<quint16> values)
|
||||
{
|
||||
quint16 receivedCpSignalState = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_cpSignalState != receivedCpSignalState) {
|
||||
m_cpSignalState = receivedCpSignalState;
|
||||
emit cpSignalStateChanged(m_cpSignalState);
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::processU1VoltageRegisterValues(const QVector<quint16> values)
|
||||
{
|
||||
float receivedU1Voltage = ModbusDataUtils::convertToUInt16(values) * 1.0 * pow(10, -2);
|
||||
if (m_u1Voltage != receivedU1Voltage) {
|
||||
m_u1Voltage = receivedU1Voltage;
|
||||
emit u1VoltageChanged(m_u1Voltage);
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::processGridVoltageRegisterValues(const QVector<quint16> values)
|
||||
{
|
||||
float receivedGridVoltage = ModbusDataUtils::convertToUInt16(values) * 1.0 * pow(10, -2);
|
||||
if (m_gridVoltage != receivedGridVoltage) {
|
||||
m_gridVoltage = receivedGridVoltage;
|
||||
emit gridVoltageChanged(m_gridVoltage);
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::processMinChargingCurrentRegisterValues(const QVector<quint16> values)
|
||||
{
|
||||
quint16 receivedMinChargingCurrent = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_minChargingCurrent != receivedMinChargingCurrent) {
|
||||
m_minChargingCurrent = receivedMinChargingCurrent;
|
||||
emit minChargingCurrentChanged(m_minChargingCurrent);
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::processCurrentChargingCurrentE3RegisterValues(const QVector<quint16> values)
|
||||
{
|
||||
quint16 receivedCurrentChargingCurrentE3 = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_currentChargingCurrentE3 != receivedCurrentChargingCurrentE3) {
|
||||
m_currentChargingCurrentE3 = receivedCurrentChargingCurrentE3;
|
||||
emit currentChargingCurrentE3Changed(m_currentChargingCurrentE3);
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::processMaxChargingCurrentE3RegisterValues(const QVector<quint16> values)
|
||||
{
|
||||
quint16 receivedMaxChargingCurrentE3 = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_maxChargingCurrentE3 != receivedMaxChargingCurrentE3) {
|
||||
m_maxChargingCurrentE3 = receivedMaxChargingCurrentE3;
|
||||
emit maxChargingCurrentE3Changed(m_maxChargingCurrentE3);
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::processMaxChargingCurrentCableE3RegisterValues(const QVector<quint16> values)
|
||||
{
|
||||
quint16 receivedMaxChargingCurrentCableE3 = ModbusDataUtils::convertToUInt16(values);
|
||||
if (m_maxChargingCurrentCableE3 != receivedMaxChargingCurrentCableE3) {
|
||||
m_maxChargingCurrentCableE3 = receivedMaxChargingCurrentCableE3;
|
||||
emit maxChargingCurrentCableE3Changed(m_maxChargingCurrentCableE3);
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::processChargingDurationRegisterValues(const QVector<quint16> values)
|
||||
{
|
||||
quint32 receivedChargingDuration = ModbusDataUtils::convertToUInt32(values, m_endianness);
|
||||
if (m_chargingDuration != receivedChargingDuration) {
|
||||
m_chargingDuration = receivedChargingDuration;
|
||||
emit chargingDurationChanged(m_chargingDuration);
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::processPluggedInDurationRegisterValues(const QVector<quint16> values)
|
||||
{
|
||||
quint32 receivedPluggedInDuration = ModbusDataUtils::convertToUInt32(values, m_endianness);
|
||||
if (m_pluggedInDuration != receivedPluggedInDuration) {
|
||||
m_pluggedInDuration = receivedPluggedInDuration;
|
||||
emit pluggedInDurationChanged(m_pluggedInDuration);
|
||||
}
|
||||
}
|
||||
|
||||
void CionModbusRtuConnection::verifyInitFinished()
|
||||
{
|
||||
if (m_pendingInitReplies.isEmpty()) {
|
||||
|
||||
@ -28,6 +28,15 @@
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* WARNING
|
||||
*
|
||||
* This file has been autogenerated. Any changes in this file may be overwritten.
|
||||
* If you want to change something, update the register json or the tool.
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef CIONMODBUSRTUCONNECTION_H
|
||||
#define CIONMODBUSRTUCONNECTION_H
|
||||
|
||||
@ -62,6 +71,9 @@ public:
|
||||
ModbusRtuMaster *modbusRtuMaster() const;
|
||||
quint16 slaveId() const;
|
||||
|
||||
ModbusDataUtils::ByteOrder endianness() const;
|
||||
void setEndianness(ModbusDataUtils::ByteOrder endianness);
|
||||
|
||||
/* Charging enabled - Address: 100, Size: 1 */
|
||||
quint16 chargingEnabled() const;
|
||||
ModbusRtuReply *setChargingEnabled(quint16 chargingEnabled);
|
||||
@ -94,24 +106,28 @@ public:
|
||||
/* Maximum charging current of connected cable [A] - Address: 128, Size: 1 */
|
||||
quint16 maxChargingCurrentCableE3() const;
|
||||
|
||||
/* Read block from start addess 126 with size of 3 registers containing following 3 properties:
|
||||
- Current charging Ampere [A] - Address: 126, Size: 1
|
||||
- Maximum charging current [A] - Address: 127, Size: 1
|
||||
- Maximum charging current of connected cable [A] - Address: 128, Size: 1
|
||||
*/
|
||||
void updateE3Block();
|
||||
/* Charging duration [ms] - Address: 151, Size: 2 */
|
||||
quint32 chargingDuration() const;
|
||||
|
||||
/* Plugged in duration [ms] - Address: 153, Size: 2 */
|
||||
quint32 pluggedInDuration() const;
|
||||
|
||||
/* Read block from start addess 126 with size of 3 registers containing following 3 properties:
|
||||
- Current charging Ampere [A] - Address: 126, Size: 1
|
||||
- Maximum charging current [A] - Address: 127, Size: 1
|
||||
- Maximum charging current of connected cable [A] - Address: 128, Size: 1
|
||||
*/
|
||||
void updateE3Block();
|
||||
|
||||
/* Read block from start addess 151 with size of 4 registers containing following 2 properties:
|
||||
- Charging duration [ms] - Address: 151, Size: 2
|
||||
- Plugged in duration [ms] - Address: 153, Size: 2
|
||||
*/
|
||||
void updateDurationsBlock();
|
||||
|
||||
virtual void initialize();
|
||||
virtual void update();
|
||||
|
||||
void updateChargingEnabled();
|
||||
void updateChargingCurrentSetpoint();
|
||||
void updateStatusBits();
|
||||
@ -120,11 +136,41 @@ public:
|
||||
void updateGridVoltage();
|
||||
void updateMinChargingCurrent();
|
||||
|
||||
virtual void initialize();
|
||||
virtual void update();
|
||||
void updateCurrentChargingCurrentE3();
|
||||
void updateMaxChargingCurrentE3();
|
||||
void updateMaxChargingCurrentCableE3();
|
||||
void updateChargingDuration();
|
||||
void updatePluggedInDuration();
|
||||
|
||||
ModbusRtuReply *readChargingEnabled();
|
||||
ModbusRtuReply *readChargingCurrentSetpoint();
|
||||
ModbusRtuReply *readStatusBits();
|
||||
ModbusRtuReply *readCpSignalState();
|
||||
ModbusRtuReply *readU1Voltage();
|
||||
ModbusRtuReply *readGridVoltage();
|
||||
ModbusRtuReply *readMinChargingCurrent();
|
||||
ModbusRtuReply *readCurrentChargingCurrentE3();
|
||||
ModbusRtuReply *readMaxChargingCurrentE3();
|
||||
ModbusRtuReply *readMaxChargingCurrentCableE3();
|
||||
ModbusRtuReply *readChargingDuration();
|
||||
ModbusRtuReply *readPluggedInDuration();
|
||||
|
||||
/* Read block from start addess 126 with size of 3 registers containing following 3 properties:
|
||||
- Current charging Ampere [A] - Address: 126, Size: 1
|
||||
- Maximum charging current [A] - Address: 127, Size: 1
|
||||
- Maximum charging current of connected cable [A] - Address: 128, Size: 1
|
||||
*/
|
||||
ModbusRtuReply *readBlockE3();
|
||||
|
||||
/* Read block from start addess 151 with size of 4 registers containing following 2 properties:
|
||||
- Charging duration [ms] - Address: 151, Size: 2
|
||||
- Plugged in duration [ms] - Address: 153, Size: 2
|
||||
*/
|
||||
ModbusRtuReply *readBlockDurations();
|
||||
|
||||
signals:
|
||||
void initializationFinished();
|
||||
void endiannessChanged(ModbusDataUtils::ByteOrder endianness);
|
||||
|
||||
void chargingEnabledChanged(quint16 chargingEnabled);
|
||||
void chargingCurrentSetpointChanged(quint16 chargingCurrentSetpoint);
|
||||
@ -140,14 +186,6 @@ signals:
|
||||
void pluggedInDurationChanged(quint32 pluggedInDuration);
|
||||
|
||||
protected:
|
||||
ModbusRtuReply *readChargingEnabled();
|
||||
ModbusRtuReply *readChargingCurrentSetpoint();
|
||||
ModbusRtuReply *readStatusBits();
|
||||
ModbusRtuReply *readCpSignalState();
|
||||
ModbusRtuReply *readU1Voltage();
|
||||
ModbusRtuReply *readGridVoltage();
|
||||
ModbusRtuReply *readMinChargingCurrent();
|
||||
|
||||
quint16 m_chargingEnabled = 0;
|
||||
quint16 m_chargingCurrentSetpoint = 6;
|
||||
quint16 m_statusBits = 85;
|
||||
@ -161,10 +199,27 @@ protected:
|
||||
quint32 m_chargingDuration = 0;
|
||||
quint32 m_pluggedInDuration = 0;
|
||||
|
||||
void processChargingEnabledRegisterValues(const QVector<quint16> values);
|
||||
void processChargingCurrentSetpointRegisterValues(const QVector<quint16> values);
|
||||
void processStatusBitsRegisterValues(const QVector<quint16> values);
|
||||
void processCpSignalStateRegisterValues(const QVector<quint16> values);
|
||||
void processU1VoltageRegisterValues(const QVector<quint16> values);
|
||||
void processGridVoltageRegisterValues(const QVector<quint16> values);
|
||||
void processMinChargingCurrentRegisterValues(const QVector<quint16> values);
|
||||
|
||||
void processCurrentChargingCurrentE3RegisterValues(const QVector<quint16> values);
|
||||
void processMaxChargingCurrentE3RegisterValues(const QVector<quint16> values);
|
||||
void processMaxChargingCurrentCableE3RegisterValues(const QVector<quint16> values);
|
||||
|
||||
void processChargingDurationRegisterValues(const QVector<quint16> values);
|
||||
void processPluggedInDurationRegisterValues(const QVector<quint16> values);
|
||||
|
||||
|
||||
private:
|
||||
ModbusRtuMaster *m_modbusRtuMaster = nullptr;
|
||||
quint16 m_slaveId = 1;
|
||||
QVector<ModbusRtuReply *> m_pendingInitReplies;
|
||||
ModbusDataUtils::ByteOrder m_endianness = ModbusDataUtils::ByteOrderBigEndian;
|
||||
|
||||
void verifyInitFinished();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user