// Path: library/src/main/java/com/reelyactive/blesdk/support/ble/util/Clock.java
// public interface Clock {
// 
//   /**
//    * @return current time in milliseconds
//    */
//   public long currentTimeMillis();
// 
//   /**
//    * @return time since the device was booted, in nanoseconds
//    */
//   public long elapsedRealtimeNanos();
// 
// }
// 
// Path: library/src/main/java/com/reelyactive/blesdk/support/ble/util/Logger.java
// public class Logger {
// 
//   public static final String TAG = "BleScanCompatLib";
// 
//   public static void logVerbose(String message) {
//     if (Log.isLoggable(TAG, Log.VERBOSE)) {
//       Log.v(TAG, message);
//     }
//   }
// 
//   public static void logWarning(String message) {
//     if (Log.isLoggable(TAG, Log.WARN)) {
//       Log.w(TAG, message);
//     }
//   }
// 
//   public static void logDebug(String message) {
//     if (Log.isLoggable(TAG, Log.DEBUG)) {
//       Log.d(TAG, message);
//     }
//   }
// 
//   public static void logInfo(String message) {
//     if (Log.isLoggable(TAG, Log.INFO)) {
//       Log.i(TAG, message);
//     }
//   }
// 
//   public static void logError(String message, Exception... e) {
//     if (Log.isLoggable(TAG, Log.ERROR)) {
//       if (e == null || e.length == 0) {
//         Log.e(TAG, message);
//       } else {
//         Log.e(TAG, message, e[0]);
//       }
//     }
//   }
// }


import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.os.Build;
import com.reelyactive.blesdk.support.ble.util.Clock;
import com.reelyactive.blesdk.support.ble.util.Logger;
package com.reelyactive.blesdk.support.ble;/*
 * Copyright 2014 Google Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// THIS IS MODIFIED COPY OF THE "L" PLATFORM CLASS. BE CAREFUL ABOUT EDITS.
// THIS CODE SHOULD FOLLOW ANDROID STYLE.
//
// Changes:
//   Change to abstract class
//   Remove implementations
//   Define setCustomScanTiming for ULR
//   Slight updates to javadoc




/**
 * Represents the public entry into the Bluetooth LE compatibility scanner that efficiently captures
 * advertising packets broadcast from Bluetooth LE devices.
 * <p/>
 * API declarations in this class are the same as the new LE scanning API that is being introduced
 * in Android "L" platform. Declarations contained here will eventually be replaced by the platform
 * versions. Refer to the <a href="http://go/android-ble">"L" release API design</a> for further
 * information.
 * <p/>
 * The API implemented here is for compatibility when used on
 * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} and later.
 *
 * @see <a href="https://www.bluetooth.org/en-us/specification/adopted-specifications"> Bluetooth
 * Adopted Specifications</a>
 * @see <a href="https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=282152"> ​Core
 * Specification Supplement (CSS) v4</a>
 */
public abstract class BluetoothLeScannerCompat {

    // Number of cycles before a sighted device is considered lost.
  /* @VisibleForTesting */ static final int SCAN_LOST_CYCLES = 4;

    // Constants for Scan Cycle
    // Low Power: 2.5 minute period with 1.5 seconds active (1% duty cycle)
  /* @VisibleForTesting */ static final int LOW_POWER_IDLE_MILLIS = 148500;
    /* @VisibleForTesting */ static final int LOW_POWER_ACTIVE_MILLIS = 1500;

    // Balanced: 15 second period with 1.5 second active (10% duty cycle)
  /* @VisibleForTesting */ static final int BALANCED_IDLE_MILLIS = 13500;
    /* @VisibleForTesting */ static final int BALANCED_ACTIVE_MILLIS = 1500;

    // Low Latency: 1.67 second period with 1.5 seconds active (90% duty cycle)
  /* @VisibleForTesting */ static final int LOW_LATENCY_IDLE_MILLIS = 167;
    /* @VisibleForTesting */ static final int LOW_LATENCY_ACTIVE_MILLIS = 1500;
    // Alarm Scan variables
// Path: library/src/main/java/com/reelyactive/blesdk/support/ble/util/Clock.java
// public interface Clock {
// 
//   /**
//    * @return current time in milliseconds
//    */
//   public long currentTimeMillis();
// 
//   /**
//    * @return time since the device was booted, in nanoseconds
//    */
//   public long elapsedRealtimeNanos();
// 
// }
// 
// Path: library/src/main/java/com/reelyactive/blesdk/support/ble/util/Logger.java
// public class Logger {
// 
//   public static final String TAG = "BleScanCompatLib";
// 
//   public static void logVerbose(String message) {
//     if (Log.isLoggable(TAG, Log.VERBOSE)) {
//       Log.v(TAG, message);
//     }
//   }
// 
//   public static void logWarning(String message) {
//     if (Log.isLoggable(TAG, Log.WARN)) {
//       Log.w(TAG, message);
//     }
//   }
// 
//   public static void logDebug(String message) {
//     if (Log.isLoggable(TAG, Log.DEBUG)) {
//       Log.d(TAG, message);
//     }
//   }
// 
//   public static void logInfo(String message) {
//     if (Log.isLoggable(TAG, Log.INFO)) {
//       Log.i(TAG, message);
//     }
//   }
// 
//   public static void logError(String message, Exception... e) {
//     if (Log.isLoggable(TAG, Log.ERROR)) {
//       if (e == null || e.length == 0) {
//         Log.e(TAG, message);
//       } else {
//         Log.e(TAG, message, e[0]);
//       }
//     }
//   }
// }


// Path: library/src/main/java/com/reelyactive/blesdk/support/ble/BluetoothLeScannerCompat.java
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.os.Build;
import com.reelyactive.blesdk.support.ble.util.Clock;
import com.reelyactive.blesdk.support.ble.util.Logger;

package com.reelyactive.blesdk.support.ble;/*
 * Copyright 2014 Google Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// THIS IS MODIFIED COPY OF THE "L" PLATFORM CLASS. BE CAREFUL ABOUT EDITS.
// THIS CODE SHOULD FOLLOW ANDROID STYLE.
//
// Changes:
//   Change to abstract class
//   Remove implementations
//   Define setCustomScanTiming for ULR
//   Slight updates to javadoc




/**
 * Represents the public entry into the Bluetooth LE compatibility scanner that efficiently captures
 * advertising packets broadcast from Bluetooth LE devices.
 * <p/>
 * API declarations in this class are the same as the new LE scanning API that is being introduced
 * in Android "L" platform. Declarations contained here will eventually be replaced by the platform
 * versions. Refer to the <a href="http://go/android-ble">"L" release API design</a> for further
 * information.
 * <p/>
 * The API implemented here is for compatibility when used on
 * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} and later.
 *
 * @see <a href="https://www.bluetooth.org/en-us/specification/adopted-specifications"> Bluetooth
 * Adopted Specifications</a>
 * @see <a href="https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=282152"> ​Core
 * Specification Supplement (CSS) v4</a>
 */
public abstract class BluetoothLeScannerCompat {

    // Number of cycles before a sighted device is considered lost.
  /* @VisibleForTesting */ static final int SCAN_LOST_CYCLES = 4;

    // Constants for Scan Cycle
    // Low Power: 2.5 minute period with 1.5 seconds active (1% duty cycle)
  /* @VisibleForTesting */ static final int LOW_POWER_IDLE_MILLIS = 148500;
    /* @VisibleForTesting */ static final int LOW_POWER_ACTIVE_MILLIS = 1500;

    // Balanced: 15 second period with 1.5 second active (10% duty cycle)
  /* @VisibleForTesting */ static final int BALANCED_IDLE_MILLIS = 13500;
    /* @VisibleForTesting */ static final int BALANCED_ACTIVE_MILLIS = 1500;

    // Low Latency: 1.67 second period with 1.5 seconds active (90% duty cycle)
  /* @VisibleForTesting */ static final int LOW_LATENCY_IDLE_MILLIS = 167;
    /* @VisibleForTesting */ static final int LOW_LATENCY_ACTIVE_MILLIS = 1500;
    // Alarm Scan variables
    private final Clock clock;