这是我的Java串行通信中的问题...我的jennic硬件设备使用UART连接。我想检索值形成我的设备..SerialPort阅读java
我收到串的字节数组中SerialPortEvent.DATA_AVAILABLE
case SerialPortEvent.DATA_AVAILABLE:
try {
int size;
while(inputStream.available()!=0) {
byte buff[]=new byte[100];
size=inputStream.read(buff);
inputStream.close();
String result = new String(buff,0,size);
ZPS_tsAplZdpIeeeAddrRsp IeeRsp = new ZPS_tsAplZdpIeeeAddrRsp(result);
}
第一I读取的字节并将其存储在BUFF []。然后将其转换为字符串,然后将其转换为字符串数组..然后我的问题是我得到了很多时间,但它的休息。
输出示例:
80011634002078445541560000341201004189
80011635002078445541560000341201004189
80011636002078445541560000341201004189
/*Here is Break my seq */
800116370020784455
41560000341201004189/*this two breaking seq generated two separate array and here is the problem*/
80011638002078445541560000341201004189
有冲厕我曾尝试inputStream.reset(),但它不工作的输入缓冲区的问题..谁能给我一个合适的建议,以解决这个问题。 。
感谢...