LAPTOP-SNT8I5JK\Boounion
2025-08-11 5edb485d226790306097e40ea954efb2ed90dd21
1.EAP:查询CJSpace和PJSpace功能模拟,Master对EAP查询机器变量的回复;
已修改12个文件
143 ■■■■■ 文件已修改
SourceCode/Bond/EAPSimulator/CHsmsActive.cpp 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CHsmsActive.h 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulator.rc 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/Resource.h 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CVariable.cpp 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CVariable.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/HsmsPassive.cpp 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/HsmsPassive.h 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/ServoDlg.cpp 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/x64/Debug/VariableList.txt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
@@ -289,6 +289,18 @@
    return 0;
}
int CHsmsActive::hsmsSelectedEquipmentStatusRequest(unsigned int SVID)
{
    IMessage* pMessage = nullptr;
    int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 1 | REPLY, 3, ++m_nSystemByte);
    pMessage->getBody()->addU4Item(SVID, "SVID");
    m_pActive->sendMessage(pMessage);
    HSMS_Destroy1Message(pMessage);
    return 0;
}
int CHsmsActive::hsmsQueryPPIDList()
{
    IMessage* pMessage = nullptr;
SourceCode/Bond/EAPSimulator/CHsmsActive.h
@@ -6,6 +6,10 @@
#include "CCollectionEvent.h"
#define SVID_CJobSpace                5001
#define SVID_PJobSpace                5002
typedef std::function<void(void* pFrom, ACTIVESTATE state)> STATECHANGED;
typedef struct _ACTIVEListener
{
@@ -61,6 +65,9 @@
    int hsmsTransmitSpooledData();
    int hsmsPurgeSpooledData();
    // 查询变量
    int hsmsSelectedEquipmentStatusRequest(unsigned int SVID);
    // 查询PPID List
    int hsmsQueryPPIDList();
SourceCode/Bond/EAPSimulator/EAPSimulator.rc
Binary files differ
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
@@ -90,6 +90,8 @@
    ON_BN_CLICKED(IDC_BUTTON_QUERY_PPID_LIST, &CEAPSimulatorDlg::OnBnClickedButtonQueryPpidList)
    ON_BN_CLICKED(IDC_BUTTON_PROCEED_WITH_CARRIER, &CEAPSimulatorDlg::OnBnClickedButtonProceedWithCarrier)
    ON_BN_CLICKED(IDC_BUTTON_CARRIER_RELEASE, &CEAPSimulatorDlg::OnBnClickedButtonCarrierRelease)
    ON_BN_CLICKED(IDC_BUTTON_QUERY_CJ_SPACE, &CEAPSimulatorDlg::OnBnClickedButtonQueryCjSpace)
    ON_BN_CLICKED(IDC_BUTTON_QUERY_PJ_SPACE, &CEAPSimulatorDlg::OnBnClickedButtonQueryPjSpace)
END_MESSAGE_MAP()
@@ -279,6 +281,8 @@
    GetDlgItem(IDC_BUTTON_QUERY_PPID_LIST)->EnableWindow(enabled);    
    GetDlgItem(IDC_BUTTON_PROCEED_WITH_CARRIER)->EnableWindow(enabled);    
    GetDlgItem(IDC_BUTTON_CARRIER_RELEASE)->EnableWindow(enabled);
    GetDlgItem(IDC_BUTTON_QUERY_CJ_SPACE)->EnableWindow(enabled);
    GetDlgItem(IDC_BUTTON_QUERY_PJ_SPACE)->EnableWindow(enabled);
}
void CEAPSimulatorDlg::OnBnClickedButtonConnect()
@@ -376,6 +380,16 @@
    theApp.m_model.m_pHsmsActive->hsmsPurgeSpooledData();
}
void CEAPSimulatorDlg::OnBnClickedButtonQueryCjSpace()
{
    theApp.m_model.m_pHsmsActive->hsmsSelectedEquipmentStatusRequest(SVID_CJobSpace);
}
void CEAPSimulatorDlg::OnBnClickedButtonQueryPjSpace()
{
    theApp.m_model.m_pHsmsActive->hsmsSelectedEquipmentStatusRequest(SVID_PJobSpace);
}
void CEAPSimulatorDlg::OnBnClickedButtonQueryPpidList()
{
    theApp.m_model.m_pHsmsActive->hsmsQueryPPIDList();
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
@@ -59,4 +59,6 @@
    afx_msg void OnBnClickedButtonQueryPpidList();
    afx_msg void OnBnClickedButtonProceedWithCarrier();
    afx_msg void OnBnClickedButtonCarrierRelease();
    afx_msg void OnBnClickedButtonQueryCjSpace();
    afx_msg void OnBnClickedButtonQueryPjSpace();
};
SourceCode/Bond/EAPSimulator/Resource.h
@@ -46,10 +46,11 @@
#define IDC_EDIT_CE_NAME                1031
#define IDC_BUTTON_QUERY_PPID_LIST      1032
#define IDC_EDIT_CE_RPTID               1033
#define IDC_BUTTON_PROCEED_WITH_CARRIER 1033
#define IDC_BUTTON_TRANSMIT_SPOOLED_DATA 1034
#define IDC_BUTTON_PROCEED_WITH_CARRIER2 1035
#define IDC_BUTTON_CARRIER_RELEASE      1035
#define IDC_BUTTON_PROCEED_WITH_CARRIER 1034
#define IDC_BUTTON_TRANSMIT_SPOOLED_DATA 1035
#define IDC_BUTTON_CARRIER_RELEASE      1036
#define IDC_BUTTON_QUERY_CJ_SPACE       1037
#define IDC_BUTTON_QUERY_PJ_SPACE       1038
// Next default values for new objects
// 
@@ -57,7 +58,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        141
#define _APS_NEXT_COMMAND_VALUE         32771
#define _APS_NEXT_CONTROL_VALUE         1035
#define _APS_NEXT_CONTROL_VALUE         1039
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif
SourceCode/Bond/Servo/CVariable.cpp
@@ -125,4 +125,15 @@
        return strRet;
    }
    __int64 CVariable::getIntValue()
    {
        if (m_format == SVFromat::U1 || m_format == SVFromat::U2 || m_format == SVFromat::I2) {
            return m_nValue;
        }
        return 0;
    }
}
SourceCode/Bond/Servo/CVariable.h
@@ -29,6 +29,7 @@
        void setValue(__int64 value);
        void setValue(const char* pszValue);
        std::string getValue();
        __int64 getIntValue();
    private:
        unsigned int m_nVarialbeId;
SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -103,6 +103,31 @@
}
void CHsmsPassive::addVariableValueToItem(ISECS2Item* pParent, SERVO::CVariable* pVariable)
{
    ASSERT(pParent);
    ASSERT(pVariable);
    SERVO::SVFromat format = pVariable->getFormat();
    switch (format)
    {
    case SERVO::SVFromat::U1:
        pParent->addU1Item((unsigned char)pVariable->getIntValue(), "SV");
        break;
    case SERVO::SVFromat::U2:
        pParent->addU2Item((unsigned char)pVariable->getIntValue(), "SV");
        break;
    case SERVO::SVFromat::I2:
        pParent->addI2Item((unsigned char)pVariable->getIntValue(), "SV");
        break;
    case SERVO::SVFromat::A20:
    case SERVO::SVFromat::A50:
        pParent->addItem(pVariable->getValue().c_str(), "SV");
    default:
        break;
    }
}
void CHsmsPassive::linkEventReport(unsigned int CEID, unsigned int RPTID)
{
    SERVO::CCollectionEvent* pEvent = getEvent(CEID);
@@ -536,6 +561,9 @@
            // S1F1
            replyAreYouThere(pMessage);
        }
        else if (nStream == 1 && pHeader->function == 3) {
            replySelectedEquipmentStatusData(pMessage);
        }
        else if (nStream == 1 && pHeader->function == 13) {
            replyEstablishCommunications(pMessage);
        }
