From 0b5d543a25328bf8454a7fecc4aac3fc54e166f3 Mon Sep 17 00:00:00 2001
From: System User <boissy@dev-el6-3.ica.synchrotron-soleil.fr>
Date: Fri, 29 Jul 2022 11:08:15 +0200
Subject: [PATCH] [ICATHALES-219] - Ajout de l'attribut error_message pour
 retenir le message a afficher sur ATKPanel

---
 src/RetrigAO.cpp | 27 +++++++++++++++++++++++----
 src/RetrigAO.h   |  1 +
 2 files changed, 24 insertions(+), 4 deletions(-)
 mode change 100644 => 100755 src/RetrigAO.cpp
 mode change 100644 => 100755 src/RetrigAO.h

diff --git a/src/RetrigAO.cpp b/src/RetrigAO.cpp
old mode 100644
new mode 100755
index 3c710dc..4561d26
--- a/src/RetrigAO.cpp
+++ b/src/RetrigAO.cpp
@@ -200,6 +200,8 @@ void RetrigAO::init_device()
   ch5 = 0;
   ch6 = 0;
   ch7 = 0;
+  _error_message = "";
+  
   // Initialise variables to default values
   //--------------------------------------------
   get_device_property();
@@ -2018,6 +2020,7 @@ void RetrigAO::init_board(void)
 	//config.set_stop_mode (adl::wait_end_waveform);
 	
 	DEBUG_STREAM<<"RetrigAO::init_device : init acq"<<std::endl;
+	try{
 	_ASL_TRY_ACTION
 	(
 		ao->init(adl::DAQ2502, boardNum),
@@ -2028,13 +2031,26 @@ void RetrigAO::init_board(void)
 	
 	this->config = _config;
 	/*DEBUG_STREAM<<"RetrigAO::init_device : config acq"<<std::endl;
-	_ASL_TRY_ACTION
+	try
+	{
+		_ASL_TRY_ACTION
 	(
 		ao->configure(_config),
 		"configure", 
 		"RetrigAO::init_device",
 		this->set_internal_state()
-	);	*/	
+	);	
+	}
+	catch (...)
+	{
+		_error_message = "Error while configurating drivers";
+	}
+	*/
+	}
+	catch (...)
+	{
+		_error_message = "Error while initializing drivers";
+	}	
 }
 //+------------------------------------------------------------------
 /**
@@ -2229,8 +2245,11 @@ void  RetrigAO::set_internal_state(void)
       break;
      case asl::ContinuousAO::FAULT:
       this->set_state(Tango::FAULT);
-      this->set_status("An error has occured");
-      break;
+	  if (_error_message == "")
+		this->set_status("An error has occured");
+      else
+		this->set_status(_error_message);
+	  break;
     case asl::ContinuousAO::UNKNOWN:
     default:
       this->set_state(Tango::UNKNOWN);
diff --git a/src/RetrigAO.h b/src/RetrigAO.h
old mode 100644
new mode 100755
index 53015b0..727cd8b
--- a/src/RetrigAO.h
+++ b/src/RetrigAO.h
@@ -549,6 +549,7 @@ protected :
    double* ch7;
    double err_ctr;
    short use_fifo;
+   std::string _error_message;
    //- Store the values into the property
    //- Properties stuff
    int				FindIndexFromPropertyName(Tango::DbData& dev_prop, string property_name);
-- 
GitLab