Opencv 3.1 project on GR-PEACH board
Fork of gr-peach-opencv-project by
USBHost_custom/USBHost3GModule/WANDongle.h@170:54ff26da7eb6, 2017-07-04 (annotated)
- Committer:
- thedo
- Date:
- Tue Jul 04 06:23:13 2017 +0000
- Revision:
- 170:54ff26da7eb6
- Parent:
- 166:3a9487d57a5c
project opencv 3.1 on GR PEACH board, no use SD card.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thedo | 166:3a9487d57a5c | 1 | /* Copyright (c) 2010-2012 mbed.org, MIT License |
thedo | 166:3a9487d57a5c | 2 | * |
thedo | 166:3a9487d57a5c | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
thedo | 166:3a9487d57a5c | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
thedo | 166:3a9487d57a5c | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
thedo | 166:3a9487d57a5c | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
thedo | 166:3a9487d57a5c | 7 | * Software is furnished to do so, subject to the following conditions: |
thedo | 166:3a9487d57a5c | 8 | * |
thedo | 166:3a9487d57a5c | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
thedo | 166:3a9487d57a5c | 10 | * substantial portions of the Software. |
thedo | 166:3a9487d57a5c | 11 | * |
thedo | 166:3a9487d57a5c | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
thedo | 166:3a9487d57a5c | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
thedo | 166:3a9487d57a5c | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
thedo | 166:3a9487d57a5c | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
thedo | 166:3a9487d57a5c | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
thedo | 166:3a9487d57a5c | 17 | */ |
thedo | 166:3a9487d57a5c | 18 | |
thedo | 166:3a9487d57a5c | 19 | #ifndef WANDONGLE_H |
thedo | 166:3a9487d57a5c | 20 | #define WANDONGLE_H |
thedo | 166:3a9487d57a5c | 21 | |
thedo | 166:3a9487d57a5c | 22 | #include "USBHostConf.h" |
thedo | 166:3a9487d57a5c | 23 | |
thedo | 166:3a9487d57a5c | 24 | #ifdef USBHOST_3GMODULE |
thedo | 166:3a9487d57a5c | 25 | |
thedo | 166:3a9487d57a5c | 26 | #include "USBHost.h" |
thedo | 166:3a9487d57a5c | 27 | #include "IUSBHostSerial.h" |
thedo | 166:3a9487d57a5c | 28 | |
thedo | 166:3a9487d57a5c | 29 | #include "rtos.h" |
thedo | 166:3a9487d57a5c | 30 | |
thedo | 166:3a9487d57a5c | 31 | #include "WANDongleSerialPort.h" |
thedo | 166:3a9487d57a5c | 32 | #include "WANDongleInitializer.h" |
thedo | 166:3a9487d57a5c | 33 | #include "IUSBEnumerator.h" |
thedo | 166:3a9487d57a5c | 34 | |
thedo | 166:3a9487d57a5c | 35 | #define WANDONGLE_MAX_OUTEP_SIZE 64 |
thedo | 166:3a9487d57a5c | 36 | #define WANDONGLE_MAX_INEP_SIZE 64 |
thedo | 166:3a9487d57a5c | 37 | |
thedo | 166:3a9487d57a5c | 38 | /** A class to use a WAN (3G/LTE) access dongle |
thedo | 166:3a9487d57a5c | 39 | * |
thedo | 166:3a9487d57a5c | 40 | */ |
thedo | 166:3a9487d57a5c | 41 | class WANDongle : public IUSBEnumerator { |
thedo | 166:3a9487d57a5c | 42 | public: |
thedo | 166:3a9487d57a5c | 43 | /* |
thedo | 166:3a9487d57a5c | 44 | * Constructor |
thedo | 166:3a9487d57a5c | 45 | * |
thedo | 166:3a9487d57a5c | 46 | * @param rootdir mount name |
thedo | 166:3a9487d57a5c | 47 | */ |
thedo | 166:3a9487d57a5c | 48 | WANDongle(); |
thedo | 166:3a9487d57a5c | 49 | |
thedo | 166:3a9487d57a5c | 50 | /* |
thedo | 166:3a9487d57a5c | 51 | * Destructor |
thedo | 166:3a9487d57a5c | 52 | */ |
thedo | 166:3a9487d57a5c | 53 | virtual ~WANDongle(); |
thedo | 166:3a9487d57a5c | 54 | |
thedo | 166:3a9487d57a5c | 55 | /* |
thedo | 166:3a9487d57a5c | 56 | * Check if a serial port device is connected |
thedo | 166:3a9487d57a5c | 57 | * |
thedo | 166:3a9487d57a5c | 58 | * @return true if a serial device is connected |
thedo | 166:3a9487d57a5c | 59 | */ |
thedo | 166:3a9487d57a5c | 60 | bool connected(); |
thedo | 166:3a9487d57a5c | 61 | |
thedo | 166:3a9487d57a5c | 62 | /* |
thedo | 166:3a9487d57a5c | 63 | * Try to connect device |
thedo | 166:3a9487d57a5c | 64 | * |
thedo | 166:3a9487d57a5c | 65 | * * @return true if connection was successful |
thedo | 166:3a9487d57a5c | 66 | */ |
thedo | 166:3a9487d57a5c | 67 | bool tryConnect(); |
thedo | 166:3a9487d57a5c | 68 | |
thedo | 166:3a9487d57a5c | 69 | /* |
thedo | 166:3a9487d57a5c | 70 | * Disconnect device |
thedo | 166:3a9487d57a5c | 71 | * |
thedo | 166:3a9487d57a5c | 72 | * * @return true if disconnection was successful |
thedo | 166:3a9487d57a5c | 73 | */ |
thedo | 166:3a9487d57a5c | 74 | bool disconnect(); |
thedo | 166:3a9487d57a5c | 75 | |
thedo | 166:3a9487d57a5c | 76 | int getDongleType(); |
thedo | 166:3a9487d57a5c | 77 | |
thedo | 166:3a9487d57a5c | 78 | IUSBHostSerial& getSerial(int index); |
thedo | 166:3a9487d57a5c | 79 | int getSerialCount(); |
thedo | 166:3a9487d57a5c | 80 | bool addInitializer(WANDongleInitializer* pInitializer); |
thedo | 166:3a9487d57a5c | 81 | |
thedo | 166:3a9487d57a5c | 82 | //From IUSBEnumerator |
thedo | 166:3a9487d57a5c | 83 | |
thedo | 166:3a9487d57a5c | 84 | virtual void setVidPid(uint16_t vid, uint16_t pid); |
thedo | 166:3a9487d57a5c | 85 | |
thedo | 166:3a9487d57a5c | 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 |
thedo | 166:3a9487d57a5c | 87 | |
thedo | 166:3a9487d57a5c | 88 | virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used |
thedo | 166:3a9487d57a5c | 89 | |
thedo | 166:3a9487d57a5c | 90 | protected: |
thedo | 166:3a9487d57a5c | 91 | USBHost * host; |
thedo | 166:3a9487d57a5c | 92 | USBDeviceConnected * dev; |
thedo | 166:3a9487d57a5c | 93 | bool dev_connected; |
thedo | 166:3a9487d57a5c | 94 | |
thedo | 166:3a9487d57a5c | 95 | WANDongleInitializer* m_pInitializer; |
thedo | 166:3a9487d57a5c | 96 | |
thedo | 166:3a9487d57a5c | 97 | void init(); |
thedo | 166:3a9487d57a5c | 98 | |
thedo | 166:3a9487d57a5c | 99 | WANDongleSerialPort m_serial[WANDONGLE_MAX_SERIAL_PORTS]; |
thedo | 166:3a9487d57a5c | 100 | int m_serialCount; |
thedo | 166:3a9487d57a5c | 101 | |
thedo | 166:3a9487d57a5c | 102 | int m_totalInitializers; |
thedo | 166:3a9487d57a5c | 103 | WANDongleInitializer* m_Initializers[WANDONGLE_MAX_INITIALIZERS]; |
thedo | 166:3a9487d57a5c | 104 | }; |
thedo | 166:3a9487d57a5c | 105 | |
thedo | 166:3a9487d57a5c | 106 | #endif /* USBHOST_3GMODULE */ |
thedo | 166:3a9487d57a5c | 107 | |
thedo | 166:3a9487d57a5c | 108 | #endif |