Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / ground / gcs / src / plugins / coreplugin / iconnection.h
blob3a1de98f7930239d993f05153861195ebd4e8b55
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 QString description;
54 bool operator==(device i)
56 return this->name == i.name;
60 virtual QList <device> availableDevices() = 0;
62 /**
63 * Open a device, and return a QIODevice interface from it
64 * It should be a dynamically created object as it will be
65 * deleted by the connection manager.
67 virtual QIODevice *openDevice(const QString &deviceName) = 0;
69 virtual void closeDevice(const QString &deviceName)
71 Q_UNUSED(deviceName)
74 /**
75 * Connection type name "USB HID"
77 virtual QString connectionName() = 0;
79 /**
80 * Short name to display in a combo box
82 virtual QString shortName()
84 return connectionName();
87 /**
88 * Manage whether the plugin is allowed to poll for devices
89 * or not
91 virtual void suspendPolling() {};
92 virtual void resumePolling() {};
94 signals:
95 /**
96 * Available devices list has changed, signal it to connection manager (and whoever wants to know)
98 void availableDevChanged(IConnection *);
100 } // namespace Core
102 #endif // ICONNECTION_H