rhr
gprs.h@1:642a8dbe076c, 2013-11-15 (annotated)
- Committer:
- lawliet
- Date:
- Fri Nov 15 03:40:35 2013 +0000
- Revision:
- 1:642a8dbe076c
- Parent:
- 0:a5ae94727346
- Child:
- 2:16985da3a446
version 0.2 with optimizing the library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lawliet | 0:a5ae94727346 | 1 | /* |
lawliet | 0:a5ae94727346 | 2 | IOT_Mbed.h |
lawliet | 0:a5ae94727346 | 3 | 2013 Copyright (c) Seeed Technology Inc. All right reserved. |
lawliet | 0:a5ae94727346 | 4 | |
lawliet | 0:a5ae94727346 | 5 | Author:lawliet.zou@gmail.com |
lawliet | 0:a5ae94727346 | 6 | 2013-11-14 |
lawliet | 0:a5ae94727346 | 7 | |
lawliet | 0:a5ae94727346 | 8 | This library is free software; you can redistribute it and/or |
lawliet | 0:a5ae94727346 | 9 | modify it under the terms of the GNU Lesser General Public |
lawliet | 0:a5ae94727346 | 10 | License as published by the Free Software Foundation; either |
lawliet | 0:a5ae94727346 | 11 | version 2.1 of the License, or (at your option) any later version. |
lawliet | 0:a5ae94727346 | 12 | |
lawliet | 0:a5ae94727346 | 13 | This library is distributed in the hope that it will be useful, |
lawliet | 0:a5ae94727346 | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
lawliet | 0:a5ae94727346 | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
lawliet | 0:a5ae94727346 | 16 | Lesser General Public License for more details. |
lawliet | 0:a5ae94727346 | 17 | |
lawliet | 0:a5ae94727346 | 18 | You should have received a copy of the GNU Lesser General Public |
lawliet | 0:a5ae94727346 | 19 | License along with this library; if not, write to the Free Software |
lawliet | 0:a5ae94727346 | 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
lawliet | 0:a5ae94727346 | 21 | */ |
lawliet | 0:a5ae94727346 | 22 | |
lawliet | 0:a5ae94727346 | 23 | #ifndef __GPRS_H__ |
lawliet | 0:a5ae94727346 | 24 | #define __GPRS_H__ |
lawliet | 0:a5ae94727346 | 25 | |
lawliet | 0:a5ae94727346 | 26 | #include "mbed.h" |
lawliet | 0:a5ae94727346 | 27 | |
lawliet | 1:642a8dbe076c | 28 | class gprs |
lawliet | 1:642a8dbe076c | 29 | { |
lawliet | 0:a5ae94727346 | 30 | |
lawliet | 1:642a8dbe076c | 31 | public: |
lawliet | 1:642a8dbe076c | 32 | gprs(PinName tx, PinName rx, int baudrate,char *Number) : gprsSerial(tx, rx) { |
lawliet | 1:642a8dbe076c | 33 | gprsSerial.baud(baudrate); |
lawliet | 1:642a8dbe076c | 34 | phoneNumber = Number; |
lawliet | 1:642a8dbe076c | 35 | }; |
lawliet | 1:642a8dbe076c | 36 | int init(void); |
lawliet | 1:642a8dbe076c | 37 | int readBuffer(char *buffer,int count); |
lawliet | 1:642a8dbe076c | 38 | void sendCmd(char *cmd); |
lawliet | 1:642a8dbe076c | 39 | int waitForResp(char *resp, int timeout); |
lawliet | 1:642a8dbe076c | 40 | int sendCmdAndWaitForResp(char *cmd, char *resp, int timeout); |
lawliet | 1:642a8dbe076c | 41 | int checkSIMStatus(void); |
lawliet | 1:642a8dbe076c | 42 | int checkSignalStrength(void); |
lawliet | 1:642a8dbe076c | 43 | int networkInit(void); |
lawliet | 1:642a8dbe076c | 44 | int sendSMS(char *number, char *data); |
lawliet | 1:642a8dbe076c | 45 | int readSMS(char *buffer, char *message, bool check); |
lawliet | 1:642a8dbe076c | 46 | int deleteSMS(int index); |
lawliet | 1:642a8dbe076c | 47 | int callUp(char *number); |
lawliet | 1:642a8dbe076c | 48 | int answer(void); |
lawliet | 1:642a8dbe076c | 49 | int loop(bool check); |
lawliet | 1:642a8dbe076c | 50 | int connectTCP(char *ip, char *port); |
lawliet | 1:642a8dbe076c | 51 | int sendTCPData(char *data); |
lawliet | 1:642a8dbe076c | 52 | int closeTCP(void); |
lawliet | 1:642a8dbe076c | 53 | int shutTCP(void); |
lawliet | 1:642a8dbe076c | 54 | void serialDebug(PinName tx, PinName rx); |
lawliet | 1:642a8dbe076c | 55 | private: |
lawliet | 1:642a8dbe076c | 56 | Serial gprsSerial; |
lawliet | 1:642a8dbe076c | 57 | Timer timeCnt; |
lawliet | 1:642a8dbe076c | 58 | char *phoneNumber; |
lawliet | 0:a5ae94727346 | 59 | }; |
lawliet | 0:a5ae94727346 | 60 | |
lawliet | 0:a5ae94727346 | 61 | //extern gprs GPRS; |
lawliet | 0:a5ae94727346 | 62 | #endif |