| | |
| | | { |
| | | } |
| | | |
| | | void CModel::refreshDerivedSVs() |
| | | { |
| | | // CJobSpace: how many ControlJobs can be created (current implementation supports 0/1). |
| | | m_hsmsPassive.setVariableValue("CJobSpace", (__int64)(m_master.canCreateControlJob() ? 1 : 0)); |
| | | } |
| | | |
| | | IObservable* CModel::getObservable() |
| | | { |
| | | if (m_pObservable == nullptr) { |
| | |
| | | listener.onEQConstantRequest = [&](void* pFrom, std::vector<EQConstant>& eqcs) -> void { |
| | | // 在此填充常量值,目前仅是加1后返回 |
| | | for (auto& item : eqcs) { |
| | | sprintf_s(item.szValue, 256, "Test%d", item.id + 1); |
| | | sprintf_s(item.szValue, EQCONSTANT_VALUE_MAX, "Test%d", item.id + 1); |
| | | } |
| | | }; |
| | | listener.onEQConstantSend = [&](void* pFrom, std::vector<EQConstant>& eqcs) -> void { |
| | |
| | | CString strVarialbleFile; |
| | | strVarialbleFile.Format(_T("%s\\VariableList.txt"), (LPTSTR)(LPCTSTR)m_strWorkDir); |
| | | m_hsmsPassive.loadVarialbles((LPTSTR)(LPCTSTR)strVarialbleFile); |
| | | refreshDerivedSVs(); |
| | | m_hsmsPassive.init(this, "APP", 7000); |
| | | strVarialbleFile.Format(_T("%s\\ReportList.txt"), (LPTSTR)(LPCTSTR)m_strWorkDir); |
| | | m_hsmsPassive.loadReports((LPTSTR)(LPCTSTR)strVarialbleFile); |
| | |
| | | LOGI("<CModel>Master state changed(%d)", (int)state); |
| | | notify(RX_CODE_MASTER_STATE_CHANGED); |
| | | }; |
| | | masterListener.onControlJobChanged = [this](void* pMaster) { |
| | | (void)pMaster; |
| | | this->refreshDerivedSVs(); |
| | | }; |
| | | masterListener.onEqAlive = [&](void* pMaster, SERVO::CEquipment* pEquipment, BOOL bAlive) -> void { |
| | | LOGI("<CModel>Equipment onAlive:%s(%s).", pEquipment->getName().c_str(), |
| | | bAlive ? _T("ON") : _T("OFF")); |
| | |
| | | } |
| | | notifyPtr(RX_CODE_LOADPORT_STATUS_CHANGED, pEquipment); |
| | | }; |
| | | masterListener.onProcessStateChanged = [&](void* pMaster, SERVO::CEquipment* pEquipment, int slotNo, SERVO::PROCESS_STATE state) { |
| | | // SubEqpStart/SubEqpEnd: align to log's EV_SubEqpStart/EV_SubEqpEnd stage (no report payload required). |
| | | (void)pMaster; |
| | | if (pEquipment != nullptr) { |
| | | m_hsmsPassive.setVariableValue("SubEqpName", pEquipment->getName().c_str()); |
| | | } |
| | | m_hsmsPassive.setVariableValue("SubEqpSlot", slotNo); |
| | | if (state == SERVO::PROCESS_STATE::Processing) { |
| | | m_hsmsPassive.requestEventReportSend_SubEqpStart(); |
| | | } |
| | | else if (state == SERVO::PROCESS_STATE::Complete) { |
| | | m_hsmsPassive.requestEventReportSend_SubEqpEnd(); |
| | | } |
| | | }; |
| | | masterListener.onCTRoundEnd = [&](void* pMaster, int round) { |
| | | m_configuration.setContinuousTransferCount(round); |
| | | }; |
| | |
| | | masterListener.onPanelEnd = [&](void* pMaster, void* pPanel) { |
| | | m_hsmsPassive.setVariableValue("PanelEndID", ((SERVO::CGlass*)pPanel)->getID().c_str()); |
| | | m_hsmsPassive.requestEventReportSend_Panel_End(); |
| | | // Placeholder payload to match log shape: EV_PROCESS_DATA_REPORT can carry a single A-string (may be empty). |
| | | m_hsmsPassive.setVariableValue("ProcessDataReportText", ""); |
| | | m_hsmsPassive.requestEventReportSend_ProcessDataReport(); |
| | | auto& db = GlassLogDb::Instance(); |
| | | db.insertFromCGlass((*(SERVO::CGlass*)pPanel)); |
| | | SERVO::CGlass* pBuddy = ((SERVO::CGlass*)pPanel)->getBuddy(); |