org.placelab.client.tracker
Class BeaconTracker

java.lang.Object
  extended byorg.placelab.client.tracker.Tracker
      extended byorg.placelab.client.tracker.BeaconTracker
All Implemented Interfaces:
SpotterListener
Direct Known Subclasses:
BeaconAndGPSParticleFilterTracker, CentroidTracker, IntersectionTracker, ParticleFilterTracker

public abstract class BeaconTracker
extends Tracker

This is the base class for all Beacon-based trackers. It includes methods to look up Beacon objects in a Mapper given a unique identifier for the Beacon.

Because a Beacon's unique identifier may not be truly unique, there is a need to choose a Beacon from a set of Beacons that match the unique identifier given a current location and/or the surrounding neighborhood of Beacons. Utility methods are provided to meet this need.


Field Summary
static long WIFI_MAX_DISTANCE
           
 
Constructor Summary
BeaconTracker(Mapper m)
           
 
Method Summary
 boolean acceptableMeasurement(Measurement m)
          Returns true if the tracker can make use of this reading to meaningfully update the estimate.
 Beacon findBeacon(java.lang.String uniqueId, BeaconMeasurement meas, Coordinate currentPosition)
          Like findBeacon(String, BeaconMeasurement, Coordinate, long) but uses the default maxDistance of 500 meters which corresponds to WiFi beacons.
 Beacon findBeacon(java.lang.String uniqueId, BeaconMeasurement meas, Coordinate currentPosition, long maxDistance)
          Given the unique id for a Beacon find the most likely Beacon in this BeaconTracker's mapper given the neighborhood of surrounding Beacons in a {org.placelab.core.BeaconMeasurement} and the current position.
 Mapper getMapper()
          Gets the Mapper used by this BeaconTracker to map Beacon ids to Beacon objects.
static Beacon pickBeacon(java.util.Vector beacons, BeaconMeasurement meas, Coordinate currentPosition)
          Like pickBeacon(Vector, BeaconMeasurement, Coordinate, long) but uses the default maxDistance of 500 meters which corresponds to WiFi beacons.
static Beacon pickBeacon(java.util.Vector beacons, BeaconMeasurement meas, Coordinate currentPosition, long maxDistance)
          A convenience method for choosing the most likely beacon from a Vector of beacons returned from a Mapper.
 
Methods inherited from class org.placelab.client.tracker.Tracker
addEstimateListener, fireEstimateUpdate, getEstimate, getLastUpdatedTime, gotMeasurement, numberOfMeasurements, removeEstimateListener, reset, resetImpl, spotterExceptionThrown, updateEstimate, updateEstimateImpl, updateWithoutMeasurement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WIFI_MAX_DISTANCE

public static final long WIFI_MAX_DISTANCE
See Also:
Constant Field Values
Constructor Detail

BeaconTracker

public BeaconTracker(Mapper m)
Method Detail

getMapper

public Mapper getMapper()
Gets the Mapper used by this BeaconTracker to map Beacon ids to Beacon objects.


acceptableMeasurement

public boolean acceptableMeasurement(Measurement m)
Description copied from class: Tracker
Returns true if the tracker can make use of this reading to meaningfully update the estimate.

Specified by:
acceptableMeasurement in class Tracker
Parameters:
m - return true if this is a BeaconMeasurement

findBeacon

public Beacon findBeacon(java.lang.String uniqueId,
                         BeaconMeasurement meas,
                         Coordinate currentPosition)
Like findBeacon(String, BeaconMeasurement, Coordinate, long) but uses the default maxDistance of 500 meters which corresponds to WiFi beacons.

See Also:
findBeacon(String, BeaconMeasurement, Coordinate, long)

findBeacon

public Beacon findBeacon(java.lang.String uniqueId,
                         BeaconMeasurement meas,
                         Coordinate currentPosition,
                         long maxDistance)
Given the unique id for a Beacon find the most likely Beacon in this BeaconTracker's mapper given the neighborhood of surrounding Beacons in a {org.placelab.core.BeaconMeasurement} and the current position. It is necessary to specify these things since MAC address spoofing and manufacturing errors can make the unique ids less than perfectly unique.

Parameters:
uniqueId - the unique identifier for the Beacon you wish you look up.
meas - of which the beacon you are trying to look up is a part.
currentPosition - your best guess as to the current location
maxDistance - the furthest distance that Beacons of this type can expect to be heard for instance, for WiFi, 500 meters is a good approximation.
Returns:
the most likely Beacon for the given address, BeaconMeasurement, and current position

pickBeacon

public static Beacon pickBeacon(java.util.Vector beacons,
                                BeaconMeasurement meas,
                                Coordinate currentPosition)
Like pickBeacon(Vector, BeaconMeasurement, Coordinate, long) but uses the default maxDistance of 500 meters which corresponds to WiFi beacons.


pickBeacon

public static Beacon pickBeacon(java.util.Vector beacons,
                                BeaconMeasurement meas,
                                Coordinate currentPosition,
                                long maxDistance)
A convenience method for choosing the most likely beacon from a Vector of beacons returned from a Mapper. Generally, you will just use the instance method findBeacon, rather than going here.

Parameters:
beacons - the Vector of beacons
meas - the measurement of which the beacon is a part (the neighborhood)
currentPosition - your best guess for the current position
maxDistance - the furthest distance that Beacons of this type can expect to be heard for instance, for WiFi, 500 meters is a good approximation.
Returns:
the most likely Beacon out of the Vector for the given address, BeaconMeasurement, and current position