def dbg_process(ch, method, properties, body): ser_msg = qmesh_pb2.SerialMsg() ser_msg.ParseFromString(body) if(ser_msg.type == ser_msg.STATUS): qmesh_common.print_status_msg(ser_msg.status) if(ser_msg.status.status == ser_msg.status.MANAGEMENT): qmesh_common.channel.stop_consuming()
def dbg_process(ch, method, properties, body): ser_msg = qmesh_pb2.SerialMsg() ser_msg.ParseFromString(body) if(ser_msg.type == ser_msg.DEBUG_MSG): qmesh_common.print_dbg_msg(ser_msg.dbg_msg) elif(ser_msg.type == ser_msg.DATA): qmesh_common.print_data_msg(ser_msg.data_msg) elif(ser_msg.type == ser_msg.STATUS): qmesh_common.print_status_msg(ser_msg.status)
def log_process(ch, method, properties, body): ser_msg = qmesh_pb2.SerialMsg() ser_msg.ParseFromString(body) if (ser_msg.type == ser_msg.STATUS): qmesh_common.print_status_msg(ser_msg.status) if (ser_msg.status.status == ser_msg.status.MANAGEMENT): qmesh_common.channel.stop_consuming() elif (ser_msg.type == ser_msg.REPLY_LOG): if (ser_msg.log_msg.valid == False): print("Finished reading in log entries") sys.exit(0) else: log_msg_str = qmesh_common.print_log_msg(ser_msg.log_msg) out_file.write(log_msg_str) out_file.flush() ser_msg = qmesh_pb2.SerialMsg() ser_msg.type = qmesh_pb2.SerialMsg.READ_LOG qmesh_common.publish_msg(ser_msg)