This library is stripped down version of NetServices library. HTTP server and client function is NOT supported.

Dependents:   imu-daq-eth

Committer:
idinor
Date:
Wed Jul 20 11:45:39 2011 +0000
Revision:
0:dcf3c92487ca

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
idinor 0:dcf3c92487ca 1
idinor 0:dcf3c92487ca 2 /*
idinor 0:dcf3c92487ca 3 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
idinor 0:dcf3c92487ca 4
idinor 0:dcf3c92487ca 5 Permission is hereby granted, free of charge, to any person obtaining a copy
idinor 0:dcf3c92487ca 6 of this software and associated documentation files (the "Software"), to deal
idinor 0:dcf3c92487ca 7 in the Software without restriction, including without limitation the rights
idinor 0:dcf3c92487ca 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
idinor 0:dcf3c92487ca 9 copies of the Software, and to permit persons to whom the Software is
idinor 0:dcf3c92487ca 10 furnished to do so, subject to the following conditions:
idinor 0:dcf3c92487ca 11
idinor 0:dcf3c92487ca 12 The above copyright notice and this permission notice shall be included in
idinor 0:dcf3c92487ca 13 all copies or substantial portions of the Software.
idinor 0:dcf3c92487ca 14
idinor 0:dcf3c92487ca 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
idinor 0:dcf3c92487ca 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
idinor 0:dcf3c92487ca 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
idinor 0:dcf3c92487ca 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
idinor 0:dcf3c92487ca 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
idinor 0:dcf3c92487ca 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
idinor 0:dcf3c92487ca 21 THE SOFTWARE.
idinor 0:dcf3c92487ca 22 */
idinor 0:dcf3c92487ca 23
idinor 0:dcf3c92487ca 24 /** \file
idinor 0:dcf3c92487ca 25 UMTS Stick network interface header file
idinor 0:dcf3c92487ca 26 */
idinor 0:dcf3c92487ca 27
idinor 0:dcf3c92487ca 28 #ifndef UMTSSTICKNETIF_H
idinor 0:dcf3c92487ca 29 #define UMTSSTICKNETIF_H
idinor 0:dcf3c92487ca 30
idinor 0:dcf3c92487ca 31 #include "mbed.h"
idinor 0:dcf3c92487ca 32
idinor 0:dcf3c92487ca 33 #include "core/net.h"
idinor 0:dcf3c92487ca 34 #include "if/ppp/PPPNetIf.h"
idinor 0:dcf3c92487ca 35
idinor 0:dcf3c92487ca 36 #include "drv/umtsstick/UMTSStick.h"
idinor 0:dcf3c92487ca 37
idinor 0:dcf3c92487ca 38 ///UMTS Stick network interface
idinor 0:dcf3c92487ca 39 /**
idinor 0:dcf3c92487ca 40 This class provides connectivity to the stack using a 3G (or LTE etc...) stick
idinor 0:dcf3c92487ca 41 Plug it to your USB host using two Pull-down resistors on the D+/D- lines
idinor 0:dcf3c92487ca 42 */
idinor 0:dcf3c92487ca 43 class UMTSStickNetIf : public LwipNetIf, protected PPPNetIf
idinor 0:dcf3c92487ca 44 {
idinor 0:dcf3c92487ca 45 public:
idinor 0:dcf3c92487ca 46 ///Instantiates the Interface and register it against the stack
idinor 0:dcf3c92487ca 47 UMTSStickNetIf();
idinor 0:dcf3c92487ca 48 virtual ~UMTSStickNetIf();
idinor 0:dcf3c92487ca 49
idinor 0:dcf3c92487ca 50 ///Tries to connect to the stick
idinor 0:dcf3c92487ca 51 /**
idinor 0:dcf3c92487ca 52 This method tries to obtain a virtual serial port interface from the stick
idinor 0:dcf3c92487ca 53 It waits for a stick to be connected, switches it from CDFS to virtual serial port mode if needed,
idinor 0:dcf3c92487ca 54 and obtains a virtual serial port from it
idinor 0:dcf3c92487ca 55 @return : A negative error code on error or 0 on success
idinor 0:dcf3c92487ca 56 */
idinor 0:dcf3c92487ca 57 UMTSStickErr setup(); //UMTSStickErr is from /drv/umtsstick/UMTSStick.h
idinor 0:dcf3c92487ca 58
idinor 0:dcf3c92487ca 59 ///Establishes a PPP connection
idinor 0:dcf3c92487ca 60 /**
idinor 0:dcf3c92487ca 61 This method opens an AT interface on the serial interface, initializes and configures the stick,
idinor 0:dcf3c92487ca 62 then opens a PPP connection and authenticates with the parameters
idinor 0:dcf3c92487ca 63 \param apn : APN of the interface, if NULL uses the SIM default value
idinor 0:dcf3c92487ca 64 \param userId : user with which to authenticate during the PPP connection, if NULL does not authenticate
idinor 0:dcf3c92487ca 65 \param password : associated password
idinor 0:dcf3c92487ca 66 @return : A negative error code on error or 0 on success
idinor 0:dcf3c92487ca 67 */
idinor 0:dcf3c92487ca 68 PPPErr connect(const char* apn = NULL, const char* userId = NULL, const char* password = NULL); //Connect using GPRS
idinor 0:dcf3c92487ca 69
idinor 0:dcf3c92487ca 70 ///Disconnects the PPP connection
idinor 0:dcf3c92487ca 71 PPPErr disconnect();
idinor 0:dcf3c92487ca 72
idinor 0:dcf3c92487ca 73 private:
idinor 0:dcf3c92487ca 74 UMTSStick m_umtsStick;
idinor 0:dcf3c92487ca 75 UsbSerial* m_pUsbSerial;
idinor 0:dcf3c92487ca 76
idinor 0:dcf3c92487ca 77 };
idinor 0:dcf3c92487ca 78
idinor 0:dcf3c92487ca 79 #endif
idinor 0:dcf3c92487ca 80