Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cs/ds/axisg2selector
1 result
Show changes
Commits on Source (3)
......@@ -6,4 +6,5 @@ src.tgz
.nse_depinfo
bin/
obj/
README.21889.txt
tmp/
......@@ -637,6 +637,7 @@ void AxisG2Selector::get_device_property()
dev_prop.push_back(Tango::DbDatum("FSMTransitionCommands"));
dev_prop.push_back(Tango::DbDatum("FSMTransitionOnMoving"));
dev_prop.push_back(Tango::DbDatum("FSMTransitionEnable"));
dev_prop.push_back(Tango::DbDatum("MovementCounter"));
// is there at least one property to be read ?
if (dev_prop.size()>0)
......@@ -767,6 +768,17 @@ void AxisG2Selector::get_device_property()
// And try to extract FSMTransitionEnable value from database
if (dev_prop[i].is_empty()==false) dev_prop[i] >> fSMTransitionEnable;
// Try to initialize MovementCounter from class property
cl_prop = ds_class->get_class_property(dev_prop[++i].name);
if (cl_prop.is_empty()==false) cl_prop >> movementCounter;
else {
// Try to initialize MovementCounter from default device value
def_prop = ds_class->get_default_device_property(dev_prop[i].name);
if (def_prop.is_empty()==false) def_prop >> movementCounter;
}
// And try to extract MovementCounter value from database
if (dev_prop[i].is_empty()==false) dev_prop[i] >> movementCounter;
}
/*----- PROTECTED REGION ID(AxisG2Selector::get_device_property_after) ENABLED START -----*/
......@@ -928,6 +940,8 @@ void AxisG2Selector::write_Instrument(Tango::WAttribute &attr)
if ( Selector_new_val != i ){
Selector_new_val = i;
fsm->fsm(FSMT_GOTO, (*trgs_in_use)[Selector_new_val]);
inc_move_counter(1);
}
break;
}
......@@ -1000,6 +1014,9 @@ void AxisG2Selector::write_Selector(Tango::WAttribute &attr)
if ( *attr_Selector_read != (int) w_val ){
fsm->fsm(FSMT_GOTO, (*trgs_in_use)[w_val]);
inc_move_counter(1);
}
......@@ -2052,6 +2069,8 @@ void AxisG2Selector::axis_init()
(const char *)"AxisG2Selector::axis_init()");
}
inc_move_counter(2);
/*----- PROTECTED REGION END -----*/ // AxisG2Selector::axis_init
}
//--------------------------------------------------------
......
......@@ -114,7 +114,6 @@ friend class TFSM;
History_ns::history* hist;
// MYCODE-END
......@@ -147,6 +146,9 @@ public:
Tango::DevBoolean fSMTransitionOnMoving;
// FSMTransitionEnable:
Tango::DevBoolean fSMTransitionEnable;
// MovementCounter: - ogni comando axis init incrementa di 2 unita` il movements_counter
// - ogni spostamento da una posizione (WM, PHOT,EBEAM, etc) ad un`altra posizione incrementa il movements_counter di 1 unita
Tango::DevLong movementCounter;
bool mandatoryNotDefined;
......@@ -470,6 +472,8 @@ public:
vector<string> getUserConfigData(const Tango::ConstDevString *w_val, int w_length);
bool Targets2Config(vector<Target>& trgs, vector<string>& targets);
protected:
void inc_move_counter(int k);
/*----- PROTECTED REGION END -----*/ // AxisG2Selector::Additional Method prototypes
};
......
......@@ -49,6 +49,10 @@
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<DefaultPropValue>false</DefaultPropValue>
</deviceProperties>
<deviceProperties name="MovementCounter" description="- ogni comando &#xab;axis init&#xbb; incrementa di 2 unita` il movements_counter&#xA;- ogni spostamento da una posizione (WM, PHOT,EBEAM, etc) ad un`altra posizione incrementa il movements_counter di 1 unita">
<type xsi:type="pogoDsl:IntType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
......@@ -208,6 +212,6 @@
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="DeltaPosition" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</dynamicAttributes>
<preferences docHome="./doc_html" makefileHome="/usr/local/tango-9.3.3/share/pogo/preferences"/>
<preferences docHome="./doc_html" makefileHome="/usr/local/tango-9.3.4/share/pogo/preferences"/>
</classes>
</pogoDsl:PogoSystem>
......@@ -450,6 +450,19 @@ void AxisG2SelectorClass::set_default_property()
}
else
add_wiz_dev_prop(prop_name, prop_desc);
prop_name = "MovementCounter";
prop_desc = "- ogni comando «axis init» incrementa di 2 unita` il movements_counter\n- ogni spostamento da una posizione (WM, PHOT,EBEAM, etc) ad un`altra posizione incrementa il movements_counter di 1 unita";
prop_def = "";
vect_data.clear();
if (prop_def.length()>0)
{
Tango::DbDatum data(prop_name);
data << vect_data ;
dev_def_prop.push_back(data);
add_wiz_dev_prop(prop_name, prop_desc, prop_def);
}
else
add_wiz_dev_prop(prop_name, prop_desc);
}
//--------------------------------------------------------
......
#include "AxisG2Selector.h"
namespace AxisG2Selector_ns
{
void AxisG2Selector::inc_move_counter(int k)
{
int32_t cur_move_counter;
Tango::Database *db = new Tango::Database();
try {
Tango::DbData get_move_counter;
get_move_counter.push_back(Tango::DbDatum("MovementCounter"));
get_db_device()->get_property(get_move_counter);
if (get_move_counter[0].is_empty()==false) {
get_move_counter[0] >> cur_move_counter;
Tango::DbDatum set_move_counter("MovementCounter");
Tango::DbData db_data;
set_move_counter << (cur_move_counter + k);
db_data.push_back(set_move_counter);
db->put_device_property(get_name(), db_data);
} else {
// DO NOTHING
}
}
catch(Tango::DevFailed e) {
delete db;
Tango::Except::throw_exception(
(const char *)"Failed to movement counter",
(const char *)"Can't save movement counter in database",
(const char *)"AxisG2Selector::inc_move_counter()", Tango::ERR);
}
catch (...) {
delete db;
Tango::Except::throw_exception(
(const char *)"Failed to movement counter",
(const char *)"Can't save movement counter in database",
(const char *)"AxisG2Selector::inc_move_counter()", Tango::ERR);
}
delete db;
}
} // namespace