Changes to support Vodafone K4606
Fork of USBHostWANDongle by
USB3GModule/WANDongle.h@6:075e36a3463e, 2012-07-27 (annotated)
- Committer:
- donatien
- Date:
- Fri Jul 27 16:14:07 2012 +0000
- Revision:
- 6:075e36a3463e
- Parent:
- 3:4394986752db
- Child:
- 8:0d1ec493842c
New enumeration model to only instantiate needed endpoints
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 0:ae46a0638b2c | 1 | /* Copyright (c) 2010-2011 mbed.org, MIT License |
donatien | 0:ae46a0638b2c | 2 | * |
donatien | 0:ae46a0638b2c | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
donatien | 0:ae46a0638b2c | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
donatien | 0:ae46a0638b2c | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
donatien | 0:ae46a0638b2c | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
donatien | 0:ae46a0638b2c | 7 | * Software is furnished to do so, subject to the following conditions: |
donatien | 0:ae46a0638b2c | 8 | * |
donatien | 0:ae46a0638b2c | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
donatien | 0:ae46a0638b2c | 10 | * substantial portions of the Software. |
donatien | 0:ae46a0638b2c | 11 | * |
donatien | 0:ae46a0638b2c | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
donatien | 0:ae46a0638b2c | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
donatien | 0:ae46a0638b2c | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
donatien | 0:ae46a0638b2c | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
donatien | 0:ae46a0638b2c | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
donatien | 0:ae46a0638b2c | 17 | */ |
donatien | 0:ae46a0638b2c | 18 | |
donatien | 0:ae46a0638b2c | 19 | #ifndef WANDONGLE_H |
donatien | 0:ae46a0638b2c | 20 | #define WANDONGLE_H |
donatien | 0:ae46a0638b2c | 21 | |
donatien | 0:ae46a0638b2c | 22 | #include "USBHost.h" |
donatien | 0:ae46a0638b2c | 23 | #include "IUSBHostSerial.h" |
donatien | 0:ae46a0638b2c | 24 | |
donatien | 0:ae46a0638b2c | 25 | #include "rtos.h" |
donatien | 0:ae46a0638b2c | 26 | |
donatien | 3:4394986752db | 27 | #include "WANDongleSerialPort.h" |
donatien | 6:075e36a3463e | 28 | #include "WANDongleInitializer.h" |
donatien | 6:075e36a3463e | 29 | #include "IUSBEnumerator.h" |
donatien | 0:ae46a0638b2c | 30 | |
donatien | 0:ae46a0638b2c | 31 | #define WANDONGLE_MAX_OUTEP_SIZE 64 |
donatien | 0:ae46a0638b2c | 32 | #define WANDONGLE_MAX_INEP_SIZE 64 |
donatien | 0:ae46a0638b2c | 33 | |
donatien | 2:a8b2d0cd9bbd | 34 | #define WANDONGLE_MAX_SERIAL_PORTS 2 |
donatien | 2:a8b2d0cd9bbd | 35 | |
donatien | 0:ae46a0638b2c | 36 | /** A class to use a WAN (3G/LTE) access dongle |
donatien | 0:ae46a0638b2c | 37 | * |
donatien | 0:ae46a0638b2c | 38 | */ |
donatien | 6:075e36a3463e | 39 | class WANDongle : public IUSBEnumerator { |
donatien | 0:ae46a0638b2c | 40 | public: |
donatien | 0:ae46a0638b2c | 41 | /* |
donatien | 0:ae46a0638b2c | 42 | * Constructor |
donatien | 0:ae46a0638b2c | 43 | * |
donatien | 0:ae46a0638b2c | 44 | * @param rootdir mount name |
donatien | 0:ae46a0638b2c | 45 | */ |
donatien | 0:ae46a0638b2c | 46 | WANDongle(); |
donatien | 0:ae46a0638b2c | 47 | |
donatien | 0:ae46a0638b2c | 48 | /* |
donatien | 0:ae46a0638b2c | 49 | * Check if a serial port device is connected |
donatien | 0:ae46a0638b2c | 50 | * |
donatien | 0:ae46a0638b2c | 51 | * @return true if a serial device is connected |
donatien | 0:ae46a0638b2c | 52 | */ |
donatien | 0:ae46a0638b2c | 53 | bool connected(); |
donatien | 0:ae46a0638b2c | 54 | |
donatien | 0:ae46a0638b2c | 55 | /* |
donatien | 0:ae46a0638b2c | 56 | * Try to connect device |
donatien | 0:ae46a0638b2c | 57 | * |
donatien | 0:ae46a0638b2c | 58 | * * @return true if connection was successful |
donatien | 0:ae46a0638b2c | 59 | */ |
donatien | 0:ae46a0638b2c | 60 | bool tryConnect(); |
donatien | 0:ae46a0638b2c | 61 | |
donatien | 3:4394986752db | 62 | IUSBHostSerial& getSerial(int index); |
donatien | 2:a8b2d0cd9bbd | 63 | int getSerialCount(); |
donatien | 0:ae46a0638b2c | 64 | |
donatien | 6:075e36a3463e | 65 | //From IUSBEnumerator |
donatien | 6:075e36a3463e | 66 | |
donatien | 6:075e36a3463e | 67 | virtual void setVidPid(uint16_t vid, uint16_t pid); |
donatien | 6:075e36a3463e | 68 | |
donatien | 6:075e36a3463e | 69 | virtual bool parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol); //Must return true if the interface should be parsed |
donatien | 6:075e36a3463e | 70 | |
donatien | 6:075e36a3463e | 71 | virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used |
donatien | 6:075e36a3463e | 72 | |
donatien | 0:ae46a0638b2c | 73 | protected: |
donatien | 0:ae46a0638b2c | 74 | USBHost * host; |
donatien | 0:ae46a0638b2c | 75 | USBDeviceConnected * dev; |
donatien | 0:ae46a0638b2c | 76 | bool dev_connected; |
donatien | 6:075e36a3463e | 77 | |
donatien | 6:075e36a3463e | 78 | WANDongleInitializer* m_pInitializer; |
donatien | 0:ae46a0638b2c | 79 | |
donatien | 2:a8b2d0cd9bbd | 80 | void init(); |
donatien | 0:ae46a0638b2c | 81 | |
donatien | 2:a8b2d0cd9bbd | 82 | WANDongleSerialPort m_serial[WANDONGLE_MAX_SERIAL_PORTS]; |
donatien | 2:a8b2d0cd9bbd | 83 | int m_serialCount; |
donatien | 0:ae46a0638b2c | 84 | }; |
donatien | 0:ae46a0638b2c | 85 | |
donatien | 0:ae46a0638b2c | 86 | #endif |