From 0221ffbd655318a01ecd21c4601dd54297f5165c Mon Sep 17 00:00:00 2001
From: Xavier Elattaoui <xavier.elattaoui@synchrotron-soleil.fr>
Date: Tue, 15 Apr 2008 12:52:15 +0000
Subject: [PATCH] xavier : - SRQ management changed : * ReadStatusByteRegister
 method added * IsSrqLineUP added

---
 include/AbstractElectrometerClass.h |  9 +++++--
 include/CommunicationLink.h         |  9 +++++--
 include/ElectrometerProtocol.h      | 11 +++++---
 include/KeithleyDDCProtocol.h       |  6 ++++-
 include/KeithleySCPIProtocol.h      |  3 ++-
 include/TangoGpibLink.h             |  3 ++-
 src/AbstractElectrometerClass.cpp   | 16 ++++++++++--
 src/CommunicationLink.cpp           | 22 +++++++++++++---
 src/ElectrometerProtocol.cpp        | 12 ++++++++-
 src/KeithleyDDCProtocol.cpp         | 13 ++++++++--
 src/KeithleySCPIProtocol.cpp        | 18 ++++++++++---
 src/Makefile.vc                     |  2 +-
 src/TangoGpibLink.cpp               | 39 ++++++++++++++++++++++++++---
 13 files changed, 136 insertions(+), 27 deletions(-)

diff --git a/include/AbstractElectrometerClass.h b/include/AbstractElectrometerClass.h
index b625e1c..a8fac2c 100644
--- a/include/AbstractElectrometerClass.h
+++ b/include/AbstractElectrometerClass.h
@@ -9,9 +9,13 @@
 //
 // $Author: xavela $
 //
-// $Revision: 1.9 $
+// $Revision: 1.10 $
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.9  2008/02/15 10:17:55  xavela
+// xavier :
+// - command abort added for SCPI Keithleys
+//
 // Revision 1.8  2008/02/15 10:15:16  xavela
 // xavier :
 // - command abort added for SCPI Keithleys
@@ -140,7 +144,8 @@ public:
 	virtual void start_storing				    (void);
 	void enable_SRQBufferFull		  (void);
 	void disable_SRQBufferFull		(void);
-	virtual bool readStatusByteRegister         (void); //- used to know if the integration cycle is done! 
+	virtual bool SRQLineState         (void); //- used to know if the integration cycle is done! 
+	virtual short readStatusByteRegister         (void); //- device status byte register value on SRQ! 
 	bool get_overloadRangeState		(void);		//- used to know if the device range is overloaded (DDC Keithley ONLY)! 
 	virtual void set_buffer_size			    (short);
 	virtual void set_triggerMode			    (short);
diff --git a/include/CommunicationLink.h b/include/CommunicationLink.h
index a5172df..0cf7976 100644
--- a/include/CommunicationLink.h
+++ b/include/CommunicationLink.h
@@ -12,9 +12,13 @@
 //
 // $Author: xavela $
 //
-// $Revision: 1.4 $
+// $Revision: 1.5 $
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.4  2008/02/15 10:17:55  xavela
+// xavier :
+// - command abort added for SCPI Keithleys
+//
 // Revision 1.3  2008/02/13 15:51:44  xavela
 // xavier :
 // - Integration Mode available for DDC/SCPI devices
@@ -98,7 +102,8 @@ public :
 	*
 	*  \throws Tango::DevFailed
 	*/
