Skip to content
Snippets Groups Projects
Commit c4ec11f4 authored by Jean Coquet's avatar Jean Coquet
Browse files

correctif plantage sur commande erronee

release_1_1_7
parent 1b3db24c
Branches
Tags v1.6.9
No related merge requests found
......@@ -8,7 +8,7 @@
</parent>
<groupId>fr.soleil.device</groupId>
<artifactId>GpibPrologix-${aol}-${mode}</artifactId>
<version>1.1.6</version>
<version>1.1.7</version>
<packaging>nar</packaging>
<name>GpibPrologix</name>
<description>GpibPrologix device</description>
......
static const char *RcsId = "$Id: GpibPrologix.cpp,v 1.17 2012-03-22 15:16:09 jean_coquet Exp $";
static const char *RcsId = "$Id: GpibPrologix.cpp,v 1.18 2012-04-04 13:50:50 jean_coquet Exp $";
//+=============================================================================
//
// file : GpibPrologix.cpp
......@@ -13,10 +13,10 @@ static const char *RcsId = "$Id: GpibPrologix.cpp,v 1.17 2012-03-22 15:16:09 jea
//
// $Author: jean_coquet $
//
// $Revision: 1.17 $
// $Revision: 1.18 $
//
// $Revision: 1.17 $
// $Date: 2012-03-22 15:16:09 $
// $Revision: 1.18 $
// $Date: 2012-04-04 13:50:50 $
//
// SVN only:
// $HeadURL: $
......@@ -24,6 +24,11 @@ static const char *RcsId = "$Id: GpibPrologix.cpp,v 1.17 2012-03-22 15:16:09 jea
// CVS only:
// $Source: /users/chaize/newsvn/cvsroot/Communication/GpibPrologix/src/GpibPrologix.cpp,v $
// $Log: not supported by cvs2svn $
// Revision 1.17 2012/03/22 15:16:09 jean_coquet
// bug correction (crash when trying to Init the device and GPIB client does not respond)
// some code cleaning
// State and Status enhanced
//
// Revision 1.16 2012/03/01 09:01:54 jean_coquet
// amelioration, avec reconnections
// A tester
......@@ -718,7 +723,8 @@ namespace GpibPrologix_ns
static_cast<const char*>("GpibPrologix::read"));
}
std::string answer("");
std::string answer;
answer.resize (64);
try
{
//- ask Prologix to read
......@@ -777,7 +783,8 @@ namespace GpibPrologix_ns
(const char*)"Unknown (...) Exception caught",
(const char*)"GpibPrologix::read");
}
Tango::DevString argout = new char[answer.size()+1];
DEBUG_STREAM << "GpibPrologix::read : answer = <" << answer << ">" << std::endl;
Tango::DevString argout = new char[answer.size()+2];
strcpy(argout, answer.c_str());
return argout;
......@@ -851,6 +858,7 @@ namespace GpibPrologix_ns
Tango::DevString resp;
try
{
this->write (argin);
......@@ -863,6 +871,7 @@ namespace GpibPrologix_ns
++this->consecutive_com_error_counter;
++this->com_error_counter;
this->com_state = Tango::FAULT;
if (resp)
this->com_last_error = "write_read : communication failed cmd sent : ["
+ std::string (argin)
+ "] response : ["
......@@ -870,6 +879,13 @@ namespace GpibPrologix_ns
+ "] + Tango::DevFailed caught : ["
+ std::string (exc.errors[0].desc)
+ "]";
else
this->com_last_error = "write_read : communication failed cmd sent : ["
+ std::string (argin)
+ "] empty response Tango::DevFailed caught : ["
+ std::string (exc.errors[0].desc)
+ "]";
ERROR_STREAM << "GpibPrologix::" << this->com_last_error << std::endl;
Tango::Except::re_throw_exception(exc,
static_cast<const char*>("COMMUNICATION_FAILED"),
......@@ -881,6 +897,7 @@ namespace GpibPrologix_ns
++this->consecutive_com_error_counter;
++this->com_error_counter;
this->com_state = Tango::FAULT;
if (resp)
this->com_last_error = "write_read : communication failed cmd sent : ["
+ std::string (argin)
+ "] response : ["
......@@ -888,6 +905,13 @@ namespace GpibPrologix_ns
+ "] + yat::SocketException caught : ["
+ se.errors[0].desc
+ "]";
else
this->com_last_error = "write_read : communication failed cmd sent : ["
+ std::string (argin)
+ "] empty response yat::SocketException caught : ["
+ se.errors[0].desc
+ "]";
ERROR_STREAM << "GpibPrologix::" << com_last_error << std::endl;
Tango::Except::throw_exception((const char*)"COMMUNICATION_FAILED",
se.errors[0].desc.c_str (),
......@@ -898,11 +922,16 @@ namespace GpibPrologix_ns
++this->consecutive_com_error_counter;
++this->com_error_counter;
this->com_state = Tango::FAULT;
if (resp)
this->com_last_error = "write_read : communication failed cmd sent : ["
+ std::string (argin)
+ "] response : ["
+ resp
+ "] +(...) exception caught";
else
this->com_last_error = "write_read : communication failed cmd sent : ["
+ std::string (argin)
+ "] empty response (...) exception caught";
ERROR_STREAM << "GpibPrologix::" << com_last_error << std::endl;
Tango::Except::throw_exception((const char*)"COMMUNICATION_FAILED",
(const char*)"Unknown (...) Exception caught",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment