aboutsummaryrefslogtreecommitdiffstats
path: root/homescreen/src/mastervolume.h
diff options
context:
space:
mode:
authorLoïc Collignon <loic.collignon@iot.bzh>2018-12-19 15:30:09 +0100
committerLoïc Collignon [ IoT.bzh ] <loic.collignon@iot.bzh>2018-12-19 15:50:33 +0000
commit3229c695fc52e22e773cef89a835915c0bb6d90b (patch)
tree7b0b4ae96bf8dcedb4fa19c6669abc3944ecfa5b /homescreen/src/mastervolume.h
parent4667d93a852d66a57a2d7d26957c3aab6845756e (diff)
Bind the slider volume to the 4a active role
4a now expose an active role, which is the opened role with the higher priority. This binds the slider to the active role. Bug: 1313 Change-Id: I73766163fc0b8ef1e6b70e9c13e28d3642be858a Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
Diffstat (limited to 'homescreen/src/mastervolume.h')
-rw-r--r--homescreen/src/mastervolume.h51
1 files changed, 27 insertions, 24 deletions
diff --git a/homescreen/src/mastervolume.h b/homescreen/src/mastervolume.h
index bca6356..e23e8d1 100644
--- a/homescreen/src/mastervolume.h
+++ b/homescreen/src/mastervolume.h
@@ -16,31 +16,34 @@
#include <QtCore/QObject>
#include <QQmlEngine>
+#include "../helpers/qafbwebsocketclient.h"
-class MasterVolume : public QObject
+class MasterVolume
+ : public QObject
{
Q_OBJECT
- Q_PROPERTY (uint32_t volume READ getVolume WRITE setVolume NOTIFY volumeChanged)
-
- public:
- MasterVolume(QObject *parent = 0)
- : QObject(parent), m_volume(32768)
- {
- }
-
- ~MasterVolume() {}
-
- uint32_t getVolume() const { return m_volume; }
- void setVolume(int volume);
-
- public slots:
- void changeExternalVolume(int volume);
-
- signals:
- void volumeChanged(void);
- void sliderVolumeChanged(int volume_delta);
- void externalVolumeChanged(uint32_t volume);
-
- private:
- uint32_t m_volume;
+ Q_PROPERTY (uint32_t volume READ getVolume WRITE setVolume NOTIFY VolumeChanged)
+
+private:
+ QAfbWebsocketClient m_client;
+ QUrl m_url;
+ qint32 m_volume;
+
+public:
+ MasterVolume(QObject* parent = nullptr);
+ ~MasterVolume() = default;
+
+ Q_INVOKABLE void open(const QUrl& url);
+ Q_INVOKABLE qint32 getVolume() const;
+ Q_INVOKABLE void setVolume(qint32 val);
+
+private slots:
+ void onClientConnected();
+ void onClientDisconnected();
+ void onClientError(QAbstractSocket::SocketError se);
+ void onClientEventReceived(QString name, const QJsonValue& data);
+ void TryOpen();
+
+signals:
+ void VolumeChanged();
};