-
Notifications
You must be signed in to change notification settings - Fork 2
/
Arduios_Shell.cpp
39 lines (35 loc) · 1 KB
/
Arduios_Shell.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "Arduios_Shell.h"
Shell shell;
String Shell::getName() {
return F("Shell");
}
void Shell::setup() {
Serial.begin(9600);
Serial.println(F("---- Arduios ----"));
Serial.println(F("by John´s Project"));
Serial.println(F("-----------------"));
Serial.println(F("type help. for help!"));
}
void Shell::loop() {
String content;
if (Serial.available() > 0) {
content = Serial.readStringUntil('.');
if (content.length() > 0) {
Serial.println("# " + content);
if (content == F("help")) {
Serial.println(F("commands: list., load:app_name."));
}
if (content == F("list")) {
for (uint8_t i = 1; i < kernel.registry.MAX_APPS; i++) {
if(kernel.registry.apps[i] != NULL){
Serial.println(kernel.registry.apps[i]->getName());
}
}
}
if (content.substring(0, 5) == F("load:")) {
content.replace("load:", "");
kernel.loadApp(content);
}
}
}
}