com.phidgets
Class GPSPhidget

java.lang.Object
  extended bycom.phidgets.Phidget
      extended bycom.phidgets.GPSPhidget

public final class GPSPhidget
extends Phidget

This class represents a Phidget GPS. All methods to manipulate the Phidget GPS are implemented in this class.

Author:
Phidgets Inc.

Field Summary
 
Fields inherited from class com.phidgets.Phidget
PHIDCLASS_ACCELEROMETER, PHIDCLASS_ADVANCEDSERVO, PHIDCLASS_ANALOG, PHIDCLASS_BRIDGE, PHIDCLASS_ENCODER, PHIDCLASS_FREQUENCYCOUNTER, PHIDCLASS_GPS, PHIDCLASS_INTERFACEKIT, PHIDCLASS_LED, PHIDCLASS_MOTORCONTROL, PHIDCLASS_NOTHING, PHIDCLASS_PHSENSOR, PHIDCLASS_RFID, PHIDCLASS_SERVO, PHIDCLASS_STEPPER, PHIDCLASS_TEMPERATURESENSOR, PHIDCLASS_TEXTLCD, PHIDCLASS_TEXTLED, PHIDCLASS_WEIGHTSENSOR, PHIDGET_LOG_CRITICAL, PHIDGET_LOG_DEBUG, PHIDGET_LOG_ERROR, PHIDGET_LOG_INFO, PHIDGET_LOG_VERBOSE, PHIDGET_LOG_WARNING, PHIDID_ACCELEROMETER_2AXIS, PHIDID_ACCELEROMETER_3AXIS, PHIDID_ADVANCEDSERVO_1MOTOR, PHIDID_ADVANCEDSERVO_8MOTOR, PHIDID_ANALOG_4OUTPUT, PHIDID_BIPOLAR_STEPPER_1MOTOR, PHIDID_BRIDGE_4INPUT, PHIDID_ENCODER_1ENCODER_1INPUT, PHIDID_ENCODER_HS_1ENCODER, PHIDID_ENCODER_HS_4ENCODER_4INPUT, PHIDID_FREQUENCYCOUNTER_2INPUT, PHIDID_GPS, PHIDID_INTERFACEKIT_0_0_4, PHIDID_INTERFACEKIT_0_0_8, PHIDID_INTERFACEKIT_0_16_16, PHIDID_INTERFACEKIT_0_8_8_w_LCD, PHIDID_INTERFACEKIT_2_2_2, PHIDID_INTERFACEKIT_4_8_8, PHIDID_INTERFACEKIT_8_8_8, PHIDID_INTERFACEKIT_8_8_8_w_LCD, PHIDID_IR, PHIDID_LED_64, PHIDID_LED_64_ADV, PHIDID_LINEAR_TOUCH, PHIDID_MOTORCONTROL_1MOTOR, PHIDID_MOTORCONTROL_HC_2MOTOR, PHIDID_MOTORCONTROL_LV_2MOTOR_4INPUT, PHIDID_NOTHING, PHIDID_PHSENSOR, PHIDID_RFID, PHIDID_RFID_2OUTPUT, PHIDID_RFID_2OUTPUT_READ_WRITE, PHIDID_ROTARY_TOUCH, PHIDID_SERVO_1MOTOR, PHIDID_SERVO_1MOTOR_OLD, PHIDID_SERVO_4MOTOR, PHIDID_SERVO_4MOTOR_OLD, PHIDID_SPATIAL_ACCEL_3AXIS, PHIDID_SPATIAL_ACCEL_GYRO_COMPASS, PHIDID_TEMPERATURESENSOR, PHIDID_TEMPERATURESENSOR_4, PHIDID_TEMPERATURESENSOR_IR, PHIDID_TEXTLCD_2x20, PHIDID_TEXTLCD_2x20_w_0_8_8, PHIDID_TEXTLCD_2x20_w_8_8_8, PHIDID_TEXTLCD_ADAPTER, PHIDID_TEXTLED_1x8, PHIDID_TEXTLED_4x8, PHIDID_UNIPOLAR_STEPPER_4MOTOR, PHIDID_WEIGHTSENSOR
 
Constructor Summary
GPSPhidget()
           
 
Method Summary
 void addGPSPositionChangeListener(GPSPositionChangeListener l)
          Adds a position change listener.
 void addGPSPositionFixStatusChangeListener(GPSPositionFixStatusChangeListener l)
          Adds a position fix status change listener.
 double getAltitude()
          Returns the current altitude, in meters.
 java.util.Calendar getDateAndTime()
          Returns the current GPS date and time, in UTC.
 double getHeading()
          Returns the current heading, in degrees - compass bearing format.
 double getLatitude()
          Returns the current latitude, in signed degrees format.
 double getLongitude()
          Returns the current longitude, in signed degrees format.
 boolean getPositionFixStatus()
          Returns the current position fix status.
 double getVelocity()
          Returns the current velocity, in km/h.
 void removeGPSPositionChangeListener(GPSPositionChangeListener l)
           
 void removeGPSPositionFixStatusChangeListener(GPSPositionFixStatusChangeListener l)
           
 
Methods inherited from class com.phidgets.Phidget
addAttachListener, addDetachListener, addErrorListener, addServerConnectListener, addServerDisconnectListener, close, disableLogging, enableLogging, equals, getDeviceClass, getDeviceID, getDeviceLabel, getDeviceName, getDeviceType, getDeviceVersion, getLibraryVersion, getSerialNumber, getServerAddress, getServerID, getServerPort, isAttached, isAttachedToServer, log, open, open, open, open, open, openAny, openAny, openAny, openAny, openAny, openLabel, openLabel, openLabel, openLabel, openLabel, removeAttachListener, removeDetachListener, removeErrorListener, removeServerConnectListener, removeServerDisconnectListener, setDeviceLabel, toString, waitForAttachment, waitForAttachment
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GPSPhidget

public GPSPhidget()
           throws PhidgetException
Method Detail

getLatitude

public double getLatitude()
                   throws PhidgetException
Returns the current latitude, in signed degrees format.

Returns:
Current latitude, in signed degrees format.
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the GPS is not plugged into the board. See open for information on determining if a device is attached. If the latitude is not available, an EPHIDGET_UNKNOWNVAL exception is thrown.

getLongitude

public double getLongitude()
                    throws PhidgetException
Returns the current longitude, in signed degrees format.

Returns:
Current longitude, in signed degrees format.
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the GPS is not plugged into the board. See open for information on determining if a device is attached. If the longitude is not available, an EPHIDGET_UNKNOWNVAL exception is thrown.

getAltitude

public double getAltitude()
                   throws PhidgetException
Returns the current altitude, in meters.

Returns:
Current altitude, in meters.
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the GPS is not plugged into the board. See open for information on determining if a device is attached. If the altitude is not available, an EPHIDGET_UNKNOWNVAL exception is thrown.

getHeading

public double getHeading()
                  throws PhidgetException
Returns the current heading, in degrees - compass bearing format. Heading is only accurate if the GPS is moving, and it represents a heading over time, and not the actual direction the PhidgetGPS is pointing. exception is thrown.

Returns:
Heading in degrees(compass bearing format).
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the GPS is not plugged into the board. See open for information on determining if a device is attached. If the heading is not available, an EPHIDGET_UNKNOWNVAL.

getVelocity

public double getVelocity()
                   throws PhidgetException
Returns the current velocity, in km/h. Velocity is only accurate if the PhidgetGPS is moving.

Returns:
Velocity in km/h.
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the GPS is not plugged into the board. See open for information on determining if a device is attached. If the velocity is not available, an EPHIDGET_UNKNOWNVAL exception is thrown.

getDateAndTime

public java.util.Calendar getDateAndTime()
                                  throws PhidgetException
Returns the current GPS date and time, in UTC. The time is updated 10 times a second and is accurate to within at least 500ms when getPositionFixStatus is true.

Returns:
Current GPS date and time.
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the GPS is not plugged into the board. See open for information on determining if a device is attached. If the date or time are not available, an EPHIDGET_UNKNOWNVAL exception is thrown.

getPositionFixStatus

public boolean getPositionFixStatus()
                             throws PhidgetException
Returns the current position fix status. If true, all of the above properties will be available. Time and date may or may not be available, but they can only be trusted as accurate when the PositionFixStatus is true.

Returns:
Current position fix status.
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the GPS is not plugged into the board. See open for information on determining if a device is attached. If false, the getHeading / getVelocity will throw an EPHIDGET_UNKNOWN exception.

addGPSPositionFixStatusChangeListener

public final void addGPSPositionFixStatusChangeListener(GPSPositionFixStatusChangeListener l)
Adds a position fix status change listener. The position fix status change handler is a method that will be called when the position fix status changes.

There is no limit on the number of position fix status change handlers that can be registered for a particular Phidget.

Parameters:
l - An implemetation of the GPSPositionFixStatusChangeListener interface

removeGPSPositionFixStatusChangeListener

public final void removeGPSPositionFixStatusChangeListener(GPSPositionFixStatusChangeListener l)

addGPSPositionChangeListener

public final void addGPSPositionChangeListener(GPSPositionChangeListener l)
Adds a position change listener. The position change handler is a method that will be called when the position changes.

There is no limit on the number of position change handlers that can be registered for a particular Phidget.

Parameters:
l - An implemetation of the GPSPositionChangeListener interface

removeGPSPositionChangeListener

public final void removeGPSPositionChangeListener(GPSPositionChangeListener l)