@@ -902,6 +930,45 @@
    return 0;
}
int CHsmsPassive::replySelectedEquipmentStatusData(IMessage* pRecv)
{
    if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) {
        return ER_NOTSELECT;
    }
    IMessage* pMessage = NULL;
    HSMS_Create1Message(pMessage, m_nSessionId, 1, 4, pRecv->getHeader()->systemBytes);
    ASSERT(pMessage);
    unsigned char SVU1 = 0;
    unsigned int SVID = 0;
    ISECS2Item* pBody = pRecv->getBody();
    if (pBody == nullptr || pBody->getType() != SITYPE::L) {
        pMessage->getBody()->addU1Item(SVU1, "SV");
        goto MYREPLY;
    }
    if (!pBody->getSubItemU4(0, SVID)) {
        pMessage->getBody()->addU1Item(SVU1, "SV");
        goto MYREPLY;
    }
    SERVO::CVariable* pVariable = getVariable(SVID);
    if (pVariable == nullptr) {
        pMessage->getBody()->addU1Item(SVU1, "SV");
        goto MYREPLY;
    }
    addVariableValueToItem(pMessage->getBody(), pVariable);
MYREPLY:
    m_pPassive->sendMessage(pMessage);
    LOGI("<HSMS>[SECS Msg SEND]%s", pMessage->toString());
    HSMS_Destroy1Message(pMessage);
    return 0;
}
// S2F13
int CHsmsPassive::replyEquipmentConstantRequest(IMessage* pRecv)
{
SourceCode/Bond/Servo/HsmsPassive.h
@@ -115,6 +115,9 @@
    /* 设置软件版本号 最大长度 20 bytes */
    void setSoftRev(const char* pszRev);
    /* 添加变量值到ISECS2Item */
    void addVariableValueToItem(ISECS2Item* pParent, SERVO::CVariable* pVariable);
    // 连接Report
    void linkEventReport(unsigned int CEID, unsigned int RPTID);
@@ -188,6 +191,7 @@
    /* reply开头的函数为回复函数 */
    int replyAreYouThere(IMessage* pRecv);
    int replyEstablishCommunications(IMessage* pRecv);
    int replySelectedEquipmentStatusData(IMessage* pRecv);
    int replyOnLine(IMessage* pRecv);
    int replyOffLine(IMessage* pRecv);
    int replyEquipmentConstantRequest(IMessage* pRecv);
SourceCode/Bond/Servo/ServoDlg.cpp
@@ -39,6 +39,8 @@
/* 运行时间定时器 */
#define TIMER_ID_UPDATE_RUMTIME            2
/* Test */
#define TIMER_ID_TEST                    3
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
@@ -332,7 +334,7 @@
    // model init
    theApp.m_model.init();
    SetTimer(TIMER_ID_TEST, 1000, nullptr);
    // 菜单
    CMenu menu;
@@ -875,6 +877,13 @@
        m_pMyStatusbar->setRunTimeText((LPTSTR)(LPCTSTR)strText);
    }
    else if(TIMER_ID_TEST == nIDEvent){
        static __int64 tttt = 0;
        tttt++;
        theApp.m_model.m_hsmsPassive.setVariableValue("CJobSpace", tttt % 10);
        theApp.m_model.m_hsmsPassive.setVariableValue("PJobSpace", tttt % 5);
    }
    CDialogEx::OnTimer(nIDEvent);
}
SourceCode/Bond/x64/Debug/VariableList.txt
@@ -8,7 +8,6 @@
701,PreviousProcessState,U1,
800,EFEMPPExecName,A20,
801,EQPPExecName,A20,
1000,CJobSpace,U1,
2000,RbRAxisTorque,I2,机器人R轴扭矩
2001,RbLAxisTorque,l2,机器人L轴扭矩
2002,RbZAxisTorque,l2,机器人Z轴扭矩
@@ -36,3 +35,5 @@
2024,CCDEnable,U2,"CCD使能:O:开启 1:屏蔽"
2025,FFUParameter,U2,FFU设定值
5000,CarrierID,A20,卡匣ID
5001,CJobSpace,U1,CJ Space
5002,PJobSpace,U1,PJ Space