From a9e9f76d23ee7206ea0080a8f5a94e312c9d90f1 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 08 七月 2025 19:41:08 +0800
Subject: [PATCH] 1.UI分组启用和禁用,方便增加更多测试功能时代码整洁简单; 2.增加Are You There测试;
---
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp | 35 +++++++++++++++++++++++++++--------
1 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
index ee40fd2..e37d164 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
@@ -73,6 +73,7 @@
ON_WM_DESTROY()
ON_BN_CLICKED(IDC_BUTTON_CONNECT, &CEAPSimulatorDlg::OnBnClickedButtonConnect)
ON_BN_CLICKED(IDC_BUTTON_DISCONNECT, &CEAPSimulatorDlg::OnBnClickedButtonDisconnect)
+ ON_BN_CLICKED(IDC_BUTTON_ARE_YOU_THERE, &CEAPSimulatorDlg::OnBnClickedButtonAreYouThere)
END_MESSAGE_MAP()
@@ -103,13 +104,11 @@
int state;
if (pAny->getIntValue("exCode", state)) {
if ((ACTIVESTATE)state == ACTIVESTATE::SELECTED) {
- GetDlgItem(IDC_BUTTON_DISCONNECT)->EnableWindow(TRUE);
+ SetGroup2Enabled(TRUE);
}
if ((ACTIVESTATE)state == ACTIVESTATE::NOT_CONNECTED) {
- GetDlgItem(IDC_BUTTON_DISCONNECT)->EnableWindow(FALSE);
- GetDlgItem(IDC_EDIT_IP)->EnableWindow(TRUE);
- GetDlgItem(IDC_EDIT_PORT)->EnableWindow(TRUE);
- GetDlgItem(IDC_BUTTON_CONNECT)->EnableWindow(TRUE);
+ SetGroup2Enabled(FALSE);
+ SetGroup1Enabled(TRUE);
}
}
}
@@ -125,6 +124,8 @@
theApp.m_model.getObservable()->observeOn(pRxWindows->mainThread())
->subscribe(m_pObserver);
}
+
+ theApp.m_model.init();
}
BOOL CEAPSimulatorDlg::OnInitDialog()
@@ -158,6 +159,8 @@
SetDlgItemText(IDC_EDIT_IP, _T("127.0.0.1"));
SetDlgItemInt(IDC_EDIT_PORT, 7000);
+ SetGroup2Enabled(FALSE);
+ SetGroup1Enabled(TRUE);
// log edit
@@ -236,6 +239,19 @@
m_pObserver = NULL;
}
+void CEAPSimulatorDlg::SetGroup1Enabled(bool enabled)
+{
+ GetDlgItem(IDC_EDIT_IP)->EnableWindow(enabled);
+ GetDlgItem(IDC_EDIT_PORT)->EnableWindow(enabled);
+ GetDlgItem(IDC_BUTTON_CONNECT)->EnableWindow(enabled);
+}
+
+void CEAPSimulatorDlg::SetGroup2Enabled(bool enabled)
+{
+ GetDlgItem(IDC_BUTTON_DISCONNECT)->EnableWindow(enabled);
+ GetDlgItem(IDC_BUTTON_ARE_YOU_THERE)->EnableWindow(enabled);
+}
+
void CEAPSimulatorDlg::OnBnClickedButtonConnect()
{
CString strIp;
@@ -243,12 +259,15 @@
GetDlgItemText(IDC_EDIT_IP, strIp);
port = GetDlgItemInt(IDC_EDIT_PORT);
theApp.m_model.connectEq((LPTSTR)(LPCTSTR)strIp, port);
- GetDlgItem(IDC_EDIT_IP)->EnableWindow(FALSE);
- GetDlgItem(IDC_EDIT_PORT)->EnableWindow(FALSE);
- GetDlgItem(IDC_BUTTON_CONNECT)->EnableWindow(FALSE);
+ SetGroup1Enabled(FALSE);
}
void CEAPSimulatorDlg::OnBnClickedButtonDisconnect()
{
theApp.m_model.disconnect();
}
+
+void CEAPSimulatorDlg::OnBnClickedButtonAreYouThere()
+{
+ theApp.m_model.m_pHsmsActive->hsmsAreYouThere();
+}
--
Gitblit v1.9.3