File indexing completed on 2024-04-28 15:39:41

0001 // SPDX-FileCopyrightText: 2014-2022 Jesper K. Pedersen <blackie@kde.org>
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 #ifndef CLIENT_H
0006 #define CLIENT_H
0007 
0008 #include "RemoteConnection.h"
0009 #include <QTcpServer>
0010 #include <QTimer>
0011 
0012 namespace RemoteControl
0013 {
0014 
0015 class Client : public RemoteConnection
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit Client(QObject *parent = 0);
0020     bool isConnected() const override;
0021 
0022 Q_SIGNALS:
0023     void gotConnected();
0024     void disconnected();
0025 
0026 protected:
0027     QTcpSocket *socket() override;
0028 
0029 private Q_SLOTS:
0030     void acceptConnection();
0031     void sendBroadcastPackage();
0032     void disconnect();
0033 
0034 private:
0035     QTcpServer m_server;
0036     QTcpSocket *m_socket = nullptr;
0037     QTimer m_timer;
0038 };
0039 
0040 }
0041 #endif // CLIENT_H