Class CurveFittedDistanceCalculator

  • All Implemented Interfaces:
    DistanceCalculator

    public class CurveFittedDistanceCalculator
    extends Object
    implements DistanceCalculator
    This class estimates the distance between the mobile device and a BLE beacon based on the measured RSSI and a txPower calibration value that represents the expected RSSI for an iPhone 5 receiving the signal when it is 1 meter away. This class uses a best-fit curve equation with configurable coefficients. The coefficients must be supplied by the caller and are specific to the Android device being used. See the ModelSpecificDistanceCalculator for more information on the coefficients. Created by dyoung on 8/28/14.
    • Constructor Detail

      • CurveFittedDistanceCalculator

        public CurveFittedDistanceCalculator​(double coefficient1,
                                             double coefficient2,
                                             double coefficient3)
        Construct a calculator with coefficients specific for the device's signal vs. distance
        Parameters:
        coefficient1 -
        coefficient2 -
        coefficient3 -
    • Method Detail

      • calculateDistance

        public double calculateDistance​(int txPower,
                                        double rssi)
        Calculated the estimated distance in meters to the beacon based on a reference rssi at 1m and the known actual rssi at the current location
        Specified by:
        calculateDistance in interface DistanceCalculator
        Parameters:
        txPower -
        rssi -
        Returns:
        estimated distance