![](/media/cache/group/SAM_2404.JPG.50x50_q85.jpg)
uses pushing box to write to google spreadsheets
Dependencies: GSM_PUSHING_BOX_STATE_MACHINE MBed_Adafruit-GPS-Library SDFileSystem mbed
Fork of DCS by
Socket/Socket.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 | Socket.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 "Socket.h" |
DeWayneDennis | 19:404594768414 | 24 | |
DeWayneDennis | 19:404594768414 | 25 | Socket::Socket() : _sock_fd(-1) { |
DeWayneDennis | 19:404594768414 | 26 | gprs = GPRS::getInstance(); |
DeWayneDennis | 19:404594768414 | 27 | if (gprs == NULL) { |
DeWayneDennis | 19:404594768414 | 28 | error("Socket constructor error: no GPRS instance available!\r\n"); |
DeWayneDennis | 19:404594768414 | 29 | } |
DeWayneDennis | 19:404594768414 | 30 | } |
DeWayneDennis | 19:404594768414 | 31 | |
DeWayneDennis | 19:404594768414 | 32 | void Socket::set_blocking(bool blocking, unsigned int timeout) |
DeWayneDennis | 19:404594768414 | 33 | { |
DeWayneDennis | 19:404594768414 | 34 | //nothing to do for GPRS |
DeWayneDennis | 19:404594768414 | 35 | } |
DeWayneDennis | 19:404594768414 | 36 | |
DeWayneDennis | 19:404594768414 | 37 | int Socket::close() { |
DeWayneDennis | 19:404594768414 | 38 | return (gprs->close(_sock_fd)) ? 0 : -1; |
DeWayneDennis | 19:404594768414 | 39 | } |
DeWayneDennis | 19:404594768414 | 40 | |
DeWayneDennis | 19:404594768414 | 41 | Socket::~Socket() { |
DeWayneDennis | 19:404594768414 | 42 | close(); |
DeWayneDennis | 19:404594768414 | 43 | } |