pub struct GpsBricklet { /* private fields */ }
Expand description
Determine position, velocity and altitude using GPS
Implementations§
Source§impl GpsBricklet
impl GpsBricklet
pub const DEVICE_IDENTIFIER: u16 = 222u16
pub const DEVICE_DISPLAY_NAME: &'static str = "GPS Bricklet"
Sourcepub fn new(uid: Uid, connection: AsyncIpConnection) -> GpsBricklet
pub fn new(uid: Uid, connection: AsyncIpConnection) -> 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 sent 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 sent 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_api_version(&self) -> [u8; 3]
pub fn get_api_version(&self) -> [u8; 3]
Returns the version of the API definition (major, minor, revision) implemented by this API bindings. This is neither the release version of this API bindings nor does it tell you anything about the represented Brick or Bricklet.
Sourcepub async fn get_coordinates_callback_receiver(
&mut self,
) -> impl Stream<Item = CoordinatesEvent>
pub async fn get_coordinates_callback_receiver( &mut self, ) -> impl Stream<Item = CoordinatesEvent>
This receiver is triggered periodically with the period that is set by
set_coordinates_callback_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 async fn get_status_callback_receiver(
&mut self,
) -> impl Stream<Item = StatusEvent>
pub async fn get_status_callback_receiver( &mut self, ) -> impl Stream<Item = StatusEvent>
This receiver is triggered periodically with the period that is set by
[set_status_callback_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 async fn get_altitude_callback_receiver(
&mut self,
) -> impl Stream<Item = AltitudeEvent>
pub async fn get_altitude_callback_receiver( &mut self, ) -> impl Stream<Item = AltitudeEvent>
This receiver is triggered periodically with the period that is set by
[set_altitude_callback_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 async fn get_motion_callback_receiver(
&mut self,
) -> impl Stream<Item = MotionEvent>
pub async fn get_motion_callback_receiver( &mut self, ) -> impl Stream<Item = MotionEvent>
This receiver is triggered periodically with the period that is set by
[set_motion_callback_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 async fn get_date_time_callback_receiver(
&mut self,
) -> impl Stream<Item = DateTimeEvent>
pub async fn get_date_time_callback_receiver( &mut self, ) -> impl Stream<Item = DateTimeEvent>
This receiver is triggered periodically with the period that is set by
[set_date_time_callback_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 async fn get_coordinates(&mut self) -> Result<Coordinates, TinkerforgeError>
pub async fn get_coordinates(&mut self) -> Result<Coordinates, TinkerforgeError>
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.
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
[get_status
].
Sourcepub async fn get_status(&mut self) -> Result<Status, TinkerforgeError>
pub async fn get_status(&mut self) -> Result<Status, TinkerforgeError>
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:
- GPS_BRICKLET_FIX_NO_FIX
- GPS_BRICKLET_FIX_2D_FIX
- GPS_BRICKLET_FIX_3D_FIX
Sourcepub async fn get_altitude(&mut self) -> Result<Altitude, TinkerforgeError>
pub async fn get_altitude(&mut self) -> Result<Altitude, TinkerforgeError>
Returns the current altitude and corresponding geoidal separation.
This data is only valid if there is currently a fix as indicated by
[get_status
].
Sourcepub async fn get_motion(&mut self) -> Result<Motion, TinkerforgeError>
pub async fn get_motion(&mut self) -> Result<Motion, TinkerforgeError>
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
[get_status
].
Sourcepub async fn get_date_time(&mut self) -> Result<DateTime, TinkerforgeError>
pub async fn get_date_time(&mut self) -> Result<DateTime, TinkerforgeError>
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.
Sourcepub async fn restart(
&mut self,
restart_type: u8,
) -> Result<(), TinkerforgeError>
pub async fn restart( &mut self, restart_type: u8, ) -> Result<(), TinkerforgeError>
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:
- GPS_BRICKLET_RESTART_TYPE_HOT_START
- GPS_BRICKLET_RESTART_TYPE_WARM_START
- GPS_BRICKLET_RESTART_TYPE_COLD_START
- GPS_BRICKLET_RESTART_TYPE_FACTORY_RESET
Sourcepub async fn set_coordinates_callback_period(
&mut self,
period: u32,
) -> Result<(), TinkerforgeError>
pub async fn set_coordinates_callback_period( &mut self, period: u32, ) -> Result<(), TinkerforgeError>
Sets the period 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.
Sourcepub async fn get_coordinates_callback_period(
&mut self,
) -> Result<u32, TinkerforgeError>
pub async fn get_coordinates_callback_period( &mut self, ) -> Result<u32, TinkerforgeError>
Returns the period as set by [set_coordinates_callback_period
].
Sourcepub async fn set_status_callback_period(
&mut self,
period: u32,
) -> Result<(), TinkerforgeError>
pub async fn set_status_callback_period( &mut self, period: u32, ) -> Result<(), TinkerforgeError>
Sets the period 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.
Sourcepub async fn get_status_callback_period(
&mut self,
) -> Result<u32, TinkerforgeError>
pub async fn get_status_callback_period( &mut self, ) -> Result<u32, TinkerforgeError>
Returns the period as set by [set_status_callback_period
].
Sourcepub async fn set_altitude_callback_period(
&mut self,
period: u32,
) -> Result<(), TinkerforgeError>
pub async fn set_altitude_callback_period( &mut self, period: u32, ) -> Result<(), TinkerforgeError>
Sets the period 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.
Sourcepub async fn get_altitude_callback_period(
&mut self,
) -> Result<u32, TinkerforgeError>
pub async fn get_altitude_callback_period( &mut self, ) -> Result<u32, TinkerforgeError>
Returns the period as set by [set_altitude_callback_period
].
Sourcepub async fn set_motion_callback_period(
&mut self,
period: u32,
) -> Result<(), TinkerforgeError>
pub async fn set_motion_callback_period( &mut self, period: u32, ) -> Result<(), TinkerforgeError>
Sets the period 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.
Sourcepub async fn get_motion_callback_period(
&mut self,
) -> Result<u32, TinkerforgeError>
pub async fn get_motion_callback_period( &mut self, ) -> Result<u32, TinkerforgeError>
Returns the period as set by [set_motion_callback_period
].
Sourcepub async fn set_date_time_callback_period(
&mut self,
period: u32,
) -> Result<(), TinkerforgeError>
pub async fn set_date_time_callback_period( &mut self, period: u32, ) -> Result<(), TinkerforgeError>
Sets the period 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.
Sourcepub async fn get_date_time_callback_period(
&mut self,
) -> Result<u32, TinkerforgeError>
pub async fn get_date_time_callback_period( &mut self, ) -> Result<u32, TinkerforgeError>
Returns the period as set by [set_date_time_callback_period
].
Sourcepub async fn get_identity(&mut self) -> Result<Identity, TinkerforgeError>
pub async fn get_identity(&mut self) -> Result<Identity, TinkerforgeError>
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. |device_identifier_constant|
Trait Implementations§
Source§impl Clone for GpsBricklet
impl Clone for GpsBricklet
Source§fn clone(&self) -> GpsBricklet
fn clone(&self) -> GpsBricklet
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more