删除冗余代码,添加读取时间间隔配置
parent
999afb87e1
commit
f93959d19f
|
@ -290,7 +290,6 @@ void CustomDisplayPanel::UpdateAlarm(OpenJson &json)
|
|||
std::string title = node["signal"].s();
|
||||
std::string value = node["value"].s();
|
||||
|
||||
int col = 0;
|
||||
QTableWidgetItem *item0 = new QTableWidgetItem(QString::fromStdString(s));
|
||||
item0->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter); // 右对齐+垂直居中
|
||||
QTableWidgetItem *item1 = new QTableWidgetItem(QString::fromStdString(title));
|
||||
|
|
|
@ -10,6 +10,7 @@ baund=9600
|
|||
data=8
|
||||
parity=0
|
||||
stop=1
|
||||
interval=15
|
||||
|
||||
[slaves]
|
||||
slave_id=1
|
||||
|
|
|
@ -101,9 +101,13 @@ void FormSerialPortSettingDialog::InitializeUi()
|
|||
ui->cb_serialport->addItem(str,parts[0].trimmed());
|
||||
}
|
||||
|
||||
ui->interval->setText("10");
|
||||
|
||||
ui->buttonBox->clear();
|
||||
QPushButton *okButton = ui->buttonBox->addButton(QDialogButtonBox::Ok);
|
||||
QPushButton *cancelButton = ui->buttonBox->addButton(QDialogButtonBox::Cancel);
|
||||
okButton->setText(tr("OK"));
|
||||
cancelButton->setText(tr("Close"));
|
||||
okButton->setFixedSize(100, 30);
|
||||
cancelButton->setFixedSize(100, 30);
|
||||
|
||||
|
@ -142,12 +146,14 @@ void FormSerialPortSettingDialog::onOkClicked()
|
|||
int parity = ui->cb_parity->currentData().toInt();
|
||||
int stop = ui->cb_stop->currentData().toInt();
|
||||
int slave_id = ui->slave_id->text().toInt();
|
||||
int intervai = ui->interval->text().toInt();
|
||||
|
||||
pSettings->setValue("modbus/baund",baund);
|
||||
pSettings->setValue("modbus/com",com);
|
||||
pSettings->setValue("modbus/data",data);
|
||||
pSettings->setValue("modbus/parity",parity);
|
||||
pSettings->setValue("modbus/stop",stop);
|
||||
pSettings->setValue("modbus/interval",intervai);
|
||||
pSettings->setValue("slaves/slave_id",slave_id);
|
||||
|
||||
accept();
|
||||
|
|
|
@ -152,7 +152,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>186</y>
|
||||
<y>184</y>
|
||||
<width>41</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
|
@ -186,7 +186,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>183</y>
|
||||
<y>181</y>
|
||||
<width>113</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
|
@ -258,6 +258,50 @@
|
|||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>540</x>
|
||||
<y>183</y>
|
||||
<width>41</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="interval">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>181</y>
|
||||
<width>113</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>187</y>
|
||||
<width>71</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>读取间隔</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>delay_timeout</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
|
|
@ -22,101 +22,6 @@
|
|||
|
||||
#define _DEBUG_VSPD_
|
||||
|
||||
#define TH08D_TEMPERATURE_EQUIPMENT_81_00_09 40000
|
||||
#define TH08D_TEMPERATURE_EQUIPMENT_81_09_06 40009
|
||||
|
||||
void DecodeWorker::setSlaveAddress(const slaveAddress& sa)
|
||||
{
|
||||
m_slaveAddress = sa;
|
||||
}
|
||||
// 处理数组的槽函数
|
||||
void DecodeWorker::processArray(const QVector<uint16_t>& array,int slave_id,int start_addr,int quantity,DeviceData* pData)
|
||||
{
|
||||
switch (start_addr)
|
||||
{
|
||||
case TH08D_TEMPERATURE_EQUIPMENT_81_00_09:
|
||||
{
|
||||
assert(pData->m_device_type == 81);
|
||||
|
||||
TemperatureData* pTemperature = (TemperatureData*)pData;
|
||||
|
||||
uint16_t value;
|
||||
int index = 0;
|
||||
pTemperature->m_device_online_state = array[index++]; //设备通讯状态
|
||||
pTemperature->TempValue = (float)array[index++] * 1.0f / 10.f; //温度
|
||||
pTemperature->HumidityValue = (float)array[index++] * 1.0f / 10.f; //湿度
|
||||
pTemperature->DewPointValue = (float)array[index++] * 1.0f; //露点
|
||||
value = array[index++]; //跳过温度偏移量
|
||||
value = array[index++]; //跳过湿度偏移量
|
||||
pTemperature->DO= array[index++]; //DO
|
||||
pTemperature->DI1 = array[index++]; //DI1
|
||||
pTemperature->DI2 = array[index++]; //DI2
|
||||
pTemperature->bDecodeAlarm = false;
|
||||
pTemperature->bDecodeTemp = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case TH08D_TEMPERATURE_EQUIPMENT_81_09_06:
|
||||
{
|
||||
assert(pData->m_device_type == 81);
|
||||
|
||||
TemperatureData* pTemperature = (TemperatureData*)pData;
|
||||
pTemperature->bDecodeAlarm = true;
|
||||
pTemperature->bDecodeTemp = false;
|
||||
|
||||
uint16_t value;
|
||||
int index = 0;
|
||||
float temp_threshold = (float)array[index++] * 1.0f / 10.f; //温度阈值
|
||||
float temp_offset = (float)array[index++] * 1.0f / 10.f; //温控偏移量
|
||||
value = array[index++]; //跳过设备状态
|
||||
pTemperature->TempHighAlarm = array[index++]; //高温告警
|
||||
pTemperature->HumidityHighAlarm = array[index++]; //高湿度告警
|
||||
pTemperature->TempLowAlarm = array[index++]; //低温告警
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//下面是模拟发送进度
|
||||
//for (int i = 0; i < array.size(); ++i)
|
||||
//{
|
||||
// qDebug() << "Worker处理索引:" << i << "值:" << array[i]
|
||||
// << "线程:" << QThread::currentThread();
|
||||
// //QThread::msleep(100); // 模拟耗时处理
|
||||
// emit progress(i);
|
||||
//}
|
||||
|
||||
qDebug() << "Worker thread finished";
|
||||
emit finished();
|
||||
}
|
||||
|
||||
void DecodeWorker::processRegisterData(const QVector<uint16_t> &array, const slaveAddress& sa, DeviceData *pData)
|
||||
{
|
||||
GeneralDeviceData* pGeneralData = (GeneralDeviceData*)pData;
|
||||
RegisterDataItems::const_iterator iter = sa.register_data_items.begin();
|
||||
int idx = 0;
|
||||
for(; iter!=sa.register_data_items.end(); iter++)
|
||||
{
|
||||
if (iter->second.skip ==0)
|
||||
{
|
||||
DisplayDataItem ddi;
|
||||
ddi.device_type = sa.device_type;
|
||||
ddi.display_location = iter->second.display;
|
||||
ddi.order = iter->second.order;
|
||||
ddi.precision = iter->second.precision;
|
||||
ddi.title = iter->second.title_chn;
|
||||
ddi.unit = iter->second.unit;
|
||||
ddi.value = array[idx];
|
||||
pGeneralData->m_PanelDisplayDataItems.emplace_back(ddi);
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
|
@ -124,7 +29,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
,m_pTimer(nullptr)
|
||||
,m_pSettings(nullptr)
|
||||
,m_bInitializeModbus(false)
|
||||
|
||||
,m_timer_interval(10)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -182,6 +87,8 @@ void MainWindow::getConfiguration(QString iniFilePath)
|
|||
m_modbus_parity = m_pSettings->value("modbus/parity").toInt();
|
||||
m_modbus_stop = m_pSettings->value("modbus/stop").toInt();
|
||||
|
||||
m_timer_interval = m_pSettings->value("modbus/interval").toInt();
|
||||
|
||||
#if 0
|
||||
m_modbus_slave_id = m_pSettings->value("slaves/slave_id").toInt();
|
||||
|
||||
|
@ -519,6 +426,12 @@ bool MainWindow::InitializeUI()
|
|||
connect(actionSetting, &QAction::triggered, this, &MainWindow::SettingSerialPort);
|
||||
connect(actionRead, &QAction::triggered, this, &MainWindow::ReadSerialPortData);
|
||||
|
||||
//读一下配置
|
||||
QString appDir = QCoreApplication::applicationDirPath();
|
||||
QString iniFilePath = appDir + QString::fromStdString("/emsshower.ini");
|
||||
|
||||
getConfiguration(iniFilePath);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -609,61 +522,6 @@ bool MainWindow::InitializeTcp()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool MainWindow::readRegister(int addr,int nb,uint16_t* dest)
|
||||
{
|
||||
if(!InitializeModbus()) //这里有问题,如果是虚拟串口,连接的通常会返回成功
|
||||
{
|
||||
ui->statusbar->showMessage(tr("Failed to open Modbus device,Check modbus connection please!")); //打开MODBUS设备失败,请检查设备连接情况!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto it = m_SlaveData.begin(); it != m_SlaveData.end(); ++it)
|
||||
{
|
||||
SlaveItem* pItem = (SlaveItem*)(*it);
|
||||
|
||||
uint16_t* tab_reg = new uint16_t[pItem->quantity];
|
||||
int regs = modbus_read_registers(m_pModbus, pItem->start_address, pItem->quantity, tab_reg);
|
||||
|
||||
QVector<uint16_t> registers;
|
||||
for (int i = 0; i < regs; ++i)
|
||||
{
|
||||
registers.push_back(tab_reg[i]);
|
||||
}
|
||||
|
||||
delete []tab_reg;
|
||||
|
||||
DeviceData* pDevice = nullptr;
|
||||
|
||||
if (pItem->start_address == TH08D_TEMPERATURE_EQUIPMENT_81_00_09
|
||||
|| pItem->start_address == TH08D_TEMPERATURE_EQUIPMENT_81_09_06)
|
||||
pDevice = new TemperatureData();
|
||||
|
||||
startAsyncProcess(registers,pItem->id,pItem->start_address, pItem->quantity, pDevice);
|
||||
|
||||
if (pItem->start_address == TH08D_TEMPERATURE_EQUIPMENT_81_00_09
|
||||
|| pItem->start_address == TH08D_TEMPERATURE_EQUIPMENT_81_09_06)
|
||||
{
|
||||
TemperatureData* pData = (TemperatureData*)pDevice;
|
||||
assert(pData);
|
||||
OpenJson json;
|
||||
if(CreateJson(pData,json))
|
||||
{
|
||||
if(pData->bDecodeTemp)
|
||||
m_pTemperaturePanel->UpdateData(json);
|
||||
if(pData->bDecodeAlarm)
|
||||
m_pAlarmPanel->UpdateAlarm(json);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->statusbar->showMessage(tr("Failed to decode temperaure data")); //解析温度数据失败!"));
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "同步读取地址" << pItem->start_address;
|
||||
delete pDevice;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MainWindow::readRegister()
|
||||
{
|
||||
|
@ -698,9 +556,14 @@ bool MainWindow::readRegister()
|
|||
DecodeSync(registers, *iterAddress, pDevice);
|
||||
|
||||
OpenJson json;
|
||||
CreateJson2(pDevice,json);
|
||||
|
||||
m_Panels[iterAddress->device_type]->UpdateData(json);
|
||||
if(CreateJson2(pDevice,json))
|
||||
{
|
||||
m_Panels[iterAddress->device_type]->UpdateData(json);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->statusbar->showMessage(tr("Failed to decode temperaure data")); //解析温度数据失败!"));
|
||||
}
|
||||
|
||||
delete pDevice;
|
||||
|
||||
|
@ -737,78 +600,6 @@ void MainWindow::DecodeSync(const QVector<uint16_t>& array,const slaveAddress& s
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::startAsyncProcess(const QVector<uint16_t>& array,int slave_id,int start_addr,int quantity, DeviceData* pDevice)
|
||||
{
|
||||
QThread* thread = new QThread;
|
||||
DecodeWorker* worker = new DecodeWorker;
|
||||
worker->moveToThread(thread);
|
||||
|
||||
worker->setParameters(array, slave_id, start_addr, quantity, pDevice);
|
||||
|
||||
// 连接线程启动信号和槽函数
|
||||
connect(this, &MainWindow::startProcessing, worker, &DecodeWorker::processArray);
|
||||
|
||||
// 工作完成后退出线程
|
||||
connect(worker, &DecodeWorker::finished, thread, &QThread::quit);
|
||||
connect(worker, &DecodeWorker::finished, worker, &DecodeWorker::deleteLater);
|
||||
connect(thread, &QThread::finished, thread, &QThread::deleteLater);
|
||||
|
||||
//// 可选:连接进度信号更新UI
|
||||
//connect(worker, &DecodeWorker::progress, this, [](int index)
|
||||
//{
|
||||
// qDebug() << "进度更新,当前处理到索引:" << index;
|
||||
//});
|
||||
|
||||
thread->start();
|
||||
|
||||
QEventLoop loop;
|
||||
QObject::connect(worker, &DecodeWorker::finished, &loop, &QEventLoop::quit);
|
||||
|
||||
// 发射信号传递参数
|
||||
emit startProcessing(array, slave_id, start_addr, quantity, pDevice);
|
||||
|
||||
// 阻塞,等待线程结束
|
||||
loop.exec();
|
||||
|
||||
qDebug() << "同步读取完成";
|
||||
}
|
||||
|
||||
void MainWindow::startAsyncProcess2(const QVector<uint16_t> &array, const slaveAddress& sa,DeviceData *pData)
|
||||
{
|
||||
QThread* thread = new QThread;
|
||||
DecodeWorker* worker = new DecodeWorker;
|
||||
worker->moveToThread(thread);
|
||||
|
||||
worker->setSlaveAddress(sa);
|
||||
|
||||
// 连接线程启动信号和槽函数
|
||||
connect(this, &MainWindow::startProcessing2, worker, &DecodeWorker::processRegisterData);
|
||||
|
||||
// 工作完成后退出线程
|
||||
connect(worker, &DecodeWorker::finished, thread, &QThread::quit);
|
||||
connect(worker, &DecodeWorker::finished, worker, &DecodeWorker::deleteLater);
|
||||
connect(thread, &QThread::finished, thread, &QThread::deleteLater);
|
||||
|
||||
//// 可选:连接进度信号更新UI
|
||||
//connect(worker, &DecodeWorker::progress, this, [](int index)
|
||||
//{
|
||||
// qDebug() << "进度更新,当前处理到索引:" << index;
|
||||
//});
|
||||
|
||||
thread->start();
|
||||
|
||||
QEventLoop loop;
|
||||
QObject::connect(worker, &DecodeWorker::finished, &loop, &QEventLoop::quit);
|
||||
|
||||
// 发射信号传递参数
|
||||
emit startProcessing2(array,sa, pData);
|
||||
|
||||
// 阻塞,等待线程结束
|
||||
loop.exec();
|
||||
|
||||
qDebug() << "同步读取完成";
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::ReadSerialPortData()
|
||||
{
|
||||
|
@ -822,7 +613,7 @@ void MainWindow::ReadSerialPortData()
|
|||
}
|
||||
else
|
||||
{
|
||||
m_pTimer->setInterval(10 * 1000); // 10秒
|
||||
m_pTimer->setInterval(m_timer_interval * 1000);
|
||||
connect(m_pTimer, &QTimer::timeout, this, &MainWindow::onTimeout);
|
||||
ui->statusbar->showMessage(tr("Begin Reading"));
|
||||
m_pTimer->start();
|
||||
|
@ -832,7 +623,6 @@ void MainWindow::ReadSerialPortData()
|
|||
|
||||
void MainWindow::onTimeout()
|
||||
{
|
||||
//readRegister(0,0,0);
|
||||
readRegister();
|
||||
}
|
||||
|
||||
|
@ -849,94 +639,6 @@ void MainWindow::SettingSerialPort()
|
|||
}
|
||||
|
||||
|
||||
bool MainWindow::CreateJson(DeviceData* pData,OpenJson& json)
|
||||
{
|
||||
int data_type = pData->m_device_type;
|
||||
if (data_type == 81) //根据协议定义的设备id进行分类,参考DeviceData定义
|
||||
{
|
||||
TemperatureData* pTempData = (TemperatureData*)pData;
|
||||
if (pTempData->bDecodeTemp)
|
||||
{
|
||||
json["panel_type"] = CustomDisplayPanel::PANEL_TEMPERATURE;
|
||||
|
||||
auto& nodeLabel = json["text_panel"];
|
||||
nodeLabel[0]["value"] = pTempData->m_device_online_state;
|
||||
nodeLabel[0]["title"] = "Online";
|
||||
|
||||
nodeLabel[1]["value"] = pTempData->TempValue;
|
||||
nodeLabel[1]["title"] = "T (℃) ";
|
||||
|
||||
nodeLabel[2]["value"] = pTempData->HumidityValue;
|
||||
nodeLabel[2]["title"] = "RH (%)";
|
||||
|
||||
auto& nodeTable = json["table"];
|
||||
int i = 0;
|
||||
|
||||
nodeTable[i]["value"] = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss").toStdString();
|
||||
nodeTable[i]["signal"] = "Time";
|
||||
|
||||
i++;
|
||||
nodeTable[i]["value"] = pTempData->DewPointValue;
|
||||
nodeTable[i]["signal"] = "Dew Point";
|
||||
|
||||
i++;
|
||||
nodeTable[i]["value"] = pTempData->DO;
|
||||
nodeTable[i]["signal"] = "DO";
|
||||
|
||||
i++;
|
||||
nodeTable[i]["value"] = pTempData->DI1;
|
||||
nodeTable[i]["signal"] = "DI1";
|
||||
|
||||
i++;
|
||||
nodeTable[i]["value"] = pTempData->DI2;
|
||||
nodeTable[i]["signal"] = "DI2";
|
||||
|
||||
std::string a = json.encode();
|
||||
|
||||
qDebug() << QString::fromStdString(a);
|
||||
}
|
||||
|
||||
if (pTempData->bDecodeAlarm)
|
||||
{
|
||||
json["panel_type"] = CustomDisplayPanel::PANEL_ALARM;
|
||||
auto& nodeTable = json["alarm"];
|
||||
|
||||
int i = -1;
|
||||
if(pTempData->TempHighAlarm != 0)
|
||||
{
|
||||
i++;
|
||||
nodeTable[i]["time"] = QDateTime::currentDateTime().toString("MM-dd HH:mm:ss").toStdString();
|
||||
nodeTable[i]["signal"] = "High Temperature";
|
||||
nodeTable[i]["value"] = pTempData->TempHighAlarm;
|
||||
}
|
||||
|
||||
if(pTempData->TempLowAlarm != 0)
|
||||
{
|
||||
i++;
|
||||
nodeTable[i]["time"] = QDateTime::currentDateTime().toString("MM-dd HH:mm:ss").toStdString();
|
||||
nodeTable[i]["signal"] = "High Temperature";
|
||||
nodeTable[i]["value"] = pTempData->TempLowAlarm;
|
||||
}
|
||||
|
||||
if(pTempData->HumidityHighAlarm != 0)
|
||||
{
|
||||
i++;
|
||||
nodeTable[i]["time"] = QDateTime::currentDateTime().toString("MM-dd HH:mm:ss").toStdString();
|
||||
nodeTable[i]["signal"] = "High Humidity";
|
||||
nodeTable[i]["value"] = pTempData->HumidityHighAlarm;
|
||||
}
|
||||
|
||||
std::string a = json.encode();
|
||||
|
||||
qDebug() << QString::fromStdString(a);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainWindow::CreateJson2(DeviceData* pData,OpenJson& json)
|
||||
{
|
||||
assert(pData);
|
||||
|
|
|
@ -27,44 +27,6 @@ typedef enum _tagModbusMode : int
|
|||
modeTcp = 1,
|
||||
} ModbusMode;
|
||||
|
||||
//这是解码类,针对协议进行解码
|
||||
class DecodeWorker : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DecodeWorker(QObject* parent = nullptr) : QObject(parent) {}
|
||||
void setParameters(const QVector<uint16_t>& array, int slave_id, int start_addr, int quantity, DeviceData* pDevice)
|
||||
{
|
||||
this->array = array;
|
||||
this->slave_id = slave_id;
|
||||
this->start_addr = start_addr;
|
||||
this->quantity = quantity;
|
||||
this->pDevice = pDevice;
|
||||
}
|
||||
|
||||
void setSlaveAddress(const slaveAddress& sa);
|
||||
|
||||
private:
|
||||
QVector<uint16_t> array;
|
||||
int slave_id;
|
||||
int start_addr;
|
||||
int quantity;
|
||||
DeviceData* pDevice;
|
||||
slaveAddress m_slaveAddress;
|
||||
|
||||
signals:
|
||||
// 处理进度信号
|
||||
void progress(int index);
|
||||
// 完成处理信号
|
||||
void finished();
|
||||
|
||||
public slots:
|
||||
// 处理数组的槽函数
|
||||
// 根据从机id、开始地址、寄存器数量三个变量进行辨别和解码处理
|
||||
void processArray(const QVector<uint16_t>& array,int slave_id,int start_addr,int quantity,DeviceData* pData);
|
||||
|
||||
void processRegisterData(const QVector<uint16_t>& array,const slaveAddress& sa,DeviceData* pData);
|
||||
};
|
||||
|
||||
//处理主界面
|
||||
class MainWindow : public QMainWindow
|
||||
|
@ -83,7 +45,6 @@ protected:
|
|||
bool InitializeRtu();
|
||||
bool InitializeTcp();
|
||||
|
||||
bool readRegister(int addr,int nb,uint16_t* dest);
|
||||
bool readRegister();
|
||||
|
||||
private:
|
||||
|
@ -106,13 +67,11 @@ protected:
|
|||
int m_modbus_slave_id;
|
||||
QSettings* m_pSettings;
|
||||
bool m_bInitializeModbus;
|
||||
int m_timer_interval;
|
||||
|
||||
SlaveItems m_total_slave_items;
|
||||
|
||||
protected:
|
||||
//异步处理数据
|
||||
void startAsyncProcess(const QVector<uint16_t>& array,int slave_id,int start_addr,int quantity,DeviceData* pData);
|
||||
void startAsyncProcess2(const QVector<uint16_t>& array,const slaveAddress& sa,DeviceData* pData);
|
||||
|
||||
private slots:
|
||||
void ReadSerialPortData();
|
||||
|
@ -131,7 +90,6 @@ private:
|
|||
std::map<int,CustomDisplayPanel*> m_Panels;
|
||||
|
||||
private:
|
||||
bool CreateJson(DeviceData* pData,OpenJson& json);
|
||||
bool CreateJson2(DeviceData* pData,OpenJson& json);
|
||||
void DecodeSync(const QVector<uint16_t>& array,const slaveAddress& sa,DeviceData* pData); //同步解码
|
||||
|
||||
|
|
Loading…
Reference in New Issue