示例#1
0
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)
示例#2
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


import sys, os
import pika
import qmesh_pb2
import qmesh_common

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()

qmesh_common.setup_outgoing_rabbitmq(dbg_process)
qmesh_common.reboot_board()
qmesh_common.channel.start_consuming()
qmesh_common.stay_in_management()

ser_msg = qmesh_pb2.SerialMsg()
ser_msg.type = ser_msg.ERASE_LOGS
qmesh_common.publish_msg(ser_msg)
qmesh_common.channel.start_consuming()