public class ModelSpecificDistanceCalculator extends Object implements DistanceCalculator
DistanceCalculator appropriate 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 and Description |
|---|
ModelSpecificDistanceCalculator(Context context,
String remoteUpdateUrlString)
Obtains the best possible
DistanceCalculator for the Android device calling
the constructor |
ModelSpecificDistanceCalculator(Context context,
String remoteUpdateUrlString,
AndroidModel model)
Obtains the best possible
DistanceCalculator for the Android device passed
as an argument |
| Modifier and Type | Method and Description |
|---|---|
double |
calculateDistance(int txPower,
double rssi) |
AndroidModel |
getModel() |
AndroidModel |
getRequestedModel() |
public ModelSpecificDistanceCalculator(Context context, String remoteUpdateUrlString)
DistanceCalculator for the Android device calling
the constructorpublic ModelSpecificDistanceCalculator(Context context, String remoteUpdateUrlString, AndroidModel model)
DistanceCalculator for the Android device passed
as an argumentpublic AndroidModel getModel()
public AndroidModel getRequestedModel()
public double calculateDistance(int txPower,
double rssi)
calculateDistance in interface DistanceCalculator