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

LibGPIB::GPIBController Class Reference

The GPIBController class provides routines to access GPIB controllers. Abstract class for accessing GPIB controllers. More...

#include <GPIBController.h>

Inheritance diagram for LibGPIB::GPIBController:

LibGPIB::iostream LibGPIB::GPIB_232_CT_A List of all members.

Public Types

Typedefs
typedef GPIBEquipmentGPIBEquipmentPtr
typedef list<GPIBEquipmentPtrGPIBEquipmentList
typedef GPIBEquipmentList::iterator GPIBEquipmentListIterator
typedef GPIBEquipmentList::const_iterator GPIBEquipmentListConstIterator
Enumerations
enum  EOSModeVal {
  EOS_TERM_READ = (1<<2),
  EOS_WRITE_EOI = (1<<3),
  EOS_EIGHT_BIT = (1<<4)
}
 All possible EOS modes for a GPIB controller. More...


Public Methods

Constructors and Destructor
 GPIBController ()
 The default constructor. More...

virtual ~GPIBController () = 0
 The default destructor. More...

Other Public Methods
void Open () = 0
 Open the specified GPIBController as a stream. More...

void Close () = 0
 Close the specified GPIBController stream. More...

virtual void BecomeActiveController (bool synchronously=true) = 0
 Become the active controller of the bus. More...

virtual void ClearDevice (GPIBEquipment &device) = 0
 Send a clear signal to a specific device. More...

virtual void SendCommand (GPIBEquipment &device, const string command) = 0
 Send the specified string to a given device. More...

virtual const string ReadData (GPIBEquipment &device, const int read_bytes) = 0
 Read data from the specified device. More...

virtual void SetLocal (GPIBEquipment &device) = 0
 Set the device in local mode. More...

virtual void SetEOSModeAndChar (const EOSModeVal mode, const char eos) = 0
 Set the EOS mode and character for the specified controller. More...

const EOSModeVal SetEOSMode (const EOSModeVal mode)
 Set the EOS mode for the controller. More...

const EOSModeVal EOSMode () const
 Get the EOS mode for the controller. More...

const char SetEOSChar (const char eos)
 Set the EOS character for the controller. More...

const char EOSChar () const
 Get the current EOS character for the controller. More...

void ConnectDevice (GPIBEquipment& device)
 Connect a specified GPIB equipment to this controller. More...

void DisconnectDevice (GPIBEquipment& device)
 Disconnect the specified device from the controller.

void DisconnectAllDevices ()
 Disconnect all device which are currently connected to this controller.


Public Attributes

friend GPIBEquipmentBuffer
 The GPIBEquipmentBuffer needs to access the Prefix and Postfix methods which are best put in the protected interface of this class.


Static Public Attributes

const char CR = 13
 The ASCII carriage return character.

const char LF = 10
 The ASCII linefeed character.


Protected Methods

virtual ostream& SendCharPrefix ( const int primary_address, const int secondary_address=0 ) = 0
 A manipulator called before sending a character to a GPIBEquipment.

virtual ostream& SendCharPostfix ( const int primary_address, const int secondary_address=0 ) = 0
 A manipulator called after sending a character to a GPIBEquipment.

virtual ostream& ReadCharPrefix ( const int primary_address, const int secondary_address=0 ) = 0
 A manipulator called before reading a character from a GPIBEquipment.

virtual ostream& ReadCharPostfix ( const int primary_address, const int secondary_address=0) = 0
 A manipulator called after reading a character from a GPIBEquipment.


Private Attributes

GPIBEquipmentList mDeviceList
 List of all the GPIB instruments which are connected to this controller.

int mIOTimeout
 The I/O timeout value.

int mEOIMode
 The EOI mode of the controller.

EOSModeVal mEOSMode
 The EOS mode of the controller. More...

char mEOSChar
 The EOS characters for the controller.


Detailed Description

The GPIBController class provides routines to access GPIB controllers. Abstract class for accessing GPIB controllers.

It provides most of the functionality that is included in the NI-488.2 library from National Instruments. However, the syntax is completely different. Furthermore, this is an abstract class which requires the user to provide routines customized for type of GPIB controller card that is being used (e.g. GPIB-232-CT-A, PCI-GPIB, AT-GPIB, PCMCIA-GPIB, PXI-GPIB, GPIB-ENET etc).

