一毛

Results 29 comments of 一毛

分包需要App和外设统一分包协议,添加包头,包头中包含包头标识、数据总长度、数据校验信息等,App接收外设到数据包根据协议拼接数据包,同样App在发送时也需要按照协议组装数据,外设接收到数据也需要拼接,最终完成长度超过20字节的数据传输

用这个库吧,非常强大,支持分包、等待通知、各种需求都能满足,巧妙解决了Android BLE的各种问题,源码写的也是相当优雅 https://github.com/NordicSemiconductor/Android-BLE-Library

嗯,非常推荐,我看了几乎所有的BLE库,只有这个https://github.com/NordicSemiconductor/Android-BLE-Library 源码写的是最好的,而且解决了BLE的所有问题,另外还支持自动重连

源码是有使用CLIENT_CHARACTERISTIC_CONFIG的,在BleConnectWorker类中setCharacteristicNotification方法,你可以看看 @Override public boolean setCharacteristicNotification(UUID service, UUID character, boolean enable) { checkRuntime(); BluetoothLog.v(String.format("setCharacteristicNotification for %s, service = %s, character = %s, enable = %b", getAddress(), service, character, enable)); BluetoothGattCharacteristic characteristic...

不会,mCountDownLatch赋值是在bindServiceSync之前,这段代码是在同一个线程的,notifyBluetoothManagerReady必然是在mCountDownLatch赋值之后回调的,是不会为空的

根据happens-before原则也能推到出来