From d2f071d5d8c5c21c4f438bf5a822fbaddb2d97ce Mon Sep 17 00:00:00 2001 From: Loïc Collignon Date: Fri, 23 Feb 2018 13:57:35 +0100 Subject: hack: control master volume using 4a with the homescreen slider MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If527d160f8eacbcfed3df2ab744485995dbe1dc9 Signed-off-by: Loïc Collignon --- homescreen/src/qafbwsclient.h | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 homescreen/src/qafbwsclient.h (limited to 'homescreen/src/qafbwsclient.h') diff --git a/homescreen/src/qafbwsclient.h b/homescreen/src/qafbwsclient.h new file mode 100644 index 0000000..2576ecb --- /dev/null +++ b/homescreen/src/qafbwsclient.h @@ -0,0 +1,50 @@ +#ifndef QAFBWSCLIENT_H +#define QAFBWSCLIENT_H + +#include +#include +#include +#include +#include + +enum class AfMsgType + : int +{ + Call = 2, + RetOk = 3, + RetErr = 4, + Event = 5 +}; + +class QAfbWsMsg; + +class QAfbWsClient + : public QObject +{ + Q_OBJECT +public: + explicit QAfbWsClient(QObject* parent = nullptr); + + void open(const QUrl& url); + void close(); + QUrl url() const; + QSharedPointer call(const QString &api, const QString &verb, const QJsonValue &args = QJsonValue()); + +signals: + void connected(); + void disconnected(); + void error(QAbstractSocket::SocketError err, QString errStr); + +private slots: + void onSocketConnected(); + void onSocketDisconnected(); + void onSocketError(QAbstractSocket::SocketError err); + void onSocketTextMessageReceived(QString msg); + +private: + int m_nextCallId; + QWebSocket m_socket; + QMap> m_calls; +}; + +#endif // QAFBWSCLIENT_H -- cgit 1.2.3-korg