am c91ad28f: Merge change 23218 into eclair

Merge commit 'c91ad28ff9173971c1d886f884250b1e774a40a6' into eclair-plus-aosp

* commit 'c91ad28ff9173971c1d886f884250b1e774a40a6':
  Fix property being cleared when DeviceFound signal is received.
This commit is contained in:
Jaikumar Ganesh
2009-08-31 16:54:37 -07:00
committed by Android Git Automerger
2 changed files with 24 additions and 19 deletions

View File

@@ -283,10 +283,12 @@ class BluetoothEventLoop {
String value = null;
int len = Integer.valueOf(propValues[1]);
if (len > 0) {
value = "";
StringBuilder str = new StringBuilder();
for (int i = 2; i < propValues.length; i++) {
value = value + propValues[i] + ',';
str.append(propValues[i]);
str.append(",");
}
value = str.toString();
}
mBluetoothService.setProperty(name, value);
} else if (name.equals("Powered")) {
@@ -331,10 +333,12 @@ class BluetoothEventLoop {
String uuid = null;
int len = Integer.valueOf(propValues[1]);
if (len > 0) {
uuid = "";
StringBuilder str = new StringBuilder();
for (int i = 2; i < propValues.length; i++) {
uuid = uuid + propValues[i] + ",";
str.append(propValues[i]);
str.append(",");
}
uuid = str.toString();
}
mBluetoothService.setRemoteDeviceProperty(address, name, uuid);
} else if (name.equals("Paired")) {

View File

@@ -551,20 +551,21 @@ public class BluetoothService extends IBluetooth.Stub {
for (int i = 0; i < properties.length; i++) {
String name = properties[i];
String newValue;
String newValue = null;
int len;
if (name == null) {
Log.e(TAG, "Error:Adapter Property at index" + i + "is null");
continue;
}
if (name.equals("Devices")) {
StringBuilder str = new StringBuilder();
len = Integer.valueOf(properties[++i]);
if (len != 0)
newValue = "";
else
newValue = null;
for (int j = 0; j < len; j++) {
newValue += properties[++i] + ",";
str.append(properties[++i]);
str.append(",");
}
if (len > 0) {
newValue = str.toString();
}
} else {
newValue = properties[++i];
@@ -837,32 +838,32 @@ public class BluetoothService extends IBluetooth.Stub {
* We get a DeviceFound signal every time RSSI changes or name changes.
* Don't create a new Map object every time */
Map<String, String> propertyValues = mDeviceProperties.get(address);
if (propertyValues != null) {
propertyValues.clear();
} else {
if (propertyValues == null) {
propertyValues = new HashMap<String, String>();
}
for (int i = 0; i < properties.length; i++) {
String name = properties[i];
String newValue;
String newValue = null;
int len;
if (name == null) {
Log.e(TAG, "Error: Remote Device Property at index" + i + "is null");
continue;
}
if (name.equals("UUIDs") || name.equals("Nodes")) {
StringBuilder str = new StringBuilder();
len = Integer.valueOf(properties[++i]);
if (len != 0)
newValue = "";
else
newValue = null;
for (int j = 0; j < len; j++) {
newValue += properties[++i] + ",";
str.append(properties[++i]);
str.append(",");
}
if (len > 0) {
newValue = str.toString();
}
} else {
newValue = properties[++i];
}
propertyValues.put(name, newValue);
}
mDeviceProperties.put(address, propertyValues);