dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
serialplugin.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 SERIALPLUGIN_H
28 #define SERIALPLUGIN_H
29 
30 //#include "serial_global.h"
31 #include <QtSerialPort/QSerialPort>
32 #include <QtSerialPort/QSerialPortInfo>
33 #include "coreplugin/iconnection.h"
37 #include <QTimer>
38 
39 class IConnection;
40 class QSerialPortInfo;
41 class SerialConnection;
42 
49 {
50  Q_OBJECT
51 public:
53  virtual ~SerialConnection();
54 
56  virtual QIODevice *openDevice(Core::IDevice *deviceName);
57  virtual void closeDevice(const QString &deviceName);
58 
59  virtual QString connectionName();
60  virtual QString shortName();
61  virtual void suspendPolling();
62  virtual void resumePolling();
63  virtual bool reconnect() { return m_config->reconnect(); }
64  bool deviceOpened() { return m_deviceOpened; }
65  SerialPluginConfiguration *Config() const { return m_config; }
66  SerialPluginOptionsPage *Optionspage() const { return m_optionspage; }
67 
68 private:
69  QSerialPort *serialHandle;
70  bool enablePolling;
71  SerialPluginConfiguration *m_config;
72  SerialPluginOptionsPage *m_optionspage;
73 
74 private slots:
75  void periodic();
76 
77 protected slots:
78  void onEnumerationChanged();
79 
80 protected:
82 
83  QTimer periodicTimer;
84 };
85 
86 // class SERIAL_EXPORT SerialPlugin
88 {
89  Q_OBJECT
90  Q_PLUGIN_METADATA(IID "org.dronin.plugins.Serial")
91 
92 public:
93  SerialPlugin();
94  ~SerialPlugin();
95 
96  virtual bool initialize(const QStringList &arguments, QString *error_message);
97  virtual void extensionsInitialized();
98 
99 private:
100  SerialConnection *m_connection;
101 };
102 
103 #endif // SERIALPLUGIN_H
virtual ~SerialConnection()
virtual QString shortName()
QTimer periodicTimer
Definition: serialplugin.h:83
virtual bool reconnect()
Used to flag that the device wants that we try to reconnect if it gets disconnected Currently this sh...
Definition: serialplugin.h:63
virtual void closeDevice(const QString &deviceName)
SerialPluginOptionsPage * Optionspage() const
Definition: serialplugin.h:66
void onEnumerationChanged()
virtual QIODevice * openDevice(Core::IDevice *deviceName)
virtual QList< Core::IDevice * > availableDevices()
virtual void suspendPolling()
virtual QString connectionName()
virtual void resumePolling()
Base class for all plugins.
Definition: iplugin.h:45
SerialPluginConfiguration * Config() const
Definition: serialplugin.h:65