diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2016-11-23 15:07:29 +0100 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2016-11-29 05:36:32 +0000 |
commit | f456d1da14008171155f08404d85006bd00d52fc (patch) | |
tree | 1fea16b52e6e496198121d3550424c16e98f9fb8 /src | |
parent | 4374cedf965016806000596db1d1fe47d592c614 (diff) |
Java uses references in container - no need to set the items in place
Task-number: QTBUG-52692
Change-Id: Id9fecd98a9031f2bcb561143b66b74ccea751db2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java index 8d17f599..ebbf4c55 100644 --- a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java +++ b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java @@ -195,7 +195,6 @@ public class QtBluetoothLE { GattEntry entry = entries.get(foundHandle); final boolean isServiceDiscoveryRun = !entry.valueKnown; entry.valueKnown = true; - entries.set(foundHandle, entry); if (status != BluetoothGatt.GATT_SUCCESS) { @@ -298,7 +297,6 @@ public class QtBluetoothLE { GattEntry entry = entries.get(foundHandle); final boolean isServiceDiscoveryRun = !entry.valueKnown; entry.valueKnown = true; - entries.set(foundHandle, entry); if (status != BluetoothGatt.GATT_SUCCESS) { Log.w(TAG, "onDescriptorRead error: " + status); @@ -435,7 +433,7 @@ public class QtBluetoothLE { public BluetoothGattService service = null; public BluetoothGattCharacteristic characteristic = null; public BluetoothGattDescriptor descriptor = null; - public int endHandle; + public int endHandle = -1; // pointer back to the handle that describes the service that this GATT entry belongs to public int associatedServiceHandle; } @@ -558,14 +556,13 @@ public class QtBluetoothLE { GattEntry serviceEntry = new GattEntry(); serviceEntry.type = GattEntryType.Service; serviceEntry.service = service; - entries.add(entry); + entries.add(serviceEntry); // remember handle for the service for later update int serviceHandle = entries.size() - 1; //point to itself -> mostly done for consistence reasons with other entries serviceEntry.associatedServiceHandle = serviceHandle; - //some devices may have more than one service with the same uuid List<Integer> old = uuidToEntry.get(service.getUuid()); if (old == null) @@ -601,7 +598,6 @@ public class QtBluetoothLE { // update endHandle of current service serviceEntry.endHandle = entries.size() - 1; - entries.set(serviceHandle, serviceEntry); } entries.trimToSize(); @@ -730,7 +726,6 @@ public class QtBluetoothLE { { GattEntry discoveredService = entries.get(handleDiscoveredService); discoveredService.valueKnown = true; - entries.set(handleDiscoveredService, discoveredService); leServiceDetailDiscoveryFinished(qtObject, discoveredService.service.getUuid().toString(), handleDiscoveredService + 1, discoveredService.endHandle + 1); @@ -742,7 +737,6 @@ public class QtBluetoothLE { int currentEntry = currentServiceInDiscovery; GattEntry discoveredService = entries.get(currentServiceInDiscovery); discoveredService.valueKnown = true; - entries.set(currentServiceInDiscovery, discoveredService); currentServiceInDiscovery = -1; |