Commit 96c11e04 authored by Cristina Cocho's avatar Cristina Cocho
Browse files

Last changes done in D22 special modules related to nexus file data saving

parent cc992129
......@@ -17,26 +17,34 @@
*/
#include <Controller.h>
#include "D22SampleSequencer.h"
#include "PersistenceServices/DataFile/NexusDataFile.h"
namespace d22special {
const string D22SampleSequencer::TYPE = "d22_sample_sequencer";
D22SampleSequencer::D22SampleSequencer(const std::string& name) : ::SampleSequencer(name, "") {
D22SampleSequencer::D22SampleSequencer(const std::string& name) :
::SampleSequencer(name, "") {
registerFunction(TYPE);
//init properties
useSpectro.init(this, SAVE, "useSpectro");
spectroController.init(this, "spectro");
};
}
;
D22SampleSequencer::~D22SampleSequencer() {
}
void D22SampleSequencer::execute(const string& command, bool blocking, bool logging) {//necessary?
void D22SampleSequencer::execute(const string& command, bool blocking, bool logging) { //necessary?
spectroController->mode = QE65000Controller::SEQUENCE;
SampleSequencer::execute(command, blocking, logging);
//testing last measure
if (command == START_COMMAND) {
doLastMeasure();
}
spectroController->mode = QE65000Controller::ALONE;
//cout << "executing command " << command << " in D22SampleSequencer" << endl;
}
......@@ -55,12 +63,19 @@ void D22SampleSequencer::updateProperty(ChangeAspect* aChangeAspect) {
int32 actualSlot = any_cast<int32>(m_sampleChanger->getValue(propertyName));
spectroController->setPlotName(actualSlot);
cout << "Doing count number: " << actualSlot << endl;
actualSlotNumber = actualSlot;
} else if (propertyName == "status_message") {
std::string countStatus = any_cast<std::string>(m_Count->getValue(propertyName));
cout << "count status: " << countStatus << endl;
if (countStatus == "Idle") {
//Get the spectro at the end of each count
getSpectro();
}
} else if (propertyName == "numor") {
cout << "numor property changed: " << endl;
lastNumor = any_cast<int32>(m_Count->getValue(propertyName));
}
}
......@@ -70,10 +85,30 @@ void D22SampleSequencer::refreshSetValue(string propertyName, const boost::any a
void D22SampleSequencer::getSpectro() {
spectroController->start();
}
//Remember the data copy is delayed
int32 maxSlotNumber = any_cast<int32>(getValue(WANTED_NBPOSITION_PROPERTY)); //move that from here
if (actualSlotNumber > 1) {
//Copy data in nexus file
int32 numor = any_cast<int32>(m_Count->getValue("numor"));
NexusDataFile::appendTo(numor - 1, "NxD22SpecialServerFile.xml", "NxD22SpecialClientFile.xml");
}
}
void D22SampleSequencer::doLastMeasure() {
//Last measure = move sample (using sampleChanger) + get spectro
Sender<ClientCommand>::begin();
Sender<ClientCommand>::post(ClientCommand(m_sampleChanger, START_COMMAND));
Sender<ClientCommand>::endIf();
spectroController->start();
int32 numor = any_cast<int32>(m_Count->getValue("numor"));
NexusDataFile::appendTo(numor, "NxD22SpecialServerFile.xml", "NxD22SpecialClientFile.xml");
cout << "adding new data (theoretically) in data file: " << numor << " value of last numor: " << lastNumor << endl;
}
}
......@@ -52,6 +52,10 @@ public:
private:
void getSpectro();
void doLastMeasure();
int32 actualSlotNumber;
int32 lastNumor;
};
......
......@@ -184,7 +184,7 @@ void QE65000Controller::setPlotName(int32 plotId) {
// plotName.update(plotNameStream.str());
numor.update(plotId);
//cout << "setting plotName to: " << plotId << endl;
cout << "setting plotName to: " << plotId << 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