2019-06-05 03:42:06 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +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
|
|
|
*
|
2020-08-17 10:48:10 +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"
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <QtCore>
|
2019-06-05 03:42:06 +01:00
|
|
|
|
|
|
|
// Tweaked Device for testing:
|
2022-09-10 22:23:52 +01:00
|
|
|
class TestDevice : public Device
|
2019-06-05 03:42:06 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
private:
|
|
|
|
int sentPackets;
|
2022-09-10 22:23:52 +01:00
|
|
|
NetworkPacket *lastPacket;
|
2019-06-05 03:42:06 +01:00
|
|
|
|
|
|
|
public:
|
2022-09-10 22:23:52 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
NetworkPacket *getLastPacket()
|
2019-06-05 03:42:06 +01:00
|
|
|
{
|
|
|
|
return lastPacket;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void deleteLastPacket()
|
|
|
|
{
|
|
|
|
delete lastPacket;
|
|
|
|
lastPacket = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
2022-09-10 22:23:52 +01:00
|
|
|
bool sendPacket(NetworkPacket &np) override;
|
2019-06-05 03:42:06 +01:00
|
|
|
};
|
2019-12-22 07:49:55 +00:00
|
|
|
|
|
|
|
#endif
|