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
可以配对连接,可以发送数据,但是无法接收到数据,也没有报错信息。
CbtManager.getInstance().startServiceListener(new ServiceListenerCallback() { @OverRide public void onStartError(Throwable throwable) { CbtLogs.e(throwable.getMessage()); }
@Override public void onDataListener(String s, BluetoothDevice device) { CbtLogs.e("onDataListener:" + s); } });
The text was updated successfully, but these errors were encountered:
这个库确实没有客户端收数据的方法,需要自己手动写。 蓝牙连接成功后开启子线程接收数据: CbtExecutor.getInstance().execute(new Runnable() { @OverRide public void run() { ByteArrayOutputStream byteArrayOutputStream; byte[] buffer = new byte[1024]; int bytes; try { InputStream inputStream = mBluetoothSocket.getInputStream(); while (true) { while ((bytes = inputStream.read(buffer)) != -1) { byteArrayOutputStream = new ByteArrayOutputStream(); byteArrayOutputStream.write(buffer, 0, bytes); //resole是并包的方法,不并包数据是错乱的 byte[] resole = ReadUtil.resole(byteArrayOutputStream.toByteArray()); } } } catch (IOException e) { e.printStackTrace(); } } });
Sorry, something went wrong.
No branches or pull requests
可以配对连接,可以发送数据,但是无法接收到数据,也没有报错信息。
CbtManager.getInstance().startServiceListener(new ServiceListenerCallback() {
@OverRide
public void onStartError(Throwable throwable) {
CbtLogs.e(throwable.getMessage());
}
The text was updated successfully, but these errors were encountered: