added trusted property to device
authorKevron Rees <kevron_m_rees@linux.intel.com>
Wed, 20 Apr 2011 23:26:10 +0000 (16:26 -0700)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Wed, 20 Apr 2011 23:26:10 +0000 (16:26 -0700)
bluetoothdevice.cpp
bluetoothdevice.h

index ad7758b..d20288d 100644 (file)
@@ -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
index c0aad35..e374ecd 100644 (file)
@@ -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);