Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates After testing with Sony SNC-CH210 #2

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions src/DiscoverCamera.qml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ Kirigami.ScrollablePage {
selectedIndex = deviceManager.appendDevice()
var newDevice = deviceManager.at(selectedIndex)
newDevice.deviceName = modelData.name;
console.log(modelData.xAddr)
newDevice.hostName = modelData.host;
console.log(modelData.xAddr[0])
newDevice.hostName = modelData.host[0];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you want a list of hostnames if you are just choosing the first?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not using this qml file. This was just a quick change to ensure that it continues to function. The previous implementation just chose the last host. This is something you'll have to rethink on your end. Ultimately I believe a host list should be returned since certain devices report more than one host interface.

newDevice.connectToDevice();
deviceManager.saveDevices()

Expand Down
17 changes: 13 additions & 4 deletions src/onvifdevicediscover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ void OnvifDeviceDiscover::start()
#endif
}

void OnvifDeviceDiscover::stop()
{
#ifdef WITH_KDSOAP_WSDISCOVERY_CLIENT
m_probeJob->stop();
#endif
}

void OnvifDeviceDiscover::matchReceived(const QSharedPointer<WSDiscoveryTargetService>& matchedService)
{
#ifdef WITH_KDSOAP_WSDISCOVERY_CLIENT
Expand All @@ -86,8 +93,10 @@ void OnvifDeviceDiscover::matchReceived(const QSharedPointer<WSDiscoveryTargetSe
}
}
}
deviceMatch->m_xAddr = matchedService->xAddrList();
deviceMatch->m_host.clear();
for (auto& xAddr : matchedService->xAddrList()) {
deviceMatch->m_xAddr = xAddr;
deviceMatch->m_host << xAddr.authority();
}
deviceMatch->m_lastSeen = matchedService->lastSeen();

Expand All @@ -106,14 +115,14 @@ QString OnvifDeviceDiscoverMatch::getEndpoint() const
return m_endpoint;
}

QUrl OnvifDeviceDiscoverMatch::getXAddr() const
QList<QUrl> OnvifDeviceDiscoverMatch::getXAddr() const
{
return m_xAddr;
}

QString OnvifDeviceDiscoverMatch::getHost() const
QStringList OnvifDeviceDiscoverMatch::getHost() const
{
return m_xAddr.authority();
return m_host;
}

QString OnvifDeviceDiscoverMatch::getName() const
Expand Down
13 changes: 8 additions & 5 deletions src/onvifdevicediscover.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define ONVIFDEVICEDISCOVER_H

#include <QMap>
#include <QList>
#include <QObject>
#include <QUrl>
#include <QDateTime>
Expand All @@ -32,20 +33,21 @@ class OnvifDeviceDiscoverMatch : public QObject
Q_PROPERTY(QString name READ getName CONSTANT)
Q_PROPERTY(QString hardware READ getHardware CONSTANT)
Q_PROPERTY(QString endpoint READ getEndpoint CONSTANT)
Q_PROPERTY(QUrl xAddr READ getXAddr CONSTANT)
Q_PROPERTY(QString host READ getHost CONSTANT)
Q_PROPERTY(QList<QUrl> xAddr READ getXAddr CONSTANT)
Q_PROPERTY(QStringList host READ getHost CONSTANT)
public:
QString getName() const;
QString getHardware() const;
QString getEndpoint() const;
QUrl getXAddr() const;
QString getHost() const;
QList<QUrl> getXAddr() const;
QStringList getHost() const;

protected:
QString m_name;
QString m_hardware;
QString m_endpoint;
QUrl m_xAddr;
QList<QUrl> m_xAddr;
QStringList m_host;
QDateTime m_lastSeen;

friend class OnvifDeviceDiscover;
Expand All @@ -66,6 +68,7 @@ class OnvifDeviceDiscover : public QObject

public slots:
void start();
void stop();

private slots:
void matchReceived(const QSharedPointer<WSDiscoveryTargetService>& matchedService);
Expand Down