From 6df6302161eb6021ad3c324d7a3f5494c63dc21e Mon Sep 17 00:00:00 2001
From: darker <mr.darker@163.com>
Date: 星期二, 18 二月 2025 08:39:53 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang

---
 SourceCode/Bond/Servo/CEquipment.h |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEquipment.h b/SourceCode/Bond/Servo/CEquipment.h
index 9f83bb8..37d8e2b 100644
--- a/SourceCode/Bond/Servo/CEquipment.h
+++ b/SourceCode/Bond/Servo/CEquipment.h
@@ -3,13 +3,30 @@
 #include "CCLinkIEControl.h"
 
 namespace SERVO {
+#define BLOCK_BUFFER_MAX			1024
+#define ALIVE_TIMEOUT				15
+
+	typedef std::function<void(void* pEiuipment, BOOL bAlive)> ONALIVE;
+	typedef struct _EquipmentListener
+	{
+		ONALIVE				onAlive;
+	} EquipmentListener;
+
 	// Memory Block 结构体定义
 	typedef struct _MemoryBlock {
 		unsigned int type;
 		unsigned int start;
 		unsigned int end;
 		unsigned int size;
+		char buffer[BLOCK_BUFFER_MAX];
 	} MemoryBlock;
+
+	// ALIVE
+	typedef struct _ALIVE {
+		BOOL flag;
+		int count;
+		BOOL alive;
+	} ALIVE;
 
 	class CEquipment
 	{
@@ -20,6 +37,7 @@
 
 	public:
 		virtual const char* getClassName() = 0;
+		virtual void setListener(EquipmentListener listener);
 		void setName(const char* pszName);
 		std::string& getName();
 		void setDescription(const char* pszDescription);
@@ -34,18 +52,25 @@
 		virtual void term();
 		virtual void onTimer(UINT nTimerid);
 		virtual void serialize(CArchive& ar);
+		virtual void onReceiveLBData(const char* pszData, size_t size);
+		BOOL isAlive();
+
+	private:
+		BOOL isBitOn(const char* pszData, size_t size, int index);
 
 	protected:
 		inline void Lock() { EnterCriticalSection(&m_criticalSection); }
 		inline void Unlock() { LeaveCriticalSection(&m_criticalSection); }
 
 	protected:
+		EquipmentListener m_listener;
 		std::string m_strName;
 		std::string m_strDescription;
 		CRITICAL_SECTION m_criticalSection;
 		StationIdentifier m_station;
 		MemoryBlock m_blockReadBit;
 		MemoryBlock m_blockWriteBit;
+		ALIVE m_alive;
 	};
 }
 

--
Gitblit v1.9.3