changed to Sonos command API
parent
afa6dcacdc
commit
2e827c8905
|
|
@ -24,9 +24,6 @@
|
||||||
#include "devices/device.h"
|
#include "devices/device.h"
|
||||||
#include "plugininfo.h"
|
#include "plugininfo.h"
|
||||||
|
|
||||||
|
|
||||||
#include <noson/sonostypes.h>
|
|
||||||
|
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
|
||||||
|
|
@ -35,19 +32,19 @@ DevicePluginSonos::DevicePluginSonos()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DevicePluginSonos::~DevicePluginSonos()
|
DevicePluginSonos::~DevicePluginSonos()
|
||||||
{
|
{
|
||||||
hardwareManager()->pluginTimerManager()->unregisterTimer(m_pluginTimer);
|
hardwareManager()->pluginTimerManager()->unregisterTimer(m_pluginTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevicePluginSonos::init()
|
|
||||||
{
|
|
||||||
qDebug(dcSonos) << "Nymea sonos plug-in using libnoson Copyright (C) 2018 Jean-Luc Barriere";
|
|
||||||
m_sonosSystem = new SONOS::System(nullptr, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
Device::DeviceSetupStatus DevicePluginSonos::setupDevice(Device *device)
|
Device::DeviceSetupStatus DevicePluginSonos::setupDevice(Device *device)
|
||||||
{
|
{
|
||||||
|
if (!sonos) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (device->deviceClassId() == sonosDeviceClassId) {
|
if (device->deviceClassId() == sonosDeviceClassId) {
|
||||||
if (!m_sonosSystem->Discover()) {
|
if (!m_sonosSystem->Discover()) {
|
||||||
return Device::DeviceSetupStatusFailure;
|
return Device::DeviceSetupStatusFailure;
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,7 @@
|
||||||
|
|
||||||
#include "devices/deviceplugin.h"
|
#include "devices/deviceplugin.h"
|
||||||
#include "plugintimer.h"
|
#include "plugintimer.h"
|
||||||
|
#include "sonos.h"
|
||||||
#include <noson/sonossystem.h>
|
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
@ -42,7 +41,6 @@ public:
|
||||||
explicit DevicePluginSonos();
|
explicit DevicePluginSonos();
|
||||||
~DevicePluginSonos() override;
|
~DevicePluginSonos() override;
|
||||||
|
|
||||||
void init() override;
|
|
||||||
Device::DeviceSetupStatus setupDevice(Device *device) override;
|
Device::DeviceSetupStatus setupDevice(Device *device) override;
|
||||||
void postSetupDevice(Device *device) override;
|
void postSetupDevice(Device *device) override;
|
||||||
void deviceRemoved(Device *device) override;
|
void deviceRemoved(Device *device) override;
|
||||||
|
|
@ -50,21 +48,12 @@ public:
|
||||||
Device::DeviceError executeAction(Device *device, const Action &action) override;
|
Device::DeviceError executeAction(Device *device, const Action &action) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SONOS::System *m_sonosSystem = nullptr;
|
Sonos *sonos = nullptr;
|
||||||
PluginTimer *m_pluginTimer;
|
|
||||||
void updateZoneInfo();
|
|
||||||
|
|
||||||
void handleEventCB(void *handle);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onPluginTimer();
|
void onPluginTimer();
|
||||||
/*void onConnectionChanged();
|
void onConnectionChanged();
|
||||||
void onStateChanged();
|
|
||||||
void onActionExecuted(int actionId, bool success);
|
|
||||||
void versionDataReceived(const QVariantMap &data);
|
|
||||||
void onSetupFinished(const QVariantMap &data);
|
|
||||||
|
|
||||||
void onPlaybackStatusChanged(const QString &playbackStatus);*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DEVICEPLUGINSONOS_H
|
#endif // DEVICEPLUGINSONOS_H
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,26 @@
|
||||||
"displayName": "Sonos",
|
"displayName": "Sonos",
|
||||||
"vendors": [
|
"vendors": [
|
||||||
{
|
{
|
||||||
|
|
||||||
"id": "30a60752-d06f-4ec9-a4e1-9810a5d22fa3",
|
"id": "30a60752-d06f-4ec9-a4e1-9810a5d22fa3",
|
||||||
"name": "sonos",
|
"name": "sonos",
|
||||||
"displayName": "Sonos",
|
"displayName": "Sono",
|
||||||
"deviceClasses": [
|
"deviceClasses": [
|
||||||
{
|
{
|
||||||
"id": "22df416d-7732-44f1-b6b9-e41296211178",
|
"id": "22df416d-7732-44f1-b6b9-e41296211178",
|
||||||
"name": "sonos",
|
"name": "sonosGroup",
|
||||||
"displayName": "Sonos",
|
"displayName": "Sonos group",
|
||||||
|
"interfaces": ["gateway", "connectable"],
|
||||||
|
"createMethods": ["discovery"],
|
||||||
|
"paramTypes": [
|
||||||
|
{
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "22df416d-7732-44f1-b6b9-e41296211178",
|
||||||
|
"name": "sonosGroup",
|
||||||
|
"displayName": "Sonos group",
|
||||||
"interfaces": ["extendedvolumecontroller", "mediametadataprovider", "shufflerepeat", "connectable"],
|
"interfaces": ["extendedvolumecontroller", "mediametadataprovider", "shufflerepeat", "connectable"],
|
||||||
"createMethods": ["discovery"],
|
"createMethods": ["discovery"],
|
||||||
"paramTypes": [
|
"paramTypes": [
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 569f2b3087d2ba39bfe796bd6dd20b767fb68eb7
|
|
||||||
|
|
@ -2,15 +2,14 @@ include(../plugins.pri)
|
||||||
|
|
||||||
QT += network
|
QT += network
|
||||||
|
|
||||||
LIBS += -lnoson
|
|
||||||
|
|
||||||
TARGET = $$qtLibraryTarget(nymea_devicepluginsonos)
|
TARGET = $$qtLibraryTarget(nymea_devicepluginsonos)
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
devicepluginsonos.cpp \
|
devicepluginsonos.cpp \
|
||||||
|
sonos.cpp \
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
devicepluginsonos.h \
|
devicepluginsonos.h \
|
||||||
|
sonos.h \
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue