kdeconnect-kde/core/backends/loopback/loopbackdevicelink.cpp

32 lines
831 B
C++
Raw Normal View History

2013-06-06 04:57:06 +01:00
/**
* SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
2013-06-06 04:57:06 +01:00
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
2013-06-06 04:57:06 +01:00
*/
2013-08-28 22:47:39 +01:00
#include "loopbackdevicelink.h"
#include "loopbacklinkprovider.h"
LoopbackDeviceLink::LoopbackDeviceLink(const QString &deviceId, LoopbackLinkProvider *provider)
: DeviceLink(deviceId, provider)
{
}
bool LoopbackDeviceLink::sendPacket(NetworkPacket &input)
{
2019-02-03 01:00:36 +00:00
NetworkPacket output((QString()));
NetworkPacket::unserialize(input.serialize(), &output);
// LoopbackDeviceLink does not need deviceTransferInfo
if (input.hasPayload()) {
bool b = input.payload()->open(QIODevice::ReadOnly);
Q_ASSERT(b);
output.setPayload(input.payload(), input.payloadSize());
}
Q_EMIT receivedPacket(output);
return true;
}