nidas
v1.2-1520
|
Base class for sensor simulators. More...
Public Member Functions | |
SensorSimulator (n_u::SerialPort *p, bool prompted, string prompt, float rate, int nmessages) | |
virtual void | sendMessage ()=0 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... | |
virtual 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 | interrupt () |
Stop the simulation. More... | |
bool | isInterrupted () const |
n_u::SerialPort * | port () |
Protected Member Functions | |
Looper * | getLooper () |
void | looperNotify () throw () |
Method called by Looper. More... | |
void | readPrompts () throw (n_u::IOException) |
SensorSimulator (const SensorSimulator &) | |
SensorSimulator & | operator= (const SensorSimulator &) |
Protected Attributes | |
n_u::SerialPort * | _port |
bool | _prompted |
string | _prompt |
float | _rate |
int | _nmessages |
bool | _interrupted |
Static Protected Attributes | |
static Looper * | _looper = 0 |
Base class for sensor simulators.
|
inline |
|
protected |
|
protected |
|
inline |
Stop the simulation.
Referenced by FileSim::sendASCIIMessage(), and FileSim::sendBinaryMessage().
|
inline |
|
protectedvirtual |
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().
|
protected |
|
inline |
|
protected |
|
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 in Csat3Sim.
References MSECS_PER_SEC.
|
pure virtual |
|
inlinevirtual |
Subclasses generate the message to send, then call writeMessage() to send it out.
Referenced by FileSim::sendASCIIMessage(), FileSim::sendBinaryMessage(), and FixedSim::sendMessage().
|
inlinevirtual |
overloaded function useful for writing binary data
|
protected |
|
staticprotected |
|
protected |
Referenced by Csat3Sim::run().
|
protected |
Referenced by Csat3Sim::run(), and Csat3Sim::sendMessage().
|
protected |
|
protected |
|
protected |
Referenced by Csat3Sim::run().