From 3c52767b24f27ac166f9c68e2fc73811527bafe1 Mon Sep 17 00:00:00 2001 From: Tomasz Sterna Date: Mon, 30 Jun 2014 01:59:14 +0200 Subject: Reworked WatchConnector connection/disconnection handling Fixed crash after Pebble disconnecting --- daemon/dbusconnector.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'daemon/dbusconnector.cpp') 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 #include -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; } -- cgit v1.2.3