Mercurial > libervia-backend
comparison src/bridge/bridge_constructor/constructors/dbus/dbus_frontend_template.py @ 2086:4633cfcbcccb
bridge (D-Bus): bad design fixes:
- renamed outputed module to dbus_bridge (to avoid uppercase and conflict with dbus module)
- class name is now Bridge for both frontend and core (make discovery/import more easy)
- register renamed to register_method in core, and register_signal in frontend
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 03 Oct 2016 21:15:39 +0200 |
parents | da4097de5a95 |
children | f413bfc24458 |
comparison
equal
deleted
inserted
replaced
2085:da4097de5a95 | 2086:4633cfcbcccb |
---|---|
57 except (SyntaxError, ValueError, TypeError): | 57 except (SyntaxError, ValueError, TypeError): |
58 condition = '' | 58 condition = '' |
59 return BridgeException(name, message, condition) | 59 return BridgeException(name, message, condition) |
60 | 60 |
61 | 61 |
62 class DBusBridgeFrontend(BridgeFrontend): | 62 class Bridge(BridgeFrontend): |
63 def __init__(self): | 63 def __init__(self): |
64 try: | 64 try: |
65 self.sessions_bus = dbus.SessionBus() | 65 self.sessions_bus = dbus.SessionBus() |
66 self.db_object = self.sessions_bus.get_object(const_INT_PREFIX, | 66 self.db_object = self.sessions_bus.get_object(const_INT_PREFIX, |
67 const_OBJ_PATH) | 67 const_OBJ_PATH) |
78 raise BridgeInitError | 78 raise BridgeInitError |
79 else: | 79 else: |
80 raise e | 80 raise e |
81 #props = self.db_core_iface.getProperties() | 81 #props = self.db_core_iface.getProperties() |
82 | 82 |
83 def register(self, functionName, handler, iface="core"): | 83 def register_signal(self, functionName, handler, iface="core"): |
84 if iface == "core": | 84 if iface == "core": |
85 self.db_core_iface.connect_to_signal(functionName, handler) | 85 self.db_core_iface.connect_to_signal(functionName, handler) |
86 elif iface == "plugin": | 86 elif iface == "plugin": |
87 self.db_plugin_iface.connect_to_signal(functionName, handler) | 87 self.db_plugin_iface.connect_to_signal(functionName, handler) |
88 else: | 88 else: |