forked from azinke/sim800l
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSim800l.h
More file actions
72 lines (59 loc) · 1.64 KB
/
Copy pathSim800l.h
File metadata and controls
72 lines (59 loc) · 1.64 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
@autor: AMOUSSOU Z. Kenneth
@date: 17/09/2018
@version: 1.0
*/
#ifndef H_SIM800L
#define H_SIM800L
#if ARDUINO < 100
#include <WProgram.h>
#else
#include <Arduino.h>
#endif
// #define DEBUG
#define SS
#define RX 10 // 10
#define TX 11 // 11
#define BAUD 9600
typedef struct {
String result;
uint8_t status = 0;
} RESPONSE;
typedef struct {
String status;
String number;
String date;
String time;
String content;
} SMS;
class Sim800l{
public:
Sim800l();
// void begin();
bool ping();
bool setEchoMode(bool enable);
/**
AT Commands According to 3GPP TS 27.005
SMS
*/
bool deleteAllSMS();
bool deleteSMS(uint8_t index, uint8_t delflag);
String readSMS(uint8_t index, uint8_t mode = 0);
bool sendSMS(String phone_number, String text);
bool setSmsFormat(uint8_t format);
bool setPreferedSmsStorage(uint8_t storage);
bool configureSmsCenter(String number);
bool setAdressType(uint8_t type); // page 70
uint8_t status();
String findPhonebookEntry(String text);
String readPhonebookEntry(uint8_t index1, uint8_t index2);
bool setPhonebookMemoryStorage(uint8_t storage); // page 84
bool writePhonebookEntry(String name, String number, uint8_t index); // page 86
// helper
SMS parseSMS(String sms);
private:
RESPONSE _buffer; // allocate buffer in memory
RESPONSE _read(unsigned long timeout); // timeout: multiple of 10µs
inline bool _ack();
};
#endif