From 0779db1d9c228f19825b501f0f037da07d5034a2 Mon Sep 17 00:00:00 2001
From: Xavier Elattaoui <xavier.elattaoui@synchrotron-soleil.fr>
Date: Tue, 17 Mar 2009 15:22:32 +0000
Subject: [PATCH] xavier : - bug in Novelec part fixed (END_OF_LINE!)

---
 src/NovelecProtocol.cpp | 16 +++++++++++-----
 src/TangoSerialLink.cpp |  3 ++-
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/NovelecProtocol.cpp b/src/NovelecProtocol.cpp
index 2bb8de6..9d29ac3 100644
--- a/src/NovelecProtocol.cpp
+++ b/src/NovelecProtocol.cpp
@@ -33,7 +33,7 @@ static const short	RANGE_CMD_NUM		= 8;
 static const short	RESPONSE_LGTH_CMD_NUM = 17;
 static const short	CLEAR_ERRORS_CMD_NUM  = 18;
 //- the specific new line character
-static const char	END_OF_LINE[] = {'\r','\n'};
+static const char	END_OF_LINE[] = {13, 10, 0};
 //- modes allowed
 static const std::string mode_str[]		= {"ERR : UNKNOWN MODE","ZERO V/F","OFFSET","LEAKAGE","TEST","MEASURE"};
 static const std::string range_str[5][8]= {	{"1e-11AcC","3e-11AcC","1e-10AcC","3e-10AcC", "OUT OF RANGE","OUT OF RANGE","OUT OF RANGE","OUT OF RANGE"},
@@ -69,11 +69,14 @@ void NovelecProtocol::init_MCCE2_for_communication(void)
 std::stringstream explicite_resp;
 std::string tmp("no data");
 
+	std::cout << "NovelecProtocol::init_MCCE2_for_communication(void) -> ENTERING ... ADDRESS = " << this->_devAdd << std::endl;
 	//- CMD to enable PROG cmds
 	this->switch_MCCE2_OFF();  //- this command is now called in the MCCE2 device !
+	std::cout << "NovelecProtocol::switch_MCCE2_OFF() -> DONE !!!" << std::endl;
 
 	//- Clear error registers
 	this->clear_registers();
+	std::cout << "NovelecProtocol::clear_registers() -> DONE !!!" << std::endl;
 
 	//- send cmd to have an explicite response :
 	explicite_resp << _devAdd << " PROG " << RESPONSE_LGTH_CMD_NUM << " 1" << END_OF_LINE << std::endl;
@@ -82,6 +85,7 @@ std::string tmp("no data");
 	check_command(tmp);
 	//- if no error
 	_is_explicite_resp_enabled = true;
+	std::cout << "NovelecProtocol::init_MCCE2_for_communication(void) -> DONE !!!" << std::endl;
 
 }
 
@@ -104,7 +108,7 @@ std::stringstream cmd_to_send;
 std::string tmp("no data");
 
 	//- send cmd to have a explicite response :
-	cmd_to_send << _devAdd << " MEASURE 1" << END_OF_LINE << std::endl;
+	cmd_to_send << _devAdd << " MEASURE 1 " << END_OF_LINE << std::endl;
 	tmp = _communication_link->write_read(cmd_to_send.str());
 	//- check only the command response
 	check_command(tmp);
@@ -117,12 +121,14 @@ std::string tmp("no data");
 // ============================================================================
 void NovelecProtocol::switch_MCCE2_OFF (void) 
 {
-std::stringstream cmd_to_send;
+std::stringstream toto;
 std::string tmp("no data");
 
+std::cout << "NovelecProtocol::switch_MCCE2_OFF : _devAdd" << _devAdd << endl;
 	//- send cmd to have a explicite response :
-	cmd_to_send << _devAdd << " MEASURE 0" << END_OF_LINE << std::endl;
-	tmp = _communication_link->write_read(cmd_to_send.str());
+	toto << _devAdd << " MEASURE 0 " << END_OF_LINE << std::ends;
+std::cout << "\n\n NovelecProtocol::switch_MCCE2_OFF -> CMD = [" << toto.str() << "]" << std::endl;
+	tmp = _communication_link->write_read(toto.str());
 	//- check only the command response
 	check_command(tmp);
 
diff --git a/src/TangoSerialLink.cpp b/src/TangoSerialLink.cpp
index 7844882..472505b 100644
--- a/src/TangoSerialLink.cpp
+++ b/src/TangoSerialLink.cpp
@@ -121,7 +121,8 @@ std::string TangoSerialLink::read (void) throw (Tango::DevFailed)
 	try
 	{
 		//- try in mode LINE
-		this->_serial_proxy->command_inout("DevSerReadString", MODE_LINE ,this->response);
+		//this->_serial_proxy->command_inout("DevSerReadString", MODE_LINE ,this->response);
+		this->_serial_proxy->command_out("DevSerReadLine", this->response);
 	}
 	catch(Tango::DevFailed& df )
 	{
-- 
GitLab