ProtocolInterface.h 1.4 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
lm's avatar
lm committed
9 10


pixhawk's avatar
pixhawk committed
11 12 13 14 15 16 17 18
/**
 * @file
 *   @brief Interface class for protocols
 *
 *   @author Lorenz Meier <mavteam@student.ethz.ch>
 *
 */

19
#pragma once
pixhawk's avatar
pixhawk committed
20 21 22

#include <QThread>
#include <QString>
23
#include <QByteArray>
pixhawk's avatar
pixhawk committed
24 25 26 27 28 29 30
#include "LinkInterface.h"

/**
 * @brief Interface for all protocols.
 *
 * This class defines the interface for
 * communication packets transported by the LinkManager.
31
 *
pixhawk's avatar
pixhawk committed
32
 * @see LinkManager.
33
 *
pixhawk's avatar
pixhawk committed
34
 **/
Lorenz Meier's avatar
Lorenz Meier committed
35
class ProtocolInterface : public QThread
pixhawk's avatar
pixhawk committed
36
{
lm's avatar
lm committed
37
    Q_OBJECT
pixhawk's avatar
pixhawk committed
38
public:
39 40
    virtual ~ProtocolInterface  () {}
    virtual QString getName     () = 0;
41 42 43 44 45
    /**
     * Reset the received, error, and dropped counts for the given link. Useful for
     * when reconnecting a link.
     * @param link The link to reset metadata for.
     */
46
    virtual void resetMetadataForLink(LinkInterface *link) = 0;
lm's avatar
lm committed
47

pixhawk's avatar
pixhawk committed
48
public slots:
49 50
    virtual void receiveBytes       (LinkInterface *link, QByteArray b) = 0;
    virtual void linkStatusChanged  (bool connected) = 0;
lm's avatar
lm committed
51 52

signals:
pixhawk's avatar
pixhawk committed
53
    /** @brief Update the packet loss from one system */
54
    void receiveLossChanged         (int uasId, float loss);
lm's avatar
lm committed
55

pixhawk's avatar
pixhawk committed
56
};