uses pushing box to write to google spreadsheets
Dependencies: GSM_PUSHING_BOX_STATE_MACHINE MBed_Adafruit-GPS-Library SDFileSystem mbed
Fork of DCS by
GPRSInterface.cpp@19:404594768414, 2015-10-21 (annotated)
- Committer:
- DeWayneDennis
- Date:
- Wed Oct 21 19:44:47 2015 +0000
- Revision:
- 19:404594768414
changed to work with pushing box via http post
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DeWayneDennis | 19:404594768414 | 1 | /* |
DeWayneDennis | 19:404594768414 | 2 | GPRSInterface.cpp |
DeWayneDennis | 19:404594768414 | 3 | 2014 Copyright (c) Seeed Technology Inc. All right reserved. |
DeWayneDennis | 19:404594768414 | 4 | |
DeWayneDennis | 19:404594768414 | 5 | Author:lawliet zou(lawliet.zou@gmail.com) |
DeWayneDennis | 19:404594768414 | 6 | 2014-2-24 |
DeWayneDennis | 19:404594768414 | 7 | |
DeWayneDennis | 19:404594768414 | 8 | This library is free software; you can redistribute it and/or |
DeWayneDennis | 19:404594768414 | 9 | modify it under the terms of the GNU Lesser General Public |
DeWayneDennis | 19:404594768414 | 10 | License as published by the Free Software Foundation; either |
DeWayneDennis | 19:404594768414 | 11 | version 2.1 of the License, or (at your option) any later version. |
DeWayneDennis | 19:404594768414 | 12 | |
DeWayneDennis | 19:404594768414 | 13 | This library is distributed in the hope that it will be useful, |
DeWayneDennis | 19:404594768414 | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
DeWayneDennis | 19:404594768414 | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
DeWayneDennis | 19:404594768414 | 16 | Lesser General Public License for more details. |
DeWayneDennis | 19:404594768414 | 17 | |
DeWayneDennis | 19:404594768414 | 18 | You should have received a copy of the GNU Lesser General Public |
DeWayneDennis | 19:404594768414 | 19 | License along with this library; if not, write to the Free Software |
DeWayneDennis | 19:404594768414 | 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
DeWayneDennis | 19:404594768414 | 21 | */ |
DeWayneDennis | 19:404594768414 | 22 | |
DeWayneDennis | 19:404594768414 | 23 | #include "GPRSInterface.h" |
DeWayneDennis | 19:404594768414 | 24 | |
DeWayneDennis | 19:404594768414 | 25 | GPRSInterface::GPRSInterface(PinName tx, PinName rx, int baudRate, const char* apn, const char* userName, const char *passWord) : GPRS(tx,rx,baudRate,apn,userName,passWord) |
DeWayneDennis | 19:404594768414 | 26 | { |
DeWayneDennis | 19:404594768414 | 27 | ip_set = false; |
DeWayneDennis | 19:404594768414 | 28 | } |
DeWayneDennis | 19:404594768414 | 29 | |
DeWayneDennis | 19:404594768414 | 30 | int GPRSInterface::init() |
DeWayneDennis | 19:404594768414 | 31 | { |
DeWayneDennis | 19:404594768414 | 32 | reset(); |
DeWayneDennis | 19:404594768414 | 33 | return 0; |
DeWayneDennis | 19:404594768414 | 34 | } |
DeWayneDennis | 19:404594768414 | 35 | |
DeWayneDennis | 19:404594768414 | 36 | int GPRSInterface::connect() |
DeWayneDennis | 19:404594768414 | 37 | { |
DeWayneDennis | 19:404594768414 | 38 | return GPRS::join(); |
DeWayneDennis | 19:404594768414 | 39 | } |
DeWayneDennis | 19:404594768414 | 40 | |
DeWayneDennis | 19:404594768414 | 41 | int GPRSInterface::disconnect() |
DeWayneDennis | 19:404594768414 | 42 | { |
DeWayneDennis | 19:404594768414 | 43 | return GPRS::disconnect(); |
DeWayneDennis | 19:404594768414 | 44 | } |
DeWayneDennis | 19:404594768414 | 45 | |
DeWayneDennis | 19:404594768414 | 46 | char* GPRSInterface::getIPAddress() |
DeWayneDennis | 19:404594768414 | 47 | { |
DeWayneDennis | 19:404594768414 | 48 | snprintf(ip_string, sizeof(ip_string), "%d.%d.%d.%d", (_ip>>24)&0xff,(_ip>>16)&0xff,(_ip>>8)&0xff,_ip&0xff); |
DeWayneDennis | 19:404594768414 | 49 | ip_set = true; |
DeWayneDennis | 19:404594768414 | 50 | return ip_string; |
DeWayneDennis | 19:404594768414 | 51 | } |