# HG changeset patch # User Goffi # Date 1309907064 -7200 # Node ID 3ea41a199b36f4b3062d54c697869f475d0cfc36 # Parent 68cdaf6d78e322fd87a4b80211b7ee25b98e35b3 bridge refactoring: categories are now core and plugin instead of communication and request diff -r 68cdaf6d78e3 -r 3ea41a199b36 src/bridge/DBus.py --- a/src/bridge/DBus.py Fri Jun 24 17:45:22 2011 +0200 +++ b/src/bridge/DBus.py Wed Jul 06 01:04:24 2011 +0200 @@ -28,8 +28,8 @@ const_INT_PREFIX = "org.goffi.SAT" #Interface prefix const_OBJ_PATH = '/org/goffi/SAT/bridge' -const_COMM_SUFFIX = ".communication" -const_REQ_SUFFIX = ".request" +const_CORE_SUFFIX = ".core" +const_PLUGIN_SUFFIX = ".plugin" class DbusObject(dbus.service.Object): @@ -43,272 +43,280 @@ ### signals ### - @dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX, + @dbus.service.signal(const_INT_PREFIX+const_PLUGIN_SUFFIX, + signature='') + def dummySignal(self): + #FIXME: workaround for addSignal (doesn't work if one method doensn't + # already exist for plugins), probably missing some initialisation, need + # further investigations + pass + + @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='ssa{ss}') def actionResult(self, answer_type, id, data): pass - @dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX, + @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='ssa{sa{ss}}') def actionResultExt(self, answer_type, id, data): pass - @dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX, + @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='ssa{ss}') def askConfirmation(self, conf_type, id, data): pass - @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='s') def connected(self, profile): pass - @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='ss') def connectionError(self, error_type, profile): pass - @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='ss') def contactDeleted(self, entity, profile): pass - @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='s') def disconnected(self, profile): pass - @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='ssss') def newAlert(self, message, title, alert_type, profile): pass - @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='sa{ss}ass') def newContact(self, contact, attributes, groups, profile): pass - @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='sssss') def newMessage(self, from_jid, message, mess_type, to_jid, profile): pass - @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='ssss') def paramUpdate(self, name, value, category, profile): pass - @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='ssia{ss}s') def presenceUpdate(self, entity, show, priority, statuses, profile): pass - @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, signature='sss') def subscribe(self, sub_type, entity, profile): pass - @dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX, - signature='sa{ss}') - def updatedValue(self, name, value): + @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, + signature='sa{ss}s') + def updatedValue(self, name, value, profile): pass ### methods ### - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='ss', out_signature='', async_callbacks=None) def addContact(self, entity, profile_key="@DEFAULT@"): return self.cb["addContact"](unicode(entity), unicode(profile_key)) - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='s', out_signature='', async_callbacks=('callback', 'errback')) def asyncConnect(self, profile_key="@DEFAULT@", callback=None, errback=None): return self.cb["asyncConnect"](unicode(profile_key), callback, errback) - @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='ssss', out_signature='s', async_callbacks=None) def callMenu(self, category, name, menu_type, 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_CORE_SUFFIX, in_signature='sba{ss}', out_signature='', async_callbacks=None) def confirmationAnswer(self, 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_CORE_SUFFIX, in_signature='s', out_signature='', async_callbacks=None) def connect(self, profile_key="@DEFAULT@"): return self.cb["connect"](unicode(profile_key)) - @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='s', out_signature='i', async_callbacks=None) def createProfile(self, profile): return self.cb["createProfile"](unicode(profile)) - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='ss', out_signature='', async_callbacks=None) def delContact(self, entity, profile_key="@DEFAULT@"): 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_CORE_SUFFIX, in_signature='s', out_signature='i', async_callbacks=None) def deleteProfile(self, profile): return self.cb["deleteProfile"](unicode(profile)) - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='s', out_signature='', async_callbacks=None) def disconnect(self, profile_key="@DEFAULT@"): return self.cb["disconnect"](unicode(profile_key)) - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='ss', out_signature='s', async_callbacks=None) def getConfig(self, section, name): return self.cb["getConfig"](unicode(section), unicode(name)) - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='s', out_signature='a(sa{ss}as)', async_callbacks=None) def getContacts(self, profile_key="@DEFAULT@"): return self.cb["getContacts"](unicode(profile_key)) - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='ssi', out_signature='a{i(ss)}', async_callbacks=None) def getHistory(self, from_jid, 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_CORE_SUFFIX, in_signature='sss', out_signature='s', async_callbacks=None) def getMenuHelp(self, category, name, 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_CORE_SUFFIX, in_signature='', out_signature='a(sss)', async_callbacks=None) def getMenus(self, ): return self.cb["getMenus"]() - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='ssss', out_signature='s', async_callbacks=None) def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"): 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_CORE_SUFFIX, in_signature='s', out_signature='s', async_callbacks=None) def getParams(self, profile_key="@DEFAULT@"): return self.cb["getParams"](unicode(profile_key)) - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='', out_signature='as', async_callbacks=None) def getParamsCategories(self, ): return self.cb["getParamsCategories"]() - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='ss', out_signature='s', async_callbacks=None) def getParamsForCategory(self, category, profile_key="@DEFAULT@"): 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_CORE_SUFFIX, in_signature='s', out_signature='s', async_callbacks=None) def getParamsUI(self, profile_key="@DEFAULT@"): return self.cb["getParamsUI"](unicode(profile_key)) - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='s', out_signature='a{sa{s(sia{ss})}}', async_callbacks=None) def getPresenceStatus(self, profile_key="@DEFAULT@"): return self.cb["getPresenceStatus"](unicode(profile_key)) - @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='s', out_signature='s', async_callbacks=None) def getProfileName(self, profile_key="@DEFAULT@"): return self.cb["getProfileName"](unicode(profile_key)) - @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='', out_signature='as', async_callbacks=None) def getProfilesList(self, ): return self.cb["getProfilesList"]() - @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='s', out_signature='a{ss}', async_callbacks=None) def getProgress(self, id): return self.cb["getProgress"](unicode(id)) - @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='', out_signature='s', async_callbacks=None) def getVersion(self, ): return self.cb["getVersion"]() - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='s', out_signature='a{ss}', async_callbacks=None) def getWaitingSub(self, profile_key="@DEFAULT@"): return self.cb["getWaitingSub"](unicode(profile_key)) - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='s', out_signature='b', async_callbacks=None) def isConnected(self, profile_key="@DEFAULT@"): return self.cb["isConnected"](unicode(profile_key)) - @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='sa{ss}s', out_signature='s', async_callbacks=None) def launchAction(self, action_type, data, profile_key="@DEFAULT@"): 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_CORE_SUFFIX, in_signature='ssssi', out_signature='s', async_callbacks=None) def registerNewAccount(self, login, password, email, host, port=5222): return self.cb["registerNewAccount"](unicode(login), unicode(password), unicode(email), unicode(host), port) - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='sssss', out_signature='', async_callbacks=None) def sendMessage(self, to_jid, message, subject='', mess_type="chat", profile_key="@DEFAULT@"): 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_CORE_SUFFIX, in_signature='ssss', out_signature='', async_callbacks=None) def setParam(self, name, value, category, profile_key="@DEFAULT@"): 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_CORE_SUFFIX, in_signature='ssia{ss}s', out_signature='', async_callbacks=None) def setPresence(self, to_jid='', show='', priority=0, statuses={}, profile_key="@DEFAULT@"): 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_CORE_SUFFIX, in_signature='sss', out_signature='', async_callbacks=None) def subscription(self, sub_type, entity, profile_key="@DEFAULT@"): return self.cb["subscription"](unicode(sub_type), unicode(entity), unicode(profile_key)) - @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='ssass', out_signature='', async_callbacks=None) def updateContact(self, entity, name, groups, profile_key="@DEFAULT@"): @@ -433,8 +441,8 @@ def subscribe(self, sub_type, entity, profile): self.dbus_bridge.subscribe(sub_type, entity, profile) - def updatedValue(self, name, value): - self.dbus_bridge.updatedValue(name, value) + def updatedValue(self, name, value, profile): + self.dbus_bridge.updatedValue(name, value, profile) def register(self, name, callback): diff -r 68cdaf6d78e3 -r 3ea41a199b36 src/bridge/bridge_constructor/bridge_contructor.py --- a/src/bridge/bridge_constructor/bridge_contructor.py Fri Jun 24 17:45:22 2011 +0200 +++ b/src/bridge/bridge_constructor/bridge_contructor.py Wed Jul 06 01:04:24 2011 +0200 @@ -344,7 +344,7 @@ completion = { 'sig_in':function['sig_in'] or '', 'sig_out':function['sig_out'] or '', - 'category':'REQ' if function['category'] == 'request' else 'COMM', + 'category':'PLUGIN' if function['category'] == 'plugin' else 'CORE', 'name':section, 'args':self.getArguments(function['sig_in'], name=arg_doc, default=default ) } @@ -419,7 +419,7 @@ completion = { 'sig_in':function['sig_in'] or '', 'sig_out':function['sig_out'] or '', - 'category':'req' if function['category'] == 'request' else 'comm', + 'category':'plugin' if function['category'] == 'plugin' else 'core', 'name':section, 'args':self.getArguments(function['sig_in'], name=arg_doc, default=default) } diff -r 68cdaf6d78e3 -r 3ea41a199b36 src/bridge/bridge_constructor/bridge_template.ini --- a/src/bridge/bridge_constructor/bridge_template.ini Fri Jun 24 17:45:22 2011 +0200 +++ b/src/bridge/bridge_constructor/bridge_template.ini Wed Jul 06 01:04:24 2011 +0200 @@ -6,21 +6,21 @@ [connected] type=signal -category=communication +category=core sig_in=s doc=Connection is done doc_param_0=%(doc_profile)s [disconnected] type=signal -category=communication +category=core sig_in=s doc=Connection is finished or lost doc_param_0=%(doc_profile)s [connectionError] type=signal -category=communication +category=core sig_in=ss doc=Something went wront with the connection doc_param_0=error_type: Why the connection got wrong, can be @@ -29,7 +29,7 @@ [newContact] type=signal -category=communication +category=core sig_in=sa{ss}ass doc=New contact received in roster doc_param_0=contact: JID from who the message is comming @@ -43,7 +43,7 @@ [newMessage] type=signal -category=communication +category=core sig_in=sssss doc=A message has been received doc_param_0=from_jid: JID where the message is comming from @@ -54,7 +54,7 @@ [newAlert] type=signal -category=communication +category=core sig_in=ssss doc=A new alert happened doc_param_0=message: Body of the alert @@ -66,7 +66,7 @@ [presenceUpdate] type=signal -category=communication +category=core sig_in=ssia{ss}s doc=Somebody changed his presence informations. doc_param_0=entity: JID from which we have presence informations @@ -77,7 +77,7 @@ [subscribe] type=signal -category=communication +category=core sig_in=sss doc=Somebody wants to be added in roster doc_param_0=sub_type: Subscription states (see RFC 3921 #9) @@ -86,7 +86,7 @@ [paramUpdate] type=signal -category=communication +category=core sig_in=ssss doc=A parameter has been changed doc_param_0=name: Name of the updated parameter @@ -96,7 +96,7 @@ [contactDeleted] type=signal -category=communication +category=core sig_in=ss doc=A contact has been supressed from roster doc_param_0=entity: JID of the contact removed from roster @@ -104,7 +104,7 @@ [askConfirmation] type=signal -category=request +category=core sig_in=ssa{ss} doc=A confirmation is needed for an action doc_param_0=conf_type: Type of the confirmation, can be: @@ -115,7 +115,7 @@ [actionResult] type=signal -category=request +category=core sig_in=ssa{ss} doc=Requested result of an action doc_param_0=answer_type: Type of the answer, can be: @@ -128,7 +128,7 @@ [actionResultExt] type=signal -category=request +category=core sig_in=ssa{sa{ss}} doc=Requested result of an action (Extended) doc_param_0=answer_type: Same as for [actionResult] but with the following additional one: @@ -138,24 +138,25 @@ [updatedValue] type=signal -category=request -sig_in=sa{ss} +category=core +sig_in=sa{ss}s doc=A value has been updated doc_param_0=name: Name of the updated value doc_param_1=value: New value +doc_param_2=%(doc_profile)s ;methods [getVersion] type=method -category=request +category=core sig_in= sig_out=s doc=Get "Salut à Toi" version [getProfileName] type=method -category=request +category=core sig_in=s sig_out=s param_0_default="@DEFAULT@" @@ -165,14 +166,14 @@ [getProfilesList] type=method -category=request +category=core sig_in= sig_out=as doc=Get all profiles [createProfile] type=method -category=request +category=core sig_in=s sig_out=i doc=Create a new profile @@ -183,7 +184,7 @@ [deleteProfile] type=method -category=request +category=core sig_in=s sig_out=i doc=Delete a profile @@ -195,7 +196,7 @@ [registerNewAccount] deprecated= type=method -category=communication +category=core sig_in=ssssi sig_out=s param_4_default=5222 @@ -208,7 +209,7 @@ [connect] type=method -category=communication +category=core sig_in=s sig_out= param_0_default="@DEFAULT@" @@ -218,7 +219,7 @@ [asyncConnect] async= type=method -category=communication +category=core sig_in=s sig_out= param_0_default="@DEFAULT@" @@ -227,7 +228,7 @@ [disconnect] type=method -category=communication +category=core sig_in=s sig_out= param_0_default="@DEFAULT@" @@ -236,7 +237,7 @@ [isConnected] type=method -category=communication +category=core sig_in=s sig_out=b param_0_default="@DEFAULT@" @@ -245,7 +246,7 @@ [getContacts] type=method -category=communication +category=core sig_in=s sig_out=a(sa{ss}as) param_0_default="@DEFAULT@" @@ -258,7 +259,7 @@ [getPresenceStatus] type=method -category=communication +category=core sig_in=s sig_out=a{sa{s(sia{ss})}} param_0_default="@DEFAULT@" @@ -269,7 +270,7 @@ [getWaitingSub] type=method -category=communication +category=core sig_in=s sig_out=a{ss} param_0_default="@DEFAULT@" @@ -279,7 +280,7 @@ [sendMessage] type=method -category=communication +category=core sig_in=sssss sig_out= param_2_default='' @@ -294,7 +295,7 @@ [setPresence] type=method -category=communication +category=core sig_in=ssia{ss}s sig_out= param_0_default='' @@ -311,7 +312,7 @@ [subscription] type=method -category=communication +category=core sig_in=sss sig_out= param_2_default="@DEFAULT@" @@ -322,7 +323,7 @@ [getConfig] type=method -category=communication +category=core sig_in=ss sig_out=s doc=get main configuration option @@ -331,7 +332,7 @@ [setParam] type=method -category=communication +category=core sig_in=ssss sig_out= param_3_default="@DEFAULT@" @@ -343,7 +344,7 @@ [getParamA] type=method -category=communication +category=core sig_in=ssss sig_out=s param_2_default="value" @@ -356,7 +357,7 @@ [getParamsUI] type=method -category=communication +category=core sig_in=s sig_out=s param_0_default="@DEFAULT@" @@ -365,7 +366,7 @@ [getParams] type=method -category=communication +category=core sig_in=s sig_out=s param_0_default="@DEFAULT@" @@ -374,7 +375,7 @@ [getParamsForCategory] type=method -category=communication +category=core sig_in=ss sig_out=s param_1_default="@DEFAULT@" @@ -384,7 +385,7 @@ [getParamsCategories] type=method -category=communication +category=core sig_in= sig_out=as doc=Get all categories currently existing in parameters @@ -392,7 +393,7 @@ [getHistory] type=method -category=communication +category=core sig_in=ssi sig_out=a{i(ss)} doc=Get history of a communication between two entities @@ -403,7 +404,7 @@ [addContact] type=method -category=communication +category=core sig_in=ss sig_out= param_1_default="@DEFAULT@" @@ -413,7 +414,7 @@ [updateContact] type=method -category=communication +category=core sig_in=ssass sig_out= param_3_default="@DEFAULT@" @@ -425,7 +426,7 @@ [delContact] type=method -category=communication +category=core sig_in=ss sig_out= param_1_default="@DEFAULT@" @@ -435,7 +436,7 @@ [launchAction] type=method -category=request +category=core sig_in=sa{ss}s sig_out=s param_2_default="@DEFAULT@" @@ -447,7 +448,7 @@ [confirmationAnswer] type=method -category=request +category=core sig_in=sba{ss} sig_out= doc=Give answer to a confirmation request @@ -457,7 +458,7 @@ [getProgress] type=method -category=request +category=core sig_in=s sig_out=a{ss} doc=Get progress information for an action @@ -468,7 +469,7 @@ [getMenus] type=method -category=request +category=core sig_in= sig_out=a(sss) doc=Get all additional menus @@ -480,7 +481,7 @@ [getMenuHelp] type=method -category=request +category=core sig_in=sss sig_out=s param_2="NORMAL" @@ -492,7 +493,7 @@ [callMenu] type=method -category=request +category=core sig_in=ssss sig_out=s doc=Execute action associated with a menu diff -r 68cdaf6d78e3 -r 3ea41a199b36 src/bridge/bridge_constructor/dbus_core_template.py --- a/src/bridge/bridge_constructor/dbus_core_template.py Fri Jun 24 17:45:22 2011 +0200 +++ b/src/bridge/bridge_constructor/dbus_core_template.py Wed Jul 06 01:04:24 2011 +0200 @@ -28,8 +28,8 @@ const_INT_PREFIX = "org.goffi.SAT" #Interface prefix const_OBJ_PATH = '/org/goffi/SAT/bridge' -const_COMM_SUFFIX = ".communication" -const_REQ_SUFFIX = ".request" +const_CORE_SUFFIX = ".core" +const_PLUGIN_SUFFIX = ".plugin" class DbusObject(dbus.service.Object): @@ -43,6 +43,14 @@ ### signals ### + @dbus.service.signal(const_INT_PREFIX+const_PLUGIN_SUFFIX, + signature='') + def dummySignal(self): + #FIXME: workaround for addSignal (doesn't work if one method doensn't + # already exist for plugins), probably missing some initialisation, need + # further investigations + pass + ##SIGNALS_PART## ### methods ### diff -r 68cdaf6d78e3 -r 3ea41a199b36 src/bridge/bridge_constructor/dbus_frontend_template.py --- a/src/bridge/bridge_constructor/dbus_frontend_template.py Fri Jun 24 17:45:22 2011 +0200 +++ b/src/bridge/bridge_constructor/dbus_frontend_template.py Wed Jul 06 01:04:24 2011 +0200 @@ -21,12 +21,12 @@ from bridge_frontend import BridgeFrontend import dbus, dbus.glib -from logging import debug +from logging import debug, error const_INT_PREFIX = "org.goffi.SAT" #Interface prefix const_OBJ_PATH = '/org/goffi/SAT/bridge' -const_COMM_SUFFIX = ".communication" -const_REQ_SUFFIX = ".request" +const_CORE_SUFFIX = ".core" +const_PLUGIN_SUFFIX = ".plugin" class BridgeExceptionNoService(Exception): pass @@ -37,97 +37,99 @@ self.sessions_bus = dbus.SessionBus() self.db_object = self.sessions_bus.get_object(const_INT_PREFIX, const_OBJ_PATH) - self.db_comm_iface = dbus.Interface(self.db_object, - dbus_interface=const_INT_PREFIX + const_COMM_SUFFIX) - self.db_req_iface = dbus.Interface(self.db_object, - dbus_interface=const_INT_PREFIX + const_REQ_SUFFIX) + self.db_core_iface = dbus.Interface(self.db_object, + dbus_interface=const_INT_PREFIX + const_CORE_SUFFIX) + self.db_plugin_iface = dbus.Interface(self.db_object, + dbus_interface=const_INT_PREFIX + const_PLUGIN_SUFFIX) except dbus.exceptions.DBusException,e: if e._dbus_error_name=='org.freedesktop.DBus.Error.ServiceUnknown': raise BridgeExceptionNoService else: raise e - #props = self.db_comm_iface.getProperties() + #props = self.db_core_iface.getProperties() - def register(self, functionName, handler, iface="communication"): - if iface == "communication": - self.db_comm_iface.connect_to_signal(functionName, handler) - elif iface == "request": - self.db_req_iface.connect_to_signal(functionName, handler) + def register(self, functionName, handler, iface="core"): + if iface == "core": + self.db_core_iface.connect_to_signal(functionName, handler) + elif iface == "plugin": + self.db_plugin_iface.connect_to_signal(functionName, handler) + else: + error(_('Unknown interface')) ##METHODS_PART## #methods from plugins def getRoomJoined(self, profile_key='@DEFAULT@'): - return self.db_comm_iface.getRoomJoined(profile_key) + return self.db_plugin_iface.getRoomJoined(profile_key) def getRoomSubjects(self, profile_key='@DEFAULT@'): - return self.db_comm_iface.getRoomSubjects(profile_key) + return self.db_plugin_iface.getRoomSubjects(profile_key) def joinMUC(self, service, roomId, nick, profile_key='@DEFAULT@'): - return self.db_comm_iface.joinMUC(service, roomId, nick, profile_key) + return self.db_plugin_iface.joinMUC(service, roomId, nick, profile_key) def tarotGameLaunch(self, players, profile_key='@DEFAULT@'): - return self.db_comm_iface.tarotGameLaunch(players, profile_key) + return self.db_plugin_iface.tarotGameLaunch(players, profile_key) def tarotGameCreate(self, room_jid, players, profile_key='@DEFAULT@'): - return self.db_comm_iface.tarotGameCreate(room_jid, players, profile_key) + return self.db_plugin_iface.tarotGameCreate(room_jid, players, profile_key) def tarotGameReady(self, player, referee, profile_key='@DEFAULT@'): - return self.db_comm_iface.tarotGameReady(player, referee, profile_key) + return self.db_plugin_iface.tarotGameReady(player, referee, profile_key) def tarotGameContratChoosed(self, player, referee, contrat, profile_key='@DEFAULT@'): - return self.db_comm_iface.tarotGameContratChoosed(player, referee, contrat, profile_key) + return self.db_plugin_iface.tarotGameContratChoosed(player, referee, contrat, profile_key) def tarotGamePlayCards(self, player, referee, cards, profile_key='@DEFAULT@'): - return self.db_comm_iface.tarotGamePlayCards(player, referee, cards, profile_key) + return self.db_plugin_iface.tarotGamePlayCards(player, referee, cards, profile_key) def quizGameLaunch(self, players, profile_key='@DEFAULT@'): - return self.db_comm_iface.quizGameLaunch(players, profile_key) + return self.db_plugin_iface.quizGameLaunch(players, profile_key) def quizGameCreate(self, room_jid, players, profile_key='@DEFAULT@'): - return self.db_comm_iface.quizGameCreate(room_jid, players, profile_key) + return self.db_plugin_iface.quizGameCreate(room_jid, players, profile_key) def quizGameReady(self, player, referee, profile_key='@DEFAULT@'): - return self.db_comm_iface.quizGameReady(player, referee, profile_key) + return self.db_plugin_iface.quizGameReady(player, referee, profile_key) def quizGameAnswer(self, player, referee, answer, profile_key='@DEFAULT@'): - return self.db_comm_iface.quizGameAnswer(player, referee, answer, profile_key) + return self.db_plugin_iface.quizGameAnswer(player, referee, answer, profile_key) def sendFile(self, to, path, profile_key='@DEFAULT@'): - return self.db_comm_iface.sendFile(to, path, profile_key) + return self.db_plugin_iface.sendFile(to, path, profile_key) def findGateways(self, target, profile_key='@DEFAULT@'): - return self.db_comm_iface.findGateways(target, profile_key) + return self.db_plugin_iface.findGateways(target, profile_key) def getCard(self, target, profile_key='@DEFAULT@'): - return self.db_comm_iface.getCard(target, profile_key) + return self.db_plugin_iface.getCard(target, profile_key) def getCardCache(self, target): - return self.db_comm_iface.getCardCache(target) + return self.db_plugin_iface.getCardCache(target) def getAvatarFile(self, hash): - return self.db_comm_iface.getAvatarFile(hash) + return self.db_plugin_iface.getAvatarFile(hash) def in_band_register(self, target, profile_key='@DEFAULT@'): - return self.db_comm_iface.in_band_register(target, profile_key) + return self.db_plugin_iface.in_band_register(target, profile_key) def gatewayRegister(self, action, target, data, profile_key='@DEFAULT@'): if data == None: 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_plugin_iface.gatewayRegister(action, target, data, profile_key) def getLastMicroblogs(self, jid, max_items, profile_key='@DEFAULT@', callback=None, errback=None): - return self.db_comm_iface.getLastMicroblogs(jid, max_items, profile_key, reply_handler=callback, error_handler=errback) + return self.db_plugin_iface.getLastMicroblogs(jid, max_items, profile_key, reply_handler=callback, error_handler=errback) def getMblogNodes(self, profile_key='@DEFAULT@', callback=None, errback=None): - return self.db_comm_iface.getMblogNodes(profile_key, reply_handler=callback, error_handler=errback) + return self.db_plugin_iface.getMblogNodes(profile_key, reply_handler=callback, error_handler=errback) def sendGroupBlog(self, groups, message, profile_key='@DEFAULT@'): - return self.db_comm_iface.sendGroupBlog(groups, message, profile_key) + return self.db_plugin_iface.sendGroupBlog(groups, message, profile_key) def sendPersonalEvent(self, event_type, data, profile_key='@DEFAULT@'): - return self.db_comm_iface.sendPersonalEvent(event_type, data, profile_key) + return self.db_plugin_iface.sendPersonalEvent(event_type, data, profile_key) def setMicroblogAccess(self, access="presence", profile_key='@DEFAULT@', callback=None, errback=None): - return self.db_comm_iface.setMicroblogAccess(access, profile_key, reply_handler=callback, error_handler=errback) + return self.db_plugin_iface.setMicroblogAccess(access, profile_key, reply_handler=callback, error_handler=errback)