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
GPRSInterface.cpp
00001 /* 00002 GPRSInterface.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 "GPRSInterface.h" 00024 00025 GPRSInterface::GPRSInterface(PinName tx, PinName rx, int baudRate, const char* apn, const char* userName, const char *passWord) : GPRS(tx,rx,baudRate,apn,userName,passWord) 00026 { 00027 ip_set = false; 00028 } 00029 00030 int GPRSInterface::init() 00031 { 00032 reset(); 00033 return 0; 00034 } 00035 00036 int GPRSInterface::connect() 00037 { 00038 return GPRS::join(); 00039 } 00040 00041 int GPRSInterface::disconnect() 00042 { 00043 return GPRS::disconnect(); 00044 } 00045 00046 char* GPRSInterface::getIPAddress() 00047 { 00048 snprintf(ip_string, sizeof(ip_string), "%d.%d.%d.%d", (_ip>>24)&0xff,(_ip>>16)&0xff,(_ip>>8)&0xff,_ip&0xff); 00049 ip_set = true; 00050 return ip_string; 00051 }
Generated on Thu Jul 14 2022 07:16:02 by 1.7.2