feat: disconnect

This commit is contained in:
玖叁 2024-12-27 15:13:46 +08:00
parent 756d611c31
commit c86ef81c4a
1 changed files with 2 additions and 1 deletions

View File

@ -143,12 +143,13 @@ class BluetoothRepositoryImpl(
status: Int,
newState: Int
) {
Log.d("onConnectionStateChange", "status: $status, newState: $newState")
if (status != BluetoothGatt.GATT_SUCCESS) {
scope.launch(Dispatchers.Main) {
Toast.makeText(context, "连接失败,错误码: $status", Toast.LENGTH_SHORT)
.show()
}
return
}
when (newState) {
BluetoothProfile.STATE_CONNECTED -> {