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

ATInstrument Class Reference

#include <at_instrument.h>

Inheritance diagram for ATInstrument:

Instrument List of all members.

Detailed Description

This class represents an electronic instrument controlled by an AT Dataset.

Author:
Simon Hoyle
Date:
August 2005
Version:
1.0

Definition at line 22 of file at_instrument.h.

Public Types

typedef std::vector< ControlPoint * > ControlPointVect
enum  Dataset_t { STD, F83, F93 }
 Enum constants for Dataset types.
typedef std::vector< Instrument * > InstrumentVect
typedef std::vector< MonitorPoint * > MonitorPointVect
enum  State { IDLE, OFFLINE, ONLINE }
 Enum constants for the Instrument state.

Public Member Functions

void add (Instrument *sub)
 Adds a sub-instrument.
void add (DumpServer *ds)
 Adds a DumpServer.
void add (CmdServer *cs)
 Adds a command server.
void add (ControlPoint *cp)
 Adds a ControlPoint.
void add (MonitorPoint *mp)
 Adds a MonitorPoint.
 ATInstrument (const char *id, const char *name, const char *dbFilename)
 Constructor.
CmdServergetCmdServer ()
 Retrieves the CommandServer.
ControlPointgetControlPoint (const char *id)
 Retrieves a ControlPoint.
const char * getID ()
 Retrieves the short identifier.
MonitorPointgetMonitorPoint (const char *id)
 Retrieves a MonitorPoint.
State getState ()
 Retrieves the current state.
bool hasControlPoint (const char *id)
 Tests for the presence of a ControlPoint.
bool hasMonitorPoint (const char *id)
 Tests for the presence of a MonitorPoint.
int init ()
 Initialiser.
void printState ()
 Writes a string equivalent of the current state to stdout.
virtual const char * read (const char *monitorPointID)
 Reads a MonitorPoint.
void setCheckPoint (MonitorPoint *checkPt)
 Assigns a check point.
void setDebug (bool onOff)
 Enables/disables printing of debug statements for a single object.
void setEnabled (bool onOff)
 Enables/disables the Instrument.
void startMonitorThread ()
 Starts the monitor thread.
void stopMonitorThread ()
 Stops the monitor thread.
virtual const char * write (const char *controlPointID, const char *val)
 Writes to a ControlPoint.

Static Public Member Functions

static void blockOn ()
 Blocks the calling thread indefinitely.
static const char * getUT ()
 Retrieves Universal Coordinated Time.
static void setDebugAll (bool onOff)
 Enables/disables printing of debug statements for the class.

Protected Member Functions

virtual State checkState ()
 Checks the state of the instrument by reading the check point.
virtual int fiveSecRead (char *buf)
 Reads all MonitorPoints in the five second list.
int getAltDsBusNum ()
 Retrieves the alternate dataset bus number.
DatasetgetDataset ()
 Retrieves the dataset.
int getDsBusNum ()
 Retrieves the default dataset bus number.
virtual void onPowerUp ()
 Performs any actions necessary when the instrument comes ONLINE.
void prependMonitorPointIDs (const char *str)
virtual int tenSecRead (char *buf)
 Reads all MonitorPoints in the ten second list.
virtual int thirtySecRead (char *buf)
 Reads all MonitorPoints in the thirty second list.
void updateMonitor (const char *dataStr)

Static Protected Member Functions

static const char * force (void *obj, int argc, char **argv)
 Standard command added to the CmdServer.
static const char * get (void *obj, int argc, char **argv)
 Standard command added to the CmdServer.
static const char * help (void *obj, int argc, char **argv)
 Standard command added to the CmdServer.
static void * monitorThread (void *arg)
 Monitor thread.
static const char * set (void *obj, int argc, char **argv)
 Standard command added to the CmdServer.

Protected Attributes

ControlPointVect allControlPoints
MonitorPointVect allMonitorPoints
MonitorPointcheckPt
CmdServercmdServer
 The command server.
DumpServerdumpServer
char endStr [50]
MonitorPointVect fiveSecPoints
const char * id
 The short identifier.
