-
Notifications
You must be signed in to change notification settings - Fork 1
/
SWCommand.h
53 lines (40 loc) · 852 Bytes
/
SWCommand.h
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
50
51
52
53
#ifndef SWCommand_H
#define SWCommand_H
//#define SWCOMMAND_USESTRING
typedef enum
{
SWCommandTypeNone = 0,
SWCommandTypeSet = 1,
SWCommandTypeGet = 2
} SWCommandType;
#define SWCommandBuffLength 100
class SWCommand
{
public:
SWCommand();
public:
bool available();
void print( long value );
inline SWCommandType type() { return _done ? _type : SWCommandTypeNone; }
inline long value() { return _done ? _value : 0; }
private:
bool _parse();
private:
char _buff[SWCommandBuffLength];
int _index;
bool _done;
long _value;
SWCommandType _type;
#ifdef SWCOMMAND_USESTRING
public:
inline String var() { return _done ? _var : "?"; }
private:
String _var;
#else
public:
inline char var() { return _done ? _var : '?'; }
private:
char _var;
#endif
};
#endif