comparison src/bridge/DBus.py @ 266:c4b84a2d2ad1

bridge: constructor and template improved, documentation added
author Goffi <goffi@goffi.org>
date Mon, 24 Jan 2011 17:47:45 +0100
parents af3d4f11fe43
children bdcd535e179e
comparison
equal deleted inserted replaced
265:b5f1f3dc9ac6 266:c4b84a2d2ad1
22 22
23 from bridge import Bridge 23 from bridge import Bridge
24 import dbus 24 import dbus
25 import dbus.service 25 import dbus.service
26 import dbus.mainloop.glib 26 import dbus.mainloop.glib
27 import pdb
28 from logging import debug, info, error 27 from logging import debug, info, error
29 28
30 const_INT_PREFIX = "org.goffi.SAT" #Interface prefix 29 const_INT_PREFIX = "org.goffi.SAT" #Interface prefix
31 const_COMM_SUFFIX = ".communication" 30 const_COMM_SUFFIX = ".communication"
32 const_REQ_SUFFIX = ".request" 31 const_REQ_SUFFIX = ".request"
53 def disconnected(self, profile): 52 def disconnected(self, profile):
54 debug("Disconnected signal") 53 debug("Disconnected signal")
55 54
56 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, 55 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
57 signature='ss') 56 signature='ss')
58 def connection_error(self, profile, error_type): 57 def connection_error(self, error_type, profile):
59 debug("Connection_error signal") 58 debug("Connection_error signal")
60 59
61 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, 60 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
62 signature='sa{ss}ass') 61 signature='sa{ss}ass')
63 def newContact(self, contact, attributes, groups, profile): 62 def newContact(self, contact, attributes, groups, profile):
140 139
141 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, 140 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
142 in_signature='s', out_signature='i') 141 in_signature='s', out_signature='i')
143 def deleteProfile(self, name): 142 def deleteProfile(self, name):
144 info ('Profile deletion asked') 143 info ('Profile deletion asked')
145 return self.cb["deleteProfile"](str(name)) 144 return self.cb["deleteProfile"](unicode(name))
146 145
147 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 146 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
148 in_signature='sssi', out_signature='s') 147 in_signature='sssi', out_signature='s')
149 def registerNewAccount(self, login, password, host, port=5222): 148 def registerNewAccount(self, login, password, host, port=5222):
150 info ("New account registration asked") 149 info ("New account registration asked")
161 def disconnect(self, profile_key='@DEFAULT@'): 160 def disconnect(self, profile_key='@DEFAULT@'):
162 info ("Disconnection asked") 161 info ("Disconnection asked")
163 return self.cb["disconnect"](profile_key) 162 return self.cb["disconnect"](profile_key)
164 163
165 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 164 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
166 in_signature='', out_signature='b') 165 in_signature='s', out_signature='b')
167 def isConnected(self, profile_key='@DEFAULT@'): 166 def isConnected(self, profile_key='@DEFAULT@'):
168 info ("Connection status asked") 167 info ("Connection status asked")
169 return self.cb["isConnected"](profile_key) 168 return self.cb["isConnected"](profile_key)
170 169
171 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 170 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,