forked from cristiansteib/Sim800l
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sim800l.h
91 lines (78 loc) · 2.44 KB
/
Sim800l.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* this library is writing by Cristian Steib.
* Designed to work with the GSM Sim800l, maybe work with SIM900L
*
* This library use SoftwareSerial, you can define RX and TX pin in the
* header "Sim800l.h" ,by default the pin is RX=10 TX=11.. be sure that gnd
* is attached to arduino too.
* You can also change the other preferred RESET_PIN
*
* Esta libreria usa SoftwareSerial, se pueden cambiar los pines de RX y TX
* en el archivo header, "Sim800l.h", por defecto los pines vienen
* configurado en RX=10 TX=11.
* Tambien se puede cambiar el RESET_PIN por otro que prefiera
*
* PINOUT:
* _____________________________
* | ARDUINO UNO >>> SIM800L |
* -----------------------------
* GND >>> GND
* RX 10 >>> TX
* TX 11 >>> RX
* RESET 2 >>> RST
*
* POWER SOURCE 4.2V >>> VCC
*
* Created on: April 20, 2016
* Author: Cristian Steib
*
*
*/
#ifndef Sim800l_h
#define Sim800l_h
#include <SoftwareSerial.h>
#include "Arduino.h"
#define RX_PIN 10
#define TX_PIN 11
// pin to the reset pin sim800l
#define RESET_PIN 2
// used for indicator led, in case that you don want set to false .
#define LED true
//pin to indicate states.
#define LED_PIN 13
// maximum size of buffer (less one for safety)
const int BUFLEN=255;
class Sim800l {
private:
int _timeout;
char _buffer[BUFLEN];
int _readSerial();
public:
void begin();
void reset();
// Methods for calling || Funciones de llamadas.
bool answerCall();
void callNumber(char *number);
bool hangoffCall();
int getCallStatus();
// Methods for sms || Funciones de SMS.
bool sendSms(char *number, char *text);
// return LENGTH of all the content of sms
char* readSms(uint8_t index);
// return the number of the sms..
int getNumberSms(uint8_t index);
// return : OK or ERROR ..
bool delAllSms();
void signalQuality();
void setPhoneFunctionality();
void activateBearerProfile();
void deactivateBearerProfile();
// get time with the variables by reference
// returns -1 on error, 0 for good values
int RTCtime(int *day, int *month, int *year, int *hour, int *minute, int *second);
// return LENGTH of date,time string of the network
int dateNet();
// Update the RTC Clock with de Time AND Date of red-.
bool updateRtc(int utc);
};
#endif