def connect_report_realt(ip): rxcnt = 0 arm_report = SocketPort(ip, x2_config.SERVER_REPORT_REALT, x2_config.TCP_RX_QUE_MAX, buffer_size=x2_config.TX2_REPORT_NORMAL_BUF_SIZE) if not arm_report.connected: print(DB_FLG + "error: tcp report real not connect") return -1 print(DB_FLG + "tcp report realt connect") while True: rx_data = arm_report.read() if rx_data != -1 and len(rx_data) > 5: rxcnt += 1 print("【real report】: len = %d, rxcnt = %d" % (len(rx_data), rxcnt)) print_report_norm(rx_data) print(" ") time.sleep(0.001)
def connect_tcp(ip): arm_port = SocketPort(ip, x2_config.SERVER_PORT, x2_config.TCP_RX_QUE_MAX, 1, buffer_size=x2_config.TX2_BUF_SIZE) if not arm_port.connected: print(DB_FLG + "error: tcp not connect") return -1 arm_cmd = TX2HexCmd(arm_port) print(DB_FLG + "tcp connect") return arm_cmd