Easyuino  1.2.0
Easyuino::GSMService Class Reference

GSMService API allows to interact with GSM boards in order to perform calls, sms management etc. More...

#include <GSMService.h>

Inheritance diagram for Easyuino::GSMService:
Easyuino::Device Easyuino::GSMServiceSecure

Public Member Functions

 GSMService (IN uint8_t txPin, IN uint8_t rxPin, IN uint8_t powerPin, IN Stream &outputStream)
 Constructor. More...
 
 GSMService (IN uint8_t txPin, IN uint8_t rxPin, IN uint8_t powerPin)
 Constructor. More...
 
 ~GSMService ()
 Destructor.
 
bool begin (IN unsigned long gsmModuleBaudRate)
 Initialize the GSMService API make it ready tor receive requests. More...
 
bool begin ()
 Initialize the GSMService API make it ready tor receive requests It uses the baud rate GSM_DEFAULT_BAUD_RATE to initialize the API. More...
 
void end ()
 Stops the GSMService API making it unable to receive more requests.
 
GSMRequestStatus turnOn ()
 Turns On the GSM module if it is turned Off. More...
 
GSMRequestStatus turnOff ()
 Turns Off the GSM module if it is turned On. More...
 
GSMRequestStatus isOn (OUT bool &isOn)
 Used to see if the GSM module is turned on or off. More...
 
GSMRequestStatus setBaudRate (IN unsigned long newBaudRate)
 Set the baud rate of the GSM module to a new one. More...
 
GSMRequestStatus beginListenForSMS ()
 Start listening for SMS reception. More...
 
virtual GSMRequestStatus availableSMS (OUT SMS &message, OUT bool &smsRead)
 Check if there is a new received SMS. More...
 
GSMRequestStatus sendSMS (IN SMS &sms)
 Send a SMS through the GSM module. More...
 
GSMRequestStatus sendSMS (IN unsigned long phoneNumber, IN const char *message, IN unsigned int countryPrefixCode)
 Send a SMS through the GSM module. More...
 
GSMRequestStatus deleteAllSMS ()
 Delete all the sms in the GSM module. More...
 
GSMRequestStatus deleteAllReadSMS ()
 Detele all the messages that were received and read. More...
 
GSMRequestStatus deleteAllSentAndReadSMS ()
 Delete all the the messages that were received and read plus the sent ones. More...
 
- Public Member Functions inherited from Easyuino::Device
 Device ()
 Constructor called by every sub-classes.
 
 ~Device ()
 Destroy all the resources associated with the device.
 
bool isInitialized () const
 Verify is the device is initialized and ready to use. More...
 

Additional Inherited Members

- Protected Attributes inherited from Easyuino::Device
bool _isInitialized
 Used to know if the device API is initialized and ready to receive requests.
 

Detailed Description

GSMService API allows to interact with GSM boards in order to perform calls, sms management etc.

See also
Devices Supported: SIM90x Series Chipset, SIM80x Chipset
Devices Tested: SIM900 Chipset

Constructor & Destructor Documentation

◆ GSMService() [1/2]

Easyuino::GSMService::GSMService ( IN uint8_t  txPin,
IN uint8_t  rxPin,
IN uint8_t  powerPin,
IN Stream &  outputStream 
)

Constructor.

Parameters
txPinArduino pin used to send the serial information to GSM module
rxPinArduino pin used to receive the serial information from GSM module
powerPinArduino pin used to turn on and off the GSM module
outputStreamDebug output stream

◆ GSMService() [2/2]

Easyuino::GSMService::GSMService ( IN uint8_t  txPin,
IN uint8_t  rxPin,
IN uint8_t  powerPin 
)

Constructor.

Parameters
txPinArduino pin used to send the serial information to GSM module
rxPinArduino pin used to receive the serial information from GSM module
powerPinArduino pin used to turn on and off the GSM module

Member Function Documentation

◆ availableSMS()

virtual GSMRequestStatus Easyuino::GSMService::availableSMS ( OUT SMS message,
OUT bool &  smsRead 
)
virtual

Check if there is a new received SMS.

If there is it filles the message with the content.

Parameters
messageMessage reference to be filled by the method if there is a new SMS.
smsReadFilled by the API. True: if a SMS was available. False: otherwise.
Returns
GSMRequestStatus (NOT_INITIALIZED, GSM_OK)

Reimplemented in Easyuino::GSMServiceSecure.

