2013-07-23 15:11:54 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
|
2013-07-23 15:11:54 +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
|
2013-07-23 15:11:54 +01:00
|
|
|
*/
|
|
|
|
|
2013-08-28 22:47:39 +01:00
|
|
|
#ifndef LANDEVICELINK_H
|
|
|
|
#define LANDEVICELINK_H
|
2013-07-23 15:11:54 +01:00
|
|
|
|
|
|
|
#include <QObject>
|
2018-11-28 18:56:22 +00:00
|
|
|
#include <QPointer>
|
2013-07-23 15:11:54 +01:00
|
|
|
#include <QString>
|
2015-07-05 14:23:53 +01:00
|
|
|
#include <QSslSocket>
|
2015-12-17 12:41:10 +00:00
|
|
|
#include <QSslCertificate>
|
2013-07-23 15:11:54 +01:00
|
|
|
|
2016-06-10 14:07:33 +01:00
|
|
|
#include <kdeconnectcore_export.h>
|
2016-07-05 13:27:53 +01:00
|
|
|
#include "backends/devicelink.h"
|
2015-07-07 19:52:10 +01:00
|
|
|
#include "uploadjob.h"
|
2018-11-28 18:56:22 +00:00
|
|
|
#include "compositeuploadjob.h"
|
2013-09-09 17:35:56 +01:00
|
|
|
|
2013-10-30 00:18:25 +00:00
|
|
|
class SocketLineReader;
|
2013-07-23 15:11:54 +01:00
|
|
|
|
2016-06-10 14:07:33 +01:00
|
|
|
class KDECONNECTCORE_EXPORT LanDeviceLink
|
2013-07-24 17:42:33 +01:00
|
|
|
: public DeviceLink
|
2013-07-23 15:11:54 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-01-10 15:12:13 +00:00
|
|
|
enum ConnectionStarted : bool { Locally, Remotely };
|
|
|
|
|
2015-09-11 16:25:23 +01:00
|
|
|
LanDeviceLink(const QString& deviceId, LinkProvider* parent, QSslSocket* socket, ConnectionStarted connectionSource);
|
2015-12-11 01:11:48 +00:00
|
|
|
void reset(QSslSocket* socket, ConnectionStarted connectionSource);
|
2013-07-23 15:11:54 +01:00
|
|
|
|
2016-06-20 08:05:02 +01:00
|
|
|
QString name() override;
|
2018-03-04 19:48:51 +00:00
|
|
|
bool sendPacket(NetworkPacket& np) override;
|
2013-07-23 15:11:54 +01:00
|
|
|
|
2016-06-20 08:05:02 +01:00
|
|
|
void userRequestsPair() override;
|
|
|
|
void userRequestsUnpair() override;
|
2015-12-01 18:45:14 +00:00
|
|
|
|
2016-06-20 08:05:02 +01:00
|
|
|
void setPairStatus(PairStatus status) override;
|
2015-12-01 18:45:14 +00:00
|
|
|
|
2016-06-20 08:05:02 +01:00
|
|
|
bool linkShouldBeKeptAlive() override;
|
2016-01-10 15:12:13 +00:00
|
|
|
|
2017-07-22 10:25:07 +01:00
|
|
|
QHostAddress hostAddress() const;
|
2020-11-26 10:28:32 +00:00
|
|
|
QSslCertificate certificate() const override;
|
2017-07-22 10:13:21 +01:00
|
|
|
|
2013-07-23 15:11:54 +01:00
|
|
|
private Q_SLOTS:
|
|
|
|
void dataReceived();
|
|
|
|
|
|
|
|
private:
|
2017-09-03 20:39:44 +01:00
|
|
|
SocketLineReader* m_socketLineReader;
|
|
|
|
ConnectionStarted m_connectionSource;
|
2018-11-28 18:56:22 +00:00
|
|
|
QPointer<CompositeUploadJob> m_compositeUploadJob;
|
2013-07-23 15:11:54 +01:00
|
|
|
};
|
|
|
|
|
2013-10-30 00:18:25 +00:00
|
|
|
#endif
|