Commit 84cd7b48 authored by Jean-Luc Pons's avatar Jean-Luc Pons

Added Calib Calculate as command and DeviceType attribute

parent 5468d36d
......@@ -94,11 +94,13 @@ if(thread==NULL) { \
// State | dev_state
// Status | Inherited (no method)
// SetIncoherencyRef | set_incoherency_ref
// CalibCalculate | calib_calculate
//================================================================
//================================================================
// Attributes managed are:
//================================================================
// DeviceType | Tango::DevString Scalar
// SA_Avg_Enable | Tango::DevBoolean Scalar
// SA_Avg_Length | Tango::DevLong Scalar
// SA_Stat_Length | Tango::DevLong Scalar
......@@ -129,7 +131,6 @@ if(thread==NULL) { \
// AGC_Enable | Tango::DevBoolean Scalar
// OffsetTune | Tango::DevLong Scalar
// CompensateTune | Tango::DevBoolean Scalar
// Calib_Calculate | Tango::DevBoolean Scalar
// Calib_Enable | Tango::DevBoolean Scalar
// Calib_Active | Tango::DevBoolean Scalar
// Calib_NumOfSamples | Tango::DevULong Scalar
......@@ -252,6 +253,7 @@ void LiberaSparkSRBPM::delete_device()
delete self;
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::delete_device
delete[] attr_DeviceType_read;
delete[] attr_SA_Avg_Enable_read;
delete[] attr_SA_Avg_Length_read;
delete[] attr_SA_Stat_Length_read;
......@@ -282,7 +284,6 @@ void LiberaSparkSRBPM::delete_device()
delete[] attr_AGC_Enable_read;
delete[] attr_OffsetTune_read;
delete[] attr_CompensateTune_read;
delete[] attr_Calib_Calculate_read;
delete[] attr_Calib_Enable_read;
delete[] attr_Calib_Active_read;
delete[] attr_Calib_NumOfSamples_read;
......@@ -346,6 +347,7 @@ void LiberaSparkSRBPM::init_device()
// Get the device properties from database
get_device_property();
attr_DeviceType_read = new Tango::DevString[1];
attr_SA_Avg_Enable_read = new Tango::DevBoolean[1];
attr_SA_Avg_Length_read = new Tango::DevLong[1];
attr_SA_Stat_Length_read = new Tango::DevLong[1];
......@@ -376,7 +378,6 @@ void LiberaSparkSRBPM::init_device()
attr_AGC_Enable_read = new Tango::DevBoolean[1];
attr_OffsetTune_read = new Tango::DevLong[1];
attr_CompensateTune_read = new Tango::DevBoolean[1];
attr_Calib_Calculate_read = new Tango::DevBoolean[1];
attr_Calib_Enable_read = new Tango::DevBoolean[1];
attr_Calib_Active_read = new Tango::DevBoolean[1];
attr_Calib_NumOfSamples_read = new Tango::DevULong[1];
......@@ -623,6 +624,25 @@ void LiberaSparkSRBPM::write_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::write_attr_hardware
}
//--------------------------------------------------------
/**
* Read attribute DeviceType related method
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
//--------------------------------------------------------
void LiberaSparkSRBPM::read_DeviceType(Tango::Attribute &attr)
{
DEBUG_STREAM << "LiberaSparkSRBPM::read_DeviceType(Tango::Attribute &attr) entering... " << endl;
/*----- PROTECTED REGION ID(LiberaSparkSRBPM::read_DeviceType) ENABLED START -----*/
attr_DeviceType_read[0] = "LiberaSpark";
attr.set_value(attr_DeviceType_read);
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::read_DeviceType
}
//--------------------------------------------------------
/**
* Read attribute SA_Avg_Enable related method
......@@ -1581,45 +1601,6 @@ void LiberaSparkSRBPM::write_CompensateTune(Tango::WAttribute &attr)
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::write_CompensateTune
}
//--------------------------------------------------------
/**
* Read attribute Calib_Calculate related method
* Description:
*
* Data type: Tango::DevBoolean
* Attr type: Scalar
*/
//--------------------------------------------------------
void LiberaSparkSRBPM::read_Calib_Calculate(Tango::Attribute &attr)
{
DEBUG_STREAM << "LiberaSparkSRBPM::read_Calib_Calculate(Tango::Attribute &attr) entering... " << endl;
/*----- PROTECTED REGION ID(LiberaSparkSRBPM::read_Calib_Calculate) ENABLED START -----*/
READ_ATTR<int64_t,Tango::DevBoolean>(attr,attr_Calib_Calculate_read,"application.calibration.calculate");
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::read_Calib_Calculate
}
//--------------------------------------------------------
/**
* Write attribute Calib_Calculate related method
* Description:
*
* Data type: Tango::DevBoolean
* Attr type: Scalar
*/
//--------------------------------------------------------
void LiberaSparkSRBPM::write_Calib_Calculate(Tango::WAttribute &attr)
{
DEBUG_STREAM << "LiberaSparkSRBPM::write_Calib_Calculate(Tango::WAttribute &attr) entering... " << endl;
// Retrieve write value
Tango::DevBoolean w_val;
attr.get_write_value(w_val);
/*----- PROTECTED REGION ID(LiberaSparkSRBPM::write_Calib_Calculate) ENABLED START -----*/
WRITE_ATTR<int64_t,Tango::DevBoolean>(w_val,"application.calibration.calculate");
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::write_Calib_Calculate
}
//--------------------------------------------------------
/**
* Read attribute Calib_Enable related method
* Description:
......@@ -3395,6 +3376,22 @@ void LiberaSparkSRBPM::set_incoherency_ref()
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::set_incoherency_ref
}
//--------------------------------------------------------
/**
* Command CalibCalculate related method
* Description: Launch calibration process
*
*/
//--------------------------------------------------------
void LiberaSparkSRBPM::calib_calculate()
{
DEBUG_STREAM << "LiberaSparkSRBPM::CalibCalculate() - " << device_name << endl;
/*----- PROTECTED REGION ID(LiberaSparkSRBPM::calib_calculate) ENABLED START -----*/
WRITE_ATTR<int64_t,Tango::DevBoolean>(true,"application.calibration.calculate");
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::calib_calculate
}
//--------------------------------------------------------
/**
* Method : LiberaSparkSRBPM::add_dynamic_commands()
* Description : Create the dynamic commands if any
......@@ -3696,6 +3693,5 @@ void LiberaSparkSRBPM::LoadPolynomial() {
}
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::namespace_ending
} // namespace
......@@ -242,6 +242,7 @@ public:
// Attribute data members
public:
Tango::DevString *attr_DeviceType_read;
Tango::DevBoolean *attr_SA_Avg_Enable_read;
Tango::DevLong *attr_SA_Avg_Length_read;
Tango::DevLong *attr_SA_Stat_Length_read;
......@@ -272,7 +273,6 @@ public:
Tango::DevBoolean *attr_AGC_Enable_read;
Tango::DevLong *attr_OffsetTune_read;
Tango::DevBoolean *attr_CompensateTune_read;
Tango::DevBoolean *attr_Calib_Calculate_read;
Tango::DevBoolean *attr_Calib_Enable_read;
Tango::DevBoolean *attr_Calib_Active_read;
Tango::DevULong *attr_Calib_NumOfSamples_read;
......@@ -403,6 +403,15 @@ public:
//--------------------------------------------------------
virtual void write_attr_hardware(vector<long> &attr_list);
/**
* Attribute DeviceType related methods
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_DeviceType(Tango::Attribute &attr);
virtual bool is_DeviceType_allowed(Tango::AttReqType type);
/**
* Attribute SA_Avg_Enable related methods
* Description:
......@@ -691,16 +700,6 @@ public:
virtual void read_CompensateTune(Tango::Attribute &attr);
virtual void write_CompensateTune(Tango::WAttribute &attr);
virtual bool is_CompensateTune_allowed(Tango::AttReqType type);
/**
* Attribute Calib_Calculate related methods
* Description:
*
* Data type: Tango::DevBoolean
* Attr type: Scalar
*/
virtual void read_Calib_Calculate(Tango::Attribute &attr);
virtual void write_Calib_Calculate(Tango::WAttribute &attr);
virtual bool is_Calib_Calculate_allowed(Tango::AttReqType type);
/**
* Attribute Calib_Enable related methods
* Description:
......@@ -1313,6 +1312,13 @@ public:
*/
virtual void set_incoherency_ref();
virtual bool is_SetIncoherencyRef_allowed(const CORBA::Any &any);
/**
* Command CalibCalculate related method
* Description: Launch calibration process
*
*/
virtual void calib_calculate();
virtual bool is_CalibCalculate_allowed(const CORBA::Any &any);
//--------------------------------------------------------
......
......@@ -40,6 +40,23 @@
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="CalibCalculate" description="Launch calibration process" execMethod="calib_calculate" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<attributes name="DeviceType" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:StringType"/>
<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=""/>
</attributes>
<attributes name="SA_Avg_Enable" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:BooleanType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
......@@ -286,14 +303,6 @@
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="Calib_Calculate" attType="Scalar" rwType="READ_WRITE" displayLevel="EXPERT" polledPeriod="0" maxX="" maxY="" allocReadMember="true" 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=""/>
</attributes>
<attributes name="Calib_Enable" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:BooleanType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
......
......@@ -170,6 +170,24 @@ CORBA::Any *SetIncoherencyRefClass::execute(Tango::DeviceImpl *device, TANGO_UNU
return new CORBA::Any();
}
//--------------------------------------------------------
/**
* method : CalibCalculateClass::execute()
* description : method to trigger the execution of the command.
*
* @param device The device on which the command must be executed
* @param in_any The command input data
*
* returns The command output data (packed in the Any object)
*/
//--------------------------------------------------------
CORBA::Any *CalibCalculateClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
{
cout2 << "CalibCalculateClass::execute(): arrived" << endl;
((static_cast<LiberaSparkSRBPM *>(device))->calib_calculate());
return new CORBA::Any();
}
//===================================================================
// Properties management
......@@ -371,6 +389,30 @@ void LiberaSparkSRBPMClass::attribute_factory(vector<Tango::Attr *> &att_list)
// Add your own code
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPMClass::attribute_factory_before
// Attribute : DeviceType
DeviceTypeAttrib *devicetype = new DeviceTypeAttrib();
Tango::UserDefaultAttrProp devicetype_prop;
// description not set for DeviceType
// label not set for DeviceType
// unit not set for DeviceType
// standard_unit not set for DeviceType
// display_unit not set for DeviceType
// format not set for DeviceType
// max_value not set for DeviceType
// min_value not set for DeviceType
// max_alarm not set for DeviceType
// min_alarm not set for DeviceType
// max_warning not set for DeviceType
// min_warning not set for DeviceType
// delta_t not set for DeviceType
// delta_val not set for DeviceType
devicetype->set_default_properties(devicetype_prop);
// Not Polled
devicetype->set_disp_level(Tango::OPERATOR);
// Not Memorized
att_list.push_back(devicetype);
// Attribute : SA_Avg_Enable
SA_Avg_EnableAttrib *sa_avg_enable = new SA_Avg_EnableAttrib();
Tango::UserDefaultAttrProp sa_avg_enable_prop;
......@@ -1123,30 +1165,6 @@ void LiberaSparkSRBPMClass::attribute_factory(vector<Tango::Attr *> &att_list)
compensatetune->set_memorized_init(true);
att_list.push_back(compensatetune);
// Attribute : Calib_Calculate
Calib_CalculateAttrib *calib_calculate = new Calib_CalculateAttrib();
Tango::UserDefaultAttrProp calib_calculate_prop;
// description not set for Calib_Calculate
// label not set for Calib_Calculate
// unit not set for Calib_Calculate
// standard_unit not set for Calib_Calculate
// display_unit not set for Calib_Calculate
// format not set for Calib_Calculate
// max_value not set for Calib_Calculate
// min_value not set for Calib_Calculate
// max_alarm not set for Calib_Calculate
// min_alarm not set for Calib_Calculate
// max_warning not set for Calib_Calculate
// min_warning not set for Calib_Calculate
// delta_t not set for Calib_Calculate
// delta_val not set for Calib_Calculate
calib_calculate->set_default_properties(calib_calculate_prop);
// Not Polled
calib_calculate->set_disp_level(Tango::EXPERT);
// Not Memorized
att_list.push_back(calib_calculate);
// Attribute : Calib_Enable
Calib_EnableAttrib *calib_enable = new Calib_EnableAttrib();
Tango::UserDefaultAttrProp calib_enable_prop;
......@@ -2736,6 +2754,15 @@ void LiberaSparkSRBPMClass::command_factory()
Tango::OPERATOR);
command_list.push_back(pSetIncoherencyRefCmd);
// Command CalibCalculate
CalibCalculateClass *pCalibCalculateCmd =
new CalibCalculateClass("CalibCalculate",
Tango::DEV_VOID, Tango::DEV_VOID,
"",
"",
Tango::OPERATOR);
command_list.push_back(pCalibCalculateCmd);
/*----- PROTECTED REGION ID(LiberaSparkSRBPMClass::command_factory_after) ENABLED START -----*/
// Add your own code
......
......@@ -58,6 +58,19 @@ namespace LiberaSparkSRBPM_ns
//=========================================
// Define classes for attributes
//=========================================
// Attribute DeviceType class definition
class DeviceTypeAttrib: public Tango::Attr
{
public:
DeviceTypeAttrib():Attr("DeviceType",
Tango::DEV_STRING, Tango::READ) {};
~DeviceTypeAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<LiberaSparkSRBPM *>(dev))->read_DeviceType(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<LiberaSparkSRBPM *>(dev))->is_DeviceType_allowed(ty);}
};
// Attribute SA_Avg_Enable class definition
class SA_Avg_EnableAttrib: public Tango::Attr
{
......@@ -488,21 +501,6 @@ public:
{return (static_cast<LiberaSparkSRBPM *>(dev))->is_CompensateTune_allowed(ty);}
};
// Attribute Calib_Calculate class definition
class Calib_CalculateAttrib: public Tango::Attr
{
public:
Calib_CalculateAttrib():Attr("Calib_Calculate",
Tango::DEV_BOOLEAN, Tango::READ_WRITE) {};
~Calib_CalculateAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<LiberaSparkSRBPM *>(dev))->read_Calib_Calculate(att);}
virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
{(static_cast<LiberaSparkSRBPM *>(dev))->write_Calib_Calculate(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<LiberaSparkSRBPM *>(dev))->is_Calib_Calculate_allowed(ty);}
};
// Attribute Calib_Enable class definition
class Calib_EnableAttrib: public Tango::Attr
{
......@@ -1394,6 +1392,29 @@ public:
{return (static_cast<LiberaSparkSRBPM *>(dev))->is_SetIncoherencyRef_allowed(any);}
};
// Command CalibCalculate class definition
class CalibCalculateClass : public Tango::Command
{
public:
CalibCalculateClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
const char *out_desc,
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
CalibCalculateClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~CalibCalculateClass() {};
virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
{return (static_cast<LiberaSparkSRBPM *>(dev))->is_CalibCalculate_allowed(any);}
};
/**
* The LiberaSparkSRBPMClass singleton definition
......
......@@ -48,6 +48,22 @@ namespace LiberaSparkSRBPM_ns
// Attributes Allowed Methods
//=================================================
//--------------------------------------------------------
/**
* Method : LiberaSparkSRBPM::is_DeviceType_allowed()
* Description : Execution allowed for DeviceType attribute
*/
//--------------------------------------------------------
bool LiberaSparkSRBPM::is_DeviceType_allowed(TANGO_UNUSED(Tango::AttReqType type))
{
// Not any excluded states for DeviceType attribute in read access.
/*----- PROTECTED REGION ID(LiberaSparkSRBPM::DeviceTypeStateAllowed_READ) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::DeviceTypeStateAllowed_READ
return true;
}
//--------------------------------------------------------
/**
* Method : LiberaSparkSRBPM::is_SA_Avg_Enable_allowed()
......@@ -600,26 +616,6 @@ bool LiberaSparkSRBPM::is_CompensateTune_allowed(TANGO_UNUSED(Tango::AttReqType
return true;
}
//--------------------------------------------------------
/**
* Method : LiberaSparkSRBPM::is_Calib_Calculate_allowed()
* Description : Execution allowed for Calib_Calculate attribute
*/
//--------------------------------------------------------
bool LiberaSparkSRBPM::is_Calib_Calculate_allowed(TANGO_UNUSED(Tango::AttReqType type))
{
// Not any excluded states for Calib_Calculate attribute in Write access.
/*----- PROTECTED REGION ID(LiberaSparkSRBPM::Calib_CalculateStateAllowed_WRITE) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::Calib_CalculateStateAllowed_WRITE
// Not any excluded states for Calib_Calculate attribute in read access.
/*----- PROTECTED REGION ID(LiberaSparkSRBPM::Calib_CalculateStateAllowed_READ) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::Calib_CalculateStateAllowed_READ
return true;
}
//--------------------------------------------------------
/**
* Method : LiberaSparkSRBPM::is_Calib_Enable_allowed()
......@@ -1732,6 +1728,21 @@ bool LiberaSparkSRBPM::is_SetIncoherencyRef_allowed(TANGO_UNUSED(const CORBA::An
return true;
}
//--------------------------------------------------------
/**
* Method : LiberaSparkSRBPM::is_CalibCalculate_allowed()
* Description : Execution allowed for CalibCalculate attribute
*/
//--------------------------------------------------------
bool LiberaSparkSRBPM::is_CalibCalculate_allowed(TANGO_UNUSED(const CORBA::Any &any))
{
// Not any excluded states for CalibCalculate command.
/*----- PROTECTED REGION ID(LiberaSparkSRBPM::CalibCalculateStateAllowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // LiberaSparkSRBPM::CalibCalculateStateAllowed
return true;
}
/*----- PROTECTED REGION ID(LiberaSparkSRBPM::LiberaSparkSRBPMStateAllowed.AdditionalMethods) ENABLED START -----*/
......
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