LP-56 - Better txpid option namings, fix tabs-spaces, tooltips. headers, variable...
[librepilot.git] / ground / openpilotgcs / src / plugins / coreplugin / iconnection.h
bloba5ebbc17d0d3391b86cb33ec94c743acf76450c3
1 /**
2 ******************************************************************************
4 * @file iconnection.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
7 * @addtogroup GCSPlugins GCS Plugins
8 * @{
9 * @addtogroup CorePlugin Core Plugin
10 * @{
11 * @brief The Core GCS plugin
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #ifndef ICONNECTION_H
30 #define ICONNECTION_H
32 #include <QObject>
33 #include <QtCore/QStringList>
34 #include <QtCore/QIODevice>
36 #include "core_global.h"
38 namespace Core {
39 /**
40 * An IConnection object define a "type of connection",
41 * for instance USB, Serial, Network, ...
43 class CORE_EXPORT IConnection : public QObject {
44 Q_OBJECT
46 public:
47 /**
48 * Return the list of devices found on the system
50 struct device {
51 QString name;
52 QString displayName;
53 bool operator==(device i)
55 return this->name == i.name;
59 virtual QList <device> availableDevices() = 0;
61 /**
62 * Open a device, and return a QIODevice interface from it
63 * It should be a dynamically created object as it will be
64 * deleted by the connection manager.
66 virtual QIODevice *openDevice(const QString &deviceName) = 0;
68 virtual void closeDevice(const QString &deviceName)
70 Q_UNUSED(deviceName)
73 /**
74 * Connection type name "USB HID"
76 virtual QString connectionName() = 0;
78 /**
79 * Short name to display in a combo box
81 virtual QString shortName()
83 return connectionName();
86 /**
87 * Manage whether the plugin is allowed to poll for devices
88 * or not
90 virtual void suspendPolling() {};
91 virtual void resumePolling() {};
93 signals:
94 /**
95 * Available devices list has changed, signal it to connection manager (and whoever wants to know)
97 void availableDevChanged(IConnection *);
99 } // namespace Core
101 #endif // ICONNECTION_H