2 ******************************************************************************
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2013.
6 * @addtogroup GCSPlugins GCS Plugins
8 * @addtogroup opHIDPlugin Raw HID Plugin
10 * @brief Impliments a HID USB connection to the flight hardware as a QIODevice
11 *****************************************************************************/
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #include "ophid_global.h"
37 #include "ophid_hidapi.h"
38 #include "ophid_usbmon.h"
40 class RawHIDReadThread
;
41 class RawHIDWriteThread
;
44 * The actual IO device that will be used to communicate
47 class OPHID_EXPORT RawHID
: public QIODevice
{
50 friend class RawHIDReadThread
;
51 friend class RawHIDWriteThread
;
55 RawHID(const QString
&deviceName
);
58 virtual bool open(OpenMode mode
);
60 virtual bool isSequential() const;
66 void onDeviceUnplugged(int num
);
69 virtual qint64
readData(char *data
, qint64 maxSize
);
70 virtual qint64
writeData(const char *data
, qint64 maxSize
);
71 virtual qint64
bytesAvailable() const;
72 virtual qint64
bytesToWrite() const;
74 // Callback from the read thread to open the device
77 // Callback from teh read thread to close the device
86 RawHIDReadThread
*m_readThread
;
87 RawHIDWriteThread
*m_writeThread
;
90 QMutex
*m_startedMutex
;