-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModem.h
More file actions
67 lines (60 loc) · 1.5 KB
/
Copy pathModem.h
File metadata and controls
67 lines (60 loc) · 1.5 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
#ifndef Modem_h
#define Modem_h
#include <Arduino.h>
#include <SoftwareSerial.h>
#include "Constants.h"
//
class Modem {
public:
Modem(SoftwareSerial *s);
// STREAM HANDLERS
void initModem();
void dropGSM();
void sendCommand(String toSIM);
void rebootSIM(void);
// http purpose
bool openConnect(void);
bool closeConnect(void);
// wrapped methods from SoftvareSerial
size_t write(uint8_t byte) {
return gsm->write(byte);
};
int read() {
return gsm->read();
};
int available() {
return gsm->available();
};
void flush() {
gsm->flush();
delay(10);
};
int print(String str) {
int len = gsm->print(str);
gsm-> flush();
delay(5);
return len;
};
int println(String str) {
return print( str + '\n');
};
bool checkOnOK(uint8_t wait_time);
// utility
bool setFormatSms( const char *format);
bool fillUCS2PhoneNumber(uint8_t numberInBook, char *phone);
bool fillGSMPhone(uint8_t clientNumber, char *phone);
bool checkPhoneFormat(char *phone); // phone number must be in GSM format
void changeShowCommand(uint8_t isShow); // whether show command on it call
bool fillMinThemperature(char *phone);
uint8_t isSendMotion();
/* ==================== PRIVATE ====================*/
private:
// var
SoftwareSerial *gsm;
bool isShowCommand = false;
int DELAY_FOR_CONNECT = 20;
// func
// http purpose
bool checkConnect(void);
};
#endif