diff options
author | Phil Burk <philburk@google.com> | 2015-09-22 22:11:53 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-09-22 22:11:53 +0000 |
commit | f7781b913b6f8cd25758360e9f3ec99970f98c7f (patch) | |
tree | 278fa1018eaa0a37340f700e5096467ddbba1ed9 /media/packages | |
parent | 622b2b7ce28d73bc6084d2f6e67de986be84b93e (diff) | |
parent | 95129f50c68c734c5ebdf32ff6b8b9c63cc1ada7 (diff) |
Merge "BluetoothMidiDevice: change write type to support JamStik"
Diffstat (limited to 'media/packages')
-rw-r--r-- | media/packages/BluetoothMidiService/src/com/android/bluetoothmidiservice/BluetoothMidiDevice.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/media/packages/BluetoothMidiService/src/com/android/bluetoothmidiservice/BluetoothMidiDevice.java b/media/packages/BluetoothMidiService/src/com/android/bluetoothmidiservice/BluetoothMidiDevice.java index e6d59e4fb141..444705cfc79f 100644 --- a/media/packages/BluetoothMidiService/src/com/android/bluetoothmidiservice/BluetoothMidiDevice.java +++ b/media/packages/BluetoothMidiService/src/com/android/bluetoothmidiservice/BluetoothMidiDevice.java @@ -147,14 +147,22 @@ public final class BluetoothMidiDevice { // switch to receiving notifications after initial characteristic read mBluetoothGatt.setCharacteristicNotification(characteristic, true); + // Use writeType that requests acknowledgement. + // This improves compatibility with various BLE-MIDI devices. + int originalWriteType = characteristic.getWriteType(); + characteristic.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT); + BluetoothGattDescriptor descriptor = characteristic.getDescriptor( CLIENT_CHARACTERISTIC_CONFIG); if (descriptor != null) { descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); - mBluetoothGatt.writeDescriptor(descriptor); + boolean result = mBluetoothGatt.writeDescriptor(descriptor); + Log.d(TAG, "writeDescriptor returned " + result); } else { Log.e(TAG, "No CLIENT_CHARACTERISTIC_CONFIG for device " + mBluetoothDevice); } + + characteristic.setWriteType(originalWriteType); } @Override |