添加管控软件和相机的通讯

This commit is contained in:
lidg
2026-10-27 22:16:55 +08:00
parent 23674e0ede
commit 4d23a71dd6
25 changed files with 2964 additions and 294 deletions
+29
View File
@@ -4,6 +4,7 @@ ProductionWorker::ProductionWorker(QObject *parent)
: QObject(parent)
, m_service(nullptr)
, m_stopRequested(false)
, m_pauseRequested(false)
{
}
@@ -15,6 +16,11 @@ void ProductionWorker::ensureService()
m_service = new ProductionService(this);
m_service->setExternalStopFlag(&m_stopRequested);
m_service->setExternalPauseFlag(&m_pauseRequested);
connect(m_service, &ProductionService::visionMeasureRequested, this, &ProductionWorker::visionMeasureRequested);
connect(m_service, &ProductionService::visionCancelRequested, this, &ProductionWorker::visionCancelRequested);
connect(m_service, &ProductionService::visionCycleChanged, this, &ProductionWorker::visionCycleChanged);
connect(m_service, &ProductionService::visionProductionActiveChanged, this, &ProductionWorker::visionProductionActiveChanged);
connect(m_service, &ProductionService::stateChanged,
this, &ProductionWorker::stateChanged);
connect(m_service, &ProductionService::deviceStatusChanged,
@@ -48,6 +54,29 @@ void ProductionWorker::requestStopImmediate()
m_stopRequested.store(true);
}
void ProductionWorker::requestPauseImmediate()
{
m_pauseRequested.store(true);
}
void ProductionWorker::updateVisionAvailability(bool ready, bool busy, const QString &session)
{
ensureService();
m_service->onVisionAvailability(ready, busy, session);
}
void ProductionWorker::receiveVisionResult(const QJsonObject &result)
{
ensureService();
m_service->onVisionResult(result);
}
void ProductionWorker::requestVisionSnapshot()
{
ensureService();
m_service->publishVisionSnapshot();
}
void ProductionWorker::reportFailure(bool success, const QString &error)
{
if (!success && !error.isEmpty()) {