Commit 38d41c80 authored by Jacques Ratel's avatar Jacques Ratel

New pickup switcher

parent 59c4da90
<module name="chopper">
<controller class="chopper::ChopperController"/>
<controller class="chopper::PickUpNto1Controller"/>
</module>
/*
* 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 "PickUpNto1Common.h"
namespace chopper {
const std::string PickUpNto1Common::TYPE = "PickUpNto1_common";
/*
* Constructor
*/
PickUpNto1Common::PickUpNto1Common(const std::string& name) :
DeviceDriver(name) {
constructor();
}
/*
* constructor
*/
void PickUpNto1Common::constructor() {
masterPickup.init(this, SAVE , "master_pickup");
slavePickup.init(this, SAVE , "slave_pickup");
delay.init(this, SAVE , "delay");
nbPickups.init(this, SAVE , "nb_pickups");
initCommand(driver::INIT_COMMAND);
initCommand(driver::STATUS_COMMAND);
initCommand(driver::START_COMMAND);
initCommand(driver::READ_COMMAND);
initCommand(driver::STOP_COMMAND);
initCommand(driver::READ_INFOS_COMMAND);
}
}
/*
* 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 PICKUPNTO1COMMON_H
#define PICKUPNTO1COMMON_H
#include <Driver.h>
#include "drivers/global/DriversCommands.h"
namespace chopper {
/*!
* \class PickUpNto1Common
* \brief Class described the PickUpNto1 common driver
*
* \par
* This is the global view of all PickUpNto1 driver. PickUpNto1 common is used by controller.
*/
class PickUpNto1Common: public DeviceDriver {
public:
//! Driver type value
static const std::string TYPE;
/*!
* \brief Constructor
* \param[in] name the name of the device driver
*/
PickUpNto1Common(const std::string& name);
/*!
* \brief constructor common stuff
*/
void constructor();
/*!
* \brief Method called for executing a command
*
* \param[in] command the command to apply on the controller
*/
virtual void execute(const string& aCommand) {
}
/*!
* Global PickUpNto1 properties
*/
Property<int32> masterPickup;
Property<int32> slavePickup;
Property<int32> delay;
Property<int32> nbPickups;
};
}
#endif //PICKUP6TO1COMMON_H
/*
* 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 "controllers/common/family/Families.h"
#include "PickUpNto1Controller.h"
namespace chopper {
const string PickUpNto1Controller::TYPE = "pickupnto1";
const string PickUpNto1Controller::SINGLE = "single";
const string PickUpNto1Controller::MULTI = "multi";
/*
* Constructor
*/
PickUpNto1Controller::PickUpNto1Controller(const string& name):
ExperimentController(name),controller::Start(this), controller::Stoppable(this), controller::Read(this) {
registerFunction(TYPE);
setFamily(family::BEAM_PARAMETERS, family::CHOPPER);
mode.init(this, SAVE , "mode");
masterPickup.init(this, SAVE , "master_pickup");
slavePickup.init(this, SAVE , "slave_pickup");
delay.init(this, SAVE , "delay");
nbPickups.init(this, SAVE , "nb_pickups");
chopperLabels.init(this, NOSAVE , "chopper_labels");
chopperValues.init(this, NOSAVE , "chopper_values");
m_Driver.init(this, "driver");
registerRefresher(nbPickups, &PickUpNto1Controller::refreshNbPickupsProperty, this);
}
/*
* Destructor
*/
PickUpNto1Controller::~PickUpNto1Controller() {
// Empty
}
void PickUpNto1Controller::postConfiguration() {
nbPickups.update(m_Driver->nbPickups());
masterPickup.setEnumeratedLabels(chopperLabels);
masterPickup.setEnumeratedValues(chopperValues);
slavePickup.setEnumeratedLabels(chopperLabels);
slavePickup.setEnumeratedValues(chopperValues);
}
void PickUpNto1Controller::refreshNbPickupsProperty(int32 value) throw (CannotSetValue) {
chopperLabels.resize(value);
chopperValues.resize(value);
for(int32 i = 0;i < value;i++) {
chopperValues.set(i, i + 1);
ostringstream buf;
buf << "CH" << (i + 1);
chopperLabels.set(i, buf.str());
}
}
/*
* read
*/
void PickUpNto1Controller::read() {
m_Driver.execute(COMMAND_READ_DEVICE_CONTAINER, false);
}
/*
* stop
*/
void PickUpNto1Controller::stop() {
}
/*
* start
*/
void PickUpNto1Controller::start() {
/*
* Execute the command
*/
commandStatus.setRunning();
commandProgression=0;
if (mode() == SINGLE) {
m_Driver->masterPickup = masterPickup();
m_Driver->slavePickup = masterPickup();
m_Driver->delay = delay();
m_Driver.execute(COMMAND_START_DEVICE_CONTAINER, true);
}
else if (mode() == MULTI) {
m_Driver->masterPickup = masterPickup();
m_Driver->slavePickup = slavePickup();
m_Driver->delay = delay();
m_Driver.execute(COMMAND_START_DEVICE_CONTAINER, true);
}
commandStatus.setIdle();
commandProgression=100;
}
}
/*
* 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 PICKUPNTO1CONTROLLER_H
#define PICKUPNTO1CONTROLLER_H
#include <Controller.h>
#include <string>
#include "PickUpNto1Common.h"
namespace chopper {
/**
* The PickUpNto1Controller class is the specific implementation of the
* ExperimentController for PickUp cards.
*/
class PickUpNto1Controller :public ExperimentController,
public controller::Start,
public controller::Stoppable,
public controller::Read{
public:
static const std::string TYPE;
/*!
* \brief Constructor
* \param[in] name the name of the experiment controller
*/
PickUpNto1Controller(const std::string& name);
/**
* The destructor of the class PickUp Controller
*/
virtual ~PickUpNto1Controller();
/**
* It moves the PickUp
*/
virtual void start();
/**
* It reads the PickUp's values and status
*/
virtual void read();
/**
* It stop the PickUp command
*/
virtual void stop();
virtual void postConfiguration();
Property<std::string> mode;
Property<int32> masterPickup;
Property<int32> slavePickup;
Property<int32> delay;
Property<int32> nbPickups;
DynamicProperty<std::string> chopperLabels;
DynamicProperty<int32> chopperValues;
private:
void refreshNbPickupsProperty(int32 value) throw (CannotSetValue);
DriverPtr<PickUpNto1Common> m_Driver;
static const std::string SINGLE;
static const std::string MULTI;
};
}
#endif //PICKUP6TO1CONTROLLER_H
pickupnto1.modePrefix=Mode
pickupnto1.modesingleValue=single
pickupnto1.modemultiValue=multi
pickupnto1.modesingleLabel=Single
pickupnto1.modemultiLabel=Multi
pickupnto1.masterSinglePrefix=Chopper
pickupnto1.masterPrefix=Master Chopper
pickupnto1.slavePrefix=Slave Chopper
pickupnto1.delayPrefix=Delay in number of period
\ No newline at end of file
<plugin>
<controller type="pickupnto1" role="pickupnto11"/>
<number_of_lines nb_lines="1"/>
<property_switcher role="pickupnto1" property="mode" switcher_key="pickupnto.modeSwitcher"/>
<combo role="pickupnto1" property="mode" prefix="pickupnto.modePrefix" valuesAndLabels="pickupnto.modesingle,pickupnto.modemulti" />
<switchable_composite switcher_key="pickupnto.modeSwitcher" switch_values="single">
<property_combo role="pickupnto11" property="master_pickup" prefix="pickupnto1.masterSinglePrefix"/>
</switchable_composite>
<switchable_composite switcher_key="pickupnto.modeSwitcher" switch_values="multi">
<property_combo role="pickupnto11" property="master_pickup" prefix="pickupnto1.masterPrefix"/>
<property_combo role="pickupnto11" property="slave_pickup" prefix="pickupnto1.slavePrefix"/>
</switchable_composite>
<text role="pickupnto11" property="delay" prefix="pickupnto.delayPrefix"/>
</plugin>
<controller_plugin_config type="pickupnto1">
<image key="SETTINGS"/>
<settings view="pickupnto1View.xml"/>
<command view="pickupnto1CommandView.xml">
</command>
</controller_plugin_config>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<controller type="pickupnto1">
<property name="mode" type="String">
</property>
<property name="master_pickup" type="int32">
</property>
<property name="slave_pickup" type="int32">
</property>
<property name="delay" type="int32">
</property>
<property name="nb_pickups" type="int32">
</property>
<dynamic_property name="chopper_labels" size_property="nb_pickups" type="String">
</dynamic_property>
<dynamic_property name="chopper_values" size_property="nb_pickups" type="int32">
</dynamic_property>
<property name="commandStatus" type="int32">
</property>
</controller>
<plugin>
<controller type="pickupnto1" role="pickupnto11"/>
<property_switcher role="pickupnto11" property="mode" switcher_key="pickupnto1.modeSwitcher"/>
<combo role="pickupnto11" property="mode" prefix="pickupnto1.modePrefix" valuesAndLabels="pickupnto1.modesingle,pickupnto1.modemulti" />
<newLine/>
<switchable_composite switcher_key="pickupnto1.modeSwitcher" switch_values="single">
<property_combo role="pickupnto11" property="master_pickup" prefix="pickupnto1.masterSinglePrefix"/>
</switchable_composite>
<switchable_composite switcher_key="pickupnto1.modeSwitcher" switch_values="multi">
<property_combo role="pickupnto11" property="master_pickup" prefix="pickupnto1.masterPrefix"/>
<property_combo role="pickupnto11" property="slave_pickup" prefix="pickupnto1.slavePrefix"/>
</switchable_composite>
<newLine/>
<text role="pickupnto11" property="delay" prefix="pickupnto1.delayPrefix"/>
<newLine/>
<status role="pickupnto11" property="commandStatus" valuesImagesAndLabels="commandStatusUnknown,commandStatusIdle,commandStatusRunning,commandStatusWarning,commandStatusError"/>
</plugin>
<module name="pickup6to1">
<driver class="pickup6to1::PickUp6to1Driver"/>
</module>
\ No newline at end of file
/*
* 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 "PerfectPickUp6to1Driver.h"
#include "PickUp6to1Def.h"
namespace pickup6to1 {
/*
* Constructor
*/
PerfectPickUp6to1Driver::PerfectPickUp6to1Driver(PickUp6to1Driver* owner) :
PickUp6to1State(owner)
{
/* Empty */
}
/*
* Destructor
*/
PerfectPickUp6to1Driver::~PerfectPickUp6to1Driver()
{
/* Empty */
}
void PerfectPickUp6to1Driver::init()
{
}
/*
* read
*/
void PerfectPickUp6to1Driver::read()
{
}
/*
* start
*/
void PerfectPickUp6to1Driver::start()
{
}
/*
* readStatus
*/
void PerfectPickUp6to1Driver::readStatus()
{
owner()->startActivated = false;
owner()->commandProgression = PROGRESSION_END_DEVICE_CONTAINER;
}
/*
* readInfos
*/
void PerfectPickUp6to1Driver::readInfos()
{
}
}
/*
* 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 PERFECTPICKUP6TO1DRIVER_H
#define PERFECTPICKUP6TO1DRIVER_H
#include "PickUp6to1State.h"
namespace pickup6to1 {
/**
* Real Implementation part of the vme card called PickUp6to1 made in Ill. It needs a board called Men A201.
*/
class PerfectPickUp6to1Driver: public PickUp6to1State {
public:
/**
* Constructor.
*
* @param Link to the class which used the state
*/
PerfectPickUp6to1Driver(PickUp6to1Driver* owner);
/**
* Destructor.
*/
virtual ~PerfectPickUp6to1Driver();
/**
* Initialisation of the device.
* Perform a Read of the gate counter.
*/
virtual void init();
/**
* Read the gate.
* Perform a Read of the gate counter.
*/
virtual void read();
/**
* Start the gate.
* Perform a start of the device to the preset given in the the parameter.
*/
virtual void start();
/**
* Read status of the pickup.
*/
virtual void readStatus();
/**
* Read the informations of the hardware.
* Read the version, the date,the signatures and local device parameters.
*/
virtual void readInfos();
};
}
#endif //PERFECTPICKUP6TO1DRIVER_H
/*
* 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 PICKUP6TO1DEF_H
#define PICKUP6TO1DEF_H
#include <common/base/BaseTypes.h>
namespace pickup6to1 {
/*
* The PICKUP6TO1 is able to perform the 6 to 1 pickup selection.
*/
/*
* The PICKUP6TO1 command address description
*
* Base = address
*
* -----------------------------------------------------------------------------
* Address | Description | Size
* -----------------------------------------------------------------------------
* Base + 0x78 | REGISTRE DE STATUS (R) | 32 bits -> LU EN 16BITS.
* -----------------------------------------------------------------------------
* Base + 0x7c | Version (R) | 32 bits.
* -----------------------------------------------------------------------------
* Base + 0x82 | REGISTRE DU PICKUP REFERENCE (R/W) | 32 bits -> ECRIT/LU EN 16BITS.
* -----------------------------------------------------------------------------
* Base + 0x86 | REGISTRE DU PICKUP ACQUISITION (R/W) | 32 bits -> ECRIT/LU EN 16BITS.
* -----------------------------------------------------------------------------
* Base + 0x8A | REGISTRE DU N° DE PERIOD AFTER (R/W) | 32 bits -> ECRIT/LU EN 16BITS.
* -----------------------------------------------------------------------------
* Base + 0xFC | RESET (W) | 16BITS.
* -----------------------------------------------------------------------------
*/
static const uint32 STATUS_REGISTER = 0x78;
static const uint32 VERSION_REGISTER = 0x7C;
static const uint32 REF_REGISTER = 0x82;
static const uint32 ACQ_REGISTER = 0x86;
static const uint32 DELAY_REGISTER = 0x8A;
static const uint32 RESET_REGISTER = 0xFC;
}
#endif //PICKUP6TO1DEF_H
/*
* 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 "PickUp6to1Driver.h"
#include "PerfectPickUp6to1Driver.h"
#include "PickUp6to1Def.h"
#include "RealPickUp6to1Driver.h"
#include "PickUp6to1State.h"
#include "drivers/legacy/def/FunctionDef.h"
namespace pickup6to1 {
const std::string PickUp6to1Driver::TYPE = "PickUp6to1";
/*
* Constructor
*/
PickUp6to1Driver::PickUp6to1Driver(const std::string& name) :