summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Phil Burk <philburk@google.com> 2015-10-13 18:58:26 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2015-10-13 18:58:26 +0000
commit246b66cbcb3f88fb40b02b8c52a1020eac72ee91 (patch)
tree2491166de0b7f2e8470e6233fff5b19fafb47033
parent61cf82778f7e3f7454778e5ef7c691857dac16e9 (diff)
parent1bc47a6e7020799ae7eb5ee3e91bc452144a3d64 (diff)
am 1bc47a6e: am bfaa71bb: am 8e82755d: Merge "BluetoothMidiDevice: change write type to support JamStik" into mnc-dr-dev
* commit '1bc47a6e7020799ae7eb5ee3e91bc452144a3d64': BluetoothMidiDevice: change write type to support JamStik
-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 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