nidas  v1.2-1520
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | List of all members
Csat3Sim Class Reference

Simulate a CSAT3 sonic. More...

Inheritance diagram for Csat3Sim:
Inheritance graph
[legend]

Public Member Functions

 Csat3Sim (n_u::SerialPort *p, float rate, int nmessages)
 
void run () throw (n_u::Exception)
 Default implementation of run will call the sendMessage() method either after receipt of a prompt or at the given rate if the sensor is not prompted. More...
 
void sendMessage () throw (n_u::IOException)
 Implement this to send a message from the simulated sensor. More...
 
virtual void writeMessage (const std::string &msg) throw (n_u::IOException)
 Subclasses generate the message to send, then call writeMessage() to send it out. More...
 
virtual void writeMessage (const char *buf, std::streamsize l) throw (n_u::IOException)
 overloaded function useful for writing binary data More...
 
void interrupt ()
 Stop the simulation. More...
 
bool isInterrupted () const
 
n_u::SerialPortport ()
 

Protected Member Functions

LoopergetLooper ()
 
void looperNotify () throw ()
 Method called by Looper. More...
 
void readPrompts () throw (n_u::IOException)
 

Protected Attributes

n_u::SerialPort_port
 
bool _prompted
 
string _prompt
 
float _rate
 
int _nmessages
 
bool _interrupted
 

Static Protected Attributes

static Looper_looper = 0
 

Private Attributes

int _cntr
 

Detailed Description

Simulate a CSAT3 sonic.

Constructor & Destructor Documentation

Csat3Sim::Csat3Sim ( n_u::SerialPort p,
float  rate,
int  nmessages 
)
inline

Member Function Documentation

Looper * SensorSimulator::getLooper ( )
protectedinherited
void SensorSimulator::interrupt ( )
inlineinherited

Stop the simulation.

Referenced by FileSim::sendASCIIMessage(), and FileSim::sendBinaryMessage().

bool SensorSimulator::isInterrupted ( ) const
inlineinherited
void SensorSimulator::looperNotify ( )
throw (
)
protectedvirtualinherited

Method called by Looper.

This method should not be a heavy user of resources, since the notification of other clients is delayed until this method finishes. If much work is to be done, this method should post a semaphore for another worker thread to proceed.

Implements nidas::core::LooperClient.

References nidas::util::Exception::what().

n_u::SerialPort* SensorSimulator::port ( )
inlineinherited
void SensorSimulator::readPrompts ( )
throw (n_u::IOException
)
protectedinherited
void Csat3Sim::run ( )
throw (n_u::Exception
)
virtual

Default implementation of run will call the sendMessage() method either after receipt of a prompt or at the given rate if the sensor is not prompted.

run() will return when isInterrupted() is true.

Reimplemented from SensorSimulator.

References SensorSimulator::_nmessages, SensorSimulator::_port, SensorSimulator::_rate, nidas::util::SerialPort::getFd(), nidas::util::SerialPort::getName(), nidas::util::SerialPort::read(), running, FileSim::sendMessage(), USECS_PER_SEC, and nidas::util::SerialPort::write().

void Csat3Sim::sendMessage ( )
throw (n_u::IOException
)
virtual

Implement this to send a message from the simulated sensor.

Implements SensorSimulator.

References SensorSimulator::_port, len, and nidas::util::SerialPort::write().

virtual void SensorSimulator::writeMessage ( const std::string &  msg)
throw (n_u::IOException
)
inlinevirtualinherited

Subclasses generate the message to send, then call writeMessage() to send it out.

Referenced by FileSim::sendASCIIMessage(), FileSim::sendBinaryMessage(), and FixedSim::sendMessage().

virtual void SensorSimulator::writeMessage ( const char *  buf,
std::streamsize  l 
)
throw (n_u::IOException
)
inlinevirtualinherited

overloaded function useful for writing binary data

Member Data Documentation

int Csat3Sim::_cntr
private
bool SensorSimulator::_interrupted
protectedinherited
Looper * SensorSimulator::_looper = 0
staticprotectedinherited
int SensorSimulator::_nmessages
protectedinherited

Referenced by run().

n_u::SerialPort* SensorSimulator::_port
protectedinherited

Referenced by run(), and sendMessage().

string SensorSimulator::_prompt
protectedinherited
bool SensorSimulator::_prompted
protectedinherited
float SensorSimulator::_rate
protectedinherited

Referenced by run().


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