Crates.io | binex |
lib.rs | binex |
version | 0.4.0 |
source | src |
created_at | 2024-10-10 18:40:57.813009 |
updated_at | 2024-11-09 15:57:25.097609 |
description | BINEX Binary RINEX encoder and decoder |
homepage | https://github.com/georust/rinex |
repository | https://github.com/georust/rinex |
max_upload_size | |
id | 1404114 |
size | 238,616 |
BINEX is a simple library to decode and encode BINEX messages.
BINEX stands for BINary EXchange and is the "real time" stream oriented
version of the RINEX format. It is to this day, the only open source protocol
to encode GNSS and navigation data.
While RINEX is readable and based on line termination, BINEX is real-time and hardware orientated (at the GNSS receiver firmware level).
This library allows easy message encoding and decoding, and aims at providing seamless convertion from RINEX back and forth.
You have two scenarios to approach a BINEX stream:
use our Decoder object, which works on I/O interface directly and can represent a stream of continuous of either Messages (open source) or undisclosed elements. (private prototypes)
or use Message::decode to work on your own buffer directly.
Use the BINEX Decoder
to decode a Readable
interface streaming
BINEX messages. Decoder exposes both open source Messages that
were fully interprated and closed source Messages (undisclosed prototypes)
that it cannot interprate:
use std::fs::File;
use binex::prelude::{Decoder, StreamElement, Provider, Error};
let fd = File::open("../test_resources/BIN/mfle20190130.bnx")
.unwrap();
let mut decoder = Decoder::new(fd);
loop {
match decoder.next() {
Some(Ok(StreamElement::OpenSource(msg))) => {
// fully interprated element
},
Some(Ok(StreamElement::ClosedSource(element))) => {
// grab content you will need to interpate
let closed_meta = element.closed_meta;
let open_meta = closed_meta.open_meta;
// verify this is your organization
if closed_meta.provider == Provider::JPL {
// grab fields that you probably need to decode
let big_endian = open_meta.big_endian;
let is_reversed = open_meta.reversed;
let enhanced_crc = open_meta.enhanced_crc;
let mid = closed_meta.mid; // message ID
let mlen = closed_meta.mlen; // total message length
let chunk_size = closed_meta.size; // chunk length
// now, proceed to interpretation of this element,
// using undisclosed method
element.interprate(&|data| {
match mid {
_ => {},
}
});
}
},
Some(Err(e)) => {
// it is possible that some frames may not
// be supported yet.
// Any I/O error should not happen.
},
None => {
// end of stream
break;
},
}
}
The BINEX library allows easy message forging. Each message can be easily encoded and then
streamed into a Writable
interface:
Licensed under either of: