kdeconnect-kde/tests/testdevice.h

51 lines
934 B
C
Raw Permalink Normal View History

2019-06-05 03:42:06 +01:00
/**
* SPDX-FileCopyrightText: 2015 Holger Kaelberer <holger.k@elberer.de>
* SPDX-FileCopyrightText: 2019 Simon Redman <simon@ergotech.com>
2019-06-05 03:42:06 +01:00
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
2019-06-05 03:42:06 +01:00
*/
2019-12-22 07:49:55 +00:00
#ifndef TESTDEVICE_H
#define TESTDEVICE_H
2019-06-05 03:42:06 +01:00
#include "core/device.h"
#include <QtCore>
2019-06-05 03:42:06 +01:00
// Tweaked Device for testing:
class TestDevice : public Device
2019-06-05 03:42:06 +01:00
{
Q_OBJECT
private:
int sentPackets;
NetworkPacket *lastPacket;
2019-06-05 03:42:06 +01:00
public:
explicit TestDevice(QObject *parent, const QString &id);
2019-06-05 03:42:06 +01:00
~TestDevice() override;
bool isReachable() const override;
int getSentPackets() const
{
return sentPackets;
}
NetworkPacket *getLastPacket()
2019-06-05 03:42:06 +01:00
{
return lastPacket;
}
private:
void deleteLastPacket()
{
delete lastPacket;
lastPacket = nullptr;
}
public Q_SLOTS:
bool sendPacket(NetworkPacket &np) override;
2019-06-05 03:42:06 +01:00
};
2019-12-22 07:49:55 +00:00
#endif