Giter Club home page Giter Club logo

android-bluetoothkit's People

Contributors

dingjikerbo avatar fuhaodev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-bluetoothkit's Issues

希望增加一个解除监听的接口

IBluetoothClient中,增加
void unnotify(String mac, UUID service, UUID character, BleNotifyResponse response)
接口,最后一个参数不同于
BleUnnotifyResponse,
它仅仅是移除设备特征通知的一个监听者,而不是解除对它的所有监听。

连接后,无法发现发现服务下面的特征值。

使用该库,在发现服务时,无法发现服务下的特征值。小米3(系统6.0)华为荣耀8(系统7.0)都如此。

08-24 19:35:24.239: D/BluetoothAdapter(11630): stopLeScan()
08-24 19:35:24.249: V/miio-bluetooth(11630): Ble search (5s) onSearchStopped
08-24 19:35:27.809: V/miio-bluetooth(11630): a B0:91:22:68:AD:10 >>> service discover timeout
08-24 19:35:27.809: V/miio-bluetooth(11630): a B0:91:22:68:AD:10 >>> close gatt
08-24 19:35:27.809: V/miio-bluetooth(11630): closeGatt for B0:91:22:68:AD:10
08-24 19:35:27.809: D/BluetoothGatt(11630): close()
08-24 19:35:27.809: D/BluetoothGatt(11630): unregisterApp() - mClientIf=5
08-24 19:35:27.814: V/miio-bluetooth(11630): a B0:91:22:68:AD:10 >>> retry connect later
08-24 19:35:27.814: V/miio-bluetooth(11630): setConnectStatus status = Disconnected
08-24 19:35:27.819: V/miio-bluetooth(11630): BluetoothReceiver onReceive: action.connect_status_changed
08-24 19:35:27.819: V/miio-bluetooth(11630): onConnectStatusChanged for B0:91:22:68:AD:10, status = 32
08-24 19:35:28.814: V/miio-bluetooth(11630): openGatt for B0:91:22:68:AD:10
08-24 19:35:28.819: D/BluetoothGatt(11630): connect() - device: B0:91:22:68:AD:10, auto: false
08-24 19:35:28.819: D/BluetoothGatt(11630): registerApp()
08-24 19:35:28.819: D/BluetoothGatt(11630): registerApp() - UUID=d606492a-af22-45de-b8f4-33814e36ef6c
08-24 19:35:28.824: D/BluetoothGatt(11630): onClientRegistered() - status=0 clientIf=4
08-24 19:35:29.029: D/BluetoothGatt(11630): onClientConnectionState() - status=0 clientIf=4 device=B0:91:22:68:AD:10
08-24 19:35:29.034: V/miio-bluetooth(11630): onConnectionStateChange for B0:91:22:68:AD:10: status = 0, newState = 2
08-24 19:35:29.034: V/miio-bluetooth(11630): setConnectStatus status = Connected
08-24 19:35:29.339: V/miio-bluetooth(11630): processDiscoverService, status = Connected
08-24 19:35:29.339: V/miio-bluetooth(11630): discoverService for B0:91:22:68:AD:10
08-24 19:35:29.339: D/BluetoothGatt(11630): discoverServices() - device: B0:91:22:68:AD:10
08-24 19:35:29.344: D/BluetoothGatt(11630): onGetService() - Device=B0:91:22:68:AD:10 UUID=00001800-0000-1000-8000-00805f9b34fb
08-24 19:35:29.349: D/BluetoothGatt(11630): onGetService() - Device=B0:91:22:68:AD:10 UUID=00001801-0000-1000-8000-00805f9b34fb
08-24 19:35:29.349: D/BluetoothGatt(11630): onGetService() - Device=B0:91:22:68:AD:10 UUID=00005500-0000-1000-8000-00805f9b34fb
08-24 19:35:29.354: D/BluetoothGatt(11630): onGetService() - Device=B0:91:22:68:AD:10 UUID=00006600-0000-1000-8000-00805f9b34fb
08-24 19:35:29.354: D/BluetoothGatt(11630): onGetService() - Device=B0:91:22:68:AD:10 UUID=00002200-0000-1000-8000-00805f9b34fb
08-24 19:35:29.359: D/BluetoothGatt(11630): onGetService() - Device=B0:91:22:68:AD:10 UUID=f000ffc0-0451-4000-b000-000000000000
08-24 19:35:29.369: D/BluetoothGatt(11630): onSearchComplete() = Device=B0:91:22:68:AD:10 Status=0
08-24 19:35:29.369: V/miio-bluetooth(11630): onServicesDiscovered for B0:91:22:68:AD:10: status = 0
08-24 19:35:29.369: V/miio-bluetooth(11630): setConnectStatus status = Service Ready
08-24 19:35:29.374: V/miio-bluetooth(11630): refreshServiceProfile for B0:91:22:68:AD:10
08-24 19:35:29.374: V/miio-bluetooth(11630): Service: 00001800-0000-1000-8000-00805f9b34fb
08-24 19:35:29.374: V/miio-bluetooth(11630): Service: 00001801-0000-1000-8000-00805f9b34fb
08-24 19:35:29.374: V/miio-bluetooth(11630): Service: 00005500-0000-1000-8000-00805f9b34fb
08-24 19:35:29.374: V/miio-bluetooth(11630): Service: 00006600-0000-1000-8000-00805f9b34fb
08-24 19:35:29.374: V/miio-bluetooth(11630): Service: 00002200-0000-1000-8000-00805f9b34fb
08-24 19:35:29.374: V/miio-bluetooth(11630): Service: f000ffc0-0451-4000-b000-000000000000
08-24 19:35:29.379: V/miio-bluetooth(11630): BluetoothReceiver onReceive: action.connect_status_changed
08-24 19:35:29.379: V/miio-bluetooth(11630): onConnectStatusChanged for B0:91:22:68:AD:10, status = 16
08-24 19:35:29.384: V/miio-bluetooth(11630): a B0:91:22:68:AD:10 >>> request complete: code = 0

但是用同一台手机,使用系统自带的API,是可以正常获取到所有服务与特征值的

