USB BARCODE READER
Fork of USBHOST by
USBHost3GModule/WANDongleInitializer.h@7:ccd0ac9ae1c9, 2018-07-02 (annotated)
- Committer:
- shivanandgowdakr
- Date:
- Mon Jul 02 12:10:45 2018 +0000
- Revision:
- 7:ccd0ac9ae1c9
- Parent:
- 1:ab240722d7ef
USB BARCODE READER ;
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 | #ifndef WANDONGLEINITIALIZER_H |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 20 | #define WANDONGLEINITIALIZER_H |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 21 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 22 | #include "USBHostConf.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 23 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 24 | #ifdef USBHOST_3GMODULE |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 25 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 26 | #include <stdint.h> |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 27 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 28 | #include "USBHost.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 29 | #include "IUSBEnumerator.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 30 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 31 | // [TODO] move these declarations to a proper place |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 32 | #define WANDONGLE_MAX_SERIAL_PORTS 2 |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 33 | #define WANDONGLE_MAX_INITIALIZERS 6 |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 34 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 35 | #define WAN_DONGLE_TYPE_UNKNOWN (-1) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 36 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 37 | class WANDongleInitializer : public IUSBEnumerator |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 38 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 39 | protected: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 40 | WANDongleInitializer(USBHost* pHost) { m_pHost = pHost; } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 41 | USBHost* m_pHost; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 42 | uint8_t m_serialIntfMap[WANDONGLE_MAX_SERIAL_PORTS]; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 43 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 44 | public: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 45 | virtual ~WANDongleInitializer() {} |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 46 | virtual uint16_t getMSDVid() = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 47 | virtual uint16_t getMSDPid() = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 48 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 49 | virtual uint16_t getSerialVid() = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 50 | virtual uint16_t getSerialPid() = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 51 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 52 | virtual bool switchMode(USBDeviceConnected* pDev) = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 53 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 54 | virtual USBEndpoint* getEp(USBDeviceConnected* pDev, int serialPortNumber, bool tx) { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 55 | return pDev->getEndpoint(m_serialIntfMap[serialPortNumber], BULK_ENDPOINT, tx ? OUT : IN, 0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 56 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 57 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 58 | virtual int getSerialPortCount() = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 59 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 60 | virtual void setVidPid(uint16_t vid, uint16_t pid) = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 61 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 62 | 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 |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 63 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 64 | virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) = 0; //Must return true if the endpoint will be used |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 65 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 66 | virtual int getType() = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 67 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 68 | virtual uint8_t getSerialIntf(int index) { return m_serialIntfMap[index]; } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 69 | }; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 70 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 71 | #endif /* USBHOST_3GMODULE */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 72 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 73 | #endif |