summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorPhil Burk <philburk@google.com>2015-09-22 12:07:31 -0700
committerSteve Kondik <shade@chemlab.org>2015-11-10 11:01:20 -0800
commitce048eb02050104a3d5d0131eef8a50888698337 (patch)
treeaadc1eea71324adb3ef8e2cbdfb17010d364335d /media
parent3ae97c857e76a46d3d5342eb76a4999d569040a9 (diff)
downloadframeworks_base-ce048eb02050104a3d5d0131eef8a50888698337.zip
frameworks_base-ce048eb02050104a3d5d0131eef8a50888698337.tar.gz
frameworks_base-ce048eb02050104a3d5d0131eef8a50888698337.tar.bz2
BluetoothMidiDevice: change write type to support JamStik
Temporarily use a Request instead of a Command so that the JamStik will be properly enabled. Bug: 24207964 Change-Id: I3d11732958c46e6039405b5969d5af0db8032fb9 Signed-off-by: Phil Burk <philburk@google.com> (cherry picked from commit 95129f50c68c734c5ebdf32ff6b8b9c63cc1ada7)
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