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的那个102 descriptor equals null 的错 #574

Open
wangjinchan opened this issue Jun 16, 2023 · 9 comments
Open

我已解决notify的那个102 descriptor equals null 的错 #574

wangjinchan opened this issue Jun 16, 2023 · 9 comments

Comments

@wangjinchan
Copy link

调试了一会儿,发现作者使用的mCharacteristic是空的,而不是从函数传入的。所以我就在BleManager.getInstance().notify这个函数里加上了characteristic;详情请看我改了哪些地方,跟着我改就可以了:
image
image
image
image
image
image
BluetoothGattDescriptor descriptor = null; List<BluetoothGattDescriptor> descriptors = characteristic.getDescriptors(); for (BluetoothGattDescriptor desc : descriptors) { if (desc.getCharacteristic().getUuid().equals(formUUID(UUID_CLIENT_CHARACTERISTIC_CONFIG_DESCRIPTOR))) { descriptor = desc; break; } }

@wangjinchan
Copy link
Author

如果还有什么没看懂 ,可以问 我,邮箱:[email protected]
希望作者把我拉进去一起维护。

@wwxwwq
Copy link

wwxwwq commented Jun 28, 2023

image
这里mCharacteristic不是已经赋值了吗

@wangjinchan
Copy link
Author

wangjinchan commented Jun 28, 2023 via email

@wwxwwq
Copy link

wwxwwq commented Jun 29, 2023

连接上后,扫描到服务,再开启通过,这里应该不可能空
image

@wangjinchan
Copy link
Author

wangjinchan commented Jun 29, 2023 via email

@hiddus
Copy link

hiddus commented Sep 6, 2023

每次都是newBleConnector characteristic每次都会赋值。
我这边状况是,write和notify是2个不同characteristic。
有时正常,读写发送都好着。
有时候,写入一次,然后接收到返回,之后再发送都是发送回调成功,实际下位机没接收到。需要重新启动APP。

@alvayang
Copy link

alvayang commented Oct 2, 2023

非常感谢 @wangjinchan 的讨论,通过源码和Debug发现,很可能是下位机对于一条指令的结束没有给出正确的反应,比较合理的尝试是修改MTU的大小,当然下位机是需要能支持的。

@ThanatosDan
Copy link

image
liangg两个一样的UUID 第二个才是notify 导致了这个问题

@ThanatosDan
Copy link

image
image
我这边这样改好像也可以

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

5 participants