a library to use GPRS like ethernet or wifi, which makes it possible to connect to the internet with your GPRS module
Dependents: Seeed_GPRS_Library_HelloWorld Seeed_GPRS_Xively_HelloWorld Seeed_ARCH_GPRS_V2_Xively_HelloWorld Seeed_ARCH_GPRS_V2_ThingSpeak_HelloWorld ... more
Socket.cpp
00001 /* 00002 Socket.cpp 00003 2014 Copyright (c) Seeed Technology Inc. All right reserved. 00004 00005 Author:lawliet zou(lawliet.zou@gmail.com) 00006 2014-2-24 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Lesser General Public 00010 License as published by the Free Software Foundation; either 00011 version 2.1 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with this library; if not, write to the Free Software 00020 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 #include "Socket.h" 00024 00025 Socket::Socket() : _sock_fd(-1) { 00026 gprs = GPRS::getInstance(); 00027 if (gprs == NULL) { 00028 error("Socket constructor error: no GPRS instance available!\r\n"); 00029 } 00030 } 00031 00032 void Socket::set_blocking(bool blocking, unsigned int timeout) 00033 { 00034 //nothing to do for GPRS 00035 } 00036 00037 int Socket::close() { 00038 return (gprs->close(_sock_fd)) ? 0 : -1; 00039 } 00040 00041 Socket::~Socket() { 00042 close(); 00043 }
Generated on Thu Jul 14 2022 07:16:02 by 1.7.2