08-24 19:40:25.019: W/dalvikvm(13873): VFY: unable to resolve virtual method 530: Landroid/bluetooth/BluetoothGatt;.requestConnectionPriority (I)Z
08-24 19:40:25.019: D/dalvikvm(13873): VFY: replacing opcode 0x6e at 0x0009
08-24 19:40:25.019: D/f(13873): Trying to create a new connection.
08-24 19:40:25.019: D/BluetoothGatt(13873): connect() - device: B0:91:22:68:AD:10, auto: false
08-24 19:40:25.019: D/BluetoothGatt(13873): registerApp()
08-24 19:40:25.019: D/BluetoothGatt(13873): registerApp() - UUID=239d8eef-4904-4366-af07-e7f90093561d
08-24 19:40:25.024: D/BluetoothGatt(13873): onClientRegistered() - status=0 clientIf=4
08-24 19:40:25.059: D/mali_winsys(13873): new_window_surface returns 0x3000
08-24 19:40:25.144: D/dalvikvm(13873): ---Heap option for 2603536
08-24 19:40:25.169: D/dalvikvm(13873): GC_FOR_ALLOC freed 404K, 24% free 16958K/22232K, paused 14ms, total 14ms
08-24 19:40:25.224: D/mali_winsys(13873): new_window_surface returns 0x3000
08-24 19:40:25.324: D/BluetoothGatt(13873): onClientConnectionState() - status=0 clientIf=4 device=B0:91:22:68:AD:10
08-24 19:40:25.324: D/f(13873): ##########STATE_CONNECTED.
08-24 19:40:25.324: D/f(13873): Attempting to start service discovery.
08-24 19:40:25.324: D/BluetoothGatt(13873): discoverServices() - device: B0:91:22:68:AD:10
08-24 19:40:31.629: D/BluetoothGatt(13873): onGetService() - Device=B0:91:22:68:AD:10 UUID=00001800-0000-1000-8000-00805f9b34fb
08-24 19:40:31.629: D/BluetoothGatt(13873): onGetService() - Device=B0:91:22:68:AD:10 UUID=00001801-0000-1000-8000-00805f9b34fb
08-24 19:40:31.634: D/BluetoothGatt(13873): onGetService() - Device=B0:91:22:68:AD:10 UUID=00005500-0000-1000-8000-00805f9b34fb
08-24 19:40:31.634: D/BluetoothGatt(13873): onGetService() - Device=B0:91:22:68:AD:10 UUID=00006600-0000-1000-8000-00805f9b34fb
08-24 19:40:31.639: D/BluetoothGatt(13873): onGetService() - Device=B0:91:22:68:AD:10 UUID=00002200-0000-1000-8000-00805f9b34fb
08-24 19:40:31.644: D/BluetoothGatt(13873): onGetService() - Device=B0:91:22:68:AD:10 UUID=f000ffc0-0451-4000-b000-000000000000
08-24 19:40:31.644: D/BluetoothGatt(13873): onGetService() - Device=B0:91:22:68:AD:10 UUID=0000fee7-0000-1000-8000-00805f9b34fb
08-24 19:40:31.654: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00002a00-0000-1000-8000-00805f9b34fb
08-24 19:40:31.654: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00002a01-0000-1000-8000-00805f9b34fb
08-24 19:40:31.659: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00002a04-0000-1000-8000-00805f9b34fb
08-24 19:40:31.669: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00005501-0000-1000-8000-00805f9b34fb
08-24 19:40:31.674: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00005502-0000-1000-8000-00805f9b34fb
08-24 19:40:31.674: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00005503-0000-1000-8000-00805f9b34fb
08-24 19:40:31.679: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00005504-0000-1000-8000-00805f9b34fb
08-24 19:40:31.679: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00005505-0000-1000-8000-00805f9b34fb
08-24 19:40:31.684: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00005506-0000-1000-8000-00805f9b34fb
08-24 19:40:31.684: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00005507-0000-1000-8000-00805f9b34fb
08-24 19:40:31.689: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00005508-0000-1000-8000-00805f9b34fb
08-24 19:40:31.689: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006602-0000-1000-8000-00805f9b34fb
08-24 19:40:31.694: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006603-0000-1000-8000-00805f9b34fb
08-24 19:40:31.694: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006604-0000-1000-8000-00805f9b34fb
08-24 19:40:31.699: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006605-0000-1000-8000-00805f9b34fb
08-24 19:40:31.699: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006606-0000-1000-8000-00805f9b34fb
08-24 19:40:31.704: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006607-0000-1000-8000-00805f9b34fb
08-24 19:40:31.709: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006608-0000-1000-8000-00805f9b34fb
08-24 19:40:31.709: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006601-0000-1000-8000-00805f9b34fb
08-24 19:40:31.714: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006622-0000-1000-8000-00805f9b34fb
08-24 19:40:31.714: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006621-0000-1000-8000-00805f9b34fb
08-24 19:40:31.719: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006623-0000-1000-8000-00805f9b34fb
08-24 19:40:31.719: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006624-0000-1000-8000-00805f9b34fb
08-24 19:40:31.724: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006609-0000-1000-8000-00805f9b34fb
08-24 19:40:31.724: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006610-0000-1000-8000-00805f9b34fb
08-24 19:40:31.724: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006611-0000-1000-8000-00805f9b34fb
08-24 19:40:31.724: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006612-0000-1000-8000-00805f9b34fb
08-24 19:40:31.729: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006613-0000-1000-8000-00805f9b34fb
08-24 19:40:31.729: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00006618-0000-1000-8000-00805f9b34fb
08-24 19:40:31.729: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=00002201-0000-1000-8000-00805f9b34fb
08-24 19:40:31.734: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=f000ffc1-0451-4000-b000-000000000000
08-24 19:40:31.734: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=f000ffc2-0451-4000-b000-000000000000
08-24 19:40:31.734: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=f000ffc3-0451-4000-b000-000000000000
08-24 19:40:31.739: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=f000ffc4-0451-4000-b000-000000000000
08-24 19:40:31.739: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=0000fec8-0000-1000-8000-00805f9b34fb
08-24 19:40:31.739: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=0000fec7-0000-1000-8000-00805f9b34fb
08-24 19:40:31.744: D/BluetoothGatt(13873): onGetCharacteristic() - Device=B0:91:22:68:AD:10 UUID=0000fec9-0000-1000-8000-00805f9b34fb
08-24 19:40:31.744: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.749: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.754: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.754: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.759: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.759: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.759: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.759: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.764: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.764: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.764: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.769: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.769: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.769: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.774: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.774: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.779: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.779: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.784: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.784: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.789: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.789: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.789: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.794: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002901-0000-1000-8000-00805f9b34fb
08-24 19:40:31.794: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.794: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002901-0000-1000-8000-00805f9b34fb
08-24 19:40:31.794: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002901-0000-1000-8000-00805f9b34fb
08-24 19:40:31.799: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.799: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002901-0000-1000-8000-00805f9b34fb
08-24 19:40:31.804: D/BluetoothGatt(13873): onGetDescriptor() - Device=B0:91:22:68:AD:10 UUID=00002902-0000-1000-8000-00805f9b34fb
08-24 19:40:31.804: D/BluetoothGatt(13873): onSearchComplete() = Device=B0:91:22:68:AD:10 Status=0
08-24 19:40:31.804: D/Oitsme(13873): #####onServicesDiscovered completed.

连接成功后,大概5 、6 秒后就自动断开了,请问是怎么回事?

/miio-bluetooth: setConnectStatus status = Service Ready
/miio-bluetooth: refreshServiceProfile for A0:E6:F8:51:7B:46
/miio-bluetooth: Service: 00001800-0000-1000-8000-00805f9b34fb
/miio-bluetooth: character: uuid = 00002a00-0000-1000-8000-00805f9b34fb
/miio-bluetooth: character: uuid = 00002a01-0000-1000-8000-00805f9b34fb
/miio-bluetooth: character: uuid = 00002a04-0000-1000-8000-00805f9b34fb
/miio-bluetooth: Service: 00001801-0000-1000-8000-00805f9b34fb
/miio-bluetooth: Service: 0000180a-0000-1000-8000-00805f9b34fb
/miio-bluetooth: character: uuid = 00002a25-0000-1000-8000-00805f9b34fb
/miio-bluetooth: character: uuid = 00002a26-0000-1000-8000-00805f9b34fb
/miio-bluetooth: character: uuid = 00002a27-0000-1000-8000-00805f9b34fb
/miio-bluetooth: character: uuid = 00002a28-0000-1000-8000-00805f9b34fb
/miio-bluetooth: character: uuid = 00002a29-0000-1000-8000-00805f9b34fb
/miio-bluetooth: Service: 0000fff0-0000-1000-8000-00805f9b34fb
/miio-bluetooth: character: uuid = 0000fff1-0000-1000-8000-00805f9b34fb
/miio-bluetooth: character: uuid = 0000fff2-0000-1000-8000-00805f9b34fb
/miio-bluetooth: BluetoothReceiver onReceive: action.connect_status_changed
/miio-bluetooth: onConnectStatusChanged for A0:E6:F8:51:7B:46, status = 16
/miio-bluetooth: character: uuid = 0000fff8-0000-1000-8000-00805f9b34fb
/miio-bluetooth: BleConnectRequest A0:E6:F8:51:7B:46 >>> request complete: code = 0
/BluetoothGatt: onClientConnectionState() - status=8 clientIf=6 device=A0:E6:F8:51:7B:46
/miio-bluetooth: onConnectionStateChange for A0:E6:F8:51:7B:46: status = 8, newState = 0
/miio-bluetooth: closeGatt for A0:E6:F8:51:7B:46
/BluetoothGatt: close()
/BluetoothGatt: unregisterApp() - mClientIf=6
/miio-bluetooth: setConnectStatus status = Disconnected
/miio-bluetooth: BluetoothReceiver onReceive: action.connect_status_changed
/miio-bluetooth: onConnectStatusChanged for A0:E6:F8:51:7B:46, status = 32

超时连接问题

我设置了连接次数4,超时50秒,为什么还是每5,6秒就重新连接?

BLE分包写

BLE单次写的数据量大小是有限制的,通常是20字节,可以尝试通过requestMTU增大,但不保证能成功。分包写是一种解决方案,需要定义分包协议,假设每个包大小20字节,分两种包,数据包和非数据包。对于数据包,头两个字节表示包的序号,剩下的都填充数据。对于非数据包,主要是发送一些控制信息。

总体流程如下:
1、发端发送控制包,告诉对方要发送的总的包数
2、收端回一个ACK包,表示准备好了,对方可以发送了
3、发端开始批量发送数据,为了速度,不需要对端回复
4、收端收到最后一个包或超时后,开始检查还缺哪些包,然后回复ACK,带上丢的包序号
5、发端重发丢的包
6、收端全部收到,回复ACK,CRC校验,包数据拼接好了传到上层

这里面核心是状态机,另外要注意对于BLE来说,主端和从端都可以收发数据,但是是非对称的。对主端来说,发是write characteristic,收是onCharacteristicChanged,对从端来说,发是sendNotify,收是onCharacteristicWrite。尽管如此,但是协议部分是相同的,所以我们要抽象成两层,底层是收发的物理层,上层是分包的协议层,再上层就是业务层。

具体代码可参考Channel.java

打开notify失败

蓝牙已经连接成功,service和character的uuid都是对的,character也可以notify,但是打开notify返回失败,请问是什么原因?

Beacon.java:32 未检测mItems是否为null,运行时会不断抛出空指针

E/miio-bluetooth: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.inuker.bluetooth.library.utils.proxy.ProxyBulk.safeInvoke(ProxyBulk.java:26)
    at com.inuker.bluetooth.library.utils.proxy.ProxyBulk.safeInvoke(ProxyBulk.java:34)
    at com.inuker.bluetooth.library.utils.proxy.ProxyInvocationHandler.handleMessage(ProxyInvocationHandler.java:102)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:194)
    at android.app.ActivityThread.main(ActivityThread.java:5682)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:963)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758)
    Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference
    at com.inuker.bluetooth.library.beacon.Beacon.toString(Beacon.java:32)
    at com.junerver.bluetoothdemo.MainActivity$1.onDeviceFounded(MainActivity.java:41)
    at java.lang.reflect.Method.invoke(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:372) 
    at com.inuker.bluetooth.library.utils.proxy.ProxyBulk.safeInvoke(ProxyBulk.java:26) 
    at com.inuker.bluetooth.library.utils.proxy.ProxyBulk.safeInvoke(ProxyBulk.java:34) 
    at com.inuker.bluetooth.library.utils.proxy.ProxyInvocationHandler.handleMessage(ProxyInvocationHandler.java:102) 
    at android.os.Handler.dispatchMessage(Handler.java:107) 
    at android.os.Looper.loop(Looper.java:194) 
    at android.app.ActivityThread.main(ActivityThread.java:5682) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:372) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:963) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758) 
    java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference
    at com.inuker.bluetooth.library.beacon.Beacon.toString(Beacon.java:32)
    at com.junerver.bluetoothdemo.MainActivity$1.onDeviceFounded(MainActivity.java:41)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.inuker.bluetooth.library.utils.proxy.ProxyBulk.safeInvoke(ProxyBulk.java:26)
    at com.inuker.bluetooth.library.utils.proxy.ProxyBulk.safeInvoke(ProxyBulk.java:34)
    at com.inuker.bluetooth.library.utils.proxy.ProxyInvocationHandler.handleMessage(ProxyInvocationHandler.java:102)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:194)
    at android.app.ActivityThread.main(ActivityThread.java:5682)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:963)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758)

蓝牙不断开

大神,问个问题,就是我调用这个ClientManager.getClient().disconnect(mac); 方法以后,app已经不再接受蓝牙设备发送的指令,但是蓝牙设备却一直是连接状态,我具体应该怎样去断开蓝牙设备?

Connect failed

Android连接蓝牙设备时,提示Connect Failed。
是否是UUID的问题?

在红米手机上版本4.4.4KTU84P扫描蓝牙设备过于频繁时出现BluetoothGatt﹕ android.os.DeadObjectException

扫描蓝牙设备频繁可能出现E/GKILINUX(17741): ##### ERROR : GKIexception: GKIexception(): Task State Table E/GKILINUX(17741): #####
E/GKILINUX(17741): ##### ERROR : GKIexception: TASK ID [0] task name [BTU] state [1]
E/GKILINUX(17741): #####
E/GKILINUX(17741): ##### ERROR : GKIexception: TASK ID [1] task name [BTIF] state [1]
E/GKILINUX(17741): #####
E/GKILINUX(17741): ##### ERROR : GKIexception: TASK ID [2] task name [A2DP-MEDIA] state [1]
E/GKILINUX(17741): #####
E/GKILINUX(17741): ##### ERROR : GKIexception: GKIexception 65524 getbuf: out of buffers#####
E/GKILINUX(17741): ##### ERROR : GKIexception:
E/GKI_LINUX(17741): **********************

请问怎么才能降低这种情况出现的可能

Duplicate notify when unregister notify failed.

BluetoothClientImpl.java line 334 to 336:
if (code == REQUEST_SUCCESS) { removeNotifyListener(mac, service, character); }

when code == FAILED will not removeNotifyListener and will lead to duplicate notify after duplicate register
notify.

Suggest: unwrap if statement.

BluetoothKit中Proxy的作用

认真阅读大神的代码,收获颇丰,非常感谢!
想请教一下,这个proxyUtils的作用是什么?查了之后也没弄明白用这个的优点、意义在哪里?
还请大神指教,非常感谢!

library里面AndroidManifest的supportsRtl属性建议去掉

不支持阿语语系右对齐的应用 引用库的时候会导致编译不过 求去掉改标志

Error:注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。

注: /Users/lee/source/taoxiaoqiPublic_android/sociallogin/src/main/java/com/taoxiaoqi/activity/T4JTwitterLoginActivity.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
/Users/lee/source/taoxiaoqiPublic_android/taoxiaoqi/src/main/AndroidManifest.xml:39:9-36 Error:
Attribute application@allowBackup value=(false) from AndroidManifest.xml:39:9-36
is also present at [com.inuker.bluetooth:library:1.2.3] AndroidManifest.xml:21:9-35 value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:37:5-269:19 to override.
/Users/lee/source/taoxiaoqiPublic_android/taoxiaoqi/src/main/AndroidManifest.xml:44:9-36 Error:
Attribute application@supportsRtl value=(false) from AndroidManifest.xml:44:9-36
is also present at [com.inuker.bluetooth:library:1.2.3] AndroidManifest.xml:23:9-35 value=(true).
Suggestion: add 'tools:replace="android:supportsRtl"' to element at AndroidManifest.xml:37:5-269:19 to override.
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':taoxiaoqi:processDailyDebugManifest'.

Manifest merger failed with multiple errors, see logs

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

Notify Not getting called sometime

We are trying to use following code,

BleClientManager.getInstance().notify(address.trim(),
                OTA_GATT_SERVICE_UUID,
                OTA_GATT_CHARACTERIC_IDENTIFY_UUID,
                new BleNotifyResponse() {
                    @Override
                    public void onNotify(UUID service, UUID character, byte[] value) {
                        Log.i("DownloadFirmware","onNotify gets called..");
                        response.onNotify(service, character, value);
                    }

                    @Override
                    public void onResponse(int code) {
                        Log.i("BleOperations", String.format("fwUploadIdentifyCharactericNotify  imgType = onResponse %d", code));
                        Log.i("DownloadFirmware","onResponse gets called.."+code);
                        if(code == REQUEST_SUCCESS) {
                            response.firmwareUpgradeSuccess(UPLOAD_IDENTIFY_CHARACTERIC,address);
                        }
                    }
                });

But sometime onNotify is not getting called, I thought to use read method but that is also returning -1, any idea why it is happening sometime only? FYI, it is working flawlessly in iOS app.

初始化出现nullpointer exception

Could not dispatch event: class com.taoxiaoqi.android.device.event.DeviceListChangeEventModel to subscribing class class com.taoxiaoqismart.stencil.presenter.home.DeviceListFragmentPresenter
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content.Context.registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter)' on a null object reference
at com.inuker.bluetooth.library.utils.BluetoothUtils.registerGlobalReceiver(BluetoothUtils.java:51)
at com.inuker.bluetooth.library.utils.BluetoothUtils.registerReceiver(BluetoothUtils.java:47)
at com.inuker.bluetooth.library.receiver.BluetoothReceiver.(BluetoothReceiver.java:67)
at com.inuker.bluetooth.library.receiver.BluetoothReceiver.getInstance(BluetoothReceiver.java:56)
at com.inuker.bluetooth.library.BluetoothClientImpl.registerBluetoothStateReceiver(BluetoothClientImpl.java:528)
at com.inuker.bluetooth.library.BluetoothClientImpl.registerBluetoothReceiver(BluetoothClientImpl.java:522)
at com.inuker.bluetooth.library.BluetoothClientImpl.(BluetoothClientImpl.java:118)
at com.inuker.bluetooth.library.BluetoothClientImpl.getInstance(BluetoothClientImpl.java:127)
at com.inuker.bluetooth.library.BluetoothClient.(BluetoothClient.java:31)
at com.taoxiaoqi.ble.BLEToolManager.(BLEToolManager.java:35)

1.2.5版本

找不到相关的UUID对应的写通道

相同的一份代码在不同的手机上运行时,会出现一个比较奇怪的问题,在一些手机上是获取不到对应的UUID对应写通道的Characteristic,但是大部分的手机都正常。看作者经验丰富下,这个是否能指点下迷津

BleGattProfile.toString Exception

Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference
at com.inuker.bluetooth.library.model.BleGattService.toString(BleGattService.java:79)
at java.lang.String.valueOf(String.java:2683)
at java.lang.StringBuilder.append(StringBuilder.java:129)
at com.inuker.bluetooth.library.model.BleGattProfile.toString(BleGattProfile.java:120)

红米note4x android 6.0.1 MIUI8.5稳定版 每次连接都会被断掉,重试了好几次才有可能连上

12:50:47.404 25183-25183/com.inuker.bluetooth I/Timeline: Timeline: Activity_launch_request time:3845900
12:50:47.425 25183-25183/com.inuker.bluetooth V/miio-bluetooth: stopSearch
12:50:47.452 25183-25183/com.inuker.bluetooth V/miio-bluetooth: connect 08:7C:BE:07:D2:23
12:50:47.456 25183-25183/com.inuker.bluetooth D/ActivityThreadInjector: clearCachedDrawables.
12:50:47.500 25183-26077/com.inuker.bluetooth W/miio-bluetooth: Process BleConnectRequest, status = Disconnected
12:50:47.502 25183-26077/com.inuker.bluetooth V/miio-bluetooth: openGatt for 08:7C:BE:07:D2:23
12:50:47.502 25183-26077/com.inuker.bluetooth D/BluetoothGatt: connect() - device: 08:7C:BE:07:D2:23, auto: false
12:50:47.502 25183-26077/com.inuker.bluetooth D/BluetoothGatt: registerApp()
12:50:47.502 25183-26077/com.inuker.bluetooth D/BluetoothGatt: registerApp() - UUID=a0b100ba-f595-43f0-906e-5f01c022fa41
12:50:47.505 25183-26056/com.inuker.bluetooth D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
12:50:48.732 25183-5740/com.inuker.bluetooth D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=5 device=08:7C:BE:07:D2:23
12:50:48.733 25183-26077/com.inuker.bluetooth V/miio-bluetooth: onConnectionStateChange for 08:7C:BE:07:D2:23: status = 133, newState = 0
12:50:48.733 25183-26077/com.inuker.bluetooth V/miio-bluetooth: closeGatt for 08:7C:BE:07:D2:23
12:50:48.733 25183-26077/com.inuker.bluetooth D/BluetoothGatt: close()
12:50:48.733 25183-26077/com.inuker.bluetooth D/BluetoothGatt: unregisterApp() - mClientIf=5
12:50:48.734 25183-26077/com.inuker.bluetooth V/miio-bluetooth: BleConnectRequest 08:7C:BE:07:D2:23 >>> retry connect later
12:50:48.734 25183-26077/com.inuker.bluetooth V/miio-bluetooth: setConnectStatus status = Disconnected
12:50:48.747 25183-25183/com.inuker.bluetooth V/miio-bluetooth: BluetoothReceiver onReceive: action.connect_status_changed
12:50:48.749 25183-25183/com.inuker.bluetooth V/miio-bluetooth: onConnectStatusChanged for 08:7C:BE:07:D2:23, status = 32
12:50:48.764 25183-25183/com.inuker.bluetooth V/miio-bluetooth: DeviceDetailActivity onConnectStatusChanged 32 in main
12:50:48.765 25183-25183/com.inuker.bluetooth V/miio-bluetooth: connect 08:7C:BE:07:D2:23
12:50:49.735 25183-26077/com.inuker.bluetooth V/miio-bluetooth: openGatt for 08:7C:BE:07:D2:23
12:50:49.736 25183-26077/com.inuker.bluetooth D/BluetoothGatt: connect() - device: 08:7C:BE:07:D2:23, auto: false
12:50:49.736 25183-26077/com.inuker.bluetooth D/BluetoothGatt: registerApp()
12:50:49.737 25183-26077/com.inuker.bluetooth D/BluetoothGatt: registerApp() - UUID=96b34614-408c-48a3-9426-c2c16cf65f16
12:50:49.744 25183-5740/com.inuker.bluetooth D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
12:50:50.002 25183-25197/com.inuker.bluetooth D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=5 device=08:7C:BE:07:D2:23
12:50:50.002 25183-26077/com.inuker.bluetooth V/miio-bluetooth: onConnectionStateChange for 08:7C:BE:07:D2:23: status = 133, newState = 0
12:50:50.002 25183-26077/com.inuker.bluetooth V/miio-bluetooth: closeGatt for 08:7C:BE:07:D2:23
12:50:50.002 25183-26077/com.inuker.bluetooth D/BluetoothGatt: close()
12:50:50.003 25183-26077/com.inuker.bluetooth D/BluetoothGatt: unregisterApp() - mClientIf=5
12:50:50.005 25183-26077/com.inuker.bluetooth V/miio-bluetooth: BleConnectRequest 08:7C:BE:07:D2:23 >>> retry connect later
12:50:50.005 25183-26077/com.inuker.bluetooth V/miio-bluetooth: setConnectStatus status = Disconnected
12:50:50.017 25183-25183/com.inuker.bluetooth V/miio-bluetooth: BluetoothReceiver onReceive: action.connect_status_changed
12:50:50.017 25183-25183/com.inuker.bluetooth V/miio-bluetooth: onConnectStatusChanged for 08:7C:BE:07:D2:23, status = 32
12:50:50.030 25183-25183/com.inuker.bluetooth V/miio-bluetooth: DeviceDetailActivity onConnectStatusChanged 32 in main
12:50:50.031 25183-25183/com.inuker.bluetooth V/miio-bluetooth: connect 08:7C:BE:07:D2:23
12:50:51.006 25183-26077/com.inuker.bluetooth V/miio-bluetooth: openGatt for 08:7C:BE:07:D2:23
12:50:51.007 25183-26077/com.inuker.bluetooth D/BluetoothGatt: connect() - device: 08:7C:BE:07:D2:23, auto: false
12:50:51.007 25183-26077/com.inuker.bluetooth D/BluetoothGatt: registerApp()
12:50:51.007 25183-26077/com.inuker.bluetooth D/BluetoothGatt: registerApp() - UUID=5bd5dbc5-b8c2-4fef-9697-734412d77fde
12:50:51.011 25183-25197/com.inuker.bluetooth D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
12:50:51.267 25183-5740/com.inuker.bluetooth D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=5 device=08:7C:BE:07:D2:23
12:50:51.271 25183-26077/com.inuker.bluetooth V/miio-bluetooth: onConnectionStateChange for 08:7C:BE:07:D2:23: status = 133, newState = 0
12:50:51.271 25183-26077/com.inuker.bluetooth V/miio-bluetooth: closeGatt for 08:7C:BE:07:D2:23
12:50:51.271 25183-26077/com.inuker.bluetooth D/BluetoothGatt: close()
12:50:51.271 25183-26077/com.inuker.bluetooth D/BluetoothGatt: unregisterApp() - mClientIf=5
12:50:51.272 25183-26077/com.inuker.bluetooth V/miio-bluetooth: BleConnectRequest 08:7C:BE:07:D2:23 >>> retry connect later
12:50:51.272 25183-26077/com.inuker.bluetooth V/miio-bluetooth: setConnectStatus status = Disconnected
12:50:51.282 25183-25183/com.inuker.bluetooth V/miio-bluetooth: BluetoothReceiver onReceive: action.connect_status_changed
12:50:51.282 25183-25183/com.inuker.bluetooth V/miio-bluetooth: onConnectStatusChanged for 08:7C:BE:07:D2:23, status = 32
12:50:51.297 25183-25183/com.inuker.bluetooth V/miio-bluetooth: DeviceDetailActivity onConnectStatusChanged 32 in main
12:50:51.298 25183-25183/com.inuker.bluetooth V/miio-bluetooth: connect 08:7C:BE:07:D2:23
12:50:52.274 25183-26077/com.inuker.bluetooth V/miio-bluetooth: openGatt for 08:7C:BE:07:D2:23
12:50:52.275 25183-26077/com.inuker.bluetooth D/BluetoothGatt: connect() - device: 08:7C:BE:07:D2:23, auto: false
12:50:52.275 25183-26077/com.inuker.bluetooth D/BluetoothGatt: registerApp()
12:50:52.275 25183-26077/com.inuker.bluetooth D/BluetoothGatt: registerApp() - UUID=2c22c7a6-22eb-4c1f-9bda-be8203bdad18
12:50:52.286 25183-25199/com.inuker.bluetooth D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
12:50:52.536 25183-5740/com.inuker.bluetooth D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=5 device=08:7C:BE:07:D2:23
12:50:52.544 25183-26077/com.inuker.bluetooth V/miio-bluetooth: onConnectionStateChange for 08:7C:BE:07:D2:23: status = 133, newState = 0
12:50:52.544 25183-26077/com.inuker.bluetooth V/miio-bluetooth: closeGatt for 08:7C:BE:07:D2:23
12:50:52.545 25183-26077/com.inuker.bluetooth D/BluetoothGatt: close()
12:50:52.545 25183-26077/com.inuker.bluetooth D/BluetoothGatt: unregisterApp() - mClientIf=5
12:50:52.547 25183-26077/com.inuker.bluetooth V/miio-bluetooth: BleConnectRequest 08:7C:BE:07:D2:23 >>> request complete: code = -1
12:50:52.548 25183-26077/com.inuker.bluetooth V/miio-bluetooth: setConnectStatus status = Disconnected
12:50:52.558 25183-26077/com.inuker.bluetooth W/miio-bluetooth: Process BleConnectRequest, status = Disconnected
12:50:52.560 25183-26077/com.inuker.bluetooth V/miio-bluetooth: openGatt for 08:7C:BE:07:D2:23
12:50:52.561 25183-26077/com.inuker.bluetooth D/BluetoothGatt: connect() - device: 08:7C:BE:07:D2:23, auto: false
12:50:52.561 25183-26077/com.inuker.bluetooth D/BluetoothGatt: registerApp()
12:50:52.561 25183-26077/com.inuker.bluetooth D/BluetoothGatt: registerApp() - UUID=8624220e-5442-4e03-a280-1f5a2c63439c
12:50:52.565 25183-25183/com.inuker.bluetooth V/miio-bluetooth: profile:
null
12:50:52.566 25183-25183/com.inuker.bluetooth V/miio-bluetooth: BluetoothReceiver onReceive: action.connect_status_changed
12:50:52.566 25183-25183/com.inuker.bluetooth V/miio-bluetooth: onConnectStatusChanged for 08:7C:BE:07:D2:23, status = 32
12:50:52.568 25183-5740/com.inuker.bluetooth D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
12:50:52.586 25183-25183/com.inuker.bluetooth V/miio-bluetooth: DeviceDetailActivity onConnectStatusChanged 32 in main
12:50:52.587 25183-25183/com.inuker.bluetooth V/miio-bluetooth: connect 08:7C:BE:07:D2:23
12:50:52.827 25183-25197/com.inuker.bluetooth D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=5 device=08:7C:BE:07:D2:23
12:50:52.828 25183-26077/com.inuker.bluetooth V/miio-bluetooth: onConnectionStateChange for 08:7C:BE:07:D2:23: status = 133, newState = 0
12:50:52.828 25183-26077/com.inuker.bluetooth V/miio-bluetooth: closeGatt for 08:7C:BE:07:D2:23
12:50:52.828 25183-26077/com.inuker.bluetooth D/BluetoothGatt: close()
12:50:52.828 25183-26077/com.inuker.bluetooth D/BluetoothGatt: unregisterApp() - mClientIf=5
12:50:52.829 25183-26077/com.inuker.bluetooth V/miio-bluetooth: BleConnectRequest 08:7C:BE:07:D2:23 >>> retry connect later
12:50:52.829 25183-26077/com.inuker.bluetooth V/miio-bluetooth: setConnectStatus status = Disconnected
12:50:52.831 25183-25183/com.inuker.bluetooth V/miio-bluetooth: BluetoothReceiver onReceive: action.connect_status_changed
12:50:52.832 25183-25183/com.inuker.bluetooth V/miio-bluetooth: onConnectStatusChanged for 08:7C:BE:07:D2:23, status = 32
12:50:52.848 25183-25183/com.inuker.bluetooth V/miio-bluetooth: DeviceDetailActivity onConnectStatusChanged 32 in main
12:50:52.851 25183-25183/com.inuker.bluetooth V/miio-bluetooth: connect 08:7C:BE:07:D2:23
12:50:53.830 25183-26077/com.inuker.bluetooth V/miio-bluetooth: openGatt for 08:7C:BE:07:D2:23
12:50:53.831 25183-26077/com.inuker.bluetooth D/BluetoothGatt: connect() - device: 08:7C:BE:07:D2:23, auto: false
12:50:53.831 25183-26077/com.inuker.bluetooth D/BluetoothGatt: registerApp()
12:50:53.832 25183-26077/com.inuker.bluetooth D/BluetoothGatt: registerApp() - UUID=a314f56f-3741-43b5-b0c0-d44096480a67
12:50:53.840 25183-5740/com.inuker.bluetooth D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
12:50:54.195 25183-8677/com.inuker.bluetooth D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=5 device=08:7C:BE:07:D2:23
12:50:54.195 25183-26077/com.inuker.bluetooth V/miio-bluetooth: onConnectionStateChange for 08:7C:BE:07:D2:23: status = 133, newState = 0
12:50:54.196 25183-26077/com.inuker.bluetooth V/miio-bluetooth: closeGatt for 08:7C:BE:07:D2:23
12:50:54.196 25183-26077/com.inuker.bluetooth D/BluetoothGatt: close()
12:50:54.196 25183-26077/com.inuker.bluetooth D/BluetoothGatt: unregisterApp() - mClientIf=5
12:50:54.198 25183-26077/com.inuker.bluetooth V/miio-bluetooth: BleConnectRequest 08:7C:BE:07:D2:23 >>> retry connect later
12:50:54.198 25183-26077/com.inuker.bluetooth V/miio-bluetooth: setConnectStatus status = Disconnected
12:50:54.215 25183-25183/com.inuker.bluetooth V/miio-bluetooth: BluetoothReceiver onReceive: action.connect_status_changed
12:50:54.216 25183-25183/com.inuker.bluetooth V/miio-bluetooth: onConnectStatusChanged for 08:7C:BE:07:D2:23, status = 32
12:50:54.232 25183-25183/com.inuker.bluetooth V/miio-bluetooth: DeviceDetailActivity onConnectStatusChanged 32 in main
12:50:54.233 25183-25183/com.inuker.bluetooth V/miio-bluetooth: connect 08:7C:BE:07:D2:23
12:50:55.199 25183-26077/com.inuker.bluetooth V/miio-bluetooth: openGatt for 08:7C:BE:07:D2:23
12:50:55.200 25183-26077/com.inuker.bluetooth D/BluetoothGatt: connect() - device: 08:7C:BE:07:D2:23, auto: false
12:50:55.200 25183-26077/com.inuker.bluetooth D/BluetoothGatt: registerApp()
12:50:55.200 25183-26077/com.inuker.bluetooth D/BluetoothGatt: registerApp() - UUID=88a33d91-f8e8-441a-a851-60e2559edea0
12:50:55.204 25183-8677/com.inuker.bluetooth D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
12:50:55.752 25183-5740/com.inuker.bluetooth D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=5 device=08:7C:BE:07:D2:23
12:50:55.752 25183-26077/com.inuker.bluetooth V/miio-bluetooth: onConnectionStateChange for 08:7C:BE:07:D2:23: status = 0, newState = 2
12:50:55.752 25183-26077/com.inuker.bluetooth V/miio-bluetooth: setConnectStatus status = Connected
12:50:56.053 25183-26077/com.inuker.bluetooth V/miio-bluetooth: processDiscoverService, status = Connected
12:50:56.053 25183-26077/com.inuker.bluetooth V/miio-bluetooth: discoverService for 08:7C:BE:07:D2:23
12:50:56.053 25183-26077/com.inuker.bluetooth D/BluetoothGatt: discoverServices() - device: 08:7C:BE:07:D2:23
12:50:56.056 25183-25199/com.inuker.bluetooth D/BluetoothGatt: onSearchComplete() = Device=08:7C:BE:07:D2:23 Status=0
12:50:56.056 25183-26077/com.inuker.bluetooth V/miio-bluetooth: onServicesDiscovered for 08:7C:BE:07:D2:23: status = 0
12:50:56.056 25183-26077/com.inuker.bluetooth V/miio-bluetooth: setConnectStatus status = Service Ready
12:50:56.057 25183-26077/com.inuker.bluetooth V/miio-bluetooth: refreshServiceProfile for 08:7C:BE:07:D2:23
12:50:56.057 25183-26077/com.inuker.bluetooth V/miio-bluetooth: Service: 00001800-0000-1000-8000-00805f9b34fb
12:50:56.057 25183-26077/com.inuker.bluetooth V/miio-bluetooth: character: uuid = 00002a00-0000-1000-8000-00805f9b34fb
12:50:56.057 25183-26077/com.inuker.bluetooth V/miio-bluetooth: character: uuid = 00002a01-0000-1000-8000-00805f9b34fb
12:50:56.057 25183-26077/com.inuker.bluetooth V/miio-bluetooth: character: uuid = 00002a02-0000-1000-8000-00805f9b34fb
12:50:56.057 25183-26077/com.inuker.bluetooth V/miio-bluetooth: character: uuid = 00002a04-0000-1000-8000-00805f9b34fb
12:50:56.057 25183-26077/com.inuker.bluetooth V/miio-bluetooth: character: uuid = 00002a03-0000-1000-8000-00805f9b34fb
12:50:56.057 25183-26077/com.inuker.bluetooth V/miio-bluetooth: Service: 00001801-0000-1000-8000-00805f9b34fb
12:50:56.058 25183-26077/com.inuker.bluetooth V/miio-bluetooth: character: uuid = 00002a05-0000-1000-8000-00805f9b34fb
12:50:56.058 25183-26077/com.inuker.bluetooth V/miio-bluetooth: Service: 0000fee8-0000-1000-8000-00805f9b34fb
12:50:56.058 25183-26077/com.inuker.bluetooth V/miio-bluetooth: character: uuid = 003784cf-f7e3-55b4-6c4c-9fd140100a16
12:50:56.058 25183-26077/com.inuker.bluetooth V/miio-bluetooth: character: uuid = 013784cf-f7e3-55b4-6c4c-9fd140100a16
12:50:56.058 25183-26077/com.inuker.bluetooth V/miio-bluetooth: Service: 0000fee9-0000-1000-8000-00805f9b34fb
12:50:56.058 25183-26077/com.inuker.bluetooth V/miio-bluetooth: character: uuid = d44bc439-abfd-45a2-b575-925416129600
12:50:56.058 25183-26077/com.inuker.bluetooth V/miio-bluetooth: character: uuid = d44bc439-abfd-45a2-b575-925416129601
12:50:56.058 25183-26077/com.inuker.bluetooth V/miio-bluetooth: BleConnectRequest 08:7C:BE:07:D2:23 >>> request complete: code = 0
12:50:56.064 25183-25183/com.inuker.bluetooth V/miio-bluetooth: BluetoothReceiver onReceive: action.connect_status_changed
12:50:56.064 25183-25183/com.inuker.bluetooth V/miio-bluetooth: onConnectStatusChanged for 08:7C:BE:07:D2:23, status = 16
12:50:56.068 25183-26077/com.inuker.bluetooth W/miio-bluetooth: Process BleConnectRequest, status = Service Ready
12:50:56.070 25183-26077/com.inuker.bluetooth V/miio-bluetooth: BleConnectRequest 08:7C:BE:07:D2:23 >>> request complete: code = 0
12:50:56.080 25183-26077/com.inuker.bluetooth W/miio-bluetooth: Process BleConnectRequest, status = Service Ready
12:50:56.080 25183-25183/com.inuker.bluetooth V/miio-bluetooth: DeviceDetailActivity onConnectStatusChanged 16 in main
12:50:56.081 25183-26077/com.inuker.bluetooth V/miio-bluetooth: BleConnectRequest 08:7C:BE:07:D2:23 >>> request complete: code = 0
12:50:56.081 25183-25183/com.inuker.bluetooth V/miio-bluetooth: profile:
Service: 00001800-0000-1000-8000-00805f9b34fb
>>> Character: BleGattCharacter{uuid=00002a02-0000-1000-8000-00805f9b34fb, property=10, permissions=0, descriptors=null}
>>> Character: BleGattCharacter{uuid=00002a01-0000-1000-8000-00805f9b34fb, property=2, permissions=0, descriptors=null}
>>> Character: BleGattCharacter{uuid=00002a03-0000-1000-8000-00805f9b34fb, property=14, permissions=0, descriptors=null}
>>> Character: BleGattCharacter{uuid=00002a04-0000-1000-8000-00805f9b34fb, property=2, permissions=0, descriptors=null}
>>> Character: BleGattCharacter{uuid=00002a00-0000-1000-8000-00805f9b34fb, property=10, permissions=0, descriptors=null}
Service: 00001801-0000-1000-8000-00805f9b34fb
>>> Character: BleGattCharacter{uuid=00002a05-0000-1000-8000-00805f9b34fb, property=34, permissions=0, descriptors=[BleGattDescriptor{mUuid=00002902-0000-1000-8000-00805f9b34fb, mPermissions=0, mValue=null}]}
Service: 0000fee8-0000-1000-8000-00805f9b34fb
>>> Character: BleGattCharacter{uuid=013784cf-f7e3-55b4-6c4c-9fd140100a16, property=4, permissions=0, descriptors=null}
>>> Character: BleGattCharacter{uuid=003784cf-f7e3-55b4-6c4c-9fd140100a16, property=16, permissions=0, descriptors=[BleGattDescriptor{mUuid=00002902-0000-1000-8000-00805f9b34fb, mPermissions=0, mValue=null}, BleGattDescriptor{mUuid=00002901-0000-1000-8000-00805f9b34fb, mPermissions=0, mValue=null}]}
Service: 0000fee9-0000-1000-8000-00805f9b34fb
>>> Character: BleGattCharacter{uuid=d44bc439-abfd-45a2-b575-925416129600, property=12, permissions=0, descriptors=[BleGattDescriptor{mUuid=00002901-0000-1000-8000-00805f9b34fb, mPermissions=0, mValue=null}]}
>>> Character: BleGattCharacter{uuid=d44bc439-abfd-45a2-b575-925416129601, property=16, permissions=0, descriptors=[BleGattDescriptor{mUuid=00002902-0000-1000-8000-00805f9b34fb, mPermissions=0, mValue=null}]}

