dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
rawhidplugin.h
Go to the documentation of this file.
1 
12 /*
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.
17  *
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
21  * for more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, see <http://www.gnu.org/licenses/>
25  */
26 
27 #ifndef RAWHIDPLUGIN_H
28 #define RAWHIDPLUGIN_H
29 
30 #include "rawhid_global.h"
31 #include "rawhid.h"
32 #include "usbmonitor.h"
33 #include "usbsignalfilter.h"
35 #include "coreplugin/iconnection.h"
36 #include "coreplugin/iboardtype.h"
39 
40 #include <QtCore/QMutex>
41 #include <QtCore/QThread>
42 
43 class IConnection;
44 class RawHIDConnection;
45 
51 class RAWHID_EXPORT RawHIDConnection : public Core::IConnection
52 {
53  Q_OBJECT
54 public:
56  virtual ~RawHIDConnection();
57 
59  virtual QIODevice *openDevice(Core::IDevice *deviceName);
60  virtual void closeDevice(const QString &deviceName);
61 
62  virtual QString connectionName();
63  virtual QString shortName();
64  virtual void suspendPolling();
65  virtual void resumePolling();
66 
67  bool deviceOpened() { return (RawHidHandle != NULL); } // Pip
68 
69 protected slots:
70  void onDeviceConnected();
71  void onDeviceDisconnected();
72 
73 private:
74  RawHID *RawHidHandle;
75  bool enablePolling;
76  USBMonitor *m_usbMonitor;
77  USBSignalFilter *m_signalFilter;
78 };
79 
80 class RAWHID_EXPORT RawHIDPlugin : public ExtensionSystem::IPlugin
81 {
82  Q_OBJECT
83  Q_PLUGIN_METADATA(IID "org.dronin.plugins.RawHID")
84 
85 public:
86  RawHIDPlugin();
87  ~RawHIDPlugin();
88 
89  virtual bool initialize(const QStringList &arguments, QString *error_message);
90  virtual void extensionsInitialized();
91 
92 private:
93  RawHIDConnection *hidConnection;
94  USBMonitor *m_usbMonitor;
95 };
96 
97 #endif // RAWHIDPLUGIN_H
virtual QIODevice * openDevice(IDevice *device)=0
virtual void extensionsInitialized()=0
virtual void suspendPolling()
Definition: iconnection.h:77
virtual void closeDevice(const QString &deviceName)
Definition: iconnection.h:61
virtual QList< IDevice * > availableDevices()=0
virtual void resumePolling()
Definition: iconnection.h:78
virtual QString connectionName()=0
Definition: rawhid.h:134
virtual bool initialize(const QStringList &arguments, QString *errorString)=0
virtual QString shortName()
Definition: iconnection.h:71
Base class for all plugins.
Definition: iplugin.h:45