// ============================================================================
//
// = CONTEXT
//    TANGO Project - Keithley Electrometer Support Library
//
// = FILENAME
//    TangoSerialLink.h
//
// = AUTHOR
//    X. Elattaoui
//
// ============================================================================

#ifndef _TANGO_SERIAL_LINK_H_
#define _TANGO_SERIAL_LINK_H_

// ============================================================================
// DEPENDENCIES
// ============================================================================
#include <tango.h>
#include <DeviceProxyHelper.h>
#include "CommunicationLink.h"

/**
 *  \addtogroup Communication Management
 *  @{
 */

/**
 *  \brief This class manage the SERIAL communication bus
 *
 *  \author Xavier Elattaoui
 *  \date 11-2006
 */

class TangoSerialLink : public CommunicationLink
{
	
public :
 	/**
	* \brief Initialization. 
	*/
	TangoSerialLink (std::string& serial_device_name);
	
	/**	
	* \brief Release resources.
	*/
	virtual ~TangoSerialLink (void);
	
	/**
	*  \brief Send command (data) as string to hardware.
	*
	*  \throws Tango::DevFailed
	*/
	void write(std::string cmd)	 throw (Tango::DevFailed);

	/**
	*  \brief Gets hardware response as string.
	*
	*  \throws Tango::DevFailed
	*/
	std::string read(void)		 throw (Tango::DevFailed);

	/**
	*  \brief Performs a write read operation as string.
	*
	*  \throws Tango::DevFailed
	*/
	std::string write_read(std::string cmd)  throw (Tango::DevFailed);

	/**
	*  \brief Returns the Gpib SRQ line state : Not used HERR
	*
	*  \throws Tango::DevFailed

	bool isSRQLineUp(void)  throw (Tango::DevFailed);
	*/
private :
	/**
	* Creates a proxy on the specified Serial Device.
	*/
	void create_serial_proxy(void) throw (Tango::DevFailed);
  
	Tango::DeviceProxyHelper* _serial_proxy;

	bool _is_serial_proxy_created;
	
	std::string response;

};

/** @} */	//- end addtogroup

#endif // _TANGO_SERIAL_LINK_H_