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