Closed lucabaldini closed 7 years ago
Getting started on this
diff --git a/daq/pRunController.cpp b/daq/pRunController.cpp
index 573b933..5be15a6 100644
--- a/daq/pRunController.cpp
+++ b/daq/pRunController.cpp
@@ -60,10 +60,12 @@ pRunController::pRunController(std::string configFilePath,
if (!xpedaqos::fileExists(m_trgMaskFilePath)) {
xpedaqos::copyFile(m_trgMaskFilePath + ".sample", m_trgMaskFilePath);
}
+ m_lockFilePath = xpedaqos::rjoin(".ups.lock");
setupRun();
m_timer = new QTimer();
m_timer->setInterval(1000);
connect(m_timer, SIGNAL(timeout()), this, SLOT(updateRunInfo()));
+ connect(m_timer, SIGNAL(timeout()), this, SLOT(checkLockFile()));
m_usbController = new pUsbController();
m_xpolFpga = new pXpolFpga(m_usbController);
m_dataCollector = new pDataCollector(m_xpolFpga, m_emitBlocks);
@@ -289,6 +291,19 @@ void pRunController::resetRunInfo()
}
+/*!
+ */
+void pRunController::checkLockFile()
+{
+ if (FILE *file = fopen(m_lockFilePath.c_str(), "r")) {
+ *xpollog::kError << "Lock file " << m_lockFilePath
+ << " found, stopping run..." << endline;
+ fclose(file);
+ setStopped();
+ }
+}
+
+
/*! Nothing to do here.
*/
void pRunController::fsmSetup()
diff --git a/daq/pRunController.h b/daq/pRunController.h
index eb44649..d671a9c 100644
--- a/daq/pRunController.h
+++ b/daq/pRunController.h
@@ -297,12 +297,21 @@ class pRunController : public pFiniteStateMachine
/// Flag for requiring the dataCollector to emit data blocks on reading
bool m_emitBlocks;
+
+ /// Path to the lock file.
+ std::string m_lockFilePath;
private slots:
-
+ /// Check the presence of a lock file and stop the DAQ if needed.
+ virtual void checkLockFile();
+
};
#endif //PRUNCONTROLLER_H
It goes without saying, this needs to be tested.
In today weekly meeting Fabio said it works, This issue can be closed.
The basic idea being: 1\ the UPS can write a lock file in a given folder 2\ the daq check for the presence of the lock file and, if found, stops the data acquisition.