Author(s):
$Author: pagey $ , Jay Sachdev Jay Sachdev , Manish P. Pagey Manish P. Pagey
Version:
$Id: GPIBController.h,v 0.13 2000/08/08 02:38:50 pagey Exp $

Definition at line 35 of file GPIBController.h.


Member Typedef Documentation

typedef list<GPIBEquipmentPtr> LibGPIB::GPIBController::GPIBEquipmentList

Definition at line 41 of file GPIBController.h.

typedef GPIBEquipmentList::const_iterator LibGPIB::GPIBController::GPIBEquipmentListConstIterator

Definition at line 43 of file GPIBController.h.

typedef GPIBEquipmentList::iterator LibGPIB::GPIBController::GPIBEquipmentListIterator

Definition at line 42 of file GPIBController.h.

typedef GPIBEquipment* LibGPIB::GPIBController::GPIBEquipmentPtr

Definition at line 40 of file GPIBController.h.


Member Enumeration Documentation

enum LibGPIB::GPIBController::EOSModeVal

All possible EOS modes for a GPIB controller.

Enumeration values:
EOS_TERM_READ   Terminate read when EOS is detected.
EOS_WRITE_EOI   Send EOI with EOS on write.
EOS_EIGHT_BIT   Compare all 8 bits of EOS rather than 7.

Definition at line 66 of file GPIBController.h.


Constructor & Destructor Documentation

LibGPIB::GPIBController::GPIBController ( ) [inline]

The default constructor.

Sets values for some default parameters such as the EOSMode, EOSChar, EOIMode, and IOTimeout. The default values are:

EOS Mode EOS_TERM_READ
EOS Character '\n'
EOI Mode 0 (none)
IO Timeout 0 (none)

Definition at line 375 of file GPIBController.h.

LibGPIB::GPIBController::~GPIBController ( ) [inline, pure virtual]

The default destructor.

Disconnects all devices connected to the controller. The destructor is made pure virtual so that this class will be an abstract class.

Definition at line 385 of file GPIBController.h.


Member Function Documentation

void LibGPIB::GPIBController::BecomeActiveController ( bool synchronously = true ) [pure virtual]

Become the active controller of the bus.

Parameters:
synchronously   If true then the controller becomes the active controller synchronously. Otherwise, the controller takes over the bus immediately.

Reimplemented in LibGPIB::GPIB_232_CT_A.

void LibGPIB::GPIBController::ClearDevice ( GPIBEquipment & device ) [pure virtual]

Send a clear signal to a specific device.

Parameters:
device   The GPIB instrument to which the clear signal is to be sent.

Reimplemented in LibGPIB::GPIB_232_CT_A.

void LibGPIB::GPIBController::Close ( ) [pure virtual]

Close the specified GPIBController stream.

No communications can occur once the GPIBController stream is closed.

Reimplemented in LibGPIB::GPIB_232_CT_A.

void LibGPIB::GPIBController::ConnectDevice ( GPIBEquipment & device )

Connect a specified GPIB equipment to this controller.

Parameters:
device   This device will be connected to this controller.

void LibGPIB::GPIBController::DisconnectAllDevices ( )

Disconnect all device which are currently connected to this controller.

void LibGPIB::GPIBController::DisconnectDevice ( GPIBEquipment & device )

Disconnect the specified device from the controller.

const char LibGPIB::GPIBController::EOSChar ( ) const [inline]

Get the current EOS character for the controller.

Returns:
The current EOS character.

Definition at line 410 of file GPIBController.h.

const GPIBController::EOSModeVal LibGPIB::GPIBController::EOSMode ( ) const [inline]

Get the EOS mode for the controller.

Returns:
The current EOS mode value.

Definition at line 398 of file GPIBController.h.

void LibGPIB::GPIBController::Open ( ) [pure virtual]

Open the specified GPIBController as a stream.

This should be called after setting all the parameters of the GPIBController subclass which are essential to communicate with the controller. For example, in the case of the GPIB-232-CT-A box, the parameters of the serial port associated with the box should be set before calling this method.

Reimplemented in LibGPIB::GPIB_232_CT_A.

ostream & LibGPIB::GPIBController::ReadCharPostfix ( int primary_address,
int secondary_address = 0 ) [protected, pure virtual]

A manipulator called after reading a character from a GPIBEquipment.

Reimplemented in LibGPIB::GPIB_232_CT_A.

