增加部分指令的解析

Signed-off-by: jiangyingjie <1308784381@qq.com>
This commit is contained in:
jiangyingjie 2024-08-30 08:33:46 +08:00
parent ae1bf3169f
commit ba3ea24de8
4 changed files with 97 additions and 9 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.1, 2024-08-27T18:34:45. -->
<!-- Written by QtCreator 4.11.1, 2024-08-28T18:47:22. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@ -46,7 +46,7 @@ void MainWindow::OpenExplorerFile(bool isOriFileOpen)
ui->tableWidget->setRowCount(0);
if (isOriFileOpen)
{
if (pQfile_ori->fileName() != filePath)
if (pQfile_ori && pQfile_ori->fileName() != filePath)
{
pQfile_ori->close();
}
@ -63,7 +63,7 @@ void MainWindow::OpenExplorerFile(bool isOriFileOpen)
}
else
{
if (pQfile_key->fileName() != filePath)
if (pQfile_key && pQfile_key->fileName() != filePath)
{
pQfile_key->close();
}
@ -363,6 +363,8 @@ QString MainWindow::AppendParse(DATA_TYPEDEF data)
ret += "单点灯启动停止";
ret += "-" + QString::number(data.buf[6] | data.buf[5] << 8 | data.buf[4] << 16 | data.buf[3] << 24, 10);
ret += "-回路" + QString::number(((data.buf[7] & 0xe0) >> 5) + 1, 10);
if (data.buf[7] & 0x01)
{
ret += "-标志灯";
@ -529,6 +531,88 @@ QString MainWindow::AppendParse(DATA_TYPEDEF data)
case 0x23:
{
ret += "应答灯具配置";
if (data.buf[1] == 0x01)
{
ret += "-" + QString::number(data.buf[7] | data.buf[6] << 8 | data.buf[5] << 16 | data.buf[4] << 24, 10);
}
else if (data.buf[1] == 0x00)
{
ret += "-回路" + QString::number(data.buf[2], 10);
ret += "-" + GetLampType(data.buf[3]);
if (data.buf[3] == 0)
{
ret += "-ERROR";
}
else if (data.buf[3] != 229)
{
ret += "-";
if (data.buf[4] & 0x20)
{
ret += "r点亮";
}
else
{
ret += "r熄灭";
}
if (data.buf[4] & 0x10)
{
ret += "l点亮";
}
else
{
ret += "l熄灭";
}
if (data.buf[4] & 0x02)
{
ret += "r点亮";
}
else
{
ret += "r熄灭";
}
if (data.buf[4] & 0x01)
{
ret += "l点亮";
}
else
{
ret += "l熄灭";
}
ret += "-";
if (data.buf[5] & 0x80)
{
ret += "点亮";
}
else
{
ret += "熄灭";
}
}
else
{
ret += "-";
if (data.buf[4] & 0x01)
{
ret += "非节能";
}
else
{
ret += "节能";
}
ret += "-";
ret += QString::number((data.buf[5] & 0xf0) >> 4, 10);
if (data.buf[5] & 0x01)
{
ret += "非节能";
}
else
{
ret += "节能";
}
}
}
}break;
case 0x24:
{
@ -796,8 +880,6 @@ void MainWindow::PushButton_Clicked_Parse_clicked()
}
}
ui->tableWidget->resizeColumnsToContents();
byteArr = pQfile_ori->readLine(); // 继续下一行的读取
context = codec->toUnicode(byteArr);
disp = context;

View File

@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>924</width>
<height>431</height>
<width>1000</width>
<height>622</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>1000</width>
<height>400</height>
</size>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
@ -214,8 +220,8 @@ background-color: rgb(91, 255, 88);</string>
<rect>
<x>0</x>
<y>0</y>
<width>924</width>
<height>21</height>
<width>1000</width>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menu">

Binary file not shown.