X-TOUCH to djay bridge

Dependencies:   mbed mbed-rtos FATFileSystem

Committer:
okini3939
Date:
Wed Jun 05 04:54:37 2019 +0000
Revision:
1:0dac72ab5910
sample

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okini3939 1:0dac72ab5910 1 /* Copyright (c) 2010-2012 mbed.org, MIT License
okini3939 1:0dac72ab5910 2 *
okini3939 1:0dac72ab5910 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
okini3939 1:0dac72ab5910 4 * and associated documentation files (the "Software"), to deal in the Software without
okini3939 1:0dac72ab5910 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
okini3939 1:0dac72ab5910 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
okini3939 1:0dac72ab5910 7 * Software is furnished to do so, subject to the following conditions:
okini3939 1:0dac72ab5910 8 *
okini3939 1:0dac72ab5910 9 * The above copyright notice and this permission notice shall be included in all copies or
okini3939 1:0dac72ab5910 10 * substantial portions of the Software.
okini3939 1:0dac72ab5910 11 *
okini3939 1:0dac72ab5910 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
okini3939 1:0dac72ab5910 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
okini3939 1:0dac72ab5910 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
okini3939 1:0dac72ab5910 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
okini3939 1:0dac72ab5910 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
okini3939 1:0dac72ab5910 17 */
okini3939 1:0dac72ab5910 18
okini3939 1:0dac72ab5910 19 #ifndef WANDONGLEINITIALIZER_H
okini3939 1:0dac72ab5910 20 #define WANDONGLEINITIALIZER_H
okini3939 1:0dac72ab5910 21
okini3939 1:0dac72ab5910 22 #include "USBHostConf.h"
okini3939 1:0dac72ab5910 23
okini3939 1:0dac72ab5910 24 #ifdef USBHOST_3GMODULE
okini3939 1:0dac72ab5910 25
okini3939 1:0dac72ab5910 26 #include <stdint.h>
okini3939 1:0dac72ab5910 27
okini3939 1:0dac72ab5910 28 #include "USBHost.h"
okini3939 1:0dac72ab5910 29 #include "IUSBEnumerator.h"
okini3939 1:0dac72ab5910 30
okini3939 1:0dac72ab5910 31 // [TODO] move these declarations to a proper place
okini3939 1:0dac72ab5910 32 #define WANDONGLE_MAX_SERIAL_PORTS 2
okini3939 1:0dac72ab5910 33 #define WANDONGLE_MAX_INITIALIZERS 6
okini3939 1:0dac72ab5910 34
okini3939 1:0dac72ab5910 35 #define WAN_DONGLE_TYPE_UNKNOWN (-1)
okini3939 1:0dac72ab5910 36
okini3939 1:0dac72ab5910 37 class WANDongleInitializer : public IUSBEnumerator
okini3939 1:0dac72ab5910 38 {
okini3939 1:0dac72ab5910 39 protected:
okini3939 1:0dac72ab5910 40 WANDongleInitializer(USBHost* pHost) { m_pHost = pHost; }
okini3939 1:0dac72ab5910 41 USBHost* m_pHost;
okini3939 1:0dac72ab5910 42 uint8_t m_serialIntfMap[WANDONGLE_MAX_SERIAL_PORTS];
okini3939 1:0dac72ab5910 43
okini3939 1:0dac72ab5910 44 public:
okini3939 1:0dac72ab5910 45 virtual ~WANDongleInitializer() {}
okini3939 1:0dac72ab5910 46 virtual uint16_t getMSDVid() = 0;
okini3939 1:0dac72ab5910 47 virtual uint16_t getMSDPid() = 0;
okini3939 1:0dac72ab5910 48
okini3939 1:0dac72ab5910 49 virtual uint16_t getSerialVid() = 0;
okini3939 1:0dac72ab5910 50 virtual uint16_t getSerialPid() = 0;
okini3939 1:0dac72ab5910 51
okini3939 1:0dac72ab5910 52 virtual bool switchMode(USBDeviceConnected* pDev) = 0;
okini3939 1:0dac72ab5910 53
okini3939 1:0dac72ab5910 54 virtual USBEndpoint* getEp(USBDeviceConnected* pDev, int serialPortNumber, bool tx) {
okini3939 1:0dac72ab5910 55 return pDev->getEndpoint(m_serialIntfMap[serialPortNumber], BULK_ENDPOINT, tx ? OUT : IN, 0);
okini3939 1:0dac72ab5910 56 }
okini3939 1:0dac72ab5910 57
okini3939 1:0dac72ab5910 58 virtual int getSerialPortCount() = 0;
okini3939 1:0dac72ab5910 59
okini3939 1:0dac72ab5910 60 virtual void setVidPid(uint16_t vid, uint16_t pid) = 0;
okini3939 1:0dac72ab5910 61
okini3939 1:0dac72ab5910 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
okini3939 1:0dac72ab5910 63
okini3939 1:0dac72ab5910 64 virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) = 0; //Must return true if the endpoint will be used
okini3939 1:0dac72ab5910 65
okini3939 1:0dac72ab5910 66 virtual int getType() = 0;
okini3939 1:0dac72ab5910 67
okini3939 1:0dac72ab5910 68 virtual uint8_t getSerialIntf(int index) { return m_serialIntfMap[index]; }
okini3939 1:0dac72ab5910 69 };
okini3939 1:0dac72ab5910 70
okini3939 1:0dac72ab5910 71 #endif /* USBHOST_3GMODULE */
okini3939 1:0dac72ab5910 72
okini3939 1:0dac72ab5910 73 #endif