From 956cb65690500f099be756accc346f3c8d56be99 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 20 一月 2025 16:50:54 +0800
Subject: [PATCH] 1.SECS,实现S2F15(Equipment Constant Send)的回复,目前仅打印显示数据,待机器端确认相关逻辑后再保存和设置机器数据。 2.修改和完善S2F13,与S2F15靠拢,并使用相同的数据结构和回调函数到应用层;
---
SourceCode/Bond/Servo/HsmsPassive.h | 44 ++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/SourceCode/Bond/Servo/HsmsPassive.h b/SourceCode/Bond/Servo/HsmsPassive.h
index cb3b047..9048e86 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.h
+++ b/SourceCode/Bond/Servo/HsmsPassive.h
@@ -2,12 +2,33 @@
#include <string>
#include <list>
#include "HsmsAction.h"
+#include <functional>
+#include <vector>
#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[256];
+} EQConstant;
+
+
+typedef std::function<void(void* pFrom, std::vector<EQConstant>&)> SECSEQCONSTANTREQUEST;
+typedef struct _SECSListener
+{
+ SECSEQCONSTANTREQUEST onEQConstantRequest;
+ SECSEQCONSTANTREQUEST onEQConstantSend;
+} SECSListener;
+
class CModel;
class CHsmsPassive
@@ -17,6 +38,13 @@
~CHsmsPassive();
public:
+ /* 设置机器型号 最大长度 20 bytes */
+ void setEquipmentModelType(const char* pszMode);
+
+ /* 设置软件版本号 最大长度 20 bytes */
+ void setSoftRev(const char* pszRev);
+
+ void setListener(SECSListener listener);
unsigned OnCimWork();
void OnTimer(UINT nTimerid);
void setActionTimeout(int nSecond);
@@ -24,12 +52,23 @@
int term();
public:
+ /* request开头的函数为主动发送数据的函数 */
int requestAreYouThere();
+ int requestAlarmReport(int ALCD, int ALID, const char* ALTX);
private:
- int replyAreYouThere(unsigned int systemBytes);
- int replyEstablishCommunications(unsigned int systemBytes);
+ void replyAck(int s, int f, unsigned int systemBytes, BYTE ack, const char* pszAckName);
+
+ /* reply开头的函数为回复函数 */
+ int replyAreYouThere(IMessage* pRecv);
+ int replyEstablishCommunications(IMessage* pRecv);
+ int replyEquipmentConstantRequest(IMessage* pRecv);
+ int replyEquipmentConstantSend(IMessage* pRecv);
int replyDatetime(IMessage* pRecv);
+ int replyEanbleDisableEventReport(IMessage* pRecv);
+ int replyEanbleDisableAlarmReport(IMessage* pRecv);
+ int replyQueryPPIDList(IMessage* pRecv);
+ int replyTerminalDisplay(IMessage* pRecv);
private:
inline void Lock() { EnterCriticalSection(&m_criticalSection); }
@@ -50,6 +89,7 @@
std::list<CHsmsAction*> m_listActionSent;
private:
+ SECSListener m_listener;
BOOL m_bCimWorking;
HANDLE m_hCimWorkEvent;
HANDLE m_hCimWorkThreadHandle;
--
Gitblit v1.9.3