(self)
| 80 | |
| 81 | @pyqtSlot() |
| 82 | def on_buttonSend_clicked(self): |
| 83 | # 发送消息按钮 |
| 84 | if not self._serial.isOpen(): |
| 85 | print('串口未连接') |
| 86 | return |
| 87 | text = self.plainTextEdit.toPlainText() |
| 88 | if not text: |
| 89 | return |
| 90 | text = QByteArray(text.encode('gb2312')) # emmm windows 测试的工具貌似是这个编码 |
| 91 | if self.checkBoxHexSend.isChecked(): |
| 92 | # 如果勾选了hex发送 |
| 93 | text = text.toHex() |
| 94 | # 发送数据 |
| 95 | print('发送数据:', text) |
| 96 | self._serial.write(text) |
| 97 | |
| 98 | def onReadyRead(self): |
| 99 | # 数据接收响应 |
nothing calls this directly
no outgoing calls
no test coverage detected