def read_com(): global ser,set_ser,text_read bit_count1 = int() while True: day1 = datetime.datetime.today() n = day1.year y = day1.month r = day1.day h = day1.hour m = day1.minute s = day1.second ms = day1.microsecond # print(day1) # print(n, y, r) # print(h, m, s, ms) day2 = str(n) + "-" + str(y) + "-" + str(r) st = str(h) + ":" + str(m) + ":" + str(s) + "(" + str(ms) + ")" # print(day2) # print(st) com_input = str() com_input = ser.readall().decode('utf-8') #print(com_input) # com_input = str(com_input.replace(" ","")) # com_input = com_input.strip("\n") # com_input = com_input.replace("LF","") if com_input: # 如果读取结果非空,则输出 # print(com_input) # if chk_6 == 2: # text = " " + "Send" + " " + str(com_input) # else: if chk_3 == 2 and chk_4 == 2 and chk_5 == 2: text = str(day2) + " " + str(st) + " " + "Read" +" " +str(com_input) elif chk_3 == 2 and chk_4 == 2 and chk_5 == 0: text = str(st) + " " + "Read" +" " +str(com_input) elif chk_3 == 2 and chk_4 == 0 and chk_5 == 2: # chk3 内容,chk4 时间,chk5日期 text = str(day2) + " " + "Read" +" " + str(com_input) elif chk_3 == 0 and chk_4 == 2 and chk_5 == 2: text = str(day2) + " " + str(st) elif chk_3 == 0 and chk_4 == 0 and chk_5 == 2: # chk3 内容,chk4 时间,chk5日期 text = str(day2) elif chk_3 == 0 and chk_4 == 2 and chk_5 == 0: # chk3 内容,chk4 时间,chk5日期 text = str(st) elif chk_3 == 2 and chk_4 == 0 and chk_5 == 0: # chk3 内容,chk4 时间,chk5日期 text = " " + "Read" +" " +str(com_input) text_read = text myWin.textEdit.append(text) bit_count = len(com_input) bit_count1 = bit_count1 + bit_count bit_count2 = str(bit_count1) myWin.lineEdit_13.setText(bit_count2) print(text) continue
本文含有隐藏内容,请 开通VIP 后查看