| | |
| | | |
| | | int CModel::init() |
| | | { |
| | | const ULONGLONG boot_model_begin = GetTickCount64(); |
| | | CString strIniFile; |
| | | CString strUnitId; |
| | | strIniFile.Format(_T("%s\\ServoConfiguration.ini"), (LPTSTR)(LPCTSTR)m_strWorkDir); |
| | |
| | | CLog::GetLog()->SetLogsDir(strLogDir); |
| | | CLog::GetLog()->SetEquipmentId((LPTSTR)(LPCTSTR)strUnitId); |
| | | LOGI("\r\n\r\n~~~ Prog Start! ~~~"); |
| | | LOGI("[BOOT][MODEL] init begin"); |
| | | |
| | | |
| | | SECSListener listener; |
| | |
| | | for (auto p : pjs) { |
| | | LOGI("<Model>onPRJobMultiCreate %s %s", p->id().c_str(), p->recipeSpec().c_str()); |
| | | } |
| | | |
| | | auto rejectAll = [&](uint32_t code, const std::string& msg) -> int { |
| | | LOGW("<Model>onPRJobMultiCreate rejected: %s", msg.c_str()); |
| | | for (auto p : pjs) { |
| | | if (p != nullptr) p->addIssue(code, msg); |
| | | } |
| | | return -1; |
| | | }; |
| | | |
| | | // 单 PJ 模式:只接受 1 条且当前无在制 PJ |
| | | if (pjs.size() != 1) { |
| | | return rejectAll(1200, "Only 1 ProcessJob supported (single-PJ mode)"); |
| | | } |
| | | if (!m_master.isProcessJobsEmpty()) { |
| | | return rejectAll(1201, "ProcessJob exists, cannot create new in single-PJ mode"); |
| | | } |
| | | |
| | | int nRet = m_master.setProcessJobs(pjs); |
| | | auto processJobs = m_master.getProcessJobs(); |
| | | std::vector<SERVO::CVariable> vars; |
| | |
| | | } |
| | | strVarialbleFile.Format(_T("%s\\HsmsPassive.cache"), (LPTSTR)(LPCTSTR)m_strWorkDir); |
| | | m_hsmsPassive.loadCacheFromFile(strVarialbleFile); |
| | | LOGI("[BOOT][MODEL] HSMS config loaded, cost=%llu ms", |
| | | (unsigned long long)(GetTickCount64() - boot_model_begin)); |
| | | |
| | | |
| | | SERVO::MasterListener masterListener; |
| | |
| | | char szBuffer[MAX_PATH]; |
| | | sprintf_s(szBuffer, MAX_PATH, "%s\\AlarmList.csv", (LPTSTR)(LPCTSTR)m_strWorkDir); |
| | | alarmManager.readAlarmFile(szBuffer); |
| | | LOGI("[BOOT][MODEL] Alarm list loaded, cost=%llu ms", |
| | | (unsigned long long)(GetTickCount64() - boot_model_begin)); |
| | | |
| | | |
| | | // Glass数据库 |
| | |
| | | GlassLogDb::Init(path); |
| | | |
| | | |
| | | LOGI("[BOOT][MODEL] init finished, total cost=%llu ms", |
| | | (unsigned long long)(GetTickCount64() - boot_model_begin)); |
| | | return 0; |
| | | } |
| | | |