|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.iu.gps.VRMI
The VRMI class encapsulates all "higher" GPS funcionality. Mainly, VRMI deals with the various kinds of triggers: - time-based triggers (periodical reporting) - distance-based triggers - region-based triggers (if the user enters/exits a given polygonal area)
Field Summary | |
protected boolean |
die
|
protected GPSDriver |
gpsDriver
|
protected GPSInfo |
gpsInfo
|
protected static int |
triggerid
|
protected java.util.Vector |
triggers
|
Constructor Summary | |
VRMI(GPSDriver _gpsDriver)
Main constructor |
Method Summary | |
int |
addDistanceTrigger(VRMITriggerListener recv,
boolean persistant,
double ds,
long dt)
Adds a trigger that reports the new location if the current location changes more than a given distance, or if the user did not move for longer than a given period of time. |
int |
addPeriodicTrigger(VRMITriggerListener recv,
boolean persistant,
long dt)
Adds a trigger that periodically reports the current location. |
int |
addRegionTrigger(VRMITriggerListener recv,
boolean persistant,
double[][] region,
boolean enter,
boolean exit)
Adds a trigger that reports if the user enters or exits a given region. |
protected int |
addTrigger(TriggerInfo ti)
Private method to add a trigger to the triggers vector. |
protected void |
checkTriggers()
Checks in list of triggers if a trigger has to be sent. |
protected void |
finalize()
Method |
GPSInfo |
getCurrentGPSInfo()
Return current GPS info as retrieved latest from GPS driver. |
void |
gpsEvent(GPSInfo _gpsInfo)
GPS callback. |
static boolean |
pointInPoly(double[][] poly,
double[] p)
Test if the given point is within a polygon. |
void |
removeTrigger(int id)
Remove the trigger given in |
void |
run()
In this thread, we call checkTriggers every second to be sure that time triggers are send even if the GPS driver does not deliver events. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static int triggerid
protected GPSDriver gpsDriver
protected java.util.Vector triggers
protected boolean die
protected GPSInfo gpsInfo
Constructor Detail |
public VRMI(GPSDriver _gpsDriver) throws java.lang.Exception
_gpsDriver
- Parameterjava.lang.Exception
- ExceptionMethod Detail |
public static boolean pointInPoly(double[][] poly, double[] p)
poly
- The 2D-polygon to use.p
- The 2D-point to test for inclusion.public GPSInfo getCurrentGPSInfo()
public int addPeriodicTrigger(VRMITriggerListener recv, boolean persistant, long dt)
recv
- The VRMICallback that receives the trigger.persistant
- Specifies if trigger is one-shot (false) or
persistant(true)dt
- Period of time in milliseconds.public int addDistanceTrigger(VRMITriggerListener recv, boolean persistant, double ds, long dt)
recv
- The VRMICallback that receives the trigger.persistant
- Specifies if trigger is one-shot (false) or
persistant(true)ds
- Distance in meters.dt
- Period of time in milliseconds.public int addRegionTrigger(VRMITriggerListener recv, boolean persistant, double[][] region, boolean enter, boolean exit)
recv
- The VRMICallback that receives the trigger.persistant
- Specifies if trigger is one-shot (false) or
persistant(true)region
- 2D-polygon that specifies the region.enter
- Specifies if entering the region should be reported.exit
- Specifies if exiting the region should be reported.public void removeTrigger(int id)
id
- Parameterpublic void gpsEvent(GPSInfo _gpsInfo)
gpsEvent
in interface GPSListener
_gpsInfo
- Parameterpublic void run()
run
in interface java.lang.Runnable
protected void finalize()
finalize
in class java.lang.Object
protected void checkTriggers()
protected int addTrigger(TriggerInfo ti)
ti
- The feature to be added to the Trigger attribute
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |