/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright (C) 2018 Simon Stürz * * * * This file is part of nymea-remoteproxy. * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef SOCKETCONNECTOR_H #define SOCKETCONNECTOR_H #include #include #include namespace remoteproxyclient { class ProxyConnection : public QObject { Q_OBJECT public: explicit ProxyConnection(QObject *parent = nullptr); virtual ~ProxyConnection() = 0; virtual void sendData(const QByteArray &data) = 0; virtual QUrl serverUrl() const = 0; virtual void ignoreSslErrors() = 0; virtual void ignoreSslErrors(const QList &errors) = 0; bool connected(); private: bool m_connected = false; protected: void setConnected(bool connected); signals: void connectedChanged(bool connected); void dataReceived(const QByteArray &data); void stateChanged(QAbstractSocket::SocketState state); void errorOccured(QAbstractSocket::SocketError error); void sslErrors(const QList &errors); public slots: virtual void connectServer(const QUrl &serverUrl) = 0; virtual void disconnectServer() = 0; }; } #endif // SOCKETCONNECTOR_H