From d3e6607623a258e26e579731713407737f96a392 Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期四, 08 一月 2026 20:45:12 +0800
Subject: [PATCH] 1.查询状态EAP模拟及测试;
---
SourceCode/Bond/EAPSimulator/CHsmsActive.cpp | 2 +-
SourceCode/Bond/EAPSimulator/Resource.h | 3 ++-
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp | 22 ++++++++++++++++++++++
SourceCode/Bond/EAPSimulator/CHsmsActive.h | 17 +++++++++--------
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h | 1 +
SourceCode/Bond/Servo/HsmsPassive.cpp | 9 +++++++--
SourceCode/Bond/EAPSimulator/EAPSimulator.rc | 0
7 files changed, 42 insertions(+), 12 deletions(-)
diff --git a/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp b/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
index 8d74257..f7f7ffa 100644
--- a/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
+++ b/SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
@@ -342,7 +342,7 @@
IMessage* pMessage = nullptr;
int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 1 | REPLY, 3, ++m_nSystemByte);
- pMessage->getBody()->addU4Item(SVID, "SVID");
+ pMessage->getBody()->addU2Item(static_cast<unsigned short>(SVID), "SVID");
m_pActive->sendMessage(pMessage);
HSMS_Destroy1Message(pMessage);
diff --git a/SourceCode/Bond/EAPSimulator/CHsmsActive.h b/SourceCode/Bond/EAPSimulator/CHsmsActive.h
index 2ba9fea..00efb31 100644
--- a/SourceCode/Bond/EAPSimulator/CHsmsActive.h
+++ b/SourceCode/Bond/EAPSimulator/CHsmsActive.h
@@ -1,4 +1,4 @@
-锘�#pragma once
+#pragma once
#include <string>
#include <vector>
#include <map>
@@ -7,7 +7,8 @@
#include "ProcessJob.h"
-#define SVID_CJobSpace 5001
+#define SVID_ControlState 600
+#define SVID_CJobSpace 5001
#define SVID_PJobSpace 5002
#define SVID_PJobQueued 5003
@@ -36,7 +37,7 @@
// Deselect Request
int hsmsDeselectRequest();
- // 寤虹珛閫氳(S1F13)
+ // 建立通讯(S1F13)
int hsmsEstablishCommunications();
// Are You There
@@ -71,18 +72,18 @@
// Configure Spooling
int hsmsConfigureSpooling(std::map<unsigned int, std::set<unsigned int>>& spoolingConfig);
- // 鍙戦�佹垨娓呯┖缂撳瓨鐨勬秷鎭�
+ // 发送或清空缓存的消息
int hsmsTransmitSpooledData();
int hsmsPurgeSpooledData();
- // 鏌ヨ鍙橀噺
+ // 查询变量
int hsmsSelectedEquipmentStatusRequest(unsigned int SVID);
- // 鏌ヨPPID List
+ // 查询PPID List
int hsmsQueryPPIDList();
// S3F17
- // 鍗″專鍔ㄤ綔璇锋眰
+ // 卡匣动作请求
int hsmsCarrierActionRequest(unsigned int DATAID,
const char* pszCarrierAction,
const char* pszCarrierId,
@@ -106,7 +107,7 @@
// S14F9
int hsmsCreateControlJob(const char* pszControlJobId, std::vector<std::string>& processJobIds);
- // 閫氳繃鐨剅eply鍑芥暟
+ // 通过的reply函数
void replyAck(int s, int f, unsigned int systemBytes, BYTE ack, const char* pszAckName);
// reply ack0
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulator.rc b/SourceCode/Bond/EAPSimulator/EAPSimulator.rc
index b153a48..a5966d9 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulator.rc
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulator.rc
Binary files differ
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
index 271f175..2a3bcc0 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
@@ -101,6 +101,7 @@
ON_BN_CLICKED(IDC_BUTTON_CTRL_OFFLINE, &CEAPSimulatorDlg::OnBnClickedButtonCtrlOffline)
ON_BN_CLICKED(IDC_BUTTON_CTRL_ONLINE_LOCAL, &CEAPSimulatorDlg::OnBnClickedButtonCtrlOnlineLocal)
ON_BN_CLICKED(IDC_BUTTON_CTRL_ONLINE_REMOTE, &CEAPSimulatorDlg::OnBnClickedButtonCtrlOnlineRemote)
+ ON_BN_CLICKED(IDC_BUTTON_QUERY_CONTROL_STATE, &CEAPSimulatorDlg::OnBnClickedButtonQueryControlState)
END_MESSAGE_MAP()
@@ -220,6 +221,19 @@
if (hBtn != nullptr) {
::SendMessage(hBtn, WM_SETFONT, (WPARAM)GetFont()->GetSafeHandle(), TRUE);
}
+ }
+ }
+ // S1F3 Query ControlState (SVID=600) button (runtime add to avoid touching UTF-16 RC)
+ {
+ // Place on its own row to avoid overlapping with control-mode buttons.
+ CRect rc(14, 136, 14 + 140, 136 + 14); // dialog units
+ MapDialogRect(&rc);
+ HWND hBtn = ::CreateWindow(_T("BUTTON"), _T("S1F3_QueryControlState"),
+ WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
+ rc.left, rc.top, rc.Width(), rc.Height(),
+ m_hWnd, (HMENU)IDC_BUTTON_QUERY_CONTROL_STATE, AfxGetInstanceHandle(), nullptr);
+ if (hBtn != nullptr) {
+ ::SendMessage(hBtn, WM_SETFONT, (WPARAM)GetFont()->GetSafeHandle(), TRUE);
}
}
@@ -344,6 +358,9 @@
}
if (GetDlgItem(IDC_BUTTON_CTRL_ONLINE_REMOTE) != nullptr) {
GetDlgItem(IDC_BUTTON_CTRL_ONLINE_REMOTE)->EnableWindow(enabled);
+ }
+ if (GetDlgItem(IDC_BUTTON_QUERY_CONTROL_STATE) != nullptr) {
+ GetDlgItem(IDC_BUTTON_QUERY_CONTROL_STATE)->EnableWindow(enabled);
}
}
@@ -509,3 +526,8 @@
theApp.m_model.m_pHsmsActive->hsmsRequestOnline();
theApp.m_model.m_pHsmsActive->hsmsGoRemote();
}
+
+void CEAPSimulatorDlg::OnBnClickedButtonQueryControlState()
+{
+ theApp.m_model.m_pHsmsActive->hsmsSelectedEquipmentStatusRequest(SVID_ControlState);
+}
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
index ffc3f40..3afdb16 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
@@ -67,4 +67,5 @@
afx_msg void OnBnClickedButtonCtrlOffline();
afx_msg void OnBnClickedButtonCtrlOnlineLocal();
afx_msg void OnBnClickedButtonCtrlOnlineRemote();
+ afx_msg void OnBnClickedButtonQueryControlState();
};
diff --git a/SourceCode/Bond/EAPSimulator/Resource.h b/SourceCode/Bond/EAPSimulator/Resource.h
index 4758455..e344952 100644
--- a/SourceCode/Bond/EAPSimulator/Resource.h
+++ b/SourceCode/Bond/EAPSimulator/Resource.h
@@ -61,6 +61,7 @@
#define IDC_BUTTON_CTRL_OFFLINE 1043
#define IDC_BUTTON_CTRL_ONLINE_LOCAL 1044
#define IDC_BUTTON_CTRL_ONLINE_REMOTE 1045
+#define IDC_BUTTON_QUERY_CONTROL_STATE 1046
// Next default values for new objects
//
@@ -68,7 +69,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 143
#define _APS_NEXT_COMMAND_VALUE 32771
-#define _APS_NEXT_CONTROL_VALUE 1046
+#define _APS_NEXT_CONTROL_VALUE 1047
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/SourceCode/Bond/Servo/HsmsPassive.cpp b/SourceCode/Bond/Servo/HsmsPassive.cpp
index 93ddb4b..fb419c0 100644
--- a/SourceCode/Bond/Servo/HsmsPassive.cpp
+++ b/SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -1784,9 +1784,14 @@
goto MYREPLY;
}
if (!pBody->getSubItemU2(0, SVID)) {
+ // also accept I2 or U4 to be tolerant with host implementations
if (!pBody->getSubItemI2(0, (short&)SVID)) {
- pMessage->getBody()->addU1Item(SVU1, "SV");
- goto MYREPLY;
+ unsigned int svidU4 = 0;
+ if (!pBody->getSubItemU4(0, svidU4)) {
+ pMessage->getBody()->addU1Item(SVU1, "SV");
+ goto MYREPLY;
+ }
+ SVID = static_cast<unsigned short>(svidU4);
}
}
--
Gitblit v1.9.3