Commit 84a5901b authored by Nicolas Tappret's avatar Nicolas Tappret

add DisableNumericValue property for defined the numeric value returned when a device is Disabled

parent 813ee79a
......@@ -233,6 +233,7 @@ void AttributeCombiner::get_device_property()
dev_prop.push_back(Tango::DbDatum("CommandList"));
dev_prop.push_back(Tango::DbDatum("Timeout"));
dev_prop.push_back(Tango::DbDatum("refreshTime"));
dev_prop.push_back(Tango::DbDatum("DisableNumericValue"));
// is there at least one property to be read ?
if (dev_prop.size()>0)
......@@ -313,6 +314,17 @@ void AttributeCombiner::get_device_property()
// And try to extract refreshTime value from database
if (dev_prop[i].is_empty()==false) dev_prop[i] >> refreshTime;
// Try to initialize DisableNumericValue from class property
cl_prop = ds_class->get_class_property(dev_prop[++i].name);
if (cl_prop.is_empty()==false) cl_prop >> disableNumericValue;
else {
// Try to initialize DisableNumericValue from default device value
def_prop = ds_class->get_default_device_property(dev_prop[i].name);
if (def_prop.is_empty()==false) def_prop >> disableNumericValue;
}
// And try to extract DisableNumericValue value from database
if (dev_prop[i].is_empty()==false) dev_prop[i] >> disableNumericValue;
}
/*----- PROTECTED REGION ID(AttributeCombiner::get_device_property_after) ENABLED START -----*/
......@@ -1135,13 +1147,11 @@ void AttributeCombiner::add_dynamic_commands()
addError(i, arl[j][i]);
} else {
if (arl[j][i].group_element_enabled()) {
if(item->type != Tango::DEV_STATE){
if(item->type != Tango::DEV_STATE && item->rwType == Tango::READ_WRITE){
vector<inType> v;
arl[j][i] >> v;
readVal[i * nbAtt + j] = (outType) v[0];
if(item->rwType){
readSetPoint[i * nbAtt + j] = (outType) v[1];
}
readSetPoint[i * nbAtt + j] = (outType) v[1];
}else{
inType v;
arl[j][i] >> v;
......@@ -1227,7 +1237,7 @@ void AttributeCombiner::add_dynamic_commands()
} else {
// Disabled device
for (int k = 0; k < (int) length; k++)
result[i * blockSize + j * length + k] = NAN;
result[i * blockSize + j * length + k] = disableNumericValue;
}
}
}
......@@ -1334,56 +1344,56 @@ void AttributeCombiner::add_dynamic_commands()
if (item->isSpectrum)
READSPECTRUM<Tango::DevBoolean>(attr, item, arl);
else
READSCALAR<Tango::DevBoolean, Tango::DevDouble>(attr, item, arl, NAN, NAN);
READSCALAR<Tango::DevBoolean, Tango::DevDouble>(attr, item, arl, NAN, disableNumericValue);
break;
case Tango::DEV_ENUM:
if (item->isSpectrum)
READSPECTRUM<Tango::DevEnum>(attr, item, arl);
else
READSCALAR<Tango::DevEnum, Tango::DevDouble>(attr, item, arl, NAN, NAN);
READSCALAR<Tango::DevEnum, Tango::DevDouble>(attr, item, arl, NAN, disableNumericValue);
break;
case Tango::DEV_USHORT:
if (item->isSpectrum)
READSPECTRUM<Tango::DevUShort>(attr, item, arl);
else
READSCALAR<Tango::DevUShort, Tango::DevDouble>(attr, item, arl, NAN, NAN);
READSCALAR<Tango::DevUShort, Tango::DevDouble>(attr, item, arl, NAN, disableNumericValue);
break;
case Tango::DEV_SHORT:
if (item->isSpectrum)
READSPECTRUM<Tango::DevShort>(attr, item, arl);
else
READSCALAR<Tango::DevShort, Tango::DevDouble>(attr, item, arl, NAN, NAN);
READSCALAR<Tango::DevShort, Tango::DevDouble>(attr, item, arl, NAN, disableNumericValue);
break;
case Tango::DEV_LONG:
if (item->isSpectrum)
READSPECTRUM<Tango::DevLong>(attr, item, arl);
else
READSCALAR<Tango::DevLong, Tango::DevDouble>(attr, item, arl, NAN, NAN);
READSCALAR<Tango::DevLong, Tango::DevDouble>(attr, item, arl, NAN, disableNumericValue);
break;
case Tango::DEV_ULONG:
if (item->isSpectrum)
READSPECTRUM<Tango::DevULong>(attr, item, arl);
else
READSCALAR<Tango::DevULong, Tango::DevDouble>(attr, item, arl, NAN, NAN);
READSCALAR<Tango::DevULong, Tango::DevDouble>(attr, item, arl, NAN, disableNumericValue);
break;
case Tango::DEV_LONG64:
if (item->isSpectrum)
READSPECTRUM<Tango::DevLong64>(attr, item, arl);
else
READSCALAR<Tango::DevLong64, Tango::DevDouble>(attr, item, arl, NAN, NAN);
READSCALAR<Tango::DevLong64, Tango::DevDouble>(attr, item, arl, NAN, disableNumericValue);
break;
case Tango::DEV_ULONG64:
if (item->isSpectrum)
READSPECTRUM<Tango::DevULong64>(attr, item, arl);
else
READSCALAR<Tango::DevULong64, Tango::DevDouble>(attr, item, arl, NAN, NAN);
READSCALAR<Tango::DevULong64, Tango::DevDouble>(attr, item, arl, NAN, disableNumericValue);
break;
case Tango::DEV_STATE:
......@@ -1402,7 +1412,7 @@ void AttributeCombiner::add_dynamic_commands()
if (item->isSpectrum)
READSPECTRUM<Tango::DevDouble>(attr, item, arl);
else
READSCALAR<Tango::DevDouble, Tango::DevDouble>(attr, item, arl, NAN, NAN);
READSCALAR<Tango::DevDouble, Tango::DevDouble>(attr, item, arl, NAN, disableNumericValue);
break;
}
......@@ -1798,6 +1808,25 @@ void AttributeCombiner::add_dynamic_commands()
}else if (s1 == Tango::CLOSE && s2 == Tango::CLOSE) {
return Tango::CLOSE;
}
if (s1 == Tango::INIT && s2 == Tango::INIT){
return Tango::ON;
}
if (s1 == Tango::INIT && s2 != Tango::INIT){
return s2;
}
if (s2 == Tango::INIT && s1 != Tango::INIT){
return s1;
}
if (s1 == Tango::DISABLE && s2 == Tango::DISABLE){
return Tango::ON;
}
if (s1 == Tango::DISABLE && s2 != Tango::DISABLE){
return s2;
}
if (s2 == Tango::DISABLE && s1 != Tango::DISABLE){
return s1;
}
return Tango::ALARM;
}
/*----- PROTECTED REGION END -----*/ // AttributeCombiner::namespace_ending
......
......@@ -141,6 +141,8 @@ public:
Tango::DevLong timeout;
// refreshTime: minimum time beetween 2 read.
Tango::DevLong64 refreshTime;
// DisableNumericValue: here you defined the value returned when a devices is disable
Tango::DevDouble disableNumericValue;
// Attribute data members
public:
......
......@@ -31,6 +31,11 @@
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<DefaultPropValue>1000</DefaultPropValue>
</deviceProperties>
<deviceProperties name="DisableNumericValue" description="here you defined the value returned when a devices is disable">
<type xsi:type="pogoDsl:DoubleType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<DefaultPropValue>NAN</DefaultPropValue>
</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" isDynamic="false">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
......
......@@ -453,6 +453,20 @@ void AttributeCombinerClass::set_default_property()
}
else
add_wiz_dev_prop(prop_name, prop_desc);
prop_name = "DisableNumericValue";
prop_desc = "here you defined the value returned when a devices is disable";
prop_def = "NAN";
vect_data.clear();
vect_data.push_back("NAN");
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);
}
//--------------------------------------------------------
......
......@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [1.0.1] - 22-11-2019
### Changed
* add DisableNumericValue property for defined the numeric value returned when a device is Disabled
* improved default state
## [1.0.0] - 15-11-2019
### Changed
......
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