Commit 334d4002 authored by yannick legoc's avatar yannick legoc
Browse files

Implemented link between TasSettings and RemoteMatlab

parent f0997f35
......@@ -42,10 +42,11 @@ RemoteMatlab::RemoteMatlab(const std::string& name) :
initialized.init(this, NOSAVE, "initialized");
test.init(this, SAVE, "test");
testNumor.init(this, SAVE, "test_numor");
active.init(this, SAVE, "active");
active.init(this, NOSAVE, "active");
scanController.init(this, "scan");
countSpy.init(this, "acquisition_spy");
tasSettings.init(this, "settings");
experimentData.assign(InstrumentManager::getInstance()->getFirstExperimentControllerByType("title"));
}
......@@ -53,6 +54,19 @@ RemoteMatlab::RemoteMatlab(const std::string& name) :
RemoteMatlab::~RemoteMatlab() {
}
void RemoteMatlab::postConfiguration() {
registerUpdater(tasSettings->mode, &RemoteMatlab::updateSettingsMode, this);
updateSettingsMode();
}
void RemoteMatlab::updateSettingsMode() {
// RemoteMatlab is only active in case of flatcone.
active = (tasSettings->mode() == tas::TasSettings::FLATCONE_MODE);
}
string RemoteMatlab::getProposalId() const {
return experimentData->proposalId();
}
......
......@@ -24,6 +24,7 @@
#include "controllers/common/acquisition/ExperimentData.h"
#include "controllers/common/scanlegacy/GenericScan1D.h"
#include "controllers/common/utilities/CountSpy.h"
#include "controllers/tas/common/TasSettings.h"
#include "NumorMessages.pb.h"
#include <cameo/cameo.h>
......@@ -40,6 +41,10 @@ public:
RemoteMatlab(const std::string& name);
virtual ~RemoteMatlab();
virtual void postConfiguration();
void updateSettingsMode();
Property<std::string> serverEndpoint;
Property<bool> initialized;
Property<bool> test;
......@@ -49,6 +54,7 @@ public:
ControllerPtr<acquisition::ExperimentData> experimentData;
ControllerPtr<scan::GenericScan1D> scanController;
ControllerPtr<utilities::CountSpy> countSpy;
ControllerPtr<tas::TasSettings> tasSettings;
protected:
std::string getProposalId() const;
......
......@@ -71,6 +71,8 @@ RemoteMatlabPub::~RemoteMatlabPub() {
void RemoteMatlabPub::postConfiguration() {
RemoteMatlab::postConfiguration();
registerUpdater(scanController->serializerEvent, &RemoteMatlabPub::updateNumor, this);
//registerUpdater(scanController->getCount()->statusMessage, &RemoteMatlabPub::updateCountStatusMessage, this);
registerUpdater(countSpy->statusMessage, &RemoteMatlabPub::updateCountStatusMessage, this);
......
......@@ -64,6 +64,8 @@ RemoteMatlabReq::~RemoteMatlabReq() {
void RemoteMatlabReq::postConfiguration() {
RemoteMatlab::postConfiguration();
registerUpdater(scanController->serializerEvent, &RemoteMatlabReq::updateNumor, this);
//registerUpdater(scanController->getCount()->statusMessage, &RemoteMatlabReq::updateCountStatusMessage, this);
registerUpdater(countSpy->statusMessage, &RemoteMatlabReq::updateCountStatusMessage, this);
......@@ -134,7 +136,9 @@ bool RemoteMatlabReq::initApplication() {
void RemoteMatlabReq::updateNumor() {
// Send the numor to be computed if there is something to serialize
if (scanController->serializerEvent()) {
if (scanController->serializerEvent()
&& active()) {
// Send the numor
if (test()) {
sendNumor(testNumor(), false);
......@@ -146,7 +150,9 @@ void RemoteMatlabReq::updateNumor() {
void RemoteMatlabReq::updateCountStatusMessage() {
if ((countSpy->statusMessage() == "Close data") && scanController->getScanInfo()->running()) {
if ((countSpy->statusMessage() == "Close data")
&& scanController->getScanInfo()->running()
&& active()) {
cout << "Send the numor for live refresh" << endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment