org.placelab.client
Class PlacelabWithProxy

java.lang.Object
  extended byorg.placelab.client.PlacelabWithProxy
All Implemented Interfaces:
java.lang.Runnable, ShutdownListener

public class PlacelabWithProxy
extends java.lang.Object
implements ShutdownListener, java.lang.Runnable

A useful class that manages a spotter and a set of trackers for the program. Many simple application can use this as their core class. This object can be constructed by explicitly passing in spotters and tracker, or by letting it create default spotters and trackers. This object can also be configured to either ping the spotter and trackers automatically at a predetermined interval, or rely on manual pinging via the pulse method. This object also has a side effect that it creates an org.placelab.proxy.ProxyServletEnginethat is active for the duration of the execution. It is important to call the createProxy() method to ensure that the proxy object is active.


Field Summary
static int spotterDelay
           
 
Constructor Summary
PlacelabWithProxy()
          This constructor creates a PlacelabWithProxy object that with a WiFiSpotterand a org.placelab.tracker.CentroidTracker.
PlacelabWithProxy(Spotter _spotter, Tracker tracker, Mapper mapper, int spotterDelay)
          This constructor allows all arguments (spotters, trackers and pulse frequency) to be passed in.
PlacelabWithProxy(Tracker tracker, Mapper mapper, int spotterDelay)
          This constructor is similar to the no-arg constructor, except that it uses the tracker passed in and the pulse frequency that is passed in.
 
Method Summary
 void addEstimateListener(EstimateListener listener)
          Add a listener that will be called back when the tracker's position estimates change
 void addShutdownListener(ShutdownListener listener)
          Allows an application to register to find out when the place lab infrastructure is being shut down.
 void createProxy()
          Start up the http proxy.
 Mapper getMapper()
           
 Spotter getSpotter()
           
 Tracker getTracker()
          Return the tracker the PlaceLab object is maintaining
static void main(java.lang.String[] args)
          This entry point causes a default PlacelabWithProxy object to be created at which point the program goes idle and does not exit.
 Measurement pulse()
           
 void run()
          This method implements the core execution loop for the pulsing.
 void shutdown()
          Shuts the proxy and pulsing off.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

spotterDelay

public static int spotterDelay
Constructor Detail

PlacelabWithProxy

public PlacelabWithProxy()
                  throws java.io.IOException
This constructor creates a PlacelabWithProxy object that with a WiFiSpotterand a org.placelab.tracker.CentroidTracker. This object will pulse the spotter once every 2000 ms by default.


PlacelabWithProxy

public PlacelabWithProxy(Tracker tracker,
                         Mapper mapper,
                         int spotterDelay)
                  throws java.io.IOException
This constructor is similar to the no-arg constructor, except that it uses the tracker passed in and the pulse frequency that is passed in. Setting the spotterDelay to -1 will cause the PlacelabWithProxy object to not pulse automatically


PlacelabWithProxy

public PlacelabWithProxy(Spotter _spotter,
                         Tracker tracker,
                         Mapper mapper,
                         int spotterDelay)
                  throws java.io.IOException
This constructor allows all arguments (spotters, trackers and pulse frequency) to be passed in.

Method Detail

createProxy

public void createProxy()
Start up the http proxy.


addEstimateListener

public void addEstimateListener(EstimateListener listener)
Add a listener that will be called back when the tracker's position estimates change


getTracker

public Tracker getTracker()
Return the tracker the PlaceLab object is maintaining


getMapper

public Mapper getMapper()

getSpotter

public Spotter getSpotter()

main

public static void main(java.lang.String[] args)
This entry point causes a default PlacelabWithProxy object to be created at which point the program goes idle and does not exit. The created org.placelab.proxy.ProxyServletEnginemakes this a good entry point for applications with no local UI that want to make use of the web proxy and servlet features.


shutdown

public void shutdown()
Shuts the proxy and pulsing off.

Specified by:
shutdown in interface ShutdownListener

addShutdownListener

public void addShutdownListener(ShutdownListener listener)
Allows an application to register to find out when the place lab infrastructure is being shut down.


pulse

public Measurement pulse()

run

public void run()
This method implements the core execution loop for the pulsing.

Specified by:
run in interface java.lang.Runnable