![]() |
Dynamixel
2.9.5
RoadNarrows Robotics Dynamixel Package
|
Dynamixel shell command abstract base class. More...
#include <dynashell_cmd.h>
Public Member Functions | |
DynaShellCmd (int nArgCntMin=0, int nArgCntMax=0) | |
Default constructor. | |
virtual | ~DynaShellCmd () |
Default destructor. | |
const char * | GetCmdName () |
Get dynamixel shell command name. More... | |
const char * | GetCmdHelpBrief () |
Get shell command name brief description. More... | |
virtual void | Exec (DynaShell &shell, int argc, char *argv[])=0 |
Execute command abstract function. More... | |
virtual void | PrintHelp (int indent=0, int width=80) |
Print command help with the description aligned at the given indentation. More... | |
int | GetPublishedLevel () const |
const char * | GetPublishedName () const |
int | SetPublishedInfo (int nLevel, const char *sParent=NULL) |
virtual char * | TabCompletion (DynaShell &shell, const char *sText, size_t uTextLen, int nState, const char *sContext) |
Default command tab completion generator. More... | |
virtual bool | ChkArgCnt (DynaShell &shell, int argc) |
Check that the argument count is within the class (min,max). More... | |
bool | ChkArgCnt0 (DynaShell &shell, int argc) |
Check that the argument count is zero. More... | |
bool | ChkArgCntEQ (DynaShell &shell, int argc, int eq) |
Check that the argument count is equal to the required. More... | |
bool | ChkArgCntGE (DynaShell &shell, int argc, int min) |
Check argument count against minimum required. More... | |
bool | ChkArgCntLE (DynaShell &shell, int argc, int max) |
Check argument count against maximum allowed. More... | |
bool | ChkComm (DynaShell &shell) |
Check that Dynamixel communication exists and is open. More... | |
bool | ChkChain (DynaShell &shell) |
Check that the servo chain exists. More... | |
bool | ChkChainNotEmpty (DynaShell &shell) |
Check that the servo chain exists and is not empty. More... | |
bool | ChkChainHasServo (DynaShell &shell, int nServoId) |
Check that the given servo is present in the chain. More... | |
bool | ChkChainIsMasterServo (DynaShell &shell, int nServoId) |
Check that the given servo is a master. More... | |
bool | ToInt (DynaShell &shell, const char *sArg, int *pVal) |
Convert command argument to integer. More... | |
bool | ToUInt (DynaShell &shell, const char *sArg, uint_t *pVal) |
Convert command argument to unsigned integer. More... | |
bool | ToDouble (DynaShell &shell, const char *sArg, double *pVal) |
Convert command argument to double. More... | |
bool | ToBool (DynaShell &shell, const char *sArg, bool *pVal) |
Convert command argument to boolean. More... | |
Protected Member Functions | |
virtual void | PrintSynopses (int indent, int width) |
Print synsopses. More... | |
virtual void | PrintBlock (int col, int indent, int width, const char *sText) |
Print a block of indented text of width. More... | |
virtual void | PrintDelim (int width, const char cDelim) |
char * | eow (const char *s) |
Find end of word. More... | |
Protected Attributes | |
const char * | m_sCmdName |
command name | |
const char * | m_sCmdHelpBrief |
command help brief | |
const char * | m_sCmdHelpArgs |
command help arguments | |
const char * | m_sCmdHelpDesc |
command help description | |
const int | m_nArgCntMin |
minimum argument count | |
const int | m_nArgCntMax |
maximum argument count (0 if not max) | |
int | m_nPubLevel |
command's published level (depth) | |
char * | m_sPubName |
command's published name | |
Dynamixel shell command abstract base class.
Definition at line 80 of file dynashell_cmd.h.
|
inlinevirtual |
Check that the argument count is within the class (min,max).
shell | Dynamixel shell. |
argc | Argument count. |
Definition at line 219 of file dynashell_cmd.h.
|
inline |
Check that the argument count is zero.
shell | Dynamixel shell. |
argc | Argument count. |
Definition at line 253 of file dynashell_cmd.h.
References DynaShell::Error().
|
inline |
Check that the argument count is equal to the required.
shell | Dynamixel shell. |
argc | Argument count. |
min | Required minimum count. |
Definition at line 274 of file dynashell_cmd.h.
References DynaShell::Error().
|
inline |
Check argument count against minimum required.
shell | Dynamixel shell. |
argc | Argument count. |
min | Required minimum count. |
Definition at line 295 of file dynashell_cmd.h.
References DynaShell::Error().
|
inline |
Check argument count against maximum allowed.
shell | Dynamixel shell. |
argc | Argument count. |
min | Maximum count. |
Definition at line 316 of file dynashell_cmd.h.
References DynaShell::Error().
|
inline |
Check that the servo chain exists.
shell | Dynamixel shell. |
Definition at line 354 of file dynashell_cmd.h.
References DynaShell::Error(), and DynaShell::m_pDynaChain.
|
inline |
Check that the given servo is present in the chain.
shell | Dynamixel shell. |
nServoId | Servo id. |
Definition at line 398 of file dynashell_cmd.h.
References DynaShell::Error(), DynaChain::HasServo(), and DynaShell::m_pDynaChain.
|
inline |
Check that the given servo is a master.
shell | Dynamixel shell. |
nServoId | Servo id. |
Definition at line 423 of file dynashell_cmd.h.
References DynaShell::Error(), DynaChain::GetServo(), DynaServo::IsMaster(), and DynaShell::m_pDynaChain.
|
inline |
Check that the servo chain exists and is not empty.
shell | Dynamixel shell. |
Definition at line 373 of file dynashell_cmd.h.
References DynaShell::Error(), DynaChain::GetNumberInChain(), and DynaShell::m_pDynaChain.
|
inline |
Check that Dynamixel communication exists and is open.
shell | Dynamixel shell. |
Definition at line 335 of file dynashell_cmd.h.
References DynaShell::Error(), DynaComm::IsOpen(), and DynaShell::m_pDynaComm.
|
protected |
Find end of word.
A word is define as a set of non-whitespace characters delimitedd by white space.
s | Null-terminated string to search. |
Definition at line 264 of file dynashell_cmd.cxx.
|
pure virtual |
Execute command abstract function.
shell | Embedding dynamixel shell. |
argc | Command argument count. |
argv | Array of arguments. |
Implemented in DynaShellCmdWriteByte, DynaShellCmdReadByte, DynaShellCmdSetSoftTorqueTh, DynaShellCmdPlay, DynaShellCmdWriteMaxTorqueLimit, DynaShellCmdSetHalfDuplexCtl, DynaShellCmdTrain, DynaShellCmdBgtGetState, DynaShellCmdReadMaxTorqueLimit, DynaShellCmdBgtStop, DynaShellCmdSaveRecording, DynaShellCmdBgtStart, DynaShellCmdMegaScan, DynaShellCmdUnlink, DynaShellCmdChainOut, DynaShellCmdScript, DynaShellCmdSetOdometer, DynaShellCmdChainIn, DynaShellCmdWait, DynaShellCmdLink, DynaShellCmdRelease, DynaShellCmdList, DynaShellCmdLog, DynaShellCmdLoadRecording, DynaShellCmdFreeze, DynaShellCmdExit, DynaShellCmdPing, DynaShellCmdQuit, DynaShellCmdEStop, DynaShellCmdScan, DynaShellCmdDestroy, DynaShellCmdSetPid, DynaShellCmdMoveAtSpeedTo, DynaShellCmdHelp, DynaShellCmdCreate, and DynaShellCmdNULL.
Referenced by DynaShell::Run().
|
inline |
Get shell command name brief description.
Definition at line 124 of file dynashell_cmd.h.
Referenced by DynaShell::PublishCommand().
|
inline |
Get dynamixel shell command name.
Definition at line 117 of file dynashell_cmd.h.
Referenced by DynaShell::PublishCommand().
|
inline |
Get the command's published level.
The root level is 0.
Definition at line 144 of file dynashell_cmd.h.
Referenced by DynaShell::Run().
|
inline |
Get the command's published name.
Definition at line 154 of file dynashell_cmd.h.
Referenced by DynaShell::PublishCommand().
|
protectedvirtual |
Print a block of indented text of width.
col | Current column position. |
indent | Column indentation from 0. |
width | Column width from 0; |
sText | Text to print. |
Definition at line 178 of file dynashell_cmd.cxx.
|
virtual |
Print command help with the description aligned at the given indentation.
indent | Column indentation. |
width | Column width. |
Definition at line 87 of file dynashell_cmd.cxx.
Referenced by DynaShellCmdHelp::Exec().
|
protectedvirtual |
Print synsopses.
indent | Column indentation. |
width | Column width. |
Definition at line 118 of file dynashell_cmd.cxx.
|
inline |
Set the command's published information.
nLevel | Published level. The root level is 0. |
sParent | Parent to which this command was published. |
Definition at line 165 of file dynashell_cmd.h.
References newstr().
Referenced by DynaShell::PublishCommand().
|
inlinevirtual |
Default command tab completion generator.
The default is no completion.
shell | Dynamixel shell. |
sText | Partial text string to complete. |
uTextLen | Length of text. |
nState | Generator state. If FIRST,then initialize any statics. |
sContext | Generator context (i.e. canonical command path). |
Reimplemented in DynaShellCmdWriteByte, DynaShellCmdReadByte, DynaShellCmdPlay, DynaShellCmdWriteMaxTorqueLimit, DynaShellCmdSetHalfDuplexCtl, DynaShellCmdTrain, DynaShellCmdReadMaxTorqueLimit, DynaShellCmdSaveRecording, DynaShellCmdBgtStart, DynaShellCmdMegaScan, DynaShellCmdUnlink, DynaShellCmdChainOut, DynaShellCmdScript, DynaShellCmdLink, DynaShellCmdChainIn, DynaShellCmdLog, DynaShellCmdLoadRecording, DynaShellCmdSetPid, DynaShellCmdHelp, and DynaShellCmdCreate.
Definition at line 199 of file dynashell_cmd.h.
|
inline |
Convert command argument to boolean.
shell | Dynamixel shell. | |
sArg | String argument to convert. | |
[out] | pVal | Converted argument. |
Definition at line 507 of file dynashell_cmd.h.
References DynaShell::Error().
|
inline |
Convert command argument to double.
shell | Dynamixel shell. | |
sArg | String argument to convert. | |
[out] | pVal | Converted argument. |
Definition at line 487 of file dynashell_cmd.h.
References DynaShell::Error().
|
inline |
Convert command argument to integer.
shell | Dynamixel shell. | |
sArg | String argument to convert. | |
[out] | pVal | Converted argument. |
Definition at line 448 of file dynashell_cmd.h.
References DynaShell::Error().
|
inline |
Convert command argument to unsigned integer.
shell | Dynamixel shell. | |
sArg | String argument to convert. | |
[out] | pVal | Converted argument. |
Definition at line 472 of file dynashell_cmd.h.