From f2ec2ff2640e8f02507e6fa44cd1ba1487a303ea Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 21 二月 2025 09:15:43 +0800
Subject: [PATCH] 1.定义派生于CStep的类CEqModeStep,用于处理设备模式改变的事件。
---
SourceCode/Bond/Servo/CEquipment.h | 35 ++++++++++++++++++++++++++++++++++-
1 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/SourceCode/Bond/Servo/CEquipment.h b/SourceCode/Bond/Servo/CEquipment.h
index 044fcd8..a19fcca 100644
--- a/SourceCode/Bond/Servo/CEquipment.h
+++ b/SourceCode/Bond/Servo/CEquipment.h
@@ -1,10 +1,14 @@
#pragma once
#include "Log.h"
#include "CCLinkIEControl.h"
+#include "CEqModeStep.h"
+#include <map>
+
namespace SERVO {
#define BLOCK_BUFFER_MAX 1024
#define ALIVE_TIMEOUT 15
+#define VCR_MAX 1
typedef std::function<void(void* pEiuipment, BOOL bAlive)> ONALIVE;
typedef struct _EquipmentListener
@@ -39,6 +43,9 @@
public:
virtual const char* getClassName() = 0;
virtual void setListener(EquipmentListener listener);
+ void setCcLink(CCCLinkIEControl* pCcLink);
+ void setID(int nID);
+ int getID();
void setName(const char* pszName);
std::string& getName();
void setDescription(const char* pszDescription);
@@ -49,15 +56,30 @@
MemoryBlock& getReadBitBlock();
void setWriteBitBlock(unsigned int start, unsigned int end);
MemoryBlock& getWriteBitBlock();
+ void getProperties(std::vector<std::pair<std::string, std::string>>& container);
+ int addStep(unsigned int addr, CStep* pStep);
+ CStep* getStep(unsigned int addr);
virtual void init();
virtual void term();
virtual void onTimer(UINT nTimerid);
virtual void serialize(CArchive& ar);
virtual void onReceiveLBData(const char* pszData, size_t size);
+
+
+ // 以下为从CC-Link读取到的Bit标志位检测函数
+ public:
BOOL isAlive();
-
+ BOOL isCimOn();
+ BOOL isUpstreamInline();
+ BOOL isDownstreamInline();
+ BOOL isLocalAlarm();
+ BOOL isAutoRecipeChange();
+ BOOL isVCREnable(unsigned int index);
+
+
private:
BOOL isBitOn(const char* pszData, size_t size, int index);
+ inline BOOL equalBool(BOOL b1, BOOL b2);
protected:
inline void Lock() { EnterCriticalSection(&m_criticalSection); }
@@ -65,6 +87,7 @@
protected:
EquipmentListener m_listener;
+ int m_nID;
std::string m_strName;
std::string m_strDescription;
CRITICAL_SECTION m_criticalSection;
@@ -72,9 +95,19 @@
MemoryBlock m_blockReadBit;
MemoryBlock m_blockWriteBit;
+ // 以下为从CC-Link读取到的Bit标志位
private:
ALIVE m_alive;
BOOL m_bCimState; // ON/OFF
+ BOOL m_bUpstreamInline;
+ BOOL m_bDownstreamInline;
+ BOOL m_bLocalAlarm;
+ BOOL m_bAutoRecipeChange;
+ BOOL m_bVCREnable[VCR_MAX];
+
+ private:
+ CCCLinkIEControl* m_pCclink;
+ std::map<unsigned int, CStep*> m_mapStep;
};
}
--
Gitblit v1.9.3