Skip to content

Commit

Permalink
Use writes without response for mDL presentment (#23)
Browse files Browse the repository at this point in the history
Also update the demo mDL as the previous one expired.

Close #16
  • Loading branch information
sbihel authored Sep 4, 2024
1 parent 0631c88 commit 70e9589
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions MobileSdk/src/main/java/com/spruceid/mobile/sdk/GattClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class GattClient(private var callback: GattClientCallback,
// Finally we've set everything up, we can write 0x01 to state to signal
// to the other end (mDL reader) that it can start sending data to us..
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
val res = gatt.writeCharacteristic(characteristicState!!, byteArrayOf(0x01.toByte()), BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT)
val res = gatt.writeCharacteristic(characteristicState!!, byteArrayOf(0x01.toByte()), BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE)
if(res != BluetoothStatusCodes.SUCCESS) {
callback.onError(Error("Error writing to Server2Client. Code: $res"))
return
Expand Down Expand Up @@ -451,7 +451,7 @@ class GattClient(private var callback: GattClientCallback,

try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
val res = gattClient!!.writeCharacteristic(characteristicClient2Server!!, chunk, BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT)
val res = gattClient!!.writeCharacteristic(characteristicClient2Server!!, chunk, BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE)
if(res != BluetoothStatusCodes.SUCCESS) {
callback.onError(Error("Error writing to Server2Client. Code: $res"))
return
Expand Down Expand Up @@ -545,7 +545,7 @@ class GattClient(private var callback: GattClientCallback,
val terminationCode = byteArrayOf(0x02.toByte())
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
val res = gattClient!!.writeCharacteristic(characteristicState!!, terminationCode, BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT)
val res = gattClient!!.writeCharacteristic(characteristicState!!, terminationCode, BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE)
if(res != BluetoothStatusCodes.SUCCESS) {
callback.onError(Error("Error writing to state characteristic. Code: $res"))
return
Expand Down

Large diffs are not rendered by default.

0 comments on commit 70e9589

Please sign in to comment.