comparison sat.tac @ 25:53e921c8a357

new plugin: gateways plugin, and first implementation of findGateways - test menu in Wix - new actionResultExt method, for sending dictionary of dictionaries - new getNextId method, for accessing sat ids from plugins.
author Goffi <goffi@goffi.org>
date Fri, 04 Dec 2009 08:47:44 +0100
parents 925ab466c5ec
children d6b613764dd7
comparison
equal deleted inserted replaced
24:61124cb82fb7 25:53e921c8a357
242 self.host.bridge.actionResult(answer_type, self.answer_id, answer_data) 242 self.host.bridge.actionResult(answer_type, self.answer_id, answer_data)
243 self.xmlstream.sendFooter() 243 self.xmlstream.sendFooter()
244 244
245 245
246 class SAT(service.Service): 246 class SAT(service.Service):
247 247
248 def get_next_id(self):
249 return sat_next_id()
250
248 def __init__(self): 251 def __init__(self):
249 #TODO: standardize callback system 252 #TODO: standardize callback system
250 self.__waiting_conf = {} #callback called when a confirmation is received 253 self.__waiting_conf = {} #callback called when a confirmation is received
251 self.__progress_cb_map = {} #callback called when a progress is requested (key = progress id) 254 self.__progress_cb_map = {} #callback called when a progress is requested (key = progress id)
252 self.__general_cb_map = {} #callback called for general reasons (key = name) 255 self.__general_cb_map = {} #callback called for general reasons (key = name)
513 debug ("Feature found: %s",feature) 516 debug ("Feature found: %s",feature)
514 self.server_features.append(feature) 517 self.server_features.append(feature)
515 for cat, type in disco.identities: 518 for cat, type in disco.identities:
516 debug ("Identity found: [%s/%s] %s" % (cat, type, disco.identities[(cat,type)])) 519 debug ("Identity found: [%s/%s] %s" % (cat, type, disco.identities[(cat,type)]))
517 520
521
518 ## Generic HMI ## 522 ## Generic HMI ##
519 523
520 def actionResult(self, id, type, data): 524 def actionResult(self, id, type, data):
521 """Send the result of an action 525 """Send the result of an action
522 @param id: same id used with action 526 @param id: same id used with action
523 @type: result type ("PARAM", "SUCCESS", "ERROR") 527 @type: result type ("PARAM", "SUCCESS", "ERROR")
524 @data: data (depend of result type) 528 @data: dictionary
525 """ 529 """
526 self.bridge.actionResult(type, id, data) 530 self.bridge.actionResult(type, id, data)
531
532 def actionResultExt(self, id, type, data):
533 """Send the result of an action, extended version
534 @param id: same id used with action
535 @type: result type ("PARAM", "SUCCESS", "ERROR")
536 @data: dictionary of dictionaries
537 """
538 if type != "DICT_DICT":
539 error("type for actionResultExt must be DICT_DICT, fixing it")
540 type = "DICT_DICT"
541 self.bridge.actionResultExt(type, id, data)
527 542
528 543
529 544
530 def askConfirmation(self, id, type, data, cb): 545 def askConfirmation(self, id, type, data, cb):
531 """Add a confirmation callback 546 """Add a confirmation callback