-	virtual bool isSRQLineUp(void);
+	virtual bool SRQLineState             (void); //- used to know if the integration cycle is done! 
+	virtual short readStatusByteRegister  (void); //- device status byte register value on SRQ! 
 
 	/**
 	*  \brief Clear a specific device (same as reset *RST).
diff --git a/include/ElectrometerProtocol.h b/include/ElectrometerProtocol.h
index c81453d..ca10570 100644
--- a/include/ElectrometerProtocol.h
+++ b/include/ElectrometerProtocol.h
@@ -12,9 +12,13 @@
 //
 // $Author: xavela $
 //
-// $Revision: 1.8 $
+// $Revision: 1.9 $
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.8  2008/02/15 10:17:55  xavela
+// xavier :
+// - command abort added for SCPI Keithleys
+//
 // Revision 1.7  2008/02/15 10:15:16  xavela
 // xavier :
 // - command abort added for SCPI Keithleys
@@ -103,8 +107,9 @@ public:
 	virtual std::string get_range(void)		= 0;
 	virtual std::vector<double> get_integratedValue		(void);
 	virtual std::vector<double> get_fetchValue		    (void);
-	virtual bool readStatusByteRegister         (void); //- used to know if the integration cycle is done! 
-	virtual bool get_overloadRangeState         (void); //- used to know if the device range is overloaded! 
+	virtual bool SRQLineState             (void); //- used to know if the integration cycle is done! 
+	virtual short readStatusByteRegister  (void); //- device status byte register value on SRQ! 
+	virtual bool get_overloadRangeState   (void); //- used to know if the device range is overloaded! 
 
 	/**
 	*  \brief Common Get Raw Electrometer Status.
diff --git a/include/KeithleyDDCProtocol.h b/include/KeithleyDDCProtocol.h
index 2c7777c..fb36ef7 100644
--- a/include/KeithleyDDCProtocol.h
+++ b/include/KeithleyDDCProtocol.h
@@ -63,7 +63,11 @@ public:
 //	void local				(void); // To be implemented in future library versions
 //	void remote				(void);
 	
-  bool readStatusByteRegister     (void); //- used to know if the integration cycle is done! 
+ 	/**
+	*  \brief Electrometer : cmd used to know if the integration cycle is done!
+	*/
+	virtual bool SRQLineState             (void); //- used to know if the integration cycle is done! 
+	virtual short readStatusByteRegister  (void); //- device status byte register value on SRQ! 
 	
   /**
 	*  \brief Electrometer : cmd to get electrometer data.
diff --git a/include/KeithleySCPIProtocol.h b/include/KeithleySCPIProtocol.h
index 14fd1ec..46e6a7c 100644
--- a/include/KeithleySCPIProtocol.h
+++ b/include/KeithleySCPIProtocol.h
@@ -80,7 +80,8 @@ public:
  	/**
 	*  \brief Electrometer : cmd used to know if the integration cycle is done!
 	*/
-  bool readStatusByteRegister (void);
+	bool SRQLineState             (void); //- used to know if the integration cycle is done! 
+	short readStatusByteRegister  (void); //- device status byte register value on SRQ! 
 	
   void init_keithley	(void); //- start operation(s)
 	void abort        	(void); //- cancel only all operation(s) started by init_keithley()
diff --git a/include/TangoGpibLink.h b/include/TangoGpibLink.h
index 37066ed..fbe53b6 100644
--- a/include/TangoGpibLink.h
+++ b/include/TangoGpibLink.h
@@ -74,7 +74,8 @@ public :
 	*
 	*  \throws Tango::DevFailed
 	*/
