chenluhua1980
2026-01-08 e878ac7788fef44639145ffd971ab0eb06d692ad
1.EAP模拟器,远程控件切换状态;
已修改5个文件
113 ■■■■■ 文件已修改
SourceCode/Bond/EAPSimulator/CHsmsActive.cpp 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CHsmsActive.h 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/Resource.h 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
@@ -143,6 +143,48 @@
    return 0;
}
int CHsmsActive::hsmsRequestOnline()
{
    IMessage* pMessage = nullptr;
    int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 1 | REPLY, 17, ++m_nSystemByte);
    m_pActive->sendMessage(pMessage);
    HSMS_Destroy1Message(pMessage);
    return 0;
}
int CHsmsActive::hsmsRequestOffline()
{
    IMessage* pMessage = nullptr;
    int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 1 | REPLY, 15, ++m_nSystemByte);
    m_pActive->sendMessage(pMessage);
    HSMS_Destroy1Message(pMessage);
    return 0;
}
int CHsmsActive::hsmsGoLocal()
{
    IMessage* pMessage = nullptr;
    int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 2 | REPLY, 41, ++m_nSystemByte);
    ISECS2Item* pBody = pMessage->getBody();
    pBody->addItem("GoLocal", "RCMD");
    pBody->addItem(); // L: empty params
    m_pActive->sendMessage(pMessage);
    HSMS_Destroy1Message(pMessage);
    return 0;
}
int CHsmsActive::hsmsGoRemote()
{
    IMessage* pMessage = nullptr;
    int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 2 | REPLY, 41, ++m_nSystemByte);
    ISECS2Item* pBody = pMessage->getBody();
    pBody->addItem("GoRemote", "RCMD");
    pBody->addItem(); // L: empty params
    m_pActive->sendMessage(pMessage);
    HSMS_Destroy1Message(pMessage);
    return 0;
}
int CHsmsActive::hsmsDatetimeSync()
{
    CTime time = CTime::GetCurrentTime();
SourceCode/Bond/EAPSimulator/CHsmsActive.h
@@ -42,6 +42,14 @@
    // Are You There
    int hsmsAreYouThere();
    // ControlState: Request Online/Offline (S1F17 / S1F15)
    int hsmsRequestOnline();
    int hsmsRequestOffline();
    // ControlState: GoLocal/GoRemote (S2F41)
    int hsmsGoLocal();
    int hsmsGoRemote();
    // Date time sync
    int hsmsDatetimeSync();
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
@@ -98,6 +98,9 @@
    ON_BN_CLICKED(IDC_BUTTON_QUERY_PJ_SPACE, &CEAPSimulatorDlg::OnBnClickedButtonQueryPjSpace)
    ON_BN_CLICKED(IDC_BUTTON_CREATE_PJ, &CEAPSimulatorDlg::OnBnClickedButtonCreatePj)
    ON_BN_CLICKED(IDC_BUTTON_CREATE_CJ, &CEAPSimulatorDlg::OnBnClickedButtonCreateCj)
    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)
END_MESSAGE_MAP()
@@ -191,6 +194,32 @@
            m_hWnd, (HMENU)IDC_BUTTON_PROCEED_WITH_SLOTMAP, AfxGetInstanceHandle(), nullptr);
        if (hBtn != nullptr) {
            ::SendMessage(hBtn, WM_SETFONT, (WPARAM)GetFont()->GetSafeHandle(), TRUE);
        }
    }
    // ControlState test buttons at runtime (resource file is UTF-16, keep it unchanged)
    {
        const int y = 120;
        const int w = 70;
        const int h = 14;
        const int gap = 3;
        struct BtnDef { int x; int id; const TCHAR* text; };
        BtnDef defs[] = {
            { 238, IDC_BUTTON_CTRL_OFFLINE, _T("Ctrl Offline") },
            { 238 + (w + gap), IDC_BUTTON_CTRL_ONLINE_LOCAL, _T("Ctrl Local") },
            { 238 + 2 * (w + gap), IDC_BUTTON_CTRL_ONLINE_REMOTE, _T("Ctrl Remote") },
        };
        for (const auto& d : defs) {
            CRect rc(d.x, y, d.x + w, y + h); // dialog units
            MapDialogRect(&rc);
            HWND hBtn = ::CreateWindow(_T("BUTTON"), d.text,
                WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                rc.left, rc.top, rc.Width(), rc.Height(),
                m_hWnd, (HMENU)d.id, AfxGetInstanceHandle(), nullptr);
            if (hBtn != nullptr) {
                ::SendMessage(hBtn, WM_SETFONT, (WPARAM)GetFont()->GetSafeHandle(), TRUE);
            }
        }
    }
@@ -307,6 +336,15 @@
    GetDlgItem(IDC_BUTTON_QUERY_PJ_SPACE)->EnableWindow(enabled);
    GetDlgItem(IDC_BUTTON_CREATE_PJ)->EnableWindow(enabled);    
    GetDlgItem(IDC_BUTTON_CREATE_CJ)->EnableWindow(enabled);    
    if (GetDlgItem(IDC_BUTTON_CTRL_OFFLINE) != nullptr) {
        GetDlgItem(IDC_BUTTON_CTRL_OFFLINE)->EnableWindow(enabled);
    }
    if (GetDlgItem(IDC_BUTTON_CTRL_ONLINE_LOCAL) != nullptr) {
        GetDlgItem(IDC_BUTTON_CTRL_ONLINE_LOCAL)->EnableWindow(enabled);
    }
    if (GetDlgItem(IDC_BUTTON_CTRL_ONLINE_REMOTE) != nullptr) {
        GetDlgItem(IDC_BUTTON_CTRL_ONLINE_REMOTE)->EnableWindow(enabled);
    }
}
void CEAPSimulatorDlg::OnBnClickedButtonConnect()
@@ -454,3 +492,20 @@
    std::vector<std::string> processJobIds = {"PJ0001"};
    theApp.m_model.m_pHsmsActive->hsmsCreateControlJob("CJ5007", processJobIds);
}
void CEAPSimulatorDlg::OnBnClickedButtonCtrlOffline()
{
    theApp.m_model.m_pHsmsActive->hsmsRequestOffline();
}
void CEAPSimulatorDlg::OnBnClickedButtonCtrlOnlineLocal()
{
    theApp.m_model.m_pHsmsActive->hsmsRequestOnline();
    theApp.m_model.m_pHsmsActive->hsmsGoLocal();
}
void CEAPSimulatorDlg::OnBnClickedButtonCtrlOnlineRemote()
{
    theApp.m_model.m_pHsmsActive->hsmsRequestOnline();
    theApp.m_model.m_pHsmsActive->hsmsGoRemote();
}
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
@@ -64,4 +64,7 @@
    afx_msg void OnBnClickedButtonQueryPjSpace();
    afx_msg void OnBnClickedButtonCreatePj();
    afx_msg void OnBnClickedButtonCreateCj();
    afx_msg void OnBnClickedButtonCtrlOffline();
    afx_msg void OnBnClickedButtonCtrlOnlineLocal();
    afx_msg void OnBnClickedButtonCtrlOnlineRemote();
};
SourceCode/Bond/EAPSimulator/Resource.h
@@ -58,6 +58,9 @@
#define IDC_BUTTON_CREATE_CJ            1040
#define IDC_BUTTON_DELETE               1041
#define IDC_BUTTON_PROCEED_WITH_SLOTMAP 1042
#define IDC_BUTTON_CTRL_OFFLINE         1043
#define IDC_BUTTON_CTRL_ONLINE_LOCAL    1044
#define IDC_BUTTON_CTRL_ONLINE_REMOTE   1045
// Next default values for new objects
// 
@@ -65,7 +68,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        143
#define _APS_NEXT_COMMAND_VALUE         32771
#define _APS_NEXT_CONTROL_VALUE         1043
#define _APS_NEXT_CONTROL_VALUE         1046
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif