def __registration(self): port = self.__listening_port if ((self.__bc_ipaddr == None) or \ (self.__bc_listening_port == None)): print "no BC ip or port specified, skipping registration" self.__registration_loop.stop() return bc_register = Proxy('http://%s:%d/' % (self.__bc_ipaddr, self.__bc_listening_port)) if self.__bc_connected: d = bc_register.callRemote('keepalive', self.__local_ip, port) else: host_specs = HostSpecsManager().get_host_specs() specs = jsonpickle.encode(host_specs) from core.blockinfo import block_infos blocks = block_infos.keys() blocks_descr = [block_infos[b] for b in blocks] descr = jsonpickle.encode(blocks_descr) #blocks_descr = [str(block_infos[b]) for b in blocks] #d = bc_register.callRemote('register', self.__local_ip, port, specs, blocks) #d = bc_register.callRemote('register', self.__local_ip, port, specs, blocks, blocks_descr) d = bc_register.callRemote('register', self.__local_ip, port, specs, blocks, descr) d.addCallback(self.__registration_results).addErrback( self.__registration_error)
def jsonrpc_get_blocks_list(self): """\brief Gets a list of the block types currently installed on the local host \return (\c ReturnValue) The block types (list[string]) """ f = None try: f = open(self.__bm_base_path + "/daemon/core/blockinfo.py") except IOError as e: msg = "No blockinfo.py file available, please run the " + \ "blockinfoparser.py script to generate this file" r = ReturnValue(ReturnValue.CODE_FAILURE, msg, None) return jsonpickle.encode(r) f.close() from core.blockinfo import block_infos r = ReturnValue(ReturnValue.CODE_SUCCESS, "", block_infos.keys()) return jsonpickle.encode(r)
def __registration(self): port = self.__listening_port if ((self.__bc_ipaddr == None) or \ (self.__bc_listening_port == None)): print "no BC ip or port specified, skipping registration" self.__registration_loop.stop() return bc_register = Proxy('http://%s:%d/' % (self.__bc_ipaddr,self.__bc_listening_port)) if self.__bc_connected: d = bc_register.callRemote('keepalive', self.__local_ip, port) else: host_specs = HostSpecsManager().get_host_specs() specs = jsonpickle.encode(host_specs) from core.blockinfo import block_infos blocks = block_infos.keys() blocks_descr = [block_infos[b] for b in blocks] descr = jsonpickle.encode(blocks_descr) #blocks_descr = [str(block_infos[b]) for b in blocks] #d = bc_register.callRemote('register', self.__local_ip, port, specs, blocks) #d = bc_register.callRemote('register', self.__local_ip, port, specs, blocks, blocks_descr) d = bc_register.callRemote('register', self.__local_ip, port, specs, blocks, descr) d.addCallback(self.__registration_results).addErrback(self.__registration_error)