This repository was archived by the owner on Jun 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandParser.hpp
More file actions
49 lines (37 loc) · 1.39 KB
/
CommandParser.hpp
File metadata and controls
49 lines (37 loc) · 1.39 KB
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
40
41
42
43
44
45
46
47
48
49
////////////////////////////////////////////////////////////////////////////////
class CommandParser {
public:
CommandParser(void);
//CommandParser( Stream * inputStream);
// functions must have a signature like: "int hello(int argc, char ** argv)"
typedef int (*CommandFunction)(int, char ** );
//
void add(const char * name, CommandFunction f);
// check for a complete command and run it if available
// non blocking
int executeIfInput(void);
int execute( const char aCommandString[]);
bool prepInput(void);
static int printHelp(int argc, char **argv);
class Command;
void resetBuffer(void);
private:
int execute(void);
int execute(int argc, char** argv);
int report(const char * message, int errorCode);
static const char BUFSIZE = 88;
static const char MAXARGS = 10;
char linebuffer[BUFSIZE];
int inptr;
static Command * firstCommand;
};
////////////////////////////////////////////////////////////////////////////////
extern CommandParser *shell;
//simple example command
extern int echo(int argc, char **argv);
extern int addArduinoCommands(CommandParser *shell);
//extern int setPinMode(int argc, char **argv);
//extern int analogRead(int argc, char **argv);
//extern int analogWrite(int argc, char **argv);
//extern int digitalRead(int argc, char **argv);
//extern int digitalWrite(int argc, char **argv);