Skip to content
Snippets Groups Projects
Commit 067b71ab authored by Xavier ELATTAOUI's avatar Xavier ELATTAOUI
Browse files

CI-1058 : device starts in any case

parent ccdfe375
Branches
Tags
No related merge requests found
......@@ -8,7 +8,7 @@
</parent>
<groupId>fr.soleil.device</groupId>
<artifactId>CYBERSTARx1000-${aol}-${mode}</artifactId>
<version>1.3.11-SNAPSHOT</version>
<version>1.3.11</version>
<packaging>nar</packaging>
<name>CYBERSTARx1000</name>
<description>CYBERSTARx1000 device</description>
......
......@@ -236,30 +236,6 @@ namespace CYBERSTARx1000_ns
mySerial = 0;
// initialize write part of attributes
try
{
read_upper();
read_lower();
}
catch (Tango::DevFailed &e)
{
this->init_device_done = false;
ERROR_STREAM << "CYBERSTARx1000::init_device() caught DevFailed trying to call read_upper() or read_lower() [" << e << "]" << std::endl;
return;
}
catch (...)
{
this->init_device_done = false;
ERROR_STREAM << "CYBERSTARx1000::init_device() caught (...) trying to call read_upper() or read_lower() " << std::endl;
return;
}
attr_scaUpperThreshold_write=(*attr_scaUpperThreshold_read);
attr_scaLowerThreshold_write=(*attr_scaLowerThreshold_read);
attr_windowWidth_write= attr_scaUpperThreshold_write- attr_scaLowerThreshold_write;
attr_windowCenterPosition_write=attr_scaLowerThreshold_write + attr_windowWidth_write/2;
try
{
this->init_proxy_Serialline ();
......@@ -272,7 +248,6 @@ namespace CYBERSTARx1000_ns
<< e
<< "]"
<< std::endl;
return;
}
catch (...)
{
......@@ -282,11 +257,34 @@ namespace CYBERSTARx1000_ns
<< "check properties, restart device"
<< "]"
<< std::endl;
return;
}
if (mySerial)
{
try
{
read_upper();
read_lower();
attr_scaUpperThreshold_write=(*attr_scaUpperThreshold_read);
attr_scaLowerThreshold_write=(*attr_scaLowerThreshold_read);
attr_windowWidth_write= attr_scaUpperThreshold_write- attr_scaLowerThreshold_write;
attr_windowCenterPosition_write=attr_scaLowerThreshold_write + attr_windowWidth_write/2;
this->init_device_done = true;
}
catch (Tango::DevFailed &e)
{
this->init_device_done = false;
ERROR_STREAM << "CYBERSTARx1000::init_device() caught DevFailed trying to call read_upper() or read_lower() [" << e << "]" << std::endl;
}
catch (...)
{
this->init_device_done = false;
ERROR_STREAM << "CYBERSTARx1000::init_device() caught (...) trying to call read_upper() or read_lower() " << std::endl;
}
}
}
//+----------------------------------------------------------------------------
//
// method : CYBERSTARx1000::get_device_property()
......@@ -345,10 +343,10 @@ namespace CYBERSTARx1000_ns
ERROR_STREAM << "Property SerialProxyName missing - fix and restart device" << std::endl;
this->properties_missing = true;
set_status ("SerialProxyName Property not set [fix and restart device]\n");
Tango::Except::throw_exception(
/* Tango::Except::throw_exception(
(const char*) "TANGO_CONFIGURATION_ERROR",
(const char*) "SerialProxyName property is empty",
(const char*) "CYBERSTARx1000::get_device_property()");
(const char*) "CYBERSTARx1000::get_device_property()"); */
}
if(maxThreshold == -1)
......@@ -356,10 +354,10 @@ namespace CYBERSTARx1000_ns
ERROR_STREAM << "Property maxThreshold missing or not set properly- fix and restart device" << std::endl;
set_status ("MaxThreshold Property not set [fix and restart device]\n");
this->properties_missing = true;
Tango::Except::throw_exception(
/* Tango::Except::throw_exception(
(const char*) "TANGO_CONFIGURATION_ERROR",
(const char*) "MaxThreshold property = -1 (default value)",
(const char*) "CYBERSTARx1000::get_device_property()");
(const char*) "CYBERSTARx1000::get_device_property()"); */
}
}
//+----------------------------------------------------------------------------
......@@ -1125,14 +1123,24 @@ namespace CYBERSTARx1000_ns
{
DEBUG_STREAM << "CYBERSTARx1000::dev_state(): entering... !" << endl;
if (!init_device_done || properties_missing || communication_failed)
if ( properties_missing )
{
set_state (Tango::FAULT);
set_status ("Critical proprt(ies)y missing.");
return Tango::FAULT;
}
if (communication_failed)
if (!init_device_done)
{
set_state (Tango::FAULT);
set_status ("Device initialization failed");
return Tango::FAULT;
}
if (communication_failed)
{
set_state (Tango::FAULT);
set_status ("communication failed");
return Tango::FAULT;
}
Tango::DevState argout;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment