bridge: core & frontend sides of bridge are now generated
This commit is contained in:
parent
69c0c458f0
commit
adc4ad3321
6 changed files with 181 additions and 29 deletions
123
frontends/src/bridge/DBus.py
Executable file → Normal file
123
frontends/src/bridge/DBus.py
Executable file → Normal file
|
|
@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from bridge_frontend import BridgeFrontend
|
from bridge_frontend import BridgeFrontend
|
||||||
import dbus, dbus.glib
|
import dbus, dbus.glib
|
||||||
|
from logging import debug
|
||||||
|
|
||||||
class BridgeExceptionNoService(Exception):
|
class BridgeExceptionNoService(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
@ -48,7 +49,126 @@ class DBusBridgeFrontend(BridgeFrontend):
|
||||||
elif iface == "request":
|
elif iface == "request":
|
||||||
self.db_req_iface.connect_to_signal(functionName, handler)
|
self.db_req_iface.connect_to_signal(functionName, handler)
|
||||||
|
|
||||||
##METHODS_PART##
|
def addContact(self, entity, profile_key="@DEFAULT@"):
|
||||||
|
debug ("addContact")
|
||||||
|
return self.db_comm_iface.addContact(entity, profile_key)
|
||||||
|
|
||||||
|
def callMenu(self, category, name, menu_type, profile_key):
|
||||||
|
debug ("callMenu")
|
||||||
|
return self.db_req_iface.callMenu(category, name, menu_type, profile_key)
|
||||||
|
|
||||||
|
def confirmationAnswer(self, id, accepted, data):
|
||||||
|
debug ("confirmationAnswer")
|
||||||
|
return self.db_req_iface.confirmationAnswer(id, accepted, data)
|
||||||
|
|
||||||
|
def connect(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("connect")
|
||||||
|
return self.db_comm_iface.connect(profile_key)
|
||||||
|
|
||||||
|
def createProfile(self, profile):
|
||||||
|
debug ("createProfile")
|
||||||
|
return self.db_req_iface.createProfile(profile)
|
||||||
|
|
||||||
|
def delContact(self, entity, profile_key="@DEFAULT@"):
|
||||||
|
debug ("delContact")
|
||||||
|
return self.db_comm_iface.delContact(entity, profile_key)
|
||||||
|
|
||||||
|
def deleteProfile(self, profile):
|
||||||
|
debug ("deleteProfile")
|
||||||
|
return self.db_req_iface.deleteProfile(profile)
|
||||||
|
|
||||||
|
def disconnect(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("disconnect")
|
||||||
|
return self.db_comm_iface.disconnect(profile_key)
|
||||||
|
|
||||||
|
def getContacts(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("getContacts")
|
||||||
|
return self.db_comm_iface.getContacts(profile_key)
|
||||||
|
|
||||||
|
def getHistory(self, from_jid, to_jid, size):
|
||||||
|
debug ("getHistory")
|
||||||
|
return self.db_comm_iface.getHistory(from_jid, to_jid, size)
|
||||||
|
|
||||||
|
def getMenuHelp(self, category, name, menu_type):
|
||||||
|
debug ("getMenuHelp")
|
||||||
|
return self.db_req_iface.getMenuHelp(category, name, menu_type)
|
||||||
|
|
||||||
|
def getMenus(self, ):
|
||||||
|
debug ("getMenus")
|
||||||
|
return self.db_req_iface.getMenus()
|
||||||
|
|
||||||
|
def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"):
|
||||||
|
debug ("getParamA")
|
||||||
|
return self.db_comm_iface.getParamA(name, category, attribute, profile_key)
|
||||||
|
|
||||||
|
def getParams(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("getParams")
|
||||||
|
return self.db_comm_iface.getParams(profile_key)
|
||||||
|
|
||||||
|
def getParamsCategories(self, ):
|
||||||
|
debug ("getParamsCategories")
|
||||||
|
return self.db_comm_iface.getParamsCategories()
|
||||||
|
|
||||||
|
def getParamsForCategory(self, category, profile_key="@DEFAULT@"):
|
||||||
|
debug ("getParamsForCategory")
|
||||||
|
return self.db_comm_iface.getParamsForCategory(category, profile_key)
|
||||||
|
|
||||||
|
def getParamsUI(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("getParamsUI")
|
||||||
|
return self.db_comm_iface.getParamsUI(profile_key)
|
||||||
|
|
||||||
|
def getPresenceStatus(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("getPresenceStatus")
|
||||||
|
return self.db_comm_iface.getPresenceStatus(profile_key)
|
||||||
|
|
||||||
|
def getProfileName(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("getProfileName")
|
||||||
|
return self.db_req_iface.getProfileName(profile_key)
|
||||||
|
|
||||||
|
def getProfilesList(self, ):
|
||||||
|
debug ("getProfilesList")
|
||||||
|
return self.db_req_iface.getProfilesList()
|
||||||
|
|
||||||
|
def getProgress(self, id):
|
||||||
|
debug ("getProgress")
|
||||||
|
return self.db_req_iface.getProgress(id)
|
||||||
|
|
||||||
|
def getVersion(self, ):
|
||||||
|
debug ("getVersion")
|
||||||
|
return self.db_req_iface.getVersion()
|
||||||
|
|
||||||
|
def getWaitingSub(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("getWaitingSub")
|
||||||
|
return self.db_comm_iface.getWaitingSub(profile_key)
|
||||||
|
|
||||||
|
def isConnected(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("isConnected")
|
||||||
|
return self.db_comm_iface.isConnected(profile_key)
|
||||||
|
|
||||||
|
def launchAction(self, action_type, data, profile_key="@DEFAULT@"):
|
||||||
|
debug ("launchAction")
|
||||||
|
return self.db_req_iface.launchAction(action_type, data, profile_key)
|
||||||
|
|
||||||
|
def registerNewAccount(self, login, password, host, port=5222):
|
||||||
|
debug ("registerNewAccount")
|
||||||
|
return self.db_comm_iface.registerNewAccount(login, password, host, port)
|
||||||
|
|
||||||
|
def sendMessage(self, to_jid, message, subject='', mess_type="chat", profile_key="@DEFAULT@"):
|
||||||
|
debug ("sendMessage")
|
||||||
|
return self.db_comm_iface.sendMessage(to_jid, message, subject, mess_type, profile_key)
|
||||||
|
|
||||||
|
def setParam(self, name, value, category, profile_key="@DEFAULT@"):
|
||||||
|
debug ("setParam")
|
||||||
|
return self.db_comm_iface.setParam(name, value, category, profile_key)
|
||||||
|
|
||||||
|
def setPresence(self, to_jid='', show='', priority=0, statuses={}, profile_key="@DEFAULT@"):
|
||||||
|
debug ("setPresence")
|
||||||
|
return self.db_comm_iface.setPresence(to_jid, show, priority, statuses, profile_key)
|
||||||
|
|
||||||
|
def subscription(self, sub_type, entity, profile_key="@DEFAULT@"):
|
||||||
|
debug ("subscription")
|
||||||
|
return self.db_comm_iface.subscription(sub_type, entity, profile_key)
|
||||||
|
|
||||||
|
|
||||||
#methods from plugins
|
#methods from plugins
|
||||||
def getRoomJoined(self, profile_key='@DEFAULT@'):
|
def getRoomJoined(self, profile_key='@DEFAULT@'):
|
||||||
|
|
@ -95,4 +215,3 @@ class DBusBridgeFrontend(BridgeFrontend):
|
||||||
data = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature
|
data = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature
|
||||||
return self.db_req_iface.gatewayRegister(action, target, data, profile_key)
|
return self.db_req_iface.gatewayRegister(action, target, data, profile_key)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,9 +119,9 @@ class QuickApp():
|
||||||
self.profile = profile
|
self.profile = profile
|
||||||
|
|
||||||
###now we get the essential params###
|
###now we get the essential params###
|
||||||
self.profiles[profile]['whoami']=JID(self.bridge.getParamA("JabberID","Connection", profile))
|
self.profiles[profile]['whoami']=JID(self.bridge.getParamA("JabberID","Connection", profile_key=profile))
|
||||||
autoconnect = self.bridge.getParamA("autoconnect","Connection", profile) == "true"
|
autoconnect = self.bridge.getParamA("autoconnect","Connection", profile_key=profile) == "true"
|
||||||
self.profiles[profile]['watched']=self.bridge.getParamA("Watched", "Misc", profile).split() #TODO: put this in a plugin
|
self.profiles[profile]['watched']=self.bridge.getParamA("Watched", "Misc", profile_key=profile).split() #TODO: put this in a plugin
|
||||||
|
|
||||||
## misc ##
|
## misc ##
|
||||||
self.profiles[profile]['onlineContact'] = set() #FIXME: temporary
|
self.profiles[profile]['onlineContact'] = set() #FIXME: temporary
|
||||||
|
|
@ -440,7 +440,7 @@ class QuickApp():
|
||||||
"""Must be called when the frontend is terminating"""
|
"""Must be called when the frontend is terminating"""
|
||||||
#TODO: mange multi-profile here
|
#TODO: mange multi-profile here
|
||||||
try:
|
try:
|
||||||
autodisconnect = self.bridge.getParamA("autodisconnect","Connection", self.profile) == "true"
|
autodisconnect = self.bridge.getParamA("autodisconnect","Connection", profile_key=self.profile) == "true"
|
||||||
if autodisconnect and self.bridge.isConnected(self.profile):
|
if autodisconnect and self.bridge.isConnected(self.profile):
|
||||||
#Does the user want autodisconnection ?
|
#Does the user want autodisconnection ?
|
||||||
self.bridge.disconnect(self.profile)
|
self.bridge.disconnect(self.profile)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ from bridge import Bridge
|
||||||
import dbus
|
import dbus
|
||||||
import dbus.service
|
import dbus.service
|
||||||
import dbus.mainloop.glib
|
import dbus.mainloop.glib
|
||||||
from logging import debug, info, error
|
from logging import debug, info
|
||||||
|
|
||||||
const_INT_PREFIX = "org.goffi.SAT" #Interface prefix
|
const_INT_PREFIX = "org.goffi.SAT" #Interface prefix
|
||||||
const_COMM_SUFFIX = ".communication"
|
const_COMM_SUFFIX = ".communication"
|
||||||
|
|
@ -45,72 +45,72 @@ class DbusObject(dbus.service.Object):
|
||||||
@dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
|
@dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||||
signature='ssa{ss}')
|
signature='ssa{ss}')
|
||||||
def actionResult(self, answer_type, id, data):
|
def actionResult(self, answer_type, id, data):
|
||||||
pass
|
debug ("actionResult")
|
||||||
|
|
||||||
@dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
|
@dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||||
signature='ssa{sa{ss}}')
|
signature='ssa{sa{ss}}')
|
||||||
def actionResultExt(self, answer_type, id, data):
|
def actionResultExt(self, answer_type, id, data):
|
||||||
pass
|
debug ("actionResultExt")
|
||||||
|
|
||||||
@dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
|
@dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||||
signature='ssa{ss}')
|
signature='ssa{ss}')
|
||||||
def askConfirmation(self, conf_type, id, data):
|
def askConfirmation(self, conf_type, id, data):
|
||||||
pass
|
debug ("askConfirmation")
|
||||||
|
|
||||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
signature='s')
|
signature='s')
|
||||||
def connected(self, profile):
|
def connected(self, profile):
|
||||||
pass
|
debug ("connected")
|
||||||
|
|
||||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
signature='ss')
|
signature='ss')
|
||||||
def connection_error(self, error_type, profile):
|
def connection_error(self, error_type, profile):
|
||||||
pass
|
debug ("connection_error")
|
||||||
|
|
||||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
signature='ss')
|
signature='ss')
|
||||||
def contactDeleted(self, entity, profile):
|
def contactDeleted(self, entity, profile):
|
||||||
pass
|
debug ("contactDeleted")
|
||||||
|
|
||||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
signature='s')
|
signature='s')
|
||||||
def disconnected(self, profile):
|
def disconnected(self, profile):
|
||||||
pass
|
debug ("disconnected")
|
||||||
|
|
||||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
signature='ssss')
|
signature='ssss')
|
||||||
def newAlert(self, message, title, alert_type, profile):
|
def newAlert(self, message, title, alert_type, profile):
|
||||||
pass
|
debug ("newAlert")
|
||||||
|
|
||||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
signature='sa{ss}ass')
|
signature='sa{ss}ass')
|
||||||
def newContact(self, contact, attributes, groups, profile):
|
def newContact(self, contact, attributes, groups, profile):
|
||||||
pass
|
debug ("newContact")
|
||||||
|
|
||||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
signature='sssss')
|
signature='sssss')
|
||||||
def newMessage(self, from_jid, message, mess_type, to_jid, profile):
|
def newMessage(self, from_jid, message, mess_type, to_jid, profile):
|
||||||
pass
|
debug ("newMessage")
|
||||||
|
|
||||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
signature='ssss')
|
signature='ssss')
|
||||||
def paramUpdate(self, name, value, category, profile):
|
def paramUpdate(self, name, value, category, profile):
|
||||||
pass
|
debug ("paramUpdate")
|
||||||
|
|
||||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
signature='ssia{ss}s')
|
signature='ssia{ss}s')
|
||||||
def presenceUpdate(self, entity, show, priority, statuses, profile):
|
def presenceUpdate(self, entity, show, priority, statuses, profile):
|
||||||
pass
|
debug ("presenceUpdate")
|
||||||
|
|
||||||
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
signature='sss')
|
signature='sss')
|
||||||
def subscribe(self, sub_type, entity, profile):
|
def subscribe(self, sub_type, entity, profile):
|
||||||
pass
|
debug ("subscribe")
|
||||||
|
|
||||||
@dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
|
@dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||||
signature='sa{ss}')
|
signature='sa{ss}')
|
||||||
def updatedValue(self, name, value):
|
def updatedValue(self, name, value):
|
||||||
pass
|
debug ("updatedValue")
|
||||||
|
|
||||||
|
|
||||||
### methods ###
|
### methods ###
|
||||||
|
|
@ -118,151 +118,181 @@ class DbusObject(dbus.service.Object):
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='ss', out_signature='')
|
in_signature='ss', out_signature='')
|
||||||
def addContact(self, entity, profile_key="@DEFAULT@"):
|
def addContact(self, entity, profile_key="@DEFAULT@"):
|
||||||
|
debug ("addContact")
|
||||||
return self.cb["addContact"](unicode(entity), unicode(profile_key))
|
return self.cb["addContact"](unicode(entity), unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||||
in_signature='ssss', out_signature='s')
|
in_signature='ssss', out_signature='s')
|
||||||
def callMenu(self, category, name, menu_type, profile_key):
|
def callMenu(self, category, name, menu_type, profile_key):
|
||||||
|
debug ("callMenu")
|
||||||
return self.cb["callMenu"](unicode(category), unicode(name), unicode(menu_type), unicode(profile_key))
|
return self.cb["callMenu"](unicode(category), unicode(name), unicode(menu_type), unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||||
in_signature='sba{ss}', out_signature='')
|
in_signature='sba{ss}', out_signature='')
|
||||||
def confirmationAnswer(self, id, accepted, data):
|
def confirmationAnswer(self, id, accepted, data):
|
||||||
|
debug ("confirmationAnswer")
|
||||||
return self.cb["confirmationAnswer"](unicode(id), accepted, data)
|
return self.cb["confirmationAnswer"](unicode(id), accepted, data)
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='s', out_signature='')
|
in_signature='s', out_signature='')
|
||||||
def connect(self, profile_key="@DEFAULT@"):
|
def connect(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("connect")
|
||||||
return self.cb["connect"](unicode(profile_key))
|
return self.cb["connect"](unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||||
in_signature='s', out_signature='i')
|
in_signature='s', out_signature='i')
|
||||||
def createProfile(self, profile):
|
def createProfile(self, profile):
|
||||||
|
debug ("createProfile")
|
||||||
return self.cb["createProfile"](unicode(profile))
|
return self.cb["createProfile"](unicode(profile))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='ss', out_signature='')
|
in_signature='ss', out_signature='')
|
||||||
def delContact(self, entity, profile_key="@DEFAULT@"):
|
def delContact(self, entity, profile_key="@DEFAULT@"):
|
||||||
|
debug ("delContact")
|
||||||
return self.cb["delContact"](unicode(entity), unicode(profile_key))
|
return self.cb["delContact"](unicode(entity), unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||||
in_signature='s', out_signature='i')
|
in_signature='s', out_signature='i')
|
||||||
def deleteProfile(self, profile):
|
def deleteProfile(self, profile):
|
||||||
|
debug ("deleteProfile")
|
||||||
return self.cb["deleteProfile"](unicode(profile))
|
return self.cb["deleteProfile"](unicode(profile))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='s', out_signature='')
|
in_signature='s', out_signature='')
|
||||||
def disconnect(self, profile_key="@DEFAULT@"):
|
def disconnect(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("disconnect")
|
||||||
return self.cb["disconnect"](unicode(profile_key))
|
return self.cb["disconnect"](unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='s', out_signature='a(sa{ss}as)')
|
in_signature='s', out_signature='a(sa{ss}as)')
|
||||||
def getContacts(self, profile_key="@DEFAULT@"):
|
def getContacts(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("getContacts")
|
||||||
return self.cb["getContacts"](unicode(profile_key))
|
return self.cb["getContacts"](unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='ssi', out_signature='a{i(ss)}')
|
in_signature='ssi', out_signature='a{i(ss)}')
|
||||||
def getHistory(self, from_jid, to_jid, size):
|
def getHistory(self, from_jid, to_jid, size):
|
||||||
|
debug ("getHistory")
|
||||||
return self.cb["getHistory"](unicode(from_jid), unicode(to_jid), size)
|
return self.cb["getHistory"](unicode(from_jid), unicode(to_jid), size)
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||||
in_signature='sss', out_signature='s')
|
in_signature='sss', out_signature='s')
|
||||||
def getMenuHelp(self, category, name, menu_type):
|
def getMenuHelp(self, category, name, menu_type):
|
||||||
|
debug ("getMenuHelp")
|
||||||
return self.cb["getMenuHelp"](unicode(category), unicode(name), unicode(menu_type))
|
return self.cb["getMenuHelp"](unicode(category), unicode(name), unicode(menu_type))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||||
in_signature='', out_signature='a(sss)')
|
in_signature='', out_signature='a(sss)')
|
||||||
def getMenus(self, ):
|
def getMenus(self, ):
|
||||||
|
debug ("getMenus")
|
||||||
return self.cb["getMenus"]()
|
return self.cb["getMenus"]()
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='sss', out_signature='s')
|
in_signature='ssss', out_signature='s')
|
||||||
def getParamA(self, name, category, profile_key="@DEFAULT@"):
|
def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"):
|
||||||
return self.cb["getParamA"](unicode(name), unicode(category), unicode(profile_key))
|
debug ("getParamA")
|
||||||
|
return self.cb["getParamA"](unicode(name), unicode(category), unicode(attribute), unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='s', out_signature='s')
|
in_signature='s', out_signature='s')
|
||||||
def getParams(self, profile_key="@DEFAULT@"):
|
def getParams(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("getParams")
|
||||||
return self.cb["getParams"](unicode(profile_key))
|
return self.cb["getParams"](unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='', out_signature='as')
|
in_signature='', out_signature='as')
|
||||||
def getParamsCategories(self, ):
|
def getParamsCategories(self, ):
|
||||||
|
debug ("getParamsCategories")
|
||||||
return self.cb["getParamsCategories"]()
|
return self.cb["getParamsCategories"]()
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='ss', out_signature='s')
|
in_signature='ss', out_signature='s')
|
||||||
def getParamsForCategory(self, category, profile_key="@DEFAULT@"):
|
def getParamsForCategory(self, category, profile_key="@DEFAULT@"):
|
||||||
|
debug ("getParamsForCategory")
|
||||||
return self.cb["getParamsForCategory"](unicode(category), unicode(profile_key))
|
return self.cb["getParamsForCategory"](unicode(category), unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='s', out_signature='s')
|
in_signature='s', out_signature='s')
|
||||||
def getParamsUI(self, profile_key="@DEFAULT@"):
|
def getParamsUI(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("getParamsUI")
|
||||||
return self.cb["getParamsUI"](unicode(profile_key))
|
return self.cb["getParamsUI"](unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='s', out_signature='a{sa{s(sia{ss})}}')
|
in_signature='s', out_signature='a{sa{s(sia{ss})}}')
|
||||||
def getPresenceStatus(self, profile_key="@DEFAULT@"):
|
def getPresenceStatus(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("getPresenceStatus")
|
||||||
return self.cb["getPresenceStatus"](unicode(profile_key))
|
return self.cb["getPresenceStatus"](unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||||
in_signature='s', out_signature='s')
|
in_signature='s', out_signature='s')
|
||||||
def getProfileName(self, profile_key="@DEFAULT@"):
|
def getProfileName(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("getProfileName")
|
||||||
return self.cb["getProfileName"](unicode(profile_key))
|
return self.cb["getProfileName"](unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||||
in_signature='', out_signature='as')
|
in_signature='', out_signature='as')
|
||||||
def getProfilesList(self, ):
|
def getProfilesList(self, ):
|
||||||
|
debug ("getProfilesList")
|
||||||
return self.cb["getProfilesList"]()
|
return self.cb["getProfilesList"]()
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||||
in_signature='s', out_signature='a{ss}')
|
in_signature='s', out_signature='a{ss}')
|
||||||
def getProgress(self, id):
|
def getProgress(self, id):
|
||||||
|
debug ("getProgress")
|
||||||
return self.cb["getProgress"](unicode(id))
|
return self.cb["getProgress"](unicode(id))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||||
in_signature='', out_signature='s')
|
in_signature='', out_signature='s')
|
||||||
def getVersion(self, ):
|
def getVersion(self, ):
|
||||||
|
debug ("getVersion")
|
||||||
return self.cb["getVersion"]()
|
return self.cb["getVersion"]()
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='s', out_signature='a{ss}')
|
in_signature='s', out_signature='a{ss}')
|
||||||
def getWaitingSub(self, profile_key="@DEFAULT@"):
|
def getWaitingSub(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("getWaitingSub")
|
||||||
return self.cb["getWaitingSub"](unicode(profile_key))
|
return self.cb["getWaitingSub"](unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='s', out_signature='b')
|
in_signature='s', out_signature='b')
|
||||||
def isConnected(self, profile_key="@DEFAULT@"):
|
def isConnected(self, profile_key="@DEFAULT@"):
|
||||||
|
debug ("isConnected")
|
||||||
return self.cb["isConnected"](unicode(profile_key))
|
return self.cb["isConnected"](unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
|
||||||
in_signature='sa{ss}s', out_signature='s')
|
in_signature='sa{ss}s', out_signature='s')
|
||||||
def launchAction(self, action_type, data, profile_key="@DEFAULT@"):
|
def launchAction(self, action_type, data, profile_key="@DEFAULT@"):
|
||||||
|
debug ("launchAction")
|
||||||
return self.cb["launchAction"](unicode(action_type), data, unicode(profile_key))
|
return self.cb["launchAction"](unicode(action_type), data, unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='sssi', out_signature='s')
|
in_signature='sssi', out_signature='s')
|
||||||
def registerNewAccount(self, login, password, host, port=5222):
|
def registerNewAccount(self, login, password, host, port=5222):
|
||||||
|
debug ("registerNewAccount")
|
||||||
return self.cb["registerNewAccount"](unicode(login), unicode(password), unicode(host), port)
|
return self.cb["registerNewAccount"](unicode(login), unicode(password), unicode(host), port)
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='sssss', out_signature='')
|
in_signature='sssss', out_signature='')
|
||||||
def sendMessage(self, to_jid, message, subject=, mess_type="chat", profile_key="@DEFAULT@"):
|
def sendMessage(self, to_jid, message, subject='', mess_type="chat", profile_key="@DEFAULT@"):
|
||||||
|
debug ("sendMessage")
|
||||||
return self.cb["sendMessage"](unicode(to_jid), unicode(message), unicode(subject), unicode(mess_type), unicode(profile_key))
|
return self.cb["sendMessage"](unicode(to_jid), unicode(message), unicode(subject), unicode(mess_type), unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='ssss', out_signature='')
|
in_signature='ssss', out_signature='')
|
||||||
def setParam(self, name, value, category, profile_key="@DEFAULT@"):
|
def setParam(self, name, value, category, profile_key="@DEFAULT@"):
|
||||||
|
debug ("setParam")
|
||||||
return self.cb["setParam"](unicode(name), unicode(value), unicode(category), unicode(profile_key))
|
return self.cb["setParam"](unicode(name), unicode(value), unicode(category), unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='ssia{ss}s', out_signature='')
|
in_signature='ssia{ss}s', out_signature='')
|
||||||
def setPresence(self, to_jid='', show='', priority=0, statuses={}, profile_key="@DEFAULT@"):
|
def setPresence(self, to_jid='', show='', priority=0, statuses={}, profile_key="@DEFAULT@"):
|
||||||
|
debug ("setPresence")
|
||||||
return self.cb["setPresence"](unicode(to_jid), unicode(show), priority, statuses, unicode(profile_key))
|
return self.cb["setPresence"](unicode(to_jid), unicode(show), priority, statuses, unicode(profile_key))
|
||||||
|
|
||||||
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
@dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
|
||||||
in_signature='sss', out_signature='')
|
in_signature='sss', out_signature='')
|
||||||
def subscription(self, sub_type, entity, profile_key="@DEFAULT@"):
|
def subscription(self, sub_type, entity, profile_key="@DEFAULT@"):
|
||||||
|
debug ("subscription")
|
||||||
return self.cb["subscription"](unicode(sub_type), unicode(entity), unicode(profile_key))
|
return self.cb["subscription"](unicode(sub_type), unicode(entity), unicode(profile_key))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -323,13 +323,15 @@ doc_param_3=%(doc_profile_key)s
|
||||||
[getParamA]
|
[getParamA]
|
||||||
type=method
|
type=method
|
||||||
category=communication
|
category=communication
|
||||||
sig_in=sss
|
sig_in=ssss
|
||||||
sig_out=s
|
sig_out=s
|
||||||
param_2_default="@DEFAULT@"
|
param_2_default="value"
|
||||||
|
param_3_default="@DEFAULT@"
|
||||||
doc=Helper method to get a parameter's attribute
|
doc=Helper method to get a parameter's attribute
|
||||||
doc_param_0=name: as for [setParam]
|
doc_param_0=name: as for [setParam]
|
||||||
doc_param_1=category: as for [setParam]
|
doc_param_1=category: as for [setParam]
|
||||||
doc_param_2=%(doc_profile_key)s
|
doc_param_2=attribute: Name of the attribute
|
||||||
|
doc_param_3=%(doc_profile_key)s
|
||||||
|
|
||||||
[getParamsUI]
|
[getParamsUI]
|
||||||
type=method
|
type=method
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ from bridge import Bridge
|
||||||
import dbus
|
import dbus
|
||||||
import dbus.service
|
import dbus.service
|
||||||
import dbus.mainloop.glib
|
import dbus.mainloop.glib
|
||||||
from logging import debug, info, error
|
from logging import debug, info
|
||||||
|
|
||||||
const_INT_PREFIX = "org.goffi.SAT" #Interface prefix
|
const_INT_PREFIX = "org.goffi.SAT" #Interface prefix
|
||||||
const_COMM_SUFFIX = ".communication"
|
const_COMM_SUFFIX = ".communication"
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from bridge_frontend import BridgeFrontend
|
from bridge_frontend import BridgeFrontend
|
||||||
import dbus, dbus.glib
|
import dbus, dbus.glib
|
||||||
|
from logging import debug
|
||||||
|
|
||||||
class BridgeExceptionNoService(Exception):
|
class BridgeExceptionNoService(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue