Open MrLingGuiQin opened 6 years ago
同问。 蓝牙关闭重新打开,在蓝牙状态监听方法中添加【开启则1秒钟后设备重连】,出现连接失败;如果只断开设备,重连则连接成功,请问是什么原因,如何解决呢? 02-12 18:59:04.029 15776-15776/com.example.app V/miio-bluetooth: BluetoothReceiver onReceive: android.bluetooth.adapter.action.STATE_CHANGED 02-12 18:59:04.035 15776-15776/com.example.app V/miio-bluetooth: state changed: state_on -> state_turning_off 02-12 18:59:04.038 15776-15794/com.example.app V/miio-bluetooth: safeCallBluetoothApi code = 12 02-12 18:59:04.044 15776-15794/com.example.app V/miio-bluetooth: IBluetoothService = com.inuker.bluetooth.library.BluetoothServiceImpl@5ac3b67 02-12 18:59:04.121 15776-15947/com.example.app V/miio-bluetooth: onConnectionStateChange for 30:AE:A4:80:63:72: status = 0, newState = 0 02-12 18:59:04.123 15776-15776/com.example.app V/miio-bluetooth: BluetoothReceiver onReceive: android.bluetooth.adapter.action.STATE_CHANGED 02-12 18:59:04.125 15776-15776/com.example.app V/miio-bluetooth: state changed: state_turning_off -> state_off 02-12 18:59:04.127 15776-15947/com.example.app V/miio-bluetooth: closeGatt for 30:AE:A4:80:63:72 02-12 18:59:04.129 15776-15947/com.example.app V/miio-bluetooth: setConnectStatus status = Disconnected 02-12 18:59:04.130 15776-15794/com.example.app V/miio-bluetooth: safeCallBluetoothApi code = 12 02-12 18:59:04.133 15776-15794/com.example.app V/miio-bluetooth: IBluetoothService = com.inuker.bluetooth.library.BluetoothServiceImpl@5ac3b67 02-12 18:59:04.405 15776-15776/com.example.app V/miio-bluetooth: BluetoothReceiver onReceive: action.connect_status_changed 02-12 18:59:04.407 15776-15776/com.example.app V/miio-bluetooth: onConnectStatusChanged for 30:AE:A4:80:63:72, status = 32 02-12 18:59:08.317 15776-15776/com.example.app V/miio-bluetooth: BluetoothReceiver onReceive: android.bluetooth.adapter.action.STATE_CHANGED 02-12 18:59:08.319 15776-15776/com.example.app V/miio-bluetooth: state changed: state_off -> state_turning_on 02-12 18:59:08.483 15776-15776/com.example.app V/miio-bluetooth: BluetoothReceiver onReceive: android.bluetooth.adapter.action.STATE_CHANGED 02-12 18:59:08.485 15776-15776/com.example.app V/miio-bluetooth: state changed: state_turning_on -> state_on 02-12 18:59:09.491 15776-15795/com.example.app V/miio-bluetooth: connect 30:AE:A4:80:63:72 02-12 18:59:09.500 15776-15794/com.example.app V/miio-bluetooth: safeCallBluetoothApi code = 1 02-12 18:59:09.502 15776-15794/com.example.app V/miio-bluetooth: IBluetoothService = com.inuker.bluetooth.library.BluetoothServiceImpl@5ac3b67 02-12 18:59:09.519 15776-15947/com.example.app W/miio-bluetooth: Process BleConnectRequest, status = Disconnected 02-12 18:59:09.523 15776-15947/com.example.app V/miio-bluetooth: openGatt for 30:AE:A4:80:63:72 02-12 18:59:11.540 15776-15947/com.example.app V/miio-bluetooth: BleConnectRequest 30:AE:A4:80:63:72 >>> connect timeout 02-12 18:59:11.543 15776-15947/com.example.app V/miio-bluetooth: BleConnectRequest 30:AE:A4:80:63:72 >>> close gatt 02-12 18:59:11.545 15776-15947/com.example.app V/miio-bluetooth: closeGatt for 30:AE:A4:80:63:72 02-12 18:59:11.552 15776-15947/com.example.app V/miio-bluetooth: BleConnectRequest 30:AE:A4:80:63:72 >>> retry connect later 02-12 18:59:11.554 15776-15947/com.example.app V/miio-bluetooth: setConnectStatus status = Disconnected 02-12 18:59:11.567 15776-15776/com.example.app V/miio-bluetooth: BluetoothReceiver onReceive: action.connect_status_changed 02-12 18:59:11.574 15776-15776/com.example.app V/miio-bluetooth: onConnectStatusChanged for 30:AE:A4:80:63:72, status = 32 02-12 18:59:12.560 15776-15947/com.example.app V/miio-bluetooth: openGatt for 30:AE:A4:80:63:72 02-12 18:59:14.592 15776-15947/com.example.app V/miio-bluetooth: BleConnectRequest 30:AE:A4:80:63:72 >>> connect timeout 02-12 18:59:14.605 15776-15947/com.example.app V/miio-bluetooth: BleConnectRequest 30:AE:A4:80:63:72 >>> close gatt 02-12 18:59:14.610 15776-15947/com.example.app V/miio-bluetooth: closeGatt for 30:AE:A4:80:63:72 02-12 18:59:14.620 15776-15947/com.example.app V/miio-bluetooth: BleConnectRequest 30:AE:A4:80:63:72 >>> retry connect later 02-12 18:59:14.622 15776-15947/com.example.app V/miio-bluetooth: setConnectStatus status = Disconnected 02-12 18:59:14.631 15776-15776/com.example.app V/miio-bluetooth: BluetoothReceiver onReceive: action.connect_status_changed 02-12 18:59:14.634 15776-15776/com.example.app V/miio-bluetooth: onConnectStatusChanged for 30:AE:A4:80:63:72, status = 32 02-12 18:59:15.628 15776-15947/com.example.app V/miio-bluetooth: openGatt for 30:AE:A4:80:63:72 02-12 18:59:17.656 15776-15947/com.example.app V/miio-bluetooth: BleConnectRequest 30:AE:A4:80:63:72 >>> connect timeout 02-12 18:59:17.658 15776-15947/com.example.app V/miio-bluetooth: BleConnectRequest 30:AE:A4:80:63:72 >>> close gatt 02-12 18:59:17.659 15776-15947/com.example.app V/miio-bluetooth: closeGatt for 30:AE:A4:80:63:72 02-12 18:59:17.665 15776-15947/com.example.app V/miio-bluetooth: BleConnectRequest 30:AE:A4:80:63:72 >>> retry connect later 02-12 18:59:17.667 15776-15947/com.example.app V/miio-bluetooth: setConnectStatus status = Disconnected 02-12 18:59:17.672 15776-15776/com.example.app V/miio-bluetooth: BluetoothReceiver onReceive: action.connect_status_changed 02-12 18:59:17.674 15776-15776/com.example.app V/miio-bluetooth: onConnectStatusChanged for 30:AE:A4:80:63:72, status = 32 02-12 18:59:18.669 15776-15947/com.example.app V/miio-bluetooth: openGatt for 30:AE:A4:80:63:72 02-12 18:59:20.680 15776-15947/com.example.app V/miio-bluetooth: BleConnectRequest 30:AE:A4:80:63:72 >>> connect timeout 02-12 18:59:20.683 15776-15947/com.example.app V/miio-bluetooth: BleConnectRequest 30:AE:A4:80:63:72 >>> close gatt 02-12 18:59:20.685 15776-15947/com.example.app V/miio-bluetooth: closeGatt for 30:AE:A4:80:63:72 02-12 18:59:20.693 15776-15947/com.example.app V/miio-bluetooth: BleConnectRequest 30:AE:A4:80:63:72 >>> request complete: code = -1 02-12 18:59:20.694 15776-15947/com.example.app V/miio-bluetooth: setConnectStatus status = Disconnected 02-12 18:59:20.701 15776-15776/com.example.app V/miio-bluetooth: BluetoothReceiver onReceive: action.connect_status_changed 02-12 18:59:20.703 15776-15776/com.example.app V/miio-bluetooth: onConnectStatusChanged for 30:AE:A4:80:63:72, status = 32
V/miio-bluetooth: connect 64:CF:D9:0F:29:20 W/miio-bluetooth: Process BleConnectRequest, status = Disconnected V/miio-bluetooth: openGatt for 64:CF:D9:0F:29:20 D/BluetoothGatt: connect() - device: 64:CF:D9:0F:29:20, auto: false D/BluetoothGatt: registerApp() D/BluetoothGatt: registerApp() - UUID=a15819a5-211f-4293-b2d6-4b500f70270e D/BluetoothGatt: onClientRegistered() - status=0 clientIf=8 V/miio-bluetooth: BleConnectRequest 64:CF:D9:0F:29:20 >>> connect timeout V/miio-bluetooth: BleConnectRequest 64:CF:D9:0F:29:20 >>> close gatt V/miio-bluetooth: closeGatt for 64:CF:D9:0F:29:20 D/BluetoothGatt: close() D/BluetoothGatt: unregisterApp() - mClientIf=8 V/miio-bluetooth: BleConnectRequest 64:CF:D9:0F:29:20 >>> retry connect later V/miio-bluetooth: setConnectStatus status = Disconnected V/miio-bluetooth: BluetoothReceiver onReceive: action.connect_status_changed V/miio-bluetooth: onConnectStatusChanged for 64:CF:D9:0F:29:20, status = 32