MCPcopy Index your code
hub / github.com/PyQt5/PyQt / onReadyRead

Method onReadyRead

QSerialPort/SerialDebugAssistant.py:98–114  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

96 self._serial.write(text)
97
98 def onReadyRead(self):
99 # 数据接收响应
100 if self._serial.bytesAvailable():
101 # 当数据可读取时
102 # 这里只是简答测试少量数据,如果数据量太多了此处readAll其实并没有读完
103 # 需要自行设置粘包协议
104 data = self._serial.readAll()
105 if self.checkBoxHexView.isChecked():
106 # 如果勾选了hex显示
107 data = data.toHex()
108 data = data.data()
109 # 解码显示(中文啥的)
110 try:
111 self.textBrowser.append('我收到了: ' + data.decode('gb2312'))
112 except:
113 # 解码失败
114 self.textBrowser.append('我收到了: ' + repr(data))
115
116 def getAvailablePorts(self):
117 # 获取可用的串口

Callers

nothing calls this directly

Calls 1

dataMethod · 0.45

Tested by

no test coverage detected