FastBle
FastBle copied to clipboard
Android Bluetooth Low Energy (BLE) Fast Development Framework. It uses simple ways to filter, scan, connect, read ,write, notify, readRssi, setMTU, and multiConnection.
1、搜索蓝牙后得到的蓝牙对象,在关闭手机蓝牙后,所有已搜索的蓝牙bleDevice下的BluetoothDevice 会变成空 2、关闭手机蓝牙,再次开启蓝牙后,重新连接成功后回调中bleDevice对象下的BluetoothDevice 对象为空 3、正常远距离断开重连是正常的 希望方便的时候帮忙分析一下原因 /// ///蓝牙连接 /// ///蓝牙设备 fun connect(bleDevice: BleDevice) { BleManager.getInstance().connect(bleDevice, object : BleGattCallback() { override fun onStartConnect() { println("---------------> onStartConnect") } override fun onConnectFail(bleDevice: BleDevice,...
if (ActivityCompat.checkSelfPermission(MainActivity.getContext(), Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) { } Never returns PERMISSION_GRANTED. My manifest looks like this: What might I be missing?
调试了一会儿,发现作者使用的mCharacteristic是空的,而不是从函数传入的。所以我就在BleManager.getInstance().notify这个函数里加上了characteristic;详情请看我改了哪些地方,跟着我改就可以了:       ` BluetoothGattDescriptor descriptor = null; List descriptors = characteristic.getDescriptors(); for (BluetoothGattDescriptor desc : descriptors) { if (desc.getCharacteristic().getUuid().equals(formUUID(UUID_CLIENT_CHARACTERISTIC_CONFIG_DESCRIPTOR))) { descriptor = desc; break; }...
Sometimes it works, and sometimes I get a timeout/error. Is there a trick to setting it? Is there a maximum value? Thank you, Mike
https://github.com/buhuiming/BleCore
写入失败, 说是设备未连接 实际上设备的状态显示是连接的, 也能收到设备发送的notify 数据。
vivoV2241A搜索不到蓝牙设备
现在的版本是否支持外设模式