add button with name (wo number)

This commit is contained in:
Dmitry Borisenko
2020-07-28 00:52:49 +02:00
parent 110fc167a1
commit 2e66c93814
7 changed files with 158 additions and 79 deletions

View File

@@ -31,7 +31,8 @@ StringCommand::StringCommand()
commandCount(0),
defaultHandler(NULL),
term('\n'), // default terminator for commands, newline character
last(NULL)
last(NULL),
main(NULL)
{
strcpy(delim, " "); // strtok_r needs a null-terminated string
clearBuffer();
@@ -130,3 +131,7 @@ void StringCommand::clearBuffer() {
char *StringCommand::next() {
return strtok_r(NULL, delim, &last);
}
char *StringCommand::order() {
return strtok_r(buffer, delim, &main);
}

View File

@@ -51,6 +51,7 @@ class StringCommand {
void readStr(String sBuffer ); // Main entry point.
void clearBuffer(); // Clears the input buffer.
char *next(); // Returns pointer to next token found in command buffer (for getting arguments to commands).
char *order();
private:
// Command/handler dictionary
@@ -70,6 +71,7 @@ class StringCommand {
char buffer[SERIALCOMMAND_BUFFER + 1]; // Buffer of stored characters while waiting for terminator character
byte bufPos; // Current position in the buffer
char *last; // State variable used by strtok_r during processing
char *main;
};
#endif //StringCommand_h