Removed hidden apis
Changed documentation
Changed return value type from byte[] to string in a few methods
Change-Id: Ib2b264947ca165a2c290a12e650bbf4573fe999d
diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeAdvertiseFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeAdvertiseFacade.java
index 9d5db59..8bfd3ed 100644
--- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeAdvertiseFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeAdvertiseFacade.java
@@ -57,7 +57,6 @@
private static int BleAdvertiseSettingsCount;
private static int BleAdvertiseDataCount;
private final HashMap<Integer, myAdvertiseCallback> mAdvertiseCallbackList;
- private final HashMap<Integer, myClassicAdvertiseCallback> mClassicAdvertiseCallbackList;
private final BluetoothLeAdvertiser mAdvertise;
private final Service mService;
private Builder mAdvertiseDataBuilder;
@@ -77,7 +76,6 @@
});
mEventFacade = manager.getReceiver(EventFacade.class);
mAdvertiseCallbackList = new HashMap<Integer, myAdvertiseCallback>();
- mClassicAdvertiseCallbackList = new HashMap<Integer, myClassicAdvertiseCallback>();
mAdvertise = mBluetoothAdapter.getBluetoothLeAdvertiser();
mAdvertiseDataList = new HashMap<Integer, AdvertiseData>();
mAdvertiseSettingsList = new HashMap<Integer, AdvertiseSettings>();
@@ -101,21 +99,6 @@
}
/**
- * Constructs a myClassicAdvertiseCallback obj and returns its index
- *
- * @return myClassicAdvertiseCallback.index
- */
- @Rpc(description = "Generate a new myClassicAdvertisement Object")
- public Integer genClassicBleAdvertiseCallback() {
- ClassicBleAdvertiseCallbackCount += 1;
- int index = ClassicBleAdvertiseCallbackCount;
- myClassicAdvertiseCallback mCallback = new myClassicAdvertiseCallback(index);
- mClassicAdvertiseCallbackList.put(mCallback.index,
- mCallback);
- return mCallback.index;
- }
-
- /**
* Constructs a AdvertiseData obj and returns its index
*
* @return index
@@ -216,25 +199,6 @@
}
/**
- * Stops a classic ble advertisement
- *
- * @param index the id of the advertisement to stop advertising on
- * @throws Exception
- */
- @Rpc(description = "Stops an ongoing classic ble advertisement scan")
- public void stopClassicBleAdvertising(
- @RpcParameter(name = "index")
- Integer index) throws Exception {
- if (mClassicAdvertiseCallbackList.get(index) != null) {
- Log.d("bluetooth_le_classic mAdvertise " + index);
- mBluetoothAdapter.stopAdvertising(mClassicAdvertiseCallbackList
- .get(index));
- } else {
- throw new Exception("Invalid index input:" + Integer.toString(index));
- }
- }
-
- /**
* Starts ble advertising
*
* @param callbackIndex The advertisementCallback index
@@ -326,30 +290,6 @@
}
/**
- * Starts Classic ble advertising
- *
- * @param callbackIndex The advertisementCallback index
- * @throws Exception
- */
- @Rpc(description = "Starts ble advertisement")
- public void startClassicBleAdvertising(
- @RpcParameter(name = "callbackIndex")
- Integer callbackIndex,
- @RpcParameter(name = "dataIndex")
- Integer dataIndex,
- @RpcParameter(name = "settingsIndex")
- Integer settingsIndex
- ) throws Exception {
- if (mClassicAdvertiseCallbackList.get(callbackIndex) != null) {
- Log.d("bluetooth_le starting a background scan on callback index: "
- + Integer.toString(callbackIndex));
- mBluetoothAdapter.startAdvertising(mClassicAdvertiseCallbackList.get(callbackIndex));
- } else {
- throw new Exception("Invalid callbackIndex input" + Integer.toString(callbackIndex));
- }
- }
-
- /**
* Set ble advertisement data include tx power level
*
* @param includeTxPowerLevel boolean whether to include the tx power level or not in the
@@ -672,42 +612,6 @@
}
}
- private class myClassicAdvertiseCallback implements
- android.bluetooth.BluetoothAdapter.AdvertiseCallback {
- public Integer index;
- private final Bundle mResults;
- String mEventType;
-
- public myClassicAdvertiseCallback(int idx) {
- index = idx;
- mEventType = "BleAdvertise";
- mResults = new Bundle();
- }
-
- @Override
- public void onAdvertiseStart(int status) {
- Log.d("bluetooth_classic_le_advertisement onAdvertiseStart " + mEventType + " "
- + index);
- mResults.putString("Type", "onAdvertiseStart");
- mResults.putInt("Status", status);
- mEventFacade.postEvent(mEventType + index + "onAdvertiseStart",
- mResults.clone());
- mResults.clear();
- }
-
- @Override
- public void onAdvertiseStop(int status) {
- Log.d("bluetooth_classic_le_advertisement onAdvertiseStop " + mEventType + " "
- + index);
- mResults.putString("Type", "onAdvertiseStop");
- mResults.putInt("Status", status);
- mEventFacade.postEvent(mEventType + index + "onAdvertiseStop",
- mResults.clone());
- mResults.clear();
- }
-
- }
-
@Override
public void shutdown() {
if (mAdvertiseCallbackList.isEmpty() == false) {
@@ -722,16 +626,6 @@
mAdvertiseSettingsList.clear();
mAdvertiseDataList.clear();
}
-
- if (mClassicAdvertiseCallbackList.isEmpty() == false) {
- for (myClassicAdvertiseCallback mAdvertise : mClassicAdvertiseCallbackList
- .values()) {
- if (mAdvertise != null) {
- mBluetoothAdapter.stopAdvertising(mAdvertise);
- }
- }
- mAdvertiseCallbackList.clear();
- }
}
}
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 22c0e52..1df328a 100644
--- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeScanFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeScanFacade.java
@@ -33,6 +33,7 @@
import android.os.Bundle;
import android.os.ParcelUuid;
+import com.googlecode.android_scripting.ConvertUtils;
import com.googlecode.android_scripting.Log;
import com.googlecode.android_scripting.MainThread;
import com.googlecode.android_scripting.facade.EventFacade;
@@ -430,14 +431,14 @@
}
/**
- * Get ScanFilter's local name
+ * Get ScanFilter's device name
*
* @param index the ScanFilter object to use
- * @return the ScanFilter's local name
+ * @return the ScanFilter's device name
* @throws Exception
*/
- @Rpc(description = "Get ScanFilter's local name")
- public String getScanFilterLocalName(
+ @Rpc(description = "Get ScanFilter's device name")
+ public String getScanFilterDeviceName(
@RpcParameter(name = "index")
Integer index,
@RpcParameter(name = "filterIndex")
@@ -462,7 +463,7 @@
* @throws Exception
*/
@Rpc(description = "Get ScanFilter's manufacturer data")
- public byte[] getScanFilterManufacturerData(
+ public String getScanFilterManufacturerData(
@RpcParameter(name = "index")
Integer index,
@RpcParameter(name = "filterIndex")
@@ -470,8 +471,8 @@
throws Exception {
if (mScanFilterList.get(index) != null) {
if (mScanFilterList.get(index).get(filterIndex) != null) {
- return mScanFilterList.get(index)
- .get(filterIndex).getManufacturerData();
+ return ConvertUtils.convertByteArrayToString(mScanFilterList.get(index)
+ .get(filterIndex).getManufacturerData());
} else {
throw new Exception("Invalid filterIndex input:" + Integer.toString(filterIndex));
}
@@ -488,7 +489,7 @@
* @throws Exception
*/
@Rpc(description = "Get ScanFilter's manufacturer data mask")
- public byte[] getScanFilterManufacturerDataMask(
+ public String getScanFilterManufacturerDataMask(
@RpcParameter(name = "index")
Integer index,
@RpcParameter(name = "filterIndex")
@@ -496,7 +497,8 @@
throws Exception {
if (mScanFilterList.get(index) != null) {
if (mScanFilterList.get(index).get(filterIndex) != null) {
- return mScanFilterList.get(index).get(filterIndex).getManufacturerDataMask();
+ return ConvertUtils.convertByteArrayToString(mScanFilterList.get(index)
+ .get(filterIndex).getManufacturerDataMask());
} else {
throw new Exception("Invalid filterIndex input:" + Integer.toString(filterIndex));
}
@@ -564,7 +566,7 @@
* @throws Exception
*/
@Rpc(description = "Get ScanFilter's service data")
- public byte[] getScanFilterServiceData(
+ public String getScanFilterServiceData(
@RpcParameter(name = "index")
Integer index,
@RpcParameter(name = "filterIndex")
@@ -572,7 +574,8 @@
throws Exception {
if (mScanFilterList.get(index) != null) {
if (mScanFilterList.get(index).get(filterIndex) != null) {
- return mScanFilterList.get(index).get(filterIndex).getServiceData();
+ return ConvertUtils.convertByteArrayToString(mScanFilterList
+ .get(index).get(filterIndex).getServiceData());
} else {
throw new Exception("Invalid filterIndex input:" + Integer.toString(filterIndex));
}
@@ -589,7 +592,7 @@
* @throws Exception
*/
@Rpc(description = "Get ScanFilter's service data mask")
- public byte[] getScanFilterServiceDataMask(
+ public String getScanFilterServiceDataMask(
@RpcParameter(name = "index")
Integer index,
@RpcParameter(name = "filterIndex")
@@ -597,7 +600,8 @@
throws Exception {
if (mScanFilterList.get(index) != null) {
if (mScanFilterList.get(index).get(filterIndex) != null) {
- return mScanFilterList.get(index).get(filterIndex).getServiceDataMask();
+ return ConvertUtils.convertByteArrayToString(mScanFilterList.get(index)
+ .get(filterIndex).getServiceDataMask());
} else {
throw new Exception("Invalid filterIndex input:" + Integer.toString(filterIndex));
}
@@ -674,7 +678,7 @@
* @throws Exception
*/
@Rpc(description = "Add filter \"macAddress\" to existing ScanFilter")
- public void setScanFilterMacAddress(
+ public void setScanFilterDeviceAddress(
@RpcParameter(name = "macAddress")
String macAddress
) {
@@ -770,13 +774,13 @@
}
/**
- * Add filter "name" to existing ScanFilter
+ * Add filter "device name" to existing ScanFilter
*
- * @param name the name to filter against
+ * @param name the device name to filter against
* @throws Exception
*/
- @Rpc(description = "Remove a scanFilter from the scanFilterList")
- public void setScanFilterName(
+ @Rpc(description = "Sets the scan filter's device name")
+ public void setScanFilterDeviceName(
@RpcParameter(name = "name")
String name
) {