diff options
| author | Tomasz Sterna <tomek@xiaoka.com> | 2014-06-30 01:59:14 +0200 |
|---|---|---|
| committer | Tomasz Sterna <tomek@xiaoka.com> | 2014-06-30 01:59:14 +0200 |
| commit | 3c52767b24f27ac166f9c68e2fc73811527bafe1 (patch) | |
| tree | d4a4050de526967ac4c3407f643b51d616cc31fe /daemon/dbusconnector.cpp | |
| parent | 1d5e1b8dbb04d1ba916ff90445d22e0a145fd041 (diff) | |
Reworked WatchConnector connection/disconnection handling
Fixed crash after Pebble disconnecting
Diffstat (limited to 'daemon/dbusconnector.cpp')
| -rw-r--r-- | daemon/dbusconnector.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/daemon/dbusconnector.cpp b/daemon/dbusconnector.cpp index 8cf5713..e5bed8f 100644 --- a/daemon/dbusconnector.cpp +++ b/daemon/dbusconnector.cpp @@ -7,18 +7,14 @@ #include <QDBusArgument> #include <QDBusObjectPath> -DBusConnector::DBusConnector(QObject *parent) : - QObject(parent) -{ //dbus-send --system --dest=org.bluez --print-reply / org.bluez.Manager.ListAdapters //dbus-send --system --dest=org.bluez --print-reply $path org.bluez.Adapter.GetProperties //dbus-send --system --dest=org.bluez --print-reply $devpath org.bluez.Device.GetProperties //dbus-send --system --dest=org.bluez --print-reply $devpath org.bluez.Input.Connect - QDBusConnection session = QDBusConnection::sessionBus(); - - findPebble(); -} +DBusConnector::DBusConnector(QObject *parent) : + QObject(parent) +{} bool DBusConnector::findPebble() { @@ -70,15 +66,12 @@ bool DBusConnector::findPebble() QString tmp = dict["Name"].toString(); qDebug() << "Found BT device:" << tmp; if (tmp.startsWith("Pebble")) { - name = tmp; - address = dict["Address"].toString(); - qDebug() << "Found Pebble:" << name << address; + qDebug() << "Found Pebble:" << tmp; + pebbleProps = dict; + emit pebbleChanged(); + return true; } } - if (name.isEmpty() or address.isEmpty()) return false; - - pebbleName = name; - pebbleAddress = address; - return true; + return false; } |
