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>pull/215/head
parent
2d95848cee
commit
43c844ea1e
|
@ -209,6 +209,10 @@ class TuhiDBusClientDevice(_DBusObject):
|
||||||
def sync_state(self):
|
def sync_state(self):
|
||||||
return self._sync_state
|
return self._sync_state
|
||||||
|
|
||||||
|
@GObject.Property
|
||||||
|
def live(self):
|
||||||
|
return self.property('Live')
|
||||||
|
|
||||||
def _on_connected(self, bluez_device, pspec):
|
def _on_connected(self, bluez_device, pspec):
|
||||||
self.notify('connected')
|
self.notify('connected')
|
||||||
|
|
||||||
|
@ -266,6 +270,8 @@ class TuhiDBusClientDevice(_DBusObject):
|
||||||
self.notify('battery-percent')
|
self.notify('battery-percent')
|
||||||
elif 'BatteryState' in changed_props:
|
elif 'BatteryState' in changed_props:
|
||||||
self.notify('battery-state')
|
self.notify('battery-state')
|
||||||
|
elif 'Live' in changed_props:
|
||||||
|
self.notify('live')
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f'{self.address} - {self.name}'
|
return f'{self.address} - {self.name}'
|
||||||
|
@ -292,12 +298,9 @@ class TuhiDBusClientDevice(_DBusObject):
|
||||||
-1,
|
-1,
|
||||||
fd_list,
|
fd_list,
|
||||||
None)
|
None)
|
||||||
if res[0] == 0:
|
|
||||||
self.live = True
|
|
||||||
|
|
||||||
def stop_live(self):
|
def stop_live(self):
|
||||||
self.proxy.StopLive()
|
self.proxy.StopLive()
|
||||||
self.live = False
|
|
||||||
|
|
||||||
def terminate(self):
|
def terminate(self):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue