Commit 08e9de46 authored by Cristina Cocho's avatar Cristina Cocho
Browse files

Modifications related to Spectro controller

parent 76fa9059
......@@ -519,4 +519,5 @@
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope"/>
</cproject>
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include <Controller.h>
#include "D22SampleSequencer.h"
namespace d22special {
const string D22SampleSequencer::TYPE = "d22_sample_sequencer";
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?
SampleSequencer::execute(command, blocking, logging);
//cout << "executing command " << command << " in D22SampleSequencer" << endl;
}
void D22SampleSequencer::postConfiguration() {
SampleSequencer::postConfiguration();
}
void D22SampleSequencer::updateProperty(ChangeAspect* aChangeAspect) {
SampleSequencer::updateProgress(aChangeAspect);
string propertyName = aChangeAspect->getStringParam();
if (propertyName == "actual_cha") {
int32 actualSlot = any_cast<int32>(m_sampleChanger->getValue(propertyName));
spectroController->setPlotName(actualSlot);
} else if (propertyName == "status_message") {
std::string countStatus = any_cast<std::string>(m_Count->getValue(propertyName));
if (countStatus == "Idle") {
//Get the spectro at the end of each count
getSpectro();
}
}
}
void D22SampleSequencer::refreshSetValue(string propertyName, const boost::any aValue) throw (CannotSetValue) {
SampleSequencer::refreshSetValue(propertyName, aValue);
}
void D22SampleSequencer::getSpectro() {
spectroController->start();
}
}
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#ifndef IN16BSAMPLESEQUENCER_H_
#define IN16BSAMPLESEQUENCER_H_
#include "InstrumentAbstraction/Lss/SampleSequencer.h"
#include "controllers/spectrometer/QE65000Controller.h"
using namespace spectrometer;
namespace d22special {
class D22SampleSequencer: public ::SampleSequencer {
public:
static const std::string TYPE;
D22SampleSequencer(const std::string & name);
virtual ~D22SampleSequencer();
DynamicProperty<int32> useSpectro;
ControllerPtr<QE65000Controller> spectroController;
virtual void execute(const string& command, bool blocking, bool logging = false);
virtual void updateProperty(ChangeAspect* aChangeAspect);
virtual void postConfiguration();
virtual void refreshSetValue(string propertyName, const boost::any aValue) throw (CannotSetValue);
private:
void getSpectro();
};
}
#endif
<module name="d22special">
<controller class="d22special::D22SampleSequencer"/>
</module>
\ No newline at end of file
......@@ -22,9 +22,11 @@
namespace spectrometer {
const string QE65000Controller::TYPE = "spectro";
const int32 QE65000Controller::ALONE = 0;
const int32 QE65000Controller::SWITCH = 1;
const int32 QE65000Controller::SEQUENCE = 2;
QE65000Controller::QE65000Controller(const std::string& name) : ExperimentController(TYPE, name), controller::Stoppable(this) {
// force register function to allow the controller to be used by the "classic" UVspectrometer controller.
registerFunction(SHUTTER_EXPERIMENT_CONTROLLER);
......@@ -33,11 +35,13 @@ QE65000Controller::QE65000Controller(const std::string& name) : ExperimentContro
yData.init(this, SAVE, "y_data");
spectroStatus.init(this, SAVE, "spectro_status");
spectroStatusMessage.init(this, SAVE, "spectro_status_message");
mode.init(this, SAVE, "mode");
plotName.init(this, SAVE, "plot_name");
numor.init(this, SAVE, "numor");
registerFunction(TYPE);
spectroDriver.init(this, "driver");
}
......@@ -57,6 +61,8 @@ void QE65000Controller::postConfiguration() {
//Set initial property values
spectroStatusMessage.update("UNPLUGGED");
mode.update(ALONE);
plotName.update("0"); //original value = empty
}
void QE65000Controller::refreshIntegrationTime(int32 time) {
......@@ -70,8 +76,6 @@ void QE65000Controller::updateYData() {
}
void QE65000Controller::updateStatus() {
cout << "updateStatus!" << endl;
//would like to know why my updaters do not work!
spectroStatus.update(spectroDriver->status());
if (spectroStatus() == 0) {
spectroStatusMessage.update("UNPLUGGED");
......@@ -87,7 +91,7 @@ void QE65000Controller::updateProgression() {
void QE65000Controller::start() {
commandProgression = 0;
spectroDriver.execute("start", true); //ask Yannick that!
spectroDriver.execute("start", false); //ask Yannick that!
//x data
int32 xSize = spectroDriver->xData.getSize();
......@@ -104,10 +108,11 @@ void QE65000Controller::start() {
yData.sendEvent();
commandProgression = 99;
spectroDriver.execute("stop", false);
}
void QE65000Controller::stop() {
spectroDriver.execute("stop", true);
spectroDriver.execute("stop", false);
commandProgression = 100;
}
......@@ -115,6 +120,15 @@ bool QE65000Controller::isConnected() {
return (spectroDriver->status() != 0);
}
void QE65000Controller::setPlotName(int32 plotId) {
stringstream plotNameStream;
plotNameStream << plotId;
// plotName.update(plotNameStream.str());
numor.update(plotId);
cout << "setting plotName to: " << plotId << endl;
}
}
......
......@@ -31,8 +31,15 @@ class QE65000Controller : public ExperimentController , public controller::Stopp
public:
static const std::string TYPE;
static const int32 ALONE;
static const int32 SWITCH;
static const int32 SEQUENCE;
Property<int32> integrationTime;
Property<int32> spectroStatus;
Property<int32> mode;
Property<std::string> plotName;
Property<int32> numor;
Property<std::string> spectroStatusMessage;
ArrayProperty<float64> xData;
ArrayProperty<float64> yData;
......@@ -56,6 +63,8 @@ public:
void updateYData();
void updateStatus();
void setPlotName(int32 plotId);
};
......
......@@ -62,10 +62,10 @@ void QE65000Driver::execute(const std::string& aCommand) {
//Get the state where to execute the accion
QE65000State* currentState = dynamic_cast<QE65000State*> (getCurrentState());
if ((aCommand != COMMAND_STOP_DEVICE_CONTAINER) && (aCommand != COMMAND_START_DEVICE_CONTAINER)) {
//cout << "sending unknown state" << endl;
sendProgressEvent(PROGRESSION_UNKNOWNSTATE_DEVICE_CONTAINER);
}
// if ((aCommand != COMMAND_STOP_DEVICE_CONTAINER) && (aCommand != COMMAND_START_DEVICE_CONTAINER)) {
// //cout << "sending unknown state" << endl;
// sendProgressEvent(PROGRESSION_UNKNOWNSTATE_DEVICE_CONTAINER);
// }
if (aCommand == driver::START_COMMAND) {
//begin reading
......
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