From c8173fa96f226ff88412d07955fb340de4681ffc Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期四, 06 三月 2025 11:21:34 +0800
Subject: [PATCH] 1.实现 CIM model change指令下发到机器。与之前的从CC link读数据逻辑稍有不同,下发指令为写数据,因此,从原CStep派生两个类,CReadStep(用于读数据),CWriteStep(用于写数据),然后根据使用场景选择合适的基数做应用层逻辑。已完成待测试验证
---
SourceCode/Bond/Servo/CEquipment.cpp | 38 +++++++++++++++++++++++++++++---------
1 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index d3bc8da..3fa85bb 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -16,6 +16,7 @@
m_bAutoRecipeChange = FALSE;
m_bVCREnable[0] = FALSE;
m_pCclink = nullptr;
+ m_nBaseAlarmId = 0;
InitializeCriticalSection(&m_criticalSection);
}
@@ -40,6 +41,16 @@
m_pCclink = pCcLink;
}
+ void CEquipment::setBaseAlarmId(int nBaseId)
+ {
+ m_nBaseAlarmId = nBaseId;
+ }
+
+ int CEquipment::getBaseAlarmId()
+ {
+ return m_nBaseAlarmId;
+ }
+
void CEquipment::getProperties(std::vector<std::pair<std::string, std::string>>& container)
{
container.clear();
@@ -47,6 +58,11 @@
container.push_back(std::make_pair("DeviceName", "ServoMotor"));
container.push_back(std::make_pair("SerialNumber", "123456789"));
container.push_back(std::make_pair("Version", "1.0"));
+ }
+
+ std::map<unsigned int, CStep*>& CEquipment::getSteps()
+ {
+ return m_mapStep;
}
CStep* CEquipment::getStep(unsigned int addr)
@@ -60,6 +76,7 @@
{
auto iter = m_mapStep.find(addr);
if (iter != m_mapStep.end()) return -1;
+ pStep->setEquipment(this);
pStep->setCcLink(m_pCclink);
m_mapStep[addr] = pStep;
return 0;
@@ -242,20 +259,23 @@
// 以下根据信号做流程处理
CStep* pStep;
- // Equipment Mode Change Report
- index = 0x360;
- bFlag = isBitOn(pszData, size, index);
- pStep = getStep(index);
- if (pStep != nullptr) {
- pStep->onSignal(bFlag);
+ // Equipment Mode Change Report(0x360)
+ // Equipment Status Change Report(0x361)
+ // Equipment Alarm Change Report(0x362 ~ 0x366)
+ for (int i = 0; i < 7; i++) {
+ index = 0x360 + i;;
+ bFlag = isBitOn(pszData, size, index);
+ pStep = getStep(index);
+ if (pStep != nullptr) {
+ ((CReadStep*)pStep)->onReadSignal(bFlag);
+ }
}
- // Equipment Status Change Report
- index = 0x361;
+ index = 0x350;
bFlag = isBitOn(pszData, size, index);
pStep = getStep(index);
if (pStep != nullptr) {
- pStep->onSignal(bFlag);
+ ((CWriteStep*)pStep)->onRecvSignal(bFlag);
}
}
--
Gitblit v1.9.3