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