complete discovery renaming
parent
9a08e50ae3
commit
76954a1403
|
|
@ -199,12 +199,10 @@ void registerQmlTypes() {
|
||||||
qmlRegisterUncreatableType<DeviceClass>(uri, 1, 0, "DeviceClass", "Can't create this in QML. Get it from the DeviceClasses.");
|
qmlRegisterUncreatableType<DeviceClass>(uri, 1, 0, "DeviceClass", "Can't create this in QML. Get it from the DeviceClasses.");
|
||||||
qmlRegisterUncreatableType<DeviceClasses>(uri, 1, 0, "DeviceClasses", "Can't create this in QML. Get it from the DeviceManager.");
|
qmlRegisterUncreatableType<DeviceClasses>(uri, 1, 0, "DeviceClasses", "Can't create this in QML. Get it from the DeviceManager.");
|
||||||
qmlRegisterType<DeviceClassesProxy>(uri, 1, 0, "DeviceClassesProxy");
|
qmlRegisterType<DeviceClassesProxy>(uri, 1, 0, "DeviceClassesProxy");
|
||||||
qmlRegisterType<ThingDiscovery>(uri, 1, 0, "DeviceDiscovery");
|
|
||||||
qmlRegisterType<ThingDiscovery>(uri, 1, 0, "ThingDiscovery");
|
qmlRegisterType<ThingDiscovery>(uri, 1, 0, "ThingDiscovery");
|
||||||
qmlRegisterType<DeviceDiscoveryProxy>(uri, 1, 0, "DeviceDiscoveryProxy");
|
qmlRegisterType<ThingDiscoveryProxy>(uri, 1, 0, "ThingDiscoveryProxy");
|
||||||
qmlRegisterType<DeviceDiscoveryProxy>(uri, 1, 0, "ThingDiscoveryProxy");
|
qmlRegisterUncreatableType<ThingDescriptor>(uri, 1, 0, "DeviceDescriptor", "Get it from DeviceDiscovery");
|
||||||
qmlRegisterUncreatableType<DeviceDescriptor>(uri, 1, 0, "DeviceDescriptor", "Get it from DeviceDiscovery");
|
qmlRegisterUncreatableType<ThingDescriptor>(uri, 1, 0, "ThingDescriptor", "Get it from ThingDiscovery");
|
||||||
qmlRegisterUncreatableType<DeviceDescriptor>(uri, 1, 0, "ThingDescriptor", "Get it from ThingDiscovery");
|
|
||||||
|
|
||||||
qmlRegisterType<DeviceModel>(uri, 1, 0, "DeviceModel");
|
qmlRegisterType<DeviceModel>(uri, 1, 0, "DeviceModel");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ QVariant ThingDiscovery::data(const QModelIndex &index, int role) const
|
||||||
case RoleDescription:
|
case RoleDescription:
|
||||||
return m_foundDevices.at(index.row())->description();
|
return m_foundDevices.at(index.row())->description();
|
||||||
case RoleDeviceId:
|
case RoleDeviceId:
|
||||||
return m_foundDevices.at(index.row())->deviceId();
|
return m_foundDevices.at(index.row())->thingId();
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
@ -100,7 +100,7 @@ void ThingDiscovery::discoverThings(const QUuid &deviceClassId, const QVariantLi
|
||||||
emit busyChanged();
|
emit busyChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceDescriptor *ThingDiscovery::get(int index) const
|
ThingDescriptor *ThingDiscovery::get(int index) const
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= m_foundDevices.count()) {
|
if (index < 0 || index >= m_foundDevices.count()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -139,7 +139,7 @@ void ThingDiscovery::discoverThingsResponse(int /*commandId*/, const QVariantMap
|
||||||
qDebug() << "Found device. Descriptor:" << descriptorVariant;
|
qDebug() << "Found device. Descriptor:" << descriptorVariant;
|
||||||
if (!contains(descriptorVariant.toMap().value("id").toUuid())) {
|
if (!contains(descriptorVariant.toMap().value("id").toUuid())) {
|
||||||
beginInsertRows(QModelIndex(), m_foundDevices.count(), m_foundDevices.count());
|
beginInsertRows(QModelIndex(), m_foundDevices.count(), m_foundDevices.count());
|
||||||
DeviceDescriptor *descriptor = new DeviceDescriptor(descriptorVariant.toMap().value("id").toUuid(),
|
ThingDescriptor *descriptor = new ThingDescriptor(descriptorVariant.toMap().value("id").toUuid(),
|
||||||
descriptorVariant.toMap().value("deviceId").toString(),
|
descriptorVariant.toMap().value("deviceId").toString(),
|
||||||
descriptorVariant.toMap().value("title").toString(),
|
descriptorVariant.toMap().value("title").toString(),
|
||||||
descriptorVariant.toMap().value("description").toString());
|
descriptorVariant.toMap().value("description").toString());
|
||||||
|
|
@ -161,7 +161,7 @@ void ThingDiscovery::discoverThingsResponse(int /*commandId*/, const QVariantMap
|
||||||
|
|
||||||
bool ThingDiscovery::contains(const QUuid &deviceDescriptorId) const
|
bool ThingDiscovery::contains(const QUuid &deviceDescriptorId) const
|
||||||
{
|
{
|
||||||
foreach (DeviceDescriptor *descriptor, m_foundDevices) {
|
foreach (ThingDescriptor *descriptor, m_foundDevices) {
|
||||||
if (descriptor->id() == deviceDescriptorId) {
|
if (descriptor->id() == deviceDescriptorId) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -169,10 +169,10 @@ bool ThingDiscovery::contains(const QUuid &deviceDescriptorId) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceDescriptor::DeviceDescriptor(const QUuid &id, const QUuid &deviceId, const QString &name, const QString &description, QObject *parent):
|
ThingDescriptor::ThingDescriptor(const QUuid &id, const QUuid &thingId, const QString &name, const QString &description, QObject *parent):
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_id(id),
|
m_id(id),
|
||||||
m_deviceId(deviceId),
|
m_thingId(thingId),
|
||||||
m_name(name),
|
m_name(name),
|
||||||
m_description(description),
|
m_description(description),
|
||||||
m_params(new Params(this))
|
m_params(new Params(this))
|
||||||
|
|
@ -180,60 +180,60 @@ DeviceDescriptor::DeviceDescriptor(const QUuid &id, const QUuid &deviceId, const
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid DeviceDescriptor::id() const
|
QUuid ThingDescriptor::id() const
|
||||||
{
|
{
|
||||||
return m_id;
|
return m_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid DeviceDescriptor::deviceId() const
|
QUuid ThingDescriptor::thingId() const
|
||||||
{
|
{
|
||||||
return m_deviceId;
|
return m_thingId;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DeviceDescriptor::name() const
|
QString ThingDescriptor::name() const
|
||||||
{
|
{
|
||||||
return m_name;
|
return m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DeviceDescriptor::description() const
|
QString ThingDescriptor::description() const
|
||||||
{
|
{
|
||||||
return m_description;
|
return m_description;
|
||||||
}
|
}
|
||||||
|
|
||||||
Params* DeviceDescriptor::params() const
|
Params* ThingDescriptor::params() const
|
||||||
{
|
{
|
||||||
return m_params;
|
return m_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceDiscoveryProxy::DeviceDiscoveryProxy(QObject *parent):
|
ThingDiscoveryProxy::ThingDiscoveryProxy(QObject *parent):
|
||||||
QSortFilterProxyModel (parent)
|
QSortFilterProxyModel (parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ThingDiscovery *DeviceDiscoveryProxy::deviceDiscovery() const
|
ThingDiscovery *ThingDiscoveryProxy::thingDiscovery() const
|
||||||
{
|
{
|
||||||
return m_deviceDiscovery;
|
return m_thingDiscovery;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceDiscoveryProxy::setDeviceDiscovery(ThingDiscovery *deviceDiscovery)
|
void ThingDiscoveryProxy::setThingDiscovery(ThingDiscovery *thingDiscovery)
|
||||||
{
|
{
|
||||||
if (m_deviceDiscovery != deviceDiscovery) {
|
if (m_thingDiscovery != thingDiscovery) {
|
||||||
m_deviceDiscovery = deviceDiscovery;
|
m_thingDiscovery = thingDiscovery;
|
||||||
setSourceModel(deviceDiscovery);
|
setSourceModel(thingDiscovery);
|
||||||
emit deviceDiscoveryChanged();
|
emit thingDiscoveryChanged();
|
||||||
emit countChanged();
|
emit countChanged();
|
||||||
connect(m_deviceDiscovery, &ThingDiscovery::countChanged, this, &DeviceDiscoveryProxy::countChanged);
|
connect(m_thingDiscovery, &ThingDiscovery::countChanged, this, &ThingDiscoveryProxy::countChanged);
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceDiscoveryProxy::showAlreadyAdded() const
|
bool ThingDiscoveryProxy::showAlreadyAdded() const
|
||||||
{
|
{
|
||||||
return m_showAlreadyAdded;
|
return m_showAlreadyAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceDiscoveryProxy::setShowAlreadyAdded(bool showAlreadyAdded)
|
void ThingDiscoveryProxy::setShowAlreadyAdded(bool showAlreadyAdded)
|
||||||
{
|
{
|
||||||
if (m_showAlreadyAdded != showAlreadyAdded) {
|
if (m_showAlreadyAdded != showAlreadyAdded) {
|
||||||
m_showAlreadyAdded = showAlreadyAdded;
|
m_showAlreadyAdded = showAlreadyAdded;
|
||||||
|
|
@ -243,12 +243,12 @@ void DeviceDiscoveryProxy::setShowAlreadyAdded(bool showAlreadyAdded)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceDiscoveryProxy::showNew() const
|
bool ThingDiscoveryProxy::showNew() const
|
||||||
{
|
{
|
||||||
return m_showNew;
|
return m_showNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceDiscoveryProxy::setShowNew(bool showNew)
|
void ThingDiscoveryProxy::setShowNew(bool showNew)
|
||||||
{
|
{
|
||||||
if (m_showNew != showNew) {
|
if (m_showNew != showNew) {
|
||||||
m_showNew = showNew;
|
m_showNew = showNew;
|
||||||
|
|
@ -258,37 +258,37 @@ void DeviceDiscoveryProxy::setShowNew(bool showNew)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid DeviceDiscoveryProxy::filterDeviceId() const
|
QUuid ThingDiscoveryProxy::filterThingId() const
|
||||||
{
|
{
|
||||||
return m_filterDeviceId;
|
return m_filterThingId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceDiscoveryProxy::setFilterDeviceId(const QUuid &filterDeviceId)
|
void ThingDiscoveryProxy::setFilterThingId(const QUuid &filterDeviceId)
|
||||||
{
|
{
|
||||||
if (m_filterDeviceId != filterDeviceId) {
|
if (m_filterThingId != filterDeviceId) {
|
||||||
m_filterDeviceId = filterDeviceId;
|
m_filterThingId = filterDeviceId;
|
||||||
emit filterDeviceIdChanged();
|
emit filterThingIdChanged();
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
emit countChanged();
|
emit countChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceDescriptor *DeviceDiscoveryProxy::get(int index) const
|
ThingDescriptor *ThingDiscoveryProxy::get(int index) const
|
||||||
{
|
{
|
||||||
return m_deviceDiscovery->get(mapToSource(this->index(index, 0)).row());
|
return m_thingDiscovery->get(mapToSource(this->index(index, 0)).row());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceDiscoveryProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
bool ThingDiscoveryProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(sourceParent)
|
Q_UNUSED(sourceParent)
|
||||||
DeviceDescriptor* dev = m_deviceDiscovery->get(sourceRow);
|
ThingDescriptor* dev = m_thingDiscovery->get(sourceRow);
|
||||||
if (!m_showAlreadyAdded && !dev->deviceId().isNull()) {
|
if (!m_showAlreadyAdded && !dev->thingId().isNull()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!m_showNew && dev->deviceId().isNull()) {
|
if (!m_showNew && dev->thingId().isNull()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!m_filterDeviceId.isNull() && dev->deviceId() != m_filterDeviceId) {
|
if (!m_filterThingId.isNull() && dev->thingId() != m_filterThingId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -36,25 +36,25 @@
|
||||||
|
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
class DeviceDescriptor: public QObject {
|
class ThingDescriptor: public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QUuid id READ id CONSTANT)
|
Q_PROPERTY(QUuid id READ id CONSTANT)
|
||||||
Q_PROPERTY(QUuid deviceId READ deviceId CONSTANT)
|
Q_PROPERTY(QUuid thingId READ thingId CONSTANT)
|
||||||
Q_PROPERTY(QString name READ name CONSTANT)
|
Q_PROPERTY(QString name READ name CONSTANT)
|
||||||
Q_PROPERTY(QString description READ description CONSTANT)
|
Q_PROPERTY(QString description READ description CONSTANT)
|
||||||
Q_PROPERTY(Params* params READ params CONSTANT)
|
Q_PROPERTY(Params* params READ params CONSTANT)
|
||||||
public:
|
public:
|
||||||
DeviceDescriptor(const QUuid &id, const QUuid &deviceId, const QString &name, const QString &description, QObject *parent = nullptr);
|
ThingDescriptor(const QUuid &id, const QUuid &thingId, const QString &name, const QString &description, QObject *parent = nullptr);
|
||||||
|
|
||||||
QUuid id() const;
|
QUuid id() const;
|
||||||
QUuid deviceId() const;
|
QUuid thingId() const;
|
||||||
QString name() const;
|
QString name() const;
|
||||||
QString description() const;
|
QString description() const;
|
||||||
Params* params() const;
|
Params* params() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QUuid m_id;
|
QUuid m_id;
|
||||||
QUuid m_deviceId;
|
QUuid m_thingId;
|
||||||
QString m_name;
|
QString m_name;
|
||||||
QString m_description;
|
QString m_description;
|
||||||
Params *m_params = nullptr;
|
Params *m_params = nullptr;
|
||||||
|
|
@ -84,7 +84,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void discoverThings(const QUuid &thingClassId, const QVariantList &discoveryParams = {});
|
Q_INVOKABLE void discoverThings(const QUuid &thingClassId, const QVariantList &discoveryParams = {});
|
||||||
|
|
||||||
Q_INVOKABLE DeviceDescriptor* get(int index) const;
|
Q_INVOKABLE ThingDescriptor* get(int index) const;
|
||||||
|
|
||||||
Engine* engine() const;
|
Engine* engine() const;
|
||||||
void setEngine(Engine *jsonRpcClient);
|
void setEngine(Engine *jsonRpcClient);
|
||||||
|
|
@ -106,23 +106,23 @@ private:
|
||||||
QString m_displayMessage;
|
QString m_displayMessage;
|
||||||
|
|
||||||
bool contains(const QUuid &deviceDescriptorId) const;
|
bool contains(const QUuid &deviceDescriptorId) const;
|
||||||
QList<DeviceDescriptor*> m_foundDevices;
|
QList<ThingDescriptor*> m_foundDevices;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DeviceDiscoveryProxy: public QSortFilterProxyModel
|
class ThingDiscoveryProxy: public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
|
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
|
||||||
Q_PROPERTY(ThingDiscovery* deviceDiscovery READ deviceDiscovery WRITE setDeviceDiscovery NOTIFY deviceDiscoveryChanged)
|
Q_PROPERTY(ThingDiscovery* thingDiscovery READ thingDiscovery WRITE setThingDiscovery NOTIFY thingDiscoveryChanged)
|
||||||
Q_PROPERTY(bool showAlreadyAdded READ showAlreadyAdded WRITE setShowAlreadyAdded NOTIFY showAlreadyAddedChanged)
|
Q_PROPERTY(bool showAlreadyAdded READ showAlreadyAdded WRITE setShowAlreadyAdded NOTIFY showAlreadyAddedChanged)
|
||||||
Q_PROPERTY(bool showNew READ showNew WRITE setShowNew NOTIFY showNewChanged)
|
Q_PROPERTY(bool showNew READ showNew WRITE setShowNew NOTIFY showNewChanged)
|
||||||
Q_PROPERTY(QUuid filterDeviceId READ filterDeviceId WRITE setFilterDeviceId NOTIFY filterDeviceIdChanged)
|
Q_PROPERTY(QUuid filterThingId READ filterThingId WRITE setFilterThingId NOTIFY filterThingIdChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DeviceDiscoveryProxy(QObject *parent = nullptr);
|
ThingDiscoveryProxy(QObject *parent = nullptr);
|
||||||
|
|
||||||
ThingDiscovery* deviceDiscovery() const;
|
ThingDiscovery* thingDiscovery() const;
|
||||||
void setDeviceDiscovery(ThingDiscovery* deviceDiscovery);
|
void setThingDiscovery(ThingDiscovery* thingDiscovery);
|
||||||
|
|
||||||
bool showAlreadyAdded() const;
|
bool showAlreadyAdded() const;
|
||||||
void setShowAlreadyAdded(bool showAlreadyAdded);
|
void setShowAlreadyAdded(bool showAlreadyAdded);
|
||||||
|
|
@ -130,26 +130,26 @@ public:
|
||||||
bool showNew() const;
|
bool showNew() const;
|
||||||
void setShowNew(bool showNew);
|
void setShowNew(bool showNew);
|
||||||
|
|
||||||
QUuid filterDeviceId() const;
|
QUuid filterThingId() const;
|
||||||
void setFilterDeviceId(const QUuid &filterDeviceId);
|
void setFilterThingId(const QUuid &filterDeviceId);
|
||||||
|
|
||||||
Q_INVOKABLE DeviceDescriptor* get(int index) const;
|
Q_INVOKABLE ThingDescriptor* get(int index) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void countChanged();
|
void countChanged();
|
||||||
void deviceDiscoveryChanged();
|
void thingDiscoveryChanged();
|
||||||
void showAlreadyAddedChanged();
|
void showAlreadyAddedChanged();
|
||||||
void showNewChanged();
|
void showNewChanged();
|
||||||
void filterDeviceIdChanged();
|
void filterThingIdChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ThingDiscovery* m_deviceDiscovery = nullptr;
|
ThingDiscovery* m_thingDiscovery = nullptr;
|
||||||
bool m_showAlreadyAdded = false;
|
bool m_showAlreadyAdded = false;
|
||||||
bool m_showNew = true;
|
bool m_showNew = true;
|
||||||
QUuid m_filterDeviceId;
|
QUuid m_filterThingId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // THINGDISCOVERY_H
|
#endif // THINGDISCOVERY_H
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@ Page {
|
||||||
id: d
|
id: d
|
||||||
property var vendorId: null
|
property var vendorId: null
|
||||||
property ThingDescriptor thingDescriptor: null
|
property ThingDescriptor thingDescriptor: null
|
||||||
property alias deviceDescriptor: d.thingDescriptor
|
|
||||||
property var discoveryParams: []
|
property var discoveryParams: []
|
||||||
property string deviceName: ""
|
property string deviceName: ""
|
||||||
property int pairRequestId: 0
|
property int pairRequestId: 0
|
||||||
|
|
@ -86,7 +85,7 @@ Page {
|
||||||
internalPageStack.push(discoveryParamsPage)
|
internalPageStack.push(discoveryParamsPage)
|
||||||
} else {
|
} else {
|
||||||
print("Starting discovery...")
|
print("Starting discovery...")
|
||||||
discovery.discoverDevices(deviceClass.id)
|
discovery.discoverThings(deviceClass.id)
|
||||||
internalPageStack.push(discoveryPage, {deviceClass: deviceClass})
|
internalPageStack.push(discoveryPage, {deviceClass: deviceClass})
|
||||||
}
|
}
|
||||||
} else if (root.deviceClass.createMethods.indexOf("CreateMethodUser") !== -1) {
|
} else if (root.deviceClass.createMethods.indexOf("CreateMethodUser") !== -1) {
|
||||||
|
|
@ -171,7 +170,7 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceDiscovery {
|
ThingDiscovery {
|
||||||
id: discovery
|
id: discovery
|
||||||
engine: _engine
|
engine: _engine
|
||||||
}
|
}
|
||||||
|
|
@ -218,7 +217,7 @@ Page {
|
||||||
param["value"] = paramRepeater.itemAt(i).value
|
param["value"] = paramRepeater.itemAt(i).value
|
||||||
d.discoveryParams.push(param);
|
d.discoveryParams.push(param);
|
||||||
}
|
}
|
||||||
discovery.discoverDevices(root.deviceClass.id, d.discoveryParams)
|
discovery.discoverThings(root.deviceClass.id, d.discoveryParams)
|
||||||
internalPageStack.push(discoveryPage, {deviceClass: root.deviceClass})
|
internalPageStack.push(discoveryPage, {deviceClass: root.deviceClass})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -259,12 +258,12 @@ Page {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
clip: true
|
clip: true
|
||||||
model: DeviceDiscoveryProxy {
|
model: ThingDiscoveryProxy {
|
||||||
id: discoveryProxy
|
id: discoveryProxy
|
||||||
deviceDiscovery: discovery
|
thingDiscovery: discovery
|
||||||
showAlreadyAdded: root.device !== null
|
showAlreadyAdded: root.device !== null
|
||||||
showNew: root.device === null
|
showNew: root.device === null
|
||||||
filterDeviceId: root.device ? root.device.id : ""
|
filterThingId: root.device ? root.device.id : ""
|
||||||
}
|
}
|
||||||
delegate: NymeaSwipeDelegate {
|
delegate: NymeaSwipeDelegate {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
@ -273,7 +272,7 @@ Page {
|
||||||
subText: model.description
|
subText: model.description
|
||||||
iconName: app.interfacesToIcon(discoveryView.deviceClass.interfaces)
|
iconName: app.interfacesToIcon(discoveryView.deviceClass.interfaces)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
d.deviceDescriptor = discoveryProxy.get(index);
|
d.thingDescriptor = discoveryProxy.get(index);
|
||||||
d.deviceName = model.name;
|
d.deviceName = model.name;
|
||||||
internalPageStack.push(paramsPage)
|
internalPageStack.push(paramsPage)
|
||||||
}
|
}
|
||||||
|
|
@ -284,7 +283,7 @@ Page {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.leftMargin: app.margins; Layout.rightMargin: app.margins
|
Layout.leftMargin: app.margins; Layout.rightMargin: app.margins
|
||||||
text: qsTr("Search again")
|
text: qsTr("Search again")
|
||||||
onClicked: discovery.discoverDevices(root.deviceClass.id, d.discoveryParams)
|
onClicked: discovery.discoverThings(root.deviceClass.id, d.discoveryParams)
|
||||||
visible: !discovery.busy
|
visible: !discovery.busy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -384,7 +383,7 @@ Page {
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: paramRepeater
|
id: paramRepeater
|
||||||
model: engine.jsonRpcClient.ensureServerVersion("1.12") || d.deviceDescriptor == null ? root.deviceClass.paramTypes : null
|
model: engine.jsonRpcClient.ensureServerVersion("1.12") || d.thingDescriptor == null ? root.deviceClass.paramTypes : null
|
||||||
delegate: ParamDelegate {
|
delegate: ParamDelegate {
|
||||||
// Layout.preferredHeight: 60
|
// Layout.preferredHeight: 60
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
@ -441,14 +440,14 @@ Page {
|
||||||
switch (root.deviceClass.setupMethod) {
|
switch (root.deviceClass.setupMethod) {
|
||||||
case 0:
|
case 0:
|
||||||
if (root.device) {
|
if (root.device) {
|
||||||
if (d.deviceDescriptor) {
|
if (d.thingDescriptor) {
|
||||||
engine.deviceManager.reconfigureDiscoveredDevice(root.device.id, d.deviceDescriptor.id, params);
|
engine.deviceManager.reconfigureDiscoveredDevice(root.device.id, d.thingDescriptor.id, params);
|
||||||
} else {
|
} else {
|
||||||
engine.deviceManager.reconfigureDevice(root.device.id, params);
|
engine.deviceManager.reconfigureDevice(root.device.id, params);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (d.deviceDescriptor) {
|
if (d.thingDescriptor) {
|
||||||
engine.deviceManager.addDiscoveredDevice(root.deviceClass.id, d.deviceDescriptor.id, nameTextField.text, params);
|
engine.deviceManager.addDiscoveredDevice(root.deviceClass.id, d.thingDescriptor.id, nameTextField.text, params);
|
||||||
} else {
|
} else {
|
||||||
engine.deviceManager.addDevice(root.deviceClass.id, nameTextField.text, params);
|
engine.deviceManager.addDevice(root.deviceClass.id, nameTextField.text, params);
|
||||||
}
|
}
|
||||||
|
|
@ -460,15 +459,15 @@ Page {
|
||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
if (root.device) {
|
if (root.device) {
|
||||||
if (d.deviceDescriptor) {
|
if (d.thingDescriptor) {
|
||||||
engine.deviceManager.pairDiscoveredDevice(root.deviceClass.id, d.deviceDescriptor.id, params, nameTextField.text);
|
engine.deviceManager.pairDiscoveredDevice(root.deviceClass.id, d.thingDescriptor.id, params, nameTextField.text);
|
||||||
} else {
|
} else {
|
||||||
engine.deviceManager.rePairDevice(root.device.id, params, nameTextField.text);
|
engine.deviceManager.rePairDevice(root.device.id, params, nameTextField.text);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (d.deviceDescriptor) {
|
if (d.thingDescriptor) {
|
||||||
engine.deviceManager.pairDiscoveredDevice(root.deviceClass.id, d.deviceDescriptor.id, params, nameTextField.text);
|
engine.deviceManager.pairDiscoveredDevice(root.deviceClass.id, d.thingDescriptor.id, params, nameTextField.text);
|
||||||
} else {
|
} else {
|
||||||
engine.deviceManager.pairDevice(root.deviceClass.id, params, nameTextField.text);
|
engine.deviceManager.pairDevice(root.deviceClass.id, params, nameTextField.text);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue