// Path: beacontag_sdk/src/main/java/com/orange/beaconme_sdk/ble/model/DeviceFootprint.java
// public class DeviceFootprint implements Serializable {
// 
//     private String uuid;
// 
//     private int major;
// 
//     private int minor;
// 
//     public DeviceFootprint() {}
// 
//     /**
//      * Create new footprint
//      * @param uuid uuid of the device
//      * @param major major of the device
//      * @param minor minor of the device
//      */
//     public DeviceFootprint(String uuid, int major, int minor) {
//         this.uuid = uuid;
//         this.major = major;
//         this.minor = minor;
//     }
// 
//     public String getUuid() {
//         return uuid;
//     }
// 
//     public int getMajor() {
//         return major;
//     }
// 
//     public int getMinor() {
//         return minor;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         DeviceFootprint that = (DeviceFootprint) o;
// 
//         if (major != that.major) return false;
//         if (minor != that.minor) return false;
//         if (!uuid.equals(that.uuid)) return false;
// 
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = uuid.hashCode();
//         result = 31 * result + major;
//         result = 31 * result + minor;
//         return result;
//     }
// }
// 
// Path: beacontag_sdk/src/main/java/com/orange/beaconme_sdk/ble/model/IBeaconDetect.java
// public class IBeaconDetect {
//     
//     private final DeviceFootprint footprint;
//     private final int rssi;
//     private final Date detectTime;
//     private final int txPower;
// 
//     public IBeaconDetect(String uuid, int major, int minor, int rssi, int txPower) {
//         footprint = new DeviceFootprint(uuid.toLowerCase(), major, minor);
//         this.rssi = rssi;
//         this.detectTime = new Date();
//         this.txPower = txPower;
//     }
// 
//     public DeviceFootprint getFootprint() {
//         return footprint;
//     }
// 
//     public int getRssi() {
//         return rssi;
//     }
// 
//     public Date getDetectTime() {
//         return detectTime;
//     }
//     
//     public double getDistance() {
//         return Math.sqrt(Math.pow(10, (txPower - rssi) / 10.0));
//     }
//     
//     public BLERange getRange(){
//         return BLERange.getRange(getDistance());
//         
//     }
//     
// }


import com.orange.beaconme_sdk.ble.model.DeviceFootprint;
import com.orange.beaconme_sdk.ble.model.IBeaconDetect;
/*
 * Copyright (c) 2015 Orange.
 *
 * This library is free software; you can redistribute it and/or modify it under the terms of
 * the GNU Lesser General Public License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License, which can be found in the file 'LICENSE.txt' in
 * this package distribution or at 'http://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html'
 * for more details.
 *
 * Created by Orange Beacon on 08/6/15.
 */
package com.orange.beaconme_sdk.control.detection_handlers;



/**
 * Super class of detection handlers register listener and invoke appropriate method when
 * onFire method is invoked
 */
public abstract class TagDetectionHandler {
    
    private final DeviceFootprint footprint;
    private volatile OnTriggerFiredListener listener;

    protected TagDetectionHandler(DeviceFootprint footprint, OnTriggerFiredListener listener) {
        this.footprint = footprint;
        this.listener = listener;
    }
    
// Path: beacontag_sdk/src/main/java/com/orange/beaconme_sdk/ble/model/DeviceFootprint.java
// public class DeviceFootprint implements Serializable {
// 
//     private String uuid;
// 
//     private int major;
// 
//     private int minor;
// 
//     public DeviceFootprint() {}
// 
//     /**
//      * Create new footprint
//      * @param uuid uuid of the device
//      * @param major major of the device
//      * @param minor minor of the device
//      */
//     public DeviceFootprint(String uuid, int major, int minor) {
//         this.uuid = uuid;
//         this.major = major;
//         this.minor = minor;
//     }
// 
//     public String getUuid() {
//         return uuid;
//     }
// 
//     public int getMajor() {
//         return major;
//     }
// 
//     public int getMinor() {
//         return minor;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         DeviceFootprint that = (DeviceFootprint) o;
// 
//         if (major != that.major) return false;
//         if (minor != that.minor) return false;
//         if (!uuid.equals(that.uuid)) return false;
// 
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = uuid.hashCode();
//         result = 31 * result + major;
//         result = 31 * result + minor;
//         return result;
//     }
// }
// 
// Path: beacontag_sdk/src/main/java/com/orange/beaconme_sdk/ble/model/IBeaconDetect.java
// public class IBeaconDetect {
//     
//     private final DeviceFootprint footprint;
//     private final int rssi;
//     private final Date detectTime;
//     private final int txPower;
// 
//     public IBeaconDetect(String uuid, int major, int minor, int rssi, int txPower) {
//         footprint = new DeviceFootprint(uuid.toLowerCase(), major, minor);
//         this.rssi = rssi;
//         this.detectTime = new Date();
//         this.txPower = txPower;
//     }
// 
//     public DeviceFootprint getFootprint() {
//         return footprint;
//     }
// 
//     public int getRssi() {
//         return rssi;
//     }
// 
//     public Date getDetectTime() {
//         return detectTime;
//     }
//     
//     public double getDistance() {
//         return Math.sqrt(Math.pow(10, (txPower - rssi) / 10.0));
//     }
//     
//     public BLERange getRange(){
//         return BLERange.getRange(getDistance());
//         
//     }
//     
// }


// Path: beacontag_sdk/src/main/java/com/orange/beaconme_sdk/control/detection_handlers/TagDetectionHandler.java
import com.orange.beaconme_sdk.ble.model.DeviceFootprint;
import com.orange.beaconme_sdk.ble.model.IBeaconDetect;

/*
 * Copyright (c) 2015 Orange.
 *
 * This library is free software; you can redistribute it and/or modify it under the terms of
 * the GNU Lesser General Public License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License, which can be found in the file 'LICENSE.txt' in
 * this package distribution or at 'http://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html'
 * for more details.
 *
 * Created by Orange Beacon on 08/6/15.
 */
package com.orange.beaconme_sdk.control.detection_handlers;



/**
 * Super class of detection handlers register listener and invoke appropriate method when
 * onFire method is invoked
 */
public abstract class TagDetectionHandler {
    
    private final DeviceFootprint footprint;
    private volatile OnTriggerFiredListener listener;

    protected TagDetectionHandler(DeviceFootprint footprint, OnTriggerFiredListener listener) {
        this.footprint = footprint;
        this.listener = listener;
    }
    
    public void onDetect(IBeaconDetect detection) {