rebased to new devicemanager api
This commit is contained in:
parent
2b6b47167d
commit
79774e5c67
@ -67,6 +67,7 @@ IntegrationPluginDenon::IntegrationPluginDenon()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void IntegrationPluginDenon::init()
|
||||
{
|
||||
m_notificationUrl = QUrl(configValue(denonPluginNotificationUrlParamTypeId).toString());
|
||||
@ -314,7 +315,7 @@ void IntegrationPluginDenon::executeAction(ThingActionInfo *info)
|
||||
|
||||
if (action.actionTypeId() == heosPlayerAlertActionTypeId) {
|
||||
heos->playUrl(playerId, m_notificationUrl);
|
||||
return Device::DeviceErrorNoError;
|
||||
return info->finish(Device::DeviceErrorNoError);
|
||||
}
|
||||
|
||||
if (action.actionTypeId() == heosPlayerVolumeActionTypeId) {
|
||||
@ -753,56 +754,63 @@ void DevicePluginDenon::onPluginConfigurationChanged(const ParamTypeId ¶mTyp
|
||||
// Check advanced mode
|
||||
if (paramTypeId == denonPluginNotificationUrlParamTypeId) {
|
||||
qCDebug(dcDenon()) << "Advanced mode" << (value.toBool() ? "enabled." : "disabled.");
|
||||
m_notificationUrl = value.toUrl();
|
||||
m_notificationUrl = value.toUrl();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Device::BrowseResult DevicePluginDenon::browseDevice(Device *device, Device::BrowseResult result, const QString &itemId, const QLocale &locale)
|
||||
void DevicePluginDenon::browseDevice(BrowseResult *result)
|
||||
{
|
||||
Q_UNUSED(locale)
|
||||
|
||||
Heos *heos = m_heos.key(device);
|
||||
Heos *heos = m_heos.value(result->device());
|
||||
if (!heos) {
|
||||
result.status = Device::DeviceErrorHardwareNotAvailable;
|
||||
return result;
|
||||
result->finish(Device::DeviceErrorHardwareNotAvailable);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
return Device::DeviceErrorNoError;
|
||||
//heos->browse(result);
|
||||
}
|
||||
|
||||
Device::BrowserItemResult DevicePluginDenon::browserItem(Device *device, Device::BrowserItemResult result, const QString &itemId, const QLocale &locale)
|
||||
void DevicePluginDenon::browserItem(BrowserItemResult *result)
|
||||
{
|
||||
Q_UNUSED(locale)
|
||||
|
||||
Heos *heos = m_heos.key(device);
|
||||
Heos *heos = m_heos.value(result->device());
|
||||
if (!heos) {
|
||||
result.status = Device::DeviceErrorHardwareNotAvailable;
|
||||
return result;
|
||||
result->finish(Device::DeviceErrorHardwareNotAvailable);
|
||||
return;
|
||||
}
|
||||
|
||||
return heos->browserItem(itemId, result);
|
||||
return;
|
||||
}
|
||||
|
||||
Device::DeviceError DevicePluginDenon::executeBrowserItem(Device *device, const BrowserAction &browserAction)
|
||||
void DevicePluginDenon::executeBrowserItem(BrowserActionInfo *info)
|
||||
{
|
||||
Heos *heos = m_heos.key(device);
|
||||
Heos *heos = m_heos.value(info->device());
|
||||
if (!heos) {
|
||||
return Device::DeviceErrorHardwareNotAvailable;
|
||||
info->finish(Device::DeviceErrorHardwareNotAvailable);
|
||||
return;
|
||||
}
|
||||
|
||||
return heos->launchBrowserItem(browserAction.itemId());
|
||||
/*
|
||||
int id = kodi->launchBrowserItem(info->browserAction().itemId());
|
||||
if (id == -1) {
|
||||
return info->finish(Device::DeviceErrorHardwareFailure);
|
||||
}
|
||||
m_pendingBrowserActions.insert(id, info);
|
||||
connect(info, &QObject::destroyed, this, [this, id](){ m_pendingBrowserActions.remove(id); });*/
|
||||
}
|
||||
|
||||
Device::DeviceError DevicePluginDenon::executeBrowserItemAction(Device *device, const BrowserItemAction &browserItemAction)
|
||||
void DevicePluginDenon::executeBrowserItemAction(BrowserItemActionInfo *info)
|
||||
{
|
||||
Heos *kodi = m_heos.key(device);
|
||||
Heos *kodi = m_heos.value(info->device());
|
||||
if (!kodi) {
|
||||
return Device::DeviceErrorHardwareNotAvailable;
|
||||
info->finish(Device::DeviceErrorHardwareNotAvailable);
|
||||
return;
|
||||
}
|
||||
|
||||
m_pendingBrowserItemActions.insert(id, browserItemAction.id());
|
||||
return Device::DeviceErrorAsync;
|
||||
|
||||
/*int id = kodi->executeBrowserItemAction(info->browserItemAction().itemId(), info->browserItemAction().actionTypeId());
|
||||
if (id == -1) {
|
||||
return info->finish(Device::DeviceErrorHardwareFailure);
|
||||
}
|
||||
m_pendingBrowserItemActions.insert(id, info);
|
||||
connect(info, &QObject::destroyed, this, [this, id](){ m_pendingBrowserItemActions.remove(id); });*/
|
||||
}
|
||||
|
||||
@ -63,10 +63,11 @@ public:
|
||||
void executeAction(ThingActionInfo *info) override;
|
||||
void thingRemoved(Thing *thing) override;
|
||||
|
||||
Device::BrowseResult browseDevice(Device *device, Device::BrowseResult result, const QString &itemId, const QLocale &locale) override;
|
||||
Device::BrowserItemResult browserItem(Device *device, Device::BrowserItemResult result, const QString &itemId, const QLocale &locale) override;
|
||||
Device::DeviceError executeBrowserItem(Device *device, const BrowserAction &browserAction) override;
|
||||
Device::DeviceError executeBrowserItemAction(Device *device, const BrowserItemAction &browserItemAction) override;
|
||||
void browseDevice(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;
|
||||
@ -82,7 +83,9 @@ private:
|
||||
QHash<const Action *, int> m_asyncActions;
|
||||
QUrl m_notificationUrl;
|
||||
|
||||
QHash<int, ActionId> m_pendingBrowserItemActions;s
|
||||
QHash<int, DeviceActionInfo*> m_pendingActions;
|
||||
QHash<int, BrowserActionInfo*> m_pendingBrowserActions;
|
||||
QHash<int, BrowserItemActionInfo*> m_pendingBrowserItemActions;
|
||||
|
||||
private slots:
|
||||
void onPluginTimer();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user