Changes to support Vodafone K4606
Fork of USBHostWANDongle by
USB3GModule/WANDongleInitializer.h@20:3abcf818be31, 2012-12-13 (annotated)
- Committer:
- ashleymills
- Date:
- Thu Dec 13 14:56:55 2012 +0000
- Revision:
- 20:3abcf818be31
- Parent:
- 10:08bce4cd973a
- Child:
- 21:dcc8c866ccbb
Added stuff for K3773 support
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 10:08bce4cd973a | 1 | /* Copyright (c) 2010-2012 mbed.org, MIT License |
donatien | 8:0d1ec493842c | 2 | * |
donatien | 8:0d1ec493842c | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
donatien | 8:0d1ec493842c | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
donatien | 8:0d1ec493842c | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
donatien | 8:0d1ec493842c | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
donatien | 8:0d1ec493842c | 7 | * Software is furnished to do so, subject to the following conditions: |
donatien | 8:0d1ec493842c | 8 | * |
donatien | 8:0d1ec493842c | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
donatien | 8:0d1ec493842c | 10 | * substantial portions of the Software. |
donatien | 8:0d1ec493842c | 11 | * |
donatien | 8:0d1ec493842c | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
donatien | 8:0d1ec493842c | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
donatien | 8:0d1ec493842c | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
donatien | 8:0d1ec493842c | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
donatien | 8:0d1ec493842c | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
donatien | 8:0d1ec493842c | 17 | */ |
donatien | 8:0d1ec493842c | 18 | |
donatien | 8:0d1ec493842c | 19 | #ifndef WANDONGLEINITIALIZER_H |
donatien | 8:0d1ec493842c | 20 | #define WANDONGLEINITIALIZER_H |
donatien | 8:0d1ec493842c | 21 | |
donatien | 8:0d1ec493842c | 22 | #include <cstdint> |
donatien | 8:0d1ec493842c | 23 | using std::uint16_t; |
donatien | 8:0d1ec493842c | 24 | using std::uint32_t; |
donatien | 8:0d1ec493842c | 25 | |
donatien | 8:0d1ec493842c | 26 | #include "USBHost.h" |
donatien | 8:0d1ec493842c | 27 | #include "IUSBEnumerator.h" |
donatien | 8:0d1ec493842c | 28 | |
donatien | 8:0d1ec493842c | 29 | enum WAN_DONGLE_TYPE |
donatien | 8:0d1ec493842c | 30 | { |
donatien | 8:0d1ec493842c | 31 | WAN_DONGLE_TYPE_UNKNOWN = -1, |
donatien | 8:0d1ec493842c | 32 | WAN_DONGLE_TYPE_VODAFONEK3770 = 0, |
donatien | 8:0d1ec493842c | 33 | WAN_DONGLE_TYPE_VODAFONEK3772Z = 1, |
ashleymills | 20:3abcf818be31 | 34 | WAN_DONGLE_TYPE_VODAFONEK3773 = 2, |
donatien | 8:0d1ec493842c | 35 | }; |
donatien | 8:0d1ec493842c | 36 | |
donatien | 8:0d1ec493842c | 37 | class WANDongleInitializer : public IUSBEnumerator |
donatien | 8:0d1ec493842c | 38 | { |
donatien | 8:0d1ec493842c | 39 | protected: |
donatien | 8:0d1ec493842c | 40 | WANDongleInitializer(USBHost* pHost); |
donatien | 8:0d1ec493842c | 41 | USBHost* m_pHost; |
donatien | 8:0d1ec493842c | 42 | |
donatien | 8:0d1ec493842c | 43 | public: |
donatien | 8:0d1ec493842c | 44 | virtual uint16_t getMSDVid() = 0; |
donatien | 8:0d1ec493842c | 45 | virtual uint16_t getMSDPid() = 0; |
donatien | 8:0d1ec493842c | 46 | |
donatien | 8:0d1ec493842c | 47 | virtual uint16_t getSerialVid() = 0; |
donatien | 8:0d1ec493842c | 48 | virtual uint16_t getSerialPid() = 0; |
donatien | 8:0d1ec493842c | 49 | |
donatien | 8:0d1ec493842c | 50 | virtual bool switchMode(USBDeviceConnected* pDev) = 0; |
donatien | 8:0d1ec493842c | 51 | |
donatien | 9:c9e9817c398c | 52 | virtual USBEndpoint* getEp(USBDeviceConnected* pDev, int serialPortNumber, bool tx) = 0; |
donatien | 8:0d1ec493842c | 53 | |
donatien | 8:0d1ec493842c | 54 | virtual int getSerialPortCount() = 0; |
donatien | 8:0d1ec493842c | 55 | |
donatien | 8:0d1ec493842c | 56 | virtual void setVidPid(uint16_t vid, uint16_t pid) = 0; |
donatien | 8:0d1ec493842c | 57 | |
donatien | 8:0d1ec493842c | 58 | virtual bool parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol) = 0; //Must return true if the interface should be parsed |
donatien | 8:0d1ec493842c | 59 | |
donatien | 8:0d1ec493842c | 60 | virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) = 0; //Must return true if the endpoint will be used |
donatien | 8:0d1ec493842c | 61 | |
donatien | 8:0d1ec493842c | 62 | virtual WAN_DONGLE_TYPE getType() = 0; |
donatien | 8:0d1ec493842c | 63 | |
donatien | 8:0d1ec493842c | 64 | static WANDongleInitializer** getInitializers(USBHost* pHost); |
donatien | 8:0d1ec493842c | 65 | }; |
donatien | 8:0d1ec493842c | 66 | |
donatien | 8:0d1ec493842c | 67 | class VodafoneK3770Initializer : public WANDongleInitializer |
donatien | 8:0d1ec493842c | 68 | { |
donatien | 8:0d1ec493842c | 69 | public: |
donatien | 8:0d1ec493842c | 70 | VodafoneK3770Initializer(USBHost* pHost); |
donatien | 8:0d1ec493842c | 71 | |
donatien | 8:0d1ec493842c | 72 | virtual uint16_t getMSDVid(); |
donatien | 8:0d1ec493842c | 73 | virtual uint16_t getMSDPid(); |
donatien | 8:0d1ec493842c | 74 | |
donatien | 8:0d1ec493842c | 75 | virtual uint16_t getSerialVid(); |
donatien | 8:0d1ec493842c | 76 | virtual uint16_t getSerialPid(); |
donatien | 8:0d1ec493842c | 77 | |
donatien | 8:0d1ec493842c | 78 | virtual bool switchMode(USBDeviceConnected* pDev); |
donatien | 8:0d1ec493842c | 79 | |
donatien | 9:c9e9817c398c | 80 | virtual USBEndpoint* getEp(USBDeviceConnected* pDev, int serialPortNumber, bool tx); |
donatien | 8:0d1ec493842c | 81 | |
donatien | 8:0d1ec493842c | 82 | virtual int getSerialPortCount(); |
donatien | 8:0d1ec493842c | 83 | |
donatien | 8:0d1ec493842c | 84 | virtual void setVidPid(uint16_t vid, uint16_t pid); |
donatien | 8:0d1ec493842c | 85 | |
donatien | 8:0d1ec493842c | 86 | 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 | 8:0d1ec493842c | 87 | |
donatien | 8:0d1ec493842c | 88 | virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used |
donatien | 8:0d1ec493842c | 89 | |
donatien | 8:0d1ec493842c | 90 | virtual WAN_DONGLE_TYPE getType(); |
donatien | 8:0d1ec493842c | 91 | |
donatien | 8:0d1ec493842c | 92 | private: |
donatien | 8:0d1ec493842c | 93 | |
donatien | 8:0d1ec493842c | 94 | bool m_hasSwitched; |
donatien | 8:0d1ec493842c | 95 | int m_currentSerialIntf; |
donatien | 8:0d1ec493842c | 96 | int m_endpointsToFetch; |
donatien | 8:0d1ec493842c | 97 | }; |
donatien | 8:0d1ec493842c | 98 | |
ashleymills | 20:3abcf818be31 | 99 | class VodafoneK3773Initializer : public WANDongleInitializer |
ashleymills | 20:3abcf818be31 | 100 | { |
ashleymills | 20:3abcf818be31 | 101 | public: |
ashleymills | 20:3abcf818be31 | 102 | VodafoneK3773Initializer(USBHost* pHost); |
ashleymills | 20:3abcf818be31 | 103 | |
ashleymills | 20:3abcf818be31 | 104 | virtual uint16_t getMSDVid(); |
ashleymills | 20:3abcf818be31 | 105 | virtual uint16_t getMSDPid(); |
ashleymills | 20:3abcf818be31 | 106 | |
ashleymills | 20:3abcf818be31 | 107 | virtual uint16_t getSerialVid(); |
ashleymills | 20:3abcf818be31 | 108 | virtual uint16_t getSerialPid(); |
ashleymills | 20:3abcf818be31 | 109 | |
ashleymills | 20:3abcf818be31 | 110 | virtual bool switchMode(USBDeviceConnected* pDev); |
ashleymills | 20:3abcf818be31 | 111 | |
ashleymills | 20:3abcf818be31 | 112 | virtual USBEndpoint* getEp(USBDeviceConnected* pDev, int serialPortNumber, bool tx); |
ashleymills | 20:3abcf818be31 | 113 | |
ashleymills | 20:3abcf818be31 | 114 | virtual int getSerialPortCount(); |
ashleymills | 20:3abcf818be31 | 115 | |
ashleymills | 20:3abcf818be31 | 116 | virtual void setVidPid(uint16_t vid, uint16_t pid); |
ashleymills | 20:3abcf818be31 | 117 | |
ashleymills | 20:3abcf818be31 | 118 | 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 |
ashleymills | 20:3abcf818be31 | 119 | |
ashleymills | 20:3abcf818be31 | 120 | virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used |
ashleymills | 20:3abcf818be31 | 121 | |
ashleymills | 20:3abcf818be31 | 122 | virtual WAN_DONGLE_TYPE getType(); |
ashleymills | 20:3abcf818be31 | 123 | |
ashleymills | 20:3abcf818be31 | 124 | private: |
ashleymills | 20:3abcf818be31 | 125 | |
ashleymills | 20:3abcf818be31 | 126 | bool m_hasSwitched; |
ashleymills | 20:3abcf818be31 | 127 | int m_currentSerialIntf; |
ashleymills | 20:3abcf818be31 | 128 | int m_endpointsToFetch; |
ashleymills | 20:3abcf818be31 | 129 | }; |
ashleymills | 20:3abcf818be31 | 130 | |
donatien | 8:0d1ec493842c | 131 | class VodafoneK3772ZInitializer : public WANDongleInitializer |
donatien | 8:0d1ec493842c | 132 | { |
donatien | 8:0d1ec493842c | 133 | public: |
donatien | 8:0d1ec493842c | 134 | VodafoneK3772ZInitializer(USBHost* pHost); |
donatien | 8:0d1ec493842c | 135 | |
donatien | 8:0d1ec493842c | 136 | virtual uint16_t getMSDVid(); |
donatien | 8:0d1ec493842c | 137 | virtual uint16_t getMSDPid(); |
donatien | 8:0d1ec493842c | 138 | |
donatien | 8:0d1ec493842c | 139 | virtual uint16_t getSerialVid(); |
donatien | 8:0d1ec493842c | 140 | virtual uint16_t getSerialPid(); |
donatien | 8:0d1ec493842c | 141 | |
donatien | 8:0d1ec493842c | 142 | virtual bool switchMode(USBDeviceConnected* pDev); |
donatien | 8:0d1ec493842c | 143 | |
donatien | 9:c9e9817c398c | 144 | virtual USBEndpoint* getEp(USBDeviceConnected* pDev, int serialPortNumber, bool tx); |
donatien | 8:0d1ec493842c | 145 | |
donatien | 8:0d1ec493842c | 146 | virtual int getSerialPortCount(); |
donatien | 8:0d1ec493842c | 147 | |
donatien | 8:0d1ec493842c | 148 | virtual void setVidPid(uint16_t vid, uint16_t pid); |
donatien | 8:0d1ec493842c | 149 | |
donatien | 8:0d1ec493842c | 150 | 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 | 8:0d1ec493842c | 151 | |
donatien | 8:0d1ec493842c | 152 | virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used |
donatien | 8:0d1ec493842c | 153 | |
donatien | 8:0d1ec493842c | 154 | virtual WAN_DONGLE_TYPE getType(); |
donatien | 8:0d1ec493842c | 155 | |
donatien | 8:0d1ec493842c | 156 | private: |
donatien | 8:0d1ec493842c | 157 | |
donatien | 8:0d1ec493842c | 158 | bool m_hasSwitched; |
donatien | 8:0d1ec493842c | 159 | int m_currentSerialIntf; |
donatien | 8:0d1ec493842c | 160 | int m_endpointsToFetch; |
donatien | 8:0d1ec493842c | 161 | }; |
donatien | 8:0d1ec493842c | 162 | |
donatien | 8:0d1ec493842c | 163 | #endif |