Skip to content
CreativeRobotics edited this page Mar 4, 2020 · 21 revisions

Welcome to the Commander wiki!

Commander API:


Constructor and update

Commander()

begin()

update()


Configuration:

void setBuffer(uint16_t buffSize)

void printCommandPrompt()

void setCommentChar(char cmtChar)

void setReloadChar(char reloadChar)

void setEndOfLineChar(char eol)

void setPromptChar(char eol)

void setDelimiters(char eol)

void echo(bool sState)

void printComments(bool cState)

void echoToAlt(bool sState)

void copyRepyAlt(bool sState)

void commandProcessor(bool state)

bool commandProcessor()

void stripCR(bool sState)

bool stripCR()

void multiCommander(bool enable)

bool multiCommander()

void errorMessages(bool state)

bool errorMessages()

void commandPrompt(bool state)

bool commandPrompt()

void showHelp(bool state)

bool showHelp()

void internalCommands(bool state)

bool internalCommands()

void showInternalCommands(bool state)

bool showInternalCommands()

cmdSettings_t getSettings()

void setSettings(cmdSettings_t newSet)

portSettings_t getPortSettings()

void setPortSettings(portSettings_t newPorts)

void printDiagnostics()

void autoChain(bool state)

bool autoChain()

autoChainErrors(bool state)

bool autoChainErrors()

void setPrintDelay(uint8_t dTime)

uint8_t getPrintDelay()

void setDelimiters(String myDelims)

String getDelimiters()

void addDelimiter(char newDelim)


Payload processing

bool containsTrue()

bool containsFalse()

bool containsOn()

bool containsOff()

bool hasPayload()

String getPayload()

String getPayloadString()

bool getInt(iType &myIvar)

bool getFloat(float &myFloat)

bool getDouble(double &myDouble)

bool getString(String &myString)


Print methods:

size_t println()

size_t print(printType printableVariable)

size_t print(printType printableVariable, int fmt)

size_t println(printType printableVariable)

size_t println(printType printableVariable, int fmt)

size_t write(printType printableVariable)

size_t write(printType printableVariable, int length)


Locking

Commander can be locked and unlocked. If an optional passphrase is set then it must be used to unlock the command system.

There are two lock levels, soft or hard. A soft lock allows internal commands to be used and will print help data. A hard lock prevents all internal commands except the unlock command. HARD_LOCK and SOFT_LOCK are defined as macros for true and false.

void setPassPhrase(String& phrase)

void printPassPhrase()

void lock()

void unlock()

void setLockType(bool hlState)

bool isLocked()

bool getLockType()


Reloading the buffer

bool feed(Commander& Cmdr)

bool feedString(String newString)

void loadString(String newString)

bool endLine()


Switching between command lists

void attachCommands(const commandList_t *commands, uint32_t size)

void transfer(Commander& Cmdr)

bool transferTo(const commandList_t *commands, uint32_t size, String newName)

void transferBack(const commandList_t *commands, uint32_t size, String newName)


File streaming and number commands

void startStream()

void stopStream()

void setStream(bool streamState)

bool isStreaming()

void attachSpecialHandler(cmdHandler handler)


Stream objects

void attachOutputPort(Stream *oPort)

`Stream* getOutputPort()

void attachAltPort(Stream *aPort)

`Stream* getAltPort()

void attachInputPort(Stream *iPort)

Stream* getInputPort()

void deleteAltPort()

void attachDefaultHandler(cmdHandler handler)

void setStreamType(streamType_t newType)

streamType_t getStreamType()


Quick set and get system

void quickSetHelp()

bool quickSet(String cmd, int& var)

bool quickSet(String cmd, float& var)

bool quickSet(String cmd, double& var)

void quickGet(String cmd, int var)

void quickGet(String cmd, float var)


Prefix and Postfix methods

void setPrefix(String prfx)

void startPrefix()

void setPostfix(String pofx)

void startFormatting()

void setAutoFormat(bool state)

bool getAutoFormat()


Help system

uint16_t getCommandListLength()

String getCommandItem(uint16_t commandItem)

uint8_t getInternalCommandLength()

String getInternalCommandItem(uint8_t internalItem)

void printCommandList()

void printCommanderVersion()

Clone this wiki locally