File indexing completed on 2024-04-28 04:57:01

0001 /**
0002  * SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #ifndef DEVICELINK_H
0008 #define DEVICELINK_H
0009 
0010 #include <QObject>
0011 
0012 #include "deviceinfo.h"
0013 #include "networkpacket.h"
0014 
0015 class LinkProvider;
0016 
0017 class DeviceLink : public QObject
0018 {
0019     Q_OBJECT
0020 public:
0021     DeviceLink(const QString &deviceId, LinkProvider *parent);
0022 
0023     QString deviceId() const
0024     {
0025         return deviceInfo().id;
0026     }
0027 
0028     int priority() const
0029     {
0030         return priorityFromProvider;
0031     }
0032 
0033     virtual bool sendPacket(NetworkPacket &np) = 0;
0034 
0035     virtual DeviceInfo deviceInfo() const = 0;
0036 
0037 private:
0038     int priorityFromProvider;
0039 
0040 Q_SIGNALS:
0041     void receivedPacket(const NetworkPacket &np);
0042 };
0043 
0044 #endif