changed to Sonos command API

master
Bernhard Trinnes 2019-08-12 19:13:12 +02:00 committed by Michael Zanetti
parent afa6dcacdc
commit 2e827c8905
5 changed files with 25 additions and 29 deletions

View File

@ -24,9 +24,6 @@
#include "devices/device.h"
#include "plugininfo.h"
#include <noson/sonostypes.h>
#include <QNetworkRequest>
#include <QNetworkReply>
@ -35,19 +32,19 @@ DevicePluginSonos::DevicePluginSonos()
}
DevicePluginSonos::~DevicePluginSonos()
{
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)
{
if (!sonos) {
}
if (device->deviceClassId() == sonosDeviceClassId) {
if (!m_sonosSystem->Discover()) {
return Device::DeviceSetupStatusFailure;

View File

@ -25,8 +25,7 @@
#include "devices/deviceplugin.h"
#include "plugintimer.h"
#include <noson/sonossystem.h>
#include "sonos.h"
#include <QHash>
#include <QDebug>
@ -42,7 +41,6 @@ public:
explicit DevicePluginSonos();
~DevicePluginSonos() override;
void init() override;
Device::DeviceSetupStatus setupDevice(Device *device) override;
void postSetupDevice(Device *device) override;
void deviceRemoved(Device *device) override;
@ -50,21 +48,12 @@ public:
Device::DeviceError executeAction(Device *device, const Action &action) override;
private:
SONOS::System *m_sonosSystem = nullptr;
PluginTimer *m_pluginTimer;
void updateZoneInfo();
void handleEventCB(void *handle);
Sonos *sonos = nullptr;
private slots:
void onPluginTimer();
/*void onConnectionChanged();
void onStateChanged();
void onActionExecuted(int actionId, bool success);
void versionDataReceived(const QVariantMap &data);
void onSetupFinished(const QVariantMap &data);
void onConnectionChanged();
void onPlaybackStatusChanged(const QString &playbackStatus);*/
};
#endif // DEVICEPLUGINSONOS_H

View File

@ -4,14 +4,26 @@
"displayName": "Sonos",
"vendors": [
{
"id": "30a60752-d06f-4ec9-a4e1-9810a5d22fa3",
"name": "sonos",
"displayName": "Sonos",
"displayName": "Sono",
"deviceClasses": [
{
"id": "22df416d-7732-44f1-b6b9-e41296211178",
"name": "sonos",
"displayName": "Sonos",
"name": "sonosGroup",
"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"],
"createMethods": ["discovery"],
"paramTypes": [

@ -1 +0,0 @@
Subproject commit 569f2b3087d2ba39bfe796bd6dd20b767fb68eb7

View File

@ -2,15 +2,14 @@ include(../plugins.pri)
QT += network
LIBS += -lnoson
TARGET = $$qtLibraryTarget(nymea_devicepluginsonos)
SOURCES += \
devicepluginsonos.cpp \
sonos.cpp \
HEADERS += \
devicepluginsonos.h \
sonos.h \