DUNE: Uniform Navigational Environment
2.6.0-rc4
|
Public Types | |
enum | Flags { FLAG_LAST } |
enum | Offset { OFFS_PREFIX, OFFS_VERSION, OFFS_FLAGS, OFFS_TTL, OFFS_PRIORITY, OFFS_SRC, OFFS_DST_COUNT, OFFS_DST, OFFS_LAST } |
Public Member Functions | |
AbstractCommand (void) | |
AbstractCommand (const std::string &name, unsigned version=0) | |
virtual | ~AbstractCommand (void) |
void | clear (void) |
AbstractCommand & | setVersion (unsigned version) |
unsigned | getVersion (void) const |
AbstractCommand & | setName (const std::string &name) |
std::string | getName (void) const |
AbstractCommand & | setSource (unsigned addr) |
unsigned | getSource (void) const |
AbstractCommand & | setDestination (unsigned addr) |
AbstractCommand & | clearDestination (unsigned addr) |
const std::set< unsigned > & | getDestinations (void) const |
AbstractCommand & | setDestinations (const std::set< unsigned > &dsts) |
AbstractCommand & | setTTL (unsigned value) |
unsigned | getTTL (void) const |
AbstractCommand & | setFlags (unsigned value) |
unsigned | getFlags (void) const |
AbstractCommand & | setPriority (unsigned value) |
unsigned | getPriority (void) const |
std::string | encode (void) const |
void | toText (std::ostream &os) const |
bool | operator== (const AbstractCommand &b) const |
bool | operator!= (const AbstractCommand &b) const |
virtual size_t | encodeArgs (std::vector< std::string > &args) const =0 |
virtual size_t | decodeArgs (const std::vector< std::string > &args, size_t index)=0 |
virtual void | toTextArgs (std::ostream &os__) const =0 |
Static Public Member Functions | |
static uint16_t | getCRC (const std::string &cmd) |
static uint16_t | computeCRC (const std::string &str, size_t size) |
static std::string | getFlagList (unsigned flags) |
|
inline |
Default constructor.
|
inline |
Construct a Command object setting name and version.
[in] | name | command name. |
[in] | version | command version. |
|
inlinevirtual |
|
inline |
Clear command.
|
inline |
Remove destination address.
This function can be called multiple times to remove more than one destination address.
[in] | addr | destination address. |
|
inlinestatic |
Compute the CRC of a string fragment.
[in] | str | string. |
[in] | size | string size. |
References DUNE::Algorithms::CRC16::compute().
Referenced by Transports::SUNSET::Factory::decode(), and encode().
|
pure virtual |
Implemented in Transports::SUNSET::Range, Transports::SUNSET::RangeGet, Transports::SUNSET::Position, Transports::SUNSET::PositionGet, Transports::SUNSET::SensorSample, Transports::SUNSET::SensorSampleGet, Transports::SUNSET::SensorInfo, Transports::SUNSET::SensorInfoGet, Transports::SUNSET::SensorList, Transports::SUNSET::SensorListGet, Transports::SUNSET::PlanAdded, Transports::SUNSET::PlanAdd, Transports::SUNSET::PlanDeleted, Transports::SUNSET::PlanDelete, Transports::SUNSET::PlanStopped, Transports::SUNSET::PlanStop, Transports::SUNSET::PlanStarted, Transports::SUNSET::PlanStart, Transports::SUNSET::Plan, Transports::SUNSET::PlanGet, Transports::SUNSET::PlanList, Transports::SUNSET::PlanListGet, Transports::SUNSET::Aborted, Transports::SUNSET::Abort, Transports::SUNSET::ParamSet, Transports::SUNSET::ParamGet, Transports::SUNSET::Param, Transports::SUNSET::PacketRx, Transports::SUNSET::PacketTxStatus, Transports::SUNSET::PacketTx, Transports::SUNSET::CommandFailure, Transports::SUNSET::CommandError, and Transports::SUNSET::CommandOk.
Referenced by Transports::SUNSET::Factory::decode().
|
inline |
Encode object to text form.
References computeCRC(), encodeArgs(), DUNE::Utils::String::join(), and DUNE::Utils::String::str().
Referenced by Transports::SUNSET::Task::sendCommand().
|
pure virtual |
Implemented in Transports::SUNSET::Range, Transports::SUNSET::RangeGet, Transports::SUNSET::Position, Transports::SUNSET::PositionGet, Transports::SUNSET::SensorSample, Transports::SUNSET::SensorSampleGet, Transports::SUNSET::SensorInfo, Transports::SUNSET::SensorInfoGet, Transports::SUNSET::SensorList, Transports::SUNSET::SensorListGet, Transports::SUNSET::PlanAdded, Transports::SUNSET::PlanAdd, Transports::SUNSET::PlanDeleted, Transports::SUNSET::PlanDelete, Transports::SUNSET::PlanStopped, Transports::SUNSET::PlanStop, Transports::SUNSET::PlanStarted, Transports::SUNSET::PlanStart, Transports::SUNSET::Plan, Transports::SUNSET::PlanGet, Transports::SUNSET::PlanList, Transports::SUNSET::PlanListGet, Transports::SUNSET::Aborted, Transports::SUNSET::Abort, Transports::SUNSET::ParamSet, Transports::SUNSET::ParamGet, Transports::SUNSET::Param, Transports::SUNSET::PacketRx, Transports::SUNSET::PacketTxStatus, Transports::SUNSET::PacketTx, Transports::SUNSET::CommandFailure, Transports::SUNSET::CommandError, and Transports::SUNSET::CommandOk.
Referenced by encode().
|
inlinestatic |
Retrieve CRC from an encoded command string.
[in] | cmd | command string. |
Referenced by Transports::SUNSET::Factory::decode().
|
inline |
Retrieve destination addresses.
|
inlinestatic |
Retrieve human-readable list of flags.
[in] | flags | flags bitfield. |
References DUNE::Utils::String::join().
Referenced by toText().
|
inline |
Retrieve command flags.
|
inline |
Get command name.
Referenced by Transports::SUNSET::Task::handleCommand(), and Transports::SUNSET::Task::handleSensorSampleGet().
|
inline |
Retrieve command priority.
|
inline |
Get command source address.
Referenced by Transports::SUNSET::Task::handleAbort(), Transports::SUNSET::Task::handlePlanListGet(), Transports::SUNSET::Task::handlePlanStart(), Transports::SUNSET::Task::handlePlanStop(), Transports::SUNSET::Task::handlePositionGet(), Transports::SUNSET::Task::handleSensorInfoGet(), Transports::SUNSET::Task::handleSensorListGet(), and Transports::SUNSET::Task::handleSensorSampleGet().
|
inline |
Retrieve command time-to-live.
|
inline |
Get command version.
|
inline |
|
inline |
|
inline |
Add destination address.
This function can be called multiple times to add more than one destination address.
[in] | addr | destination address. |
Referenced by Transports::SUNSET::Task::handleSensorInfoGet(), Transports::SUNSET::Task::handleSensorListGet(), Transports::SUNSET::Task::requestNodeId(), Transports::SUNSET::Task::sendAborted(), Transports::SUNSET::Task::sendError(), Transports::SUNSET::Task::sendFailure(), Transports::SUNSET::Task::sendOk(), Transports::SUNSET::Task::sendPlanList(), Transports::SUNSET::Task::sendPlanStarted(), Transports::SUNSET::Task::sendPlanStopped(), Transports::SUNSET::Task::sendPosition(), and Transports::SUNSET::Task::setTxPower().
|
inline |
Set destination addresses.
Referenced by Transports::SUNSET::Factory::decode().
|
inline |
Set command flags.
[in] | value | flags. |
Referenced by Transports::SUNSET::Factory::decode().
|
inline |
Set command name.
[in] | name | command name. |
Referenced by Transports::SUNSET::Abort::Abort(), Transports::SUNSET::Aborted::Aborted(), Transports::SUNSET::CommandError::CommandError(), Transports::SUNSET::CommandFailure::CommandFailure(), Transports::SUNSET::CommandOk::CommandOk(), Transports::SUNSET::Factory::decode(), Transports::SUNSET::PacketRx::PacketRx(), Transports::SUNSET::PacketTx::PacketTx(), Transports::SUNSET::PacketTxStatus::PacketTxStatus(), Transports::SUNSET::Param::Param(), Transports::SUNSET::ParamGet::ParamGet(), Transports::SUNSET::ParamSet::ParamSet(), Transports::SUNSET::Plan::Plan(), Transports::SUNSET::PlanAdd::PlanAdd(), Transports::SUNSET::PlanAdded::PlanAdded(), Transports::SUNSET::PlanDelete::PlanDelete(), Transports::SUNSET::PlanDeleted::PlanDeleted(), Transports::SUNSET::PlanGet::PlanGet(), Transports::SUNSET::PlanList::PlanList(), Transports::SUNSET::PlanListGet::PlanListGet(), Transports::SUNSET::PlanStart::PlanStart(), Transports::SUNSET::PlanStarted::PlanStarted(), Transports::SUNSET::PlanStop::PlanStop(), Transports::SUNSET::PlanStopped::PlanStopped(), Transports::SUNSET::Position::Position(), Transports::SUNSET::PositionGet::PositionGet(), Transports::SUNSET::Range::Range(), Transports::SUNSET::RangeGet::RangeGet(), Transports::SUNSET::SensorInfo::SensorInfo(), Transports::SUNSET::SensorInfoGet::SensorInfoGet(), Transports::SUNSET::SensorList::SensorList(), Transports::SUNSET::SensorListGet::SensorListGet(), Transports::SUNSET::SensorSample::SensorSample(), and Transports::SUNSET::SensorSampleGet::SensorSampleGet().
|
inline |
Set command priority.
[in] | value | priority. |
Referenced by Transports::SUNSET::Factory::decode().
|
inline |
Set command source address.
[in] | addr | command source address. |
Referenced by Transports::SUNSET::Factory::decode(), Transports::SUNSET::Task::handleSensorInfoGet(), Transports::SUNSET::Task::handleSensorListGet(), Transports::SUNSET::Task::sendCommand(), Transports::SUNSET::Task::sendError(), Transports::SUNSET::Task::sendFailure(), and Transports::SUNSET::Task::sendOk().
|
inline |
Set command time-to-live.
[in] | value | number of seconds. |
Referenced by Transports::SUNSET::Factory::decode().
|
inline |
Set command version.
[in] | version | command version. |
Referenced by Transports::SUNSET::Factory::decode().
|
inline |
References getFlagList(), and toTextArgs().
|
pure virtual |
Implemented in Transports::SUNSET::Range, Transports::SUNSET::RangeGet, Transports::SUNSET::Position, Transports::SUNSET::PositionGet, Transports::SUNSET::SensorSample, Transports::SUNSET::SensorSampleGet, Transports::SUNSET::SensorInfo, Transports::SUNSET::SensorInfoGet, Transports::SUNSET::SensorList, Transports::SUNSET::SensorListGet, Transports::SUNSET::PlanAdded, Transports::SUNSET::PlanAdd, Transports::SUNSET::PlanDeleted, Transports::SUNSET::PlanDelete, Transports::SUNSET::PlanStopped, Transports::SUNSET::PlanStop, Transports::SUNSET::PlanStarted, Transports::SUNSET::PlanStart, Transports::SUNSET::Plan, Transports::SUNSET::PlanGet, Transports::SUNSET::PlanList, Transports::SUNSET::PlanListGet, Transports::SUNSET::Aborted, Transports::SUNSET::Abort, Transports::SUNSET::ParamSet, Transports::SUNSET::ParamGet, Transports::SUNSET::Param, Transports::SUNSET::PacketRx, Transports::SUNSET::PacketTxStatus, Transports::SUNSET::PacketTx, Transports::SUNSET::CommandFailure, Transports::SUNSET::CommandError, and Transports::SUNSET::CommandOk.
Referenced by toText().