Package com.tinkerforge
Class BrickletGPS
- java.lang.Object
-
- com.tinkerforge.DeviceBase
-
- com.tinkerforge.Device
-
- com.tinkerforge.BrickletGPS
-
public class BrickletGPS extends Device
Determine position, velocity and altitude using GPS
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
BrickletGPS.Altitude
static interface
BrickletGPS.AltitudeListener
This listener is triggered periodically with the period that is set bysetAltitudeCallbackPeriod(long)
.class
BrickletGPS.Coordinates
static interface
BrickletGPS.CoordinatesListener
This listener is triggered periodically with the period that is set bysetCoordinatesCallbackPeriod(long)
.class
BrickletGPS.DateTime
static interface
BrickletGPS.DateTimeListener
This listener is triggered periodically with the period that is set bysetDateTimeCallbackPeriod(long)
.class
BrickletGPS.Motion
static interface
BrickletGPS.MotionListener
This listener is triggered periodically with the period that is set bysetMotionCallbackPeriod(long)
.class
BrickletGPS.Status
static interface
BrickletGPS.StatusListener
This listener is triggered periodically with the period that is set bysetStatusCallbackPeriod(long)
.-
Nested classes/interfaces inherited from class com.tinkerforge.Device
Device.Identity
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description BrickletGPS(java.lang.String uid, IPConnection ipcon)
Creates an object with the unique device ID \c uid.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAltitudeListener(BrickletGPS.AltitudeListener listener)
Adds a Altitude listener.void
addCoordinatesListener(BrickletGPS.CoordinatesListener listener)
Adds a Coordinates listener.void
addDateTimeListener(BrickletGPS.DateTimeListener listener)
Adds a DateTime listener.void
addMotionListener(BrickletGPS.MotionListener listener)
Adds a Motion listener.void
addStatusListener(BrickletGPS.StatusListener listener)
Adds a Status listener.BrickletGPS.Altitude
getAltitude()
Returns the current altitude and corresponding geoidal separation.long
getAltitudeCallbackPeriod()
Returns the period as set bysetAltitudeCallbackPeriod(long)
.BrickletGPS.Coordinates
getCoordinates()
Returns the GPS coordinates.long
getCoordinatesCallbackPeriod()
Returns the period as set bysetCoordinatesCallbackPeriod(long)
.BrickletGPS.DateTime
getDateTime()
Returns the current date and time.long
getDateTimeCallbackPeriod()
Returns the period as set bysetDateTimeCallbackPeriod(long)
.Device.Identity
getIdentity()
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.BrickletGPS.Motion
getMotion()
Returns the current course and speed.long
getMotionCallbackPeriod()
Returns the period as set bysetMotionCallbackPeriod(long)
.BrickletGPS.Status
getStatus()
Returns the current fix status, the number of satellites that are in view and the number of satellites that are currently used.long
getStatusCallbackPeriod()
Returns the period as set bysetStatusCallbackPeriod(long)
.void
removeAltitudeListener(BrickletGPS.AltitudeListener listener)
Removes a Altitude listener.void
removeCoordinatesListener(BrickletGPS.CoordinatesListener listener)
Removes a Coordinates listener.void
removeDateTimeListener(BrickletGPS.DateTimeListener listener)
Removes a DateTime listener.void
removeMotionListener(BrickletGPS.MotionListener listener)
Removes a Motion listener.void
removeStatusListener(BrickletGPS.StatusListener listener)
Removes a Status listener.void
restart(short restartType)
Restarts the GPS Bricklet, the following restart types are available: \verbatim "Value", "Description" "0", "Hot start (use all available data in the NV store)" "1", "Warm start (don't use ephemeris at restart)" "2", "Cold start (don't use time, position, almanacs and ephemeris at restart)" "3", "Factory reset (clear all system/user configurations at restart)" \endverbatimvoid
setAltitudeCallbackPeriod(long period)
Sets the period with which theBrickletGPS.AltitudeListener
listener is triggered periodically.void
setCoordinatesCallbackPeriod(long period)
Sets the period with which theBrickletGPS.CoordinatesListener
listener is triggered periodically.void
setDateTimeCallbackPeriod(long period)
Sets the period with which theBrickletGPS.DateTimeListener
listener is triggered periodically.void
setMotionCallbackPeriod(long period)
Sets the period with which theBrickletGPS.MotionListener
listener is triggered periodically.void
setStatusCallbackPeriod(long period)
Sets the period with which theBrickletGPS.StatusListener
listener is triggered periodically.-
Methods inherited from class com.tinkerforge.DeviceBase
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
-
-
-
-
Field Detail
-
DEVICE_IDENTIFIER
public static final int DEVICE_IDENTIFIER
- See Also:
- Constant Field Values
-
DEVICE_DISPLAY_NAME
public static final java.lang.String DEVICE_DISPLAY_NAME
- See Also:
- Constant Field Values
-
FUNCTION_GET_COORDINATES
public static final byte FUNCTION_GET_COORDINATES
- See Also:
- Constant Field Values
-
FUNCTION_GET_STATUS
public static final byte FUNCTION_GET_STATUS
- See Also:
- Constant Field Values
-
FUNCTION_GET_ALTITUDE
public static final byte FUNCTION_GET_ALTITUDE
- See Also:
- Constant Field Values
-
FUNCTION_GET_MOTION
public static final byte FUNCTION_GET_MOTION
- See Also:
- Constant Field Values
-
FUNCTION_GET_DATE_TIME
public static final byte FUNCTION_GET_DATE_TIME
- See Also:
- Constant Field Values
-
FUNCTION_RESTART
public static final byte FUNCTION_RESTART
- See Also:
- Constant Field Values
-
FUNCTION_SET_COORDINATES_CALLBACK_PERIOD
public static final byte FUNCTION_SET_COORDINATES_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_COORDINATES_CALLBACK_PERIOD
public static final byte FUNCTION_GET_COORDINATES_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_SET_STATUS_CALLBACK_PERIOD
public static final byte FUNCTION_SET_STATUS_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_STATUS_CALLBACK_PERIOD
public static final byte FUNCTION_GET_STATUS_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD
public static final byte FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD
public static final byte FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_SET_MOTION_CALLBACK_PERIOD
public static final byte FUNCTION_SET_MOTION_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_MOTION_CALLBACK_PERIOD
public static final byte FUNCTION_GET_MOTION_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD
public static final byte FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD
public static final byte FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_IDENTITY
public static final byte FUNCTION_GET_IDENTITY
- See Also:
- Constant Field Values
-
FIX_NO_FIX
public static final short FIX_NO_FIX
- See Also:
- Constant Field Values
-
FIX_2D_FIX
public static final short FIX_2D_FIX
- See Also:
- Constant Field Values
-
FIX_3D_FIX
public static final short FIX_3D_FIX
- See Also:
- Constant Field Values
-
RESTART_TYPE_HOT_START
public static final short RESTART_TYPE_HOT_START
- See Also:
- Constant Field Values
-
RESTART_TYPE_WARM_START
public static final short RESTART_TYPE_WARM_START
- See Also:
- Constant Field Values
-
RESTART_TYPE_COLD_START
public static final short RESTART_TYPE_COLD_START
- See Also:
- Constant Field Values
-
RESTART_TYPE_FACTORY_RESET
public static final short RESTART_TYPE_FACTORY_RESET
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BrickletGPS
public BrickletGPS(java.lang.String uid, IPConnection ipcon)
Creates an object with the unique device ID \c uid. and adds it to the IP Connection \c ipcon.
-
-
Method Detail
-
getCoordinates
public BrickletGPS.Coordinates getCoordinates() throws TinkerforgeException
Returns the GPS coordinates. Latitude and longitude are given in the ``DD.dddddd°`` format, the value 57123468 means 57.123468°. The parameter ``ns`` and ``ew`` are the cardinal directions for latitude and longitude. Possible values for ``ns`` and ``ew`` are 'N', 'S', 'E' and 'W' (north, south, east and west). PDOP, HDOP and VDOP are the dilution of precision (DOP) values. They specify the additional multiplicative effect of GPS satellite geometry on GPS precision. See `here <https://en.wikipedia.org/wiki/Dilution_of_precision_(GPS)>`__ for more information. EPE is the "Estimated Position Error". This is not the absolute maximum error, it is the error with a specific confidence. See `here <https://www.nps.gov/gis/gps/WhatisEPE.html>`__ for more information. This data is only valid if there is currently a fix as indicated bygetStatus()
.- Throws:
TinkerforgeException
-
getStatus
public BrickletGPS.Status getStatus() throws TinkerforgeException
Returns the current fix status, the number of satellites that are in view and the number of satellites that are currently used. Possible fix status values can be: \verbatim "Value", "Description" "1", "No Fix,getCoordinates()
,getAltitude()
andgetMotion()
return invalid data" "2", "2D Fix, onlygetCoordinates()
andgetMotion()
return valid data" "3", "3D Fix,getCoordinates()
,getAltitude()
andgetMotion()
return valid data" \endverbatim There is also a :ref:`blue LED <gps_bricklet_fix_led>` on the Bricklet that indicates the fix status.- Throws:
TinkerforgeException
-
getAltitude
public BrickletGPS.Altitude getAltitude() throws TinkerforgeException
Returns the current altitude and corresponding geoidal separation. This data is only valid if there is currently a fix as indicated bygetStatus()
.- Throws:
TinkerforgeException
-
getMotion
public BrickletGPS.Motion getMotion() throws TinkerforgeException
Returns the current course and speed. A course of 0° means the Bricklet is traveling north bound and 90° means it is traveling east bound. Please note that this only returns useful values if an actual movement is present. This data is only valid if there is currently a fix as indicated bygetStatus()
.- Throws:
TinkerforgeException
-
getDateTime
public BrickletGPS.DateTime getDateTime() throws TinkerforgeException
Returns the current date and time. The date is given in the format ``ddmmyy`` and the time is given in the format ``hhmmss.sss``. For example, 140713 means 14.07.13 as date and 195923568 means 19:59:23.568 as time.- Throws:
TinkerforgeException
-
restart
public void restart(short restartType) throws TinkerforgeException
Restarts the GPS Bricklet, the following restart types are available: \verbatim "Value", "Description" "0", "Hot start (use all available data in the NV store)" "1", "Warm start (don't use ephemeris at restart)" "2", "Cold start (don't use time, position, almanacs and ephemeris at restart)" "3", "Factory reset (clear all system/user configurations at restart)" \endverbatim- Throws:
TinkerforgeException
-
setCoordinatesCallbackPeriod
public void setCoordinatesCallbackPeriod(long period) throws TinkerforgeException
Sets the period with which theBrickletGPS.CoordinatesListener
listener is triggered periodically. A value of 0 turns the listener off. TheBrickletGPS.CoordinatesListener
listener is only triggered if the coordinates changed since the last triggering.- Throws:
TinkerforgeException
-
getCoordinatesCallbackPeriod
public long getCoordinatesCallbackPeriod() throws TinkerforgeException
Returns the period as set bysetCoordinatesCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
setStatusCallbackPeriod
public void setStatusCallbackPeriod(long period) throws TinkerforgeException
Sets the period with which theBrickletGPS.StatusListener
listener is triggered periodically. A value of 0 turns the listener off. TheBrickletGPS.StatusListener
listener is only triggered if the status changed since the last triggering.- Throws:
TinkerforgeException
-
getStatusCallbackPeriod
public long getStatusCallbackPeriod() throws TinkerforgeException
Returns the period as set bysetStatusCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
setAltitudeCallbackPeriod
public void setAltitudeCallbackPeriod(long period) throws TinkerforgeException
Sets the period with which theBrickletGPS.AltitudeListener
listener is triggered periodically. A value of 0 turns the listener off. TheBrickletGPS.AltitudeListener
listener is only triggered if the altitude changed since the last triggering.- Throws:
TinkerforgeException
-
getAltitudeCallbackPeriod
public long getAltitudeCallbackPeriod() throws TinkerforgeException
Returns the period as set bysetAltitudeCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
setMotionCallbackPeriod
public void setMotionCallbackPeriod(long period) throws TinkerforgeException
Sets the period with which theBrickletGPS.MotionListener
listener is triggered periodically. A value of 0 turns the listener off. TheBrickletGPS.MotionListener
listener is only triggered if the motion changed since the last triggering.- Throws:
TinkerforgeException
-
getMotionCallbackPeriod
public long getMotionCallbackPeriod() throws TinkerforgeException
Returns the period as set bysetMotionCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
setDateTimeCallbackPeriod
public void setDateTimeCallbackPeriod(long period) throws TinkerforgeException
Sets the period with which theBrickletGPS.DateTimeListener
listener is triggered periodically. A value of 0 turns the listener off. TheBrickletGPS.DateTimeListener
listener is only triggered if the date or time changed since the last triggering.- Throws:
TinkerforgeException
-
getDateTimeCallbackPeriod
public long getDateTimeCallbackPeriod() throws TinkerforgeException
Returns the period as set bysetDateTimeCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
getIdentity
public Device.Identity getIdentity() throws TinkerforgeException
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier. The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at position 'z'. The device identifier numbers can be found :ref:`here <device_identifier>`. |device_identifier_constant|- Specified by:
getIdentity
in classDevice
- Throws:
TinkerforgeException
-
addCoordinatesListener
public void addCoordinatesListener(BrickletGPS.CoordinatesListener listener)
Adds a Coordinates listener.
-
removeCoordinatesListener
public void removeCoordinatesListener(BrickletGPS.CoordinatesListener listener)
Removes a Coordinates listener.
-
addStatusListener
public void addStatusListener(BrickletGPS.StatusListener listener)
Adds a Status listener.
-
removeStatusListener
public void removeStatusListener(BrickletGPS.StatusListener listener)
Removes a Status listener.
-
addAltitudeListener
public void addAltitudeListener(BrickletGPS.AltitudeListener listener)
Adds a Altitude listener.
-
removeAltitudeListener
public void removeAltitudeListener(BrickletGPS.AltitudeListener listener)
Removes a Altitude listener.
-
addMotionListener
public void addMotionListener(BrickletGPS.MotionListener listener)
Adds a Motion listener.
-
removeMotionListener
public void removeMotionListener(BrickletGPS.MotionListener listener)
Removes a Motion listener.
-
addDateTimeListener
public void addDateTimeListener(BrickletGPS.DateTimeListener listener)
Adds a DateTime listener.
-
removeDateTimeListener
public void removeDateTimeListener(BrickletGPS.DateTimeListener listener)
Removes a DateTime listener.
-
-