We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
为啥我从serialPort.getInputStream() 拿到的数据最多只能拿到32个字节 while (!isInterrupted()) { try { if (mInputStream == null) { return; } int available = mInputStream.available(); byte[] buffer = new byte[available]; int size = mInputStream.read(buffer); if (size > 0) { if (null != callback) { callback.callback(buffer); } } } catch (IOException e) { e.printStackTrace(); return; } }
我这里如果改成比32大的byte[] ,32位之后的数据全是0
The text was updated successfully, but these errors were encountered:
不要期待一次性就能把串口传输的数据读全的,我试过对接一个波特率只有4800的项目,每次read只能读到1个有效字节,解决方法是把读到的数据全缓存到一个大数组里面,然后按照具体协议进行分包。
Sorry, something went wrong.
No branches or pull requests
为啥我从serialPort.getInputStream() 拿到的数据最多只能拿到32个字节
while (!isInterrupted()) {
try {
if (mInputStream == null) {
return;
}
int available = mInputStream.available();
byte[] buffer = new byte[available];
int size = mInputStream.read(buffer);
if (size > 0) {
if (null != callback) {
callback.callback(buffer);
}
}
} catch (IOException e) {
e.printStackTrace();
return;
}
}
我这里如果改成比32大的byte[] ,32位之后的数据全是0
The text was updated successfully, but these errors were encountered: