Skip to content
Snippets Groups Projects
Commit 2d89895c authored by ELATTAOUI's avatar ELATTAOUI
Browse files

minor changes.

parent 92705e70
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@
</parent>
<groupId>fr.soleil.lib</groupId>
<artifactId>Electrometers-${aol}-${library}-${mode}</artifactId>
<version>2.5.3</version>
<version>2.5.4</version>
<packaging>nar</packaging>
<name>Electrometers library</name>
<description>Electrometers library</description>
......
This diff is collapsed.
......@@ -64,13 +64,21 @@ void TangoGpibLink::create_gpib_proxy (void) throw (Tango::DevFailed)
}
catch(Tango::DevFailed& df )
{
description = "Unable to create proxy on : " + _communication_Device_name;
description = "Unable to create proxy on : " + _communication_Device_name + ". Check GPIB device is up !";
Tango::Except::re_throw_exception (df,
(const char*)"COMMUNICATION_ERROR",
description.c_str(),
(const char*)"TangoGpibLink::create_gpib_proxy");
}
}
catch(...)
{
description = "Unable to create proxy on : " + _communication_Device_name + ". Check GPIB device is up !";
Tango::Except::throw_exception (
(const char*)"COMMUNICATION_ERROR",
description.c_str(),
(const char*)"TangoGpibLink::create_gpib_proxy");
}
}
......@@ -120,16 +128,25 @@ void TangoGpibLink::write (std::string command_to_send) throw (Tango::DevFailed
}
catch(Tango::DevFailed& df )
{
description = "Unable to write command : " + command_to_send;
if ( cmd )
delete [] cmd;
description = "Unable to write command : " + command_to_send + ". Caught DevFailed." ;
Tango::Except::re_throw_exception (df,
(const char*)"COMMUNICATION_ERROR",
description.c_str(),
(const char*)"TangoGpibLink::write");
}
catch(...)
{
if ( cmd )
delete [] cmd;
description = "Unable to write command : " + command_to_send + ". Caught [...]." ;
Tango::Except::throw_exception (
(const char*)"COMMUNICATION_ERROR",
description.c_str(),
(const char*)"TangoGpibLink::write");
}
}
......@@ -156,6 +173,13 @@ std::string TangoGpibLink::read (void) throw (Tango::DevFailed)
(const char*)"Unable to perform a read operation",
(const char*)"TangoGpibLink::read");
}
catch(...)
{
Tango::Except::throw_exception (
(const char*)"COMMUNICATION_ERROR",
(const char*)"Unable to perform a read operation, caught [...].",
(const char*)"TangoGpibLink::read");
}
return this->response;
}
......@@ -185,14 +209,25 @@ std::string TangoGpibLink::write_read (std::string command_to_send) throw (Tango
}
catch(Tango::DevFailed& df )
{
description = "Unable to write command : " + command_to_send + " and read device response.";
if ( argin )
delete [] argin;
description = "Unable to write/read command : " + command_to_send + " and read device response.";
Tango::Except::re_throw_exception (df,
(const char*)"COMMUNICATION_ERROR",
description.c_str(),
(const char*)"TangoGpibLink::write_read");
}
catch(...)
{
if ( argin )
delete [] argin;
description = "Unable to write/read command : " + command_to_send + " and read device response.";
Tango::Except::throw_exception (
(const char*)"COMMUNICATION_ERROR",
description.c_str(),
(const char*)"TangoGpibLink::write_read");
}
return this->response;
}
......@@ -224,6 +259,14 @@ bool TangoGpibLink::SRQLineState (void) throw (Tango::DevFailed)
(const char*)"TangoGpibLink::SRQLineState");
}
catch(...)
{
description = "Unable to get Gpib SRQ line state.";
Tango::Except::throw_exception (
(const char*)"COMMUNICATION_ERROR",
description.c_str(),
(const char*)"TangoGpibLink::SRQLineState");
}
return result;
}
......@@ -257,6 +300,15 @@ short TangoGpibLink::readStatusByteRegister (void) throw (Tango::DevFailed)
(const char*)"TangoGpibLink::readStatusByteRegister");
}
catch(...)
{
description = "Unable to get device status byte register.";
Tango::Except::throw_exception (
(const char*)"COMMUNICATION_ERROR",
description.c_str(),
(const char*)"TangoGpibLink::readStatusByteRegister");
}
return result;
}
......@@ -278,12 +330,19 @@ void TangoGpibLink::clear (void) throw (Tango::DevFailed)
catch(Tango::DevFailed& df )
{
description = "Unable send Clear Device command.";
Tango::Except::re_throw_exception (df,
(const char*)"COMMUNICATION_ERROR",
description.c_str(),
(const char*)"TangoGpibLink::clear");
}
catch(...)
{
description = "Unable send Clear Device command.";
Tango::Except::throw_exception (
(const char*)"COMMUNICATION_ERROR",
description.c_str(),
(const char*)"TangoGpibLink::clear");
}
}
// ============================================================================
......@@ -304,11 +363,18 @@ void TangoGpibLink::trigger (void) throw (Tango::DevFailed)
catch(Tango::DevFailed& df )
{
description = "Unable send Trigger command.";
Tango::Except::re_throw_exception (df,
(const char*)"COMMUNICATION_ERROR",
description.c_str(),
(const char*)"TangoGpibLink::clear");
(const char*)"TangoGpibLink::trigger");
}
catch(...)
{
description = "Unable send Trigger command.";
Tango::Except::throw_exception (
(const char*)"COMMUNICATION_ERROR",
description.c_str(),
(const char*)"TangoGpibLink::trigger");
}
}
......@@ -18,7 +18,7 @@
#include <iostream>
#include "TangoSerialLink.h"
//- Read serial data in mode LINE (i.e SerialLine device wait until EOF is received from instrument
//- Read serial data in mode LINE (i.e SerialLine device wait until EOF is received from instrument)
static const long MODE_LINE = 2;
//- init of the static instance
......@@ -90,22 +90,39 @@ void TangoSerialLink::create_serial_proxy (void) throw (Tango::DevFailed)
try
{
//- try
//this->_serial_proxy = new Tango::DeviceProxyHelper(_communication_Device_name);
this->_serial_proxy = new Tango::DeviceProxy(_communication_Device_name.c_str());
//(*_serial_proxy)->ping();
_is_serial_proxy_created = true;
}
catch(Tango::DevFailed& df )
{
description = "Unable to create proxy on : " + _communication_Device_name;
if( this->_serial_proxy )
{
delete this->_serial_proxy;
this->_serial_proxy = 0;
}
_is_serial_proxy_created = false;
this->_serial_proxy = 0;
description = "Unable to create proxy on : " + _communication_Device_name;
Tango::Except::re_throw_exception (df,
(const char*)"COMMUNICATION_ERROR",
(const char*)"ALLOCATION_ERROR",
description.c_str(),
(const char*)"TangoSerialLink::create_serial_proxy");
}
catch(...)
{
if( this->_serial_proxy )
{
delete this->_serial_proxy;
this->_serial_proxy = 0;
}
_is_serial_proxy_created = false;
description = "Unable to write command : " + command_to_send + "\nmemory allocation failed.";
Tango::Except::throw_exception (
(const char*)"ALLOCATION_ERROR",
description.c_str(),
(const char*)"TangoSerialLink::write");
}
}
// ============================================================================
......@@ -127,8 +144,12 @@ void TangoSerialLink::write (std::string command_to_send) throw (Tango::DevFail
}
catch(Tango::DevFailed& df )
{
if( argin )
{
delete [] argin;
argin = 0;
}
description = "Unable to write command : " + command_to_send + + "\nmemory allocation failed.";
Tango::Except::re_throw_exception (df,
(const char*)"ALLOCATION_ERROR",
description.c_str(),
......@@ -137,7 +158,6 @@ void TangoSerialLink::write (std::string command_to_send) throw (Tango::DevFail
catch(...)
{
description = "Unable to write command : " + command_to_send + "\nmemory allocation failed.";
Tango::Except::throw_exception (
(const char*)"ALLOCATION_ERROR",
description.c_str(),
......@@ -149,18 +169,40 @@ void TangoSerialLink::write (std::string command_to_send) throw (Tango::DevFail
//- try
dd_in << argin;
this->_serial_proxy->command_inout("DevSerWriteString", dd_in);
if( argin )
{
delete [] argin;
argin = 0;
}
//std::cout << "TangoSerialLink::write -> argin = *\"" << argin << "\"*" << std::endl;
}
catch(Tango::DevFailed& df )
{
if( argin )
{
delete [] argin;
argin = 0;
}
description = "Unable to write command : " + command_to_send;
Tango::Except::re_throw_exception (df,
(const char*)"COMMUNICATION_ERROR",
description.c_str(),
(const char*)"TangoSerialLink::write");
}
catch(...)
{
if( argin )
{
delete [] argin;
argin = 0;
}
description = "Unable to write command : " + command_to_send;
Tango::Except::throw_exception (
(const char*)"COMMUNICATION_ERROR",
description.c_str(),
(const char*)"TangoSerialLink::write");
}
}
......@@ -187,6 +229,13 @@ std::string TangoSerialLink::read (void) throw (Tango::DevFailed)
(const char*)"Unable to perform a read operation",
(const char*)"TangoSerialLink::read");
}
catch(...)
{
Tango::Except::throw_exception (
(const char*)"COMMUNICATION_ERROR",
(const char*)"Unable to perform a read operation",
(const char*)"TangoSerialLink::read");
}
return this->response ;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment