LAPTOP-SNT8I5JK\Boounion
2025-07-08 d9c3fbc92d2a775674943d4ab882fbd77f0db688
1.增加日期时间同步功能和测试;
已修改12个文件
61 ■■■■ 文件已修改
SourceCode/Bond/EAPSimulator/CHsmsActive.cpp 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CHsmsActive.h 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulator.rc 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/Resource.h 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/HSMSSDK/Include/ISECS2Item.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.cpp 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.h 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/HsmsPassive.cpp 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/HsmsPassive.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Model.cpp 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
@@ -25,7 +25,6 @@
{
    m_strIp = pszIp;
    m_nPort = port;
    ++m_nSessionId;
    auto onStatusChanged = [&](void* pFrom, ACTIVESTATE state) -> void {
        if (m_listener.onStateChanged != nullptr) {
@@ -130,3 +129,20 @@
    return 0;
}
int CHsmsActive::hsmsDatetimeSync()
{
    CTime time = CTime::GetCurrentTime();
    char szTime[256];
    sprintf_s(szTime, 256, _T("%4d%02d%02d%02d%02d%02d00"), time.GetYear(),
        time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond());
    IMessage* pMessage = nullptr;
    int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 2 | REPLY, 31, ++m_nSystemByte);
    ISECS2Item* pItem = pMessage->getBody();
    pItem->setString((const char*)szTime, _T("Date time"));
    m_pActive->sendMessage(pMessage);
    HSMS_Destroy1Message(pMessage);
    return 0;
}
SourceCode/Bond/EAPSimulator/CHsmsActive.h
@@ -31,6 +31,9 @@
    // Are You There
    int hsmsAreYouThere();
    // Date time sync
    int hsmsDatetimeSync();
private:
    ACTIVEListener m_listener;
    IActive* m_pActive;
SourceCode/Bond/EAPSimulator/EAPSimulator.rc
Binary files differ
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
@@ -74,6 +74,7 @@
    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)
    ON_BN_CLICKED(IDC_BUTTON_DATETIME_SYNC, &CEAPSimulatorDlg::OnBnClickedButtonDatetimeSync)
END_MESSAGE_MAP()
@@ -250,6 +251,7 @@
{
    GetDlgItem(IDC_BUTTON_DISCONNECT)->EnableWindow(enabled);
    GetDlgItem(IDC_BUTTON_ARE_YOU_THERE)->EnableWindow(enabled);
    GetDlgItem(IDC_BUTTON_DATETIME_SYNC)->EnableWindow(enabled);
}
void CEAPSimulatorDlg::OnBnClickedButtonConnect()
@@ -271,3 +273,8 @@
{
    theApp.m_model.m_pHsmsActive->hsmsAreYouThere();
}
void CEAPSimulatorDlg::OnBnClickedButtonDatetimeSync()
{
    theApp.m_model.m_pHsmsActive->hsmsDatetimeSync();
}
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
@@ -47,4 +47,5 @@
    afx_msg void OnBnClickedButtonConnect();
    afx_msg void OnBnClickedButtonDisconnect();
    afx_msg void OnBnClickedButtonAreYouThere();
    afx_msg void OnBnClickedButtonDatetimeSync();
};
SourceCode/Bond/EAPSimulator/Resource.h
@@ -12,8 +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
#define IDC_BUTTON_DATETIME_SYNC        1006
// Next default values for new objects
// 
@@ -21,7 +21,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        129
#define _APS_NEXT_COMMAND_VALUE         32771
#define _APS_NEXT_CONTROL_VALUE         1006
#define _APS_NEXT_CONTROL_VALUE         1007
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif
SourceCode/Bond/HSMSSDK/Include/ISECS2Item.h
@@ -68,5 +68,6 @@
    virtual ISECS2Item* addU2Item(unsigned short value, const char* pszNote) = 0;
    virtual ISECS2Item* addU1Item(unsigned char value, const char* pszNote) = 0;
    virtual void setBinary(const char* pszData, unsigned int len, const char* pszNote) = 0;
    virtual void setString(const char* pszText, const char* pszNote) = 0;
    virtual ISECS2Item* addItem() = 0;
};
SourceCode/Bond/Servo/CMaster.cpp
@@ -1577,4 +1577,12 @@
        pPort->localSetTransferMode((SERVO::TransferMode)transferMode);
        pPort->localAutoChangeEnable(autoChangeEnable);
    }
    void CMaster::datetimeSync(SYSTEMTIME& time)
    {
        for (auto item : m_listEquipment) {
            item->setDateTime(time.wYear, time.wMonth, time.wDay,
                time.wHour, time.wMinute, time.wSecond);
        }
    }
}
SourceCode/Bond/Servo/CMaster.h
@@ -69,6 +69,7 @@
        int restoreCurrentTask();
        void setPortType(unsigned int index, BOOL enable, int type, int mode,
            int cassetteType, int transferMode, BOOL autoChangeEnable);
        void datetimeSync(SYSTEMTIME& time);
    private:
        inline void lock() { EnterCriticalSection(&m_criticalSection); }
