Mercurial > libervia-backend
changeset 10:14d7861ca59e
refactoring: CONST replaced by const
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 26 Oct 2009 18:26:21 +0100 |
parents | 63ab3d8058f4 |
children | 37153f3a3dc1 |
files | sat_bridge/DBus.py |
diffstat | 1 files changed, 25 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_bridge/DBus.py Mon Oct 26 18:05:17 2009 +0100 +++ b/sat_bridge/DBus.py Mon Oct 26 18:26:21 2009 +0100 @@ -27,7 +27,7 @@ import pdb from logging import debug, info, error -CONST_INT_PREFIX = "org.goffi.SAT" #Interface prefix +const_INT_PREFIX = "org.goffi.SAT" #Interface prefix class DbusObject(dbus.service.Object): @@ -41,32 +41,32 @@ ### signals ### - @dbus.service.signal(CONST_INT_PREFIX+".communication", + @dbus.service.signal(const_INT_PREFIX+".communication", signature='sa{ss}as') def newContact(self, contact, attributes, groups): debug("new contact signal (%s) sended", contact) - @dbus.service.signal(CONST_INT_PREFIX+".communication", + @dbus.service.signal(const_INT_PREFIX+".communication", signature='ssss') def newMessage(self, from_jid, msg, type='chat', to=''): debug("new message signal (from:%s msg:%s type:%s to:%s) sended", from_jid, msg, type, to) - @dbus.service.signal(CONST_INT_PREFIX+".communication", + @dbus.service.signal(const_INT_PREFIX+".communication", signature='ssssi') def presenceUpdate(self, jid, type, show, status, priority): debug("presence update signal (from:%s type: %s show:%s status:\"%s\" priority:%d) sended" , jid, type, show, status, priority) - @dbus.service.signal(CONST_INT_PREFIX+".communication", + @dbus.service.signal(const_INT_PREFIX+".communication", signature='sss') def paramUpdate(self, name, value, namespace): debug("param update signal: %s=%s in namespace %s", name, value, namespace) - @dbus.service.signal(CONST_INT_PREFIX+".communication", + @dbus.service.signal(const_INT_PREFIX+".communication", signature='s') def contactDeleted(self, jid): debug("contact deleted signal: %s", jid) - @dbus.service.signal(CONST_INT_PREFIX+".request", + @dbus.service.signal(const_INT_PREFIX+".request", signature='ssa{ss}') def askConfirmation(self, type, id, data): debug("asking for confirmation: id = [%s] type = %s data = %s", id, type, data) @@ -75,92 +75,92 @@ ### methods ### - @dbus.service.method(CONST_INT_PREFIX+".communication", + @dbus.service.method(const_INT_PREFIX+".communication", in_signature='', out_signature='') def connect(self): info ("Connection asked") return self.cb["connect"]() - @dbus.service.method(CONST_INT_PREFIX+".communication", + @dbus.service.method(const_INT_PREFIX+".communication", in_signature='', out_signature='') def disconnect(self): info ("Disconnection asked") return self.cb["disconnect"]() - @dbus.service.method(CONST_INT_PREFIX+".communication", + @dbus.service.method(const_INT_PREFIX+".communication", in_signature='', out_signature='a(sa{ss}as)') def getContacts(self): debug("getContacts...") return self.cb["getContacts"]() - @dbus.service.method(CONST_INT_PREFIX+".communication", + @dbus.service.method(const_INT_PREFIX+".communication", in_signature='', out_signature='a(ssssi)') def getPresenceStatus(self): debug("getPresenceStatus...") return self.cb["getPresenceStatus"]() - @dbus.service.method(CONST_INT_PREFIX+".communication", + @dbus.service.method(const_INT_PREFIX+".communication", in_signature='ss', out_signature='') def sendMessage(self, to, message): debug("sendMessage...") self.cb["sendMessage"](to, message) - @dbus.service.method(CONST_INT_PREFIX+".communication", + @dbus.service.method(const_INT_PREFIX+".communication", in_signature='ssssi', out_signature='') def setPresence(self, to="", type="", show="", status="", priority=0): self.cb["setPresence"](to, type, show, status, priority) - @dbus.service.method(CONST_INT_PREFIX+".communication", + @dbus.service.method(const_INT_PREFIX+".communication", in_signature='sss', out_signature='') def setParam(self, name, value, namespace="default"): self.cb["setParam"](name, str(value), namespace) - @dbus.service.method(CONST_INT_PREFIX+".communication", + @dbus.service.method(const_INT_PREFIX+".communication", in_signature='ss', out_signature='(ss)') def getParam(self, name, namespace="default"): return self.cb["getParam"](name, namespace) - @dbus.service.method(CONST_INT_PREFIX+".communication", + @dbus.service.method(const_INT_PREFIX+".communication", in_signature='s', out_signature='a(sss)') def getParams(self, namespace): return self.cb["getParams"](namespace) - @dbus.service.method(CONST_INT_PREFIX+".communication", + @dbus.service.method(const_INT_PREFIX+".communication", in_signature='', out_signature='as') def getParamsCategories(self): return self.cb["getParamsCategories"]() - @dbus.service.method(CONST_INT_PREFIX+".communication", + @dbus.service.method(const_INT_PREFIX+".communication", in_signature='ssi', out_signature='a{i(ss)}') def getHistory(self, from_jid, to_jid, size): debug("History asked for %s", to_jid) return self.cb["getHistory"](from_jid, to_jid, size) - @dbus.service.method(CONST_INT_PREFIX+".communication", + @dbus.service.method(const_INT_PREFIX+".communication", in_signature='s', out_signature='') def addContact(self, jid): debug("Subscription asked for %s", jid) return self.cb["addContact"](jid) - @dbus.service.method(CONST_INT_PREFIX+".communication", + @dbus.service.method(const_INT_PREFIX+".communication", in_signature='s', out_signature='') def delContact(self, jid): debug("Unsubscription asked for %s", jid) return self.cb["delContact"](jid) - @dbus.service.method(CONST_INT_PREFIX+".communication", + @dbus.service.method(const_INT_PREFIX+".communication", in_signature='', out_signature='b') def isConnected(self): debug("Connection status requested") return self.cb["isConnected"]() - @dbus.service.method(CONST_INT_PREFIX+".request", + @dbus.service.method(const_INT_PREFIX+".request", in_signature='sba{ss}', out_signature='') def confirmationAnswer(self, id, accepted, data): debug("Answer for confirmation [%s]: %s", id, "Accepted" if accepted else "Refused") return self.cb["confirmationAnswer"](id, accepted, data) - @dbus.service.method(CONST_INT_PREFIX+".request", + @dbus.service.method(const_INT_PREFIX+".request", in_signature='s', out_signature='a{ss}') def getProgress(self, id): #debug("Progress asked for %s", id) @@ -198,7 +198,7 @@ exec (code) method = locals()[name] setattr(DbusObject, name, dbus.service.method( - CONST_INT_PREFIX+int_suffix, in_signature=in_sign, out_signature=out_sign)(method)) + const_INT_PREFIX+int_suffix, in_signature=in_sign, out_signature=out_sign)(method)) class DBusBridge(Bridge): def __init__(self): @@ -206,7 +206,7 @@ Bridge.__init__(self) info ("Init DBus...") self.session_bus = dbus.SessionBus() - self.dbus_name = dbus.service.BusName(CONST_INT_PREFIX, self.session_bus) + self.dbus_name = dbus.service.BusName(const_INT_PREFIX, self.session_bus) self.dbus_bridge = DbusObject(self.session_bus, '/org/goffi/SAT/bridge') def newContact(self, contact, attributes, groups):