/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright 2013 - 2020, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. * This project including source code and documentation is protected by * copyright law, and remains the property of nymea GmbH. All rights, including * reproduction, publication, editing and translation, are reserved. The use of * this project is subject to the terms of a license agreement to be concluded * with nymea GmbH in accordance with the terms of use of nymea GmbH, available * under https://nymea.io/license * * GNU Lesser General Public License Usage * Alternatively, this project may be redistributed and/or modified under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; version 3. This project 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this project. If not, see . * * For any further details and any questions please contact us under * contact@nymea.io or see our FAQ/Licensing Information on * https://nymea.io/license/faq * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef INTEGRATIONPLUGINDENON_H #define INTEGRATIONPLUGINDENON_H #include "heos.h" #include "avrconnection.h" #include "plugintimer.h" #include "integrations/integrationplugin.h" #include "network/zeroconf/zeroconfservicebrowser.h" #include "network/zeroconf/zeroconfserviceentry.h" #include #include #include #include #include #include #include #include class IntegrationPluginDenon : public IntegrationPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "io.nymea.IntegrationPlugin" FILE "integrationplugindenon.json") Q_INTERFACES(IntegrationPlugin) public: explicit IntegrationPluginDenon(); void init() override; void discoverThings(ThingDiscoveryInfo *info) override; void startPairing(ThingPairingInfo *info) override; void confirmPairing(ThingPairingInfo *info, const QString &username, const QString &secret) override; void setupThing(ThingSetupInfo *info) override; void postSetupThing(Thing *thing) override; void executeAction(ThingActionInfo *info) override; void thingRemoved(Thing *thing) override; void browseThing(BrowseResult *result) override; void browserItem(BrowserItemResult *result) override; void executeBrowserItem(BrowserActionInfo *info) override; void executeBrowserItemAction(BrowserItemActionInfo *info) override; private: PluginTimer *m_pluginTimer = nullptr; ZeroConfServiceBrowser *m_serviceBrowser = nullptr; QHash m_avrConnections; QHash m_heosConnections; QHash m_unfinishedHeosConnections; QHash m_unfinishedHeosPairings; QHash m_asyncAvrSetups; QHash m_asyncHeosSetups; QHash m_playerIds; QHash m_discoveredPlayerIds; QHash m_asyncActions; QUrl m_notificationUrl; QHash m_heosPendingActions; QHash m_avrPendingActions; QHash m_pendingGetSourcesRequest; QHash m_pendingBrowseResult; // QString = containerId or sourceId QHash m_pendingBrowserActions; QHash m_pendingBrowserItemActions; QHash m_mediaObjects; QHash m_groupBuffer; QHash m_playerBuffer; QHash m_heosIpAddresses; Heos *createHeosConnection(const QHostAddress &address); QHostAddress findAvrById(const QString &id); private slots: void onPluginTimer(); void onHeosConnectionChanged(bool status); void onHeosPlayersChanged(); void onHeosPlayersReceived(QList players); void onHeosPlayerInfoRecieved(HeosPlayer *player); void onHeosPlayStateReceived(int playerId, PLAYER_STATE state); void onHeosShuffleModeReceived(int playerId, bool shuffle); void onHeosRepeatModeReceived(int playerId, REPEAT_MODE repeatMode); void onHeosMuteStatusReceived(int playerId, bool mute); void onHeosVolumeStatusReceived(int playerId, int volume); void onHeosNowPlayingMediaStatusReceived(int playerId, const QString &sourceId, const QString &artist, const QString &album, const QString &song, const QString &artwork); void onHeosMusicSourcesReceived(quint32 sequenceNumber, QList musicSources); void onHeosBrowseRequestReceived(quint32 sequenceNumber, const QString &sourceId, const QString &containerId, QList musicSources, QList mediaItems); void onHeosBrowseErrorReceived(const QString &sourceId, const QString &containerId, int errorId, const QString &errorMessage); void onHeosPlayerNowPlayingChanged(int playerId); void onHeosPlayerQueueChanged(int playerId); void onHeosGroupsReceived(QList groups); void onHeosGroupsChanged(); void onHeosUserChanged(bool signedIn, const QString &userName); void onHeosDiscoveryFinished(); void onAvrConnectionChanged(bool status); void onAvrSocketError(); void onAvrCommandExecuted(const QUuid &commandId, bool success); void onAvrVolumeChanged(int volume); void onAvrChannelChanged(const QString &channel); void onAvrMuteChanged(bool mute); void onAvrPowerChanged(bool power); void onAvrSurroundModeChanged(const QString &surroundMode); void onAvrSongChanged(const QString &song); void onAvrArtistChanged(const QString &artist); void onAvrAlbumChanged(const QString &album); void onAvrPlayBackModeChanged(AvrConnection::PlayBackMode mode); void onAvrBassLevelChanged(int level); void onAvrTrebleLevelChanged(int level); void onAvrToneControlEnabledChanged(bool enabled); void onPluginConfigurationChanged(const ParamTypeId ¶mTypeId, const QVariant &value); }; #endif // INTEGRATIONPLUGINDENON_H