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.h
00001 /* 00002 GPRSInterface.h 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 #ifndef __GPRSINTERFACE_H__ 00023 #define __GPRSINTERFACE_H__ 00024 00025 #include "GPRS.h" 00026 #include "TCPSocketConnection.h" 00027 #include "TCPSocketServer.h" 00028 00029 /** Interface using GPRS to connect to an IP-based network 00030 * 00031 */ 00032 class GPRSInterface: public GPRS 00033 { 00034 00035 public: 00036 00037 /** Constructor 00038 * @param tx mbed pin to use for tx line of Serial interface 00039 * @param rx mbed pin to use for rx line of Serial interface 00040 * @param baudRate serial communicate baud rate 00041 * @param apn name of the gateway for GPRS to connect to the network 00042 * @param userName apn's username, usually is NULL 00043 * @param passWord apn's password, usually is NULL 00044 */ 00045 GPRSInterface(PinName tx, PinName rx, int baudRate, const char* apn, const char* userName = NULL, const char *passWord = NULL); 00046 00047 /** Initialize the interface(no connection at this point). 00048 * @return 0 on success, a negative number on failure 00049 */ 00050 int init(); 00051 00052 /** Connect to the network and get IP address 00053 * @returns 0 on success, a negative number on failure 00054 */ 00055 int connect(); 00056 00057 /** Disconnect with the network 00058 * @returns 0 on success, a negative number on failure 00059 */ 00060 int disconnect(); 00061 00062 /** Get IP address 00063 * @returns ip address 00064 */ 00065 char* getIPAddress(); 00066 00067 private: 00068 00069 char ip_string[20]; 00070 bool ip_set; 00071 }; 00072 00073 #endif
Generated on Thu Jul 14 2022 07:16:02 by 1.7.2