Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LAMBDA: ajout des Mode d'acquisition d'image en 1bit et 6bit #96

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 145 additions & 5 deletions specifics/Lambda/Lambda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ namespace Lambda_ns
// chargeSumming | Tango::DevBoolean Scalar
// lowerThreshold | Tango::DevDouble Scalar
// upperThreshold | Tango::DevDouble Scalar
// hwAcquisitionMode | Tango::DevEnum Scalar
// hwAccumulation | Tango::DevBoolean Scalar
// exposureAccuTime | Tango::DevDouble Scalar
//================================================================

namespace Lambda_ns
Expand Down Expand Up @@ -154,6 +157,7 @@ void Lambda::delete_device()
m_is_device_initialized = false;

/*----- PROTECTED REGION END -----*/ // Lambda::delete_device
delete[] attr_hwAcquisitionMode_read;
}

//--------------------------------------------------------
Expand All @@ -175,6 +179,7 @@ void Lambda::init_device()
// Get the device properties from database
get_device_property();

attr_hwAcquisitionMode_read = new hwAcquisitionModeEnum[1];
/*----- PROTECTED REGION ID(Lambda::init_device) ENABLED START -----*/
// Initialize device
CREATE_SCALAR_ATTRIBUTE(attr_distortionCorrection_read);
Expand Down Expand Up @@ -366,6 +371,7 @@ void Lambda::get_device_property()
//--------------------------------------------------------
void Lambda::always_executed_hook()
{
DEBUG_STREAM << "Lambda::always_executed_hook() " << device_name << endl;
/*----- PROTECTED REGION ID(Lambda::always_executed_hook) ENABLED START -----*/

// code always executed before all requests
Expand Down Expand Up @@ -419,6 +425,7 @@ void Lambda::always_executed_hook()
//--------------------------------------------------------
void Lambda::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list))
{
DEBUG_STREAM << "Lambda::read_attr_hardware(vector<long> &attr_list) entering... " << endl;
/*----- PROTECTED REGION ID(Lambda::read_attr_hardware) ENABLED START -----*/

// Add your own code
Expand All @@ -433,6 +440,7 @@ void Lambda::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list))
//--------------------------------------------------------
void Lambda::write_attr_hardware(TANGO_UNUSED(vector<long> &attr_list))
{
DEBUG_STREAM << "Lambda::write_attr_hardware(vector<long> &attr_list) entering... " << endl;
/*----- PROTECTED REGION ID(Lambda::write_attr_hardware) ENABLED START -----*/

// Add your own code
Expand Down Expand Up @@ -655,7 +663,7 @@ void Lambda::read_linearityCorrection(Tango::Attribute &attr)
//--------------------------------------------------------
void Lambda::write_linearityCorrection(Tango::WAttribute &attr)
{
INFO_STREAM << "Lambda::write_linearityCorrection(Tango::WAttribute &attr) entering... " << endl;
DEBUG_STREAM << "Lambda::write_linearityCorrection(Tango::WAttribute &attr) entering... " << endl;
// Retrieve write value
Tango::DevBoolean w_val;
attr.get_write_value(w_val);
Expand Down Expand Up @@ -720,7 +728,7 @@ void Lambda::read_saturationFlag(Tango::Attribute &attr)
//--------------------------------------------------------
void Lambda::write_saturationFlag(Tango::WAttribute &attr)
{
INFO_STREAM << "Lambda::write_saturationFlag(Tango::WAttribute &attr) entering... " << endl;
DEBUG_STREAM << "Lambda::write_saturationFlag(Tango::WAttribute &attr) entering... " << endl;
// Retrieve write value
Tango::DevBoolean w_val;
attr.get_write_value(w_val);
Expand Down Expand Up @@ -785,7 +793,7 @@ void Lambda::read_saturationThreshold(Tango::Attribute &attr)
//--------------------------------------------------------
void Lambda::write_saturationThreshold(Tango::WAttribute &attr)
{
INFO_STREAM << "Lambda::write_saturationThreshold(Tango::WAttribute &attr) entering... " << endl;
DEBUG_STREAM << "Lambda::write_saturationThreshold(Tango::WAttribute &attr) entering... " << endl;
// Retrieve write value
Tango::DevLong w_val;
attr.get_write_value(w_val);
Expand Down Expand Up @@ -870,7 +878,7 @@ void Lambda::read_lowerThreshold(Tango::Attribute &attr)
//--------------------------------------------------------
void Lambda::write_lowerThreshold(Tango::WAttribute &attr)
{
INFO_STREAM << "Lambda::write_lowerThreshold(Tango::WAttribute &attr) entering... " << endl;
DEBUG_STREAM << "Lambda::write_lowerThreshold(Tango::WAttribute &attr) entering... " << endl;
// Retrieve write value
Tango::DevDouble w_val;
attr.get_write_value(w_val);
Expand Down Expand Up @@ -938,7 +946,7 @@ void Lambda::read_upperThreshold(Tango::Attribute &attr)
//--------------------------------------------------------
void Lambda::write_upperThreshold(Tango::WAttribute &attr)
{
INFO_STREAM << "Lambda::write_upperThreshold(Tango::WAttribute &attr) entering... " << endl;
DEBUG_STREAM << "Lambda::write_upperThreshold(Tango::WAttribute &attr) entering... " << endl;
// Retrieve write value
Tango::DevDouble w_val;
attr.get_write_value(w_val);
Expand All @@ -960,6 +968,138 @@ void Lambda::write_upperThreshold(Tango::WAttribute &attr)

/*----- PROTECTED REGION END -----*/ // Lambda::write_upperThreshold
}
//--------------------------------------------------------
/**
* Read attribute hwAcquisitionMode related method
* Description:
*
* Data type: Tango::DevEnum (hwAcquisitionModeEnum)
* Attr type: Scalar
*/
//--------------------------------------------------------
void Lambda::read_hwAcquisitionMode(Tango::Attribute &attr)
{
DEBUG_STREAM << "Lambda::read_hwAcquisitionMode(Tango::Attribute &attr) entering... " << endl;
/*----- PROTECTED REGION ID(Lambda::read_hwAcquisitionMode) ENABLED START -----*/
// Set the attribute value
int acqMode = -1;
m_camera->getAcquisitionMode(acqMode);
switch(acqMode) {
case 1: *attr_hwAcquisitionMode_read = Lambda_ns::_1_BIT; break;
case 6: *attr_hwAcquisitionMode_read = Lambda_ns::_6_BITS; break;
case 12: *attr_hwAcquisitionMode_read = Lambda_ns::_12_BITS; break;
case 24: *attr_hwAcquisitionMode_read = Lambda_ns::_24_BITS; break;
default: break;
}
attr.set_value(attr_hwAcquisitionMode_read);

/*----- PROTECTED REGION END -----*/ // Lambda::read_hwAcquisitionMode
}
//--------------------------------------------------------
/**
* Write attribute hwAcquisitionMode related method
* Description:
*
* Data type: Tango::DevEnum (hwAcquisitionModeEnum)
* Attr type: Scalar
*/
//--------------------------------------------------------
void Lambda::write_hwAcquisitionMode(Tango::WAttribute &attr)
{
DEBUG_STREAM << "Lambda::write_hwAcquisitionMode(Tango::WAttribute &attr) entering... " << endl;
// Retrieve write value
hwAcquisitionModeEnum w_val;
attr.get_write_value(w_val);
/*----- PROTECTED REGION ID(Lambda::write_hwAcquisitionMode) ENABLED START -----*/
try
{
int acqMode = 24;
switch(w_val) {
case Lambda_ns::_1_BIT: acqMode = 1; break;
case Lambda_ns::_6_BITS: acqMode = 6; break;
case Lambda_ns::_12_BITS: acqMode = 12; break;
case Lambda_ns::_24_BITS: acqMode = 24; break;
default: break;
}
m_camera->setAcquisitionMode(acqMode);
//- Memorize the write value
yat4tango::PropertyHelper::set_memorized_attribute(this, "hwAcquisitionMode", w_val);
}
catch (Tango::DevFailed& df)
{
manage_devfailed_exception(df, "write_hwAcquisitionMode");
}
catch (lima::Exception& le)
{
manage_lima_exception(le, "write_hwAcquisitionMode");
}

/*----- PROTECTED REGION END -----*/ // Lambda::write_hwAcquisitionMode
}
//--------------------------------------------------------
/**
* Write attribute hwAccumulation related method
* Description:
*
* Data type: Tango::DevBoolean
* Attr type: Scalar
*/
//--------------------------------------------------------
void Lambda::write_hwAccumulation(Tango::WAttribute &attr)
{
DEBUG_STREAM << "Lambda::write_hwAccumulation(Tango::WAttribute &attr) entering... " << endl;
// Retrieve write value
Tango::DevBoolean w_val;
attr.get_write_value(w_val);
/*----- PROTECTED REGION ID(Lambda::write_hwAccumulation) ENABLED START -----*/
try
{
m_camera->setAccumulationMode(w_val);
//- Memorize the write value
yat4tango::PropertyHelper::set_memorized_attribute(this, "hwAccumulation", w_val);
}
catch(Tango::DevFailed& df)
{
manage_devfailed_exception(df, "Lambda::write_hwAccumulation");
}
catch(Exception& e)
{
manage_lima_exception(e, "Lambda::write_hwAccumulation");
}
/*----- PROTECTED REGION END -----*/ // Lambda::write_hwAccumulation
}
//--------------------------------------------------------
/**
* Write attribute exposureAccuTime related method
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
//--------------------------------------------------------
void Lambda::write_exposureAccuTime(Tango::WAttribute &attr)
{
DEBUG_STREAM << "Lambda::write_exposureAccuTime(Tango::WAttribute &attr) entering... " << endl;
// Retrieve write value
Tango::DevDouble w_val;
attr.get_write_value(w_val);
/*----- PROTECTED REGION ID(Lambda::write_exposureAccuTime) ENABLED START -----*/
try
{
m_camera->setExposureAccuTime(w_val);
//- Memorize the write value
yat4tango::PropertyHelper::set_memorized_attribute(this, "exposureAccuTime", w_val);
}
catch(Tango::DevFailed& df)
{
manage_devfailed_exception(df, "Lambda::write_exposureAccuTime");
}
catch(Exception& e)
{
manage_lima_exception(e, "Lambda::write_exposureAccuTime");
}
/*----- PROTECTED REGION END -----*/ // Lambda::write_exposureAccuTime
}

//--------------------------------------------------------
/**
Expand Down
37 changes: 37 additions & 0 deletions specifics/Lambda/Lambda.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@

namespace Lambda_ns
{
enum _hwAcquisitionModeEnum {
_24_BITS,
_12_BITS,
_6_BITS,
_1_BIT,
} ;
typedef _hwAcquisitionModeEnum hwAcquisitionModeEnum;

/*----- PROTECTED REGION ID(Lambda::Additional Class Declarations) ENABLED START -----*/

// Additional Class Declarations
Expand Down Expand Up @@ -106,6 +114,7 @@ class Lambda : public TANGO_BASE_CLASS
Tango::DevBoolean *attr_chargeSumming_read;
Tango::DevDouble *attr_lowerThreshold_read;
Tango::DevDouble *attr_upperThreshold_read;
hwAcquisitionModeEnum *attr_hwAcquisitionMode_read;

// Constructors and destructors
public:
Expand Down Expand Up @@ -298,7 +307,35 @@ class Lambda : public TANGO_BASE_CLASS
virtual void read_upperThreshold(Tango::Attribute &attr);
virtual void write_upperThreshold(Tango::WAttribute &attr);
virtual bool is_upperThreshold_allowed(Tango::AttReqType type);
/**
* Attribute hwAcquisitionMode related methods
* Description:
*
* Data type: Tango::DevEnum
* Attr type: Scalar
*/
virtual void read_hwAcquisitionMode(Tango::Attribute &attr);
virtual void write_hwAcquisitionMode(Tango::WAttribute &attr);
virtual bool is_hwAcquisitionMode_allowed(Tango::AttReqType type);

/**
* Attribute hwAccumulation related methods
* Description:
*
* Data type: Tango::DevBoolean
* Attr type: Scalar
*/
virtual void write_hwAccumulation(Tango::WAttribute &attr);
virtual bool is_hwAccumulation_allowed(Tango::AttReqType type);
/**
* Attribute exposureAccuTime related methods
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void write_exposureAccuTime(Tango::WAttribute &attr);
virtual bool is_exposureAccuTime_allowed(Tango::AttReqType type);

//--------------------------------------------------------
/**
Expand Down
40 changes: 38 additions & 2 deletions specifics/Lambda/Lambda.xmi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ASCII"?>
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
<classes name="Lambda" pogoRevision="9.6">
<description description="Device for Lambda detectors from XSpectrum." title="XSpectrum Lambda detector TANGO specific device." sourcePath="/home/informatique/ica/bahji/Repositories_Dev/Lima_Repo_GitHub/Lima-tango-cpp/specifics/Lambda" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false">
<description description="Device for Lambda detectors from XSpectrum." title="XSpectrum Lambda detector TANGO specific device." sourcePath="/home/informatique/ica/ica/DeviceSources/Lima/applications/tango/cpp/specifics/Lambda" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false">
<inheritances classname="Device_Impl" sourcePath=""/>
<identification contact="at synchrotron-soleil.fr - cedric.castel" author="cedric.castel" emailDomain="synchrotron-soleil.fr" classFamily="Acquisition" siteSpecific="" platform="Unix Like" bus="Ethernet" manufacturer="XSpectrum" reference="LAMBDA"/>
</description>
Expand Down Expand Up @@ -167,6 +167,42 @@
<writeExcludedStates>FAULT</writeExcludedStates>
<writeExcludedStates>RUNNING</writeExcludedStates>
</attributes>
<attributes name="hwAccumulation" attType="Scalar" rwType="WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="false" isDynamic="false">
<dataType xsi:type="pogoDsl:BooleanType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
<readExcludedStates>FAULT</readExcludedStates>
<readExcludedStates>RUNNING</readExcludedStates>
<writeExcludedStates>FAULT</writeExcludedStates>
<writeExcludedStates>RUNNING</writeExcludedStates>
</attributes>
<attributes name="exposureAccuTime" attType="Scalar" rwType="WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="false" isDynamic="false">
<dataType xsi:type="pogoDsl:DoubleType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
<readExcludedStates>FAULT</readExcludedStates>
<readExcludedStates>RUNNING</readExcludedStates>
<writeExcludedStates>FAULT</writeExcludedStates>
<writeExcludedStates>RUNNING</writeExcludedStates>
</attributes>
<attributes name="hwAcquisitionMode" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:EnumType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
<enumLabels>24 Bits</enumLabels>
<enumLabels>12 Bits</enumLabels>
<enumLabels>6 Bits</enumLabels>
<enumLabels>1 Bit</enumLabels>
</attributes>
<states name="STANDBY" description="">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states>
Expand All @@ -176,6 +212,6 @@
<states name="RUNNING" description="">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states>
<preferences docHome="./doc_html" makefileHome="/usr/share/pogo/preferences"/>
<preferences docHome="../doc/doc_html" makefileHome="$(TANGO_HOME)"/>
</classes>
</pogoDsl:PogoSystem>
Loading