◆ begin() [1/2]

bool Easyuino::GSMService::begin ( IN unsigned long  gsmModuleBaudRate)

Initialize the GSMService API make it ready tor receive requests.

Parameters
gsmModuleBaudRateBaud rate to communicate with the GSM module
Returns
True: If begin was success. False: Otherwise.

◆ begin() [2/2]

bool Easyuino::GSMService::begin ( )
virtual

Initialize the GSMService API make it ready tor receive requests It uses the baud rate GSM_DEFAULT_BAUD_RATE to initialize the API.

Returns
True: If begin was success. False: Otherwise.

Implements Easyuino::Device.

◆ beginListenForSMS()

GSMRequestStatus Easyuino::GSMService::beginListenForSMS ( )

Start listening for SMS reception.

Necessary for the availableSMS() return new SMSs.

Returns
GSMRequestStatus (NOT_INITIALIZED, GSM_OK, GSM_UNEXPECTED_REPLY, GSM_MODULE_DIDNT_REPLY)

◆ deleteAllReadSMS()

GSMRequestStatus Easyuino::GSMService::deleteAllReadSMS ( )

Detele all the messages that were received and read.

Returns
GSMRequestStatuss (NOT_INITIALIZED, GSM_OK, GSM_UNEXPECTED_REPLY, GSM_MODULE_DIDNT_REPLY)

◆ deleteAllSentAndReadSMS()

GSMRequestStatus Easyuino::GSMService::deleteAllSentAndReadSMS ( )

Delete all the the messages that were received and read plus the sent ones.

Returns
GSMRequestStatus (NOT_INITIALIZED, GSM_OK, GSM_UNEXPECTED_REPLY, GSM_MODULE_DIDNT_REPLY)

◆ deleteAllSMS()

GSMRequestStatus Easyuino::GSMService::deleteAllSMS ( )

Delete all the sms in the GSM module.

Returns
GSMRequestStatus (NOT_INITIALIZED, GSM_OK, GSM_UNEXPECTED_REPLY, GSM_MODULE_DIDNT_REPLY)

◆ isOn()

GSMRequestStatus Easyuino::GSMService::isOn ( OUT bool &  isOn)

Used to see if the GSM module is turned on or off.

Parameters
isOnTrue: If GSM board is on. False: otherwise.
Returns
GSMRequestStatus (NOT_INITIALIZED, GSM_OK)

◆ sendSMS() [1/2]

GSMRequestStatus Easyuino::GSMService::sendSMS ( IN SMS sms)

Send a SMS through the GSM module.

Parameters
smsReference of the the filled SMS to be sent by the GSM module.
Returns
GSMRequestStatus (NOT_INITIALIZED, GSM_OK, GSM_UNEXPECTED_REPLY, GSM_MODULE_DIDNT_REPLY)

◆ sendSMS() [2/2]

GSMRequestStatus Easyuino::GSMService::sendSMS ( IN unsigned long  phoneNumber,
IN const char *  message,
IN unsigned int  countryPrefixCode 
)

Send a SMS through the GSM module.

Parameters
phoneNumberPhone number of SMS receipt.
messageThe message content to be sent.
countryPrefixCodeThe country prefix code of the phone number.
Returns
GSMRequestStatus (NOT_INITIALIZED, GSM_OK, GSM_UNEXPECTED_REPLY, GSM_MODULE_DIDNT_REPLY)

◆ setBaudRate()

GSMRequestStatus Easyuino::GSMService::setBaudRate ( IN unsigned long  newBaudRate)

Set the baud rate of the GSM module to a new one.

After calling this method with success the next time you use the GSM module you need to provide this new baud rate in the begin(unsigned long) method.

Parameters
newBaudRateNew baud rate to communicate with the GSM module.
Returns
GSMRequestStatus (NOT_INITIALIZED, GSM_OK, GSM_UNEXPECTED_REPLY, GSM_MODULE_DIDNT_REPLY)

◆ turnOff()

GSMRequestStatus Easyuino::GSMService::turnOff ( )

Turns Off the GSM module if it is turned On.

Returns
GSMRequestStatus (NOT_INITIALIZED, GSM_OK)

◆ turnOn()

GSMRequestStatus Easyuino::GSMService::turnOn ( )

Turns On the GSM module if it is turned Off.

Returns
GSMRequestStatus (NOT_INITIALIZED, GSM_OK)

The documentation for this class was generated from the following file: