-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c92113a
commit fada239
Showing
5 changed files
with
225 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
[package] | ||
name = "sbf2rnx" | ||
version = "0.1.0" | ||
authors = ["Lars Næsbye Christensen <[email protected]"] | ||
authors = ["Lars Næsbye Christensen <[email protected]>"] | ||
edition = "2021" | ||
|
||
[dependencies] | ||
rinex = "0.15" | ||
thiserror = "1.0" | ||
clap = { version = "4.4.12", features = [] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ mod sbf; | |
use rinex::Rinex; | ||
use std::path::Path; | ||
use thiserror::Error; | ||
use clap::{arg, Command}; | ||
|
||
#[derive(Debug, Error)] | ||
pub enum Error { | ||
|
@@ -14,22 +15,28 @@ pub enum Error { | |
} | ||
|
||
pub fn main() -> Result<(), Error> { | ||
let filepath: &str = "../../tests/testdata/KMS3240s.22_"; | ||
let matches = Command::new("sbf2rnx") | ||
.version("0.1") | ||
.author("Lars Næsbye Christensen <[email protected]>") | ||
.about("Does awesome things") | ||
.arg(arg!(--i <VALUE>).required(true)) | ||
.get_matches(); | ||
let filepath: String = matches.get_one::<String>("i").unwrap().to_string(); | ||
let rinexrec = sbf2rnxrec(filepath); | ||
write_rnx_file(rinexrec); | ||
// write_rnx_file(rinexrec); | ||
return Ok(()); | ||
} | ||
|
||
fn sbf2rnxrec(filepath: &str) -> Rinex { | ||
fn sbf2rnxrec(filepath: String) -> Rinex { | ||
//! Build RINEX records and output them as files | ||
// For now we read the entire file as bytes before conversion - this uses more memory! | ||
|
||
let rrecord: Rinex = Rinex::default(); | ||
match std::fs::read(Path::new(&filepath).as_os_str()) { | ||
Ok(bytes) => { | ||
// for byte in bytes { | ||
// eprintln!("Read byte {}", byte); | ||
// } | ||
for byte in bytes { | ||
eprintln!("Read byte {}", byte); | ||
} | ||
} | ||
Err(e) => { | ||
if e.kind() == std::io::ErrorKind::NotFound { | ||
|
Oops, something went wrong.