Skip to content

Commit

Permalink
Limit write value length to a max of 512
Browse files Browse the repository at this point in the history
  • Loading branch information
weliem committed Dec 19, 2023
1 parent 9dbc85d commit 0d910b6
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import android.os.Looper
import android.os.SystemClock
import java.util.*
import java.util.concurrent.ConcurrentLinkedQueue
import kotlin.math.min

/**
* Represents a remote Bluetooth peripheral and replaces BluetoothDevice and BluetoothGatt
Expand Down Expand Up @@ -784,7 +785,7 @@ class BluetoothPeripheral internal constructor(
return when (writeType) {
WriteType.WITH_RESPONSE -> 512
WriteType.SIGNED -> currentMtu - 15
else -> currentMtu - 3
else -> min(currentMtu - 3, 512)
}
}

Expand Down

0 comments on commit 0d910b6

Please sign in to comment.