# val = "0x" + "".join('%02X' % ord(x) for x in frame['parameter']) # print query_addr, opt, " ".join('%02X' % ord(x) for x in frame['parameter']) # print opt, val #, "(%d)" % int(val, 16) data[opt] = val else: logging.error("no parameter in frame for command %s! %s", opt, str(frame)) elif frame['status'] == '\x04': logging.warn("timeout querying %s", opt) else: resend = False # logging.error("error querying %s: %02X", opt, ord(frame['status'])) # logged by BaseConsumer break pprint(data) logging.debug("cleaning up") gw.shutdown() gw_thread.join() logging.shutdown() if __name__ == "__main__": from support import log_config log_config.init_logging_stdout(level = logging.INFO) sys.exit(main())
body = serializer_utils.serialize( { 'name' : event, 'data' : kwargs, }, serializer_utils.CONTENT_TYPE_JSON ) ) # }}} if __name__ == '__main__': from support import daemonizer, log_config basedir = os.path.abspath(os.path.dirname(__file__)) # daemonizer.createDaemon() # log_config.init_logging(basedir + "/logs/base_consumer.log") log_config.init_logging_stdout() bc = BaseConsumer() try: bc.process_forever() finally: bc.shutdown() log_config.shutdown()