added browsable interface

master
nymea 2019-09-30 13:43:17 +02:00 committed by bernhard.trinnes
parent 54458ae277
commit 2b6b47167d
3 changed files with 68 additions and 0 deletions

View File

@ -756,3 +756,53 @@ void DevicePluginDenon::onPluginConfigurationChanged(const ParamTypeId &paramTyp
m_notificationUrl = value.toUrl();
}
}
Device::BrowseResult DevicePluginDenon::browseDevice(Device *device, Device::BrowseResult result, const QString &itemId, const QLocale &locale)
{
Q_UNUSED(locale)
Heos *heos = m_heos.key(device);
if (!heos) {
result.status = Device::DeviceErrorHardwareNotAvailable;
return result;
}
return Device::DeviceErrorNoError;
}
Device::BrowserItemResult DevicePluginDenon::browserItem(Device *device, Device::BrowserItemResult result, const QString &itemId, const QLocale &locale)
{
Q_UNUSED(locale)
Heos *heos = m_heos.key(device);
if (!heos) {
result.status = Device::DeviceErrorHardwareNotAvailable;
return result;
}
return heos->browserItem(itemId, result);
}
Device::DeviceError DevicePluginDenon::executeBrowserItem(Device *device, const BrowserAction &browserAction)
{
Heos *heos = m_heos.key(device);
if (!heos) {
return Device::DeviceErrorHardwareNotAvailable;
}
return heos->launchBrowserItem(browserAction.itemId());
}
Device::DeviceError DevicePluginDenon::executeBrowserItemAction(Device *device, const BrowserItemAction &browserItemAction)
{
Heos *kodi = m_heos.key(device);
if (!kodi) {
return Device::DeviceErrorHardwareNotAvailable;
}
m_pendingBrowserItemActions.insert(id, browserItemAction.id());
return Device::DeviceErrorAsync;
}

View File

@ -63,6 +63,10 @@ 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;
private:
PluginTimer *m_pluginTimer = nullptr;
ZeroConfServiceBrowser *m_serviceBrowser = nullptr;
@ -78,6 +82,7 @@ private:
QHash<const Action *, int> m_asyncActions;
QUrl m_notificationUrl;
QHash<int, ActionId> m_pendingBrowserItemActions;s
private slots:
void onPluginTimer();

View File

@ -210,6 +210,7 @@
"displayName": "Heos player",
"createMethods": ["auto"],
"interfaces": ["mediaplayer", "mediacontroller", "extendedvolumecontroller", "mediametadataprovider", "shufflerepeat", "alert", "connectable"],
"browsable": true,
"paramTypes":[
{
"id": "89629008-6ad8-4e92-863d-b86e0e012d0b",
@ -388,6 +389,18 @@
"name": "skipNext",
"displayName": "Skip next"
}
],
"browserItemActionTypes": [
{
"id": "34167b7d-c9d0-486c-b82b-0778d69599ea",
"name": "updateLibrary",
"displayName": "Update library"
},
{
"id": "02bcfbbe-d929-439e-a04f-68ace25e93a7",
"name": "cleanLibrary",
"displayName": "Clean library"
}
]
}
]