Change byte[] array in scanrecord return to a string.
Make sure the callback type was added to a return.
Change-Id: Idd15481dab5fcf9e232b288671a7ac3bca08a612
diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeScanFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeScanFacade.java
index e0a6948..88b27bd 100644
--- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeScanFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeScanFacade.java
@@ -923,6 +923,7 @@
public void onScanResult(int callbackType, ScanResult result) {
Log.d("bluetooth_le_scan change onUpdate " + mEventType + " " + index);
mResults.putInt("ID", index);
+ mResults.putInt("CallbackType", callbackType);
mResults.putString("Type", "onScanResult");
mResults.putParcelable("Result", result);
mEventFacade.postEvent(mEventType + index + "onScanResults", mResults.clone());
@@ -958,7 +959,7 @@
Log.d("bluetooth_classic_le_scan " + mEventType + " " + index);
mResults.putParcelable("Device", device);
mResults.putInt("Rssi", rssi);
- mResults.putByteArray("ScanRecord", scanRecord);
+ mResults.putString("ScanRecord", ConvertUtils.convertByteArrayToString(scanRecord));
mResults.putString("Type", "onLeScan");
mEventFacade.postEvent(mEventType + index + "onLeScan", mResults.clone());
mResults.clear();
diff --git a/Common/src/com/googlecode/android_scripting/jsonrpc/JsonBuilder.java b/Common/src/com/googlecode/android_scripting/jsonrpc/JsonBuilder.java
index cae57b2..f938924 100644
--- a/Common/src/com/googlecode/android_scripting/jsonrpc/JsonBuilder.java
+++ b/Common/src/com/googlecode/android_scripting/jsonrpc/JsonBuilder.java
@@ -46,6 +46,7 @@
import android.telephony.NeighboringCellInfo;
import android.telephony.gsm.GsmCellLocation;
+import com.googlecode.android_scripting.ConvertUtils;
import com.googlecode.android_scripting.event.Event;
public class JsonBuilder {
@@ -289,8 +290,9 @@
throws JSONException {
JSONObject result = new JSONObject();
result.put("rssi", scanResult.getRssi());
- result.put("timestampNanos", scanResult.getTimestampNanos());
- result.put("scanRecord", build(scanResult.getScanRecord()));
+ result.put("timestampSeconds", scanResult.getTimestampNanos());
+ result.put("scanRecord", build(ConvertUtils.convertByteArrayToString(
+ scanResult.getScanRecord())));
result.put("deviceInfo", build(scanResult.getDevice()));
return result;
}