InstrumentVect::const_iterator iit
char monitorPage [8000]
pthread_mutex_t monitorPageMutex
pthread_t monitorThreadID
bool moreToDo
const char * name
 The long identifier.
MonitorPointVect onceOnlyPoints
char startStr [50]
PseudoMonitorPointstat
State state
InstrumentVect subInstruments
MonitorPointVect tenSecPoints
MonitorPointVect thirtySecPoints
char updateEndStr [50]
char updateStartStr [50]


Constructor & Destructor Documentation

ATInstrument::ATInstrument const char *  id,
const char *  name,
const char *  dbFilename
 

Constructor.

Parameters:
id A short identifier.
name The full name.
dbFilename Database file name with full path.

Definition at line 23 of file at_instrument.cc.


Member Function Documentation

void Instrument::add DumpServer ds  )  [inherited]
 

Adds a DumpServer.

Parameters:
ds The DumpServer to add.

Definition at line 360 of file instrument.cc.

References Instrument::dumpServer.

void Instrument::add CmdServer cs  )  [inherited]
 

Adds a command server.

Parameters:
cs The CmdServer to add.

Definition at line 352 of file instrument.cc.

References CmdServer::addCtlCmd(), CmdServer::addMonCmd(), Instrument::cmdServer, Instrument::get(), Instrument::help(), and Instrument::set().

void Instrument::add ControlPoint cp  )  [inherited]
 

Adds a ControlPoint.

Parameters:
cp The ControlPoint to add.

Definition at line 347 of file instrument.cc.

References Instrument::allControlPoints.

void Instrument::add MonitorPoint mp  )  [inherited]
 

Adds a MonitorPoint.

Parameters:
mp The MonitorPoint to add.

Definition at line 328 of file instrument.cc.

References Instrument::allMonitorPoints, Instrument::fiveSecPoints, MonitorPoint::getInterval(), Instrument::onceOnlyPoints, Instrument::tenSecPoints, and Instrument::thirtySecPoints.

Referenced by init().

Instrument::State Instrument::checkState  )  [protected, virtual, inherited]
 

Checks the state of the instrument by reading the check point.

Returns:
The current state.

Reimplemented in PseudoInstrument.

Definition at line 64 of file instrument.cc.

References Instrument::allMonitorPoints, Instrument::checkPt, Instrument::checkState(), MonitorPoint::getCommsDev(), MonitorPoint::getState(), Instrument::iit, MonitorPoint::initComms(), Instrument::onPowerUp(), Instrument::state, and Instrument::subInstruments.

Referenced by Instrument::checkState(), and Instrument::monitorThread().

CmdServer * Instrument::getCmdServer  )  [inherited]
 

Retrieves the CommandServer.

Returns:
A pointer to the CommandServer.

Definition at line 639 of file instrument.cc.

References Instrument::cmdServer.

ControlPoint * Instrument::getControlPoint const char *  id  )  [inherited]
 

Retrieves a ControlPoint.

Parameters:
id The short id of the ControlPoint.
Returns:
A pointer to the ControlPoint.

Definition at line 400 of file instrument.cc.

References Instrument::allControlPoints, Instrument::getControlPoint(), ControlPoint::hasID(), Instrument::iit, and Instrument::subInstruments.

Referenced by Instrument::getControlPoint(), Instrument::read(), and Instrument::write().

Dataset * ATInstrument::getDataset  )  [protected]
 

Retrieves the dataset.

Returns:
A pointer to the dataset.

Definition at line 105 of file at_instrument.cc.

MonitorPoint * Instrument::getMonitorPoint const char *  id  )  [inherited]
 

Retrieves a MonitorPoint.

Parameters:
id The short id of the MonitorPoint.
Returns:
A pointer to the MonitorPoint.

Definition at line 375 of file instrument.cc.

References Instrument::allMonitorPoints, Instrument::getMonitorPoint(), MonitorPoint::hasID(), Instrument::iit, and Instrument::subInstruments.

Referenced by Instrument::add(), Instrument::getMonitorPoint(), and Instrument::read().

Instrument::State Instrument::getState  )  [inherited]
 

