[Add] English version work is done
This commit is contained in:
parent
d4ae45d1dc
commit
bfee5f9d49
|
@ -11,6 +11,7 @@ CONFIG += c++17
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
appproto.cpp \
|
appproto.cpp \
|
||||||
|
appproto_english.cpp \
|
||||||
batt.cpp \
|
batt.cpp \
|
||||||
chartpaint.cpp \
|
chartpaint.cpp \
|
||||||
custom/delegate.cpp \
|
custom/delegate.cpp \
|
||||||
|
@ -23,10 +24,12 @@ SOURCES += \
|
||||||
mainwindow.cpp \
|
mainwindow.cpp \
|
||||||
modbusrtu.cpp \
|
modbusrtu.cpp \
|
||||||
proto/battery.pb.cc \
|
proto/battery.pb.cc \
|
||||||
appserial.cpp
|
appserial.cpp \
|
||||||
|
proto/battery_english.pb.cc
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
appproto.h \
|
appproto.h \
|
||||||
|
appproto_english.h \
|
||||||
batt.h \
|
batt.h \
|
||||||
chartpaint.h \
|
chartpaint.h \
|
||||||
custom/delegate.h \
|
custom/delegate.h \
|
||||||
|
@ -42,7 +45,8 @@ HEADERS += \
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
modbusrtu.h \
|
modbusrtu.h \
|
||||||
proto/battery.pb.h \
|
proto/battery.pb.h \
|
||||||
appserial.h
|
appserial.h \
|
||||||
|
proto/battery_english.pb.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
dialoglogin.ui \
|
dialoglogin.ui \
|
||||||
|
|
Binary file not shown.
32
appproto.cpp
32
appproto.cpp
|
@ -15,38 +15,6 @@ AppProto::~AppProto()
|
||||||
|
|
||||||
void AppProto::init()
|
void AppProto::init()
|
||||||
{
|
{
|
||||||
// Battery::BCUList bcus;
|
|
||||||
// std::ifstream finBetteryData("battery.data", std::ios::binary);
|
|
||||||
// if(!bcus.ParseFromIstream(&finBetteryData)) {
|
|
||||||
// qDebug() << "Failed to parse BSU message.";
|
|
||||||
// // config message
|
|
||||||
// int bmuNum = 16;
|
|
||||||
// int cellNum = 26;
|
|
||||||
// for(int i = 0; i < bmuNum; i++) {
|
|
||||||
// bcus.add_bmus();
|
|
||||||
// bcus.mutable_bmus(i)->set_name("BUM" + QString("%1").arg(i+1).toStdString());
|
|
||||||
// for(int j = 0; j < cellNum; j++) {
|
|
||||||
// bcus.mutable_bmus(i)->add_cells();
|
|
||||||
// bcus.mutable_bmus(i)->mutable_cells(j)->set_name("Cell" + QString("%1").arg(j+1).toStdString());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// std::fstream foutBetteryData("battery.data",std::ios::out | std::ios::trunc | std::ios::binary);
|
|
||||||
// if(!bcus.SerializePartialToOstream(&foutBetteryData)) {
|
|
||||||
// qDebug() << "filed";
|
|
||||||
// }
|
|
||||||
// foutBetteryData.close();
|
|
||||||
// foutBetteryData.clear();
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// qDebug() << "bum num:" << bcus.bmus_size();
|
|
||||||
// for(int i = 0; i < bcus.bmus_size(); i++) {
|
|
||||||
// qDebug() << "bmu name:" << bcus.bmus(i).name().c_str() << "cell num:" << bcus.bmus(i).cells_size();
|
|
||||||
// for(int j = 0; j < bcus.bmus(i).cells_size(); j++) {
|
|
||||||
// qDebug() << "cell name:" << bcus.bmus(i).cells(j).name().c_str();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
BatteryConfig::Item item;
|
BatteryConfig::Item item;
|
||||||
std::ifstream finBetteryData("battery.data", std::ios::binary);
|
std::ifstream finBetteryData("battery.data", std::ios::binary);
|
||||||
if(!item.ParseFromIstream(&finBetteryData)) {
|
if(!item.ParseFromIstream(&finBetteryData)) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,30 @@
|
||||||
|
#ifndef APPPROTO_ENGLISH_H
|
||||||
|
#define APPPROTO_ENGLISH_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class Appproto_English : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit Appproto_English(QObject *parent = nullptr);
|
||||||
|
~Appproto_English();
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
|
public:
|
||||||
|
int itemCount = 0;
|
||||||
|
int itemCount_balance = 0;
|
||||||
|
int itemCount_DIDO = 0;
|
||||||
|
int itemCount_SOX = 0;
|
||||||
|
int itemCount_other = 0;
|
||||||
|
int itemCount_alert_value = 0;
|
||||||
|
int itemCount_alert_delay = 0;
|
||||||
|
int itemCount_alert_release_value = 0;
|
||||||
|
int itemCount_alert_release_delay = 0;
|
||||||
|
int itemCount_alert_dropcurr_rate = 0;
|
||||||
|
int itemCount_alert_solve_measure = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // APPPROTO_ENGLISH_H
|
|
@ -10,6 +10,7 @@
|
||||||
#include "appserial.h"
|
#include "appserial.h"
|
||||||
#include "modbusrtu.h"
|
#include "modbusrtu.h"
|
||||||
#include <windef.h>
|
#include <windef.h>
|
||||||
|
#include <QTranslator>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
DialogLogin::DialogLogin(QWidget *parent)
|
DialogLogin::DialogLogin(QWidget *parent)
|
||||||
|
@ -53,6 +54,9 @@ void DialogLogin::init()
|
||||||
ini = new QSettings("config.ini", QSettings::IniFormat);
|
ini = new QSettings("config.ini", QSettings::IniFormat);
|
||||||
connect(ui->btnConnect, &QPushButton::clicked, this, &DialogLogin::slot_btnConnect_clicked);
|
connect(ui->btnConnect, &QPushButton::clicked, this, &DialogLogin::slot_btnConnect_clicked);
|
||||||
|
|
||||||
|
// //将背景设置为白色
|
||||||
|
// ui->groupBox->setStyleSheet("background-color: #FFFFFF;");
|
||||||
|
|
||||||
// //传递BCU个数的信号与槽
|
// //传递BCU个数的信号与槽
|
||||||
// BCUNumbers = ui->comboBoxBCUQuantity->currentText().toInt();
|
// BCUNumbers = ui->comboBoxBCUQuantity->currentText().toInt();
|
||||||
// qDebug() << "the number of the BCU: " << BCUNumbers;
|
// qDebug() << "the number of the BCU: " << BCUNumbers;
|
||||||
|
@ -97,6 +101,11 @@ void DialogLogin::init()
|
||||||
m_ModbusRTU->quit();
|
m_ModbusRTU->quit();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//主窗口接受语言选择number的信号与槽的连接
|
||||||
|
connect(this, &DialogLogin::sendLanNumberSignals, m_MainWindow, &MainWindow::getLanNumberSlot);
|
||||||
|
|
||||||
|
|
||||||
// QMetaObject::invokeMethod(m_ModbusRTU,"read_regs_slot",Qt::QueuedConnection);
|
// QMetaObject::invokeMethod(m_ModbusRTU,"read_regs_slot",Qt::QueuedConnection);
|
||||||
// connect(m_ModbusRTU, &ModbusRTU::sig_readMoveToThread, m_ModbusRTU, &ModbusRTU::read_regs_slot, Qt::QueuedConnection);
|
// connect(m_ModbusRTU, &ModbusRTU::sig_readMoveToThread, m_ModbusRTU, &ModbusRTU::read_regs_slot, Qt::QueuedConnection);
|
||||||
// thread = new QThread;
|
// thread = new QThread;
|
||||||
|
@ -117,6 +126,8 @@ void DialogLogin::serialInit()
|
||||||
ui->comboBoxDataBits->setCurrentIndex(3);
|
ui->comboBoxDataBits->setCurrentIndex(3);
|
||||||
ui->comboBoxStopBits->setCurrentIndex(0);
|
ui->comboBoxStopBits->setCurrentIndex(0);
|
||||||
ui->comboBoxParity->setCurrentIndex(0);
|
ui->comboBoxParity->setCurrentIndex(0);
|
||||||
|
ui->comboBoxLanguage->setCurrentIndex(ini->value("System/Language").toUInt());
|
||||||
|
// qDebug() << "lan currentIndex false:" << ini->value("System/Language").toUInt();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui->comboBoxSerialPort->addItems(m_Serial->getAvailablePort());
|
ui->comboBoxSerialPort->addItems(m_Serial->getAvailablePort());
|
||||||
|
@ -124,6 +135,9 @@ void DialogLogin::serialInit()
|
||||||
ui->comboBoxDataBits->setCurrentIndex(ini->value("Serial/DataBits").toUInt());
|
ui->comboBoxDataBits->setCurrentIndex(ini->value("Serial/DataBits").toUInt());
|
||||||
ui->comboBoxStopBits->setCurrentIndex(ini->value("Serial/StopBits").toUInt());
|
ui->comboBoxStopBits->setCurrentIndex(ini->value("Serial/StopBits").toUInt());
|
||||||
ui->comboBoxParity->setCurrentIndex(ini->value("Serial/Parity").toUInt());
|
ui->comboBoxParity->setCurrentIndex(ini->value("Serial/Parity").toUInt());
|
||||||
|
ui->comboBoxLanguage->setCurrentIndex(ini->value("System/Language").toUInt());
|
||||||
|
// ui->comboBoxLanguage->setCurrentIndex(ini->value());
|
||||||
|
// qDebug() << "lan currentIndex " << ini->value("System/Language").toUInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,6 +188,30 @@ void DialogLogin::slot_btnConnect_clicked()
|
||||||
{
|
{
|
||||||
BCUNumbers = ui->comboBoxBCUQuantity->currentText().toInt();
|
BCUNumbers = ui->comboBoxBCUQuantity->currentText().toInt();
|
||||||
|
|
||||||
|
QString language = ui->comboBoxLanguage->currentText();
|
||||||
|
if (language == "English")
|
||||||
|
{
|
||||||
|
qDebug() << "ini lanuage index" << ini->value("System/Language");
|
||||||
|
ini->setValue("System/Language", 1);
|
||||||
|
ini->sync();
|
||||||
|
QTranslator trans;
|
||||||
|
emit sendLanNumberSignals(0);
|
||||||
|
trans.load(":/Language/BatteryMonitor_ENG.qm");
|
||||||
|
QApplication::installTranslator(&trans);
|
||||||
|
m_MainWindow->ui->retranslateUi(m_MainWindow);
|
||||||
|
}
|
||||||
|
else if (language == "Chinese")
|
||||||
|
{
|
||||||
|
qDebug() << "ini lanuage index" << ini->value("System/Language");
|
||||||
|
ini->setValue("System/Language", 0);
|
||||||
|
ini->sync();
|
||||||
|
emit sendLanNumberSignals(1);
|
||||||
|
QTranslator trans;
|
||||||
|
trans.load(":/Language/BatteryMonitor_CHN.qm");
|
||||||
|
QApplication::installTranslator(&trans);
|
||||||
|
m_MainWindow->ui->retranslateUi(m_MainWindow);
|
||||||
|
}
|
||||||
|
|
||||||
emit sendBCUNumberSignals(BCUNumbers);
|
emit sendBCUNumberSignals(BCUNumbers);
|
||||||
connect(this, &DialogLogin::sendBCUNumberSignals, m_MainWindow, &MainWindow::slot_getBcuNumberFromDialoglogin);
|
connect(this, &DialogLogin::sendBCUNumberSignals, m_MainWindow, &MainWindow::slot_getBcuNumberFromDialoglogin);
|
||||||
ini->setValue("Serial/BaudRate", ui->comboBoxBaudRate->currentIndex());
|
ini->setValue("Serial/BaudRate", ui->comboBoxBaudRate->currentIndex());
|
||||||
|
@ -263,6 +301,7 @@ void DialogLogin::slot_btnConnect_clicked()
|
||||||
// m_MainWindow->showMaximized();
|
// m_MainWindow->showMaximized();
|
||||||
// m_ModbusRTU->start();
|
// m_ModbusRTU->start();
|
||||||
m_ModbusRTU->start();
|
m_ModbusRTU->start();
|
||||||
|
m_MainWindow->showMaximized();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(ini->value("System/Language") == MainWindow::LANGUAGE_ENG) {
|
if(ini->value("System/Language") == MainWindow::LANGUAGE_ENG) {
|
||||||
|
|
|
@ -36,6 +36,7 @@ private:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendBCUNumberSignals(int number);
|
void sendBCUNumberSignals(int number);
|
||||||
|
void sendLanNumberSignals(int number);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slot_comChangeStatus(QString name, bool flag);
|
void slot_comChangeStatus(QString name, bool flag);
|
||||||
|
|
269
dialoglogin.ui
269
dialoglogin.ui
|
@ -20,93 +20,33 @@
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" colspan="2">
|
||||||
|
<widget class="QPushButton" name="btnConnect">
|
||||||
|
<property name="text">
|
||||||
|
<string>Connect</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Communication</string>
|
<string>Communication</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="9" column="3">
|
<item row="8" column="3">
|
||||||
<widget class="QComboBox" name="comboBoxParity">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>None</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Odd</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Even</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="3">
|
|
||||||
<widget class="QComboBox" name="comboBoxSerialPort"/>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="2">
|
|
||||||
<widget class="QLabel" name="labelBaudRate">
|
|
||||||
<property name="text">
|
|
||||||
<string>Baud Rate</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="3">
|
|
||||||
<widget class="QComboBox" name="comboBoxBaudRate">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>1200</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>2400</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>4800</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>9600</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>19200</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>38400</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>57600</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>115200</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="2">
|
|
||||||
<widget class="QLabel" name="labelSerialPort">
|
|
||||||
<property name="text">
|
|
||||||
<string>Serial Port</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="3">
|
|
||||||
<widget class="QComboBox" name="comboBoxDataBits">
|
<widget class="QComboBox" name="comboBoxDataBits">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -130,21 +70,10 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="2">
|
<item row="4" column="3">
|
||||||
<widget class="QLabel" name="labelStopBits">
|
<widget class="QComboBox" name="comboBoxSerialPort"/>
|
||||||
<property name="text">
|
|
||||||
<string>Stop Bits</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="2">
|
<item row="10" column="3">
|
||||||
<widget class="QLabel" name="labelParity">
|
|
||||||
<property name="text">
|
|
||||||
<string>Parity</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="3">
|
|
||||||
<widget class="QComboBox" name="comboBoxStopBits">
|
<widget class="QComboBox" name="comboBoxStopBits">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -158,14 +87,7 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="2">
|
<item row="2" column="3">
|
||||||
<widget class="QLabel" name="labelDataBits">
|
|
||||||
<property name="text">
|
|
||||||
<string>Data Bits</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3">
|
|
||||||
<widget class="QComboBox" name="comboBoxBCUQuantity">
|
<widget class="QComboBox" name="comboBoxBCUQuantity">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -249,36 +171,135 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="7" column="3">
|
||||||
|
<widget class="QComboBox" name="comboBoxBaudRate">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>1200</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>2400</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>4800</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>9600</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>19200</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>38400</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>57600</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>115200</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="2">
|
||||||
|
<widget class="QLabel" name="labelBaudRate">
|
||||||
|
<property name="text">
|
||||||
|
<string>Baud Rate</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="2">
|
||||||
|
<widget class="QLabel" name="labelStopBits">
|
||||||
|
<property name="text">
|
||||||
|
<string>Stop Bits</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
<widget class="QLabel" name="labelBCUQuantity">
|
<widget class="QLabel" name="labelBCUQuantity">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>BCU Quantity</string>
|
<string>BCU Quantity</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="2">
|
||||||
|
<widget class="QLabel" name="labelSerialPort">
|
||||||
|
<property name="text">
|
||||||
|
<string>Serial Port</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="11" column="2">
|
||||||
|
<widget class="QLabel" name="labelParity">
|
||||||
|
<property name="text">
|
||||||
|
<string>Parity</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="2">
|
||||||
|
<widget class="QLabel" name="labelDataBits">
|
||||||
|
<property name="text">
|
||||||
|
<string>Data Bits</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="11" column="3">
|
||||||
|
<widget class="QComboBox" name="comboBoxParity">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>None</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Odd</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Even</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="labelBCUQuantity_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Language</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QComboBox" name="comboBoxLanguage">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Chinese</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>English</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="2">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" colspan="2">
|
|
||||||
<widget class="QPushButton" name="btnConnect">
|
|
||||||
<property name="text">
|
|
||||||
<string>Connect</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
985
mainwindow.cpp
985
mainwindow.cpp
File diff suppressed because it is too large
Load Diff
|
@ -13,6 +13,7 @@ class QSettings;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QFile;
|
class QFile;
|
||||||
class AppProto;
|
class AppProto;
|
||||||
|
class Appproto_English;
|
||||||
class ChartPaint;
|
class ChartPaint;
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
@ -36,6 +37,7 @@ public:
|
||||||
QStandardItemModel *model;
|
QStandardItemModel *model;
|
||||||
ComLogin *m_ComLogin;
|
ComLogin *m_ComLogin;
|
||||||
AppProto *m_AppProto;
|
AppProto *m_AppProto;
|
||||||
|
Appproto_English *m_AppProto_English;
|
||||||
QSettings *ini;
|
QSettings *ini;
|
||||||
QFile *logFile;
|
QFile *logFile;
|
||||||
QLabel *statusBarConnectedIcon;
|
QLabel *statusBarConnectedIcon;
|
||||||
|
@ -58,6 +60,7 @@ public:
|
||||||
QList<int> base_info83_106;
|
QList<int> base_info83_106;
|
||||||
int battery_count;
|
int battery_count;
|
||||||
ModbusRTU *m_modbusrtu_main;
|
ModbusRTU *m_modbusrtu_main;
|
||||||
|
int lan;
|
||||||
|
|
||||||
int tabWidget_paraset_index = 0;
|
int tabWidget_paraset_index = 0;
|
||||||
|
|
||||||
|
@ -113,6 +116,7 @@ private:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// void setNum(QString value);
|
// void setNum(QString value);
|
||||||
|
void getLanNumberSlot(int number);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void showLogin();
|
void showLogin();
|
||||||
|
|
1497
mainwindow.ui
1497
mainwindow.ui
File diff suppressed because it is too large
Load Diff
|
@ -42,6 +42,7 @@ void ModbusRTU::run()
|
||||||
QList<int> base_list_47_49_51_53_55;
|
QList<int> base_list_47_49_51_53_55;
|
||||||
uint16_t sgl_vol[112]; // Buffer to store the registers
|
uint16_t sgl_vol[112]; // Buffer to store the registers
|
||||||
uint16_t sgl_tempt[112];
|
uint16_t sgl_tempt[112];
|
||||||
|
// uint16_t alarm[];
|
||||||
|
|
||||||
label: int ret_base1_45 = modbus_read_input_registers(m_ModbusRTUDevice, 1, 45, base1_45);
|
label: int ret_base1_45 = modbus_read_input_registers(m_ModbusRTUDevice, 1, 45, base1_45);
|
||||||
if(MODBUS_ERR == ret_base1_45)
|
if(MODBUS_ERR == ret_base1_45)
|
||||||
|
@ -100,7 +101,7 @@ void ModbusRTU::run()
|
||||||
if(MODBUS_ERR == ret_base57_78)
|
if(MODBUS_ERR == ret_base57_78)
|
||||||
{
|
{
|
||||||
// qDebug() << "modbus no message";
|
// qDebug() << "modbus no message";
|
||||||
return;
|
goto label;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -130,38 +131,38 @@ void ModbusRTU::run()
|
||||||
free(m_ModbusRTUDevice->recvMsg);
|
free(m_ModbusRTUDevice->recvMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret_vol = modbus_read_input_registers(m_ModbusRTUDevice, 1001, 112, sgl_vol);
|
// int ret_vol = modbus_read_input_registers(m_ModbusRTUDevice, 1001, 112, sgl_vol);
|
||||||
if(MODBUS_ERR == ret_vol)
|
// if(MODBUS_ERR == ret_vol)
|
||||||
{
|
// {
|
||||||
// qDebug() << "modbus no message";
|
// // qDebug() << "modbus no message";
|
||||||
goto label;
|
// goto label;
|
||||||
|
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
QByteArray sendArray = QByteArray::fromRawData(reinterpret_cast<char *>(m_ModbusRTUDevice->sendMsg), m_ModbusRTUDevice->sendMsgLen);
|
// QByteArray sendArray = QByteArray::fromRawData(reinterpret_cast<char *>(m_ModbusRTUDevice->sendMsg), m_ModbusRTUDevice->sendMsgLen);
|
||||||
emit sig_showModbusData(sendArray, TypeSendData);
|
// emit sig_showModbusData(sendArray, TypeSendData);
|
||||||
free(m_ModbusRTUDevice->sendMsg);
|
// free(m_ModbusRTUDevice->sendMsg);
|
||||||
QByteArray recvArray = QByteArray::fromRawData(reinterpret_cast<char *>(m_ModbusRTUDevice->recvMsg), m_ModbusRTUDevice->recvMsgLen);
|
// QByteArray recvArray = QByteArray::fromRawData(reinterpret_cast<char *>(m_ModbusRTUDevice->recvMsg), m_ModbusRTUDevice->recvMsgLen);
|
||||||
emit sig_showModbusData(recvArray, TypeRecvData);
|
// emit sig_showModbusData(recvArray, TypeRecvData);
|
||||||
free(m_ModbusRTUDevice->recvMsg);
|
// free(m_ModbusRTUDevice->recvMsg);
|
||||||
}
|
// }
|
||||||
|
|
||||||
int ret_tempt = modbus_read_input_registers(m_ModbusRTUDevice, 1601, 112, sgl_tempt);
|
// int ret_tempt = modbus_read_input_registers(m_ModbusRTUDevice, 1601, 112, sgl_tempt);
|
||||||
if(MODBUS_ERR == ret_tempt)
|
// if(MODBUS_ERR == ret_tempt)
|
||||||
{
|
// {
|
||||||
// qDebug() << "modbus no message";
|
// // qDebug() << "modbus no message";
|
||||||
goto label;
|
// goto label;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
QByteArray sendArray = QByteArray::fromRawData(reinterpret_cast<char *>(m_ModbusRTUDevice->sendMsg), m_ModbusRTUDevice->sendMsgLen);
|
// QByteArray sendArray = QByteArray::fromRawData(reinterpret_cast<char *>(m_ModbusRTUDevice->sendMsg), m_ModbusRTUDevice->sendMsgLen);
|
||||||
emit sig_showModbusData_sgl_tempt(sendArray, TypeSendData);
|
// emit sig_showModbusData_sgl_tempt(sendArray, TypeSendData);
|
||||||
free(m_ModbusRTUDevice->sendMsg);
|
// free(m_ModbusRTUDevice->sendMsg);
|
||||||
QByteArray recvArray = QByteArray::fromRawData(reinterpret_cast<char *>(m_ModbusRTUDevice->recvMsg), m_ModbusRTUDevice->recvMsgLen);
|
// QByteArray recvArray = QByteArray::fromRawData(reinterpret_cast<char *>(m_ModbusRTUDevice->recvMsg), m_ModbusRTUDevice->recvMsgLen);
|
||||||
emit sig_showModbusData_sgl_tempt(recvArray, TypeRecvData);
|
// emit sig_showModbusData_sgl_tempt(recvArray, TypeRecvData);
|
||||||
free(m_ModbusRTUDevice->recvMsg);
|
// free(m_ModbusRTUDevice->recvMsg);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
set local
|
||||||
|
:: 设置库路径
|
||||||
|
SET LIB_PATH=..\library\libprotobuf\lib
|
||||||
|
:: 设置环境变量
|
||||||
|
SET PATH=%LIB_PATH%;%PATH%
|
||||||
|
:: 设置protoc路径
|
||||||
|
SET PROTOC_PATH=..\library\libprotobuf\bin\protoc.exe
|
||||||
|
:: 编译proto文件
|
||||||
|
%PROTOC_PATH% --cpp_out=.\ *.proto
|
||||||
|
|
||||||
|
pause
|
||||||
|
endlocal
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,105 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package BatteryConfig_English;
|
||||||
|
|
||||||
|
message Item{
|
||||||
|
repeated Attributes ItemAttr = 1;
|
||||||
|
repeated Attributes_balance ItemAttr_balance = 2;
|
||||||
|
repeated Attributes_DIDO ItemAttr_DIDO = 3;
|
||||||
|
repeated Attributes_SOX ItemAttr_SOX = 4;
|
||||||
|
repeated Attributes_other ItemAttr_other = 5;
|
||||||
|
repeated Attributes_alert_value ItemAttr_alert_value = 6;
|
||||||
|
repeated Attributes_alert_delay ItemAttr_alert_delay = 7;
|
||||||
|
repeated Attributes_alert_release_value ItemAttr_alert_release_value = 8;
|
||||||
|
repeated Attributes_alert_release_delay ItemAttr_alert_release_delay = 9;
|
||||||
|
repeated Attributes_alert_dropcurr_rate ItemAttr_alert_dropcurr_rate = 10;
|
||||||
|
repeated Attributes_alert_solve_measure ItemAttr_alert_solve_measure = 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Attributes{
|
||||||
|
string name = 1;
|
||||||
|
int32 addr = 2;
|
||||||
|
int32 value = 3;
|
||||||
|
float scale = 4;
|
||||||
|
string introduce = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Attributes_balance{
|
||||||
|
string name = 1;
|
||||||
|
int32 addr = 2;
|
||||||
|
int32 value = 3;
|
||||||
|
float scale = 4;
|
||||||
|
string introduce = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Attributes_DIDO{
|
||||||
|
string name = 1;
|
||||||
|
int32 addr = 2;
|
||||||
|
int32 value = 3;
|
||||||
|
float scale = 4;
|
||||||
|
string introduce = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Attributes_SOX{
|
||||||
|
string name = 1;
|
||||||
|
int32 addr = 2;
|
||||||
|
int32 value = 3;
|
||||||
|
float scale = 4;
|
||||||
|
string introduce = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Attributes_other{
|
||||||
|
string name = 1;
|
||||||
|
int32 addr = 2;
|
||||||
|
int32 value = 3;
|
||||||
|
float scale = 4;
|
||||||
|
string introduce = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Attributes_alert_value{
|
||||||
|
string name = 1;
|
||||||
|
int32 addr = 2;
|
||||||
|
int32 value = 3;
|
||||||
|
float scale = 4;
|
||||||
|
string introduce = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Attributes_alert_delay{
|
||||||
|
string name = 1;
|
||||||
|
int32 addr = 2;
|
||||||
|
int32 value = 3;
|
||||||
|
float scale = 4;
|
||||||
|
string introduce = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Attributes_alert_release_value{
|
||||||
|
string name = 1;
|
||||||
|
int32 addr = 2;
|
||||||
|
int32 value = 3;
|
||||||
|
float scale = 4;
|
||||||
|
string introduce = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Attributes_alert_release_delay{
|
||||||
|
string name = 1;
|
||||||
|
int32 addr = 2;
|
||||||
|
int32 value = 3;
|
||||||
|
float scale = 4;
|
||||||
|
string introduce = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Attributes_alert_dropcurr_rate{
|
||||||
|
string name = 1;
|
||||||
|
int32 addr = 2;
|
||||||
|
int32 value = 3;
|
||||||
|
float scale = 4;
|
||||||
|
string introduce = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Attributes_alert_solve_measure{
|
||||||
|
string name = 1;
|
||||||
|
int32 addr = 2;
|
||||||
|
int32 value = 3;
|
||||||
|
float scale = 4;
|
||||||
|
string introduce = 5;
|
||||||
|
}
|
Loading…
Reference in New Issue