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没收到onCharacteristicChanged回调(同样操作fastble可以) #33

Closed
chengxinping opened this issue Apr 10, 2024 · 8 comments

Comments

@chengxinping
Copy link

问题描述(出现的环境,demo是否存在)
公司的设备两个特征值,一个用来写,一个用来notiffy,本框架写了之后notify的那个特征值收不到change的回调,fastble可以

bleCore
fastble1
fastble2

框架文档是否提及了该问题【必答】 否

是否已经查阅框架文档但还未能解决的【必答】

issue 列表中是否有人曾提过类似的问题【必答】

是否已经搜索过了 issue 列表但还未能解决的【必答】

@buhuiming
Copy link
Owner

小伙子我没有复现你的bug啊
Screenshot_20240411_183625_BleCore
Screenshot_20240411_184330_FastBLE
Screenshot_20240411_184336_FastBLE

@chengxinping
Copy link
Author

我这边只有我这款型号的设备能复现,其他设备也没法复现,大概率和机器的蓝牙芯片有关系,没办法我只能替换回fastble了

@chengxinping
Copy link
Author

我们这边这款型号的机器是必现的 脑壳痛

@buhuiming
Copy link
Owner

和fastble是一样的原生Api,只不过android sdk版本不一样

@buhuiming
Copy link
Owner

image
小伙子,把137行、157~159号注释掉试一试

@chengxinping
Copy link
Author

chengxinping commented Apr 26, 2024

尝试了一下没用,还是收不到notify的问题,咱们这个库要传递一个DescriptorGetType,fastble的notify没这个参数,不太懂这个参数是干啥的,不知道是不是这个参数影响的 我看你这个参数里面注释也说了这个问题

image

目前是传的AllDescriptor,是无效的,应该就是这个导致的

@buhuiming
Copy link
Owner

1、BleDescriptorGetType有3个类型,除了AllDescriptor,其他2个是和FaseBle对应的。AllDescriptor这个其实把该特征值下的所有描述符都写入。Default是系统提供接受通知自带的UUID对应的特征值,和FaseBle useCharacteristicDescriptor=fasle一样。CharacteristicDescriptor是业务层指定的UUID对应的特征值,和FaseBle useCharacteristicDescriptor=true一样。不知道你有没有3个值都试一下?
2、第二个可能会导致,就是BleConnectedDevice类中的onCharacteristicChanged方法,Android13中引用了新的方法,如果新方法和旧方法都没有触发的话,这个问题目前就无解了

@buhuiming
Copy link
Owner

此外说明一下,为什么会引入AllDescriptor,是借鉴了我上家公司工程师写的Ble库,做法就是把把该特征值下的所有描述符都写入,该库已经在百万级设备上应用,因此才拓展出来,至于特征值对应的是哪个描述符,这个也是需要固件(硬件)工程师确定的

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

2 participants