[136] | 1 | /*
|
---|
| 2 | This file is part of the GSM3 communications library for Arduino
|
---|
| 3 | -- Multi-transport communications platform
|
---|
| 4 | -- Fully asynchronous
|
---|
| 5 | -- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
---|
| 6 | -- Voice calls
|
---|
| 7 | -- SMS
|
---|
| 8 | -- TCP/IP connections
|
---|
| 9 | -- HTTP basic clients
|
---|
| 10 |
|
---|
| 11 | This library has been developed by Telefónica Digital - PDI -
|
---|
| 12 | - Physical Internet Lab, as part as its collaboration with
|
---|
| 13 | Arduino and the Open Hardware Community.
|
---|
| 14 |
|
---|
| 15 | September-December 2012
|
---|
| 16 |
|
---|
| 17 | This library is free software; you can redistribute it and/or
|
---|
| 18 | modify it under the terms of the GNU Lesser General Public
|
---|
| 19 | License as published by the Free Software Foundation; either
|
---|
| 20 | version 2.1 of the License, or (at your option) any later version.
|
---|
| 21 |
|
---|
| 22 | This library is distributed in the hope that it will be useful,
|
---|
| 23 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 25 | Lesser General Public License for more details.
|
---|
| 26 |
|
---|
| 27 | You should have received a copy of the GNU Lesser General Public
|
---|
| 28 | License along with this library; if not, write to the Free Software
|
---|
| 29 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
---|
| 30 |
|
---|
| 31 | The latest version of this library can always be found at
|
---|
| 32 | https://github.com/BlueVia/Official-Arduino
|
---|
| 33 | */
|
---|
| 34 | #ifndef _GSM3MOBILESMSPROVIDER_
|
---|
| 35 | #define _GSM3MOBILESMSPROVIDER_
|
---|
| 36 |
|
---|
| 37 | class GSM3MobileSMSProvider
|
---|
| 38 | {
|
---|
| 39 | public:
|
---|
| 40 |
|
---|
| 41 | /** Begin a SMS to send it
|
---|
| 42 | @param to Destination
|
---|
| 43 | @return error command if it exists
|
---|
| 44 | */
|
---|
| 45 | virtual inline int beginSMS(const char* to){return 0;};
|
---|
| 46 |
|
---|
| 47 | /** Write a SMS character by character
|
---|
| 48 | @param c Character
|
---|
| 49 | */
|
---|
| 50 | virtual inline void writeSMS(const char c){};
|
---|
| 51 |
|
---|
| 52 | /** End SMS
|
---|
| 53 | @return error command if it exists
|
---|
| 54 | */
|
---|
| 55 | virtual inline int endSMS(){return 0;};
|
---|
| 56 |
|
---|
| 57 | /** Check if SMS available and prepare it to be read
|
---|
| 58 | @return number of bytes in a received SMS
|
---|
| 59 | */
|
---|
| 60 | virtual inline int availableSMS(){return 0;};
|
---|
| 61 |
|
---|
| 62 | /** Read a byte but do not advance the buffer header (circular buffer)
|
---|
| 63 | @return character
|
---|
| 64 | */
|
---|
| 65 | virtual inline int peekSMS(){return 0;};
|
---|
| 66 |
|
---|
| 67 | /** Delete the SMS from Modem memory and proccess answer
|
---|
| 68 | */
|
---|
| 69 | virtual inline void flushSMS(){return;};
|
---|
| 70 |
|
---|
| 71 | /** Read sender number phone
|
---|
| 72 | @param number Buffer for save number phone
|
---|
| 73 | @param nlength Buffer length
|
---|
| 74 | @return 1 success, >1 error
|
---|
| 75 | */
|
---|
| 76 | virtual inline int remoteSMSNumber(char* number, int nlength){return 0;};
|
---|
| 77 |
|
---|
| 78 | /** Read one char for SMS buffer (advance circular buffer)
|
---|
| 79 | @return character
|
---|
| 80 | */
|
---|
| 81 | virtual inline int readSMS(){return 0;};
|
---|
| 82 |
|
---|
| 83 | /** Get last command status
|
---|
| 84 | @return returns 0 if last command is still executing, 1 success, >1 error
|
---|
| 85 | */
|
---|
| 86 | virtual int ready()=0;
|
---|
| 87 | };
|
---|
| 88 |
|
---|
| 89 | extern GSM3MobileSMSProvider* theGSM3SMSProvider;
|
---|
| 90 |
|
---|
| 91 | #endif
|
---|