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 <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2019-08-29 11:10:24 +10:00
parent 2d95848cee
commit 43c844ea1e
1 changed files with 6 additions and 3 deletions

View File

@ -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: