Implementation of Filtered Scan for BLE android client
[platform/upstream/iotivity.git] / android / android_api / base / src / main / java / org / iotivity / ca / CaLeClientInterface.java
old mode 100644 (file)
new mode 100755 (executable)
index fc1db0d..9b7c8ad
@@ -74,11 +74,11 @@ public class CaLeClientInterface {
     }
 
     public static void getLeScanCallback() {
-//        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-//            caLeRegisterLeScanCallbackForV21(mLeScanCallbackForV21);
-//        } else {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+            caLeRegisterLeScanCallbackForV21(mLeScanCallbackForV21);
+        } else {
             caLeRegisterLeScanCallback(mLeScanCallback);
-//        }
+        }
     }
 
     public static void getLeGattCallback() {
@@ -217,12 +217,12 @@ public class CaLeClientInterface {
         try {
             List<UUID> uuids = getUuids(scanRecord);
             for (UUID uuid : uuids) {
+            Log.d(TAG,"UUID is "+ uuid.toString());
                 if(uuid.toString().contains(SERVICE_UUID.toLowerCase())) {
                     caLeScanCallback(device);
                 } else if(uuid.toString().contains(CUSTOM_UUID.toLowerCase()) ||
                          uuid.toString().contains(CUSTOM_UUID2.toLowerCase())) {
-                    Log.d(TAG, "we found that has the Device [" + device.getAddress() +
-                               "] which has custom adv");
+                    Log.d(TAG, "Found device which has custom adv");
                     caLeScanCallback(device);
                 }
             }
@@ -352,6 +352,7 @@ public class CaLeClientInterface {
         public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
                 int status) {
             super.onDescriptorWrite(gatt, descriptor, status);
+            Log.d(TAG,"Descriptor status is "+ status);
 
             caLeGattDescriptorWriteCallback(gatt, status);
             caLeGattNWDescriptorWriteCallback(gatt, status);