27 #ifndef _EASYUINO_GSM_SERVICE_h 28 #define _EASYUINO_GSM_SERVICE_h 30 #include <SoftwareSerial.h> 31 #include "Utilities.h" 36 #define GSM_DELAY_NETWORK_LOGIN 10000 38 #define GSM_DEFAULT_BAUD_RATE 9600 44 #define INTERNAL_BUFFER_SIZE_BYTES 128 49 enum class GSMRequestStatus : uint8_t {
57 GSM_UNEXPECTED_REPLY = 1,
61 GSM_MODULE_DIDNT_REPLY = 2,
63 GSM_REQUEST_INVALID_ARGUMENT = 4,
65 GSM_MAXIMUM_ALLOWED_NUMBERS_REACHED = 5,
78 enum GSMSmsDeleteFlag : uint8_t {
79 INDEX_PARAMTER_CHOSEN_ONLY = 0,
81 ALL_SENT_AND_READ_SMS = 2,
85 const char *AT_OK =
"OK\r\n";
86 const char *AT_ERROR =
"ERROR\r\n";
95 SoftwareSerial* _GSMSerial;
98 char _internalBuffer[INTERNAL_BUFFER_SIZE_BYTES];
101 bool _readyToReceiveSMS;
110 GSMService(IN uint8_t txPin, IN uint8_t rxPin, IN uint8_t powerPin, IN Stream &outputStream);
117 GSMService(IN uint8_t txPin, IN uint8_t rxPin, IN uint8_t powerPin);
126 bool begin(IN
unsigned long gsmModuleBaudRate);
137 #pragma region GSM Physical Module Management 142 GSMRequestStatus turnOn();
147 GSMRequestStatus turnOff();
153 GSMRequestStatus isOn(OUT
bool &isOn);
161 GSMRequestStatus setBaudRate(IN
unsigned long newBaudRate);
165 #pragma region SMS Management 170 GSMRequestStatus beginListenForSMS();
177 virtual GSMRequestStatus availableSMS(OUT
SMS &message, OUT
bool &smsRead);
183 GSMRequestStatus sendSMS(IN
SMS &sms);
191 GSMRequestStatus sendSMS(IN
unsigned long phoneNumber, IN
const char* message, IN
unsigned int countryPrefixCode);
196 GSMRequestStatus deleteAllSMS();
201 GSMRequestStatus deleteAllReadSMS();
206 GSMRequestStatus deleteAllSentAndReadSMS();
214 GSMRequestStatus getUnreadSMS(INOUT
SMS &sms, OUT
bool &smsAvailable);
221 GSMRequestStatus deleteSMS(IN GSMSmsDeleteFlag parameter, IN
unsigned int messageIndex = 0);
226 GSMRequestStatus waitForGSMmoduleData();
231 bool lookForGSMmoduleData();
236 void zeroInternalBuffer();
Represents a SMS object used to send and receive it from the GSMService API.
Definition: SMS.h:38
GSMService API allows to interact with GSM boards in order to perform calls, sms management etc...
Definition: GSMService.h:74
General class that provides the common API behaviour for all the devices/sensors. ...
Definition: Device.h:42