This is the description of the MQTT API bindings for the GPS Bricklet. General information and technical specifications for the GPS Bricklet are summarized in its hardware description.
An installation guide for the MQTT API bindings is part of their general description.
The example code below is Public Domain (CC0 1.0).
1 2 3 4 5 6 | # Change XYZ to the UID of your GPS Bricklet
setup:
# Get current coordinates
subscribe to tinkerforge/response/gps_bricklet/XYZ/get_coordinates
publish '' to tinkerforge/request/gps_bricklet/XYZ/get_coordinates
|
Download (example-callback.txt)
1 2 3 4 5 6 7 8 9 10 11 | # Change XYZ to the UID of your GPS Bricklet
setup:
# Handle incoming coordinates callbacks
subscribe to tinkerforge/callback/gps_bricklet/XYZ/coordinates
publish '{"register": true}' to tinkerforge/register/gps_bricklet/XYZ/coordinates # Register coordinates callback
# Set period for coordinates callback to 1s (1000ms)
# Note: The coordinates callback is only called every second
# if the coordinates has changed since the last call!
publish '{"period": 1000}' to tinkerforge/request/gps_bricklet/XYZ/set_coordinates_callback_period
|
All published payloads to and from the MQTT bindings are in JSON format.
If an error occures, the bindings publish a JSON object containing the error message as member _ERROR
.
It is published on the corresponding response topic: .../response/...
for .../request/...
and .../callback/...
for .../register/...
.
request/
gps_bricklet/
<UID>/
get_coordinates
¶Request: |
|
---|---|
Response: |
|
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 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 for more information.
This data is only valid if there is currently a fix as indicated by
request/gps_bricklet/<UID>/get_status
.
request/
gps_bricklet/
<UID>/
get_status
¶Request: |
|
---|---|
Response: |
|
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:
Value | Description |
---|---|
1 | No Fix, request/gps_bricklet/<UID>/get_coordinates , request/gps_bricklet/<UID>/get_altitude and request/gps_bricklet/<UID>/get_motion return invalid data |
2 | 2D Fix, only request/gps_bricklet/<UID>/get_coordinates and request/gps_bricklet/<UID>/get_motion return valid data |
3 | 3D Fix, request/gps_bricklet/<UID>/get_coordinates , request/gps_bricklet/<UID>/get_altitude and request/gps_bricklet/<UID>/get_motion return valid data |
There is also a blue LED on the Bricklet that indicates the fix status.
The following symbols are available for this function:
For fix:
request/
gps_bricklet/
<UID>/
get_altitude
¶Request: |
|
---|---|
Response: |
|
Returns the current altitude and corresponding geoidal separation.
This data is only valid if there is currently a fix as indicated by
request/gps_bricklet/<UID>/get_status
.
request/
gps_bricklet/
<UID>/
get_motion
¶Request: |
|
---|---|
Response: |
|
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 by
request/gps_bricklet/<UID>/get_status
.
request/
gps_bricklet/
<UID>/
get_date_time
¶Request: |
|
---|---|
Response: |
|
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.
request/
gps_bricklet/
<UID>/
restart
¶Request: |
|
---|---|
Response: |
|
Restarts the GPS Bricklet, the following restart types are available:
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) |
The following symbols are available for this function:
For restart_type:
request/
gps_bricklet/
<UID>/
get_identity
¶Request: |
|
---|---|
Response: |
|
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 Isolator Bricklet is always at position 'z'.
The device identifier numbers can be found here. If symbolic output is not disabled, the device identifier is mapped to the corresponding name in the format used in topics.
The display name contains the GPS's name in a human readable form.
request/
gps_bricklet/
<UID>/
set_coordinates_callback_period
¶Request: |
|
---|---|
Response: |
|
Sets the period with which the register/gps_bricklet/<UID>/coordinates
callback is triggered
periodically. A value of 0 turns the callback off.
The register/gps_bricklet/<UID>/coordinates
callback is only triggered if the coordinates changed
since the last triggering.
request/
gps_bricklet/
<UID>/
get_coordinates_callback_period
¶Request: |
|
---|---|
Response: |
|
Returns the period as set by request/gps_bricklet/<UID>/set_coordinates_callback_period
.
request/
gps_bricklet/
<UID>/
set_status_callback_period
¶Request: |
|
---|---|
Response: |
|
Sets the period with which the register/gps_bricklet/<UID>/status
callback is triggered
periodically. A value of 0 turns the callback off.
The register/gps_bricklet/<UID>/status
callback is only triggered if the status changed since the
last triggering.
request/
gps_bricklet/
<UID>/
get_status_callback_period
¶Request: |
|
---|---|
Response: |
|
Returns the period as set by request/gps_bricklet/<UID>/set_status_callback_period
.
request/
gps_bricklet/
<UID>/
set_altitude_callback_period
¶Request: |
|
---|---|
Response: |
|
Sets the period with which the register/gps_bricklet/<UID>/altitude
callback is triggered
periodically. A value of 0 turns the callback off.
The register/gps_bricklet/<UID>/altitude
callback is only triggered if the altitude changed since
the last triggering.
request/
gps_bricklet/
<UID>/
get_altitude_callback_period
¶Request: |
|
---|---|
Response: |
|
Returns the period as set by request/gps_bricklet/<UID>/set_altitude_callback_period
.
request/
gps_bricklet/
<UID>/
set_motion_callback_period
¶Request: |
|
---|---|
Response: |
|
Sets the period with which the register/gps_bricklet/<UID>/motion
callback is triggered
periodically. A value of 0 turns the callback off.
The register/gps_bricklet/<UID>/motion
callback is only triggered if the motion changed since the
last triggering.
request/
gps_bricklet/
<UID>/
get_motion_callback_period
¶Request: |
|
---|---|
Response: |
|
Returns the period as set by request/gps_bricklet/<UID>/set_motion_callback_period
.
request/
gps_bricklet/
<UID>/
set_date_time_callback_period
¶Request: |
|
---|---|
Response: |
|
Sets the period with which the register/gps_bricklet/<UID>/date_time
callback is triggered
periodically. A value of 0 turns the callback off.
The register/gps_bricklet/<UID>/date_time
callback is only triggered if the date or time changed
since the last triggering.
request/
gps_bricklet/
<UID>/
get_date_time_callback_period
¶Request: |
|
---|---|
Response: |
|
Returns the period as set by request/gps_bricklet/<UID>/set_date_time_callback_period
.
Callbacks can be registered to receive
time critical or recurring data from the device. The registration is done
with the corresponding .../register/...
topic and an optional suffix.
This suffix can be used to deregister the callback later.
Note
Using callbacks for recurring events is always preferred compared to using getters. It will use less USB bandwidth and the latency will be a lot better, since there is no round trip time.
register/
gps_bricklet/
<UID>/
coordinates
¶Register Request: |
|
---|---|
Callback Response: |
|
A callback can be registered for this event by publishing to the .../register/gps_bricklet/<UID>/coordinates[/<SUFFIX>]
topic with the payload "true".
An added callback can be removed by publishing to the same topic with the payload "false".
To support multiple (de)registrations, e.g. for message filtering, an optional suffix can be used.
If the callback is triggered, a message with it's payload is published under the corresponding .../callback/gps_bricklet/<UID>/coordinates[/<SUFFIX>]
topic for each registered suffix.
This callback is triggered periodically with the period that is set by
request/gps_bricklet/<UID>/set_coordinates_callback_period
. The parameters are the same
as for request/gps_bricklet/<UID>/get_coordinates
.
The register/gps_bricklet/<UID>/coordinates
callback is only triggered if the coordinates changed
since the last triggering and if there is currently a fix as indicated by
request/gps_bricklet/<UID>/get_status
.
register/
gps_bricklet/
<UID>/
status
¶Register Request: |
|
---|---|
Callback Response: |
|
A callback can be registered for this event by publishing to the .../register/gps_bricklet/<UID>/status[/<SUFFIX>]
topic with the payload "true".
An added callback can be removed by publishing to the same topic with the payload "false".
To support multiple (de)registrations, e.g. for message filtering, an optional suffix can be used.
If the callback is triggered, a message with it's payload is published under the corresponding .../callback/gps_bricklet/<UID>/status[/<SUFFIX>]
topic for each registered suffix.
This callback is triggered periodically with the period that is set by
request/gps_bricklet/<UID>/set_status_callback_period
. The parameters are the same
as for request/gps_bricklet/<UID>/get_status
.
The register/gps_bricklet/<UID>/status
callback is only triggered if the status changed since the
last triggering.
The following symbols are available for this function:
For fix:
register/
gps_bricklet/
<UID>/
altitude
¶Register Request: |
|
---|---|
Callback Response: |
|
A callback can be registered for this event by publishing to the .../register/gps_bricklet/<UID>/altitude[/<SUFFIX>]
topic with the payload "true".
An added callback can be removed by publishing to the same topic with the payload "false".
To support multiple (de)registrations, e.g. for message filtering, an optional suffix can be used.
If the callback is triggered, a message with it's payload is published under the corresponding .../callback/gps_bricklet/<UID>/altitude[/<SUFFIX>]
topic for each registered suffix.
This callback is triggered periodically with the period that is set by
request/gps_bricklet/<UID>/set_altitude_callback_period
. The parameters are the same
as for request/gps_bricklet/<UID>/get_altitude
.
The register/gps_bricklet/<UID>/altitude
callback is only triggered if the altitude changed since
the last triggering and if there is currently a fix as indicated by
request/gps_bricklet/<UID>/get_status
.
register/
gps_bricklet/
<UID>/
motion
¶Register Request: |
|
---|---|
Callback Response: |
|
A callback can be registered for this event by publishing to the .../register/gps_bricklet/<UID>/motion[/<SUFFIX>]
topic with the payload "true".
An added callback can be removed by publishing to the same topic with the payload "false".
To support multiple (de)registrations, e.g. for message filtering, an optional suffix can be used.
If the callback is triggered, a message with it's payload is published under the corresponding .../callback/gps_bricklet/<UID>/motion[/<SUFFIX>]
topic for each registered suffix.
This callback is triggered periodically with the period that is set by
request/gps_bricklet/<UID>/set_motion_callback_period
. The parameters are the same
as for request/gps_bricklet/<UID>/get_motion
.
The register/gps_bricklet/<UID>/motion
callback is only triggered if the motion changed since the
last triggering and if there is currently a fix as indicated by
request/gps_bricklet/<UID>/get_status
.
register/
gps_bricklet/
<UID>/
date_time
¶Register Request: |
|
---|---|
Callback Response: |
|
A callback can be registered for this event by publishing to the .../register/gps_bricklet/<UID>/date_time[/<SUFFIX>]
topic with the payload "true".
An added callback can be removed by publishing to the same topic with the payload "false".
To support multiple (de)registrations, e.g. for message filtering, an optional suffix can be used.
If the callback is triggered, a message with it's payload is published under the corresponding .../callback/gps_bricklet/<UID>/date_time[/<SUFFIX>]
topic for each registered suffix.
This callback is triggered periodically with the period that is set by
request/gps_bricklet/<UID>/set_date_time_callback_period
. The parameters are the same
as for request/gps_bricklet/<UID>/get_date_time
.
The register/gps_bricklet/<UID>/date_time
callback is only triggered if the date or time changed
since the last triggering.