📄 readserial.java
字号:
package communication;
import java.io.*;
/**
* This class reads message from the specific serial port and save
* the message to the serial buffer.
*/
public class ReadSerial extends Thread
{
private SerialBuffer ComBuffer;//ComBuffer是存储串口传来数据的缓冲区!!!!
private InputStream inPort;
/**
* Constructor
* @param SB The buffer to save the incoming messages.
* @param Port The InputStream from the specific serial port.
*/
public ReadSerial(SerialBuffer SB, InputStream Port)
{
ComBuffer = SB;
inPort = Port;
}
public void run()
{
int c;
try
{
while (true)
{
c = inPort.read();
ComBuffer.PutChar(c);
}
} catch (IOException e) {}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -