diff --git a/src/SingleShotAO.cpp b/src/SingleShotAO.cpp index ee7b789428db19b54161b9cf1f58d81f6e1540bc..96a72ba280a17738ad9cc6e82c68bb244d04616e 100755 --- a/src/SingleShotAO.cpp +++ b/src/SingleShotAO.cpp @@ -247,7 +247,7 @@ void SingleShotAO::init_device() //-------------------------------------------- try { - get_device_properties(); + get_device_property(); } catch (const Tango::DevFailed& df) { @@ -570,57 +570,52 @@ void SingleShotAO::init_device() //+---------------------------------------------------------------------------- // -// method : SingleShotAO::get_device_properties() +// method : SingleShotAO::get_device_property() // // description : Read the device properties from database. // //----------------------------------------------------------------------------- -void SingleShotAO::get_device_properties() +void SingleShotAO::get_device_property() { - // Initialize your default values here (if not done with POGO). - //------------------------------------------------------------------ - - // Read device properties from database.(Automatic code generation) + // Read device properties from database //------------------------------------------------------------------ Tango::DbData dev_prop; dev_prop.push_back(Tango::DbDatum("BoardNum")); dev_prop.push_back(Tango::DbDatum("BoardType")); - // Call database and extract values + // Call database and extract values //-------------------------------------------- - if (Tango::Util::instance()->_UseDb==true) + if (Tango::Util::instance()->_UseDb==true) { get_db_device()->get_property(dev_prop); - Tango::DbDatum def_prop, cl_prop; - SingleShotAOClass *ds_class = - (static_cast<SingleShotAOClass *>(get_device_class())); + } + Tango::DbDatum def_prop, cl_prop; + SingleShotAOClass *ds_class = (static_cast<SingleShotAOClass *>(get_device_class())); int i = -1; - // 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); if (cl_prop.is_empty()==false) cl_prop >> boardNum; else { - // Try to initialize BoardNum from default device value + // Try to initialize BoardNum from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> boardNum; } - // 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; - // 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); if (cl_prop.is_empty()==false) cl_prop >> boardType; else { - // Try to initialize BoardType from default device value + // Try to initialize BoardType from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); if (def_prop.is_empty()==false) def_prop >> boardType; } - // 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; - - - // End of Automatic code generation - //------------------------------------------------------------------ + // Check critical properties being present + //-------------------------------------------- critical_properties_missing = false; @@ -639,8 +634,11 @@ void SingleShotAO::get_device_properties() return; } + // Check critical properties being valid + //-------------------------------------------- + //- <BoardNum> ----------------------- - if (boardNum > 7) + if (boardNum < 0 || boardNum > 7) { boardNum = 0; ERROR_STREAM << "device property <BoardNum> is invalid. Valid range is [0..7]" << endl; @@ -665,7 +663,6 @@ void SingleShotAO::get_device_properties() ERROR_STREAM << "device property <BoardType> is invalid [supported hw: MAO_6208 or MAO_6216]" << endl; critical_properties_missing = true; } - } diff --git a/src/SingleShotAO.h b/src/SingleShotAO.h index 8e259d076f2b50dd42d185e749c98991515fe2d1..7faa1820a7fe1e2260d2f13899c7b71dbe420bbf 100755 --- a/src/SingleShotAO.h +++ b/src/SingleShotAO.h @@ -219,7 +219,7 @@ public : /** * Read the device properties from database */ - void get_device_properties(); + void get_device_property(); //@} // Here is the end of the automatic code generation part