-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimcom.h
54 lines (49 loc) · 1.11 KB
/
Simcom.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
54
#include <Arduino.h>
struct HTTPReqHeader
{
String header;
String value;
};
struct HTTPReqStruct
{
String host;
String url;
String port;
String method;
String body = "";
};
struct MQTTStruct
{
char protocolName[10] = "MQTT";
char host[55]
char port[10] = "1883";
char clientID[20] = "ESP-SIMCOM";
char username[30] = "admin";
char password[30] = "123";
char lvl = 0x03;
char flags = 0xc2;
unsigned int keepAlive = 60;
char qos = 0x00;
char packageID = 0x0001;
};
class Simcom
{
public:
Simcom();
void begin(unsigned long baudrate);
void setTimeout(int interval);
bool status();
bool getIpDevice();
bool setCIPMode(String mode);
bool activePNP(String profile);
bool closeNet();
bool openNet();
bool connectTCP(String ip, String port);
bool connectMQTTSecure(MQTTStruct req);
bool connectMQTT(MQTTStruct req);
bool requestHTTP(HTTPReqStruct req, HTTPReqHeader header[], int size, String &out);
private:
int _interval = 10 * 1000;
bool readSerial(String wakeword, String &out);
bool endRequestHTTP();
};