From 43c844ea1eaa64f35dc075dd6fcda8769749fdee Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 29 Aug 2019 11:10:24 +1000 Subject: [PATCH] dbusclient: make the live property mirror the dbus one We have a dbus property for this so let's just use that as a backend for our live property instead of emulating our own on top of it. Signed-off-by: Peter Hutterer --- tuhi/dbusclient.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tuhi/dbusclient.py b/tuhi/dbusclient.py index 6ae7c34..0dc7064 100644 --- a/tuhi/dbusclient.py +++ b/tuhi/dbusclient.py @@ -209,6 +209,10 @@ class TuhiDBusClientDevice(_DBusObject): def sync_state(self): return self._sync_state + @GObject.Property + def live(self): + return self.property('Live') + def _on_connected(self, bluez_device, pspec): self.notify('connected') @@ -266,6 +270,8 @@ class TuhiDBusClientDevice(_DBusObject): self.notify('battery-percent') elif 'BatteryState' in changed_props: self.notify('battery-state') + elif 'Live' in changed_props: + self.notify('live') def __repr__(self): return f'{self.address} - {self.name}' @@ -292,12 +298,9 @@ class TuhiDBusClientDevice(_DBusObject): -1, fd_list, None) - if res[0] == 0: - self.live = True def stop_live(self): self.proxy.StopLive() - self.live = False def terminate(self): try: