Committer:
mbed714
Date:
Sat Sep 18 23:05:49 2010 +0000
Revision:
0:d616ece2d859

        

Who changed what in which revision?

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