-	bool isSRQLineUp(void)  throw (Tango::DevFailed);
+	bool SRQLineState             (void); //- used to know if the integration cycle is done! 
+	short readStatusByteRegister  (void); //- device status byte register value on SRQ! 
 
 	/**
 	*  \brief Clear a specific device (same as reset *RST).
diff --git a/src/AbstractElectrometerClass.cpp b/src/AbstractElectrometerClass.cpp
index 3b86624..9784492 100644
--- a/src/AbstractElectrometerClass.cpp
+++ b/src/AbstractElectrometerClass.cpp
@@ -11,9 +11,13 @@
 //
 // $Author: xavela $
 //
-// $Revision: 1.10 $
+// $Revision: 1.11 $
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.10  2008/02/15 10:17:57  xavela
+// xavier :
+// - command abort added for SCPI Keithleys
+//
 // Revision 1.9  2008/02/15 10:15:18  xavela
 // xavier :
 // - command abort added for SCPI Keithleys
@@ -499,10 +503,18 @@ void AbstractElectrometerClass::disable_SRQBufferFull (void)
   _electrometerProtocol->disable_SRQBufferFull();
 }
 
+// ============================================================================
+// AbstractElectrometerClass::SRQLineState
+// ============================================================================
+bool AbstractElectrometerClass::SRQLineState (void) 
+{
+  return _electrometerProtocol->SRQLineState();
+}
+
 // ============================================================================
 // AbstractElectrometerClass::readStatusByteRegister
 // ============================================================================
-bool AbstractElectrometerClass::readStatusByteRegister (void) 
+short AbstractElectrometerClass::readStatusByteRegister (void) 
 {
   return _electrometerProtocol->readStatusByteRegister();
 }
diff --git a/src/CommunicationLink.cpp b/src/CommunicationLink.cpp
index d03cf87..b6056fd 100644
--- a/src/CommunicationLink.cpp
+++ b/src/CommunicationLink.cpp
@@ -12,9 +12,13 @@
 //
 // $Author: xavela $
 //
-// $Revision: 1.4 $
+// $Revision: 1.5 $
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.4  2008/02/15 10:17:57  xavela
+// xavier :
+// - command abort added for SCPI Keithleys
+//
 // Revision 1.3  2008/02/13 15:51:44  xavela
 // xavier :
 // - Integration Mode available for DDC/SCPI devices
@@ -63,13 +67,23 @@ CommunicationLink::~CommunicationLink (void)
 }
 
 // ============================================================================
-// CommunicationLink::isSRQLineUp
+// CommunicationLink::SRQLineState
 // ============================================================================
-bool CommunicationLink::isSRQLineUp (void)
+bool CommunicationLink::SRQLineState (void)
 {
 		throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", 
 												"This protocol cannot check the SRQ line state.",
-												"CommunicationLink::isSRQLineUp( ).");
+												"CommunicationLink::SRQLineState( ).");
+}
+
+// ============================================================================
+// CommunicationLink::readStatusByteRegister
+// ============================================================================
+short CommunicationLink::readStatusByteRegister (void)
+{
+		throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", 
+												"This protocol cannot check the device staus byte register.",
+												"CommunicationLink::readStatusByteRegister( ).");
 }
 
 // ============================================================================
diff --git a/src/ElectrometerProtocol.cpp b/src/ElectrometerProtocol.cpp
index 4ebd516..bc80d45 100644
--- a/src/ElectrometerProtocol.cpp
+++ b/src/ElectrometerProtocol.cpp
@@ -600,10 +600,20 @@ void ElectrometerProtocol::disable_SRQBufferFull (void)
 											"ElectrometerProtocol::disable_SRQBufferFull( ).");
 }
   
+// ============================================================================
+// ElectrometerProtocol::SRQLineState
+// ============================================================================
+bool ElectrometerProtocol::SRQLineState (void) 
+{
+	throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", 
+											"This Electrometer does not support this command.",
+											"ElectrometerProtocol::SRQLineState( ).");
+}
+  
 // ============================================================================
 // ElectrometerProtocol::readStatusByteRegister
 // ============================================================================
-bool ElectrometerProtocol::readStatusByteRegister (void) 
+short ElectrometerProtocol::readStatusByteRegister (void) 
 {
 	throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", 
 											"This Electrometer does not support this command.",
diff --git a/src/KeithleyDDCProtocol.cpp b/src/KeithleyDDCProtocol.cpp
index 1673162..dec49ae 100644
--- a/src/KeithleyDDCProtocol.cpp
+++ b/src/KeithleyDDCProtocol.cpp
@@ -466,13 +466,22 @@ std::string cmd_to_send("M0X");
 
 }
 
+// ============================================================================
+// KeithleyDDCProtocol::SRQLineState()
+// ============================================================================
+bool KeithleyDDCProtocol::SRQLineState (void) 
+{
+	//- if asserted -> the programmed event occurs : the device can be asked !
+	return _communication_link->SRQLineState();
+}
+
 // ============================================================================
 // KeithleyDDCProtocol::readStatusByteRegister()
 // ============================================================================
-bool KeithleyDDCProtocol::readStatusByteRegister (void) 
+short KeithleyDDCProtocol::readStatusByteRegister (void) 
 {
 	//- if asserted -> the programmed event occurs : the device can be asked !
-	return _communication_link->isSRQLineUp();
+	return _communication_link->readStatusByteRegister();
 }
 
 // ============================================================================
diff --git a/src/KeithleySCPIProtocol.cpp b/src/KeithleySCPIProtocol.cpp
index 2bb5ccb..0ed5eb5 100644
--- a/src/KeithleySCPIProtocol.cpp
+++ b/src/KeithleySCPIProtocol.cpp
@@ -826,12 +826,24 @@ std::string cmd_to_send("STAT:MEAS?");
 }
 
 // ============================================================================
-// KeithleySCPIProtocol::readStatusByteRegister()
+// KeithleySCPIProtocol::SRQLineState()
 // ============================================================================
-bool KeithleySCPIProtocol::readStatusByteRegister (void) 
+bool KeithleySCPIProtocol::SRQLineState (void) 
 {
 	//- if asserted -> the programmed event occurs : the device can be asked !
-	return _communication_link->isSRQLineUp();
+	return _communication_link->SRQLineState();
+
+  //- Cf Keithley doc to know how the to get the wanted event 
+  //-   Chapter : Status Structure
+}
+
+// ============================================================================
+// KeithleySCPIProtocol::readStatusByteRegister()
+// ============================================================================
+short KeithleySCPIProtocol::readStatusByteRegister (void) 
+{
+	//- if SRQ line UP -> the programmed event(s) occurs : the value is available !
+	return _communication_link->readStatusByteRegister();
 
   //- Cf Keithley doc to know how the to get the wanted event 
   //-   Chapter : Status Structure
diff --git a/src/Makefile.vc b/src/Makefile.vc
index a398570..2e4aef0 100644
--- a/src/Makefile.vc
+++ b/src/Makefile.vc
@@ -11,7 +11,7 @@ INCUSER=
 LIBUSER=
 #	 Si vous souhaitez g�n�rer une librairie et pas un executable
 #	 decommentez la ligne suivante
-LIBRARY_NAME= ..\lib\Electrometers.lib
+LIBRARY_NAME= ..\lib\Electrometers_new.lib
 #
 # Le chemin ou j'ai d'autres fichiers sources que ceux du DeviceServer � compiler
 CPPDIRUSER=
diff --git a/src/TangoGpibLink.cpp b/src/TangoGpibLink.cpp
index eae8ff6..1ce95d5 100644
--- a/src/TangoGpibLink.cpp
+++ b/src/TangoGpibLink.cpp
@@ -164,9 +164,9 @@ std::string TangoGpibLink::write_read (std::string command_to_send) throw (Tango
 }
 
 // ============================================================================
-// TangoGpibLink::isSRQLineUp
+// TangoGpibLink::SRQLineState
 // ============================================================================
-bool TangoGpibLink::isSRQLineUp (void) throw (Tango::DevFailed)
+bool TangoGpibLink::SRQLineState (void) throw (Tango::DevFailed)
 {
 	TangoSys_OMemStream description;
   bool result = false;
@@ -177,7 +177,7 @@ bool TangoGpibLink::isSRQLineUp (void) throw (Tango::DevFailed)
 	try
 	{
 		//- try
-		this->_gpib_proxy->read_attribute("isSRQLineAsserted",  result);
+		this->_gpib_proxy->command_out("IsSRQLineUP",  result);
 		return result;
 		
 	}
@@ -188,7 +188,38 @@ bool TangoGpibLink::isSRQLineUp (void) throw (Tango::DevFailed)
 		Tango::Except::re_throw_exception (df,
 			(const char*)"COMMUNICATION_ERROR",
 			description.str(),
-			(const char*)"TangoGpibLink::isSRQLineUp");
+			(const char*)"TangoGpibLink::SRQLineState");
+		
+	}
+	
+}
+
+// ============================================================================
+// TangoGpibLink::readStatusByteRegister
+// ============================================================================
+short TangoGpibLink::readStatusByteRegister (void) throw (Tango::DevFailed)
+{
+	TangoSys_OMemStream description;
+  short result = -1;
+	
+	if(!_is_gpib_proxy_created)
+		create_gpib_proxy();
+	
+	try
+	{
+		//- try
+		this->_gpib_proxy->read_attribute("statusByteRegister",  result);
+		return result;
+		
+	}
+	catch(Tango::DevFailed& df )
+	{
+		description << "Unable to get device status byte register." << ends;
+		
+		Tango::Except::re_throw_exception (df,
+			(const char*)"COMMUNICATION_ERROR",
+			description.str(),
+			(const char*)"TangoGpibLink::readStatusByteRegister");
 		
 	}
 	
-- 
GitLab