我尝试使用蓝牙GATT服务连接目标设备, 我在控制台中收到此消息,无法连接。
我尝试使用此连接
bluetoothGatt = mDiscoverderDevice.connectGatt(this, true, mGattCallback);
D/BluetoothGatt: connect() - device: 5D:BB:1E:F0:09:05, auto: true
D/BluetoothGatt: registerApp()
D/BluetoothGatt: registerApp() - UUID=b6173656-60d1-494d-bac2-dc1f1a12f294
D/BluetoothGatt: onClientRegistered() - status=0 clientIf=6
D/ALERT **** :: connectwithGATTServiceandroid.bluetooth.BluetoothGatt@20128b49
D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=6 device=5D:BB:1E:F0:09:05
W/BluetoothGatt: Unhandled exception in callback
W/BluetoothGatt: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
W/BluetoothGatt: at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6462)
W/BluetoothGatt: at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:897)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.widget.RelativeLayout.requestLayout(RelativeLayout.java:360)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.widget.TextView.checkForRelayout(TextView.java:6880)
W/BluetoothGatt: at android.widget.TextView.setText(TextView.java:4063)
W/BluetoothGatt: at android.widget.TextView.setText(TextView.java:3921)
W/BluetoothGatt: at android.widget.TextView.setText(TextView.java:3896)
W/BluetoothGatt: at tel.android.com.rseremote.MainActivity.setStatus(MainActivity.java:293)
W/BluetoothGatt: at tel.android.com.rseremote.MainActivity.access$500(MainActivity.java:37)
W/BluetoothGatt: at tel.android.com.rseremote.MainActivity$5.onConnectionStateChange(MainActivity.java:381)
W/BluetoothGatt: at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:181)
W/BluetoothGatt: at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:70)
W/BluetoothGatt: at android.os.Binder.execTransact(Binder.java:446)