USB BARCODE READER
Fork of USBHOST by
USBHost3GModule/WANDongle.cpp@1:ab240722d7ef, 2017-02-15 (annotated)
- Committer:
- frq08711@LMECWL0871.LME.ST.COM
- Date:
- Wed Feb 15 10:49:44 2017 +0100
- Revision:
- 1:ab240722d7ef
update to mbed 5.3.5
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 1 | /* Copyright (c) 2010-2012 mbed.org, MIT License |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 2 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 7 | * Software is furnished to do so, subject to the following conditions: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 8 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 10 | * substantial portions of the Software. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 11 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 17 | */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 18 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 19 | #include "USBHostConf.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 20 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 21 | #ifdef USBHOST_3GMODULE |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 22 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 23 | #include "dbg.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 24 | #include <stdint.h> |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 25 | #include "rtos.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 26 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 27 | #include "WANDongle.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 28 | #include "WANDongleInitializer.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 29 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 30 | WANDongle::WANDongle() : m_pInitializer(NULL), m_serialCount(0), m_totalInitializers(0) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 31 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 32 | host = USBHost::getHostInst(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 33 | init(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 34 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 35 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 36 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 37 | bool WANDongle::connected() { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 38 | return dev_connected; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 39 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 40 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 41 | bool WANDongle::tryConnect() |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 42 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 43 | //FIXME should run on USB thread |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 44 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 45 | USB_DBG("Trying to connect device"); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 46 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 47 | if (dev_connected) { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 48 | USB_DBG("Device is already connected!"); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 49 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 50 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 51 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 52 | m_pInitializer = NULL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 53 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 54 | //Protect from concurrent access from USB thread |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 55 | USBHost::Lock lock(host); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 56 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 57 | for (int i = 0; i < MAX_DEVICE_CONNECTED; i++) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 58 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 59 | if ((dev = host->getDevice(i)) != NULL) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 60 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 61 | m_pInitializer = NULL; //Will be set in setVidPid callback |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 62 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 63 | USB_DBG("Enumerate"); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 64 | int ret = host->enumerate(dev, this); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 65 | if(ret) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 66 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 67 | return false; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 68 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 69 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 70 | USB_DBG("Device has VID:%04x PID:%04x", dev->getVid(), dev->getPid()); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 71 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 72 | if(m_pInitializer) //If an initializer has been found |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 73 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 74 | USB_DBG("m_pInitializer=%p", m_pInitializer); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 75 | USB_DBG("m_pInitializer->getSerialVid()=%04x", m_pInitializer->getSerialVid()); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 76 | USB_DBG("m_pInitializer->getSerialPid()=%04x", m_pInitializer->getSerialPid()); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 77 | if ((dev->getVid() == m_pInitializer->getSerialVid()) && (dev->getPid() == m_pInitializer->getSerialPid())) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 78 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 79 | USB_DBG("The dongle is in virtual serial mode"); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 80 | host->registerDriver(dev, 0, this, &WANDongle::init); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 81 | m_serialCount = m_pInitializer->getSerialPortCount(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 82 | if( m_serialCount > WANDONGLE_MAX_SERIAL_PORTS ) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 83 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 84 | m_serialCount = WANDONGLE_MAX_SERIAL_PORTS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 85 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 86 | for(int j = 0; j < m_serialCount; j++) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 87 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 88 | USB_DBG("Connecting serial port #%d", j+1); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 89 | USB_DBG("Ep %p", m_pInitializer->getEp(dev, j, false)); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 90 | USB_DBG("Ep %p", m_pInitializer->getEp(dev, j, true)); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 91 | m_serial[j].connect( dev, m_pInitializer->getEp(dev, j, false), m_pInitializer->getEp(dev, j, true) ); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 92 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 93 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 94 | USB_DBG("Device connected"); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 95 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 96 | dev_connected = true; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 97 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 98 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 99 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 100 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 101 | else if ((dev->getVid() == m_pInitializer->getMSDVid()) && (dev->getPid() == m_pInitializer->getMSDPid())) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 102 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 103 | USB_DBG("Vodafone K3370 dongle detected in MSD mode"); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 104 | //Try to switch |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 105 | if( m_pInitializer->switchMode(dev) ) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 106 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 107 | USB_DBG("Switched OK"); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 108 | return false; //Will be connected on a next iteration |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 109 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 110 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 111 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 112 | USB_ERR("Could not switch mode"); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 113 | return false; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 114 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 115 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 116 | } //if() |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 117 | } //if() |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 118 | } //for() |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 119 | return false; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 120 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 121 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 122 | bool WANDongle::disconnect() |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 123 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 124 | dev_connected = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 125 | for(int i = 0; i < WANDONGLE_MAX_SERIAL_PORTS; i++) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 126 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 127 | m_serial[i].disconnect(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 128 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 129 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 130 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 131 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 132 | int WANDongle::getDongleType() |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 133 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 134 | if( m_pInitializer != NULL ) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 135 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 136 | return m_pInitializer->getType(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 137 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 138 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 139 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 140 | return WAN_DONGLE_TYPE_UNKNOWN; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 141 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 142 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 143 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 144 | IUSBHostSerial& WANDongle::getSerial(int index) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 145 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 146 | return m_serial[index]; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 147 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 148 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 149 | int WANDongle::getSerialCount() |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 150 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 151 | return m_serialCount; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 152 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 153 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 154 | //Private methods |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 155 | void WANDongle::init() |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 156 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 157 | m_pInitializer = NULL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 158 | dev_connected = false; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 159 | for(int i = 0; i < WANDONGLE_MAX_SERIAL_PORTS; i++) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 160 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 161 | m_serial[i].init(host); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 162 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 163 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 164 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 165 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 166 | /*virtual*/ void WANDongle::setVidPid(uint16_t vid, uint16_t pid) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 167 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 168 | WANDongleInitializer* initializer; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 169 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 170 | for(int i = 0; i < m_totalInitializers; i++) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 171 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 172 | initializer = m_Initializers[i]; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 173 | USB_DBG("initializer=%p", initializer); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 174 | USB_DBG("initializer->getSerialVid()=%04x", initializer->getSerialVid()); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 175 | USB_DBG("initializer->getSerialPid()=%04x", initializer->getSerialPid()); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 176 | if ((dev->getVid() == initializer->getSerialVid()) && (dev->getPid() == initializer->getSerialPid())) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 177 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 178 | USB_DBG("The dongle is in virtual serial mode"); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 179 | m_pInitializer = initializer; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 180 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 181 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 182 | else if ((dev->getVid() == initializer->getMSDVid()) && (dev->getPid() == initializer->getMSDPid())) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 183 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 184 | USB_DBG("Dongle detected in MSD mode"); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 185 | m_pInitializer = initializer; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 186 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 187 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 188 | initializer++; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 189 | } //for |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 190 | if(m_pInitializer) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 191 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 192 | m_pInitializer->setVidPid(vid, pid); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 193 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 194 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 195 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 196 | /*virtual*/ bool WANDongle::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 |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 197 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 198 | if(m_pInitializer) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 199 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 200 | return m_pInitializer->parseInterface(intf_nb, intf_class, intf_subclass, intf_protocol); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 201 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 202 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 203 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 204 | return false; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 205 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 206 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 207 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 208 | /*virtual*/ bool WANDongle::useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) //Must return true if the endpoint will be used |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 209 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 210 | if(m_pInitializer) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 211 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 212 | return m_pInitializer->useEndpoint(intf_nb, type, dir); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 213 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 214 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 215 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 216 | return false; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 217 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 218 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 219 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 220 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 221 | bool WANDongle::addInitializer(WANDongleInitializer* pInitializer) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 222 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 223 | if (m_totalInitializers >= WANDONGLE_MAX_INITIALIZERS) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 224 | return false; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 225 | m_Initializers[m_totalInitializers++] = pInitializer; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 226 | return true; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 227 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 228 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 229 | WANDongle::~WANDongle() |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 230 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 231 | for(int i = 0; i < m_totalInitializers; i++) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 232 | delete m_Initializers[i]; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 233 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 234 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 235 | #endif /* USBHOST_3GMODULE */ |