2010-03-21 14:44:00 +01:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file iconnection.h
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
2010-07-16 18:59:25 +02:00
|
|
|
* @addtogroup GCSPlugins GCS Plugins
|
2010-03-21 14:44:00 +01:00
|
|
|
* @{
|
2010-07-16 18:59:25 +02:00
|
|
|
* @addtogroup CorePlugin Core Plugin
|
|
|
|
* @{
|
|
|
|
* @brief The Core GCS plugin
|
2010-03-21 14:44:00 +01:00
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ICONNECTION_H
|
|
|
|
#define ICONNECTION_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QtCore/QStringList>
|
|
|
|
#include <QtCore/QIODevice>
|
|
|
|
|
|
|
|
#include "core_global.h"
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
2010-03-21 21:53:28 +01:00
|
|
|
/**
|
|
|
|
* An IConnection object define a "type of connection",
|
|
|
|
* for instance USB, Serial, Network, ...
|
|
|
|
*/
|
2010-03-21 14:44:00 +01:00
|
|
|
class CORE_EXPORT IConnection : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2010-03-21 21:53:28 +01:00
|
|
|
/**
|
|
|
|
* Return the list of devices found on the system
|
|
|
|
*/
|
2010-03-21 14:44:00 +01:00
|
|
|
virtual QStringList availableDevices() = 0;
|
2010-03-21 21:53:28 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Open a device, and return a QIODevice interface from it
|
2010-05-02 18:13:12 +02:00
|
|
|
* It should be a dynamically created object as it will be
|
|
|
|
* deleted by the connection manager.
|
2010-03-21 21:53:28 +01:00
|
|
|
*/
|
2010-03-21 14:44:00 +01:00
|
|
|
virtual QIODevice *openDevice(const QString &deviceName) = 0;
|
2010-03-21 21:53:28 +01:00
|
|
|
|
2010-03-21 14:44:00 +01:00
|
|
|
virtual void closeDevice(const QString &deviceName) {};
|
|
|
|
|
2010-03-21 21:53:28 +01:00
|
|
|
/**
|
|
|
|
* Connection type name "USB HID"
|
|
|
|
*/
|
2010-03-21 14:44:00 +01:00
|
|
|
virtual QString connectionName() = 0;
|
2010-03-21 21:53:28 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Short name to display in a combo box
|
|
|
|
*/
|
2010-03-21 14:44:00 +01:00
|
|
|
virtual QString shortName() {return connectionName();}
|
|
|
|
|
|
|
|
signals:
|
2010-03-21 21:53:28 +01:00
|
|
|
/**
|
|
|
|
* Available devices list has changed, signal it to connection manager (and whoever wants to know)
|
|
|
|
*/
|
2010-03-21 14:44:00 +01:00
|
|
|
void availableDevChanged(IConnection *);
|
|
|
|
};
|
|
|
|
|
|
|
|
} //namespace Core
|
|
|
|
|
|
|
|
#endif // ICONNECTION_H
|