summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorPhil Burk <philburk@google.com>2015-10-13 18:43:35 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-10-13 18:43:35 +0000
commitbfaa71bb316552236c78de87a96f0ee722133e78 (patch)
treeb29517542937c650601d82b1a7fd6f85f978d80e /media
parent7bbb6fedbcce05cd712b464cecbdbd80e28a6b4e (diff)
parent8e82755dfdfee837cb73d3db3f6319301d2a5903 (diff)
downloadframeworks_base-bfaa71bb316552236c78de87a96f0ee722133e78.zip
frameworks_base-bfaa71bb316552236c78de87a96f0ee722133e78.tar.gz
frameworks_base-bfaa71bb316552236c78de87a96f0ee722133e78.tar.bz2
am 8e82755d: Merge "BluetoothMidiDevice: change write type to support JamStik" into mnc-dr-dev
* commit '8e82755dfdfee837cb73d3db3f6319301d2a5903': BluetoothMidiDevice: change write type to support JamStik
Diffstat (limited to 'media')
-rw-r--r--media/packages/BluetoothMidiService/src/com/android/bluetoothmidiservice/BluetoothMidiDevice.java10
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 e6d59e4..444705c 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