Temp fork

Dependents:   Seeed_GPRS_Shield

Fork of GPRSInterface by wei zou

Committer:
screamer
Date:
Fri Jul 25 10:42:42 2014 +0000
Revision:
9:5afc5b4e2df8
Parent:
0:8ccbd963e74d
Fix documentation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lawliet 0:8ccbd963e74d 1 /*
lawliet 0:8ccbd963e74d 2 GPRSInterface.cpp
lawliet 0:8ccbd963e74d 3 2014 Copyright (c) Seeed Technology Inc. All right reserved.
lawliet 0:8ccbd963e74d 4
lawliet 0:8ccbd963e74d 5 Author:lawliet zou(lawliet.zou@gmail.com)
lawliet 0:8ccbd963e74d 6 2014-2-24
lawliet 0:8ccbd963e74d 7
lawliet 0:8ccbd963e74d 8 This library is free software; you can redistribute it and/or
lawliet 0:8ccbd963e74d 9 modify it under the terms of the GNU Lesser General Public
lawliet 0:8ccbd963e74d 10 License as published by the Free Software Foundation; either
lawliet 0:8ccbd963e74d 11 version 2.1 of the License, or (at your option) any later version.
lawliet 0:8ccbd963e74d 12
lawliet 0:8ccbd963e74d 13 This library is distributed in the hope that it will be useful,
lawliet 0:8ccbd963e74d 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
lawliet 0:8ccbd963e74d 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
lawliet 0:8ccbd963e74d 16 Lesser General Public License for more details.
lawliet 0:8ccbd963e74d 17
lawliet 0:8ccbd963e74d 18 You should have received a copy of the GNU Lesser General Public
lawliet 0:8ccbd963e74d 19 License along with this library; if not, write to the Free Software
lawliet 0:8ccbd963e74d 20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
lawliet 0:8ccbd963e74d 21 */
lawliet 0:8ccbd963e74d 22
lawliet 0:8ccbd963e74d 23 #include "GPRSInterface.h"
lawliet 0:8ccbd963e74d 24
lawliet 0:8ccbd963e74d 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)
lawliet 0:8ccbd963e74d 26 {
lawliet 0:8ccbd963e74d 27 ip_set = false;
lawliet 0:8ccbd963e74d 28 }
lawliet 0:8ccbd963e74d 29
lawliet 0:8ccbd963e74d 30 int GPRSInterface::init()
lawliet 0:8ccbd963e74d 31 {
lawliet 0:8ccbd963e74d 32 reset();
lawliet 0:8ccbd963e74d 33 return 0;
lawliet 0:8ccbd963e74d 34 }
lawliet 0:8ccbd963e74d 35
lawliet 0:8ccbd963e74d 36 int GPRSInterface::connect()
lawliet 0:8ccbd963e74d 37 {
lawliet 0:8ccbd963e74d 38 return GPRS::join();
lawliet 0:8ccbd963e74d 39 }
lawliet 0:8ccbd963e74d 40
lawliet 0:8ccbd963e74d 41 int GPRSInterface::disconnect()
lawliet 0:8ccbd963e74d 42 {
lawliet 0:8ccbd963e74d 43 return GPRS::disconnect();
lawliet 0:8ccbd963e74d 44 }
lawliet 0:8ccbd963e74d 45
lawliet 0:8ccbd963e74d 46 char* GPRSInterface::getIPAddress()
lawliet 0:8ccbd963e74d 47 {
lawliet 0:8ccbd963e74d 48 snprintf(ip_string, sizeof(ip_string), "%d.%d.%d.%d", (_ip>>24)&0xff,(_ip>>16)&0xff,(_ip>>8)&0xff,_ip&0xff);
lawliet 0:8ccbd963e74d 49 ip_set = true;
lawliet 0:8ccbd963e74d 50 return ip_string;
lawliet 0:8ccbd963e74d 51 }