ostream & LibGPIB::GPIBController::ReadCharPrefix ( int primary_address,
int secondary_address = 0 ) [protected, pure virtual]

A manipulator called before reading a character from a GPIBEquipment.

Reimplemented in LibGPIB::GPIB_232_CT_A.

const string LibGPIB::GPIBController::ReadData ( GPIBEquipment & device,
int read_bytes ) [pure virtual]

Read data from the specified device.

Parameters:
device   The instrument from which data is to be read.

Returns:
The data read from the device as a string.

Reimplemented in LibGPIB::GPIB_232_CT_A.

ostream & LibGPIB::GPIBController::SendCharPostfix ( int primary_address,
int secondary_address = 0 ) [protected, pure virtual]

A manipulator called after sending a character to a GPIBEquipment.

Reimplemented in LibGPIB::GPIB_232_CT_A.

ostream & LibGPIB::GPIBController::SendCharPrefix ( int primary_address,
int secondary_address = 0 ) [protected, pure virtual]

A manipulator called before sending a character to a GPIBEquipment.

Reimplemented in LibGPIB::GPIB_232_CT_A.

void LibGPIB::GPIBController::SendCommand ( GPIBEquipment & device,
string command ) [pure virtual]

Send the specified string to a given device.

Parameters:
device   The device to which the command will be sent.
command   The command to be sent to the device.

Reimplemented in LibGPIB::GPIB_232_CT_A.

const char LibGPIB::GPIBController::SetEOSChar ( char eos ) [inline]

Set the EOS character for the controller.

Parameters:
eos   The EOS character will be set to this value.

Returns:
The EOS character before it is set to the specified value.

Definition at line 403 of file GPIBController.h.

const GPIBController::EOSModeVal LibGPIB::GPIBController::SetEOSMode ( EOSModeVal mode ) [inline]

Set the EOS mode for the controller.

Parameters:
mode   The EOS mode will be set to this value.

Returns:
The value of the EOS mode before setting it to the specified value.

Definition at line 391 of file GPIBController.h.

void LibGPIB::GPIBController::SetEOSModeAndChar ( EOSModeVal mode,
char eos ) [pure virtual]

Set the EOS mode and character for the specified controller.

Parameters:
mode   The EOS mode will be set to this value.
eos   The EOS character.

Reimplemented in LibGPIB::GPIB_232_CT_A.

void LibGPIB::GPIBController::SetLocal ( GPIBEquipment & device ) [pure virtual]

Set the device in local mode.

Parameters:
device   The instrument to be set in local mode.
read_bytes   The number of bytes to be read from the rd command

Reimplemented in LibGPIB::GPIB_232_CT_A.


Member Data Documentation

const char LibGPIB::GPIBController::CR = 13 [static]

The ASCII carriage return character.

Definition at line 53 of file GPIBController.h.

GPIBEquipmentBuffer

The GPIBEquipmentBuffer needs to access the Prefix and Postfix methods which are best put in the protected interface of this class.

Definition at line 292 of file GPIBController.h.

const char LibGPIB::GPIBController::LF = 10 [static]

The ASCII linefeed character.

Definition at line 58 of file GPIBController.h.

GPIBEquipmentList LibGPIB::GPIBController::mDeviceList [private]

List of all the GPIB instruments which are connected to this controller.

Definition at line 339 of file GPIBController.h.

int LibGPIB::GPIBController::mEOIMode [private]

The EOI mode of the controller.

Definition at line 349 of file GPIBController.h.

char LibGPIB::GPIBController::mEOSChar [private]

The EOS characters for the controller.

Definition at line 367 of file GPIBController.h.

EOSModeVal LibGPIB::GPIBController::mEOSMode [private]

The EOS mode of the controller.

If this is zero then the EOS configuration is disabled. The possible values of EOS mode are part of enum EOSModeVal. These are:

EOS_TERM_READ Terminate read when EOS is detected. EOS_WRITE_EOI Send EOI with EOS on write. EOS_EIGHT_BIT Compare all 8 bits of EOS rather than 7.

These values can be ORed together to select the actual EOS mode.

Definition at line 362 of file GPIBController.h.

int LibGPIB::GPIBController::mIOTimeout [private]

The I/O timeout value.

Definition at line 344 of file GPIBController.h.


The documentation for this class was generated from the following file:
Generated at Tue Aug 8 01:37:56 2000 for libgpib by doxygen1.1.4 written by Dimitri van Heesch, © 1997-2000