mDot AT-Firmware for testing
Dependencies: MTS-Serial libmDot-mbed5
Fork of Dot-AT-Firmware by
Diff: CommandTerminal/Command.h
- Revision:
- 14:f9a77400b622
- Parent:
- 9:ff62b20f7000
--- a/CommandTerminal/Command.h Fri Nov 04 19:10:24 2016 +0000 +++ b/CommandTerminal/Command.h Fri Nov 04 14:25:43 2016 -0500 @@ -40,7 +40,9 @@ #include <string> #include <vector> #include "limits.h" -#include "debug.h" +#include "mts_at_debug.h" +#include "CommandTerminal.h" + /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __command_H @@ -54,19 +56,19 @@ public: - Command(mDot* dot); - Command(mDot* dot, const char* name, const char* text, const char* desc); + Command(); + Command(const char* name, const char* text, const char* desc, const char* usage); virtual ~Command() {}; const char* name() const { return _name; }; const char* text() const { return _text; }; const char* desc() const { return _desc; }; - const char* help() const { return _help.c_str(); }; + const std::string help() const { + return std::string(text()) + ": " + std::string(desc()); + }; - virtual uint32_t action(std::vector<std::string> args) = 0; - virtual bool verify(std::vector<std::string> args); std::string usage() const; - std::string& errorMessage(); + const std::string& errorMessage() const; bool queryable() const; static const char newline[]; @@ -77,19 +79,14 @@ protected: - void setErrorMessage(const char* message); - void setErrorMessage(const std::string& message); - std::string _help; - std::string _usage; bool _queryable; - mDot* _dot; private: const char* _name; const char* _text; const char* _desc; - std::string _errorMessage; + const char* _usage; };