测试了配置
parent
c0ec038847
commit
02666e647b
|
@ -123,7 +123,7 @@ void CustomDisplayPanel::Build()
|
|||
|
||||
// 设置列宽策略
|
||||
tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);
|
||||
tableWidget->setColumnWidth(0, 200);
|
||||
tableWidget->setColumnWidth(0, 250);
|
||||
tableWidget->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
|
||||
//tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
//tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
|
@ -153,23 +153,23 @@ void CustomDisplayPanel::Build()
|
|||
}
|
||||
|
||||
|
||||
void CustomDisplayPanel::UpdateData(OpenJson& json)
|
||||
void CustomDisplayPanel::UpdateData(OpenJson& json,bool app/*=false*/)
|
||||
{
|
||||
int panel_type = json["panel_type"].i32();
|
||||
qDebug() << panel_type;
|
||||
|
||||
if (panel_type == CustomDisplayPanel::PANEL_ALARM)
|
||||
{
|
||||
UpdateAlarm(json);
|
||||
UpdateAlarm(json,app);
|
||||
}
|
||||
|
||||
else //(panel_type == CustomDisplayPanel::PANEL_TEMPERATURE)
|
||||
{
|
||||
UpdateTemperature(json);
|
||||
UpdateTemperature(json,app);
|
||||
}
|
||||
}
|
||||
|
||||
void CustomDisplayPanel::UpdateTemperature(OpenJson &json)
|
||||
void CustomDisplayPanel::UpdateTemperature(OpenJson &json,bool app/*=false*/)
|
||||
{
|
||||
auto& nodeLabel = json["text_panel"];
|
||||
qDebug() << "text_panel: " << nodeLabel.size();
|
||||
|
@ -220,8 +220,23 @@ void CustomDisplayPanel::UpdateTemperature(OpenJson &json)
|
|||
auto& nodeTable = json["table"];
|
||||
qDebug() << "table: "<< nodeTable.size();
|
||||
|
||||
m_pTableWidget->clear();
|
||||
m_pTableWidget->setRowCount(nodeTable.size());
|
||||
if (!app)
|
||||
{
|
||||
m_pTableWidget->clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "table append";
|
||||
}
|
||||
|
||||
int rows = m_pTableWidget->rowCount();
|
||||
if (rows > 162) //电池模块中的参数最大数量
|
||||
{
|
||||
m_pTableWidget->clear();
|
||||
rows = 0;
|
||||
}
|
||||
|
||||
m_pTableWidget->setRowCount(nodeTable.size()+rows);
|
||||
|
||||
// 加载字体
|
||||
int fontId = QFontDatabase::addApplicationFont(":/fonts/Alimama_DongFangDaKai_Regular.ttf");
|
||||
|
@ -246,7 +261,7 @@ void CustomDisplayPanel::UpdateTemperature(OpenJson &json)
|
|||
QFont font;
|
||||
//font.setFamily("Alimama DongFangDaKai");
|
||||
font.setFamily("Arial");
|
||||
font.setPixelSize(20);
|
||||
font.setPixelSize(16);
|
||||
font.setBold(true);
|
||||
item->setFont(font);
|
||||
//item->setForeground(QBrush(QColor("#2E86C1")));
|
||||
|
@ -260,7 +275,7 @@ void CustomDisplayPanel::UpdateTemperature(OpenJson &json)
|
|||
|
||||
QFont font2;
|
||||
font2.setFamily("Arial");
|
||||
font2.setPixelSize(20);
|
||||
font2.setPixelSize(16);
|
||||
//font2.setBold(true);
|
||||
item2->setFont(font2);
|
||||
//item2->setForeground(QBrush(QColor("#2E86C1")));
|
||||
|
@ -270,7 +285,7 @@ void CustomDisplayPanel::UpdateTemperature(OpenJson &json)
|
|||
}
|
||||
}
|
||||
|
||||
void CustomDisplayPanel::UpdateAlarm(OpenJson &json)
|
||||
void CustomDisplayPanel::UpdateAlarm(OpenJson &json,bool app/*=false*/)
|
||||
{
|
||||
qDebug() << "更新告警信息";
|
||||
QFont font;
|
||||
|
|
|
@ -87,10 +87,10 @@ public:
|
|||
|
||||
public:
|
||||
//更新数据
|
||||
void UpdateData(OpenJson& json);
|
||||
void UpdateData(OpenJson& json,bool app=false);
|
||||
|
||||
void UpdateTemperature(OpenJson& json);
|
||||
void UpdateAlarm(OpenJson& json);
|
||||
void UpdateTemperature(OpenJson& json,bool app=false);
|
||||
void UpdateAlarm(OpenJson& json,bool app=false);
|
||||
public:
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -284,7 +284,7 @@
|
|||
"precision":1,
|
||||
"unit":"V",
|
||||
"title_chn":"相电压AB/A",
|
||||
"title_eng":"Vin AB/A",
|
||||
"title_eng":"V_A",
|
||||
"display":1,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -294,7 +294,7 @@
|
|||
"precision":1,
|
||||
"unit":"V",
|
||||
"title_chn":"相电压BC/B",
|
||||
"title_eng":"Vin BC/B",
|
||||
"title_eng":"V_B",
|
||||
"display":1,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -304,7 +304,7 @@
|
|||
"precision":1,
|
||||
"unit":"V",
|
||||
"title_chn":"相电压CA/C",
|
||||
"title_eng":"Vin CA/C",
|
||||
"title_eng":"V_C",
|
||||
"display":1,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -334,7 +334,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"输出电流A",
|
||||
"title_eng":"IAout",
|
||||
"title_eng":"IA",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -344,7 +344,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"输出电流B",
|
||||
"title_eng":"IBout",
|
||||
"title_eng":"IB",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -354,7 +354,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"输出电流C",
|
||||
"title_eng":"ICout",
|
||||
"title_eng":"IC",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -374,7 +374,7 @@
|
|||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"系统供电方式",
|
||||
"title_eng":"Pwr Supply Mode",
|
||||
"title_eng":"Power Supply Mode",
|
||||
"display":2,
|
||||
"skip":0
|
||||
}
|
||||
|
@ -405,7 +405,7 @@
|
|||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"相电压AB/A",
|
||||
"title_eng":"Vin AB/A",
|
||||
"title_eng":"V_A",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -415,7 +415,7 @@
|
|||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"相电压BC/B",
|
||||
"title_eng":"Vin BC/B",
|
||||
"title_eng":"V_B",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -425,7 +425,7 @@
|
|||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"相电压CA/C",
|
||||
"title_eng":"Vin CA/C",
|
||||
"title_eng":"V_C",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -465,7 +465,7 @@
|
|||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"A相输入电流",
|
||||
"title_eng":"Iin A",
|
||||
"title_eng":"IA",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -475,7 +475,7 @@
|
|||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"B相输入电流",
|
||||
"title_eng":"Iin B",
|
||||
"title_eng":"IB",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -485,7 +485,7 @@
|
|||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"C相输入电流",
|
||||
"title_eng":"Iin C",
|
||||
"title_eng":"IC",
|
||||
"display":2,
|
||||
"skip":0
|
||||
}
|
||||
|
@ -603,7 +603,7 @@
|
|||
{
|
||||
"comment":"模块2输入电压",
|
||||
"order":10,
|
||||
"precision":2,
|
||||
"precision":1,
|
||||
"unit":"V",
|
||||
"title_chn":"模块2输入电压",
|
||||
"title_eng":"Vin #2",
|
||||
|
@ -653,7 +653,7 @@
|
|||
{
|
||||
"comment":"模块3输入电压",
|
||||
"order":15,
|
||||
"precision":2,
|
||||
"precision":1,
|
||||
"unit":"V",
|
||||
"title_chn":"模块3输入电压",
|
||||
"title_eng":"Vin #3",
|
||||
|
@ -703,7 +703,7 @@
|
|||
{
|
||||
"comment":"模块4输入电压",
|
||||
"order":20,
|
||||
"precision":2,
|
||||
"precision":1,
|
||||
"unit":"V",
|
||||
"title_chn":"模块4输入电压",
|
||||
"title_eng":"Vin #4",
|
||||
|
@ -894,7 +894,7 @@
|
|||
{
|
||||
"comment":"模块4未授权告警",
|
||||
"order":15,
|
||||
"precision":4,
|
||||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"模块4未授权告警",
|
||||
"title_eng":"Rect. #4 unauthorized access",
|
||||
|
@ -915,7 +915,7 @@
|
|||
},
|
||||
{
|
||||
"start_addr":2048,
|
||||
"quantity":20,
|
||||
"quantity":30,
|
||||
"bytes_per_register":2,
|
||||
"language":"en",
|
||||
"device_name_chn":"直流配电",
|
||||
|
@ -938,7 +938,7 @@
|
|||
"precision":1,
|
||||
"unit":"V",
|
||||
"title_chn":"直流输出电压",
|
||||
"title_eng":"DC Vout",
|
||||
"title_eng":"D.C. Vout",
|
||||
"display":1,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -948,7 +948,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"总负载电流",
|
||||
"title_eng":"I_load",
|
||||
"title_eng":"Load Current",
|
||||
"display":1,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -988,7 +988,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"分路电池电流1",
|
||||
"title_eng":"Branch #1 Current",
|
||||
"title_eng":"#1 Current",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -998,7 +998,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"分路电池电流2",
|
||||
"title_eng":"Branch #2 Current",
|
||||
"title_eng":"#2 Current",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -1008,7 +1008,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"分路电池电流3",
|
||||
"title_eng":"Branch #3 Current",
|
||||
"title_eng":"#3 Current",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -1018,7 +1018,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"分路电池电流4",
|
||||
"title_eng":"Branch #4 Current",
|
||||
"title_eng":"#4 Current",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -1028,7 +1028,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"分路电池电流5",
|
||||
"title_eng":"Branch #5 Current",
|
||||
"title_eng":"#5 Current",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -1038,7 +1038,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"分路电池电流6",
|
||||
"title_eng":"Branch #6 Current",
|
||||
"title_eng":"#6 Current",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -1048,7 +1048,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"分路电池电流7",
|
||||
"title_eng":"Branch #7 Current",
|
||||
"title_eng":"#7 Current",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -1058,7 +1058,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"分路电池电流8",
|
||||
"title_eng":"Branch #8 Current",
|
||||
"title_eng":"#8 Current",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -1068,7 +1068,7 @@
|
|||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"检测直流分路电流数N",
|
||||
"title_eng":"Detect DC Branch Cur. Num.",
|
||||
"title_eng":"DC Cur. Num.",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -1078,7 +1078,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"直流分路电流1",
|
||||
"title_eng":"DC Branch #1 Current",
|
||||
"title_eng":"DC #1 Current",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -1088,7 +1088,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"直流分路电流2",
|
||||
"title_eng":"DC Branch #2 Current",
|
||||
"title_eng":"DC #2 Current",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -1098,7 +1098,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"直流分路电流3",
|
||||
"title_eng":"DC Branch #3 Current",
|
||||
"title_eng":"DC #3 Current",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -1108,7 +1108,7 @@
|
|||
"precision":1,
|
||||
"unit":"A",
|
||||
"title_chn":"直流分路电流4",
|
||||
"title_eng":"DC Branch #4 Current",
|
||||
"title_eng":"DC #4 Current",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -1224,9 +1224,80 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"start_addr":11774,
|
||||
"quantity":6,
|
||||
"bytes_per_register":2,
|
||||
"language":"en",
|
||||
"device_name_chn":"风机",
|
||||
"device_name_eng":"Fan",
|
||||
"device_type":4,
|
||||
"data": [
|
||||
{
|
||||
"comment":"设备通讯状态",
|
||||
"order":0,
|
||||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"设备通讯状态",
|
||||
"title_eng":"Online",
|
||||
"display":1,
|
||||
"skip":0
|
||||
},
|
||||
{
|
||||
"comment":"温度值",
|
||||
"order":1,
|
||||
"precision":1,
|
||||
"unit":"℃",
|
||||
"title_chn":"温度值",
|
||||
"title_eng":"Temperature",
|
||||
"display":1,
|
||||
"skip":0
|
||||
},
|
||||
{
|
||||
"comment":"风扇1状态",
|
||||
"order":2,
|
||||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"风扇#1 状态",
|
||||
"title_eng":"Fan#1 Status",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
{
|
||||
"comment":"风扇2状态",
|
||||
"order":3,
|
||||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"风扇#2 状态",
|
||||
"title_eng":"Fan#2 Status",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
{
|
||||
"comment":"风扇3状态",
|
||||
"order":4,
|
||||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"风扇#3 状态",
|
||||
"title_eng":"Fan#3 Status",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
{
|
||||
"comment":"风扇4状态",
|
||||
"order":5,
|
||||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"风扇#4 状态",
|
||||
"title_eng":"Fan#4 Status",
|
||||
"display":2,
|
||||
"skip":0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"start_addr":16384,
|
||||
"quantity":162,
|
||||
"quantity":107,
|
||||
"bytes_per_register":2,
|
||||
"language":"en",
|
||||
"device_name_chn":"电池",
|
||||
|
@ -1249,7 +1320,7 @@
|
|||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"BMS数量",
|
||||
"title_eng":"BMSBatPackNum",
|
||||
"title_eng":"BattPack Num",
|
||||
"display":1,
|
||||
"skip":0
|
||||
},
|
||||
|
@ -2302,7 +2373,18 @@
|
|||
"title_eng":"BatPack3RunningMode",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"start_addr":16491,
|
||||
"quantity":55,
|
||||
"bytes_per_register":2,
|
||||
"language":"en",
|
||||
"device_name_chn":"电池",
|
||||
"device_name_eng":"Battery",
|
||||
"device_type":2,
|
||||
"data": [
|
||||
{
|
||||
"comment":"电池组4总线电压",
|
||||
"order":107,
|
||||
|
@ -2835,7 +2917,7 @@
|
|||
},
|
||||
{
|
||||
"comment":"电池组4放电状态",
|
||||
"order":60,
|
||||
"order":160,
|
||||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"电池组4放电状态",
|
||||
|
@ -2854,77 +2936,6 @@
|
|||
"skip":0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"start_addr":11774,
|
||||
"quantity":6,
|
||||
"bytes_per_register":2,
|
||||
"language":"en",
|
||||
"device_name_chn":"风机",
|
||||
"device_name_eng":"Fan",
|
||||
"device_type":4,
|
||||
"data": [
|
||||
{
|
||||
"comment":"设备通讯状态",
|
||||
"order":0,
|
||||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"设备通讯状态",
|
||||
"title_eng":"Online",
|
||||
"display":1,
|
||||
"skip":0
|
||||
},
|
||||
{
|
||||
"comment":"温度值",
|
||||
"order":1,
|
||||
"precision":1,
|
||||
"unit":"℃",
|
||||
"title_chn":"温度值",
|
||||
"title_eng":"Temperature",
|
||||
"display":1,
|
||||
"skip":0
|
||||
},
|
||||
{
|
||||
"comment":"风扇1状态",
|
||||
"order":2,
|
||||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"风扇#1 状态",
|
||||
"title_eng":"Fan#1 Status",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
{
|
||||
"comment":"风扇2状态",
|
||||
"order":3,
|
||||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"风扇#2 状态",
|
||||
"title_eng":"Fan#2 Status",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
{
|
||||
"comment":"风扇3状态",
|
||||
"order":4,
|
||||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"风扇#3 状态",
|
||||
"title_eng":"Fan#3 Status",
|
||||
"display":2,
|
||||
"skip":0
|
||||
},
|
||||
{
|
||||
"comment":"风扇4状态",
|
||||
"order":5,
|
||||
"precision":1,
|
||||
"unit":"",
|
||||
"title_chn":"风扇#4 状态",
|
||||
"title_eng":"Fan#4 Status",
|
||||
"display":2,
|
||||
"skip":0
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -252,7 +252,7 @@ bool MainWindow::InitializeUI()
|
|||
//电源直流配电
|
||||
m_pPowerPanel = new CustomDisplayPanel(this);
|
||||
m_pPowerPanel->setImage(":/icons/main_power.png");
|
||||
QStringList l2{QStringList{tr("Online"),tr("Vout"),tr("Iout"),tr("SOC"),tr("V_batt")}};
|
||||
QStringList l2{QStringList{tr("Online"),tr("D.C. Vout"),tr("Load Current"),tr("V_batt"),tr("SOC")}};
|
||||
m_pPowerPanel->setLableCount(l2.count());
|
||||
m_pPowerPanel->setTableRowsCount(10);
|
||||
m_pPowerPanel->setLables(l2);
|
||||
|
@ -266,7 +266,7 @@ bool MainWindow::InitializeUI()
|
|||
//整流模块
|
||||
m_pInverterPanel = new CustomDisplayPanel(this);
|
||||
m_pInverterPanel->setImage(":/icons/main_peidian.png");
|
||||
QStringList l5{QStringList{tr("Online"),tr("Vin AB/A"),tr("Vin BC/B"),tr("Vin CA/C")}};
|
||||
QStringList l5{QStringList{tr("Online"),tr("V_A"),tr("V_B"),tr("V_C")}};
|
||||
m_pInverterPanel->setLableCount(l5.count());
|
||||
m_pInverterPanel->setTableRowsCount(10);
|
||||
m_pInverterPanel->setLables(l5);
|
||||
|
@ -552,6 +552,8 @@ bool MainWindow::readRegister()
|
|||
uint16_t* tab_reg = new uint16_t[iterAddress->quantity];
|
||||
int regs = modbus_read_registers(m_pModbus, iterAddress->start_addr, iterAddress->quantity, tab_reg);
|
||||
|
||||
assert(regs>0);
|
||||
|
||||
QVector<uint16_t> registers;
|
||||
for (int i = 0; i < regs; ++i)
|
||||
{
|
||||
|
@ -569,7 +571,15 @@ bool MainWindow::readRegister()
|
|||
OpenJson json;
|
||||
if(CreateJson2(pDevice,json))
|
||||
{
|
||||
m_Panels[iterAddress->device_type]->UpdateData(json);
|
||||
if (iterAddress->device_type == 2 /*PANEL_BATTERY*/)
|
||||
{
|
||||
m_Panels[iterAddress->device_type]->UpdateData(json,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Panels[iterAddress->device_type]->UpdateData(json);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -662,7 +672,6 @@ bool MainWindow::CreateJson2(DeviceData* pData,OpenJson& json)
|
|||
|
||||
if (iter->device_type == 6) //告警,需要特别处理
|
||||
{
|
||||
|
||||
auto& nodeTable = json["alarm"];
|
||||
for(; iter!=pDevice->m_PanelDisplayDataItems.end(); iter++)
|
||||
{
|
||||
|
@ -680,8 +689,8 @@ bool MainWindow::CreateJson2(DeviceData* pData,OpenJson& json)
|
|||
auto& nodeTable = json["table"];
|
||||
for(; iter!=pDevice->m_PanelDisplayDataItems.end(); iter++)
|
||||
{
|
||||
qDebug() << iter->title.c_str();
|
||||
qDebug() << iter->value;
|
||||
//qDebug() << iter->title.c_str();
|
||||
//qDebug() << iter->value;
|
||||
|
||||
if(iter->display_location == 1) //显示在面板
|
||||
{
|
||||
|
@ -700,7 +709,13 @@ bool MainWindow::CreateJson2(DeviceData* pData,OpenJson& json)
|
|||
|
||||
{
|
||||
nodeTable[idx1]["value"] = iter->value * 1.0f / iter->precision;
|
||||
nodeTable[idx1]["signal"] = iter->title;
|
||||
|
||||
if (iter->unit.size()!=0)
|
||||
nodeTable[idx1]["signal"] = iter->title + " (" + iter->unit + ")";
|
||||
else
|
||||
nodeTable[idx1]["signal"] = iter->title;
|
||||
|
||||
//qDebug() << "idx=" << idx1 << ";" << nodeTable[idx1]["signal"].s().c_str() << ":" << nodeTable[idx1]["value"].d();
|
||||
}
|
||||
|
||||
idx1++;
|
||||
|
@ -708,10 +723,10 @@ bool MainWindow::CreateJson2(DeviceData* pData,OpenJson& json)
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _DEBUG_
|
||||
std::string a = json.encode();
|
||||
|
||||
qDebug() << QString::fromStdString(a);
|
||||
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue