| 
    nidas v1.2.3
    
   | 
 
Read serial records from a file and send them at a given rate or after a prompt. More...

Public Member Functions | |
| FileSim (n_u::SerialPort *p, const string &path, enum sep_type septype, string separator, bool prompted, string prompt, float rate, int nmessages, bool once, bool verbose=false) | |
| FileSim (n_u::SerialPort *p, const string &path, float rate, bool once, bool verbose=false) | |
| void | open () | 
| void | close () | 
| void | rewind () | 
| void | sendMessage () | 
| Implement this to send a message from the simulated sensor.   | |
| void | sendASCIIMessage () | 
| void | sendBinaryMessage () | 
| virtual void | writeMessage (const std::string &msg) | 
| Subclasses generate the message to send, then call writeMessage() to send it out.   | |
| virtual void | writeMessage (const char *buf, std::streamsize l) | 
| overloaded function useful for writing binary data   | |
| virtual void | run () | 
| 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.   | |
| void | interrupt () | 
| Stop the simulation.   | |
| bool | isInterrupted () const | 
| n_u::SerialPort * | port () | 
Protected Member Functions | |
| Looper * | getLooper () | 
| void | looperNotify () override | 
| Method called by Looper.   | |
| void | readPrompts () | 
Protected Attributes | |
| n_u::SerialPort * | _port | 
| bool | _prompted | 
| string | _prompt | 
| float | _rate | 
| int | _nmessages | 
| bool | _interrupted | 
Static Protected Attributes | |
| static Looper * | _looper = 0 | 
Private Member Functions | |
| FileSim (const FileSim &) | |
| FileSim & | operator= (const FileSim &) | 
Private Attributes | |
| string | _path | 
| std::ifstream | _infile | 
| std::istream * | _in | 
| std::string | _msg | 
| enum sep_type | _septype | 
| string | _separator | 
| bool | _reopen | 
| bool | _onceThru | 
| bool | _verbose | 
| bool | _binary | 
Read serial records from a file and send them at a given rate or after a prompt.
      
  | 
  inline | 
References open().
      
  | 
  inline | 
References open().
      
  | 
  inline | 
Referenced by open(), rewind(), and sendASCIIMessage().
      
  | 
  protectedinherited | 
References SensorSimulator::_looper.
Referenced by SensorSimulator::run().
      
  | 
  inlineinherited | 
Stop the simulation.
References SensorSimulator::_interrupted.
Referenced by SensorSimulator::looperNotify(), SensorSimulator::readPrompts(), sendASCIIMessage(), and sendBinaryMessage().
      
  | 
  inlineinherited | 
References SensorSimulator::_interrupted.
Referenced by SensorSimulator::readPrompts().
      
  | 
  overrideprotectedvirtualinherited | 
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 SensorSimulator::_interrupted, SensorSimulator::_looper, SensorSimulator::_nmessages, nidas::core::getSample(), SensorSimulator::interrupt(), and SensorSimulator::sendMessage().
      
  | 
  inline | 
      
  | 
  inlineinherited | 
References SensorSimulator::_port.
      
  | 
  protectedinherited | 
      
  | 
  inline | 
      
  | 
  virtualinherited | 
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 SensorSimulator::_looper, SensorSimulator::_prompted, SensorSimulator::_rate, SensorSimulator::getLooper(), nidas::core::getSample(), MSECS_PER_SEC, and SensorSimulator::readPrompts().
| void FileSim::sendASCIIMessage | ( | ) | 
References _in, _msg, _onceThru, _reopen, _separator, _septype, _verbose, BOM_SEPARATOR, close(), EOM_SEPARATOR, SensorSimulator::interrupt(), nidas::util::replaceBackslashSequences(), rewind(), and SensorSimulator::writeMessage().
Referenced by sendMessage().
| void FileSim::sendBinaryMessage | ( | ) | 
References _in, SensorSimulator::interrupt(), and SensorSimulator::writeMessage().
Referenced by sendMessage().
      
  | 
  virtual | 
Implement this to send a message from the simulated sensor.
| nidas::util::IOException | 
Implements SensorSimulator.
References _binary, sendASCIIMessage(), and sendBinaryMessage().
      
  | 
  inlinevirtualinherited | 
overloaded function useful for writing binary data
References SensorSimulator::_port, and nidas::util::SerialPort::write().
Subclasses generate the message to send, then call writeMessage() to send it out.
References SensorSimulator::_port, and nidas::util::SerialPort::write().
Referenced by sendASCIIMessage(), sendBinaryMessage(), and FixedSim::sendMessage().
      
  | 
  private | 
Referenced by sendMessage().
      
  | 
  private | 
Referenced by close(), open(), sendASCIIMessage(), and sendBinaryMessage().
      
  | 
  protectedinherited | 
Referenced by SensorSimulator::interrupt(), SensorSimulator::isInterrupted(), and SensorSimulator::looperNotify().
      
  | 
  staticprotectedinherited | 
Referenced by SensorSimulator::getLooper(), SensorSimulator::looperNotify(), and SensorSimulator::run().
      
  | 
  private | 
Referenced by sendASCIIMessage().
      
  | 
  protectedinherited | 
Referenced by SensorSimulator::looperNotify(), SensorSimulator::readPrompts(), and Csat3Sim::run().
      
  | 
  private | 
Referenced by sendASCIIMessage().
      
  | 
  protectedinherited | 
      
  | 
  protectedinherited | 
Referenced by SensorSimulator::readPrompts().
      
  | 
  protectedinherited | 
Referenced by SensorSimulator::run().
      
  | 
  protectedinherited | 
Referenced by SensorSimulator::run(), and Csat3Sim::run().
      
  | 
  private | 
Referenced by open(), rewind(), and sendASCIIMessage().
      
  | 
  private | 
Referenced by sendASCIIMessage().
Referenced by sendASCIIMessage().
      
  | 
  private | 
Referenced by open(), rewind(), and sendASCIIMessage().