基于Beacon的通信

1.发现刚连接一秒后就自动断开了,而客户端发送数据显示发送成功了
2.需求:连接后发送数据等待回复json,是不是write和read方法同时调用就可以了

蓝牙设备配对的问题

#大神,是这么一回事,就是我想在app和蓝牙设备配对成功以后,发送一些指令,我监听了连接蓝牙连接的状态变化,但是在app与蓝牙设备请求配对的时候,我还没点系统的蓝牙配对请求确认,蓝牙监听的状态是true, 但是这个时候设备还没有匹配上,发送的指令蓝牙设备接收不到。请问,我该如何去做这块的功能?

write接口速度问题

12-07 11:45:19.044 15540-15540/com.taoxiaoqi D/bleSpeed: call write.. 00 00 00
12-07 11:45:19.224 15540-15540/com.taoxiaoqi D/bleSpeed: write.. onResponse 0
12-07 11:45:19.374 15540-15540/com.taoxiaoqi D/bleSpeed: call write.. 00 30 10 4F 66 A5 59 02 B0 3E DB 18 DC 8C CA 42 C1 59 4E 37
12-07 11:45:19.564 15540-15540/com.taoxiaoqi D/bleSpeed: write.. onResponse 0
12-07 11:45:19.564 15540-15540/com.taoxiaoqi D/bleSpeed: call write.. 01 37 65 06 3E 21 58 4F 06 4E EC 05 8B A8 82 D5 70 6D 8A A0
12-07 11:45:19.764 15540-15540/com.taoxiaoqi D/bleSpeed: write.. onResponse 0
12-07 11:45:19.764 15540-15540/com.taoxiaoqi D/bleSpeed: call write.. 02 1D DD 4F 7A 92 75 B0 2D B4 7C 71 78
12-07 11:45:19.954 15540-15540/com.taoxiaoqi D/bleSpeed: write.. onResponse 0

请教个问题,最近在测试性能的时候,发现写character的时候,从写入到接到response大概都要将近200ms的时间。没有其他ble的调试经验,IOS项目基本上60ms一个包就能搞定了,我们这个速度是不是有点慢?

Ble蓝牙读写数据

Ble蓝牙在写入数据后,在读取的接口中没有获取到数据,但是在通知的接口中获取到了数据,请问是怎么怎么回事呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.