Struct tinkerforge::gps_bricklet::GpsBricklet
source · pub struct GpsBricklet { /* private fields */ }
Expand description
Determine position, velocity and altitude using GPS
Implementations
sourceimpl GpsBricklet
impl GpsBricklet
pub const DEVICE_IDENTIFIER: u16 = 222u16
pub const DEVICE_DISPLAY_NAME: &'static str = "GPS Bricklet"
sourcepub fn new(uid: &str, ip_connection: &IpConnection) -> GpsBricklet
pub fn new(uid: &str, ip_connection: &IpConnection) -> GpsBricklet
Creates an object with the unique device ID uid
. This object can then be used after the IP Connection ip_connection
is connected.
sourcepub fn get_response_expected(
&mut self,
fun: GpsBrickletFunction
) -> Result<bool, GetResponseExpectedError>
pub fn get_response_expected(
&mut self,
fun: GpsBrickletFunction
) -> Result<bool, GetResponseExpectedError>
Returns the response expected flag for the function specified by the function ID parameter. It is true if the function is expected to send a response, false otherwise.
For getter functions this is enabled by default and cannot be disabled, because those
functions will always send a response. For callback configuration functions it is enabled
by default too, but can be disabled by set_response_expected
.
For setter functions it is disabled by default and can be enabled.
Enabling the response expected flag for a setter function allows to detect timeouts and other error conditions calls of this setter as well. The device will then send a response for this purpose. If this flag is disabled for a setter function then no response is send and errors are silently ignored, because they cannot be detected.
See set_response_expected
for the list of function ID constants available for this function.
sourcepub fn set_response_expected(
&mut self,
fun: GpsBrickletFunction,
response_expected: bool
) -> Result<(), SetResponseExpectedError>
pub fn set_response_expected(
&mut self,
fun: GpsBrickletFunction,
response_expected: bool
) -> Result<(), SetResponseExpectedError>
Changes the response expected flag of the function specified by the function ID parameter. This flag can only be changed for setter (default value: false) and callback configuration functions (default value: true). For getter functions it is always enabled.
Enabling the response expected flag for a setter function allows to detect timeouts and other error conditions calls of this setter as well. The device will then send a response for this purpose. If this flag is disabled for a setter function then no response is send and errors are silently ignored, because they cannot be detected.
sourcepub fn set_response_expected_all(&mut self, response_expected: bool)
pub fn set_response_expected_all(&mut self, response_expected: bool)
Changes the response expected flag for all setter and callback configuration functions of this device at once.
sourcepub fn get_coordinates_callback_receiver(
&self
) -> ConvertingCallbackReceiver<CoordinatesEvent>
pub fn get_coordinates_callback_receiver(
&self
) -> ConvertingCallbackReceiver<CoordinatesEvent>
This receiver is triggered periodically with the period that is set by
Set Coordinates Receiver Period
. The parameters are the same
as for Get Coordinates
.
The get_coordinates_callback_receiver
receiver is only triggered if the coordinates changed
since the last triggering and if there is currently a fix as indicated by
Get Status
.
sourcepub fn get_status_callback_receiver(
&self
) -> ConvertingCallbackReceiver<StatusEvent>
pub fn get_status_callback_receiver(
&self
) -> ConvertingCallbackReceiver<StatusEvent>
This receiver is triggered periodically with the period that is set by
Set Status Receiver Period
. The parameters are the same
as for Get Status
.
The get_status_callback_receiver
receiver is only triggered if the status changed since the
last triggering.
sourcepub fn get_altitude_callback_receiver(
&self
) -> ConvertingCallbackReceiver<AltitudeEvent>
pub fn get_altitude_callback_receiver(
&self
) -> ConvertingCallbackReceiver<AltitudeEvent>
This receiver is triggered periodically with the period that is set by
Set Altitude Receiver Period
. The parameters are the same
as for Get Altitude
.
The get_altitude_callback_receiver
receiver is only triggered if the altitude changed since
the last triggering and if there is currently a fix as indicated by
Get Status
.
sourcepub fn get_motion_callback_receiver(
&self
) -> ConvertingCallbackReceiver<MotionEvent>
pub fn get_motion_callback_receiver(
&self
) -> ConvertingCallbackReceiver<MotionEvent>
This receiver is triggered periodically with the period that is set by
Set Motion Receiver Period
. The parameters are the same
as for Get Motion
.
The get_motion_callback_receiver
receiver is only triggered if the motion changed since the
last triggering and if there is currently a fix as indicated by
Get Status
.
sourcepub fn get_date_time_callback_receiver(
&self
) -> ConvertingCallbackReceiver<DateTimeEvent>
pub fn get_date_time_callback_receiver(
&self
) -> ConvertingCallbackReceiver<DateTimeEvent>
This receiver is triggered periodically with the period that is set by
Set Date Time Receiver Period
. The parameters are the same
as for Get Date Time
.
The get_date_time_callback_receiver
receiver is only triggered if the date or time changed
since the last triggering.
sourcepub fn get_coordinates(&self) -> ConvertingReceiver<Coordinates>
pub fn get_coordinates(&self) -> ConvertingReceiver<Coordinates>
Returns the GPS coordinates. Latitude and longitude are given in the
[`DD.dddddd°format, the value 57123468 means 57.123468°. The parameter
nsand
eware the cardinal directions for latitude and longitude. Possible values for
nsand
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. The values are give in hundredths.
EPE is the Estimated Position Error. The EPE is given in cm. 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
Get Status
.
sourcepub fn get_status(&self) -> ConvertingReceiver<Status>
pub fn get_status(&self) -> ConvertingReceiver<Status>
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 |
2 | 2D Fix |
3 | 3D Fix |
There is also a `blue LED](gps_bricklet_fix_led) on the Bricklet that indicates the fix status.
Associated constants:
- GPSBRICKLET_FIX_NO_FIX
- GPSBRICKLET_FIX_2D_FIX
- GPSBRICKLET_FIX_3D_FIX
sourcepub fn get_altitude(&self) -> ConvertingReceiver<Altitude>
pub fn get_altitude(&self) -> ConvertingReceiver<Altitude>
Returns the current altitude and corresponding geoidal separation.
Both values are given in cm.
This data is only valid if there is currently a fix as indicated by
Get Status
.
sourcepub fn get_motion(&self) -> ConvertingReceiver<Motion>
pub fn get_motion(&self) -> ConvertingReceiver<Motion>
Returns the current course and speed. Course is given in hundredths degree and speed is given in hundredths km/h. 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
Get Status
.
sourcepub fn get_date_time(&self) -> ConvertingReceiver<DateTime>
pub fn get_date_time(&self) -> ConvertingReceiver<DateTime>
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.05.13 as date and 195923568 means 19:59:23.568 as time.
sourcepub fn restart(&self, restart_type: u8) -> ConvertingReceiver<()>
pub fn restart(&self, restart_type: u8) -> ConvertingReceiver<()>
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 |
3 | Factory reset (clear all system/user configurations at restart) |
Associated constants:
- GPSBRICKLET_RESTART_TYPE_HOT_START
- GPSBRICKLET_RESTART_TYPE_WARM_START
- GPSBRICKLET_RESTART_TYPE_COLD_START
- GPSBRICKLET_RESTART_TYPE_FACTORY_RESET
sourcepub fn set_coordinates_callback_period(
&self,
period: u32
) -> ConvertingReceiver<()>
pub fn set_coordinates_callback_period(
&self,
period: u32
) -> ConvertingReceiver<()>
Sets the period in ms with which the get_coordinates_callback_receiver
receiver is triggered
periodically. A value of 0 turns the receiver off.
The get_coordinates_callback_receiver
receiver is only triggered if the coordinates changed
since the last triggering.
The default value is 0.
sourcepub fn get_coordinates_callback_period(&self) -> ConvertingReceiver<u32>
pub fn get_coordinates_callback_period(&self) -> ConvertingReceiver<u32>
Returns the period as set by Set Coordinates Receiver Period
.
sourcepub fn set_status_callback_period(&self, period: u32) -> ConvertingReceiver<()>
pub fn set_status_callback_period(&self, period: u32) -> ConvertingReceiver<()>
Sets the period in ms with which the get_status_callback_receiver
receiver is triggered
periodically. A value of 0 turns the receiver off.
The get_status_callback_receiver
receiver is only triggered if the status changed since the
last triggering.
The default value is 0.
sourcepub fn get_status_callback_period(&self) -> ConvertingReceiver<u32>
pub fn get_status_callback_period(&self) -> ConvertingReceiver<u32>
Returns the period as set by Set Status Receiver Period
.
sourcepub fn set_altitude_callback_period(&self, period: u32) -> ConvertingReceiver<()>
pub fn set_altitude_callback_period(&self, period: u32) -> ConvertingReceiver<()>
Sets the period in ms with which the get_altitude_callback_receiver
receiver is triggered
periodically. A value of 0 turns the receiver off.
The get_altitude_callback_receiver
receiver is only triggered if the altitude changed since
the last triggering.
The default value is 0.
sourcepub fn get_altitude_callback_period(&self) -> ConvertingReceiver<u32>
pub fn get_altitude_callback_period(&self) -> ConvertingReceiver<u32>
Returns the period as set by Set Altitude Receiver Period
.
sourcepub fn set_motion_callback_period(&self, period: u32) -> ConvertingReceiver<()>
pub fn set_motion_callback_period(&self, period: u32) -> ConvertingReceiver<()>
Sets the period in ms with which the get_motion_callback_receiver
receiver is triggered
periodically. A value of 0 turns the receiver off.
The get_motion_callback_receiver
receiver is only triggered if the motion changed since the
last triggering.
The default value is 0.
sourcepub fn get_motion_callback_period(&self) -> ConvertingReceiver<u32>
pub fn get_motion_callback_period(&self) -> ConvertingReceiver<u32>
Returns the period as set by Set Motion Receiver Period
.
sourcepub fn set_date_time_callback_period(
&self,
period: u32
) -> ConvertingReceiver<()>
pub fn set_date_time_callback_period(
&self,
period: u32
) -> ConvertingReceiver<()>
Sets the period in ms with which the get_date_time_callback_receiver
receiver is triggered
periodically. A value of 0 turns the receiver off.
The get_date_time_callback_receiver
receiver is only triggered if the date or time changed
since the last triggering.
The default value is 0.
sourcepub fn get_date_time_callback_period(&self) -> ConvertingReceiver<u32>
pub fn get_date_time_callback_period(&self) -> ConvertingReceiver<u32>
Returns the period as set by Set Date Time Receiver Period
.
sourcepub fn get_identity(&self) -> ConvertingReceiver<Identity>
pub fn get_identity(&self) -> ConvertingReceiver<Identity>
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’ or ‘d’.
The device identifier numbers can be found here. |device_identifier_constant|
Trait Implementations
sourceimpl Clone for GpsBricklet
impl Clone for GpsBricklet
sourcefn clone(&self) -> GpsBricklet
fn clone(&self) -> GpsBricklet
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more