Skip to content
Snippets Groups Projects
Commit 1085d888 authored by Alexandre MALFREYT's avatar Alexandre MALFREYT Committed by Florent LANGLOIS
Browse files

feat: add EnableRamps and WriteMemorizedValuesAtInit properties with default...

feat: add EnableRamps and WriteMemorizedValuesAtInit properties with default values (do nothing so far)
parent 915889e1
Branches
Tags
2 merge requests!4develop -> main,!3EnableRamps and OutputMemorizedChannelsAtInit properties
...@@ -56,16 +56,34 @@ ...@@ -56,16 +56,34 @@
<Font Size=-1>Tango::DEV_STRING</Font> <Font Size=-1>Tango::DEV_STRING</Font>
</Td> </Td>
<Td> <Td>
<Font Size=-1>The board type [MAO_xxxx - where <xxxx> is the ADlink board identifier - e.g. MAO_6208 - no <Font Size=-1>The board type [MAO_xxxx - where <xxxx> is the ADlink board identifier - e.g. MAO_6208 - no default value]</Font>
default value]</Font>
</Td> </Td>
</Tr> </Tr>
<Tr>
<Td><b><a href=#Dev_DefaultValues>EnableRamps </a></b></Td>
<Td>
<Font Size=-1>Tango::DEV_BOOLEAN</Font>
</Td>
<Td>
<Font Size=-1>Whether to enable or disable the ramp generation on the board output channels. If false, the speedX and initialX dynamic attributes will not be created for every channel, and the changes will happen instantly. [true/false - default value is true]</Font>
</Td>
</Tr>
<Tr>
<Td><b><a href=#Dev_DefaultValues>WriteMemorizedValuesAtInit </a></b></Td>
<Td>
<Font Size=-1>Tango::DEV_BOOLEAN</Font>
</Td>
<Td>
<Font Size=-1>Whether to write the memorized values to the board at the device initialization. [true/false - default value is false]</Font>
</Td>
</Tr>
</Table> </Table>
</Center> </Center>
<A name=Dev_DefaultValues><!--- ---></a>
<Font Size=+1>Device Properties Default Values:</Font><Br> <Font Size=+1>Device Properties Default Values:</Font><Br>
<Table Border=2 Cellpadding=2 CELLSPACING=2> <Table Border=2 Cellpadding=2 CELLSPACING=2>
<tr BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <tr BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
...@@ -80,6 +98,14 @@ ...@@ -80,6 +98,14 @@
<Td>BoardType</Td> <Td>BoardType</Td>
<td>No default value</td> <td>No default value</td>
</Tr> </Tr>
<Tr>
<Td>EnableRamps</Td>
<td>true</td>
</Tr>
<Tr>
<Td>WriteMemorizedValuesAtInit</Td>
<td>false</td>
</Tr>
</Table> </Table>
<Br><Br><Br> <Br><Br><Br>
......
...@@ -582,6 +582,8 @@ void SingleShotAO::get_device_property() ...@@ -582,6 +582,8 @@ void SingleShotAO::get_device_property()
Tango::DbData dev_prop; Tango::DbData dev_prop;
dev_prop.push_back(Tango::DbDatum("BoardNum")); dev_prop.push_back(Tango::DbDatum("BoardNum"));
dev_prop.push_back(Tango::DbDatum("BoardType")); dev_prop.push_back(Tango::DbDatum("BoardType"));
dev_prop.push_back(Tango::DbDatum("EnableRamps"));
dev_prop.push_back(Tango::DbDatum("WriteMemorizedValuesAtInit"));
// Call database and extract values // Call database and extract values
//-------------------------------------------- //--------------------------------------------
...@@ -592,6 +594,7 @@ void SingleShotAO::get_device_property() ...@@ -592,6 +594,7 @@ void SingleShotAO::get_device_property()
SingleShotAOClass *ds_class = (static_cast<SingleShotAOClass *>(get_device_class())); SingleShotAOClass *ds_class = (static_cast<SingleShotAOClass *>(get_device_class()));
int i = -1; int i = -1;
//- <BoardNum> -----------------------
// Try to initialize BoardNum from class property // Try to initialize BoardNum from class property
cl_prop = ds_class->get_class_property(dev_prop[++i].name); cl_prop = ds_class->get_class_property(dev_prop[++i].name);
if (cl_prop.is_empty()==false) cl_prop >> boardNum; if (cl_prop.is_empty()==false) cl_prop >> boardNum;
...@@ -603,6 +606,7 @@ void SingleShotAO::get_device_property() ...@@ -603,6 +606,7 @@ void SingleShotAO::get_device_property()
// And try to extract BoardNum value from database // And try to extract BoardNum value from database
if (dev_prop[i].is_empty()==false) dev_prop[i] >> boardNum; if (dev_prop[i].is_empty()==false) dev_prop[i] >> boardNum;
//- <BoardType> -----------------------
// Try to initialize BoardType from class property // Try to initialize BoardType from class property
cl_prop = ds_class->get_class_property(dev_prop[++i].name); cl_prop = ds_class->get_class_property(dev_prop[++i].name);
if (cl_prop.is_empty()==false) cl_prop >> boardType; if (cl_prop.is_empty()==false) cl_prop >> boardType;
...@@ -614,6 +618,33 @@ void SingleShotAO::get_device_property() ...@@ -614,6 +618,33 @@ void SingleShotAO::get_device_property()
// And try to extract BoardType value from database // And try to extract BoardType value from database
if (dev_prop[i].is_empty()==false) dev_prop[i] >> boardType; if (dev_prop[i].is_empty()==false) dev_prop[i] >> boardType;
//- <EnableRamps> -----------------------
// Try to initialize EnableRamps from class property
cl_prop = ds_class->get_class_property(dev_prop[++i].name);
if (cl_prop.is_empty() == false) cl_prop >> enableRamps;
else
{
// Try to initialize EnableRamps from default device value
def_prop = ds_class->get_default_device_property(dev_prop[i].name);
if (def_prop.is_empty() == false) def_prop >> enableRamps;
}
// And try to extract EnableRamps value from database
if (dev_prop[i].is_empty() == false) dev_prop[i] >> enableRamps;
//- <WriteMemorizedValuesAtInit> -----------------------
// Try to initialize WriteMemorizedValuesAtInit from class property
cl_prop = ds_class->get_class_property(dev_prop[++i].name);
if (cl_prop.is_empty() == false) cl_prop >> writeMemorizedValuesAtInit;
else
{
// Try to initialize WriteMemorizedValuesAtInit from default device value
def_prop = ds_class->get_default_device_property(dev_prop[i].name);
if (def_prop.is_empty() == false) def_prop >> writeMemorizedValuesAtInit;
}
// And try to extract WriteMemorizedValuesAtInit value from database
if (dev_prop[i].is_empty() == false) dev_prop[i] >> writeMemorizedValuesAtInit;
// Check critical properties being present // Check critical properties being present
//-------------------------------------------- //--------------------------------------------
......
...@@ -110,6 +110,14 @@ public : ...@@ -110,6 +110,14 @@ public :
* The board type [MAO_xxxx - where <xxxx> is the ADlink board identifier - e.g. MAO_6208 - no default value] * The board type [MAO_xxxx - where <xxxx> is the ADlink board identifier - e.g. MAO_6208 - no default value]
*/ */
string boardType; string boardType;
/**
* Whether to enable or disable the ramp generation on the board output channels. If false, the speedX and initialX dynamic attributes will not be created for every channel, and the changes will happen instantly. [true/false - default value is true]
*/
Tango::DevBoolean enableRamps;
/**
* Whether to write the memorized values to the board at the device initialization. [true/false - default value is false]
*/
Tango::DevBoolean writeMemorizedValuesAtInit;
//@} //@}
/** /**
......
...@@ -369,10 +369,14 @@ void SingleShotAOClass::set_default_property() ...@@ -369,10 +369,14 @@ void SingleShotAOClass::set_default_property()
string prop_def; string prop_def;
vector<string> vect_data; vector<string> vect_data;
// Set Default Class Properties // Set Default Class Properties
// ...
// Set Default Device Properties // Set Default Device Properties
//- <BoardNum> -----------------------
prop_name = "BoardNum"; prop_name = "BoardNum";
prop_desc = "The the board identifier in the cPCI crate [valid range is 0...7 - no default value] ."; prop_desc = "The board identifier in the cPCI crate [valid range is 0...7 - no default value].";
prop_def = ""; prop_def = "";
vect_data.clear(); vect_data.clear();
if (prop_def.length()>0) if (prop_def.length()>0)
...@@ -385,6 +389,7 @@ void SingleShotAOClass::set_default_property() ...@@ -385,6 +389,7 @@ void SingleShotAOClass::set_default_property()
else else
add_wiz_dev_prop(prop_name, prop_desc); add_wiz_dev_prop(prop_name, prop_desc);
//- <BoardType> -----------------------
prop_name = "BoardType"; prop_name = "BoardType";
prop_desc = "The board type [MAO_xxxx - where <xxxx> is the ADlink board identifier - e.g. MAO_6208 - no default value]"; prop_desc = "The board type [MAO_xxxx - where <xxxx> is the ADlink board identifier - e.g. MAO_6208 - no default value]";
prop_def = ""; prop_def = "";
...@@ -399,7 +404,40 @@ void SingleShotAOClass::set_default_property() ...@@ -399,7 +404,40 @@ void SingleShotAOClass::set_default_property()
else else
add_wiz_dev_prop(prop_name, prop_desc); add_wiz_dev_prop(prop_name, prop_desc);
//- <EnableRamps> -----------------------
prop_name = "EnableRamps";
prop_desc = "Whether to enable or disable the ramp generation on the board output channels. If false, the speedX and initialX dynamic attributes will not be created for every channel, and the changes will happen instantly. [true/false - default value is true]";
prop_def = "true";
vect_data.clear();
vect_data.push_back("true");
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);
//- <WriteMemorizedValuesAt> -----------------------
prop_name = "WriteMemorizedValuesAtInit";
prop_desc = "Whether to write the memorized values to the board at the device initialization. [true/false - default value is false]";
prop_def = "false";
vect_data.clear();
vect_data.push_back("false");
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);
} }
//+---------------------------------------------------------------------------- //+----------------------------------------------------------------------------
// //
// method : SingleShotAOClass::write_class_property // method : SingleShotAOClass::write_class_property
...@@ -432,107 +470,6 @@ void SingleShotAOClass::write_class_property() ...@@ -432,107 +470,6 @@ void SingleShotAOClass::write_class_property()
description << str_desc; description << str_desc;
data.push_back(description); data.push_back(description);
// put cvs or svn location
string filename(classname);
filename += "Class.cpp";
// Create a string with the class ID to
// get the string into the binary
string class_id(ClassId);
// check for cvs information
string src_path(CvsPath);
start = src_path.find("/");
if (start!=string::npos)
{
end = src_path.find(filename);
if (end>start)
{
string strloc = src_path.substr(start, end-start);
// Check if specific repository
start = strloc.find("/cvsroot/");
if (start!=string::npos && start>0)
{
string repository = strloc.substr(0, start);
if (repository.find("/segfs/")!=string::npos)
strloc = "ESRF:" + strloc.substr(start, strloc.length()-start);
}
Tango::DbDatum cvs_loc("cvs_location");
cvs_loc << strloc;
data.push_back(cvs_loc);
}
}
// check for svn information
else
{
string src_path(SvnPath);
start = src_path.find("://");
if (start!=string::npos)
{
end = src_path.find(filename);
if (end>start)
{
header = "$HeadURL: ";
start = header.length();
string strloc = src_path.substr(start, (end-start));
Tango::DbDatum svn_loc("svn_location");
svn_loc << strloc;
data.push_back(svn_loc);
}
}
}
// Get CVS or SVN revision tag
// CVS tag
string tagname(TagName);
header = "$Name: ";
start = header.length();
string endstr(" $");
end = tagname.find(endstr);
if (end!=string::npos && end>start)
{
string strtag = tagname.substr(start, end-start);
Tango::DbDatum cvs_tag("cvs_tag");
cvs_tag << strtag;
data.push_back(cvs_tag);
}
// SVN tag
string svnpath(SvnPath);
header = "$HeadURL: ";
start = header.length();
end = svnpath.find(endstr);
if (end!=string::npos && end>start)
{
string strloc = svnpath.substr(start, end-start);
string tagstr ("/tags/");
start = strloc.find(tagstr);
if ( start!=string::npos )
{
start = start + tagstr.length();
end = strloc.find(filename);
string strtag = strloc.substr(start, end-start-1);
Tango::DbDatum svn_tag("svn_tag");
svn_tag << strtag;
data.push_back(svn_tag);
}
}
// Get URL location
string httpServ(HttpServer);
if (httpServ.length()>0)
{
Tango::DbDatum db_doc_url("doc_url");
db_doc_url << httpServ;
data.push_back(db_doc_url);
}
// Put inheritance // Put inheritance
Tango::DbDatum inher_datum("InheritedFrom"); Tango::DbDatum inher_datum("InheritedFrom");
vector<string> inheritance; vector<string> inheritance;
...@@ -540,8 +477,7 @@ void SingleShotAOClass::write_class_property() ...@@ -540,8 +477,7 @@ void SingleShotAOClass::write_class_property()
inher_datum << inheritance; inher_datum << inheritance;
data.push_back(inher_datum); data.push_back(inher_datum);
// Call database and and values // Call database and add values
//--------------------------------------------
get_db_class()->put_property(data); get_db_class()->put_property(data);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment