Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: CommandProcessor/CommandProcessor.cpp
- Revision:
- 1:d42ef49f54df
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CommandProcessor/CommandProcessor.cpp Mon Nov 11 03:38:40 2019 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+#include "CommandProcessor.h"
+
+void processCmd(Serial *pc, char *buf) {
+ char *tokens[10];
+ int len = tokenize(buf, tokens, 10);
+
+ switch (len) {
+ case 1:
+ if (strcmp(tokens[0], "ls") == 0) cmd_ls(pc);
+ else if (strcmp(tokens[0], "defaults") == 0) cmd_defaults(pc);
+ else if (strcmp(tokens[0], "clear") == 0) cmd_clear(pc);
+ else pc->printf("%s\n", "Bad command");
+ break;
+ case 2:
+ if (strcmp(tokens[0], "ls") == 0) cmd_ls2(pc, tokens[1]);
+ else if (strcmp(tokens[0], "get") == 0) cmd_ls2(pc, tokens[1]);
+ else pc->printf("%s\n", "Bad command");
+ break;
+ case 3:
+ if (strcmp(tokens[0], "set") == 0) cmd_set(pc, tokens[1], tokens[2]);
+ else pc->printf("%s\n", "Bad command");
+ break;
+ default:
+ pc->printf("%s\n", "Bad command");
+ break;
+ }
+}
\ No newline at end of file