Kodi, AvahiMonitor: Update to new ZeroConf API
This commit is contained in:
parent
e6347ba0a9
commit
40c0de8863
@ -44,7 +44,7 @@
|
|||||||
#include "plugin/device.h"
|
#include "plugin/device.h"
|
||||||
#include "devicemanager.h"
|
#include "devicemanager.h"
|
||||||
#include "plugininfo.h"
|
#include "plugininfo.h"
|
||||||
#include "network/avahi/qtavahiservicebrowser.h"
|
#include "network/zeroconf/zeroconfservicebrowser.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
@ -58,8 +58,8 @@ DevicePluginAvahiMonitor::DevicePluginAvahiMonitor()
|
|||||||
|
|
||||||
void DevicePluginAvahiMonitor::init()
|
void DevicePluginAvahiMonitor::init()
|
||||||
{
|
{
|
||||||
connect(hardwareManager()->avahiBrowser(), &QtAvahiServiceBrowser::serviceEntryAdded, this, &DevicePluginAvahiMonitor::onServiceEntryAdded);
|
connect(hardwareManager()->zeroConfServiceBrowser(), &ZeroConfServiceBrowser::serviceEntryAdded, this, &DevicePluginAvahiMonitor::onServiceEntryAdded);
|
||||||
connect(hardwareManager()->avahiBrowser(), &QtAvahiServiceBrowser::serviceEntryRemoved, this, &DevicePluginAvahiMonitor::onServiceEntryRemoved);
|
connect(hardwareManager()->zeroConfServiceBrowser(), &ZeroConfServiceBrowser::serviceEntryRemoved, this, &DevicePluginAvahiMonitor::onServiceEntryRemoved);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceManager::DeviceSetupStatus DevicePluginAvahiMonitor::setupDevice(Device *device)
|
DeviceManager::DeviceSetupStatus DevicePluginAvahiMonitor::setupDevice(Device *device)
|
||||||
@ -77,7 +77,7 @@ DeviceManager::DeviceError DevicePluginAvahiMonitor::discoverDevices(const Devic
|
|||||||
return DeviceManager::DeviceErrorDeviceClassNotFound;
|
return DeviceManager::DeviceErrorDeviceClassNotFound;
|
||||||
|
|
||||||
QList<DeviceDescriptor> deviceDescriptors;
|
QList<DeviceDescriptor> deviceDescriptors;
|
||||||
foreach (const AvahiServiceEntry &service, hardwareManager()->avahiBrowser()->serviceEntries()) {
|
foreach (const ZeroConfServiceEntry &service, hardwareManager()->zeroConfServiceBrowser()->serviceEntries()) {
|
||||||
DeviceDescriptor deviceDescriptor(avahiDeviceClassId, service.name(), service.hostAddress().toString());
|
DeviceDescriptor deviceDescriptor(avahiDeviceClassId, service.name(), service.hostAddress().toString());
|
||||||
ParamList params;
|
ParamList params;
|
||||||
params.append(Param(avahiDeviceServiceParamTypeId, service.name()));
|
params.append(Param(avahiDeviceServiceParamTypeId, service.name()));
|
||||||
@ -97,7 +97,7 @@ DeviceManager::DeviceError DevicePluginAvahiMonitor::discoverDevices(const Devic
|
|||||||
return DeviceManager::DeviceErrorAsync;
|
return DeviceManager::DeviceErrorAsync;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevicePluginAvahiMonitor::onServiceEntryAdded(const AvahiServiceEntry &serviceEntry)
|
void DevicePluginAvahiMonitor::onServiceEntryAdded(const ZeroConfServiceEntry &serviceEntry)
|
||||||
{
|
{
|
||||||
foreach (Device *device, myDevices()) {
|
foreach (Device *device, myDevices()) {
|
||||||
if (device->paramValue(avahiDeviceServiceParamTypeId).toString() == serviceEntry.name()) {
|
if (device->paramValue(avahiDeviceServiceParamTypeId).toString() == serviceEntry.name()) {
|
||||||
@ -107,7 +107,7 @@ void DevicePluginAvahiMonitor::onServiceEntryAdded(const AvahiServiceEntry &serv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevicePluginAvahiMonitor::onServiceEntryRemoved(const AvahiServiceEntry &serviceEntry)
|
void DevicePluginAvahiMonitor::onServiceEntryRemoved(const ZeroConfServiceEntry &serviceEntry)
|
||||||
{
|
{
|
||||||
foreach (Device *device, myDevices()) {
|
foreach (Device *device, myDevices()) {
|
||||||
if (device->paramValue(avahiDeviceServiceParamTypeId).toString() == serviceEntry.name()) {
|
if (device->paramValue(avahiDeviceServiceParamTypeId).toString() == serviceEntry.name()) {
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
#define DEVICEPLUGINAVAHIMONITOR_H
|
#define DEVICEPLUGINAVAHIMONITOR_H
|
||||||
|
|
||||||
#include "plugin/deviceplugin.h"
|
#include "plugin/deviceplugin.h"
|
||||||
#include "network/avahi/avahiserviceentry.h"
|
#include "network/zeroconf/zeroconfserviceentry.h"
|
||||||
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
@ -45,8 +45,8 @@ public:
|
|||||||
DeviceManager::DeviceError discoverDevices(const DeviceClassId &deviceClassId, const ParamList ¶ms) override;
|
DeviceManager::DeviceError discoverDevices(const DeviceClassId &deviceClassId, const ParamList ¶ms) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onServiceEntryAdded(const AvahiServiceEntry &serviceEntry);
|
void onServiceEntryAdded(const ZeroConfServiceEntry &serviceEntry);
|
||||||
void onServiceEntryRemoved(const AvahiServiceEntry &serviceEntry);
|
void onServiceEntryRemoved(const ZeroConfServiceEntry &serviceEntry);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DEVICEPLUGINAVAHIMONITOR_H
|
#endif // DEVICEPLUGINAVAHIMONITOR_H
|
||||||
|
|||||||
@ -65,8 +65,8 @@
|
|||||||
#include "plugin/device.h"
|
#include "plugin/device.h"
|
||||||
#include "plugininfo.h"
|
#include "plugininfo.h"
|
||||||
#include "network/upnp/upnpdiscovery.h"
|
#include "network/upnp/upnpdiscovery.h"
|
||||||
#include "network/avahi/qtavahiservicebrowser.h"
|
#include "network/zeroconf/zeroconfservicebrowser.h"
|
||||||
#include "network/avahi/avahiserviceentry.h"
|
#include "network/zeroconf/zeroconfserviceentry.h"
|
||||||
#include "network/networkaccessmanager.h"
|
#include "network/networkaccessmanager.h"
|
||||||
|
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
@ -184,7 +184,7 @@ DeviceManager::DeviceError DevicePluginKodi::discoverDevices(const DeviceClassId
|
|||||||
Q_UNUSED(deviceClassId)
|
Q_UNUSED(deviceClassId)
|
||||||
|
|
||||||
QList<DeviceDescriptor> descriptors;
|
QList<DeviceDescriptor> descriptors;
|
||||||
foreach (const AvahiServiceEntry &avahiEntry, hardwareManager()->avahiBrowser()->serviceEntries()) {
|
foreach (const ZeroConfServiceEntry &avahiEntry, hardwareManager()->zeroConfServiceBrowser()->serviceEntries()) {
|
||||||
if (avahiEntry.serviceType() == "_xbmc-jsonrpc._tcp") {
|
if (avahiEntry.serviceType() == "_xbmc-jsonrpc._tcp") {
|
||||||
qCDebug(dcKodi) << "Zeroconf entry:" << avahiEntry;
|
qCDebug(dcKodi) << "Zeroconf entry:" << avahiEntry;
|
||||||
DeviceDescriptor descriptor(kodiDeviceClassId, avahiEntry.name(), avahiEntry.hostName() + " (" + avahiEntry.hostAddress().toString() + ")");
|
DeviceDescriptor descriptor(kodiDeviceClassId, avahiEntry.name(), avahiEntry.hostName() + " (" + avahiEntry.hostAddress().toString() + ")");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user