Add bluetooth service discovery and bluetooth interface

This commit is contained in:
Simon Stürz 2018-07-04 21:28:33 +02:00
parent 00e2ee75f0
commit 5e407ff13f
85 changed files with 463 additions and 179 deletions

View File

@ -1,92 +1,110 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; If not, see *
* <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "bluetoothinterface.h"
#include <QJsonDocument>
#include <QJsonParseError>
#include <QUrl>
#include <QDebug>
BluetoothInterface::BluetoothInterface(QObject *parent) :
NymeaInterface(parent),
m_socket(0),
m_discovery(new BluetoothDiscovery(this))
NymeaInterface(parent)
{
connect(m_discovery, &BluetoothDiscovery::serviceFound, this, &BluetoothInterface::onServiceFound);
m_socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
QObject::connect(m_socket, &QBluetoothSocket::connected, this, &BluetoothInterface::onConnected);
QObject::connect(m_socket, &QBluetoothSocket::disconnected, this, &BluetoothInterface::onDisconnected);
QObject::connect(m_socket, &QBluetoothSocket::readyRead, this, &BluetoothInterface::onDataReady);
}
QStringList BluetoothInterface::supportedSchemes() const
{
return {"rfcom"};
}
void BluetoothInterface::connect(const QUrl &url)
{
if (url.scheme() != "rfcom") {
qWarning() << "BluetoothInterface: Cannot connect. Invalid scheme in url" << url.toString();
return;
}
QString macAddress = url.host();
qDebug() << "Connecting to bluetooth server" << macAddress;
m_socket->connectToService(QBluetoothAddress(macAddress), QBluetoothUuid(QUuid("997936b5-d2cd-4c57-b41b-c6048320cd2b")));
}
void BluetoothInterface::disconnect()
{
m_socket->close();
}
NymeaInterface::ConnectionState BluetoothInterface::connectionState() const
{
switch (m_socket->state()) {
case QBluetoothSocket::ConnectedState:
return NymeaInterface::ConnectionStateConnected;
case QBluetoothSocket::ConnectingState:
case QBluetoothSocket::ServiceLookupState:
return NymeaInterface::ConnectionStateConnecting;
default:
return NymeaInterface::ConnectionStateDisconnected;
}
}
void BluetoothInterface::sendData(const QByteArray &data)
{
if (m_socket)
m_socket->write(data + '\n');
}
void BluetoothInterface::sendRequest(const QVariantMap &request)
{
sendData(QJsonDocument::fromVariant(request).toJson(QJsonDocument::Compact));
}
BluetoothDiscovery *BluetoothInterface::discovery()
{
return m_discovery;
}
void BluetoothInterface::enable()
{
if (m_socket)
return;
m_socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
connect(m_socket, &QBluetoothSocket::readyRead, this, &BluetoothInterface::onDataReady);
connect(m_socket, &QBluetoothSocket::connected, this, &BluetoothInterface::onConnected);
connect(m_socket, &QBluetoothSocket::disconnected, this, &BluetoothInterface::onDisconnected);
}
void BluetoothInterface::disable()
{
delete m_socket;
m_socket = 0;
m_socket->write(data + '\n');
}
void BluetoothInterface::onServiceFound(const QBluetoothServiceInfo &service)
{
m_service = service;
enable();
if (m_socket->isOpen())
return;
qDebug() << "Connecting to service" << m_service.serviceName();
qDebug() << "BluetoothInterface: Connecting to service" << m_service.serviceName();
m_socket->connectToService(m_service);
}
void BluetoothInterface::onConnected()
{
qDebug() << "Bluetooth Interface: connected" << m_socket->peerName() << m_socket->peerAddress();
setConnected(true);
qDebug() << "BluetoothInterface: connected" << m_socket->peerName() << m_socket->peerAddress();
emit connected();
}
void BluetoothInterface::onDisconnected()
{
qDebug() << "Bluetooth Interface: disconnected";
setConnected(false);
qDebug() << "BluetoothInterface: disconnected" << m_socket->peerName() << m_socket->peerAddress();
emit disconnected();
}
void BluetoothInterface::onDataReady()
{
if (!m_socket)
return;
QByteArray message;
while (m_socket->canReadLine()) {
QByteArray dataLine = m_socket->readLine();
message.append(dataLine);
if (dataLine.endsWith('\n')) {
QJsonParseError error;
QJsonDocument jsonDoc = QJsonDocument::fromJson(message, &error);
if (error.error != QJsonParseError::NoError) {
qWarning() << "Could not parse json data from guh" << message << error.errorString();
return;
}
emit dataReady(jsonDoc.toVariant().toMap());
emit dataReady(message);
message.clear();
}
}

View File

@ -1,3 +1,25 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; If not, see *
* <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef BLUETOOTHINTERFACE_H
#define BLUETOOTHINTERFACE_H
@ -5,40 +27,29 @@
#include <QBluetoothSocket>
#include "nymeainterface.h"
#include "discovery/bluetoothdiscovery.h"
class BluetoothInterface : public NymeaInterface
{
Q_OBJECT
Q_PROPERTY(BluetoothDiscovery *discovery READ discovery CONSTANT)
public:
explicit BluetoothInterface(QObject *parent = 0);
explicit BluetoothInterface(QObject *parent = nullptr);
QStringList supportedSchemes() const override;
void connect(const QUrl &url) override;
void disconnect() override;
ConnectionState connectionState() const override;
void sendData(const QByteArray &data) override;
void sendRequest(const QVariantMap &request) override;
BluetoothDiscovery *discovery();
private:
QBluetoothSocket *m_socket;
QBluetoothSocket *m_socket = nullptr;
QBluetoothServiceInfo m_service;
BluetoothDiscovery *m_discovery;
signals:
public slots:
Q_INVOKABLE void enable() override;
Q_INVOKABLE void disable() override;
private slots:
void onServiceFound(const QBluetoothServiceInfo &service);
void onConnected();
void onDisconnected();
void onDataReady();
};
#endif // BLUETOOTHINTERFACE_H

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -0,0 +1,107 @@
#include "bluetoothservicediscovery.h"
#include "discoverymodel.h"
BluetoothServiceDiscovery::BluetoothServiceDiscovery(DiscoveryModel *discoveryModel, QObject *parent) :
QObject(parent),
m_discoveryModel(discoveryModel)
{
m_localDevice = new QBluetoothLocalDevice(this);
connect(m_localDevice, &QBluetoothLocalDevice::hostModeStateChanged, this, &BluetoothServiceDiscovery::onHostModeChanged);
m_serviceDiscovery = new QBluetoothServiceDiscoveryAgent(m_localDevice->address());
connect(m_serviceDiscovery, &QBluetoothServiceDiscoveryAgent::serviceDiscovered, this, &BluetoothServiceDiscovery::onServiceDiscovered);
connect(m_serviceDiscovery, &QBluetoothServiceDiscoveryAgent::finished, this, &BluetoothServiceDiscovery::onServiceDiscoveryFinished);
}
bool BluetoothServiceDiscovery::discovering() const
{
return m_discovering;
}
bool BluetoothServiceDiscovery::available() const
{
return m_available;
}
void BluetoothServiceDiscovery::discover(const QBluetoothUuid &uuid)
{
m_enabed = true;
if (m_discovering)
return;
qDebug() << "BluetoothServiceDiscovery: Start scanning services";
setDiscovering(true);
m_serviceDiscovery->setUuidFilter(uuid);
m_serviceDiscovery->start(QBluetoothServiceDiscoveryAgent::FullDiscovery);
}
void BluetoothServiceDiscovery::stopDiscovery()
{
m_enabed = false;
setDiscovering(false);
m_deviceDiscovery->stop();
}
void BluetoothServiceDiscovery::setDiscovering(const bool &discovering)
{
if (m_discovering == discovering)
return;
m_discovering = discovering;
emit discoveringChanged(m_discovering);
}
void BluetoothServiceDiscovery::onHostModeChanged(const QBluetoothLocalDevice::HostMode &mode)
{
qDebug() << "BluetoothServiceDiscovery: Host mode changed" << mode;
}
void BluetoothServiceDiscovery::onServiceDiscovered(const QBluetoothServiceInfo &serviceInfo)
{
qDebug() << "BluetoothServiceDiscovery: Service [+]" << serviceInfo.device().name() << serviceInfo.serviceName() << serviceInfo.serviceDescription() << serviceInfo.serviceProvider();
qDebug() << "Discovered service on"
<< serviceInfo.device().name() << serviceInfo.device().address().toString();
qDebug() << "\tService name:" << serviceInfo.serviceName();
qDebug() << "\tDescription:"
<< serviceInfo.attribute(QBluetoothServiceInfo::ServiceDescription).toString();
qDebug() << "\tProvider:"
<< serviceInfo.attribute(QBluetoothServiceInfo::ServiceProvider).toString();
qDebug() << "\tL2CAP protocol service multiplexer:"
<< serviceInfo.protocolServiceMultiplexer();
qDebug() << "\tRFCOMM server channel:" << serviceInfo.serverChannel();
if (serviceInfo.serviceClassUuids().isEmpty())
return;
if (serviceInfo.serviceClassUuids().first() == QBluetoothUuid(QUuid("997936b5-d2cd-4c57-b41b-c6048320cd2b"))) {
qDebug() << "Found nymea rfcom service!";
DiscoveryDevice* device = m_discoveryModel->find(serviceInfo.device().address());
if (!device) {
device = new DiscoveryDevice(DiscoveryDevice::DeviceTypeBluetooth, this);
qDebug() << "BluetoothServiceDiscovery: Adding new bluetooth host to model";
device->setName(serviceInfo.device().name());
device->setBluetoothAddress(serviceInfo.device().address());
m_discoveryModel->addDevice(device);
}
}
}
void BluetoothServiceDiscovery::onServiceDiscoveryFinished()
{
qDebug() << "BluetoothServiceDiscovery: Service discovery finished.";
setDiscovering(false);
foreach (const QBluetoothServiceInfo &serviceInfo, m_serviceDiscovery->discoveredServices()) {
onServiceDiscovered(serviceInfo);
}
// If discover was called, but never stopDiscover, continue discovery
if (m_enabed) {
qDebug() << "BluetoothServiceDiscovery: Restart bluetooth discovery";
m_serviceDiscovery->start(QBluetoothServiceDiscoveryAgent::FullDiscovery);
}
}

View File

@ -0,0 +1,45 @@
#ifndef BLUETOOTHSERVICEDISCOVERY_H
#define BLUETOOTHSERVICEDISCOVERY_H
#include <QObject>
#include <QBluetoothLocalDevice>
#include <QBluetoothServiceDiscoveryAgent>
class DiscoveryModel;
class BluetoothServiceDiscovery : public QObject
{
Q_OBJECT
public:
explicit BluetoothServiceDiscovery(DiscoveryModel *discoveryModel, QObject *parent = nullptr);
bool discovering() const;
bool available() const;
Q_INVOKABLE void discover(const QBluetoothUuid &uuid);
Q_INVOKABLE void stopDiscovery();
private:
DiscoveryModel *m_discoveryModel = nullptr;
QBluetoothLocalDevice *m_localDevice = nullptr;
QBluetoothDeviceDiscoveryAgent *m_deviceDiscovery = nullptr;
QBluetoothServiceDiscoveryAgent *m_serviceDiscovery = nullptr;
bool m_enabed = false;
bool m_discovering = false;
bool m_available = false;
void setDiscovering(const bool &discovering);
signals:
void discoveringChanged(bool discovering);
private slots:
void onHostModeChanged(const QBluetoothLocalDevice::HostMode &mode);
void onServiceDiscovered(const QBluetoothServiceInfo &serviceInfo);
void onServiceDiscoveryFinished();
};
#endif // BLUETOOTHSERVICEDISCOVERY_H

View File

@ -22,11 +22,18 @@
#include <QUrl>
DiscoveryDevice::DiscoveryDevice(QObject *parent): QObject(parent)
DiscoveryDevice::DiscoveryDevice(DeviceType deviceType, QObject *parent):
QObject(parent),
m_deviceType(deviceType)
{
m_portConfigs = new PortConfigs(this);
}
DiscoveryDevice::DeviceType DiscoveryDevice::deviceType() const
{
return m_deviceType;
}
QUuid DiscoveryDevice::uuid() const
{
return m_uuid;
@ -55,6 +62,25 @@ void DiscoveryDevice::setHostAddress(const QHostAddress &hostAddress)
}
}
QBluetoothAddress DiscoveryDevice::bluetoothAddress() const
{
return m_bluetoothAddress;
}
QString DiscoveryDevice::bluetoothAddressString() const
{
return m_bluetoothAddress.toString();
}
void DiscoveryDevice::setBluetoothAddress(const QBluetoothAddress &bluetoothAddress)
{
if (m_bluetoothAddress == bluetoothAddress)
return;
m_bluetoothAddress = bluetoothAddress;
emit bluetoothAddressChanged();
}
QString DiscoveryDevice::name() const
{
return m_name;
@ -102,6 +128,11 @@ QString DiscoveryDevice::toUrl(int portConfigIndex)
return ret;
}
QString DiscoveryDevice::toUrl(const QString &hostAddress)
{
return QString("rfcom://%1").arg(hostAddress);
}
PortConfigs::PortConfigs(QObject *parent): QAbstractListModel(parent)
{
@ -147,6 +178,9 @@ void PortConfigs::insert(PortConfig *portConfig)
PortConfig* PortConfigs::get(int index) const
{
if (index < 0 || index >= m_portConfigs.count())
return nullptr;
return m_portConfigs.at(index);
}

View File

@ -25,6 +25,7 @@
#include <QUuid>
#include <QUrl>
#include <QHostAddress>
#include <QBluetoothAddress>
#include <QObject>
#include <QAbstractListModel>
@ -94,14 +95,24 @@ private:
class DiscoveryDevice: public QObject
{
Q_OBJECT
Q_PROPERTY(DeviceType deviceType READ deviceType CONSTANT)
Q_PROPERTY(QUuid uuid READ uuid CONSTANT)
Q_PROPERTY(QString hostAddress READ hostAddressString NOTIFY hostAddressChanged)
Q_PROPERTY(QString bluetoothAddress READ bluetoothAddressString NOTIFY bluetoothAddressChanged)
Q_PROPERTY(QString name READ name NOTIFY nameChanged)
Q_PROPERTY(QString version READ version NOTIFY versionChanged)
Q_PROPERTY(PortConfigs* portConfigs READ portConfigs CONSTANT)
public:
explicit DiscoveryDevice(QObject *parent = nullptr);
enum DeviceType {
DeviceTypeNetwork,
DeviceTypeBluetooth
};
Q_ENUM(DeviceType)
explicit DiscoveryDevice(DeviceType deviceType, QObject *parent = nullptr);
DeviceType deviceType() const;
QUuid uuid() const;
void setUuid(const QUuid &uuid);
@ -110,6 +121,10 @@ public:
QString hostAddressString() const;
void setHostAddress(const QHostAddress &hostAddress);
QBluetoothAddress bluetoothAddress() const;
QString bluetoothAddressString() const;
void setBluetoothAddress(const QBluetoothAddress &bluetoothAddress);
QString name() const;
void setName(const QString &name);
@ -119,15 +134,19 @@ public:
PortConfigs *portConfigs() const;
Q_INVOKABLE QString toUrl(int portConfigIndex);
Q_INVOKABLE QString toUrl(const QString &hostAddress);
signals:
void nameChanged();
void hostAddressChanged();
void bluetoothAddressChanged();
void versionChanged();
private:
DeviceType m_deviceType = DeviceTypeNetwork;
QUuid m_uuid;
QHostAddress m_hostAddress;
QBluetoothAddress m_bluetoothAddress;
QString m_name;
QString m_version;
PortConfigs *m_portConfigs = nullptr;

View File

@ -38,12 +38,16 @@ QVariant DiscoveryModel::data(const QModelIndex &index, int role) const
DiscoveryDevice *device = m_devices.at(index.row());
switch (role) {
case TypeRole:
return device->deviceType();
case UuidRole:
return device->uuid();
case NameRole:
return device->name();
case HostAddressRole:
return device->hostAddress().toString();
case BluetoothAddressRole:
return device->bluetoothAddressString();
// case WebSocketUrlRole:
// return device.webSocketUrl();
// case PortRole:
@ -86,6 +90,17 @@ DiscoveryDevice *DiscoveryModel::find(const QUuid &uuid)
return nullptr;
}
DiscoveryDevice *DiscoveryModel::find(const QBluetoothAddress &bluetoothAddress)
{
foreach (DiscoveryDevice *device, m_devices) {
if (device->bluetoothAddress() == bluetoothAddress) {
return device;
}
}
return nullptr;
}
void DiscoveryModel::clearModel()
{
beginResetModel();
@ -97,9 +112,11 @@ void DiscoveryModel::clearModel()
QHash<int, QByteArray> DiscoveryModel::roleNames() const
{
QHash<int, QByteArray> roles;
roles[TypeRole] = "type";
roles[UuidRole] = "uuid";
roles[NameRole] = "name";
roles[HostAddressRole] = "hostAddress";
roles[BluetoothAddressRole] = "bluetoothAddress";
roles[VersionRole] = "version";
return roles;
}

View File

@ -32,9 +32,11 @@ class DiscoveryModel : public QAbstractListModel
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
public:
enum DeviceRole {
TypeRole,
UuidRole,
NameRole,
HostAddressRole,
BluetoothAddressRole,
VersionRole
};
Q_ENUM(DeviceRole)
@ -48,6 +50,7 @@ public:
Q_INVOKABLE DiscoveryDevice* get(int index) const;
Q_INVOKABLE DiscoveryDevice* find(const QUuid &uuid);
Q_INVOKABLE DiscoveryDevice* find(const QBluetoothAddress &bluetoothAddress);
void clearModel();

View File

@ -2,6 +2,7 @@
#include "upnpdiscovery.h"
#include "zeroconfdiscovery.h"
#include "bluetoothservicediscovery.h"
NymeaDiscovery::NymeaDiscovery(QObject *parent) : QObject(parent)
{
@ -9,6 +10,7 @@ NymeaDiscovery::NymeaDiscovery(QObject *parent) : QObject(parent)
m_upnp = new UpnpDiscovery(m_discoveryModel, this);
m_zeroConf = new ZeroconfDiscovery(m_discoveryModel, this);
m_bluetooth = new BluetoothServiceDiscovery(m_discoveryModel, this);
}
bool NymeaDiscovery::discovering() const
@ -18,16 +20,20 @@ bool NymeaDiscovery::discovering() const
void NymeaDiscovery::setDiscovering(bool discovering)
{
if (m_discovering != discovering) {
m_discovering = discovering;
// For zeroconf we'll ignore it as zeroconf doesn't do active discovery but just listens for changes in the net all the time
if (discovering) {
m_upnp->discover();
} else {
m_upnp->stopDiscovery();
}
emit discoveringChanged();
if (m_discovering == discovering)
return;
m_discovering = discovering;
// For zeroconf we'll ignore it as zeroconf doesn't do active discovery but just listens for changes in the net all the time
if (discovering) {
//m_upnp->discover();
// Note: this is the nymea uuid
m_bluetooth->discover(QBluetoothUuid(QUuid("997936b5-d2cd-4c57-b41b-c6048320cd2b")));
} else {
m_upnp->stopDiscovery();
m_bluetooth->stopDiscovery();
}
emit discoveringChanged();
}
DiscoveryModel *NymeaDiscovery::discoveryModel() const

View File

@ -6,6 +6,7 @@
class DiscoveryModel;
class UpnpDiscovery;
class ZeroconfDiscovery;
class BluetoothServiceDiscovery;
class NymeaDiscovery : public QObject
{
@ -30,6 +31,8 @@ private:
UpnpDiscovery *m_upnp = nullptr;
ZeroconfDiscovery *m_zeroConf = nullptr;
BluetoothServiceDiscovery *m_bluetooth = nullptr;
};
#endif // NYMEADISCOVERY_H

View File

@ -264,7 +264,7 @@ void UpnpDiscovery::networkReplyFinished(QNetworkReply *reply)
DiscoveryDevice* device = m_discoveryModel->find(uuid);
if (!device) {
device = new DiscoveryDevice(m_discoveryModel);
device = new DiscoveryDevice(DiscoveryDevice::DeviceTypeNetwork, m_discoveryModel);
device->setUuid(uuid);
qDebug() << "Adding new host to model";
m_discoveryModel->addDevice(device);

View File

@ -70,7 +70,7 @@ void ZeroconfDiscovery::serviceEntryAdded(const QZeroConfService &entry)
DiscoveryDevice* device = m_discoveryModel->find(uuid);
if (!device) {
device = new DiscoveryDevice(m_discoveryModel);
device = new DiscoveryDevice(DiscoveryDevice::DeviceTypeNetwork, m_discoveryModel);
device->setUuid(uuid);
// qDebug() << "Adding new host to model";
m_discoveryModel->addDevice(device);

View File

@ -67,7 +67,9 @@ SOURCES += \
ruletemplates/eventdescriptortemplate.cpp \
ruletemplates/ruleactiontemplate.cpp \
ruletemplates/stateevaluatortemplate.cpp \
ruletemplates/statedescriptortemplate.cpp
ruletemplates/statedescriptortemplate.cpp \
bluetoothinterface.cpp \
discovery/bluetoothservicediscovery.cpp \
HEADERS += \
engine.h \
@ -120,7 +122,9 @@ HEADERS += \
ruletemplates/eventdescriptortemplate.h \
ruletemplates/ruleactiontemplate.h \
ruletemplates/stateevaluatortemplate.h \
ruletemplates/statedescriptortemplate.h
ruletemplates/statedescriptortemplate.h \
bluetoothinterface.h \
discovery/bluetoothservicediscovery.h \
unix {
target.path = /usr/lib

View File

@ -2,19 +2,21 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app. *
* This file is part of nymea:app. *
* *
* nymea:app is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, version 3 of the License. *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* nymea:app is distributed in the hope that it will be useful, *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with nymea:app. If not, see <http://www.gnu.org/licenses/>. *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; If not, see *
* <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

View File

@ -1,20 +1,22 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* Copyright (C) 2017 - 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app. *
* This file is part of nymea:app. *
* *
* nymea:app is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, version 3 of the License. *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* nymea:app is distributed in the hope that it will be useful, *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with nymea:app. If not, see <http://www.gnu.org/licenses/>. *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; If not, see *
* <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@ -44,7 +46,7 @@ public:
virtual void disconnect() = 0;
virtual ConnectionState connectionState() const = 0;
virtual void sendData(const QByteArray &data) = 0;
virtual void ignoreSslErrors(const QList<QSslError> &errors) = 0;
virtual void ignoreSslErrors(const QList<QSslError> &errors) { Q_UNUSED(errors) }
signals:
void connected();

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2018 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of nymea:app *
* This file is part of nymea:app *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -173,6 +173,14 @@ Page {
}
contentItem: RowLayout {
ColorIcon {
Layout.fillHeight: true
Layout.preferredWidth: height
name: model.type === DiscoveryDevice.DeviceTypeNetwork ? "../images/network-vpn.svg" : "../images/bluetooth.svg"
color: app.guhAccent
}
ColumnLayout {
Layout.fillWidth: true
Label {
@ -181,10 +189,11 @@ Page {
elide: Text.ElideRight
}
Label {
text: model.hostAddress
text: model.type === DiscoveryDevice.DeviceTypeNetwork ? model.hostAddress : model.bluetoothAddress
font.pixelSize: app.smallFont
}
}
ColorIcon {
Layout.fillHeight: true
Layout.preferredWidth: height
@ -193,12 +202,16 @@ Page {
visible: hasSecurePort
name: "../images/network-secure.svg"
color: isTrusted ? app.guhAccent : keyColor
}
}
onClicked: {
Engine.connection.connect(discoveryDevice.toUrl(defaultPortConfigIndex))
if (model.type === DiscoveryDevice.DeviceTypeNetwork) {
Engine.connection.connect(discoveryDevice.toUrl(defaultPortConfigIndex))
} else if (model.type === DiscoveryDevice.DeviceTypeNetwork) {
Engine.connection.connect(discoveryDevice.toUrl(model.bluetoothAddress))
}
pageStack.push(connectingPage)
}