Skip to content

Commit 0a08e66

Browse files
authored
RINEX2BIN: special options (#302)
* introduce option to skip header serialization * introduce option for a custom header message Signed-off-by: Guillaume W. Bres <[email protected]>
1 parent 08f1c6a commit 0a08e66

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

rinex/src/binex/rnx2bin/mod.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ pub struct RNX2BIN<'a> {
3838
header: &'a Header,
3939
/// RINEX [TypeDependentStreamer]
4040
streamer: TypeDependentStreamer<'a>,
41+
/// Assert (before deployment) whether the Header should not be serialized (no default!)
42+
pub skip_header: bool,
43+
/// Define (before deployment) a custom message to be included in the announcement.
44+
pub custom_announce: Option<String>,
4145
}
4246

4347
#[derive(Debug, Default, Clone, Copy, PartialEq)]
@@ -58,9 +62,11 @@ impl<'a> Iterator for RNX2BIN<'a> {
5862
let content = match self.state {
5963
State::HeaderPkgVersion => {
6064
let mut geo = self.forge_monument_geo();
61-
geo.comments
62-
.push(format!("RNX2BIN from {}", self.header.rinex_type));
63-
geo.comments.push("STREAM starting!".to_string());
65+
if let Some(custom) = &self.custom_announce {
66+
geo.comments.push(custom.clone());
67+
}
68+
// announce stream beginning
69+
geo.comments.push("Stream starting!".to_string());
6470
self.state = State::MonumentGeo;
6571
Some(geo)
6672
},
@@ -87,7 +93,7 @@ impl<'a> Iterator for RNX2BIN<'a> {
8793
if let Some(_position) = &self.header.rx_position {
8894
//geo = geo.with_site_location();
8995
}
90-
if !self.header.comments.is_empty() {
96+
if !self.header.comments.is_empty() && !self.skip_header {
9197
self.state = State::AnnounceHeaderComments;
9298
} else {
9399
self.state = State::AnnounceRecord;
@@ -169,6 +175,8 @@ impl Rinex {
169175
meta,
170176
header: &self.header,
171177
state: State::default(),
178+
skip_header: false,
179+
custom_announce: Default::default(),
172180
streamer: TypeDependentStreamer::new(meta, self),
173181
})
174182
}

rinex/src/binex/rnx2bin/nav.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ impl<'a> Iterator for Streamer<'a> {
241241
_ => None,
242242
}
243243
};
244+
244245
let frame = frame?;
245246
Some(Message {
246247
meta: self.meta,

0 commit comments

Comments
 (0)