comparison sat_frontends/bridge/dbus_bridge.py @ 3206:ae09989e9feb

core, bridge: new `devicesInfosGet` method to get infos on known devices of an entity
author Goffi <goffi@goffi.org>
date Fri, 06 Mar 2020 18:19:03 +0100
parents 439e2f88c3a9
children 6d0137022df2
comparison
equal deleted inserted replaced
3205:2c0628f3927e 3206:ae09989e9feb
214 else: 214 else:
215 if errback is None: 215 if errback is None:
216 errback = log.error 216 errback = log.error
217 error_handler = lambda err:errback(dbus_to_bridge_exception(err)) 217 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
218 return self.db_core_iface.delContact(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) 218 return self.db_core_iface.delContact(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
219
220 def devicesInfosGet(self, bare_jid, profile_key, callback=None, errback=None):
221 if callback is None:
222 error_handler = None
223 else:
224 if errback is None:
225 errback = log.error
226 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
227 return str(self.db_core_iface.devicesInfosGet(bare_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
219 228
220 def discoFindByFeatures(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key="@DEFAULT@", callback=None, errback=None): 229 def discoFindByFeatures(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key="@DEFAULT@", callback=None, errback=None):
221 if callback is None: 230 if callback is None:
222 error_handler = None 231 error_handler = None
223 else: 232 else:
972 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 981 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
973 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) 982 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
974 self.db_core_iface.delContact(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) 983 self.db_core_iface.delContact(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
975 return fut 984 return fut
976 985
986 def devicesInfosGet(self, bare_jid, profile_key):
987 loop = asyncio.get_running_loop()
988 fut = loop.create_future()
989 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
990 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
991 self.db_core_iface.devicesInfosGet(bare_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
992 return fut
993
977 def discoFindByFeatures(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key="@DEFAULT@"): 994 def discoFindByFeatures(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key="@DEFAULT@"):
978 loop = asyncio.get_running_loop() 995 loop = asyncio.get_running_loop()
979 fut = loop.create_future() 996 fut = loop.create_future()
980 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 997 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
981 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) 998 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))