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

请问下,回调只收到部分数据怎么解? #30

Open
phoebewow opened this issue May 18, 2022 · 8 comments
Open

请问下,回调只收到部分数据怎么解? #30

phoebewow opened this issue May 18, 2022 · 8 comments

Comments

@phoebewow
Copy link

看日志数据是全部接收到了的,但是回调只给了部分

D/BluetoothGatt: onNotify() - Device=50:33:8B:::** handle=21
D/EasyBLE: characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: A5 07 10 00 00 20 20 30 31 2D 30 30 2E 32 2E 30 31 20 20 20]
D/BluetoothGatt: onNotify() - Device=50:33:8B:::** handle=21
D/EasyBLE: characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: 20 1C BD 5A]

这个数据,第一条的数据有回调,第二条数据就没有
是因为这两条数据连发的原因吗?

@wandersnail
Copy link
Owner

都会回的呀

@phoebewow
Copy link
Author

确实是只收到了一条数据
这两条数据下位机那边实际发送的是一条,共24个字节,但是蓝牙是20字节一包这样发送的

@phoebewow
Copy link
Author

我下了源码放到APP里,加了时间打印,看了间隔时间应该满足啊

D/BluetoothGatt: onNotify() - Device=50:33:8B:::** handle=21
D/EasyBLE: 2022-05-19 14:59:31:855 characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: A5 07 10 00 00 20 20 30 31 2D 30 30 2E 32 2E 30 31 20 20 20]
D/BluetoothGatt: onNotify() - Device=50:33:8B:::** handle=21
D/EasyBLE: 2022-05-19 14:59:31:876 characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: 20 1C BD 5A]
D/BluetoothGatt: onNotify() - Device=50:33:8B:::** handle=21
D/EasyBLE: 2022-05-19 14:59:32:873 characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: A5 07 10 00 00 20 20 30 31 2D 30 30 2E 32 2E 30 31 20 20 20]
D/BluetoothGatt: onNotify() - Device=50:33:8B:::** handle=21
D/EasyBLE: 2022-05-19 14:59:32:879 characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: 20 1C BD 5A]

@phoebewow
Copy link
Author

是observer为空了,所以没有回调
D/EasyBLE: 2022-05-19 15:08:20:047 characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: A5 07 10 00 00 20 20 30 31 2D 30 30 2E 32 2E 30 31 20 20 20]
D/BluetoothGatt: onNotify() - Device=50:33:8B:::** handle=21
D/EasyBLE: observer is null
D/EasyBLE: 2022-05-19 15:08:20:053 characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: 20 1C BD 5A]
D/BluetoothGatt: onNotify() - Device=50:33:8B:::** handle=21
D/EasyBLE: observer is null
D/EasyBLE: 2022-05-19 15:08:21:047 characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: A5 07 10 00 00 20 20 30 31 2D 30 30 2E 32 2E 30 31 20 20 20]
D/BluetoothGatt: onNotify() - Device=50:33:8B:::** handle=21
D/EasyBLE: observer is null
D/EasyBLE: 2022-05-19 15:08:21:071 characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: 20 1C BD 5A]

@phoebewow
Copy link
Author

之前observer为空是因为连接时没加,但是加了以后还是一样没回调第二条

D/BluetoothGatt: onNotify() - Device=50:33:8B:::** handle=21
D/EasyBLE: 2022-05-19 15:39:51:484 characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: A5 07 10 00 00 20 20 30 31 2D 30 30 2E 32 2E 30 31 20 20 20]
D/BluetoothGatt: onNotify() - Device=50:33:8B:::** handle=21
D/EasyBLE: 2022-05-19 15:39:51:489 characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: 20 1C BD 5A]
D/BluetoothGatt: onNotify() - Device=50:33:8B:::** handle=21
D/EasyBLE: 2022-05-19 15:39:52:459 characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: A5 07 10 00 00 20 20 30 31 2D 30 30 2E 32 2E 30 31 20 20 20]
D/BluetoothGatt: onNotify() - Device=50:33:8B:::** handle=21
D/EasyBLE: 2022-05-19 15:39:52:483 characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: 20 1C BD 5A]
D/BluetoothGatt: onNotify() - Device=50:33:8B:::** handle=21
D/EasyBLE: 2022-05-19 15:39:53:458 characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: A5 07 10 00 00 20 20 30 31 2D 30 30 2E 32 2E 30 31 20 20 20]
D/BluetoothGatt: onNotify() - Device=50:33:8B:::** handle=21
D/EasyBLE: 2022-05-19 15:39:53:484 characteristic change! [UUID: 0000f1f2, addr: 50:33:8B:21:C3:5B, value: 20 1C BD 5A]

@phoebewow
Copy link
Author

我尝试在连接到时候设置了setBluetoothGattCallback,这样可以收到数据,但变成2个进程了,会造成我拼包那里出问题

@phoebewow
Copy link
Author

加了线程锁之后就没问题了,但是observer没回调的应该还是要看看怎么解决吧?

@coolBreezes
Copy link

加了线程锁之后就没问题了,但是observer没回调的应该还是要看看怎么解决吧?

我验证了下,并没有出现你反馈的问题

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