Loading media/packages/BluetoothMidiService/src/com/android/bluetoothmidiservice/BluetoothMidiDevice.java +19 −15 Original line number Diff line number Diff line Loading @@ -92,7 +92,6 @@ public final class BluetoothMidiDevice { mBluetoothGatt.discoverServices()); } else if (newState == BluetoothProfile.STATE_DISCONNECTED) { Log.i(TAG, "Disconnected from GATT server."); // FIXME synchronize? close(); } } Loading Loading @@ -121,8 +120,8 @@ public final class BluetoothMidiDevice { } } } else { Log.w(TAG, "onServicesDiscovered received: " + status); // FIXME - report error back to client? Log.e(TAG, "onServicesDiscovered received: " + status); close(); } } Loading @@ -137,9 +136,12 @@ public final class BluetoothMidiDevice { BluetoothGattDescriptor descriptor = characteristic.getDescriptor( CLIENT_CHARACTERISTIC_CONFIG); // FIXME null check if (descriptor != null) { descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); mBluetoothGatt.writeDescriptor(descriptor); } else { Log.e(TAG, "No CLIENT_CHARACTERISTIC_CONFIG for device " + mBluetoothDevice); } } @Override Loading Loading @@ -244,7 +246,8 @@ public final class BluetoothMidiDevice { }.start(); } void close() { private void close() { synchronized (mBluetoothDevice) { mEventScheduler.close(); if (mDeviceServer != null) { IoUtils.closeQuietly(mDeviceServer); Loading @@ -256,6 +259,7 @@ public final class BluetoothMidiDevice { mBluetoothGatt = null; } } } public IBinder getBinder() { return mDeviceServer.asBinder(); Loading Loading
media/packages/BluetoothMidiService/src/com/android/bluetoothmidiservice/BluetoothMidiDevice.java +19 −15 Original line number Diff line number Diff line Loading @@ -92,7 +92,6 @@ public final class BluetoothMidiDevice { mBluetoothGatt.discoverServices()); } else if (newState == BluetoothProfile.STATE_DISCONNECTED) { Log.i(TAG, "Disconnected from GATT server."); // FIXME synchronize? close(); } } Loading Loading @@ -121,8 +120,8 @@ public final class BluetoothMidiDevice { } } } else { Log.w(TAG, "onServicesDiscovered received: " + status); // FIXME - report error back to client? Log.e(TAG, "onServicesDiscovered received: " + status); close(); } } Loading @@ -137,9 +136,12 @@ public final class BluetoothMidiDevice { BluetoothGattDescriptor descriptor = characteristic.getDescriptor( CLIENT_CHARACTERISTIC_CONFIG); // FIXME null check if (descriptor != null) { descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); mBluetoothGatt.writeDescriptor(descriptor); } else { Log.e(TAG, "No CLIENT_CHARACTERISTIC_CONFIG for device " + mBluetoothDevice); } } @Override Loading Loading @@ -244,7 +246,8 @@ public final class BluetoothMidiDevice { }.start(); } void close() { private void close() { synchronized (mBluetoothDevice) { mEventScheduler.close(); if (mDeviceServer != null) { IoUtils.closeQuietly(mDeviceServer); Loading @@ -256,6 +259,7 @@ public final class BluetoothMidiDevice { mBluetoothGatt = null; } } } public IBinder getBinder() { return mDeviceServer.asBinder(); Loading