Retrieves the current state.

See also:
State.

Definition at line 629 of file instrument.cc.

References Instrument::state.

bool Instrument::hasControlPoint const char *  id  )  [inherited]
 

Tests for the presence of a ControlPoint.

Parameters:
id The short id of the ControlPoint.

Definition at line 449 of file instrument.cc.

References Instrument::allControlPoints, Instrument::hasControlPoint(), ControlPoint::hasID(), Instrument::iit, and Instrument::subInstruments.

Referenced by Instrument::hasControlPoint().

bool Instrument::hasMonitorPoint const char *  id  )  [inherited]
 

Tests for the presence of a MonitorPoint.

Parameters:
id The short id of the MonitorPoint.

Definition at line 425 of file instrument.cc.

References Instrument::allControlPoints, Instrument::allMonitorPoints, MonitorPoint::hasID(), Instrument::hasMonitorPoint(), Instrument::iit, and Instrument::subInstruments.

Referenced by Instrument::hasMonitorPoint().

int ATInstrument::init  ) 
 

Initialiser.

Must be called before any other ATInstrument methods, except of course, the constructor.

Reimplemented from Instrument.

Definition at line 30 of file at_instrument.cc.

References Instrument::add(), MonitorPoint::init(), Instrument::init(), Instrument::setCheckPoint(), and Dataset::setF93AnalogScaling().

void * Instrument::monitorThread void *  arg  )  [static, protected, inherited]
 

Monitor thread.

Reads MonitorPoints and passes the data to the DumpServer. Must be static to conform to signature specified by Posix Threads.

Parameters:
arg Pointer to the Instrument object.

Definition at line 244 of file instrument.cc.

References Instrument::checkState(), Instrument::debug, Instrument::dumpServer, Instrument::endStr, Instrument::fiveSecRead(), Instrument::id, Instrument::monitorPage, Instrument::monitorPageMutex, Instrument::moreToDo, DumpServer::send(), Instrument::startStr, Instrument::state, Instrument::tenSecRead(), and Instrument::thirtySecRead().

Referenced by Instrument::startMonitorThread().

virtual void Instrument::onPowerUp  )  [inline, protected, virtual, inherited]
 

Performs any actions necessary when the instrument comes ONLINE.

Called automatically by method checkState. This method is a NOP in this class. It should be implemented to suit a particular instrument in the inheriting class.

See also:
checkState.

Definition at line 224 of file instrument.h.

Referenced by Instrument::checkState().

void Instrument::printState  )  [inherited]
 

Writes a string equivalent of the current state to stdout.

See also:
State.

Definition at line 667 of file instrument.cc.

References Instrument::state.

const char * Instrument::read const char *  monitorPointID  )  [virtual, inherited]
 

Reads a MonitorPoint.

Parameters:
monitorPointID The short id of the MonitorPoint.
Returns:
The MonitorPoint data.

Definition at line 473 of file instrument.cc.

References Instrument::allControlPoints, Instrument::allMonitorPoints, Instrument::getControlPoint(), Instrument::getMonitorPoint(), Instrument::iit, MonitorPoint::read(), ControlPoint::read(), and Instrument::subInstruments.

Referenced by Instrument::get().

void Instrument::setCheckPoint MonitorPoint checkPt  )  [inherited]
 

Assigns a check point.

A check point is a MonitorPoint that is used to determine if the instrument is ONLINE. When the instrument is OFFLINE, a single successful read of the check point places it in an ONLINE state. The check point is read automatically by the monitor thread.

Parameters:
checkPt The check point to assign.
See also:
monitorThread

Definition at line 553 of file instrument.cc.

Referenced by init().

const char * Instrument::write const char *  controlPointID,
const char *  val
[virtual, inherited]
 

Writes to a ControlPoint.

Parameters:
controlPointID The short id of the ControlPoint.
val The value to write.

Definition at line 504 of file instrument.cc.

References Instrument::getControlPoint(), ControlPoint::getUpdate(), ControlPoint::hasUpdate(), Instrument::updateMonitor(), and ControlPoint::write().

Referenced by Instrument::set().


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