| SourceCode/Bond/EAPSimulator/CHsmsActive.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/EAPSimulator/CHsmsActive.h | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/EAPSimulator/EAPSimulator.rc | 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/EAPSimulator/Resource.h | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
@@ -1,5 +1,6 @@ #include "pch.h" #include "CHsmsActive.h" #include "Log.h" CHsmsActive::CHsmsActive() @@ -32,16 +33,21 @@ } if (ACTIVESTATE::NOT_SELECTED == state) { LOGI("Active state changed(NOT_SELECTED)."); hsmsSelectRequest(); } else if (ACTIVESTATE::SELECTED == state) { LOGI("Active state changed(SELECTED)."); hsmsEstablishCommunications(); } else if (ACTIVESTATE::NOT_CONNECTED == state) { LOGI("Active state changed(NOT_CONNECTED)."); m_pActive->disconnect(); } }; auto onRecvSysMessage = [&](void* pFrom, IMessage* pMessage) -> void { LOGI("onRecvSysMessage(sessionId:%d, sType:%d).", pMessage->getHeader()->sessionId, pMessage->getHeader()->sType); TRACE("sessionId:%d, sType:%d\n", pMessage->getHeader()->sessionId, pMessage->getHeader()->sType); }; @@ -57,6 +63,7 @@ HEADER* pHeader = pMessage->getHeader(); TRACE("收到消息 S%dF%d================\n", pHeader->stream & 0x7F, pHeader->function); TRACE("Body:%s\n", pMessage->toString()); LOGI("onRecvDataMessage(%s).", pMessage->toString()); }; ActiveListener listener; @@ -113,3 +120,13 @@ return 0; } int CHsmsActive::hsmsAreYouThere() { IMessage* pMessage = nullptr; int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 1 | REPLY, 1, ++m_nSystemByte); m_pActive->sendMessage(pMessage); HSMS_Destroy1Message(pMessage); return 0; } SourceCode/Bond/EAPSimulator/CHsmsActive.h
@@ -25,10 +25,11 @@ // Deselect Request int hsmsDeselectRequest(); // 建立通讯(S1F13) int hsmsEstablishCommunications(); // Are You There int hsmsAreYouThere(); private: ACTIVEListener m_listener; SourceCode/Bond/EAPSimulator/EAPSimulator.rcBinary files differ
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(); } SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
@@ -17,6 +17,9 @@ private: void AppendLog(int level, const char* pszText); void InitRxWindow(); void SetGroup1Enabled(bool enabled); void SetGroup2Enabled(bool enabled); // 对话框数据 #ifdef AFX_DESIGN_TIME @@ -43,4 +46,5 @@ afx_msg void OnDestroy(); afx_msg void OnBnClickedButtonConnect(); afx_msg void OnBnClickedButtonDisconnect(); afx_msg void OnBnClickedButtonAreYouThere(); }; SourceCode/Bond/EAPSimulator/Resource.h
@@ -12,6 +12,8 @@ #define IDC_EDIT_PORT 1002 #define IDC_BUTTON_CONNECT 1003 #define IDC_BUTTON_DISCONNECT 1004 #define IDC_BUTTON3 1005 #define IDC_BUTTON_ARE_YOU_THERE 1005 // Next default values for new objects // @@ -19,7 +21,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 129 #define _APS_NEXT_COMMAND_VALUE 32771 #define _APS_NEXT_CONTROL_VALUE 1005 #define _APS_NEXT_CONTROL_VALUE 1006 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif