DUNE: Uniform Navigational Environment
2020.01.0
|
Public Member Functions | |
BasicModem (Tasks::Task *task, IO::Handle *handle) | |
virtual | ~BasicModem (void) |
void | initialize (void) |
void | setLineTermIn (const std::string &term) |
const std::string & | getLineTermIn (void) |
void | setLineTermOut (const std::string &str) |
const std::string & | getLineTermOut (void) |
void | setLineTrim (bool enable) |
void | setTxRateMax (double rate) |
bool | isBusy (void) |
bool | isCooling (void) |
void | setBusy (bool value) |
Public Member Functions inherited from DUNE::Concurrency::Thread | |
Thread (void) | |
virtual | ~Thread (void) |
int | getProcessorUsage (void) |
Public Member Functions inherited from DUNE::Concurrency::Runnable | |
Runnable (void) | |
virtual | ~Runnable (void) |
void | start (void) |
void | stop (void) |
void | join (void) |
void | stopAndJoin (void) |
void | setPriority (Scheduler::Policy policy, unsigned priority) |
unsigned | getPriority (void) |
State | getState (void) |
bool | isCreated (void) |
bool | isStopping (void) |
bool | isRunning (void) |
bool | isStarting (void) |
bool | isDead (void) |
Protected Types |
Protected Member Functions | |
virtual bool | handleUnsolicited (const std::string &str) |
virtual void | sendInitialization (void) |
virtual void | sendReset (void) |
virtual bool | isFragment (const std::string &str) |
void | sendRaw (const uint8_t *data, unsigned data_size) |
void | send (const std::string &str) |
void | setTimeout (double timeout) |
double | getTimeout (void) |
void | expect (const std::string &str) |
void | readRaw (Time::Counter< double > &timer, uint8_t *data, unsigned data_size) |
ReadMode | getReadMode (void) |
void | setReadMode (ReadMode mode) |
void | flushInput (void) |
std::string | readLine (void) |
std::string | readLine (Time::Counter< double > &timer) |
Tasks::Task * | getTask (void) |
void | setSkipLine (const std::string &line) |
Protected Member Functions inherited from DUNE::Concurrency::Thread | |
void | startImpl (void) |
void | stopImpl (void) |
void | joinImpl (void) |
void | setPriorityImpl (Scheduler::Policy policy, unsigned priority) |
unsigned | getPriorityImpl (void) |
Protected Attributes | |
Concurrency::Mutex | m_mutex |
IO::Handle * | m_handle |
std::string | m_last_cmd |
Additional Inherited Members | |
Public Types inherited from DUNE::Concurrency::Runnable |
|
protected |
DUNE::Hardware::BasicModem::BasicModem | ( | Tasks::Task * | task, |
IO::Handle * | handle | ||
) |
Constructor.
[in] | task | parent task. |
[in] | handle | I/O handle. |
References DUNE::IO::Handle::flushInput(), and m_handle.
|
inlinevirtual |
References getLineTermIn(), getLineTermOut(), initialize(), isBusy(), isCooling(), setBusy(), setLineTermIn(), setLineTermOut(), setLineTrim(), and setTxRateMax().
|
protected |
References readLine().
Referenced by isFragment().
|
protected |
References DUNE::Status::CODE_IO_ERROR, DUNE::IO::Handle::flushInput(), getReadMode(), DUNE::Status::getString(), getTask(), handleUnsolicited(), DUNE::IMC::IoEvent::IOV_TYPE_INPUT_ERROR, DUNE::Concurrency::Runnable::isStopping(), m_handle, DUNE::IO::Poll::poll(), DUNE::Concurrency::TSQueue< T >::push(), DUNE::IO::Handle::read(), READ_MODE_RAW, DUNE::Tasks::Task::receive(), DUNE::Streams::sanitize(), DUNE::IMC::Message::setDestinationEntity(), DUNE::IMC::Message::setSource(), DUNE::IMC::Message::setSourceEntity(), DUNE::Tasks::Task::spew(), DUNE::IMC::IoEvent::type, and DUNE::Tasks::Task::war().
Referenced by isFragment().
const std::string & DUNE::Hardware::BasicModem::getLineTermIn | ( | void | ) |
References m_mutex.
Referenced by ~BasicModem().
const std::string & DUNE::Hardware::BasicModem::getLineTermOut | ( | void | ) |
References m_mutex.
Referenced by DUNE::Hardware::HayesModem::sendAT(), and ~BasicModem().
|
protected |
References m_mutex.
Referenced by flushInput(), and isFragment().
|
inlineprotected |
References setSkipLine().
Referenced by flushInput(), DUNE::Hardware::HayesModem::HayesModem(), readRaw(), send(), DUNE::Hardware::HayesModem::sendAT(), and DUNE::Hardware::HayesModem::setRSSI().
|
protected |
References m_mutex.
Referenced by isFragment(), and readLine().
|
inlineprotectedvirtual |
Handle unsolicited or asynchronous commands.
[in] | str | command string. |
Referenced by flushInput().
void DUNE::Hardware::BasicModem::initialize | ( | void | ) |
References DUNE::IO::Handle::flushInput(), m_handle, READ_MODE_LINE, sendInitialization(), sendReset(), setReadMode(), DUNE::Concurrency::Runnable::start(), and DUNE::Time::Delay::wait().
Referenced by ~BasicModem().
bool DUNE::Hardware::BasicModem::isBusy | ( | void | ) |
Test if the modem is busy.
Test if ISU is busy performing an SBD session.
References m_mutex.
Referenced by ~BasicModem().
bool DUNE::Hardware::BasicModem::isCooling | ( | void | ) |
Test if the modem is cooling down.
Test if ISU is cooling down.
References m_mutex, and DUNE::Time::Counter< T >::overflow().
Referenced by ~BasicModem().
|
inlineprotectedvirtual |
Test if command is not complete (i.e.
is a fragment). This method is useful when the protocol allows mixing ASCII with binary data.
[in] | str | command string. |
References expect(), flushInput(), getReadMode(), getTimeout(), readLine(), readRaw(), send(), sendRaw(), setReadMode(), and setTimeout().
Referenced by readRaw().
|
protected |
References getTimeout().
Referenced by DUNE::Hardware::HayesModem::expect(), expect(), DUNE::Hardware::HayesModem::getRevision(), isFragment(), readLine(), and DUNE::Hardware::HayesModem::readValue().
|
protected |
|
protected |
References DUNE::Tasks::Task::debug(), DUNE::Tasks::Task::dispatch(), DUNE::Time::Counter< T >::getRemaining(), getTask(), isFragment(), DUNE::Time::Counter< T >::overflow(), DUNE::Concurrency::TSQueue< T >::pop(), DUNE::Streams::sanitize(), DUNE::IMC::Message::setDestination(), DUNE::Tasks::Task::trace(), DUNE::Utils::String::trim(), DUNE::IMC::DevDataText::value, and DUNE::Concurrency::TSQueue< T >::waitForItems().
Referenced by isFragment().
|
protected |
References getTask(), DUNE::Streams::sanitize(), sendRaw(), and DUNE::Tasks::Task::trace().
Referenced by isFragment(), and DUNE::Hardware::HayesModem::sendAT().
|
inlineprotectedvirtual |
Reimplemented in DUNE::Hardware::HayesModem.
Referenced by initialize().
|
protected |
References m_handle, and DUNE::IO::Handle::write().
Referenced by isFragment(), and send().
|
inlineprotectedvirtual |
Reimplemented in DUNE::Hardware::HayesModem.
Referenced by initialize().
void DUNE::Hardware::BasicModem::setBusy | ( | bool | value | ) |
References m_mutex, and DUNE::Time::Counter< T >::reset().
Referenced by ~BasicModem().
void DUNE::Hardware::BasicModem::setLineTermIn | ( | const std::string & | term | ) |
Set line termination for modem to CPU commands.
[in] | term | line terminator. |
References m_mutex.
Referenced by ~BasicModem().
void DUNE::Hardware::BasicModem::setLineTermOut | ( | const std::string & | str | ) |
Set line termination for CPU to modem commands.
[in] | str | line terminator. |
References m_mutex.
Referenced by ~BasicModem().
void DUNE::Hardware::BasicModem::setLineTrim | ( | bool | enable | ) |
Remove leading and trailing blank characters from lines.
[in] | enable | true to enable trimming, false otherwise. |
References m_mutex.
Referenced by ~BasicModem().
|
protected |
References m_mutex.
Referenced by initialize(), DUNE::Hardware::HayesModem::initialize(), and isFragment().
|
protected |
Referenced by getTask().
|
protected |
References m_mutex.
Referenced by isFragment().
void DUNE::Hardware::BasicModem::setTxRateMax | ( | double | rate | ) |
Set maximum transmission rate.
[in] | rate | transmission rate in second. Negative values will disable transmission rate control. |
[in] | rate | transmission rate in second. Negative values will disable transmission rate cap. |
References m_mutex, and DUNE::Time::Counter< T >::setTop().
Referenced by ~BasicModem().
|
protected |
I/O handle.
Referenced by BasicModem(), flushInput(), initialize(), DUNE::Hardware::HayesModem::initialize(), DUNE::Hardware::HayesModem::sendRaw(), and sendRaw().
|
protected |
Last command sent to modem.
Referenced by readLine(), and DUNE::Hardware::HayesModem::sendAT().
|
protected |
Concurrency lock.
Referenced by getLineTermIn(), getLineTermOut(), getReadMode(), DUNE::Hardware::HayesModem::getRSSI(), getTimeout(), isBusy(), isCooling(), setBusy(), setLineTermIn(), setLineTermOut(), setLineTrim(), setReadMode(), DUNE::Hardware::HayesModem::setRSSI(), setTimeout(), and setTxRateMax().