added paired property
authorKevron Rees <kevron_m_rees@linux.intel.com>
Thu, 26 May 2011 20:22:28 +0000 (13:22 -0700)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Thu, 26 May 2011 20:22:28 +0000 (13:22 -0700)
bluetooth-qt/bluetoothdevice.cpp
bluetooth-qt/bluetoothdevice.h

index 7722c07..d140342 100644 (file)
@@ -30,6 +30,12 @@ BluetoothDevice::BluetoothDevice(QDBusObjectPath path, QObject *parent) :
    setupProfiles();
 }
 
+bool BluetoothDevice::paired()
+{
+    QVariantMap props = m_device->GetProperties();
+    return props["Paired"].toBool();
+}
+
 void BluetoothDevice::setupProfiles()
 {
     if(isProfileSupported(BluetoothProfiles::hid))
@@ -238,6 +244,12 @@ void BluetoothDevice::propertyChanged(QString name,QDBusVariant value)
     {
         emit trustedChanged(value.variant().toBool());
     }
+
+    if(name == "Paired")
+    {
+        emit pairedChanged();
+    }
+
     emit propertyChanged(name,value.variant());
 
     ///TODO: create individual signals for each property... maybe
index d1566d9..82d1a36 100644 (file)
@@ -15,6 +15,7 @@ class BluetoothDevice : public QObject
        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(bool paired READ paired NOTIFY pairedChanged)
        Q_PROPERTY(QStringList profiles READ profiles NOTIFY profilesChanged)
        Q_PROPERTY(QString alias READ alias)
        Q_PROPERTY(QString name READ name)
@@ -24,6 +25,7 @@ class BluetoothDevice : public QObject
 
 public:
        explicit BluetoothDevice(QDBusObjectPath path = QDBusObjectPath(), QObject *parent = 0);
+       bool paired();
 
 signals:
        void connectedChanged(bool isConnected);
@@ -32,6 +34,7 @@ signals:
        void propertyChanged(QString name, QVariant value);
        void profilesChanged(QStringList uuids);
        void trustedChanged(bool trust);
+       void pairedChanged();
 
 public slots:
        void unpair();