comparison src/bridge/bridge_constructor/dbus_core_template.py @ 359:eb9d33ba4e36

bridge: templates' constants can now be overrided
author Goffi <goffi@goffi.org>
date Mon, 06 Jun 2011 18:35:30 +0200
parents 4402ac630712
children 3ea41a199b36
comparison
equal deleted inserted replaced
358:f147b778511a 359:eb9d33ba4e36
25 import dbus.service 25 import dbus.service
26 import dbus.mainloop.glib 26 import dbus.mainloop.glib
27 from logging import debug, info 27 from logging import debug, info
28 28
29 const_INT_PREFIX = "org.goffi.SAT" #Interface prefix 29 const_INT_PREFIX = "org.goffi.SAT" #Interface prefix
30 const_OBJ_PATH = '/org/goffi/SAT/bridge'
30 const_COMM_SUFFIX = ".communication" 31 const_COMM_SUFFIX = ".communication"
31 const_REQ_SUFFIX = ".request" 32 const_REQ_SUFFIX = ".request"
32 33
33 class DbusObject(dbus.service.Object): 34 class DbusObject(dbus.service.Object):
34 35
123 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) 124 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
124 Bridge.__init__(self) 125 Bridge.__init__(self)
125 info ("Init DBus...") 126 info ("Init DBus...")
126 self.session_bus = dbus.SessionBus() 127 self.session_bus = dbus.SessionBus()
127 self.dbus_name = dbus.service.BusName(const_INT_PREFIX, self.session_bus) 128 self.dbus_name = dbus.service.BusName(const_INT_PREFIX, self.session_bus)
128 self.dbus_bridge = DbusObject(self.session_bus, '/org/goffi/SAT/bridge') 129 self.dbus_bridge = DbusObject(self.session_bus, const_OBJ_PATH)
129 130
130 ##DIRECT_CALLS## 131 ##DIRECT_CALLS##
131 132
132 def register(self, name, callback): 133 def register(self, name, callback):
133 debug("registering DBus bridge method [%s]", name) 134 debug("registering DBus bridge method [%s]", name)