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/drv/umtsstick/UMTSStick.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 driver header file |
mafischl | 0:d9266031f832 | 26 | */ |
mafischl | 0:d9266031f832 | 27 | |
mafischl | 0:d9266031f832 | 28 | #ifndef UMTS_STICK_H |
mafischl | 0:d9266031f832 | 29 | #define UMTS_STICK_H |
mafischl | 0:d9266031f832 | 30 | |
mafischl | 0:d9266031f832 | 31 | #include "mbed.h" |
mafischl | 0:d9266031f832 | 32 | |
mafischl | 0:d9266031f832 | 33 | #include "drv/usb/UsbHostMgr.h" |
mafischl | 0:d9266031f832 | 34 | #include "drv/usb/UsbDevice.h" |
mafischl | 0:d9266031f832 | 35 | #include "drv/usb/UsbEndpoint.h" |
mafischl | 0:d9266031f832 | 36 | |
mafischl | 0:d9266031f832 | 37 | #include "drv/serial/usb/UsbSerial.h" |
mafischl | 0:d9266031f832 | 38 | |
mafischl | 0:d9266031f832 | 39 | #define UMTS_SWITCHING_COUNT 2 |
mafischl | 0:d9266031f832 | 40 | |
mafischl | 0:d9266031f832 | 41 | typedef unsigned char byte; |
mafischl | 0:d9266031f832 | 42 | |
mafischl | 0:d9266031f832 | 43 | struct UMTSSwitchingInfo |
mafischl | 0:d9266031f832 | 44 | { |
mafischl | 0:d9266031f832 | 45 | uint16_t cdfsVid; |
mafischl | 0:d9266031f832 | 46 | uint16_t cdfsPid; |
mafischl | 0:d9266031f832 | 47 | uint16_t serialVid; |
mafischl | 0:d9266031f832 | 48 | uint16_t serialPidList[16]; |
mafischl | 0:d9266031f832 | 49 | byte targetClass; |
mafischl | 0:d9266031f832 | 50 | bool huaweiPacket; |
mafischl | 0:d9266031f832 | 51 | byte cdfsPacket[31]; |
mafischl | 0:d9266031f832 | 52 | }; |
mafischl | 0:d9266031f832 | 53 | |
mafischl | 0:d9266031f832 | 54 | extern const UMTSSwitchingInfo UMTSwitchingTable[UMTS_SWITCHING_COUNT]; |
mafischl | 0:d9266031f832 | 55 | |
mafischl | 0:d9266031f832 | 56 | ///UMTS Stick error codes |
mafischl | 0:d9266031f832 | 57 | enum UMTSStickErr |
mafischl | 0:d9266031f832 | 58 | { |
mafischl | 0:d9266031f832 | 59 | __UMTSERR_MIN = -0xFFFF, |
mafischl | 0:d9266031f832 | 60 | UMTSERR_NOTFOUND, ///<Stick was not found |
mafischl | 0:d9266031f832 | 61 | UMTSERR_NOTIMPLEMENTED, ///<This model is not implemented |
mafischl | 0:d9266031f832 | 62 | UMTSERR_USBERR, ///<USB Error |
mafischl | 0:d9266031f832 | 63 | UMTSERR_DISCONNECTED, ///<Stick disconnected |
mafischl | 0:d9266031f832 | 64 | UMTSERR_OK = 0 ///<Success |
mafischl | 0:d9266031f832 | 65 | }; |
mafischl | 0:d9266031f832 | 66 | |
mafischl | 0:d9266031f832 | 67 | class UMTSStick |
mafischl | 0:d9266031f832 | 68 | { |
mafischl | 0:d9266031f832 | 69 | public: |
mafischl | 0:d9266031f832 | 70 | UMTSStick(); |
mafischl | 0:d9266031f832 | 71 | ~UMTSStick(); |
mafischl | 0:d9266031f832 | 72 | |
mafischl | 0:d9266031f832 | 73 | UMTSStickErr getSerial(UsbSerial** ppUsbSerial); |
mafischl | 0:d9266031f832 | 74 | |
mafischl | 0:d9266031f832 | 75 | private: |
mafischl | 0:d9266031f832 | 76 | UMTSStickErr waitForDevice(); |
mafischl | 0:d9266031f832 | 77 | UMTSStickErr checkDeviceState(const UMTSSwitchingInfo* pInfo, bool* pCdfs); |
mafischl | 0:d9266031f832 | 78 | |
mafischl | 0:d9266031f832 | 79 | UMTSStickErr switchMode(const UMTSSwitchingInfo* pInfo); |
mafischl | 0:d9266031f832 | 80 | UMTSStickErr findSerial(UsbSerial** ppUsbSerial); |
mafischl | 0:d9266031f832 | 81 | |
mafischl | 0:d9266031f832 | 82 | |
mafischl | 0:d9266031f832 | 83 | UsbHostMgr m_host; |
mafischl | 0:d9266031f832 | 84 | UsbDevice* m_pDev; |
mafischl | 0:d9266031f832 | 85 | }; |
mafischl | 0:d9266031f832 | 86 | |
mafischl | 0:d9266031f832 | 87 | #endif |