yahboom_gps
is a Rust library for initializing and reading GPS data from a Yahboom GPS module via a serial port.
Add this to your Cargo.toml
:
[dependencies]
yahboom_gps = "0.1.0"
Here is a complete example demonstrating how to use the yahboom_gps
library to initialize the GPS module, read GPS messages, and parse GPS data.
use yahboom_gps::{gps_init, read_complete_gps_message, parse_gps_data};
use anyhow::Result;
fn main() -> Result<()> {
// Initialize the GPS module
let mut port = gps_init("COM3", 9600)?;
// Continuously read and parse GPS messages
while let Ok(Some(message)) = read_complete_gps_message(&mut port) {
// Parse the GPS data
let parsed_data = parse_gps_data(&message);
// Print the parsed GPS data
println!("Parsed GPS Data: {}", serde_json::to_string_pretty(&parsed_data)?);
println!("--- End of message ---");
}
Ok(())
}
For more detailed documentation, please visit docs.rs.
This project is licensed under the Apache License 2.0. See the LICENSE file for more details.
Contributions are welcome! Please feel free to submit a pull request or open an issue.
If you have any questions or suggestions, please feel free to contact me at [401].