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>
|
2015-12-17 12:41:10 +00:00
|
|
|
#include <QSslCertificate>
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <QSslSocket>
|
|
|
|
#include <QString>
|
2013-07-23 15:11:54 +01:00
|
|
|
|
2016-07-05 13:27:53 +01:00
|
|
|
#include "backends/devicelink.h"
|
2018-11-28 18:56:22 +00:00
|
|
|
#include "compositeuploadjob.h"
|
2022-09-10 22:23:52 +01:00
|
|
|
#include "uploadjob.h"
|
|
|
|
#include <kdeconnectcore_export.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
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
class KDECONNECTCORE_EXPORT LanDeviceLink : 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 };
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
LanDeviceLink(const QString &deviceId, LinkProvider *parent, QSslSocket *socket, ConnectionStarted connectionSource);
|
|
|
|
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;
|
2022-09-10 22:23:52 +01: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:
|
2022-09-10 22:23:52 +01:00
|
|
|
SocketLineReader *m_socketLineReader;
|
2017-09-03 20:39:44 +01:00
|
|
|
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
|