From e42e8364112e97d89eeaecd13f043dff42179949 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 27 五月 2025 17:19:02 +0800
Subject: [PATCH] 1.enum修改为enum class, 理顺CLoadPort各成员变量在调度中的判定作用;

---
 SourceCode/Bond/Servo/HsmsPassive.h |  112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 110 insertions(+), 2 deletions(-)

diff --git a/SourceCode/Bond/Servo/HsmsPassive.h b/SourceCode/Bond/Servo/HsmsPassive.h
index ac820bb..44ce52c 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.h
+++ b/SourceCode/Bond/Servo/HsmsPassive.h
@@ -2,12 +2,73 @@
 #include <string>
 #include <list>
 #include "HsmsAction.h"
+#include <functional>
+#include <vector>
+#include <map>
+
+
+#define EQCONSTANT_VALUE_MAX	64
+#define COMMAND_NAME_MAX		64
+#define COMMAND_VALUE_MAX		64
+#define REPORT_NAME_MAX			64
+#define VALUE_NAME_MAX			64
 
 
 #define ER_NOERROR			0
 #define ER_NOTSELECT		-1
 #define ER_BUSY				-2
 #define ER_PARAM_ERROR		-3
+
+
+/*
+ * 常量数据结构
+ */
+typedef struct _EQConstant
+{
+	unsigned int id;
+	char szValue[EQCONSTANT_VALUE_MAX];
+} EQConstant;
+
+/*
+ * Command 数据结构
+ */
+typedef struct _CommandParameter
+{
+	char szName[COMMAND_NAME_MAX];
+	char szValue[COMMAND_VALUE_MAX];
+} CommandParameter;
+
+/*
+ * Report 数据结构
+ */
+typedef struct _REPORT
+{
+	char szName[REPORT_NAME_MAX];
+	unsigned int id;
+} REPORT;
+
+/*
+ * Value 数据结构
+ */
+typedef struct _VALUE
+{
+	char szName[VALUE_NAME_MAX];
+	unsigned int id;
+} VALUE;
+
+
+typedef std::function<void(void* pFrom)> SECSEQOFFLINE;
+typedef std::function<void(void* pFrom, std::vector<EQConstant>&)> SECSEQCONSTANTREQUEST;
+typedef std::function<void(void* pFrom, const char*, std::vector<CommandParameter>&)> SECSCommand;
+typedef struct _SECSListener
+{
+	SECSEQOFFLINE				onEQOffLine;
+	SECSEQOFFLINE				onEQOnLine;
+	SECSEQCONSTANTREQUEST		onEQConstantRequest;
+	SECSEQCONSTANTREQUEST		onEQConstantSend;
+	SECSCommand					onCommand;
+} SECSListener;
+
 
 class CModel;
 class CHsmsPassive
@@ -23,6 +84,27 @@
 	/* 设置软件版本号 最大长度 20 bytes */
 	void setSoftRev(const char* pszRev);
 
+	/* 添加Report */
+	void addReport(unsigned int id, const char* pszName);
+
+	// 连接Report
+	void linkEventReport(unsigned int RPTID, unsigned int CEID);
+
+	// 取消连接report
+	void unlinkEventReport(unsigned int CEID);
+
+	unsigned int getCEID(int RPTID);
+
+	// define Report
+	void defineReport(unsigned int VID, unsigned int RPTID);
+
+	// 取消 define report
+	void deleteReport(unsigned int RPTID);
+
+	// 取消/删除所有 define report
+	void deleteAllReport();
+
+	void setListener(SECSListener listener);
 	unsigned OnCimWork();
 	void OnTimer(UINT nTimerid);
 	void setActionTimeout(int nSecond);
@@ -33,14 +115,26 @@
 	/* request开头的函数为主动发送数据的函数 */
 	int requestAreYouThere();
 	int requestAlarmReport(int ALCD, int ALID, const char* ALTX);
+	int requestEventReportSend(unsigned int DATAID, unsigned int RPTID, const std::vector<std::string>& values);
 
 private:
+	void replyAck(int s, int f, unsigned int systemBytes, BYTE ack, const char* pszAckName);
+
 	/* reply开头的函数为回复函数 */
-	int replyAreYouThere(unsigned int systemBytes);
-	int replyEstablishCommunications(unsigned int systemBytes);
+	int replyAreYouThere(IMessage* pRecv);
+	int replyEstablishCommunications(IMessage* pRecv);
+	int replyOnLine(IMessage* pRecv);
+	int replyOffLine(IMessage* pRecv);
+	int replyEquipmentConstantRequest(IMessage* pRecv);
+	int replyEquipmentConstantSend(IMessage* pRecv);
 	int replyDatetime(IMessage* pRecv);
+	int replyDefineReport(IMessage* pRecv);
+	int replyLinkEventReport(IMessage* pRecv);
 	int replyEanbleDisableEventReport(IMessage* pRecv);
+	int replyCommand(IMessage* pRecv);
 	int replyEanbleDisableAlarmReport(IMessage* pRecv);
+	int replyQueryPPIDList(IMessage* pRecv);
+	int replyTerminalDisplay(IMessage* pRecv);
 
 private:
 	inline void Lock() { EnterCriticalSection(&m_criticalSection); }
@@ -61,9 +155,23 @@
 	std::list<CHsmsAction*> m_listActionSent;
 
 private:
+	SECSListener m_listener;
 	BOOL m_bCimWorking;
 	HANDLE m_hCimWorkEvent;
 	HANDLE m_hCimWorkThreadHandle;
 	unsigned m_nCimWorkThrdaddr;
+
+private:
+	// RPTID to CEID
+	std::map<unsigned int, unsigned int> m_mapReportIdToCEID;
+	
+	// RPTID to Report
+	std::map<unsigned int, REPORT> m_mapReport;
+
+	// VID to RPTID
+	std::map<unsigned int, unsigned int> m_mapValueIdToPRTID;
+
+	// VID to Report
+	std::map<unsigned int, VALUE> m_mapValue;
 };
 

--
Gitblit v1.9.3