Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

GPIB_232_CT_A.h

Go to the documentation of this file.
00001 /*
00002  * Time-stamp: <00/08/07 18:56:41 pagey>
00003  *
00004  * $Format: " * $Id: GPIB_232_CT_A.h,v 0.11 2000/08/08 02:38:50 pagey Exp $"$
00005  * GPIB_232_CT_A.h 1.1 Mon, 06 Mar 2000 03:04:16 -0800 pagey
00006  *
00007  */
00008 #ifndef GPIB_232_CT_A_h
00009 #define GPIB_232_CT_A_h
00010 
00011 #include <unistd.h>
00012 #include <stdio.h>
00013 #include <assert.h>
00014 #include "GPIBController.h"
00015 #include "SerialStream.h"
00016 #include "LibGPIB.h"
00017 
00018 extern "C++" {
00019   namespace LibGPIB {
00020     class GPIB_232_CT_A : public GPIBController {
00021     public:
00027       GPIB_232_CT_A(const string serial_port) ;
00028 
00031       virtual ~GPIB_232_CT_A() ;
00032 
00035       const string Identify() ;
00036 
00039       void SetIOTimeout(float timeout) ;
00040 
00041       /* Overloaded Functions: These virtual functions overload the
00042          corresponding functions in the parent classes. Please see the
00043          documentation in the corresponding parent class
00044          documentation. Doxygen automatically includes the
00045          documentation from the parent class so it best to look at the
00046          documentation genearted by Doxygen in the doc directory of
00047          this package.
00048        
00049        */
00051       virtual void Open() ;
00052       virtual void Close() ;
00053       virtual void BecomeActiveController(bool synchronously=true) ;
00054       virtual void ClearDevice(GPIBEquipment &device) ;
00055       virtual void SendCommand(GPIBEquipment &device, const string command) ;
00056       virtual const string ReadData(GPIBEquipment &device, const int read_bytes) ;
00057       virtual void SetLocal(GPIBEquipment &device) ;
00058       virtual void SetEOSModeAndChar(const EOSModeVal mode, const char eos) ; 
00060     protected:
00061       virtual ostream& SendCharPrefix( const int primary_address, 
00062                                        const int secondary_address=0 ) ;
00063       virtual ostream& SendCharPostfix( const int primary_address, 
00064                                         const int secondary_address=0 ) ;
00065       virtual ostream& ReadCharPrefix( const int primary_address, 
00066                                        const int secondary_address=0 ) ;
00067       virtual ostream& ReadCharPostfix( const int primary_address, 
00068                                         const int secondary_address=0 ) ;
00069     private:
00074       string mSerialPortFile ;
00075 
00080       LibSerial::SerialStream mSerialPort ;
00081 
00086       int mEOT ;
00087 
00092       string mEOSSetting ;
00093       
00099       void DiscardCRLF() ;
00100     } ; /* class GPIB_232_CT_A */
00101 
00102     inline 
00103     GPIB_232_CT_A::GPIB_232_CT_A(const string serial_port) :
00104       mSerialPort(serial_port), mEOT(0), mEOSSetting("X,13") {
00105       rdbuf(mSerialPort.rdbuf()) ;
00106       mSerialPort.SetBaud(LibSerial::SerialStream::BAUD_9600) ;
00107       mSerialPort.SetParity(LibSerial::SerialStream::PARITY_NONE) ;
00108       mSerialPort.SetNumOfStopBits(1) ;
00109       mSerialPort.SetCharSize(LibSerial::SerialStream::CHAR_SIZE_7) ;
00110       mSerialPort.SetHardwareFlowControl() ;
00111     }
00112 
00113     inline 
00114     GPIB_232_CT_A::~GPIB_232_CT_A() {
00115       /* empty */
00116     }
00117 
00118     inline 
00119     void
00120     GPIB_232_CT_A::DiscardCRLF() {
00121       char discard_ch ;
00122       //
00123       // <CR>
00124       //
00125       discard_ch = this->get() ;
00126       assert( discard_ch == CR ) ;
00127       //
00128       // <LF>
00129       //
00130       discard_ch = this->get() ;
00131       assert( discard_ch == LF ) ;
00132     }
00133   } // namespace LibGPIB
00134 } // extern "C++"
00135 
00136 #endif /* GPIB_232_CT_A_h */

Generated at Tue Aug 8 01:37:55 2000 for libgpib by doxygen1.1.4 written by Dimitri van Heesch, © 1997-2000