-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDTE.h
More file actions
57 lines (51 loc) · 1.73 KB
/
DTE.h
File metadata and controls
57 lines (51 loc) · 1.73 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
50
51
52
53
54
55
56
57
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* DTE.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: Neta Yahav <neta540@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/09/20 15:40:51 by Neta Yahav #+# #+# */
/* Updated: 2020/08/02 18:43:03 by Neta Yahav ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __DTE_H__
#define __DTE_H__
#include <Arduino.h>
class DTE {
// variables
public:
enum CommandResult {
EXPECT_BUSY,
EXPECT_TIMEOUT,
EXPECT_DELAY,
EXPECT_RESULT
};
protected:
private:
String buffer;
Stream &stream;
unsigned int bufferIndex;
unsigned int bufferSize;
String response[3];
unsigned long timeout;
unsigned long tick;
unsigned int match;
CommandResult result;
// functions
public:
DTE(Stream &stream, unsigned int size);
~DTE();
void SendCommand(const char *command, unsigned long timeout,
const char *response1, const char *response2 = 0,
const char *response3 = 0);
void Delay(unsigned long delay);
bool getIsBusy();
CommandResult getResult();
unsigned int getMatch();
String &getBuffer();
protected:
private:
void proccess();
}; // DTE
#endif //__DTE_H__