Michael Spencer / Mbed 2 deprecated LaOS

Dependencies:   mbed

Committer:
Michael J. Spencer
Date:
Wed Mar 05 06:14:02 2014 -0800
Revision:
1:f5ac63519541
Initial commit.

Who changed what in which revision?

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