diff options
Diffstat (limited to 'src/bluetoothsettings/bluez/bluetoothdevice_p.cpp')
-rw-r--r-- | src/bluetoothsettings/bluez/bluetoothdevice_p.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/bluetoothsettings/bluez/bluetoothdevice_p.cpp b/src/bluetoothsettings/bluez/bluetoothdevice_p.cpp index e473f59..7b29ec9 100644 --- a/src/bluetoothsettings/bluez/bluetoothdevice_p.cpp +++ b/src/bluetoothsettings/bluez/bluetoothdevice_p.cpp @@ -33,6 +33,11 @@ #include "moc_objectmanager_interface.cpp" #include "device1_interface.h" +#ifdef USE_CONNMAN_BLUETOOTH +#include "connman_technology_interface.h" +#include "connmancommon.h" +#endif + QT_BEGIN_NAMESPACE BluetoothDevicePrivate::BluetoothDevicePrivate(BluetoothDevice *parent) : QObject(parent) @@ -49,6 +54,11 @@ BluetoothDevicePrivate::BluetoothDevicePrivate(BluetoothDevice *parent) : QObjec m_manager = new OrgFreedesktopDBusObjectManagerInterface(QStringLiteral("org.bluez"), QStringLiteral("/"), QDBusConnection::systemBus(), this); +#ifdef USE_CONNMAN_BLUETOOTH + m_technology = new NetConnmanTechnologyInterface(QStringLiteral("net.connman"), + QStringLiteral("/net/connman/technology/bluetooth"), + QDBusConnection::systemBus(), this); +#endif QDBusPendingReply<ManagedObjectList> reply = m_manager->GetManagedObjects(); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); connect(watcher, &QDBusPendingCallWatcher::finished, @@ -69,6 +79,13 @@ bool BluetoothDevicePrivate::powered() const void BluetoothDevicePrivate::setPowered(const bool& aPowered) { + if (!m_localDevice) + return; + +#ifdef USE_CONNMAN_BLUETOOTH + m_technology->SetProperty(PropertyPowered, QDBusVariant(QVariant(aPowered))); +#endif + if (aPowered) { m_localDevice->powerOn(); } @@ -219,9 +236,11 @@ void BluetoothDevicePrivate::getManagedObjectsFinished(QDBusPendingCallWatcher * if (m_powered) { emit q->poweredChanged(); - m_deviceModel->scanDevices(); - m_scanning = true; - emit q->scanningChanged(); + if (!m_scanning) { + m_deviceModel->scanDevices(); + m_scanning = true; + emit q->scanningChanged(); + } } emit q->availabilityChanged(); |