Package org.altbeacon.beacon.distance
Class ModelSpecificDistanceCalculator
- java.lang.Object
-
- org.altbeacon.beacon.distance.ModelSpecificDistanceCalculator
-
- All Implemented Interfaces:
DistanceCalculator
public class ModelSpecificDistanceCalculator extends Object implements DistanceCalculator
Obtains aDistanceCalculatorappropriate for a specific Android model. Each model may have a different Bluetooth chipset, radio and antenna and sees a different signal level at the same distance, therefore requiring a different equation coefficients for each model. This class uses a configuration table to look for a matching Android device model for which coefficients are known. If an exact match cannot be found, this class will attempt to find the closest match possible based on the assumption that an unknown model made by Samsung, for example might have a different signal response as a known device model also made by Samsung. If no match can be found at all, the device model marked as the default will be used for the calculation. The configuration table is stored in model-distance-calculations.json For information on how to get new Android device models added to this table, please see Created by dyoung on 8/28/14.
-
-
Constructor Summary
Constructors Constructor Description ModelSpecificDistanceCalculator(Context context, String remoteUpdateUrlString)Obtains the best possibleDistanceCalculatorfor the Android device calling the constructorModelSpecificDistanceCalculator(Context context, String remoteUpdateUrlString, AndroidModel model)Obtains the best possibleDistanceCalculatorfor the Android device passed as an argument
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublecalculateDistance(int txPower, double rssi)AndroidModelgetModel()AndroidModelgetRequestedModel()
-
-
-
Constructor Detail
-
ModelSpecificDistanceCalculator
public ModelSpecificDistanceCalculator(Context context, String remoteUpdateUrlString)
Obtains the best possibleDistanceCalculatorfor the Android device calling the constructor
-
ModelSpecificDistanceCalculator
public ModelSpecificDistanceCalculator(Context context, String remoteUpdateUrlString, AndroidModel model)
Obtains the best possibleDistanceCalculatorfor the Android device passed as an argument
-
-
Method Detail
-
getModel
public AndroidModel getModel()
- Returns:
- the Android device model used for distance calculations
-
getRequestedModel
public AndroidModel getRequestedModel()
- Returns:
- the Android device model requested to be used for distance calculations
-
calculateDistance
public double calculateDistance(int txPower, double rssi)- Specified by:
calculateDistancein interfaceDistanceCalculator
-
-