@@ -97,7 +98,7 @@
        CRobotTask* createTransferTask_bake_to_cooling(CEquipment* pSrcEq);
        CRobotTask* createTransferTask_bakecooling_to_measurement(CEquipment* pSrcEq, CEquipment* pTarEq);
        CRobotTask* createTransferTask_restore(CEquipment* pEqSrc, CLoadPort** pPorts);
    private:
        CRITICAL_SECTION m_criticalSection;
        MasterListener m_listener;
SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -68,11 +68,7 @@
void CHsmsPassive::setListener(SECSListener listener)
{
    m_listener.onEQOffLine = listener.onEQOffLine;
    m_listener.onEQOnLine = listener.onEQOnLine;
    m_listener.onCommand = listener.onCommand;
    m_listener.onEQConstantRequest = listener.onEQConstantRequest;
    m_listener.onEQConstantSend = listener.onEQConstantSend;
    m_listener = listener;
}
void CHsmsPassive::setActionTimeout(int nSecond)
@@ -623,6 +619,9 @@
        time.wYear = atoi(&szBuffer[0]);
        time.wMilliseconds = 0;
        SetLocalTime(&time);
        if (m_listener.onDatetimeSync != nullptr) {
            m_listener.onDatetimeSync(this, time);
        }
    }
    replyAck(2, 32, pRecv->getHeader()->systemBytes, BYTE(0), "TIACK");
SourceCode/Bond/Servo/HsmsPassive.h
@@ -60,6 +60,7 @@
typedef std::function<void(void* pFrom)> SECSEQOFFLINE;
typedef std::function<void(void* pFrom, std::vector<EQConstant>&)> SECSEQCONSTANTREQUEST;
typedef std::function<void(void* pFrom, const char*, std::vector<CommandParameter>&)> SECSCommand;
typedef std::function<void(void* pFrom, SYSTEMTIME& time)> DATETIMESYNC;
typedef struct _SECSListener
{
    SECSEQOFFLINE                onEQOffLine;
@@ -67,6 +68,7 @@
    SECSEQCONSTANTREQUEST        onEQConstantRequest;
    SECSEQCONSTANTREQUEST        onEQConstantSend;
    SECSCommand                    onCommand;
    DATETIMESYNC                onDatetimeSync;
} SECSListener;
SourceCode/Bond/Servo/Model.cpp
@@ -108,6 +108,11 @@
            LOGI("onEQConstantRequest: %d, %s", item.id, item.szValue);
        }
    };
    listener.onDatetimeSync = [&](void* pFrom, SYSTEMTIME& time) -> void {
        LOGI("onDatetimeSync: %d%02d%02d%02d%02d%02d", time.wYear,
            time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond);
        m_master.datetimeSync(time);
    };
    m_hsmsPassive.setListener(listener);
    m_hsmsPassive.setEquipmentModelType((LPTSTR)(LPCTSTR)strModeType);