File indexing completed on 2024-04-28 15:40:17
0001 // SPDX-FileCopyrightText: 2014-2022 Jesper K. Pedersen <blackie@kde.org> 0002 // 0003 // SPDX-License-Identifier: GPL-2.0-or-later 0004 0005 #ifndef SERVER_H 0006 #define SERVER_H 0007 0008 #include "RemoteConnection.h" 0009 0010 class QUdpSocket; 0011 class QTcpSocket; 0012 0013 namespace RemoteControl 0014 { 0015 class Server : public RemoteConnection 0016 { 0017 Q_OBJECT 0018 public: 0019 explicit Server(QObject *parent = 0); 0020 bool isConnected() const override; 0021 void listen(QHostAddress address); 0022 void stopListening(); 0023 QTcpSocket *socket() override; 0024 void connectToTcpServer(const QHostAddress &address); 0025 0026 Q_SIGNALS: 0027 void connected(); 0028 void disConnected(); 0029 void stoppedListening(); 0030 0031 private Q_SLOTS: 0032 void readIncommingUDP(); 0033 void gotConnected(); 0034 void lostConnection(); 0035 0036 private: 0037 QUdpSocket *m_socket = nullptr; 0038 QTcpSocket *m_tcpSocket = nullptr; 0039 bool m_isConnected = false; 0040 }; 0041 0042 } 0043 0044 #endif // SERVER_H