Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

SerialCommsDevice Class Reference

Inheritance diagram for SerialCommsDevice:

CommsDevice List of all members.

Detailed Description

Definition at line 25 of file serial_comms_device.h.

Public Types

enum  { NONE, ODD, EVEN }
enum  { VERY_SHORT_TIMEOUT = 100000, SHORT_TIMEOUT = 200000, LONG_TIMEOUT = 500000, VERY_LONG_TIMEOUT = 999990 }
enum  State { IDLE, OFFLINE, ONLINE }
 Device state.

Public Member Functions

virtual void clear ()
 Clears the CommsDevice and/or its communications bus.
void clear (int portNum)
void clearInput (int portNum)
void clearOutput (int portNum)
void close (int portNum)
virtual int cmd (int addr, int val)
 Send a command request.
int comRd (int portNum, char *rdBuf, int nBytes, int timeOut)
int comRdAll (int portNum, char *rdBuf, int limit, int timeOut)
int comWrt (int portNum, char *rdBuf, int nBytes, int timeOut)
const char * getErrMsg (int code)
 Convert an error code to an error message.
const char * getID ()
 Retrieve the identifier.
State getState ()
 Retrieve the current state.
virtual int init (int addr)
 Initialiser.
void lock (int portNum)
virtual int mon (int addr, float *volts)
 Send a monitor request.
virtual int mon (int addr, int *val, int timeOut)
 Send a monitor request.
virtual int mon (int addr, int *val)
 Send a monitor request.
int open (int portNum, speed_t baud=B38400, int parity=ODD, int dataBits=8, int stopBits=1)
 SerialCommsDevice (const char *id)
 Constructor.
void setDebug (bool onOff)
void unlock (int portNum)

Static Public Member Functions

static const char * getUT ()
 Read the current Universal Coordinated Time.
static void setDebugAll (bool onOff)
 A method to enable/disable printing of debug statements for a single object.

Protected Member Functions

void clearTimeoutErr ()
void flagTimeoutErr ()
 Flag a timeout.

Protected Attributes

const char * id
 Short identifier.
State state
 Current instrument state.

Static Protected Attributes

static SerialPortAccessData spDat [8]

Classes

struct  SerialPortAccessData
 A method to enable/disable printing of debug statements for the class. More...


Member Function Documentation

virtual void CommsDevice::clear  )  [inline, virtual, inherited]
 

Clears the CommsDevice and/or its communications bus.

Note:
Method is a no-op in this class.

Reimplemented in Dataset.

Definition at line 88 of file comms_device.h.

const char * SerialCommsDevice::getErrMsg int  code  )  [virtual]
 

Convert an error code to an error message.

Parameters:
code An error code returned by another method of this class.
Returns:
An error message.
Note:
Method is pure virtual.

Implements CommsDevice.

Definition at line 214 of file serial_comms_device.cc.

const char * CommsDevice::getUT  )  [inline, static, inherited]
 

Read the current Universal Coordinated Time.

Returns:
UTC in "HH:MM:SS" format.

Definition at line 136 of file comms_device.h.

Referenced by PseudoMonitorPoint::read(), and PseudoControlPoint::write().

virtual int CommsDevice::init int  addr  )  [inline, virtual, inherited]
 

Initialiser.

Must be called before other methods.

Parameters:
addr An address that can be read to determine instrument state.
Returns:
Zero for success, negative for error, positive for a warning.
Note:
Method is a no-op in this class.

Reimplemented in Dataset.

Definition at line 41 of file comms_device.h.

Referenced by MonitorPoint::initComms().

virtual int CommsDevice::mon int  addr,
float *  volts
[inline, virtual, inherited]
 

Send a monitor request.

Reads analog data.

Parameters:
addr The address to read.
volts Location to store the value read.
Returns:
Zero for success, negative for error, positive for a warning.
Note:
Method is a no-op in this class.

Reimplemented in Dataset.

Definition at line 82 of file comms_device.h.

virtual int CommsDevice::mon int  addr,
int *  val,
int  timeOut
[inline, virtual, inherited]
 

Send a monitor request.

Reads digital data or an instrument parameter.

Parameters:
addr The address to read.
val Location to store the value read.
timeOut Timeout value in microseconds.
Returns:
Zero for success, negative for error, positive for a warning.
Note:
Method is a no-op in this class.

Reimplemented in Dataset.

Definition at line 72 of file comms_device.h.

virtual int CommsDevice::mon int  addr,
int *  val
[inline, virtual, inherited]
 

Send a monitor request.

Reads digital data or an instrument parameter.

Parameters:
addr The address to read.
val Location to store the value read.
Returns:
Zero for success, negative for error, positive for a warning.
Note:
Method is a no-op in this class.

Reimplemented in Dataset.

Definition at line 61 of file comms_device.h.

Referenced by MonitorRegister::read(), and MonitorPoint::read().


The documentation for this class was generated from the following files:
Generated on Mon Apr 30 13:32:47 2007 for Parkes M & C - PKMC C++ library API by  doxygen 1.4.4