|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlocation.LocationServer
LocationServer is the singleton that applications implementing the LocationListener interface register on to receive location information. The LocationServer obtains location information from a LocationGenerator. The LocationGenerator used can be specified by the user using the setLocationGenerator(...) method prior to booting the LocationServer. Once the LocationServer has been booted, the LocationGenerator it is using cannot be changed.
Two LocationGenerators are provided within a subpackage called location.generators. They are: FakeGPSMonitor and RealGPSMonitor. The FakeGPSMonitor provides a graphical user interface that allows the user to "move" around. The RealGPSMonitor reads data from a real GPS unit connected to the serial port.
Additional LocationGenerators may be defined by third parties by implementing the LocationGenerator interface.
The LocationServer supports two types of listeners: LocationListener
and GpsInfoListener
. A LocationListener
is informed
of location information, while a GpsInfoListener
is informed of
GPS status such as the number of satellites.
GpsInfoEvent
,
LocationEvent
,
LocationListener
,
GpsInfoListener
,
Serialized FormField Summary | |
private boolean |
booted
Keeps track of whether this server has been booted. |
private java.util.Vector |
gps_listeners
Holds the listeners that are registered on this server. |
private LocationGenerator |
lg
The LocationGenerator that provides the location. |
private java.util.Vector |
listeners
Holds the listeners that are registered on this server. |
private static LocationServer |
server
This is the singleton LocationServer. |
Constructor Summary | |
private |
LocationServer()
Creates a LocationServer. |
Method Summary | |
void |
addGpsInfoListener(GpsInfoListener gpsinfo)
Adds a GpsInfoListener to this server. |
void |
addLocationListener(LocationListener ll)
Adds a LocationListener to this server. |
void |
boot()
Boots the Location Server. |
private void |
distributeInfo(GpsInfoEvent gpsinfo)
|
private void |
distributeLocation(LocationEvent le)
|
static LocationServer |
getServer()
Returns the LocationServer singleton. |
boolean |
isBooted()
Returns true if the location server is booted. |
void |
locationChanged(LocationEvent le)
This implements the locationlistener interface. |
void |
newGpsInfo(GpsInfoEvent gpsinfo)
This implements the GpsInfolistener interface. |
void |
removeGpsInfoListener(GpsInfoListener gpsinfo)
Removes a GpsInfoListener from this server. |
void |
removeLocationListener(LocationListener ll)
Removes a LocationListener from this server. |
void |
setLocationGenerator(LocationGenerator lg)
Sets the location generated used by this LocationServer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private LocationGenerator lg
private static final LocationServer server
private boolean booted
private java.util.Vector listeners
private java.util.Vector gps_listeners
Constructor Detail |
private LocationServer()
Method Detail |
public void setLocationGenerator(LocationGenerator lg)
public void locationChanged(LocationEvent le)
locationChanged
in interface LocationListener
le
- the new location event.private void distributeLocation(LocationEvent le)
public void newGpsInfo(GpsInfoEvent gpsinfo)
newGpsInfo
in interface GpsInfoListener
gpsinfo
- The new gpsinfoevent.private void distributeInfo(GpsInfoEvent gpsinfo)
public boolean isBooted()
public void boot()
public void addLocationListener(LocationListener ll)
ll
- the LocationListener.public void removeLocationListener(LocationListener ll)
ll
- the LocationListener to be removed.
public void addGpsInfoListener(GpsInfoListener gpsinfo)
gpsinfo
- the GpsInfoListener.public void removeGpsInfoListener(GpsInfoListener gpsinfo)
gpsinfo
- the GpsInfoListener to be removed.
public static LocationServer getServer()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |