From 11260184c3c930d0d9ccd6b65e905c7828efd3cf Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期五, 12 九月 2025 09:44:02 +0800
Subject: [PATCH] 1. 优化报警的查询功能 2. 插入设备表数据和单元表数据 3. 修复报警查询失败的问题
---
SourceCode/Bond/Servo/CEqReadStep.cpp | 30 +++++++++++++++++++++---------
1 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/SourceCode/Bond/Servo/CEqReadStep.cpp b/SourceCode/Bond/Servo/CEqReadStep.cpp
index 854338e..f4fe44f 100644
--- a/SourceCode/Bond/Servo/CEqReadStep.cpp
+++ b/SourceCode/Bond/Servo/CEqReadStep.cpp
@@ -27,9 +27,10 @@
{
CReadStep::getAttributeVector(attrubutes);
+ unsigned int weight = 31;
std::string strTemp;
attrubutes.addAttribute(new CAttribute("Dev",
- ("W" + CToolUnits::toHexString(m_nDataDev, strTemp)).c_str(), ""));
+ ("W" + CToolUnits::toHexString(m_nDataDev, strTemp)).c_str(), "", weight++));
}
int CEqReadStep::onReadData()
@@ -37,20 +38,31 @@
CReadStep::onReadData();
+ // 20250620新增,有些场景是不需要读数据的,只要检测到信息就写数据给机器
+ if (m_nReadSize == 0) {
+ if (m_onReadBlock != nullptr) {
+ m_onReadBlock(this, ROK, nullptr, 0);
+ }
+
+ return 0;
+ }
+
+
+ // 读数据
char szBuffer[READ_BUFFER_MAX];
int nRet = m_pCclink->ReadData2(m_station, DeviceType::W, m_nDataDev,
(long)min(READ_BUFFER_MAX, m_nReadSize), szBuffer);
if (0 != nRet) {
- LOGI("<CEqReadStep>Read data error.");
+ LOGE("<CEqReadStep>Read data error.");
if (m_onReadBlock != nullptr) {
- m_onReadBlock(RERROR, nullptr, 0);
+ m_onReadBlock(this, RERROR, nullptr, 0);
}
return -1;
}
- LOGI("<CEqReadStep>read data succeed.");
+ LOGD("<CEqReadStep>read data succeed.");
if (m_onReadBlock != nullptr) {
- m_onReadBlock(ROK, szBuffer, m_nReadSize);
+ m_onReadBlock(this, ROK, szBuffer, m_nReadSize);
}
@@ -60,9 +72,9 @@
int CEqReadStep::onComplete()
{
CReadStep::onComplete();
- LOGI("<CEqReadStep> onComplete.");
+ LOGD("<CEqReadStep> onComplete.");
if (m_onReadBlock != nullptr) {
- m_onReadBlock(RCOMPLETE, nullptr, 0);
+ m_onReadBlock(this, RCOMPLETE, nullptr, 0);
}
return 0;
@@ -71,9 +83,9 @@
int CEqReadStep::onTimeout()
{
CReadStep::onTimeout();
- LOGI("<CEqReadStep> onTimeout.");
+ LOGE("<CEqReadStep> onTimeout.");
if (m_onReadBlock != nullptr) {
- m_onReadBlock(RTIMEOUT, nullptr, 0);
+ m_onReadBlock(this, RTIMEOUT, nullptr, 0);
}
return 0;
--
Gitblit v1.9.3