From 8ac087ded72dc663fd8fd67e2ca794aa99fc3515 Mon Sep 17 00:00:00 2001 From: Kevron Rees Date: Wed, 20 Apr 2011 16:26:10 -0700 Subject: [PATCH] added trusted property to device --- bluetoothdevice.cpp | 15 +++++++++++++++ bluetoothdevice.h | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/bluetoothdevice.cpp b/bluetoothdevice.cpp index ad7758b..d20288d 100644 --- a/bluetoothdevice.cpp +++ b/bluetoothdevice.cpp @@ -186,6 +186,17 @@ QString BluetoothDevice::path() return m_device->path(); } +bool BluetoothDevice::trusted() +{ + QVariantMap props = m_device->GetProperties(); + return props["Trusted"].toBool(); +} + +void BluetoothDevice::setTrusted(bool trust) +{ + m_device->SetProperty("Trusted",QDBusVariant(trust)); +} + void BluetoothDevice::propertyChanged(QString name,QDBusVariant value) { qDebug()<<"BluetoothDevice::propertyChanged()"; @@ -200,6 +211,10 @@ void BluetoothDevice::propertyChanged(QString name,QDBusVariant value) emit profilesChanged(value.variant().toStringList()); } + if(name == "Trusted") + { + emit trustedChanged(value.variant().toBool()); + } emit propertyChanged(name,value.variant()); ///TODO: create individual signals for each property diff --git a/bluetoothdevice.h b/bluetoothdevice.h index c0aad35..e374ecd 100644 --- a/bluetoothdevice.h +++ b/bluetoothdevice.h @@ -14,6 +14,7 @@ class BluetoothDevice : public QObject Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged); Q_PROPERTY(bool audioConnected READ audioConnected NOTIFY audioConnectedChanged) Q_PROPERTY(bool inputConnected READ inputConnected NOTIFY inputConnectedChanged) + Q_PROPERTY(bool trusted READ trusted WRITE setTrusted NOTIFY trustedChanged) Q_PROPERTY(QStringList profiles READ profiles NOTIFY profilesChanged) Q_PROPERTY(QString alias READ alias) Q_PROPERTY(QString name READ name) @@ -30,6 +31,7 @@ signals: void inputConnectedChanged(bool isConnected); void propertyChanged(QString name, QVariant value); void profilesChanged(QStringList uuids); + void trustedChanged(bool trust); public slots: void unpair(); @@ -39,6 +41,8 @@ public slots: void connectInput(); void disconnect(); void disconnectAudio(); + bool trusted(); + void setTrusted(bool trust); QStringList profiles(); bool isProfileSupported(QString profile); -- 2.7.4