Skip to content
New issue

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

临时解决通讯notify接收不能超过20个字节问题 #172

Open
loveanao opened this issue May 31, 2022 · 2 comments
Open

临时解决通讯notify接收不能超过20个字节问题 #172

loveanao opened this issue May 31, 2022 · 2 comments

Comments

@loveanao
Copy link

修改源码 BluetoothGattResponse

@OverRide
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {

    // 为了接受超过20个字节的数据
    // 前提条件: 第一 设备支持蓝牙4.2协议规范,第二 android 5.0
    // mut 一般限制范围为23~517字节
    if (gatt != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        int mut = 96;
        gatt.requestMtu(mut);
    }

    response.onConnectionStateChange(status, newState);
}
@rayzeng0221
Copy link

老哥,方便加下联系方式吗?请教你蓝牙开发的问题

@tomKitty888888
Copy link

如果是用经典蓝牙,使用这个库是不是很多地方需要调整 关键的收发数据

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants