From 2070871df480a664c9c4e38bc4e4e324682a64c6 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期四, 03 四月 2025 16:12:28 +0800
Subject: [PATCH] 1. 解决 WebView2 控制器创建失败时闪退的问题 2. 解决连接图销毁时保存设备图形数据闪退的问题
---
SourceCode/Bond/Servo/HsmsPassive.h | 78 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 76 insertions(+), 2 deletions(-)
diff --git a/SourceCode/Bond/Servo/HsmsPassive.h b/SourceCode/Bond/Servo/HsmsPassive.h
index 88125df..44ce52c 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.h
+++ b/SourceCode/Bond/Servo/HsmsPassive.h
@@ -4,6 +4,14 @@
#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
@@ -18,18 +26,47 @@
typedef struct _EQConstant
{
unsigned int id;
- char szValue[256];
+ char szValue[EQCONSTANT_VALUE_MAX];
} EQConstant;
+/*
+ * Command 数据结构
+ */
+typedef struct _CommandParameter
+{
+ char szName[COMMAND_NAME_MAX];
+ char szValue[COMMAND_VALUE_MAX];
+} CommandParameter;
-typedef std::function<void(void* pFrom, std::vector<EQConstant>&)> SECSEQCONSTANTREQUEST;
+/*
+ * 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;
@@ -47,6 +84,26 @@
/* 设置软件版本号 最大长度 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);
@@ -58,6 +115,7 @@
/* 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);
@@ -70,7 +128,10 @@
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);
@@ -99,5 +160,18 @@
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