My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
gcp::util::GpibUsbController Class Reference
Inheritance diagram for gcp::util::GpibUsbController:
gcp::util::SerialClient gcp::util::SpawnableTask< GpibUsbControllerMsg > gcp::util::Port gcp::util::GenericTask< GpibUsbControllerMsg > gcp::util::RunnableTask gcp::util::Runnable

Public Types

enum  Mode { MODE_CONTROLLER = 0, MODE_DEVICE = 1 }
 
enum  { EOS_CRLF = 0, EOS_CR = 1, EOS_LF = 2, EOS_NONE = 3 }
 

Public Member Functions

 GpibUsbController (bool doSpawn=false)
 
 GpibUsbController (std::string port, bool doSpawn=false)
 
virtual ~GpibUsbController ()
 
void stop ()
 
int connect ()
 
int connectAndClear ()
 
void setAuto (bool doAuto)
 
void setMode (Mode mode)
 
virtual void setAddress (unsigned address)
 
virtual unsigned getAddress ()
 
void setEoi (bool sendEoi)
 
std::string getEoi ()
 
std::string getVersion ()
 
std::string getHelp ()
 
void setEos (unsigned)
 
std::string getEos ()
 
void clearInterface ()
 
void resetController ()
 
void enableEot (bool enable)
 
void setEotChar (char eot)
 
std::string getDevice ()
 
void resetDevice ()
 
void clearDevice ()
 
void clearDeviceInterface ()
 
std::string getSelfTest ()
 
void wait ()
 
- Public Member Functions inherited from gcp::util::SerialClient
 SerialClient (std::string port="/dev/ttyS0", int baudRate=9600, bool canonical=false, bool sevenBit=false)
 
virtual ~SerialClient ()
 
void setPort (std::string port)
 
void setBaudRate (int baudRate)
 
int connect ()
 
void disconnect ()
 
std::string portName ()
 
void setFd (int fd)
 
- Public Member Functions inherited from gcp::util::Port
 Port (int fd=-1)
 
virtual ~Port ()
 
int getFd ()
 
void writeString (std::string &message, int fd=-1)
 
void writeBytes (Vector< unsigned char > &buffer)
 
unsigned int readBytes (unsigned char *message, int fd=-1)
 
unsigned int readBytes (Vector< unsigned char > &buffer)
 
unsigned char getNextByte ()
 
std::string readString (int fd=-1)
 
bool concatenateString (std::ostringstream &os, int fd=-1, bool cont=true)
 
void concatenateChar (std::ostringstream &os, int fd=-1)
 
int getNbyte (int fd=-1)
 
void terminateAt (std::string strip)
 
void strip (std::string strip)
 
void dontStrip (std::string strip)
 
void stripUnprintable (bool strip)
 
void append (std::string append)
 
void setNoBuf ()
 
void setLineBuf ()
 
- Public Member Functions inherited from gcp::util::SpawnableTask< GpibUsbControllerMsg >
 SpawnableTask (bool spawn)
 
virtual ~SpawnableTask ()
 
- Public Member Functions inherited from gcp::util::GenericTask< GpibUsbControllerMsg >
void sendRestartMsg ()
 
void sendStopMsg ()
 
void sendHeartBeatMsg ()
 
virtual void fwdTaskMsg (GpibUsbControllerMsg *msg)
 
- Public Member Functions inherited from gcp::util::RunnableTask
 RunnableTask (bool spawnThread)
 
virtual ~RunnableTask ()
 
- Public Member Functions inherited from gcp::util::Runnable
 Runnable (bool spawnThread, RUN_FN(*runFn))
 
 Runnable (bool spawnThread, RUN_FN(*runFn), int priority)
 
virtual ~Runnable ()
 
void blockForever ()
 
void spawn ()
 

Static Public Member Functions

static GPIB_RESPONSE_HANDLER (checkString)
 
- Static Public Member Functions inherited from gcp::util::Port
static void writeBytes (Vector< unsigned char > &buffer, int fd)
 
- Static Public Member Functions inherited from gcp::util::RunnableTask
static RUN_FN (runFn)
 
- Static Public Member Functions inherited from gcp::util::Runnable
static THREAD_START (startUp)
 

Public Attributes

std::ostringstream response_
 
void * retVal_
 

Protected Types

enum  Receiver { DEVICE = 0, CONTROLLER = 1 }
 

Protected Member Functions

void initialize (bool doSpawn)
 
void serviceMsgQ (void)
 
void processMsg (GpibUsbControllerMsg *msg)
 
void suspendProcessingMessages (bool suspend)
 
void watchForResponse (bool watch)
 
void respondToTimeOut ()
 
void readResponse ()
 
void respondToUnexpectedInput ()
 
void sendDeviceCommand (std::string cmd, bool expectsResponse=false, GPIB_RESPONSE_HANDLER(*handler)=0, bool block=false, void *retVal=0)
 
void sendControllerCommand (std::string cmd, bool expectsResponse=false, GPIB_RESPONSE_HANDLER(*handler)=0, bool block=false, void *retVal=0)
 
virtual void sendCommand (std::string cmd, Receiver rx, bool expectsResponse=false, GPIB_RESPONSE_HANDLER(*handler)=0, bool block=false, void *retVal=0)
 
void executeCommand (std::string cmd, bool expectsResponse, GPIB_RESPONSE_HANDLER(*handler), CondVar *condVar, void *retVal)
 
void executeConnect (void *retVal)
 
- Protected Member Functions inherited from gcp::util::SpawnableTask< GpibUsbControllerMsg >
void run ()
 
- Protected Member Functions inherited from gcp::util::GenericTask< GpibUsbControllerMsg >
 GenericTask ()
 
 GenericTask (Thread *thread)
 
virtual ~GenericTask ()
 
void sendTaskMsg (GpibUsbControllerMsg *msg)
 
void startThreads (void *arg)
 
void startThread (void *arg, unsigned order)
 
unsigned getMinStartOrder ()
 
bool threadsNeedStarting ()
 
void cancelThreads ()
 
void cancelThread (unsigned order)
 
unsigned getMinCancelOrder ()
 
bool threadsNeedCancelling ()
 
void pingThreads (void *arg)
 
void raise (std::string name, int sigNo)
 
ThreadgetThread (std::string name)
 
bool threadsAreRunning ()
 
void shutdownConnection (int fd)
 
virtual void restart (void)
 
virtual void processTaskMsg (bool *stop)
 
virtual void respondToHeartBeat ()
 
virtual void installTimer (GpibUsbControllerMsg *msg)
 
virtual void installSignal (GpibUsbControllerMsg *msg)
 
virtual void enableTimer (GpibUsbControllerMsg *msg)
 
virtual void addHandler (GpibUsbControllerMsg *msg)
 
void stepCommands ()
 
- Protected Member Functions inherited from gcp::util::Runnable
virtual void broadcastReady ()
 
void spawn (void *arg)
 

Static Protected Member Functions

static GPIB_RESPONSE_HANDLER (checkHandler)
 
static GPIB_RESPONSE_HANDLER (checkAddress)
 
static GPIB_RESPONSE_HANDLER (checkDevice)
 
static GPIB_RESPONSE_HANDLER (checkCompletion)
 

Protected Attributes

TimeOut cmdTimeOut_
 
std::string devName_
 
std::string lastCmd_
 
bool expectingResponse_
 
GPIB_RESPONSE_HANDLER * responseHandler_
 
CondVarcondVar_
 
bool eotEnabled_
 
- Protected Attributes inherited from gcp::util::Port
int fd_
 
- Protected Attributes inherited from gcp::util::GenericTask< GpibUsbControllerMsg >
Threadthread_
 
std::vector< Thread * > threads_
 
PipeQ< GpibUsbControllerMsgmsgq_
 
gcp::util::FdSet fdSet_
 
std::vector< Command * > commands_
 
struct timeval * timeOut_
 
TimeVal commandTimeOut_
 
- Protected Attributes inherited from gcp::util::Runnable
ThreadspawnedThread_
 
bool spawned_
 
RUN_FN * runFn_
 

Friends

class GpibUsbDevice
 

Additional Inherited Members

- Static Public Attributes inherited from gcp::util::Port
static const unsigned int MAX_RCV_BUFFER = 300
 
static const unsigned TELNET_PORT_NO = 23
 

Constructor & Destructor Documentation

GpibUsbController::GpibUsbController ( bool  doSpawn = false)

....................................................................... Constructor.

GpibUsbController::GpibUsbController ( std::string  port,
bool  doSpawn = false 
)

....................................................................... Constructor.

GpibUsbController::~GpibUsbController ( )
virtual

....................................................................... Destructor.

Member Function Documentation

void GpibUsbController::clearInterface ( )

....................................................................... Clear the interfacae

int GpibUsbController::connect ( )
virtual

....................................................................... Send a message to connect to the serial port

Reimplemented from gcp::util::Port.

int GpibUsbController::connectAndClear ( )

....................................................................... Connect to the controller, and send a message to clear the interface

void GpibUsbController::executeCommand ( std::string  cmd,
bool  expectsResponse,
GPIB_RESPONSE_HANDLER *  handler,
CondVar condVar,
void *  retVal 
)
protected

....................................................................... Execute a command

void GpibUsbController::executeConnect ( void *  retVal)
protected

....................................................................... Open the psuedo-serial port

unsigned GpibUsbController::getAddress ( )
virtual

....................................................................... Get the GPIB address of the controller

std::string GpibUsbController::getDevice ( )

....................................................................... Get the device identification string

std::string GpibUsbController::getEoi ( )

....................................................................... Get the EOI state from the controller

std::string GpibUsbController::getEos ( )

....................................................................... Get the EOS state from the controller

std::string GpibUsbController::getHelp ( )

....................................................................... Get the help string from the controller

std::string GpibUsbController::getSelfTest ( )

....................................................................... Query the status of a self test

std::string GpibUsbController::getVersion ( )

....................................................................... Get the version string from the controller

void GpibUsbController::processMsg ( GpibUsbControllerMsg msg)
protectedvirtual

....................................................................... Main Task event loop: when this is called, the task blocks forever in select(), or until a stop message is received.

Reimplemented from gcp::util::SpawnableTask< GpibUsbControllerMsg >.

void GpibUsbController::readResponse ( )
protected

....................................................................... Read/continue reading a response

void GpibUsbController::resetController ( )

....................................................................... Reset the controller

void GpibUsbController::respondToTimeOut ( )
protected

....................................................................... Respond to a timeout while waiting for a response

void GpibUsbController::respondToUnexpectedInput ( )
protected

....................................................................... Respond to unexpected input from the controller

void GpibUsbController::sendCommand ( std::string  cmd,
Receiver  rx,
bool  expectsResponse = false,
GPIB_RESPONSE_HANDLER *  handler = 0,
bool  block = false,
void *  retVal = 0 
)
protectedvirtual

....................................................................... Send a command

void GpibUsbController::sendControllerCommand ( std::string  cmd,
bool  expectsResponse = false,
GPIB_RESPONSE_HANDLER *  handler = 0,
bool  block = false,
void *  retVal = 0 
)
protected

....................................................................... Send a controller command

void GpibUsbController::sendDeviceCommand ( std::string  cmd,
bool  expectsResponse = false,
GPIB_RESPONSE_HANDLER *  handler = 0,
bool  block = false,
void *  retVal = 0 
)
protected

....................................................................... Send a device command

void GpibUsbController::serviceMsgQ ( void  )
protectedvirtual

....................................................................... Main Task event loop: when this is called, the task blocks forever in select(), or until a stop message is received.

Reimplemented from gcp::util::GenericTask< GpibUsbControllerMsg >.

void GpibUsbController::setAddress ( unsigned  address)
virtual

........................................................................ Set the GPIB address of the controller device

void GpibUsbController::setAuto ( bool  doAuto)

....................................................................... Set the GPIB controller mode to automatically listen for a response from the GPIB device

void GpibUsbController::suspendProcessingMessages ( bool  suspend)
protected

....................................................................... Suspend or resume processing messages

void GpibUsbController::wait ( )

....................................................................... Issue GPIB WAIT command

void GpibUsbController::watchForResponse ( bool  watch)
protected

....................................................................... Watch the serial port for a response, and set a timeout


The documentation for this class was generated from the following files: